diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index de8fcaf3d..000000000 --- a/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# uniffi-generated MatrixRTC SDK bindings, vendored by scripts/sync-matrix-rtc-sdk.sh -src/matrix-rtc-sdk/generated/** linguist-generated=true -src/matrix-rtc-sdk/generated/**/*.wasm binary diff --git a/.github/workflows/build-element-call.yaml b/.github/workflows/build-element-call.yaml index f4071975e..838ef95bc 100644 --- a/.github/workflows/build-element-call.yaml +++ b/.github/workflows/build-element-call.yaml @@ -42,6 +42,14 @@ jobs: with: cache: "pnpm" node-version-file: ".node-version" + - name: Authenticate to GitHub Packages + # The MatrixRTC SDK (@billcarsonfr/matrix-rtc, see .npmrc) is on the GitHub + # Packages npm registry, which needs a token with read:packages even for + # public packages. A workflow's GITHUB_TOKEN only reaches packages of its own + # repository, so this is a personal access token kept as a repository secret. + env: + NPM_REGISTRY_TOKEN: ${{ secrets.MATRIX_RTC_NPM_TOKEN }} + run: echo "//npm.pkg.github.com/:_authToken=${NPM_REGISTRY_TOKEN}" >> ~/.npmrc - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3fe10723d..babb65c94 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -102,6 +102,14 @@ jobs: with: cache: "pnpm" node-version-file: ".node-version" + - name: Authenticate to GitHub Packages + # The MatrixRTC SDK (@billcarsonfr/matrix-rtc, see .npmrc) is on the GitHub + # Packages npm registry, which needs a token with read:packages even for + # public packages. A workflow's GITHUB_TOKEN only reaches packages of its own + # repository, so this is a personal access token kept as a repository secret. + env: + NPM_REGISTRY_TOKEN: ${{ secrets.MATRIX_RTC_NPM_TOKEN }} + run: echo "//npm.pkg.github.com/:_authToken=${NPM_REGISTRY_TOKEN}" >> ~/.npmrc - name: Install dependencies run: "pnpm install --frozen-lockfile --ignore-pnpmfile" - name: Build Storybook diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index ad92e7d1a..d8bce7f06 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,6 +17,14 @@ jobs: with: cache: "pnpm" node-version-file: ".node-version" + - name: Authenticate to GitHub Packages + # The MatrixRTC SDK (@billcarsonfr/matrix-rtc, see .npmrc) is on the GitHub + # Packages npm registry, which needs a token with read:packages even for + # public packages. A workflow's GITHUB_TOKEN only reaches packages of its own + # repository, so this is a personal access token kept as a repository secret. + env: + NPM_REGISTRY_TOKEN: ${{ secrets.MATRIX_RTC_NPM_TOKEN }} + run: echo "//npm.pkg.github.com/:_authToken=${NPM_REGISTRY_TOKEN}" >> ~/.npmrc - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 7ba5f424a..683b1a5d4 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -19,6 +19,14 @@ jobs: with: cache: "pnpm" node-version-file: ".node-version" + - name: Authenticate to GitHub Packages + # The MatrixRTC SDK (@billcarsonfr/matrix-rtc, see .npmrc) is on the GitHub + # Packages npm registry, which needs a token with read:packages even for + # public packages. A workflow's GITHUB_TOKEN only reaches packages of its own + # repository, so this is a personal access token kept as a repository secret. + env: + NPM_REGISTRY_TOKEN: ${{ secrets.MATRIX_RTC_NPM_TOKEN }} + run: echo "//npm.pkg.github.com/:_authToken=${NPM_REGISTRY_TOKEN}" >> ~/.npmrc - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" @@ -65,6 +73,14 @@ jobs: with: cache: "pnpm" node-version-file: ".node-version" + - name: Authenticate to GitHub Packages + # The MatrixRTC SDK (@billcarsonfr/matrix-rtc, see .npmrc) is on the GitHub + # Packages npm registry, which needs a token with read:packages even for + # public packages. A workflow's GITHUB_TOKEN only reaches packages of its own + # repository, so this is a personal access token kept as a repository secret. + env: + NPM_REGISTRY_TOKEN: ${{ secrets.MATRIX_RTC_NPM_TOKEN }} + run: echo "//npm.pkg.github.com/:_authToken=${NPM_REGISTRY_TOKEN}" >> ~/.npmrc - name: Install dependencies # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: pnpm install --frozen-lockfile --ignore-pnpmfile diff --git a/.github/workflows/translations-download.yaml b/.github/workflows/translations-download.yaml index f61a44c59..9b9d204ff 100644 --- a/.github/workflows/translations-download.yaml +++ b/.github/workflows/translations-download.yaml @@ -25,6 +25,14 @@ jobs: cache: "pnpm" node-version-file: ".node-version" + - name: Authenticate to GitHub Packages + # The MatrixRTC SDK (@billcarsonfr/matrix-rtc, see .npmrc) is on the GitHub + # Packages npm registry, which needs a token with read:packages even for + # public packages. A workflow's GITHUB_TOKEN only reaches packages of its own + # repository, so this is a personal access token kept as a repository secret. + env: + NPM_REGISTRY_TOKEN: ${{ secrets.MATRIX_RTC_NPM_TOKEN }} + run: echo "//npm.pkg.github.com/:_authToken=${NPM_REGISTRY_TOKEN}" >> ~/.npmrc - name: Install Deps # ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present) run: "pnpm install --frozen-lockfile --ignore-pnpmfile" diff --git a/.npmrc b/.npmrc new file mode 100644 index 000000000..9cd6995e5 --- /dev/null +++ b/.npmrc @@ -0,0 +1,9 @@ +# The MatrixRTC SDK (`@element-hq/matrix-rtc`, aliased in package.json to the +# name the fork's CI publishes it under) comes from the GitHub Packages npm +# registry, which needs a token with `read:packages` even for public +# packages. This is a stop-gap while the SDK is in flux; once it is published +# to npmjs.com this file and the alias go away (docs/matrix_rtc_sdk.md). +# Only the scope->registry mapping lives here; the token goes in your +# user-level npm config (~/.npmrc), never in this file. CI writes it there +# from a repository secret (see .github/workflows). +@billcarsonfr:registry=https://npm.pkg.github.com diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 44be81943..20bac1bf8 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -2,10 +2,5 @@ "$schema": "./node_modules/oxfmt/configuration_schema.json", "printWidth": 80, "sortPackageJson": false, - "ignorePatterns": [ - "pnpm-lock.yaml", - "node_modules", - "dist", - "src/matrix-rtc-sdk/generated" - ] + "ignorePatterns": ["pnpm-lock.yaml", "node_modules", "dist"] } diff --git a/.oxlintrc.json b/.oxlintrc.json index cf1cef833..c89ab8a28 100644 --- a/.oxlintrc.json +++ b/.oxlintrc.json @@ -28,9 +28,6 @@ "env": { "builtin": true }, - // uniffi-generated bindings and wasm-bindgen glue, vendored by - // scripts/sync-matrix-rtc-sdk.sh; not ours to lint - "ignorePatterns": ["src/matrix-rtc-sdk/generated/**"], "rules": { "element-call/copyright-header": [ "error", diff --git a/README.md b/README.md index 84910ed57..c5dbc0a1a 100644 --- a/README.md +++ b/README.md @@ -206,6 +206,19 @@ corepack enable pnpm install ``` +`pnpm install` currently needs a GitHub token: the MatrixRTC SDK +(`@element-hq/matrix-rtc`) is, as a stop-gap until it is published to npmjs.com, +an npm package on the GitHub Packages registry, which rejects anonymous +requests even for public packages. Create a classic personal access token with +the `read:packages` scope and add it to your user-level npm config once: + +```sh +echo "//npm.pkg.github.com/:_authToken=" >> ~/.npmrc +``` + +See [The MatrixRTC SDK package](./docs/matrix_rtc_sdk.md) for the details, CI +setup and developing against a local crate. + To use it, create a local config by, e.g., `cp ./config/config.devenv.json ./public/config.json` and adapt it if necessary. The `config.devenv.json` config should work with the backend development @@ -220,6 +233,7 @@ pnpm dev See also: - [Developing with linked packages](./docs/linking.md) +- [The MatrixRTC SDK package](./docs/matrix_rtc_sdk.md) #### Element Call as a component (experimental) @@ -298,7 +312,9 @@ The package is not published yet. A host installs it as a git dependency on the whose `prepare` script runs the build on install. That build needs pnpm (via Corepack) on the host's machine, runs a full `pnpm install` of this repository -and is memory-hungry, since it inherits the `--max-old-space-size` setting of +(so the host needs the GitHub Packages token described in +[The MatrixRTC SDK package](./docs/matrix_rtc_sdk.md) as well) and is +memory-hungry, since it inherits the `--max-old-space-size` setting of the app build; the host's pnpm also has to allow it to run at all (`allowBuilds` in its `pnpm-workspace.yaml`). Note that `component/` is a pnpm project of its own for this reason, so pnpm commands run from inside that diff --git a/docs/README.md b/docs/README.md index 8bd148462..84bcb2d24 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,6 +9,7 @@ This folder contains documentation for setup, usage, and development of Element - [MatrixRTC modes](./matrix_rtc_modes.md) - [Self-Hosting](./self_hosting.md) - [Developing with linked packages](./linking.md) +- [The MatrixRTC SDK package](./matrix_rtc_sdk.md) (registry token, CI, local crate) ### Writing code for Element Call (agent-readable conventions) diff --git a/docs/linking.md b/docs/linking.md index 3a18844d4..a792d7dd9 100644 --- a/docs/linking.md +++ b/docs/linking.md @@ -29,6 +29,9 @@ Instead, create a file named `.links.cjs` in the Element Call project directory module.exports = { "matrix-js-sdk": "../your/path/matrix-js-sdk", "matrix-widget-api": "../your/path/matrix-widget-api", + // The MatrixRTC SDK: run `npm run build` in that directory first + "@element-hq/matrix-rtc": + "../your/path/matrix-rust-rtc/MatrixSdkArchitectureDraft/web-test-app", }; ``` diff --git a/docs/matrix_rtc_sdk.md b/docs/matrix_rtc_sdk.md new file mode 100644 index 000000000..1f155683c --- /dev/null +++ b/docs/matrix_rtc_sdk.md @@ -0,0 +1,135 @@ +# The MatrixRTC SDK package + +Element Call's MatrixRTC logic (session membership, keep-alive, transport +tokens, media key exchange) runs in the Rust `matrix-rtc` crate, compiled to +WebAssembly and shipped as the npm package `@element-hq/matrix-rtc`. The +package is built and published by the +[`npm-web-bindings.yml`](https://github.com/element-hq/matrix-rust-rtc/blob/main/.github/workflows/npm-web-bindings.yml) +workflow of the `matrix-rust-rtc` repository, from its +`MatrixSdkArchitectureDraft/web-test-app` directory. Element Call loads it in +`src/matrix-rtc-sdk/index.ts`, the only module that imports the package +directly. + +## Where the package comes from + +For now the package lives on the **GitHub Packages** npm registry +(`https://npm.pkg.github.com`), not on npmjs.com. **This is a stop-gap** for +the phase in which the crate's API still changes with every push: publishing +from the crate's CI into a registry that comes with the repository needs no +account or secret upstream, and nothing else consumes the package yet. Once +the SDK is ready for consumers beyond Element Call, it should be published to +**npmjs.com** as `@element-hq/matrix-rtc`, which makes everything in this +document about tokens and scopes go away: `pnpm install` works anonymously +again, forks and Renovate can install, component hosts need no setup, and the +alias in `package.json` and the scope line in `.npmrc` are deleted. + +Until then, two properties of GitHub Packages shape the setup below: + +- **Every request needs a token**, including reads of public packages. There + is no anonymous install. +- **A package is scoped to the owner of the repository whose CI published + it.** While the crate is developed on the `BillCarsonFr` fork, the package is + published as `@billcarsonfr/matrix-rtc`; once it is published from + `element-hq/matrix-rust-rtc` it becomes `@element-hq/matrix-rtc`. + +So that the code does not have to change when that happens, `package.json` +installs the fork's package under the final name: + +```json +"@element-hq/matrix-rtc": "npm:@billcarsonfr/matrix-rtc@next" +``` + +and the repository's `.npmrc` maps only the scope to the registry: + +```ini +@billcarsonfr:registry=https://npm.pkg.github.com +``` + +When the package moves to `element-hq`, change the alias to the plain package +and the scope line in `.npmrc` accordingly; nothing else in the repository +refers to the fork's name. + +## Setting up your machine + +1. Create a **personal access token (classic)** at + with only the `read:packages` scope. + Fine-grained tokens do not work with GitHub Packages. +2. Add it to your **user-level** npm config. Never put it in the repository's + `.npmrc`: + + ```sh + echo "//npm.pkg.github.com/:_authToken=" >> ~/.npmrc + ``` + +3. Run `pnpm install` as usual. + +Without the token, `pnpm install` fails while resolving +`@billcarsonfr/matrix-rtc` with a `401` or `404` from `npm.pkg.github.com`; +that error always means "no or wrong token", never "the package does not +exist". + +## CI and other consumers + +A workflow's built-in `GITHUB_TOKEN` can only read packages owned by the +repository's own owner, so element-hq's workflows cannot read a package owned +by the `BillCarsonFr` user. The workflows that run `pnpm install` therefore +write a personal access token from the repository secret +`MATRIX_RTC_NPM_TOKEN` (scope `read:packages`) to `~/.npmrc` before installing. +Keep in mind: + +- **Pull requests from forks and from Renovate do not receive secrets**, so + their installs fail until the package is readable with the built-in token. +- **Hosts of the [component](../README.md#element-call-as-a-component-experimental)** + install it as a git dependency whose `prepare` script runs + `pnpm install --frozen-lockfile` in this repository, so they need the same + token in their `~/.npmrc` or CI. + +Publishing from `element-hq/matrix-rust-rtc` (and granting the Element Call +repository access to the package) would let the built-in token work for +element-hq's own workflows, but that only patches the CI case. The intended end +state is the npmjs.com publication described above, which removes the token +requirement for everyone. + +## Versions + +The package version tracks the crate's `Cargo.toml`. Every push to the tracked +branches of `matrix-rust-rtc` publishes a `next` pre-release named +`-next..`, and a `matrix-rtc-v` tag +publishes `latest`. Element Call follows `next`; `pnpm install` picks up a new +pre-release only when the lockfile is updated, e.g. with +`pnpm update @element-hq/matrix-rtc`. + +The publish job runs only after the crate's own `cargo test` job passed on a +_push_ (pull-request runs never publish). If a `next` build you expect is +missing, check that workflow's push runs for a failed crate job and re-run it; +its tests are known to be timing-sensitive. + +## Developing against a local crate checkout + +To run Element Call against a crate you are changing, build the package there +and link it, instead of waiting for CI: + +```sh +cd ../matrix-rust-rtc/MatrixSdkArchitectureDraft/web-test-app +npm install && npm run build # produces dist/ +``` + +then add it to `.links.cjs` in this repository and run `pnpm links:on`, as +described in [Developing with linked packages](./linking.md): + +```cjs +"@element-hq/matrix-rtc": "../matrix-rust-rtc/MatrixSdkArchitectureDraft/web-test-app", +``` + +`pnpm links:off` restores the registry package before committing. + +## How the wasm is loaded + +`initMatrixRtcSdk()` in `src/matrix-rtc-sdk/index.ts` is the single entry +point: it awaits the package's `initAsync`, then installs the log sink that +routes the crate's logs into Element Call's logger. The wasm is imported as +`@element-hq/matrix-rtc/wasm?url`, so the app builds emit it as an asset next +to the other `.wasm` files and the component build inlines it. Unit tests read +the bytes from the installed package instead (`src/utils/test-matrix-rtc.ts`), +since vitest has no server to fetch from. A component host can point at a copy +it serves itself through `initializeElementCall(config, { matrixRtcWasm })`. diff --git a/element-call-oxidation-plan.md b/element-call-oxidation-plan.md index df5aaf74f..38a541a8f 100644 --- a/element-call-oxidation-plan.md +++ b/element-call-oxidation-plan.md @@ -59,8 +59,9 @@ files it touches are listed there. `src/utils/logger.ts` (S6) so a later swap is one line. - Writing a matrix-rust-sdk-backed driver (Element X). The interface is shaped so one can be written; none is written here. -- Publishing the crate as an npm package. Until it exists, the generated - bindings are vendored (§5.1). +- Publishing the crate as an npm package: done upstream (`@element-hq/matrix-rtc`, + built and published by `npm-web-bindings.yml` in matrix-rust-rtc; consumed + here since 2026-09-16, §5.1). - Turning on MSC4153 (cross-signed sender) enforcement. Parity first (§5.8). --- @@ -501,13 +502,24 @@ RateLimited`, 403 → `Rejected`, 404/`M_UNRECOGNIZED` → `Unsupported`. ## 5. Decisions and assumptions -1. **Vendored bindings.** `src/matrix-rtc-sdk/generated/` holds `matrix_rtc.ts`, - `matrix_rtc-ffi.ts`, `wasm-bindgen/index.js`, `index_bg.wasm` and a - hand-written `wasm-bindgen/index.d.ts` (no `allowJs` in `tsconfig.json`), - synced by `scripts/sync-matrix-rtc-sdk.sh` (runs `ubrn build web` in the - draft **without** the `runtime-probe` feature, copies). Committed so CI - works. `@ubjs/core` becomes a dependency. The wasm is ~6.5 MB unoptimised. - **Assumption:** committing the binary is acceptable for the draft phase. +1. **The SDK is an npm package.** `@element-hq/matrix-rtc` (the draft's + `web-test-app/`, built by `npm-web-bindings.yml`: uniffi bindings, the + wasm-bindgen glue, a `wasm-opt`'d ~760 KB wasm, `.d.ts`, and `@ubjs/core` + as its own dependency) is a devDependency, aliased in `package.json` to + `@billcarsonfr/matrix-rtc@next` while it is published from the fork, so + the imports already say `@element-hq/matrix-rtc`. It lives on the GitHub + Packages registry: `.npmrc` maps the scope, a `read:packages` token goes + in `~/.npmrc` (CI: the `MATRIX_RTC_NPM_TOKEN` secret). **The GitHub + Packages registry is a stop-gap** for the phase in which the crate's API + moves with every push; once the SDK is ready for consumers beyond Element + Call it belongs on npmjs.com as `@element-hq/matrix-rtc`, which drops the + alias, `.npmrc`, the CI secret and every token requirement + (`docs/matrix_rtc_sdk.md`). `src/matrix-rtc-sdk/` + keeps only the loader (`initMatrixRtcSdk`: package `initAsync` + our log + sink, wasm via `@element-hq/matrix-rtc/wasm?url`) and the curated + re-exports. _History:_ until 2026-09-16 the bindings were vendored under + `src/matrix-rtc-sdk/generated/` by `scripts/sync-matrix-rtc-sdk.sh`; local + crate work now goes through `pnpm links:on` (`docs/linking.md`). 2. **Wasm loading.** Verified: Vite 8 library mode inlines `?url` and `new URL(…, import.meta.url)` assets as base64 regardless of `assetsInlineLimit`; `?url&no-inline` emits a file. App builds use `?url`; @@ -599,12 +611,14 @@ Gate: `cargo test --features uniffi`, `cargo clippy --all-targets --features uni ### S0b — SDK intake ☑ -- `scripts/sync-matrix-rtc-sdk.sh`, `src/matrix-rtc-sdk/generated/**`, +- ~~`scripts/sync-matrix-rtc-sdk.sh`, `src/matrix-rtc-sdk/generated/**`~~ + (replaced by the `@element-hq/matrix-rtc` package on 2026-09-16, §5.1), `src/matrix-rtc-sdk/index.ts` (loader + curated re-exports), `src/matrix-rtc-sdk/index.test.ts` (boot, one join round-trip against the TS mock driver). -- `package.json` (`@ubjs/core`), `knip.ts` (`ignore` for `generated/**`), - `.oxlintrc.json` `ignorePatterns`, `.oxfmtrc.json` ignore, +- `package.json` (~~`@ubjs/core`~~ now `@element-hq/matrix-rtc`; the + `generated/**` carve-outs in `knip.ts`, `.oxlintrc.json`, `.oxfmtrc.json`, + `vitest.config.ts` and `.gitattributes` went with the vendored files), `vite.config.ts` (nothing needed for `?url`; verified `vite-plugin-wasm` ignores it), `tsconfig.json` untouched thanks to the `.d.ts`. - Gate: `pnpm lint && pnpm format:check && pnpm test:unit`. diff --git a/knip.ts b/knip.ts index 200dbb426..951af9a42 100644 --- a/knip.ts +++ b/knip.ts @@ -26,10 +26,7 @@ export default { // This is a shell built-in. "printf", ], - // uniffi-generated bindings (scripts/sync-matrix-rtc-sdk.sh): every - // export the crate has, most of them unused here by design ignore: [ - "src/matrix-rtc-sdk/generated/**", // The host-facing driver seam, landed ahead of its consumers (the // `CallParticipation` layer and the hosts, see element-call-oxidation-plan.md) "src/driver/**", diff --git a/package.json b/package.json index 7bfe8dc1c..49d056c8d 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ }, "devDependencies": { "@codecov/vite-plugin": "^1.3.0", + "@element-hq/matrix-rtc": "npm:@billcarsonfr/matrix-rtc@next", "@fontsource/inconsolata": "^5.1.0", "@fontsource/inter": "^5.1.0", "@formatjs/intl-durationformat": "^0.10.0", @@ -82,7 +83,6 @@ "@types/react-dom": "^19.0.0", "@types/sdp-transform": "^2.4.5", "@typescript-eslint/utils": "^8.61.0", - "@ubjs/core": "0.31.0-5", "@use-gesture/react": "^10.2.11", "@vector-im/compound-design-tokens": "^10.0.0", "@vector-im/compound-web": "^10.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e80c0a9ec..57e103183 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -25,6 +25,9 @@ importers: '@codecov/vite-plugin': specifier: ^1.3.0 version: 1.9.1(vite@8.2.2(@types/node@24.13.3)(esbuild@0.28.2)(jiti@2.7.0)(sass@1.103.1)(terser@5.46.1)(yaml@2.9.0)) + '@element-hq/matrix-rtc': + specifier: npm:@billcarsonfr/matrix-rtc@next + version: '@billcarsonfr/matrix-rtc@0.1.0-next.7.c5a5a80(matrix-js-sdk@https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/24929be0e741be6a5d0a7226f1c682e245263b8a)' '@fontsource/inconsolata': specifier: ^5.1.0 version: 5.3.0 @@ -127,9 +130,6 @@ importers: '@typescript-eslint/utils': specifier: ^8.61.0 version: 8.69.0(eslint@8.57.1(supports-color@7.2.0))(supports-color@7.2.0)(typescript@5.9.3) - '@ubjs/core': - specifier: 0.31.0-5 - version: 0.31.0-5 '@use-gesture/react': specifier: ^10.2.11 version: 10.3.1(react@19.2.8) @@ -412,6 +412,13 @@ packages: resolution: {integrity: sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==} engines: {node: '>=18'} + '@billcarsonfr/matrix-rtc@0.1.0-next.7.c5a5a80': + resolution: {integrity: sha512-6Ti4jQZahHPI2Y9F/6dUplSEvoDdWP0OTLJXFUe708YFa13nRwW3t7QoRRbsSB5O0eWQHwu9hHVJQHEjpx4EwA==, tarball: https://npm.pkg.github.com/download/@billcarsonfr/matrix-rtc/0.1.0-next.7.c5a5a80/55919d699c12752b2316ad6d97a00c4b78088057} + version: 0.1.0-next.7.c5a5a80 + engines: {node: '>=20'} + peerDependencies: + matrix-js-sdk: '>=42' + '@blazediff/core@1.9.1': resolution: {integrity: sha512-ehg3jIkYKulZh+8om/O25vkvSsXXwC+skXmyA87FFx6A/45eqOkZsBltMw/TVteb0mloiGT8oGRTcjRAz66zaA==} @@ -6365,6 +6372,11 @@ snapshots: '@bcoe/v8-coverage@1.0.2': {} + '@billcarsonfr/matrix-rtc@0.1.0-next.7.c5a5a80(matrix-js-sdk@https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/24929be0e741be6a5d0a7226f1c682e245263b8a)': + dependencies: + '@ubjs/core': 0.31.0-5 + matrix-js-sdk: https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/24929be0e741be6a5d0a7226f1c682e245263b8a + '@blazediff/core@1.9.1': {} '@bufbuild/protobuf@1.10.1': {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 9e4f0fd6f..85113e126 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -3,6 +3,8 @@ supportedArchitectures: cpu: [current, arm64] libc: [current, glibc] minimumReleaseAgeExclude: + # The MatrixRTC SDK is consumed as `next` pre-releases straight from its CI + - "@billcarsonfr/matrix-rtc" - "@vector-im/compound-design-tokens" - "@vector-im/compound-web" - matrix-js-sdk diff --git a/scripts/sync-matrix-rtc-sdk.sh b/scripts/sync-matrix-rtc-sdk.sh deleted file mode 100755 index 29847f3cf..000000000 --- a/scripts/sync-matrix-rtc-sdk.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash -# -# Copyright 2026 Element Creations Ltd. -# -# SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial -# Please see LICENSE in the repository root for full details. -# -# Vendors the matrix-rtc crate's uniffi web bindings into -# src/matrix-rtc-sdk/generated/. Until the crate ships as an npm package this -# is how Element Call picks up a new build of it: build it there, copy the -# generated TypeScript, the wasm-bindgen glue and the wasm here. -# -# scripts/sync-matrix-rtc-sdk.sh [path-to-MatrixSdkArchitectureDraft] [--no-build] -# -# The build uses web-test-app/ubrn.element-call.config.yaml (feature `uniffi` -# only, release profile, its own output directory so the app's test build is -# left alone). Pass --no-build to copy whatever was built last. - -set -euo pipefail - -DRAFT="${1:-../matrix-rust-rtc/MatrixSdkArchitectureDraft}" -BUILD=1 -for arg in "$@"; do - [[ "$arg" == "--no-build" ]] && BUILD=0 -done - -APP="$DRAFT/web-test-app" -GENERATED="$APP/src/generated-element-call" -DEST="$(cd "$(dirname "$0")/.." && pwd)/src/matrix-rtc-sdk/generated" - -if [[ ! -f "$APP/ubrn.element-call.config.yaml" ]]; then - echo "No web-test-app/ubrn.element-call.config.yaml under $DRAFT" >&2 - exit 1 -fi - -if [[ "$BUILD" == 1 ]]; then - (cd "$APP" && npx ubrn build web --config ubrn.element-call.config.yaml --release) -fi - -mkdir -p "$DEST/wasm-bindgen" -cp "$GENERATED/matrix_rtc.ts" "$GENERATED/matrix_rtc-ffi.ts" "$DEST/" -cp "$GENERATED/wasm-bindgen/index.js" "$GENERATED/wasm-bindgen/index_bg.wasm" "$DEST/wasm-bindgen/" - -REV="$(git -C "$DRAFT" rev-parse --short HEAD 2>/dev/null || echo unknown)" -DIRTY="$(git -C "$DRAFT" status --porcelain 2>/dev/null | grep -q . && echo '-dirty' || true)" -cat > "$DEST/VERSION" < void; -export type UniffiForeignFutureDroppedCallback = (handle: bigint) => void; -export type UniffiForeignFutureDroppedCallbackStruct = { - handle: bigint; - free: UniffiForeignFutureDroppedCallback; -}; -type UniffiCallbackInterfaceMatrixRtcConnectionsListenerMethod0 = (uniffiHandle: bigint, connections: Uint8Array) => UniffiResult; -type UniffiCallbackInterfaceCloneMatrixRtcConnectionsListener = (handle: bigint) => UniffiResult; -type UniffiCallbackInterfaceFreeMatrixRtcConnectionsListener = (handle: bigint) => void; -export type UniffiVTableCallbackInterfaceMatrixRtcConnectionsListener = { - uniffi_free: UniffiCallbackInterfaceFreeMatrixRtcConnectionsListener; - uniffi_clone: UniffiCallbackInterfaceCloneMatrixRtcConnectionsListener; - on_connections_change: UniffiCallbackInterfaceMatrixRtcConnectionsListenerMethod0; -}; -type UniffiCallbackInterfaceMatrixRtcKeyMapListenerMethod0 = (uniffiHandle: bigint, keyMap: Uint8Array, change: Uint8Array) => UniffiResult; -type UniffiCallbackInterfaceCloneMatrixRtcKeyMapListener = (handle: bigint) => UniffiResult; -type UniffiCallbackInterfaceFreeMatrixRtcKeyMapListener = (handle: bigint) => void; -export type UniffiVTableCallbackInterfaceMatrixRtcKeyMapListener = { - uniffi_free: UniffiCallbackInterfaceFreeMatrixRtcKeyMapListener; - uniffi_clone: UniffiCallbackInterfaceCloneMatrixRtcKeyMapListener; - on_key_map_change: UniffiCallbackInterfaceMatrixRtcKeyMapListenerMethod0; -}; -type UniffiCallbackInterfaceMatrixRtcKeyRejectedListenerMethod0 = (uniffiHandle: bigint, memberId: Uint8Array, reason: Uint8Array) => UniffiResult; -type UniffiCallbackInterfaceCloneMatrixRtcKeyRejectedListener = (handle: bigint) => UniffiResult; -type UniffiCallbackInterfaceFreeMatrixRtcKeyRejectedListener = (handle: bigint) => void; -export type UniffiVTableCallbackInterfaceMatrixRtcKeyRejectedListener = { - uniffi_free: UniffiCallbackInterfaceFreeMatrixRtcKeyRejectedListener; - uniffi_clone: UniffiCallbackInterfaceCloneMatrixRtcKeyRejectedListener; - on_key_rejected: UniffiCallbackInterfaceMatrixRtcKeyRejectedListenerMethod0; -}; -type UniffiCallbackInterfaceMatrixRtcLogSinkMethod0 = (uniffiHandle: bigint, level: Uint8Array, target: Uint8Array, message: Uint8Array) => UniffiResult; -type UniffiCallbackInterfaceCloneMatrixRtcLogSink = (handle: bigint) => UniffiResult; -type UniffiCallbackInterfaceFreeMatrixRtcLogSink = (handle: bigint) => void; -export type UniffiVTableCallbackInterfaceMatrixRtcLogSink = { - uniffi_free: UniffiCallbackInterfaceFreeMatrixRtcLogSink; - uniffi_clone: UniffiCallbackInterfaceCloneMatrixRtcLogSink; - log: UniffiCallbackInterfaceMatrixRtcLogSinkMethod0; -}; -export type UniffiForeignFutureResultRustBuffer = { - return_value: Uint8Array; - call_status: UniffiRustCallStatus; -}; -export type UniffiForeignFutureCompleterustBuffer = (callbackData: bigint, result: UniffiForeignFutureResultRustBuffer) => void; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod0 = (uniffiHandle: bigint, roomId: Uint8Array, eventType: Uint8Array, contentJson: Uint8Array, durationMs: bigint, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod1 = (uniffiHandle: bigint, roomId: Uint8Array, eventType: Uint8Array, stateKey: Uint8Array, contentJson: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod2 = (uniffiHandle: bigint, roomId: Uint8Array, eventType: Uint8Array, contentJson: Uint8Array, delayMs: bigint, stickyDurationMs: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod3 = (uniffiHandle: bigint, roomId: Uint8Array, eventType: Uint8Array, stateKey: Uint8Array, contentJson: Uint8Array, delayMs: bigint, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -export type UniffiForeignFutureResultVoid = { - call_status: UniffiRustCallStatus; -}; -export type UniffiForeignFutureCompletevoid = (callbackData: bigint, result: UniffiForeignFutureResultVoid) => void; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod4 = (uniffiHandle: bigint, roomId: Uint8Array, delayId: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompletevoid, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod5 = (uniffiHandle: bigint, roomId: Uint8Array, delayId: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompletevoid, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod6 = (uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompletevoid, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod7 = (uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompletevoid, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod8 = (uniffiHandle: bigint, recipients: Uint8Array, eventType: Uint8Array, contentJson: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod9 = (uniffiHandle: bigint, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod10 = (uniffiHandle: bigint, request: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod11 = (uniffiHandle: bigint, eventType: Uint8Array, stateKey: Uint8Array, limit: number, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod12 = (uniffiHandle: bigint, eventType: Uint8Array, stateKey: Uint8Array, uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, uniffiCallbackData: bigint) => UniffiForeignFutureDroppedCallbackStruct; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod13 = (uniffiHandle: bigint, sink: bigint) => UniffiResult; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod14 = (uniffiHandle: bigint, sink: bigint) => UniffiResult; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod15 = (uniffiHandle: bigint, sink: bigint) => UniffiResult; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod16 = (uniffiHandle: bigint) => number; -type UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod17 = (uniffiHandle: bigint, sink: bigint) => UniffiResult; -type UniffiCallbackInterfaceCloneMatrixRtcMatrixDriverCallback = (handle: bigint) => UniffiResult; -type UniffiCallbackInterfaceFreeMatrixRtcMatrixDriverCallback = (handle: bigint) => void; -export type UniffiVTableCallbackInterfaceMatrixRtcMatrixDriverCallback = { - uniffi_free: UniffiCallbackInterfaceFreeMatrixRtcMatrixDriverCallback; - uniffi_clone: UniffiCallbackInterfaceCloneMatrixRtcMatrixDriverCallback; - send_sticky_event: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod0; - send_state_event: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod1; - send_delayed_event: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod2; - send_delayed_state_event: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod3; - restart_delayed_event: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod4; - cancel_delayed_event: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod5; - delegate_delayed_leave_via_homeserver: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod6; - delegate_delayed_leave_via_transport: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod7; - send_to_device: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod8; - get_rtc_transports: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod9; - get_livekit_token: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod10; - read_events: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod11; - read_state: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod12; - subscribe_room_events: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod13; - subscribe_to_device_events: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod14; - subscribe_state_updates: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod15; - is_homeserver_connected: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod16; - subscribe_connectivity: UniffiCallbackInterfaceMatrixRtcMatrixDriverCallbackMethod17; -}; -type UniffiCallbackInterfaceMatrixRtcMembershipsListenerMethod0 = (uniffiHandle: bigint, memberships: Uint8Array) => UniffiResult; -type UniffiCallbackInterfaceCloneMatrixRtcMembershipsListener = (handle: bigint) => UniffiResult; -type UniffiCallbackInterfaceFreeMatrixRtcMembershipsListener = (handle: bigint) => void; -export type UniffiVTableCallbackInterfaceMatrixRtcMembershipsListener = { - uniffi_free: UniffiCallbackInterfaceFreeMatrixRtcMembershipsListener; - uniffi_clone: UniffiCallbackInterfaceCloneMatrixRtcMembershipsListener; - on_memberships_change: UniffiCallbackInterfaceMatrixRtcMembershipsListenerMethod0; -}; -type UniffiCallbackInterfaceMatrixRtcSessionListenerMethod0 = (uniffiHandle: bigint, session: Uint8Array) => UniffiResult; -type UniffiCallbackInterfaceCloneMatrixRtcSessionListener = (handle: bigint) => UniffiResult; -type UniffiCallbackInterfaceFreeMatrixRtcSessionListener = (handle: bigint) => void; -export type UniffiVTableCallbackInterfaceMatrixRtcSessionListener = { - uniffi_free: UniffiCallbackInterfaceFreeMatrixRtcSessionListener; - uniffi_clone: UniffiCallbackInterfaceCloneMatrixRtcSessionListener; - on_session_change: UniffiCallbackInterfaceMatrixRtcSessionListenerMethod0; -}; -type UniffiCallbackInterfaceMatrixRtcStatusListenerMethod0 = (uniffiHandle: bigint, status: Uint8Array) => UniffiResult; -type UniffiCallbackInterfaceCloneMatrixRtcStatusListener = (handle: bigint) => UniffiResult; -type UniffiCallbackInterfaceFreeMatrixRtcStatusListener = (handle: bigint) => void; -export type UniffiVTableCallbackInterfaceMatrixRtcStatusListener = { - uniffi_free: UniffiCallbackInterfaceFreeMatrixRtcStatusListener; - uniffi_clone: UniffiCallbackInterfaceCloneMatrixRtcStatusListener; - on_status_change: UniffiCallbackInterfaceMatrixRtcStatusListenerMethod0; -}; \ No newline at end of file diff --git a/src/matrix-rtc-sdk/generated/matrix_rtc.ts b/src/matrix-rtc-sdk/generated/matrix_rtc.ts deleted file mode 100644 index d34986c1f..000000000 --- a/src/matrix-rtc-sdk/generated/matrix_rtc.ts +++ /dev/null @@ -1,9440 +0,0 @@ -// This file was autogenerated by some hot garbage in the `uniffi-bindgen-react-native` crate. -// Trust me, you don't want to mess with it! -/* tslint:disable */ -/* eslint-disable */ -// @ts-nocheck -import * as wasmBundle from "./wasm-bindgen/index.js"; -import { type UniffiRustFutureContinuationCallback, type UniffiForeignFutureDroppedCallback, type UniffiForeignFutureDroppedCallbackStruct, type UniffiVTableCallbackInterfaceMatrixRtcConnectionsListener, type UniffiVTableCallbackInterfaceMatrixRtcKeyMapListener, type UniffiVTableCallbackInterfaceMatrixRtcKeyRejectedListener, type UniffiVTableCallbackInterfaceMatrixRtcLogSink, type UniffiForeignFutureResultRustBuffer, type UniffiForeignFutureCompleterustBuffer, type UniffiForeignFutureResultVoid, type UniffiForeignFutureCompletevoid, type UniffiVTableCallbackInterfaceMatrixRtcMatrixDriverCallback, type UniffiVTableCallbackInterfaceMatrixRtcMembershipsListener, type UniffiVTableCallbackInterfaceMatrixRtcSessionListener, type UniffiVTableCallbackInterfaceMatrixRtcStatusListener, -} from "./matrix_rtc-ffi"; -import { type FfiConverter, type UniffiByteArray, type UniffiGcObject, type UniffiHandle, type UniffiObjectFactory, type UniffiReferenceHolder, type UniffiRustCallStatus, AbstractFfiConverterByteArray, Cursor, FfiConverterArray, FfiConverterArrayBuffer, FfiConverterBool, FfiConverterObject, FfiConverterObjectWithCallbacks, FfiConverterOptional, FfiConverterUInt32, FfiConverterUInt64, FfiConverterUInt8, RustBuffer, UniffiAbstractObject, UniffiEnum, UniffiError, UniffiInternalError, UniffiResult, UniffiRustCaller, destructorGuardSymbol, pointerLiteralSymbol, uniffiCreateFfiConverterString, uniffiCreateRecord, uniffiRustCallAsync, uniffiTraitInterfaceCall, uniffiTraitInterfaceCallAsyncWithError, uniffiTypeNameSymbol, variantOrdinalSymbol, -} from "@ubjs/core"; -// wasm1: wrap the wasm-bindgen namespace once so the codegen call sites can -// uniformly reference `nativeModule().rustbuffer_alloc` / `.rustbuffer_free`. -// For wasm1, RustBuffers are plain JS Uint8Arrays — no Rust-side allocation -// is involved, so alloc just hands back a fresh view and free is a no-op. -const _nativeModule = Object.assign({}, wasmBundle, { - rustbuffer_alloc: (n: number): Uint8Array => new Uint8Array(n), - rustbuffer_free: (_: Uint8Array): void => {}, -}); -const nativeModule = () => _nativeModule; -const uniffiCaller = new UniffiRustCaller(() => new wasmBundle.RustCallStatus()); - -const uniffiIsDebug = - // @ts-ignore -- The process global might not be defined - typeof process !== "object" || - // @ts-ignore -- The process global might not be defined - process?.env?.NODE_ENV !== "production" || - false; - -// Public interface members begin here. - -/** - * Static session computation for room-list / header info: values, not - * subscriptions — call it on every room update and populate room_info from - * the snapshot fields. Takes all relevant events in one list (sticky and - * state, many rooms at once — the dispatch groups by room and slot). - * Origins are unknown here, so origin-dependent conditions stay - * unenforced — fine for room-info purposes. - */ -export function computeSessionsFromEvents(eventsJson: Array, compat: FfiElementCallCompat): Array /*throws*/ { - const __rb: Uint8Array = uniffiCaller.rustCallWithError( - /*liftError:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError), - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_func_compute_sessions_from_events( - FfiConverterSequenceString.lower(eventsJson, nativeModule().rustbuffer_alloc), - FfiConverterTypeFfiElementCallCompat.lower(compat, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterSequenceTypeFfiSessionSnapshot.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - -/** - * The severity of one impairment, so a host can sort or filter without - * re-deriving the table. (`impairments` already arrives sorted, most severe - * first.) - */ -export function impairmentSeverity(impairment: FfiImpairment): FfiSeverity { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_func_impairment_severity( - FfiConverterTypeFfiImpairment.lower(impairment, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterTypeFfiSeverity.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - -/** - * Routes the crate's log lines to `sink`, at `max_level` and above. Call - * once after the bindings are initialised; calling again replaces the sink - * and the level. The `log` facade accepts one logger per process, so if the - * host already installed a Rust logger of its own (a native host with - * `tracing`), that one keeps the lines and the sink stays silent. - */ -export function setLogSink(sink: LogSink, maxLevel: FfiLogLevel): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_func_set_log_sink( - FfiConverterTypeLogSink.lower(sink, nativeModule().rustbuffer_alloc), - FfiConverterTypeFfiLogLevel.lower(maxLevel, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - -const stringConverter = (() => { - const encoder = new TextEncoder(); - const decoder = new TextDecoder(); - return { - stringToBytes: (s: string) => encoder.encode(s), - bytesToString: (ab: UniffiByteArray) => decoder.decode(ab), - stringByteLength: (s: string) => encoder.encode(s).byteLength, - writeStringIntoBuffer: (s: string, buf: any, offset: number): number => { - const view = new Uint8Array( - buf.arrayBuffer, - offset, - buf.arrayBuffer.byteLength - offset, - ); - return encoder.encodeInto(s, view).written; - }, - readStringFromBuffer: (buf: any, offset: number, length: number): string => - decoder.decode(new Uint8Array(buf.arrayBuffer, offset, length)), - }; -})(); -const FfiConverterString = uniffiCreateFfiConverterString(stringConverter); - -export type FfiConnectionData = { - /** - * The connection key (`livekit_service_url`) `FfiMembership::connections` - * refers to. - */ - serviceUrl: string, - /** - * The SFU websocket URL to connect to. - */ - wsUrl: string, - jwtToken: string, - /** - * From the JWT's `exp`; `None` when it carries none. A failed re-mint - * keeps the old token (a host may still be connected on it), so check - * this rather than discovering staleness through a failed connect. - */ - expiresAtTs?: bigint -} - -/** - * Generated factory for {@link FfiConnectionData} record objects. - */ -export const FfiConnectionData = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiConnectionData = (() => { - type TypeName = FfiConnectionData; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - serviceUrl: FfiConverterString.readFromCursor(c), - wsUrl: FfiConverterString.readFromCursor(c), - jwtToken: FfiConverterString.readFromCursor(c), - expiresAtTs: FfiConverterOptionalUInt64.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.serviceUrl, c); - FfiConverterString.writeIntoCursor(value.wsUrl, c); - FfiConverterString.writeIntoCursor(value.jwtToken, c); - FfiConverterOptionalUInt64.writeIntoCursor(value.expiresAtTs, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.serviceUrl) + - FfiConverterString.allocationSize(value.wsUrl) + - FfiConverterString.allocationSize(value.jwtToken) + - FfiConverterOptionalUInt64.allocationSize(value.expiresAtTs); - - } - }; - return new FFIConverter(); -})(); - -export enum FfiConnectionProblemKind { - /** - * Wanted, never minted — absent from `connections()` entirely. - */ - NoToken, - /** - * Present in `connections()` but its JWT is past `exp`. - */ - TokenExpired -} - -const FfiConverterTypeFfiConnectionProblemKind = (() => { - type TypeName = FfiConnectionProblemKind; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiConnectionProblemKind.NoToken; - case 2: return FfiConnectionProblemKind.TokenExpired; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiConnectionProblemKind.NoToken: return c.writeI32(1); - case FfiConnectionProblemKind.TokenExpired: return c.writeI32(2); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - -/** - * A connection the session needs that the host cannot currently use. - */ -export type FfiConnectionProblem = { - serviceUrl: string, - /** - * Members whose media is unavailable because of it. - */ - memberIds: Array, - kind: FfiConnectionProblemKind, - lastError: string, - /** - * When the next mint is due; `0` = at the next beat. - */ - retryAtTs: bigint -} - -/** - * Generated factory for {@link FfiConnectionProblem} record objects. - */ -export const FfiConnectionProblem = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiConnectionProblem = (() => { - type TypeName = FfiConnectionProblem; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - serviceUrl: FfiConverterString.readFromCursor(c), - memberIds: FfiConverterSequenceString.readFromCursor(c), - kind: FfiConverterTypeFfiConnectionProblemKind.readFromCursor(c), - lastError: FfiConverterString.readFromCursor(c), - retryAtTs: FfiConverterUInt64.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.serviceUrl, c); - FfiConverterSequenceString.writeIntoCursor(value.memberIds, c); - FfiConverterTypeFfiConnectionProblemKind.writeIntoCursor(value.kind, c); - FfiConverterString.writeIntoCursor(value.lastError, c); - FfiConverterUInt64.writeIntoCursor(value.retryAtTs, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.serviceUrl) + - FfiConverterSequenceString.allocationSize(value.memberIds) + - FfiConverterTypeFfiConnectionProblemKind.allocationSize(value.kind) + - FfiConverterString.allocationSize(value.lastError) + - FfiConverterUInt64.allocationSize(value.retryAtTs); - - } - }; - return new FFIConverter(); -})(); - -export enum FfiDeviceAttribution { - Verified, - Claimed, - Unknown -} - -const FfiConverterTypeFfiDeviceAttribution = (() => { - type TypeName = FfiDeviceAttribution; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiDeviceAttribution.Verified; - case 2: return FfiDeviceAttribution.Claimed; - case 3: return FfiDeviceAttribution.Unknown; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiDeviceAttribution.Verified: return c.writeI32(1); - case FfiDeviceAttribution.Claimed: return c.writeI32(2); - case FfiDeviceAttribution.Unknown: return c.writeI32(3); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - -export type FfiRtcTransport = { - transportType: string, - /** - * Type-specific fields as a JSON string (LiveKit: `livekit_service_url`). - */ - propertiesJson: string -} - -/** - * Generated factory for {@link FfiRtcTransport} record objects. - */ -export const FfiRtcTransport = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiRtcTransport = (() => { - type TypeName = FfiRtcTransport; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - transportType: FfiConverterString.readFromCursor(c), - propertiesJson: FfiConverterString.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.transportType, c); - FfiConverterString.writeIntoCursor(value.propertiesJson, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.transportType) + - FfiConverterString.allocationSize(value.propertiesJson); - - } - }; - return new FFIConverter(); -})(); - -export type FfiMember = { - memberId: string, - userId: string, - deviceId?: string, - deviceAttribution: FfiDeviceAttribution, - /** - * `origin_server_ts` of the event that started this participation, where - * the dialect needs it to tell joins apart (MSC3401 compat). - */ - membershipTs?: bigint, - /** - * From the room's `m.room.member` state for this user, kept current by - * the session: a rename shows up as a memberships change. - */ - displayName?: string, - avatarUrl?: string, - /** - * The membership event this entry was projected from — the *current* - * one, so it changes on every re-send. Relate application events - * (reactions, hand raises) to it. `None` for a member without an event - * yet (our own entry before the echo). - */ - eventId?: string, - intent?: string, - applicationType?: string, - /** - * The transports this member publishes on. - */ - publishedTransports: Array, - canSubscribe: Array -} - -/** - * Generated factory for {@link FfiMember} record objects. - */ -export const FfiMember = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiMember = (() => { - type TypeName = FfiMember; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - memberId: FfiConverterString.readFromCursor(c), - userId: FfiConverterString.readFromCursor(c), - deviceId: FfiConverterOptionalString.readFromCursor(c), - deviceAttribution: FfiConverterTypeFfiDeviceAttribution.readFromCursor(c), - membershipTs: FfiConverterOptionalUInt64.readFromCursor(c), - displayName: FfiConverterOptionalString.readFromCursor(c), - avatarUrl: FfiConverterOptionalString.readFromCursor(c), - eventId: FfiConverterOptionalString.readFromCursor(c), - intent: FfiConverterOptionalString.readFromCursor(c), - applicationType: FfiConverterOptionalString.readFromCursor(c), - publishedTransports: FfiConverterSequenceTypeFfiRtcTransport.readFromCursor(c), - canSubscribe: FfiConverterSequenceString.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.memberId, c); - FfiConverterString.writeIntoCursor(value.userId, c); - FfiConverterOptionalString.writeIntoCursor(value.deviceId, c); - FfiConverterTypeFfiDeviceAttribution.writeIntoCursor(value.deviceAttribution, c); - FfiConverterOptionalUInt64.writeIntoCursor(value.membershipTs, c); - FfiConverterOptionalString.writeIntoCursor(value.displayName, c); - FfiConverterOptionalString.writeIntoCursor(value.avatarUrl, c); - FfiConverterOptionalString.writeIntoCursor(value.eventId, c); - FfiConverterOptionalString.writeIntoCursor(value.intent, c); - FfiConverterOptionalString.writeIntoCursor(value.applicationType, c); - FfiConverterSequenceTypeFfiRtcTransport.writeIntoCursor(value.publishedTransports, c); - FfiConverterSequenceString.writeIntoCursor(value.canSubscribe, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.memberId) + - FfiConverterString.allocationSize(value.userId) + - FfiConverterOptionalString.allocationSize(value.deviceId) + - FfiConverterTypeFfiDeviceAttribution.allocationSize(value.deviceAttribution) + - FfiConverterOptionalUInt64.allocationSize(value.membershipTs) + - FfiConverterOptionalString.allocationSize(value.displayName) + - FfiConverterOptionalString.allocationSize(value.avatarUrl) + - FfiConverterOptionalString.allocationSize(value.eventId) + - FfiConverterOptionalString.allocationSize(value.intent) + - FfiConverterOptionalString.allocationSize(value.applicationType) + - FfiConverterSequenceTypeFfiRtcTransport.allocationSize(value.publishedTransports) + - FfiConverterSequenceString.allocationSize(value.canSubscribe); - - } - }; - return new FFIConverter(); -})(); - -export type FfiConnectionWithMembers = { - connection: FfiConnectionData, - members: Array -} - -/** - * Generated factory for {@link FfiConnectionWithMembers} record objects. - */ -export const FfiConnectionWithMembers = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiConnectionWithMembers = (() => { - type TypeName = FfiConnectionWithMembers; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - connection: FfiConverterTypeFfiConnectionData.readFromCursor(c), - members: FfiConverterSequenceTypeFfiMember.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterTypeFfiConnectionData.writeIntoCursor(value.connection, c); - FfiConverterSequenceTypeFfiMember.writeIntoCursor(value.members, c); - } - allocationSize(value: TypeName): number { - return FfiConverterTypeFfiConnectionData.allocationSize(value.connection) + - FfiConverterSequenceTypeFfiMember.allocationSize(value.members); - - } - }; - return new FFIConverter(); -})(); - -export enum FfiJoinExclusionReason { - SlotClosed, - UnencryptedInEncryptedRoom, - SenderNotInRoom, - Expired -} - -const FfiConverterTypeFfiJoinExclusionReason = (() => { - type TypeName = FfiJoinExclusionReason; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiJoinExclusionReason.SlotClosed; - case 2: return FfiJoinExclusionReason.UnencryptedInEncryptedRoom; - case 3: return FfiJoinExclusionReason.SenderNotInRoom; - case 4: return FfiJoinExclusionReason.Expired; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiJoinExclusionReason.SlotClosed: return c.writeI32(1); - case FfiJoinExclusionReason.UnencryptedInEncryptedRoom: return c.writeI32(2); - case FfiJoinExclusionReason.SenderNotInRoom: return c.writeI32(3); - case FfiJoinExclusionReason.Expired: return c.writeI32(4); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - -export type FfiExcludedCandidate = { - member: FfiMember, - reason: FfiJoinExclusionReason -} - -/** - * Generated factory for {@link FfiExcludedCandidate} record objects. - */ -export const FfiExcludedCandidate = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiExcludedCandidate = (() => { - type TypeName = FfiExcludedCandidate; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - member: FfiConverterTypeFfiMember.readFromCursor(c), - reason: FfiConverterTypeFfiJoinExclusionReason.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterTypeFfiMember.writeIntoCursor(value.member, c); - FfiConverterTypeFfiJoinExclusionReason.writeIntoCursor(value.reason, c); - } - allocationSize(value: TypeName): number { - return FfiConverterTypeFfiMember.allocationSize(value.member) + - FfiConverterTypeFfiJoinExclusionReason.allocationSize(value.reason); - - } - }; - return new FFIConverter(); -})(); - -/** - * See `driver::TransportDelegationRequest`: the token request with the - * MSC4195 through the homeserver: `POST - * /_matrix/client/unstable/io.element.msc4195/rtc/livekit/delegate_delayed_leave` - * with the body `{ url, room_id, slot_id, member, delay_id, delay_timeout }` - * — `url` is `sfu_url`, `member` is `member_json` parsed, `delay_timeout` - * is `delay_timeout_ms`. - */ -export type FfiHomeserverDelegationRequest = { - /** - * The SFU websocket URL our token named: the service checks it is its own. - */ - sfuUrl: string, - /** - * The authorisation service of the transport we publish on. - */ - livekitServiceUrl: string, - roomId: string, - slotId: string, - /** - * MSC4195 member claims `{ id, claimed_user_id, claimed_device_id }`. - */ - memberJson: string, - delayId: string, - delayTimeoutMs: bigint -} - -/** - * Generated factory for {@link FfiHomeserverDelegationRequest} record objects. - */ -export const FfiHomeserverDelegationRequest = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiHomeserverDelegationRequest = (() => { - type TypeName = FfiHomeserverDelegationRequest; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - sfuUrl: FfiConverterString.readFromCursor(c), - livekitServiceUrl: FfiConverterString.readFromCursor(c), - roomId: FfiConverterString.readFromCursor(c), - slotId: FfiConverterString.readFromCursor(c), - memberJson: FfiConverterString.readFromCursor(c), - delayId: FfiConverterString.readFromCursor(c), - delayTimeoutMs: FfiConverterUInt64.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.sfuUrl, c); - FfiConverterString.writeIntoCursor(value.livekitServiceUrl, c); - FfiConverterString.writeIntoCursor(value.roomId, c); - FfiConverterString.writeIntoCursor(value.slotId, c); - FfiConverterString.writeIntoCursor(value.memberJson, c); - FfiConverterString.writeIntoCursor(value.delayId, c); - FfiConverterUInt64.writeIntoCursor(value.delayTimeoutMs, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.sfuUrl) + - FfiConverterString.allocationSize(value.livekitServiceUrl) + - FfiConverterString.allocationSize(value.roomId) + - FfiConverterString.allocationSize(value.slotId) + - FfiConverterString.allocationSize(value.memberJson) + - FfiConverterString.allocationSize(value.delayId) + - FfiConverterUInt64.allocationSize(value.delayTimeoutMs); - - } - }; - return new FFIConverter(); -})(); - -export type FfiJoinParams = { - applicationType: string, - /** - * `application["m.call.intent"]`. - */ - intent?: string, - stickyDurationMs: bigint, - keepAliveTimeoutMs: bigint, - /** - * Lifetime when the homeserver refuses delayed events (default 5 min). - */ - degradedLifetimeMs?: bigint, - /** - * Hand the delayed leave to the SFU (MSC4195): the crate tries the - * homeserver, then the authorisation service, then keeps restarting the - * leave itself. - */ - delegateDelayedLeave: boolean, - /** - * The delay of the delegated leave (MSC4195 asks for ≥ 1 h); the short - * `keep_alive_timeout_ms` leave stays armed until delegation is confirmed. - */ - delegatedDelayMs: bigint -} - -/** - * Generated factory for {@link FfiJoinParams} record objects. - */ -export const FfiJoinParams = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiJoinParams = (() => { - type TypeName = FfiJoinParams; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - applicationType: FfiConverterString.readFromCursor(c), - intent: FfiConverterOptionalString.readFromCursor(c), - stickyDurationMs: FfiConverterUInt64.readFromCursor(c), - keepAliveTimeoutMs: FfiConverterUInt64.readFromCursor(c), - degradedLifetimeMs: FfiConverterOptionalUInt64.readFromCursor(c), - delegateDelayedLeave: FfiConverterBool.readFromCursor(c), - delegatedDelayMs: FfiConverterUInt64.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.applicationType, c); - FfiConverterOptionalString.writeIntoCursor(value.intent, c); - FfiConverterUInt64.writeIntoCursor(value.stickyDurationMs, c); - FfiConverterUInt64.writeIntoCursor(value.keepAliveTimeoutMs, c); - FfiConverterOptionalUInt64.writeIntoCursor(value.degradedLifetimeMs, c); - FfiConverterBool.writeIntoCursor(value.delegateDelayedLeave, c); - FfiConverterUInt64.writeIntoCursor(value.delegatedDelayMs, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.applicationType) + - FfiConverterOptionalString.allocationSize(value.intent) + - FfiConverterUInt64.allocationSize(value.stickyDurationMs) + - FfiConverterUInt64.allocationSize(value.keepAliveTimeoutMs) + - FfiConverterOptionalUInt64.allocationSize(value.degradedLifetimeMs) + - FfiConverterBool.allocationSize(value.delegateDelayedLeave) + - FfiConverterUInt64.allocationSize(value.delegatedDelayMs); - - } - }; - return new FFIConverter(); -})(); - -/** - * Join progress, step by step. - */ -export type FfiJoinProgress = { - hasFetchedTransports: boolean, - hasFetchedInitialMemberList: boolean, - hasCreatedTransportToken: boolean, - hasSentDelayedLeaveEvent: boolean, - hasSentMemberJoinEvent: boolean, - hasDelegatedDelayedEvent: boolean, - hasStartedHeartbeat: boolean -} - -/** - * Generated factory for {@link FfiJoinProgress} record objects. - */ -export const FfiJoinProgress = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiJoinProgress = (() => { - type TypeName = FfiJoinProgress; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - hasFetchedTransports: FfiConverterBool.readFromCursor(c), - hasFetchedInitialMemberList: FfiConverterBool.readFromCursor(c), - hasCreatedTransportToken: FfiConverterBool.readFromCursor(c), - hasSentDelayedLeaveEvent: FfiConverterBool.readFromCursor(c), - hasSentMemberJoinEvent: FfiConverterBool.readFromCursor(c), - hasDelegatedDelayedEvent: FfiConverterBool.readFromCursor(c), - hasStartedHeartbeat: FfiConverterBool.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterBool.writeIntoCursor(value.hasFetchedTransports, c); - FfiConverterBool.writeIntoCursor(value.hasFetchedInitialMemberList, c); - FfiConverterBool.writeIntoCursor(value.hasCreatedTransportToken, c); - FfiConverterBool.writeIntoCursor(value.hasSentDelayedLeaveEvent, c); - FfiConverterBool.writeIntoCursor(value.hasSentMemberJoinEvent, c); - FfiConverterBool.writeIntoCursor(value.hasDelegatedDelayedEvent, c); - FfiConverterBool.writeIntoCursor(value.hasStartedHeartbeat, c); - } - allocationSize(value: TypeName): number { - return FfiConverterBool.allocationSize(value.hasFetchedTransports) + - FfiConverterBool.allocationSize(value.hasFetchedInitialMemberList) + - FfiConverterBool.allocationSize(value.hasCreatedTransportToken) + - FfiConverterBool.allocationSize(value.hasSentDelayedLeaveEvent) + - FfiConverterBool.allocationSize(value.hasSentMemberJoinEvent) + - FfiConverterBool.allocationSize(value.hasDelegatedDelayedEvent) + - FfiConverterBool.allocationSize(value.hasStartedHeartbeat); - - } - }; - return new FFIConverter(); -})(); - -export type FfiLivekitToken = { - jwt: string, - /** - * The SFU websocket URL from the response, when it returned one. - */ - url?: string -} - -/** - * Generated factory for {@link FfiLivekitToken} record objects. - */ -export const FfiLivekitToken = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiLivekitToken = (() => { - type TypeName = FfiLivekitToken; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - jwt: FfiConverterString.readFromCursor(c), - url: FfiConverterOptionalString.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.jwt, c); - FfiConverterOptionalString.writeIntoCursor(value.url, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.jwt) + - FfiConverterOptionalString.allocationSize(value.url); - - } - }; - return new FFIConverter(); -})(); - -/** - * See `driver::LivekitTokenRequest`: the driver fetches the OpenID token - * itself and posts `{ room_id, slot_id, openid_token, member }` to - * `{url}/get_token` — or, with `legacy_sfu_get`, `{ room: room_id, - * openid_token, device_id }` to `{url}/sfu/get`. - */ -export type FfiLivekitTokenRequest = { - url: string, - roomId: string, - slotId: string, - /** - * MSC4195 member claims `{ id, claimed_user_id, claimed_device_id }`. - */ - memberJson: string, - legacySfuGet: boolean -} - -/** - * Generated factory for {@link FfiLivekitTokenRequest} record objects. - */ -export const FfiLivekitTokenRequest = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiLivekitTokenRequest = (() => { - type TypeName = FfiLivekitTokenRequest; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - url: FfiConverterString.readFromCursor(c), - roomId: FfiConverterString.readFromCursor(c), - slotId: FfiConverterString.readFromCursor(c), - memberJson: FfiConverterString.readFromCursor(c), - legacySfuGet: FfiConverterBool.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.url, c); - FfiConverterString.writeIntoCursor(value.roomId, c); - FfiConverterString.writeIntoCursor(value.slotId, c); - FfiConverterString.writeIntoCursor(value.memberJson, c); - FfiConverterBool.writeIntoCursor(value.legacySfuGet, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.url) + - FfiConverterString.allocationSize(value.roomId) + - FfiConverterString.allocationSize(value.slotId) + - FfiConverterString.allocationSize(value.memberJson) + - FfiConverterBool.allocationSize(value.legacySfuGet); - - } - }; - return new FFIConverter(); -})(); - -export type FfiMediaKey = { - memberId: string, - key: ArrayBuffer, - index: number, - creationTsMs: bigint -} - -/** - * Generated factory for {@link FfiMediaKey} record objects. - */ -export const FfiMediaKey = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiMediaKey = (() => { - type TypeName = FfiMediaKey; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - memberId: FfiConverterString.readFromCursor(c), - key: FfiConverterArrayBuffer.readFromCursor(c), - index: FfiConverterUInt8.readFromCursor(c), - creationTsMs: FfiConverterUInt64.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.memberId, c); - FfiConverterArrayBuffer.writeIntoCursor(value.key, c); - FfiConverterUInt8.writeIntoCursor(value.index, c); - FfiConverterUInt64.writeIntoCursor(value.creationTsMs, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.memberId) + - FfiConverterArrayBuffer.allocationSize(value.key) + - FfiConverterUInt8.allocationSize(value.index) + - FfiConverterUInt64.allocationSize(value.creationTsMs); - - } - }; - return new FFIConverter(); -})(); - -/** - * Why an inbound media key was discarded — the answer to "why can't I hear - * them?", which the crate computes and used to drop on the floor. - */ -export enum FfiKeyRejection { - Cleartext, - UnknownOrigin, - SenderMismatch, - DeviceMismatch, - UnattributableMember, - NotCrossSigned, - WrongRoom, - Outdated, - NotManagingKeys -} - -const FfiConverterTypeFfiKeyRejection = (() => { - type TypeName = FfiKeyRejection; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiKeyRejection.Cleartext; - case 2: return FfiKeyRejection.UnknownOrigin; - case 3: return FfiKeyRejection.SenderMismatch; - case 4: return FfiKeyRejection.DeviceMismatch; - case 5: return FfiKeyRejection.UnattributableMember; - case 6: return FfiKeyRejection.NotCrossSigned; - case 7: return FfiKeyRejection.WrongRoom; - case 8: return FfiKeyRejection.Outdated; - case 9: return FfiKeyRejection.NotManagingKeys; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiKeyRejection.Cleartext: return c.writeI32(1); - case FfiKeyRejection.UnknownOrigin: return c.writeI32(2); - case FfiKeyRejection.SenderMismatch: return c.writeI32(3); - case FfiKeyRejection.DeviceMismatch: return c.writeI32(4); - case FfiKeyRejection.UnattributableMember: return c.writeI32(5); - case FfiKeyRejection.NotCrossSigned: return c.writeI32(6); - case FfiKeyRejection.WrongRoom: return c.writeI32(7); - case FfiKeyRejection.Outdated: return c.writeI32(8); - case FfiKeyRejection.NotManagingKeys: return c.writeI32(9); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - -/** - * Who can hear whom, for one tile. Two independent booleans: they fail for - * different reasons and a UI renders them in different places. - */ -export type FfiMediaKeyState = { - /** - * They hold our current key: they can decrypt us. - */ - holdsOurKey: boolean, - /** - * We hold theirs: we can decrypt them. - */ - haveTheirKey: boolean, - /** - * Why their most recent key was discarded, while we still lack one. - */ - rejection?: FfiKeyRejection, - /** - * MSC4153: whether the device that sent the key we hold from them is - * cross-signed by its owner; `None` while we hold none or the host - * could not tell. Reported whether or not the check is enforced. - */ - senderCrossSigned?: boolean -} - -/** - * Generated factory for {@link FfiMediaKeyState} record objects. - */ -export const FfiMediaKeyState = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiMediaKeyState = (() => { - type TypeName = FfiMediaKeyState; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - holdsOurKey: FfiConverterBool.readFromCursor(c), - haveTheirKey: FfiConverterBool.readFromCursor(c), - rejection: FfiConverterOptionalTypeFfiKeyRejection.readFromCursor(c), - senderCrossSigned: FfiConverterOptionalBoolean.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterBool.writeIntoCursor(value.holdsOurKey, c); - FfiConverterBool.writeIntoCursor(value.haveTheirKey, c); - FfiConverterOptionalTypeFfiKeyRejection.writeIntoCursor(value.rejection, c); - FfiConverterOptionalBoolean.writeIntoCursor(value.senderCrossSigned, c); - } - allocationSize(value: TypeName): number { - return FfiConverterBool.allocationSize(value.holdsOurKey) + - FfiConverterBool.allocationSize(value.haveTheirKey) + - FfiConverterOptionalTypeFfiKeyRejection.allocationSize(value.rejection) + - FfiConverterOptionalBoolean.allocationSize(value.senderCrossSigned); - - } - }; - return new FFIConverter(); -})(); - -export enum FfiMembershipState { - /** - * In the session's joined projection. - */ - Joined, - /** - * Left the session but still holds a not-yet-rotated copy of our media - * key — render as "leaving / may still be listening" until rotation - * settles. - */ - LeftWithKeys -} - -const FfiConverterTypeFfiMembershipState = (() => { - type TypeName = FfiMembershipState; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiMembershipState.Joined; - case 2: return FfiMembershipState.LeftWithKeys; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiMembershipState.Joined: return c.writeI32(1); - case FfiMembershipState.LeftWithKeys: return c.writeI32(2); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - -/** - * One entry of the membership list — everything needed to render a tile - * and later attach its media from the LK rooms. - */ -export type FfiMembership = { - member: FfiMember, - state: FfiMembershipState, - /** - * `service_url`s (the connection key, `FfiConnectionData::service_url`) - * of the connections this member publishes on — the LK room(s) carrying - * their media. Empty for receive-only members and `LeftWithKeys` - * entries. - */ - connections: Array, - /** - * Participant identity inside those LK rooms (MSC4195 pseudonymous - * hash; `{user}:{device}` in legacy compat mode). - */ - transportIdentity?: string, - /** - * Whether this member and we can hear each other. `None` when the call - * does not manage media keys, for our own tile, and while not joined. - */ - mediaKey?: FfiMediaKeyState -} - -/** - * Generated factory for {@link FfiMembership} record objects. - */ -export const FfiMembership = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiMembership = (() => { - type TypeName = FfiMembership; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - member: FfiConverterTypeFfiMember.readFromCursor(c), - state: FfiConverterTypeFfiMembershipState.readFromCursor(c), - connections: FfiConverterSequenceString.readFromCursor(c), - transportIdentity: FfiConverterOptionalString.readFromCursor(c), - mediaKey: FfiConverterOptionalTypeFfiMediaKeyState.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterTypeFfiMember.writeIntoCursor(value.member, c); - FfiConverterTypeFfiMembershipState.writeIntoCursor(value.state, c); - FfiConverterSequenceString.writeIntoCursor(value.connections, c); - FfiConverterOptionalString.writeIntoCursor(value.transportIdentity, c); - FfiConverterOptionalTypeFfiMediaKeyState.writeIntoCursor(value.mediaKey, c); - } - allocationSize(value: TypeName): number { - return FfiConverterTypeFfiMember.allocationSize(value.member) + - FfiConverterTypeFfiMembershipState.allocationSize(value.state) + - FfiConverterSequenceString.allocationSize(value.connections) + - FfiConverterOptionalString.allocationSize(value.transportIdentity) + - FfiConverterOptionalTypeFfiMediaKeyState.allocationSize(value.mediaKey); - - } - }; - return new FFIConverter(); -})(); - -/** - * Our sticky membership event on the server (MSC4354). - */ -export type FfiMembershipPublication = { - lifetimeMs: bigint, - lastPublishedTs: bigint, - /** - * `last_published_ts + lifetime_ms` — when the server drops us if no - * refresh lands. - */ - expiresAtTs: bigint, - refreshFailingSinceTs?: bigint, - lastRefreshError?: string -} - -/** - * Generated factory for {@link FfiMembershipPublication} record objects. - */ -export const FfiMembershipPublication = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiMembershipPublication = (() => { - type TypeName = FfiMembershipPublication; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - lifetimeMs: FfiConverterUInt64.readFromCursor(c), - lastPublishedTs: FfiConverterUInt64.readFromCursor(c), - expiresAtTs: FfiConverterUInt64.readFromCursor(c), - refreshFailingSinceTs: FfiConverterOptionalUInt64.readFromCursor(c), - lastRefreshError: FfiConverterOptionalString.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterUInt64.writeIntoCursor(value.lifetimeMs, c); - FfiConverterUInt64.writeIntoCursor(value.lastPublishedTs, c); - FfiConverterUInt64.writeIntoCursor(value.expiresAtTs, c); - FfiConverterOptionalUInt64.writeIntoCursor(value.refreshFailingSinceTs, c); - FfiConverterOptionalString.writeIntoCursor(value.lastRefreshError, c); - } - allocationSize(value: TypeName): number { - return FfiConverterUInt64.allocationSize(value.lifetimeMs) + - FfiConverterUInt64.allocationSize(value.lastPublishedTs) + - FfiConverterUInt64.allocationSize(value.expiresAtTs) + - FfiConverterOptionalUInt64.allocationSize(value.refreshFailingSinceTs) + - FfiConverterOptionalString.allocationSize(value.lastRefreshError); - - } - }; - return new FFIConverter(); -})(); - -/** - * Pre-2026 Element Call interop, selected per call (session read side + - * own-membership write side). - */ -export enum FfiElementCallCompat { - Off, - StateEvents -} - -const FfiConverterTypeFfiElementCallCompat = (() => { - type TypeName = FfiElementCallCompat; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiElementCallCompat.Off; - case 2: return FfiElementCallCompat.StateEvents; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiElementCallCompat.Off: return c.writeI32(1); - case FfiElementCallCompat.StateEvents: return c.writeI32(2); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - -/** - * Per-manager configuration: the compat dialect plus the encryption knobs a - * host must be able to set (a room without a slot negotiates nothing, so - * the local defaults decide). - */ -export type FfiParticipationConfig = { - compat: FfiElementCallCompat, - /** - * Whether to exchange media keys when the slot prescribes nothing (no - * slot in the room). A slot's negotiated encryption overrides it. - */ - manageMediaKeys: boolean, - /** - * MSC4153: discard media keys from a sending device the host did not - * report as cross-signed by its owner. Hosts that cannot evaluate that - * (or whose peers may be unverified guests) turn it off. - */ - requireCrossSignedSender: boolean, - /** - * Wait this long after sending a rotated key before encrypting with it, - * so slow peers have it before the first frame arrives. - */ - useKeyDelayMs: bigint -} - -/** - * Generated factory for {@link FfiParticipationConfig} record objects. - */ -export const FfiParticipationConfig = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiParticipationConfig = (() => { - type TypeName = FfiParticipationConfig; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - compat: FfiConverterTypeFfiElementCallCompat.readFromCursor(c), - manageMediaKeys: FfiConverterBool.readFromCursor(c), - requireCrossSignedSender: FfiConverterBool.readFromCursor(c), - useKeyDelayMs: FfiConverterUInt64.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterTypeFfiElementCallCompat.writeIntoCursor(value.compat, c); - FfiConverterBool.writeIntoCursor(value.manageMediaKeys, c); - FfiConverterBool.writeIntoCursor(value.requireCrossSignedSender, c); - FfiConverterUInt64.writeIntoCursor(value.useKeyDelayMs, c); - } - allocationSize(value: TypeName): number { - return FfiConverterTypeFfiElementCallCompat.allocationSize(value.compat) + - FfiConverterBool.allocationSize(value.manageMediaKeys) + - FfiConverterBool.allocationSize(value.requireCrossSignedSender) + - FfiConverterUInt64.allocationSize(value.useKeyDelayMs); - - } - }; - return new FFIConverter(); -})(); - -export type FfiSendEventResponse = { - eventId?: string, - delayId?: string -} - -/** - * Generated factory for {@link FfiSendEventResponse} record objects. - */ -export const FfiSendEventResponse = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiSendEventResponse = (() => { - type TypeName = FfiSendEventResponse; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - eventId: FfiConverterOptionalString.readFromCursor(c), - delayId: FfiConverterOptionalString.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterOptionalString.writeIntoCursor(value.eventId, c); - FfiConverterOptionalString.writeIntoCursor(value.delayId, c); - } - allocationSize(value: TypeName): number { - return FfiConverterOptionalString.allocationSize(value.eventId) + - FfiConverterOptionalString.allocationSize(value.delayId); - - } - }; - return new FFIConverter(); -})(); - -/** - * One of the room-state / timeline reads the session's seed makes. A read - * that failed leaves its condition *unknown*, which is not the same as the - * condition being absent. - */ -export enum FfiSessionRead { - Slot, - RoomEncryption, - RoomMembers, - MemberEvents -} - -const FfiConverterTypeFfiSessionRead = (() => { - type TypeName = FfiSessionRead; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiSessionRead.Slot; - case 2: return FfiSessionRead.RoomEncryption; - case 3: return FfiSessionRead.RoomMembers; - case 4: return FfiSessionRead.MemberEvents; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiSessionRead.Slot: return c.writeI32(1); - case FfiSessionRead.RoomEncryption: return c.writeI32(2); - case FfiSessionRead.RoomMembers: return c.writeI32(3); - case FfiSessionRead.MemberEvents: return c.writeI32(4); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - -/** - * One session as a plain value — what [`compute_sessions_from_events`] - * returns. The convenience data the room-list / header / lobby / room_info - * computation needs is precomputed into fields (records carry no methods). - */ -export type FfiSessionSnapshot = { - roomId: string, - slotId: string, - members: Array, - memberCount: number, - isActive: boolean, - /** - * `origin_server_ts` of the earliest joined membership, while active. - */ - startTs?: bigint, - applicationType?: string, - /** - * `None` while no slot state was supplied (condition unenforced). - */ - slotOpen?: boolean, - /** - * The slot-prescribed encryption decision; `None` while unknown. - * - * Read it together with `failed_reads`: `None` with an empty - * `failed_reads` means "this call is not encrypted", `None` with - * `Slot` in it means "we could not find out" — the difference between - * rendering an open padlock and rendering nothing. - */ - encrypted?: boolean, - /** - * `true` once the live session finished seeding (even after read - * failures); always `true` for a statically computed snapshot. - */ - seeded: boolean, - /** - * Seed reads that failed, so an absent value can be told from an - * unknown one. Empty is the healthy case, and an entry disappears once - * a live state update supplies that value. - */ - failedReads: Array, - /** - * Member events that landed but are not in the joined projection, with - * the reason — the load-bearing diagnostics for "why can nobody see - * me?". Find your own entry with `own_member_id()`. - */ - excludedCandidates: Array -} - -/** - * Generated factory for {@link FfiSessionSnapshot} record objects. - */ -export const FfiSessionSnapshot = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiSessionSnapshot = (() => { - type TypeName = FfiSessionSnapshot; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - roomId: FfiConverterString.readFromCursor(c), - slotId: FfiConverterString.readFromCursor(c), - members: FfiConverterSequenceTypeFfiMember.readFromCursor(c), - memberCount: FfiConverterUInt32.readFromCursor(c), - isActive: FfiConverterBool.readFromCursor(c), - startTs: FfiConverterOptionalUInt64.readFromCursor(c), - applicationType: FfiConverterOptionalString.readFromCursor(c), - slotOpen: FfiConverterOptionalBoolean.readFromCursor(c), - encrypted: FfiConverterOptionalBoolean.readFromCursor(c), - seeded: FfiConverterBool.readFromCursor(c), - failedReads: FfiConverterSequenceTypeFfiSessionRead.readFromCursor(c), - excludedCandidates: FfiConverterSequenceTypeFfiExcludedCandidate.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.roomId, c); - FfiConverterString.writeIntoCursor(value.slotId, c); - FfiConverterSequenceTypeFfiMember.writeIntoCursor(value.members, c); - FfiConverterUInt32.writeIntoCursor(value.memberCount, c); - FfiConverterBool.writeIntoCursor(value.isActive, c); - FfiConverterOptionalUInt64.writeIntoCursor(value.startTs, c); - FfiConverterOptionalString.writeIntoCursor(value.applicationType, c); - FfiConverterOptionalBoolean.writeIntoCursor(value.slotOpen, c); - FfiConverterOptionalBoolean.writeIntoCursor(value.encrypted, c); - FfiConverterBool.writeIntoCursor(value.seeded, c); - FfiConverterSequenceTypeFfiSessionRead.writeIntoCursor(value.failedReads, c); - FfiConverterSequenceTypeFfiExcludedCandidate.writeIntoCursor(value.excludedCandidates, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.roomId) + - FfiConverterString.allocationSize(value.slotId) + - FfiConverterSequenceTypeFfiMember.allocationSize(value.members) + - FfiConverterUInt32.allocationSize(value.memberCount) + - FfiConverterBool.allocationSize(value.isActive) + - FfiConverterOptionalUInt64.allocationSize(value.startTs) + - FfiConverterOptionalString.allocationSize(value.applicationType) + - FfiConverterOptionalBoolean.allocationSize(value.slotOpen) + - FfiConverterOptionalBoolean.allocationSize(value.encrypted) + - FfiConverterBool.allocationSize(value.seeded) + - FfiConverterSequenceTypeFfiSessionRead.allocationSize(value.failedReads) + - FfiConverterSequenceTypeFfiExcludedCandidate.allocationSize(value.excludedCandidates); - - } - }; - return new FFIConverter(); -})(); - -export type FfiToDeviceRecipient = { - userId: string, - deviceId: string -} - -/** - * Generated factory for {@link FfiToDeviceRecipient} record objects. - */ -export const FfiToDeviceRecipient = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiToDeviceRecipient = (() => { - type TypeName = FfiToDeviceRecipient; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - userId: FfiConverterString.readFromCursor(c), - deviceId: FfiConverterString.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.userId, c); - FfiConverterString.writeIntoCursor(value.deviceId, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.userId) + - FfiConverterString.allocationSize(value.deviceId); - - } - }; - return new FFIConverter(); -})(); - -export type FfiToDeviceDelivery = { - recipient: FfiToDeviceRecipient, - error?: string -} - -/** - * Generated factory for {@link FfiToDeviceDelivery} record objects. - */ -export const FfiToDeviceDelivery = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiToDeviceDelivery = (() => { - type TypeName = FfiToDeviceDelivery; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - recipient: FfiConverterTypeFfiToDeviceRecipient.readFromCursor(c), - error: FfiConverterOptionalString.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterTypeFfiToDeviceRecipient.writeIntoCursor(value.recipient, c); - FfiConverterOptionalString.writeIntoCursor(value.error, c); - } - allocationSize(value: TypeName): number { - return FfiConverterTypeFfiToDeviceRecipient.allocationSize(value.recipient) + - FfiConverterOptionalString.allocationSize(value.error); - - } - }; - return new FFIConverter(); -})(); - -/** - * MSC4195 delay fields, sent to `{livekit_service_url}/get_token` (or - * `/sfu/get` with `legacy_sfu_get`). - */ -export type FfiTransportDelegationRequest = { - livekitServiceUrl: string, - roomId: string, - slotId: string, - /** - * MSC4195 member claims `{ id, claimed_user_id, claimed_device_id }`. - */ - memberJson: string, - delayId: string, - delayTimeoutMs: bigint, - legacySfuGet: boolean -} - -/** - * Generated factory for {@link FfiTransportDelegationRequest} record objects. - */ -export const FfiTransportDelegationRequest = (() => { - const defaults = () => ({ - }); - const create = (() => { - return uniffiCreateRecord>(defaults); - })(); - return Object.freeze({ - create, - new: create, - defaults: () => Object.freeze(defaults()) as Partial, - }); -})(); - -const FfiConverterTypeFfiTransportDelegationRequest = (() => { - type TypeName = FfiTransportDelegationRequest; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - return { - livekitServiceUrl: FfiConverterString.readFromCursor(c), - roomId: FfiConverterString.readFromCursor(c), - slotId: FfiConverterString.readFromCursor(c), - memberJson: FfiConverterString.readFromCursor(c), - delayId: FfiConverterString.readFromCursor(c), - delayTimeoutMs: FfiConverterUInt64.readFromCursor(c), - legacySfuGet: FfiConverterBool.readFromCursor(c) - }; - } - writeIntoCursor(value: TypeName, c: Cursor): void { - FfiConverterString.writeIntoCursor(value.livekitServiceUrl, c); - FfiConverterString.writeIntoCursor(value.roomId, c); - FfiConverterString.writeIntoCursor(value.slotId, c); - FfiConverterString.writeIntoCursor(value.memberJson, c); - FfiConverterString.writeIntoCursor(value.delayId, c); - FfiConverterUInt64.writeIntoCursor(value.delayTimeoutMs, c); - FfiConverterBool.writeIntoCursor(value.legacySfuGet, c); - } - allocationSize(value: TypeName): number { - return FfiConverterString.allocationSize(value.livekitServiceUrl) + - FfiConverterString.allocationSize(value.roomId) + - FfiConverterString.allocationSize(value.slotId) + - FfiConverterString.allocationSize(value.memberJson) + - FfiConverterString.allocationSize(value.delayId) + - FfiConverterUInt64.allocationSize(value.delayTimeoutMs) + - FfiConverterBool.allocationSize(value.legacySfuGet); - - } - }; - return new FFIConverter(); -})(); - -/** - * Which pump stopped, for [`FfiDisconnectCause::ManagerStopped`]. - */ -export enum FfiComponent { - Session, - OwnMembership, - Connections, - Encryption, - Participation -} - -const FfiConverterTypeFfiComponent = (() => { - type TypeName = FfiComponent; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiComponent.Session; - case 2: return FfiComponent.OwnMembership; - case 3: return FfiComponent.Connections; - case 4: return FfiComponent.Encryption; - case 5: return FfiComponent.Participation; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiComponent.Session: return c.writeI32(1); - case FfiComponent.OwnMembership: return c.writeI32(2); - case FfiComponent.Connections: return c.writeI32(3); - case FfiComponent.Encryption: return c.writeI32(4); - case FfiComponent.Participation: return c.writeI32(5); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - -/** - * What became of the dead man's switch when we left. A failed cancel still - * leaves us out of the call — the delay is itself a leave — but a stray - * delayed event of ours may land afterwards. - */ -export enum FfiDelayedLeaveOutcome { - Cancelled, - MayStillFire -} - -const FfiConverterTypeFfiDelayedLeaveOutcome = (() => { - type TypeName = FfiDelayedLeaveOutcome; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiDelayedLeaveOutcome.Cancelled; - case 2: return FfiDelayedLeaveOutcome.MayStillFire; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiDelayedLeaveOutcome.Cancelled: return c.writeI32(1); - case FfiDelayedLeaveOutcome.MayStillFire: return c.writeI32(2); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - -/** - * How the delayed leave was handed to the SFU (MSC4195). - */ -export enum FfiDelegationRoute { - /** - * The homeserver's CS API endpoint. - */ - Homeserver, - /** - * The authorisation service's token endpoint with the delay fields. - */ - AuthorisationService -} - -const FfiConverterTypeFfiDelegationRoute = (() => { - type TypeName = FfiDelegationRoute; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiDelegationRoute.Homeserver; - case 2: return FfiDelegationRoute.AuthorisationService; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiDelegationRoute.Homeserver: return c.writeI32(1); - case FfiDelegationRoute.AuthorisationService: return c.writeI32(2); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - - -// Enum: FfiJoinError -export enum FfiJoinError_Tags { - AlreadyJoined = "AlreadyJoined", - InvalidParams = "InvalidParams", - SlotClosed = "SlotClosed", - NoTransport = "NoTransport", - TokenRefused = "TokenRefused", - EncryptionSetup = "EncryptionSetup", - Driver = "Driver" -} -/** - * Why a join failed. Typed so a host can decide what to offer next: - * `NoTransport` is a configuration problem, `TokenRefused` may be worth a - * retry. - */ -export const FfiJoinError = (() => { - - type AlreadyJoined__interface = { - tag: FfiJoinError_Tags.AlreadyJoined - }; - class AlreadyJoined_ extends UniffiEnum implements AlreadyJoined__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiJoinError"; - readonly tag = FfiJoinError_Tags.AlreadyJoined; - constructor() { - super("FfiJoinError", "AlreadyJoined"); - } - - static new(): AlreadyJoined_ { - return new AlreadyJoined_(); - } - - static instanceOf(obj: any): obj is AlreadyJoined_ { - return obj.tag === FfiJoinError_Tags.AlreadyJoined; - } - - } - - type InvalidParams__interface = { - tag: FfiJoinError_Tags.InvalidParams; - inner: -Readonly<{message: string}> - }; - class InvalidParams_ extends UniffiEnum implements InvalidParams__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiJoinError"; - readonly tag = FfiJoinError_Tags.InvalidParams; - readonly inner: -Readonly<{message: string}>; - constructor( -inner: {message: string }) { - super("FfiJoinError", "InvalidParams"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {message: string }): InvalidParams_ { - return new InvalidParams_(inner); - } - - static instanceOf(obj: any): obj is InvalidParams_ { - return obj.tag === FfiJoinError_Tags.InvalidParams; - } - - } - - type SlotClosed__interface = { - tag: FfiJoinError_Tags.SlotClosed - }; - class SlotClosed_ extends UniffiEnum implements SlotClosed__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiJoinError"; - readonly tag = FfiJoinError_Tags.SlotClosed; - constructor() { - super("FfiJoinError", "SlotClosed"); - } - - static new(): SlotClosed_ { - return new SlotClosed_(); - } - - static instanceOf(obj: any): obj is SlotClosed_ { - return obj.tag === FfiJoinError_Tags.SlotClosed; - } - - } - - type NoTransport__interface = { - tag: FfiJoinError_Tags.NoTransport; - inner: -Readonly<{message: string}> - }; - class NoTransport_ extends UniffiEnum implements NoTransport__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiJoinError"; - readonly tag = FfiJoinError_Tags.NoTransport; - readonly inner: -Readonly<{message: string}>; - constructor( -inner: {message: string }) { - super("FfiJoinError", "NoTransport"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {message: string }): NoTransport_ { - return new NoTransport_(inner); - } - - static instanceOf(obj: any): obj is NoTransport_ { - return obj.tag === FfiJoinError_Tags.NoTransport; - } - - } - - type TokenRefused__interface = { - tag: FfiJoinError_Tags.TokenRefused; - inner: -Readonly<{message: string}> - }; - class TokenRefused_ extends UniffiEnum implements TokenRefused__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiJoinError"; - readonly tag = FfiJoinError_Tags.TokenRefused; - readonly inner: -Readonly<{message: string}>; - constructor( -inner: {message: string }) { - super("FfiJoinError", "TokenRefused"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {message: string }): TokenRefused_ { - return new TokenRefused_(inner); - } - - static instanceOf(obj: any): obj is TokenRefused_ { - return obj.tag === FfiJoinError_Tags.TokenRefused; - } - - } - - type EncryptionSetup__interface = { - tag: FfiJoinError_Tags.EncryptionSetup; - inner: -Readonly<{message: string}> - }; - class EncryptionSetup_ extends UniffiEnum implements EncryptionSetup__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiJoinError"; - readonly tag = FfiJoinError_Tags.EncryptionSetup; - readonly inner: -Readonly<{message: string}>; - constructor( -inner: {message: string }) { - super("FfiJoinError", "EncryptionSetup"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {message: string }): EncryptionSetup_ { - return new EncryptionSetup_(inner); - } - - static instanceOf(obj: any): obj is EncryptionSetup_ { - return obj.tag === FfiJoinError_Tags.EncryptionSetup; - } - - } - - type Driver__interface = { - tag: FfiJoinError_Tags.Driver; - inner: -Readonly<{message: string}> - }; - class Driver_ extends UniffiEnum implements Driver__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiJoinError"; - readonly tag = FfiJoinError_Tags.Driver; - readonly inner: -Readonly<{message: string}>; - constructor( -inner: {message: string }) { - super("FfiJoinError", "Driver"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {message: string }): Driver_ { - return new Driver_(inner); - } - - static instanceOf(obj: any): obj is Driver_ { - return obj.tag === FfiJoinError_Tags.Driver; - } - - } - - function instanceOf(obj: any): obj is FfiJoinError { - return obj[uniffiTypeNameSymbol] === "FfiJoinError"; - } - - return Object.freeze({ - instanceOf, - AlreadyJoined: AlreadyJoined_, - InvalidParams: InvalidParams_, - SlotClosed: SlotClosed_, - NoTransport: NoTransport_, - TokenRefused: TokenRefused_, - EncryptionSetup: EncryptionSetup_, - Driver: Driver_ - }); - -})(); -/** - * Why a join failed. Typed so a host can decide what to offer next: - * `NoTransport` is a configuration problem, `TokenRefused` may be worth a - * retry. - */ -export type FfiJoinError = InstanceType< - typeof FfiJoinError['AlreadyJoined' | 'InvalidParams' | 'SlotClosed' | 'NoTransport' | 'TokenRefused' | 'EncryptionSetup' | 'Driver'] ->; - -// FfiConverter for enum FfiJoinError -const FfiConverterTypeFfiJoinError = (() => { - type TypeName = FfiJoinError; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new FfiJoinError.AlreadyJoined(); - case 2: return new FfiJoinError.InvalidParams({message: FfiConverterString.readFromCursor(c) }); - case 3: return new FfiJoinError.SlotClosed(); - case 4: return new FfiJoinError.NoTransport({message: FfiConverterString.readFromCursor(c) }); - case 5: return new FfiJoinError.TokenRefused({message: FfiConverterString.readFromCursor(c) }); - case 6: return new FfiJoinError.EncryptionSetup({message: FfiConverterString.readFromCursor(c) }); - case 7: return new FfiJoinError.Driver({message: FfiConverterString.readFromCursor(c) }); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case FfiJoinError_Tags.AlreadyJoined: { - c.writeI32(1); - return; - } - case FfiJoinError_Tags.InvalidParams: { - c.writeI32(2); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner.message, c); - return; - } - case FfiJoinError_Tags.SlotClosed: { - c.writeI32(3); - return; - } - case FfiJoinError_Tags.NoTransport: { - c.writeI32(4); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner.message, c); - return; - } - case FfiJoinError_Tags.TokenRefused: { - c.writeI32(5); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner.message, c); - return; - } - case FfiJoinError_Tags.EncryptionSetup: { - c.writeI32(6); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner.message, c); - return; - } - case FfiJoinError_Tags.Driver: { - c.writeI32(7); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner.message, c); - return; - } - default: - // Throwing from here means that FfiJoinError_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case FfiJoinError_Tags.AlreadyJoined: { - return 4; - } - case FfiJoinError_Tags.InvalidParams: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner.message); - return size; - } - case FfiJoinError_Tags.SlotClosed: { - return 4; - } - case FfiJoinError_Tags.NoTransport: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner.message); - return size; - } - case FfiJoinError_Tags.TokenRefused: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner.message); - return size; - } - case FfiJoinError_Tags.EncryptionSetup: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner.message); - return size; - } - case FfiJoinError_Tags.Driver: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner.message); - return size; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - - -// Enum: FfiDisconnectCause -export enum FfiDisconnectCause_Tags { - NeverJoined = "NeverJoined", - LeftByHost = "LeftByHost", - SlotClosed = "SlotClosed", - JoinFailed = "JoinFailed", - ManagerStopped = "ManagerStopped" -} -/** - * Why we are not in a call. Terminal by construction: unlike an impairment, - * none of these clears on its own. - */ -export const FfiDisconnectCause = (() => { - - type NeverJoined__interface = { - tag: FfiDisconnectCause_Tags.NeverJoined - }; - /** - * No join has been attempted on this manager. - */ - class NeverJoined_ extends UniffiEnum implements NeverJoined__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiDisconnectCause"; - readonly tag = FfiDisconnectCause_Tags.NeverJoined; - constructor() { - super("FfiDisconnectCause", "NeverJoined"); - } - - static new(): NeverJoined_ { - return new NeverJoined_(); - } - - static instanceOf(obj: any): obj is NeverJoined_ { - return obj.tag === FfiDisconnectCause_Tags.NeverJoined; - } - - } - - type LeftByHost__interface = { - tag: FfiDisconnectCause_Tags.LeftByHost; - inner: -Readonly<{code?: string; reason?: string}> - }; - /** - * The host called `leave()`. - */ - class LeftByHost_ extends UniffiEnum implements LeftByHost__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiDisconnectCause"; - readonly tag = FfiDisconnectCause_Tags.LeftByHost; - readonly inner: -Readonly<{code?: string; reason?: string}>; - constructor( -inner: {code?: string; reason?: string }) { - super("FfiDisconnectCause", "LeftByHost"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {code?: string; reason?: string }): LeftByHost_ { - return new LeftByHost_(inner); - } - - static instanceOf(obj: any): obj is LeftByHost_ { - return obj.tag === FfiDisconnectCause_Tags.LeftByHost; - } - - } - - type SlotClosed__interface = { - tag: FfiDisconnectCause_Tags.SlotClosed - }; - /** - * The slot was closed under us and the machine left on its own. - */ - class SlotClosed_ extends UniffiEnum implements SlotClosed__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiDisconnectCause"; - readonly tag = FfiDisconnectCause_Tags.SlotClosed; - constructor() { - super("FfiDisconnectCause", "SlotClosed"); - } - - static new(): SlotClosed_ { - return new SlotClosed_(); - } - - static instanceOf(obj: any): obj is SlotClosed_ { - return obj.tag === FfiDisconnectCause_Tags.SlotClosed; - } - - } - - type JoinFailed__interface = { - tag: FfiDisconnectCause_Tags.JoinFailed; - inner: -Readonly<{atTs: bigint; progress: FfiJoinProgress; error: FfiJoinError}> - }; - /** - * `join()` failed; the participation never started. `progress` says how - * far it got. - */ - class JoinFailed_ extends UniffiEnum implements JoinFailed__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiDisconnectCause"; - readonly tag = FfiDisconnectCause_Tags.JoinFailed; - readonly inner: -Readonly<{atTs: bigint; progress: FfiJoinProgress; error: FfiJoinError}>; - constructor( -inner: {atTs: bigint; progress: FfiJoinProgress; error: FfiJoinError }) { - super("FfiDisconnectCause", "JoinFailed"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {atTs: bigint; progress: FfiJoinProgress; error: FfiJoinError }): JoinFailed_ { - return new JoinFailed_(inner); - } - - static instanceOf(obj: any): obj is JoinFailed_ { - return obj.tag === FfiDisconnectCause_Tags.JoinFailed; - } - - } - - type ManagerStopped__interface = { - tag: FfiDisconnectCause_Tags.ManagerStopped; - inner: -Readonly<{component: FfiComponent}> - }; - /** - * A pump stopped. The manager is dead and will not recover; build a new - * one. - */ - class ManagerStopped_ extends UniffiEnum implements ManagerStopped__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiDisconnectCause"; - readonly tag = FfiDisconnectCause_Tags.ManagerStopped; - readonly inner: -Readonly<{component: FfiComponent}>; - constructor( -inner: {component: FfiComponent }) { - super("FfiDisconnectCause", "ManagerStopped"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {component: FfiComponent }): ManagerStopped_ { - return new ManagerStopped_(inner); - } - - static instanceOf(obj: any): obj is ManagerStopped_ { - return obj.tag === FfiDisconnectCause_Tags.ManagerStopped; - } - - } - - function instanceOf(obj: any): obj is FfiDisconnectCause { - return obj[uniffiTypeNameSymbol] === "FfiDisconnectCause"; - } - - return Object.freeze({ - instanceOf, - NeverJoined: NeverJoined_, - LeftByHost: LeftByHost_, - SlotClosed: SlotClosed_, - JoinFailed: JoinFailed_, - ManagerStopped: ManagerStopped_ - }); - -})(); -/** - * Why we are not in a call. Terminal by construction: unlike an impairment, - * none of these clears on its own. - */ -export type FfiDisconnectCause = InstanceType< - typeof FfiDisconnectCause['NeverJoined' | 'LeftByHost' | 'SlotClosed' | 'JoinFailed' | 'ManagerStopped'] ->; - -// FfiConverter for enum FfiDisconnectCause -const FfiConverterTypeFfiDisconnectCause = (() => { - type TypeName = FfiDisconnectCause; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new FfiDisconnectCause.NeverJoined(); - case 2: return new FfiDisconnectCause.LeftByHost({code: FfiConverterOptionalString.readFromCursor(c), reason: FfiConverterOptionalString.readFromCursor(c) }); - case 3: return new FfiDisconnectCause.SlotClosed(); - case 4: return new FfiDisconnectCause.JoinFailed({atTs: FfiConverterUInt64.readFromCursor(c), progress: FfiConverterTypeFfiJoinProgress.readFromCursor(c), error: FfiConverterTypeFfiJoinError.readFromCursor(c) }); - case 5: return new FfiDisconnectCause.ManagerStopped({component: FfiConverterTypeFfiComponent.readFromCursor(c) }); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case FfiDisconnectCause_Tags.NeverJoined: { - c.writeI32(1); - return; - } - case FfiDisconnectCause_Tags.LeftByHost: { - c.writeI32(2); - const inner = value.inner; - FfiConverterOptionalString.writeIntoCursor(inner.code, c); - FfiConverterOptionalString.writeIntoCursor(inner.reason, c); - return; - } - case FfiDisconnectCause_Tags.SlotClosed: { - c.writeI32(3); - return; - } - case FfiDisconnectCause_Tags.JoinFailed: { - c.writeI32(4); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.atTs, c); - FfiConverterTypeFfiJoinProgress.writeIntoCursor(inner.progress, c); - FfiConverterTypeFfiJoinError.writeIntoCursor(inner.error, c); - return; - } - case FfiDisconnectCause_Tags.ManagerStopped: { - c.writeI32(5); - const inner = value.inner; - FfiConverterTypeFfiComponent.writeIntoCursor(inner.component, c); - return; - } - default: - // Throwing from here means that FfiDisconnectCause_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case FfiDisconnectCause_Tags.NeverJoined: { - return 4; - } - case FfiDisconnectCause_Tags.LeftByHost: { - const inner = value.inner; - let size = 4; - size += FfiConverterOptionalString.allocationSize(inner.code); - size += FfiConverterOptionalString.allocationSize(inner.reason); - return size; - } - case FfiDisconnectCause_Tags.SlotClosed: { - return 4; - } - case FfiDisconnectCause_Tags.JoinFailed: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.atTs); - size += FfiConverterTypeFfiJoinProgress.allocationSize(inner.progress); - size += FfiConverterTypeFfiJoinError.allocationSize(inner.error); - return size; - } - case FfiDisconnectCause_Tags.ManagerStopped: { - const inner = value.inner; - let size = 4; - size += FfiConverterTypeFfiComponent.allocationSize(inner.component); - return size; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - - -// Enum: FfiEncryptionStatus -export enum FfiEncryptionStatus_Tags { - Joining = "Joining", - Connected = "Connected" -} -/** - * The media-key exchange as a whole. - */ -export const FfiEncryptionStatus = (() => { - - type Joining__interface = { - tag: FfiEncryptionStatus_Tags.Joining; - inner: -Readonly<{hasDistributedInitialKeys: boolean; hasReceivedAllMemberKeys: boolean}> - }; - class Joining_ extends UniffiEnum implements Joining__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiEncryptionStatus"; - readonly tag = FfiEncryptionStatus_Tags.Joining; - readonly inner: -Readonly<{hasDistributedInitialKeys: boolean; hasReceivedAllMemberKeys: boolean}>; - constructor( -inner: {hasDistributedInitialKeys: boolean; hasReceivedAllMemberKeys: boolean }) { - super("FfiEncryptionStatus", "Joining"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {hasDistributedInitialKeys: boolean; hasReceivedAllMemberKeys: boolean }): Joining_ { - return new Joining_(inner); - } - - static instanceOf(obj: any): obj is Joining_ { - return obj.tag === FfiEncryptionStatus_Tags.Joining; - } - - } - - type Connected__interface = { - tag: FfiEncryptionStatus_Tags.Connected; - inner: -Readonly<{leftMembersWithKeys: Array; fullySettled: boolean; lastRotationTs: bigint}> - }; - class Connected_ extends UniffiEnum implements Connected__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiEncryptionStatus"; - readonly tag = FfiEncryptionStatus_Tags.Connected; - readonly inner: -Readonly<{leftMembersWithKeys: Array; fullySettled: boolean; lastRotationTs: bigint}>; - constructor( -inner: {leftMembersWithKeys: Array; fullySettled: boolean; lastRotationTs: bigint }) { - super("FfiEncryptionStatus", "Connected"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {leftMembersWithKeys: Array; fullySettled: boolean; lastRotationTs: bigint }): Connected_ { - return new Connected_(inner); - } - - static instanceOf(obj: any): obj is Connected_ { - return obj.tag === FfiEncryptionStatus_Tags.Connected; - } - - } - - function instanceOf(obj: any): obj is FfiEncryptionStatus { - return obj[uniffiTypeNameSymbol] === "FfiEncryptionStatus"; - } - - return Object.freeze({ - instanceOf, - Joining: Joining_, - Connected: Connected_ - }); - -})(); -/** - * The media-key exchange as a whole. - */ -export type FfiEncryptionStatus = InstanceType< - typeof FfiEncryptionStatus['Joining' | 'Connected'] ->; - -// FfiConverter for enum FfiEncryptionStatus -const FfiConverterTypeFfiEncryptionStatus = (() => { - type TypeName = FfiEncryptionStatus; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new FfiEncryptionStatus.Joining({hasDistributedInitialKeys: FfiConverterBool.readFromCursor(c), hasReceivedAllMemberKeys: FfiConverterBool.readFromCursor(c) }); - case 2: return new FfiEncryptionStatus.Connected({leftMembersWithKeys: FfiConverterSequenceTypeFfiMember.readFromCursor(c), fullySettled: FfiConverterBool.readFromCursor(c), lastRotationTs: FfiConverterUInt64.readFromCursor(c) }); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case FfiEncryptionStatus_Tags.Joining: { - c.writeI32(1); - const inner = value.inner; - FfiConverterBool.writeIntoCursor(inner.hasDistributedInitialKeys, c); - FfiConverterBool.writeIntoCursor(inner.hasReceivedAllMemberKeys, c); - return; - } - case FfiEncryptionStatus_Tags.Connected: { - c.writeI32(2); - const inner = value.inner; - FfiConverterSequenceTypeFfiMember.writeIntoCursor(inner.leftMembersWithKeys, c); - FfiConverterBool.writeIntoCursor(inner.fullySettled, c); - FfiConverterUInt64.writeIntoCursor(inner.lastRotationTs, c); - return; - } - default: - // Throwing from here means that FfiEncryptionStatus_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case FfiEncryptionStatus_Tags.Joining: { - const inner = value.inner; - let size = 4; - size += FfiConverterBool.allocationSize(inner.hasDistributedInitialKeys); - size += FfiConverterBool.allocationSize(inner.hasReceivedAllMemberKeys); - return size; - } - case FfiEncryptionStatus_Tags.Connected: { - const inner = value.inner; - let size = 4; - size += FfiConverterSequenceTypeFfiMember.allocationSize(inner.leftMembersWithKeys); - size += FfiConverterBool.allocationSize(inner.fullySettled); - size += FfiConverterUInt64.allocationSize(inner.lastRotationTs); - return size; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - - -// Enum: FfiEventOrigin -export enum FfiEventOrigin_Tags { - Encrypted = "Encrypted", - Cleartext = "Cleartext", - Unknown = "Unknown" -} -export const FfiEventOrigin = (() => { - - type Encrypted__interface = { - tag: FfiEventOrigin_Tags.Encrypted; - inner: -Readonly<{senderDeviceId?: string}> - }; - class Encrypted_ extends UniffiEnum implements Encrypted__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiEventOrigin"; - readonly tag = FfiEventOrigin_Tags.Encrypted; - readonly inner: -Readonly<{senderDeviceId?: string}>; - constructor( -inner: {senderDeviceId?: string }) { - super("FfiEventOrigin", "Encrypted"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {senderDeviceId?: string }): Encrypted_ { - return new Encrypted_(inner); - } - - static instanceOf(obj: any): obj is Encrypted_ { - return obj.tag === FfiEventOrigin_Tags.Encrypted; - } - - } - - type Cleartext__interface = { - tag: FfiEventOrigin_Tags.Cleartext - }; - class Cleartext_ extends UniffiEnum implements Cleartext__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiEventOrigin"; - readonly tag = FfiEventOrigin_Tags.Cleartext; - constructor() { - super("FfiEventOrigin", "Cleartext"); - } - - static new(): Cleartext_ { - return new Cleartext_(); - } - - static instanceOf(obj: any): obj is Cleartext_ { - return obj.tag === FfiEventOrigin_Tags.Cleartext; - } - - } - - type Unknown__interface = { - tag: FfiEventOrigin_Tags.Unknown - }; - class Unknown_ extends UniffiEnum implements Unknown__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiEventOrigin"; - readonly tag = FfiEventOrigin_Tags.Unknown; - constructor() { - super("FfiEventOrigin", "Unknown"); - } - - static new(): Unknown_ { - return new Unknown_(); - } - - static instanceOf(obj: any): obj is Unknown_ { - return obj.tag === FfiEventOrigin_Tags.Unknown; - } - - } - - function instanceOf(obj: any): obj is FfiEventOrigin { - return obj[uniffiTypeNameSymbol] === "FfiEventOrigin"; - } - - return Object.freeze({ - instanceOf, - Encrypted: Encrypted_, - Cleartext: Cleartext_, - Unknown: Unknown_ - }); - -})(); -export type FfiEventOrigin = InstanceType< - typeof FfiEventOrigin['Encrypted' | 'Cleartext' | 'Unknown'] ->; - -// FfiConverter for enum FfiEventOrigin -const FfiConverterTypeFfiEventOrigin = (() => { - type TypeName = FfiEventOrigin; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new FfiEventOrigin.Encrypted({senderDeviceId: FfiConverterOptionalString.readFromCursor(c) }); - case 2: return new FfiEventOrigin.Cleartext(); - case 3: return new FfiEventOrigin.Unknown(); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case FfiEventOrigin_Tags.Encrypted: { - c.writeI32(1); - const inner = value.inner; - FfiConverterOptionalString.writeIntoCursor(inner.senderDeviceId, c); - return; - } - case FfiEventOrigin_Tags.Cleartext: { - c.writeI32(2); - return; - } - case FfiEventOrigin_Tags.Unknown: { - c.writeI32(3); - return; - } - default: - // Throwing from here means that FfiEventOrigin_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case FfiEventOrigin_Tags.Encrypted: { - const inner = value.inner; - let size = 4; - size += FfiConverterOptionalString.allocationSize(inner.senderDeviceId); - return size; - } - case FfiEventOrigin_Tags.Cleartext: { - return 4; - } - case FfiEventOrigin_Tags.Unknown: { - return 4; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - - -// Enum: FfiImpairment -export enum FfiImpairment_Tags { - HomeserverUnreachable = "HomeserverUnreachable", - KeepAliveRestartFailing = "KeepAliveRestartFailing", - KeepAliveExpired = "KeepAliveExpired", - KeepAliveUnavailable = "KeepAliveUnavailable", - MembershipRefreshFailing = "MembershipRefreshFailing", - OwnMembershipMissing = "OwnMembershipMissing", - OwnMembershipExcluded = "OwnMembershipExcluded", - MediaKeyNotDelivered = "MediaKeyNotDelivered", - MediaKeyNotReceived = "MediaKeyNotReceived", - MediaKeyRejected = "MediaKeyRejected", - ConnectionUnavailable = "ConnectionUnavailable", - ConnectionTokenExpired = "ConnectionTokenExpired", - SessionStateUnread = "SessionStateUnread", - JoinedBeforeSeed = "JoinedBeforeSeed" -} -/** - * A condition that is true right now and that the crate is still working - * on. Every variant clears by itself when the underlying operation - * succeeds — an impairment is never terminal; anything terminal ends the - * participation and appears as [`FfiDisconnectCause`] instead. - * - * A host that renders one warning banner can read this list and nothing - * else; the structured status above is for anything that needs the details. - */ -export const FfiImpairment = (() => { - - type HomeserverUnreachable__interface = { - tag: FfiImpairment_Tags.HomeserverUnreachable; - inner: -Readonly<{sinceTs: bigint}> - }; - /** - * The driver reports the homeserver unreachable; clears when it is back. - */ - class HomeserverUnreachable_ extends UniffiEnum implements HomeserverUnreachable__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.HomeserverUnreachable; - readonly inner: -Readonly<{sinceTs: bigint}>; - constructor( -inner: {sinceTs: bigint }) { - super("FfiImpairment", "HomeserverUnreachable"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {sinceTs: bigint }): HomeserverUnreachable_ { - return new HomeserverUnreachable_(inner); - } - - static instanceOf(obj: any): obj is HomeserverUnreachable_ { - return obj.tag === FfiImpairment_Tags.HomeserverUnreachable; - } - - } - - type KeepAliveRestartFailing__interface = { - tag: FfiImpairment_Tags.KeepAliveRestartFailing; - inner: -Readonly<{sinceTs: bigint; firesAtTs: bigint; lastError: string}> - }; - class KeepAliveRestartFailing_ extends UniffiEnum implements KeepAliveRestartFailing__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.KeepAliveRestartFailing; - readonly inner: -Readonly<{sinceTs: bigint; firesAtTs: bigint; lastError: string}>; - constructor( -inner: {sinceTs: bigint; firesAtTs: bigint; lastError: string }) { - super("FfiImpairment", "KeepAliveRestartFailing"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {sinceTs: bigint; firesAtTs: bigint; lastError: string }): KeepAliveRestartFailing_ { - return new KeepAliveRestartFailing_(inner); - } - - static instanceOf(obj: any): obj is KeepAliveRestartFailing_ { - return obj.tag === FfiImpairment_Tags.KeepAliveRestartFailing; - } - - } - - type KeepAliveExpired__interface = { - tag: FfiImpairment_Tags.KeepAliveExpired; - inner: -Readonly<{sinceTs: bigint}> - }; - class KeepAliveExpired_ extends UniffiEnum implements KeepAliveExpired__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.KeepAliveExpired; - readonly inner: -Readonly<{sinceTs: bigint}>; - constructor( -inner: {sinceTs: bigint }) { - super("FfiImpairment", "KeepAliveExpired"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {sinceTs: bigint }): KeepAliveExpired_ { - return new KeepAliveExpired_(inner); - } - - static instanceOf(obj: any): obj is KeepAliveExpired_ { - return obj.tag === FfiImpairment_Tags.KeepAliveExpired; - } - - } - - type KeepAliveUnavailable__interface = { - tag: FfiImpairment_Tags.KeepAliveUnavailable; - inner: -Readonly<{permanent: boolean; membershipExpiresAtTs: bigint}> - }; - class KeepAliveUnavailable_ extends UniffiEnum implements KeepAliveUnavailable__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.KeepAliveUnavailable; - readonly inner: -Readonly<{permanent: boolean; membershipExpiresAtTs: bigint}>; - constructor( -inner: {permanent: boolean; membershipExpiresAtTs: bigint }) { - super("FfiImpairment", "KeepAliveUnavailable"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {permanent: boolean; membershipExpiresAtTs: bigint }): KeepAliveUnavailable_ { - return new KeepAliveUnavailable_(inner); - } - - static instanceOf(obj: any): obj is KeepAliveUnavailable_ { - return obj.tag === FfiImpairment_Tags.KeepAliveUnavailable; - } - - } - - type MembershipRefreshFailing__interface = { - tag: FfiImpairment_Tags.MembershipRefreshFailing; - inner: -Readonly<{sinceTs: bigint; expiresAtTs: bigint; lastError: string}> - }; - class MembershipRefreshFailing_ extends UniffiEnum implements MembershipRefreshFailing__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.MembershipRefreshFailing; - readonly inner: -Readonly<{sinceTs: bigint; expiresAtTs: bigint; lastError: string}>; - constructor( -inner: {sinceTs: bigint; expiresAtTs: bigint; lastError: string }) { - super("FfiImpairment", "MembershipRefreshFailing"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {sinceTs: bigint; expiresAtTs: bigint; lastError: string }): MembershipRefreshFailing_ { - return new MembershipRefreshFailing_(inner); - } - - static instanceOf(obj: any): obj is MembershipRefreshFailing_ { - return obj.tag === FfiImpairment_Tags.MembershipRefreshFailing; - } - - } - - type OwnMembershipMissing__interface = { - tag: FfiImpairment_Tags.OwnMembershipMissing; - inner: -Readonly<{sinceTs: bigint; republishedAtTs?: bigint}> - }; - class OwnMembershipMissing_ extends UniffiEnum implements OwnMembershipMissing__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.OwnMembershipMissing; - readonly inner: -Readonly<{sinceTs: bigint; republishedAtTs?: bigint}>; - constructor( -inner: {sinceTs: bigint; republishedAtTs?: bigint }) { - super("FfiImpairment", "OwnMembershipMissing"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {sinceTs: bigint; republishedAtTs?: bigint }): OwnMembershipMissing_ { - return new OwnMembershipMissing_(inner); - } - - static instanceOf(obj: any): obj is OwnMembershipMissing_ { - return obj.tag === FfiImpairment_Tags.OwnMembershipMissing; - } - - } - - type OwnMembershipExcluded__interface = { - tag: FfiImpairment_Tags.OwnMembershipExcluded; - inner: -Readonly<{reason: FfiJoinExclusionReason}> - }; - class OwnMembershipExcluded_ extends UniffiEnum implements OwnMembershipExcluded__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.OwnMembershipExcluded; - readonly inner: -Readonly<{reason: FfiJoinExclusionReason}>; - constructor( -inner: {reason: FfiJoinExclusionReason }) { - super("FfiImpairment", "OwnMembershipExcluded"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {reason: FfiJoinExclusionReason }): OwnMembershipExcluded_ { - return new OwnMembershipExcluded_(inner); - } - - static instanceOf(obj: any): obj is OwnMembershipExcluded_ { - return obj.tag === FfiImpairment_Tags.OwnMembershipExcluded; - } - - } - - type MediaKeyNotDelivered__interface = { - tag: FfiImpairment_Tags.MediaKeyNotDelivered; - inner: -Readonly<{memberIds: Array}> - }; - class MediaKeyNotDelivered_ extends UniffiEnum implements MediaKeyNotDelivered__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.MediaKeyNotDelivered; - readonly inner: -Readonly<{memberIds: Array}>; - constructor( -inner: {memberIds: Array }) { - super("FfiImpairment", "MediaKeyNotDelivered"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {memberIds: Array }): MediaKeyNotDelivered_ { - return new MediaKeyNotDelivered_(inner); - } - - static instanceOf(obj: any): obj is MediaKeyNotDelivered_ { - return obj.tag === FfiImpairment_Tags.MediaKeyNotDelivered; - } - - } - - type MediaKeyNotReceived__interface = { - tag: FfiImpairment_Tags.MediaKeyNotReceived; - inner: -Readonly<{memberIds: Array}> - }; - class MediaKeyNotReceived_ extends UniffiEnum implements MediaKeyNotReceived__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.MediaKeyNotReceived; - readonly inner: -Readonly<{memberIds: Array}>; - constructor( -inner: {memberIds: Array }) { - super("FfiImpairment", "MediaKeyNotReceived"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {memberIds: Array }): MediaKeyNotReceived_ { - return new MediaKeyNotReceived_(inner); - } - - static instanceOf(obj: any): obj is MediaKeyNotReceived_ { - return obj.tag === FfiImpairment_Tags.MediaKeyNotReceived; - } - - } - - type MediaKeyRejected__interface = { - tag: FfiImpairment_Tags.MediaKeyRejected; - inner: -Readonly<{memberId: string; senderUserId: string; reason: FfiKeyRejection; atTs: bigint}> - }; - class MediaKeyRejected_ extends UniffiEnum implements MediaKeyRejected__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.MediaKeyRejected; - readonly inner: -Readonly<{memberId: string; senderUserId: string; reason: FfiKeyRejection; atTs: bigint}>; - constructor( -inner: {memberId: string; senderUserId: string; reason: FfiKeyRejection; atTs: bigint }) { - super("FfiImpairment", "MediaKeyRejected"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {memberId: string; senderUserId: string; reason: FfiKeyRejection; atTs: bigint }): MediaKeyRejected_ { - return new MediaKeyRejected_(inner); - } - - static instanceOf(obj: any): obj is MediaKeyRejected_ { - return obj.tag === FfiImpairment_Tags.MediaKeyRejected; - } - - } - - type ConnectionUnavailable__interface = { - tag: FfiImpairment_Tags.ConnectionUnavailable; - inner: -Readonly<{serviceUrl: string; memberIds: Array; lastError: string; retryAtTs: bigint}> - }; - class ConnectionUnavailable_ extends UniffiEnum implements ConnectionUnavailable__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.ConnectionUnavailable; - readonly inner: -Readonly<{serviceUrl: string; memberIds: Array; lastError: string; retryAtTs: bigint}>; - constructor( -inner: {serviceUrl: string; memberIds: Array; lastError: string; retryAtTs: bigint }) { - super("FfiImpairment", "ConnectionUnavailable"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {serviceUrl: string; memberIds: Array; lastError: string; retryAtTs: bigint }): ConnectionUnavailable_ { - return new ConnectionUnavailable_(inner); - } - - static instanceOf(obj: any): obj is ConnectionUnavailable_ { - return obj.tag === FfiImpairment_Tags.ConnectionUnavailable; - } - - } - - type ConnectionTokenExpired__interface = { - tag: FfiImpairment_Tags.ConnectionTokenExpired; - inner: -Readonly<{serviceUrl: string; expiredAtTs: bigint; lastError: string}> - }; - class ConnectionTokenExpired_ extends UniffiEnum implements ConnectionTokenExpired__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.ConnectionTokenExpired; - readonly inner: -Readonly<{serviceUrl: string; expiredAtTs: bigint; lastError: string}>; - constructor( -inner: {serviceUrl: string; expiredAtTs: bigint; lastError: string }) { - super("FfiImpairment", "ConnectionTokenExpired"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {serviceUrl: string; expiredAtTs: bigint; lastError: string }): ConnectionTokenExpired_ { - return new ConnectionTokenExpired_(inner); - } - - static instanceOf(obj: any): obj is ConnectionTokenExpired_ { - return obj.tag === FfiImpairment_Tags.ConnectionTokenExpired; - } - - } - - type SessionStateUnread__interface = { - tag: FfiImpairment_Tags.SessionStateUnread; - inner: -Readonly<{reads: Array}> - }; - class SessionStateUnread_ extends UniffiEnum implements SessionStateUnread__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.SessionStateUnread; - readonly inner: -Readonly<{reads: Array}>; - constructor( -inner: {reads: Array }) { - super("FfiImpairment", "SessionStateUnread"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {reads: Array }): SessionStateUnread_ { - return new SessionStateUnread_(inner); - } - - static instanceOf(obj: any): obj is SessionStateUnread_ { - return obj.tag === FfiImpairment_Tags.SessionStateUnread; - } - - } - - type JoinedBeforeSeed__interface = { - tag: FfiImpairment_Tags.JoinedBeforeSeed; - inner: -Readonly<{atTs: bigint}> - }; - class JoinedBeforeSeed_ extends UniffiEnum implements JoinedBeforeSeed__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiImpairment"; - readonly tag = FfiImpairment_Tags.JoinedBeforeSeed; - readonly inner: -Readonly<{atTs: bigint}>; - constructor( -inner: {atTs: bigint }) { - super("FfiImpairment", "JoinedBeforeSeed"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {atTs: bigint }): JoinedBeforeSeed_ { - return new JoinedBeforeSeed_(inner); - } - - static instanceOf(obj: any): obj is JoinedBeforeSeed_ { - return obj.tag === FfiImpairment_Tags.JoinedBeforeSeed; - } - - } - - function instanceOf(obj: any): obj is FfiImpairment { - return obj[uniffiTypeNameSymbol] === "FfiImpairment"; - } - - return Object.freeze({ - instanceOf, - HomeserverUnreachable: HomeserverUnreachable_, - KeepAliveRestartFailing: KeepAliveRestartFailing_, - KeepAliveExpired: KeepAliveExpired_, - KeepAliveUnavailable: KeepAliveUnavailable_, - MembershipRefreshFailing: MembershipRefreshFailing_, - OwnMembershipMissing: OwnMembershipMissing_, - OwnMembershipExcluded: OwnMembershipExcluded_, - MediaKeyNotDelivered: MediaKeyNotDelivered_, - MediaKeyNotReceived: MediaKeyNotReceived_, - MediaKeyRejected: MediaKeyRejected_, - ConnectionUnavailable: ConnectionUnavailable_, - ConnectionTokenExpired: ConnectionTokenExpired_, - SessionStateUnread: SessionStateUnread_, - JoinedBeforeSeed: JoinedBeforeSeed_ - }); - -})(); -/** - * A condition that is true right now and that the crate is still working - * on. Every variant clears by itself when the underlying operation - * succeeds — an impairment is never terminal; anything terminal ends the - * participation and appears as [`FfiDisconnectCause`] instead. - * - * A host that renders one warning banner can read this list and nothing - * else; the structured status above is for anything that needs the details. - */ -export type FfiImpairment = InstanceType< - typeof FfiImpairment['HomeserverUnreachable' | 'KeepAliveRestartFailing' | 'KeepAliveExpired' | 'KeepAliveUnavailable' | 'MembershipRefreshFailing' | 'OwnMembershipMissing' | 'OwnMembershipExcluded' | 'MediaKeyNotDelivered' | 'MediaKeyNotReceived' | 'MediaKeyRejected' | 'ConnectionUnavailable' | 'ConnectionTokenExpired' | 'SessionStateUnread' | 'JoinedBeforeSeed'] ->; - -// FfiConverter for enum FfiImpairment -const FfiConverterTypeFfiImpairment = (() => { - type TypeName = FfiImpairment; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new FfiImpairment.HomeserverUnreachable({sinceTs: FfiConverterUInt64.readFromCursor(c) }); - case 2: return new FfiImpairment.KeepAliveRestartFailing({sinceTs: FfiConverterUInt64.readFromCursor(c), firesAtTs: FfiConverterUInt64.readFromCursor(c), lastError: FfiConverterString.readFromCursor(c) }); - case 3: return new FfiImpairment.KeepAliveExpired({sinceTs: FfiConverterUInt64.readFromCursor(c) }); - case 4: return new FfiImpairment.KeepAliveUnavailable({permanent: FfiConverterBool.readFromCursor(c), membershipExpiresAtTs: FfiConverterUInt64.readFromCursor(c) }); - case 5: return new FfiImpairment.MembershipRefreshFailing({sinceTs: FfiConverterUInt64.readFromCursor(c), expiresAtTs: FfiConverterUInt64.readFromCursor(c), lastError: FfiConverterString.readFromCursor(c) }); - case 6: return new FfiImpairment.OwnMembershipMissing({sinceTs: FfiConverterUInt64.readFromCursor(c), republishedAtTs: FfiConverterOptionalUInt64.readFromCursor(c) }); - case 7: return new FfiImpairment.OwnMembershipExcluded({reason: FfiConverterTypeFfiJoinExclusionReason.readFromCursor(c) }); - case 8: return new FfiImpairment.MediaKeyNotDelivered({memberIds: FfiConverterSequenceString.readFromCursor(c) }); - case 9: return new FfiImpairment.MediaKeyNotReceived({memberIds: FfiConverterSequenceString.readFromCursor(c) }); - case 10: return new FfiImpairment.MediaKeyRejected({memberId: FfiConverterString.readFromCursor(c), senderUserId: FfiConverterString.readFromCursor(c), reason: FfiConverterTypeFfiKeyRejection.readFromCursor(c), atTs: FfiConverterUInt64.readFromCursor(c) }); - case 11: return new FfiImpairment.ConnectionUnavailable({serviceUrl: FfiConverterString.readFromCursor(c), memberIds: FfiConverterSequenceString.readFromCursor(c), lastError: FfiConverterString.readFromCursor(c), retryAtTs: FfiConverterUInt64.readFromCursor(c) }); - case 12: return new FfiImpairment.ConnectionTokenExpired({serviceUrl: FfiConverterString.readFromCursor(c), expiredAtTs: FfiConverterUInt64.readFromCursor(c), lastError: FfiConverterString.readFromCursor(c) }); - case 13: return new FfiImpairment.SessionStateUnread({reads: FfiConverterSequenceTypeFfiSessionRead.readFromCursor(c) }); - case 14: return new FfiImpairment.JoinedBeforeSeed({atTs: FfiConverterUInt64.readFromCursor(c) }); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case FfiImpairment_Tags.HomeserverUnreachable: { - c.writeI32(1); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.sinceTs, c); - return; - } - case FfiImpairment_Tags.KeepAliveRestartFailing: { - c.writeI32(2); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.sinceTs, c); - FfiConverterUInt64.writeIntoCursor(inner.firesAtTs, c); - FfiConverterString.writeIntoCursor(inner.lastError, c); - return; - } - case FfiImpairment_Tags.KeepAliveExpired: { - c.writeI32(3); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.sinceTs, c); - return; - } - case FfiImpairment_Tags.KeepAliveUnavailable: { - c.writeI32(4); - const inner = value.inner; - FfiConverterBool.writeIntoCursor(inner.permanent, c); - FfiConverterUInt64.writeIntoCursor(inner.membershipExpiresAtTs, c); - return; - } - case FfiImpairment_Tags.MembershipRefreshFailing: { - c.writeI32(5); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.sinceTs, c); - FfiConverterUInt64.writeIntoCursor(inner.expiresAtTs, c); - FfiConverterString.writeIntoCursor(inner.lastError, c); - return; - } - case FfiImpairment_Tags.OwnMembershipMissing: { - c.writeI32(6); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.sinceTs, c); - FfiConverterOptionalUInt64.writeIntoCursor(inner.republishedAtTs, c); - return; - } - case FfiImpairment_Tags.OwnMembershipExcluded: { - c.writeI32(7); - const inner = value.inner; - FfiConverterTypeFfiJoinExclusionReason.writeIntoCursor(inner.reason, c); - return; - } - case FfiImpairment_Tags.MediaKeyNotDelivered: { - c.writeI32(8); - const inner = value.inner; - FfiConverterSequenceString.writeIntoCursor(inner.memberIds, c); - return; - } - case FfiImpairment_Tags.MediaKeyNotReceived: { - c.writeI32(9); - const inner = value.inner; - FfiConverterSequenceString.writeIntoCursor(inner.memberIds, c); - return; - } - case FfiImpairment_Tags.MediaKeyRejected: { - c.writeI32(10); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner.memberId, c); - FfiConverterString.writeIntoCursor(inner.senderUserId, c); - FfiConverterTypeFfiKeyRejection.writeIntoCursor(inner.reason, c); - FfiConverterUInt64.writeIntoCursor(inner.atTs, c); - return; - } - case FfiImpairment_Tags.ConnectionUnavailable: { - c.writeI32(11); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner.serviceUrl, c); - FfiConverterSequenceString.writeIntoCursor(inner.memberIds, c); - FfiConverterString.writeIntoCursor(inner.lastError, c); - FfiConverterUInt64.writeIntoCursor(inner.retryAtTs, c); - return; - } - case FfiImpairment_Tags.ConnectionTokenExpired: { - c.writeI32(12); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner.serviceUrl, c); - FfiConverterUInt64.writeIntoCursor(inner.expiredAtTs, c); - FfiConverterString.writeIntoCursor(inner.lastError, c); - return; - } - case FfiImpairment_Tags.SessionStateUnread: { - c.writeI32(13); - const inner = value.inner; - FfiConverterSequenceTypeFfiSessionRead.writeIntoCursor(inner.reads, c); - return; - } - case FfiImpairment_Tags.JoinedBeforeSeed: { - c.writeI32(14); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.atTs, c); - return; - } - default: - // Throwing from here means that FfiImpairment_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case FfiImpairment_Tags.HomeserverUnreachable: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.sinceTs); - return size; - } - case FfiImpairment_Tags.KeepAliveRestartFailing: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.sinceTs); - size += FfiConverterUInt64.allocationSize(inner.firesAtTs); - size += FfiConverterString.allocationSize(inner.lastError); - return size; - } - case FfiImpairment_Tags.KeepAliveExpired: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.sinceTs); - return size; - } - case FfiImpairment_Tags.KeepAliveUnavailable: { - const inner = value.inner; - let size = 4; - size += FfiConverterBool.allocationSize(inner.permanent); - size += FfiConverterUInt64.allocationSize(inner.membershipExpiresAtTs); - return size; - } - case FfiImpairment_Tags.MembershipRefreshFailing: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.sinceTs); - size += FfiConverterUInt64.allocationSize(inner.expiresAtTs); - size += FfiConverterString.allocationSize(inner.lastError); - return size; - } - case FfiImpairment_Tags.OwnMembershipMissing: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.sinceTs); - size += FfiConverterOptionalUInt64.allocationSize(inner.republishedAtTs); - return size; - } - case FfiImpairment_Tags.OwnMembershipExcluded: { - const inner = value.inner; - let size = 4; - size += FfiConverterTypeFfiJoinExclusionReason.allocationSize(inner.reason); - return size; - } - case FfiImpairment_Tags.MediaKeyNotDelivered: { - const inner = value.inner; - let size = 4; - size += FfiConverterSequenceString.allocationSize(inner.memberIds); - return size; - } - case FfiImpairment_Tags.MediaKeyNotReceived: { - const inner = value.inner; - let size = 4; - size += FfiConverterSequenceString.allocationSize(inner.memberIds); - return size; - } - case FfiImpairment_Tags.MediaKeyRejected: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner.memberId); - size += FfiConverterString.allocationSize(inner.senderUserId); - size += FfiConverterTypeFfiKeyRejection.allocationSize(inner.reason); - size += FfiConverterUInt64.allocationSize(inner.atTs); - return size; - } - case FfiImpairment_Tags.ConnectionUnavailable: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner.serviceUrl); - size += FfiConverterSequenceString.allocationSize(inner.memberIds); - size += FfiConverterString.allocationSize(inner.lastError); - size += FfiConverterUInt64.allocationSize(inner.retryAtTs); - return size; - } - case FfiImpairment_Tags.ConnectionTokenExpired: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner.serviceUrl); - size += FfiConverterUInt64.allocationSize(inner.expiredAtTs); - size += FfiConverterString.allocationSize(inner.lastError); - return size; - } - case FfiImpairment_Tags.SessionStateUnread: { - const inner = value.inner; - let size = 4; - size += FfiConverterSequenceTypeFfiSessionRead.allocationSize(inner.reads); - return size; - } - case FfiImpairment_Tags.JoinedBeforeSeed: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.atTs); - return size; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - - -// Enum: FfiKeepAlive -export enum FfiKeepAlive_Tags { - Armed = "Armed", - Delegated = "Delegated", - RestartFailing = "RestartFailing", - Expired = "Expired", - Unavailable = "Unavailable" -} -/** - * The dead man's switch that clears our membership if this client dies. - * Mutually exclusive states of one mechanism. - */ -export const FfiKeepAlive = (() => { - - type Armed__interface = { - tag: FfiKeepAlive_Tags.Armed; - inner: -Readonly<{delayMs: bigint; lastRestartTs: bigint; firesAtTs: bigint}> - }; - /** - * Armed, and we restart it ourselves. - */ - class Armed_ extends UniffiEnum implements Armed__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiKeepAlive"; - readonly tag = FfiKeepAlive_Tags.Armed; - readonly inner: -Readonly<{delayMs: bigint; lastRestartTs: bigint; firesAtTs: bigint}>; - constructor( -inner: {delayMs: bigint; lastRestartTs: bigint; firesAtTs: bigint }) { - super("FfiKeepAlive", "Armed"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {delayMs: bigint; lastRestartTs: bigint; firesAtTs: bigint }): Armed_ { - return new Armed_(inner); - } - - static instanceOf(obj: any): obj is Armed_ { - return obj.tag === FfiKeepAlive_Tags.Armed; - } - - } - - type Delegated__interface = { - tag: FfiKeepAlive_Tags.Delegated; - inner: -Readonly<{delegatedAtTs: bigint; earliestFireTs: bigint; via: FfiDelegationRoute}> - }; - /** - * Handed to the SFU (MSC4195): we no longer restart it, so a frozen - * `last_restart_ts` is expected here rather than a fault. - */ - class Delegated_ extends UniffiEnum implements Delegated__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiKeepAlive"; - readonly tag = FfiKeepAlive_Tags.Delegated; - readonly inner: -Readonly<{delegatedAtTs: bigint; earliestFireTs: bigint; via: FfiDelegationRoute}>; - constructor( -inner: {delegatedAtTs: bigint; earliestFireTs: bigint; via: FfiDelegationRoute }) { - super("FfiKeepAlive", "Delegated"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {delegatedAtTs: bigint; earliestFireTs: bigint; via: FfiDelegationRoute }): Delegated_ { - return new Delegated_(inner); - } - - static instanceOf(obj: any): obj is Delegated_ { - return obj.tag === FfiKeepAlive_Tags.Delegated; - } - - } - - type RestartFailing__interface = { - tag: FfiKeepAlive_Tags.RestartFailing; - inner: -Readonly<{sinceTs: bigint; firesAtTs: bigint; lastError: string}> - }; - /** - * Armed, but restarts are failing — we drop out at `fires_at_ts` - * unless one succeeds. - */ - class RestartFailing_ extends UniffiEnum implements RestartFailing__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiKeepAlive"; - readonly tag = FfiKeepAlive_Tags.RestartFailing; - readonly inner: -Readonly<{sinceTs: bigint; firesAtTs: bigint; lastError: string}>; - constructor( -inner: {sinceTs: bigint; firesAtTs: bigint; lastError: string }) { - super("FfiKeepAlive", "RestartFailing"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {sinceTs: bigint; firesAtTs: bigint; lastError: string }): RestartFailing_ { - return new RestartFailing_(inner); - } - - static instanceOf(obj: any): obj is RestartFailing_ { - return obj.tag === FfiKeepAlive_Tags.RestartFailing; - } - - } - - type Expired__interface = { - tag: FfiKeepAlive_Tags.Expired; - inner: -Readonly<{sinceTs: bigint}> - }; - /** - * Its delay elapsed with no successful restart: we are probably out - * already. A replacement is being armed. - */ - class Expired_ extends UniffiEnum implements Expired__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiKeepAlive"; - readonly tag = FfiKeepAlive_Tags.Expired; - readonly inner: -Readonly<{sinceTs: bigint}>; - constructor( -inner: {sinceTs: bigint }) { - super("FfiKeepAlive", "Expired"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {sinceTs: bigint }): Expired_ { - return new Expired_(inner); - } - - static instanceOf(obj: any): obj is Expired_ { - return obj.tag === FfiKeepAlive_Tags.Expired; - } - - } - - type Unavailable__interface = { - tag: FfiKeepAlive_Tags.Unavailable; - inner: -Readonly<{permanent: boolean; nextProbeTs?: bigint}> - }; - /** - * None armed. `permanent` = this homeserver refuses delayed events for - * good; otherwise we re-probe at `next_probe_ts` (`Some(0)` = next beat). - */ - class Unavailable_ extends UniffiEnum implements Unavailable__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiKeepAlive"; - readonly tag = FfiKeepAlive_Tags.Unavailable; - readonly inner: -Readonly<{permanent: boolean; nextProbeTs?: bigint}>; - constructor( -inner: {permanent: boolean; nextProbeTs?: bigint }) { - super("FfiKeepAlive", "Unavailable"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {permanent: boolean; nextProbeTs?: bigint }): Unavailable_ { - return new Unavailable_(inner); - } - - static instanceOf(obj: any): obj is Unavailable_ { - return obj.tag === FfiKeepAlive_Tags.Unavailable; - } - - } - - function instanceOf(obj: any): obj is FfiKeepAlive { - return obj[uniffiTypeNameSymbol] === "FfiKeepAlive"; - } - - return Object.freeze({ - instanceOf, - Armed: Armed_, - Delegated: Delegated_, - RestartFailing: RestartFailing_, - Expired: Expired_, - Unavailable: Unavailable_ - }); - -})(); -/** - * The dead man's switch that clears our membership if this client dies. - * Mutually exclusive states of one mechanism. - */ -export type FfiKeepAlive = InstanceType< - typeof FfiKeepAlive['Armed' | 'Delegated' | 'RestartFailing' | 'Expired' | 'Unavailable'] ->; - -// FfiConverter for enum FfiKeepAlive -const FfiConverterTypeFfiKeepAlive = (() => { - type TypeName = FfiKeepAlive; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new FfiKeepAlive.Armed({delayMs: FfiConverterUInt64.readFromCursor(c), lastRestartTs: FfiConverterUInt64.readFromCursor(c), firesAtTs: FfiConverterUInt64.readFromCursor(c) }); - case 2: return new FfiKeepAlive.Delegated({delegatedAtTs: FfiConverterUInt64.readFromCursor(c), earliestFireTs: FfiConverterUInt64.readFromCursor(c), via: FfiConverterTypeFfiDelegationRoute.readFromCursor(c) }); - case 3: return new FfiKeepAlive.RestartFailing({sinceTs: FfiConverterUInt64.readFromCursor(c), firesAtTs: FfiConverterUInt64.readFromCursor(c), lastError: FfiConverterString.readFromCursor(c) }); - case 4: return new FfiKeepAlive.Expired({sinceTs: FfiConverterUInt64.readFromCursor(c) }); - case 5: return new FfiKeepAlive.Unavailable({permanent: FfiConverterBool.readFromCursor(c), nextProbeTs: FfiConverterOptionalUInt64.readFromCursor(c) }); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case FfiKeepAlive_Tags.Armed: { - c.writeI32(1); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.delayMs, c); - FfiConverterUInt64.writeIntoCursor(inner.lastRestartTs, c); - FfiConverterUInt64.writeIntoCursor(inner.firesAtTs, c); - return; - } - case FfiKeepAlive_Tags.Delegated: { - c.writeI32(2); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.delegatedAtTs, c); - FfiConverterUInt64.writeIntoCursor(inner.earliestFireTs, c); - FfiConverterTypeFfiDelegationRoute.writeIntoCursor(inner.via, c); - return; - } - case FfiKeepAlive_Tags.RestartFailing: { - c.writeI32(3); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.sinceTs, c); - FfiConverterUInt64.writeIntoCursor(inner.firesAtTs, c); - FfiConverterString.writeIntoCursor(inner.lastError, c); - return; - } - case FfiKeepAlive_Tags.Expired: { - c.writeI32(4); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.sinceTs, c); - return; - } - case FfiKeepAlive_Tags.Unavailable: { - c.writeI32(5); - const inner = value.inner; - FfiConverterBool.writeIntoCursor(inner.permanent, c); - FfiConverterOptionalUInt64.writeIntoCursor(inner.nextProbeTs, c); - return; - } - default: - // Throwing from here means that FfiKeepAlive_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case FfiKeepAlive_Tags.Armed: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.delayMs); - size += FfiConverterUInt64.allocationSize(inner.lastRestartTs); - size += FfiConverterUInt64.allocationSize(inner.firesAtTs); - return size; - } - case FfiKeepAlive_Tags.Delegated: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.delegatedAtTs); - size += FfiConverterUInt64.allocationSize(inner.earliestFireTs); - size += FfiConverterTypeFfiDelegationRoute.allocationSize(inner.via); - return size; - } - case FfiKeepAlive_Tags.RestartFailing: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.sinceTs); - size += FfiConverterUInt64.allocationSize(inner.firesAtTs); - size += FfiConverterString.allocationSize(inner.lastError); - return size; - } - case FfiKeepAlive_Tags.Expired: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.sinceTs); - return size; - } - case FfiKeepAlive_Tags.Unavailable: { - const inner = value.inner; - let size = 4; - size += FfiConverterBool.allocationSize(inner.permanent); - size += FfiConverterOptionalUInt64.allocationSize(inner.nextProbeTs); - return size; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - -/** - * The `log` crate's levels, for a [`LogSink`]. - */ -export enum FfiLogLevel { - Error, - Warn, - Info, - Debug, - Trace -} - -const FfiConverterTypeFfiLogLevel = (() => { - type TypeName = FfiLogLevel; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiLogLevel.Error; - case 2: return FfiLogLevel.Warn; - case 3: return FfiLogLevel.Info; - case 4: return FfiLogLevel.Debug; - case 5: return FfiLogLevel.Trace; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiLogLevel.Error: return c.writeI32(1); - case FfiLogLevel.Warn: return c.writeI32(2); - case FfiLogLevel.Info: return c.writeI32(3); - case FfiLogLevel.Debug: return c.writeI32(4); - case FfiLogLevel.Trace: return c.writeI32(5); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - - -// Enum: FfiRosterPresence -export enum FfiRosterPresence_Tags { - AwaitingEcho = "AwaitingEcho", - Present = "Present", - Missing = "Missing", - Excluded = "Excluded" -} -/** - * Whether the session projects our own membership — i.e. whether anybody - * can see us. - */ -export const FfiRosterPresence = (() => { - - type AwaitingEcho__interface = { - tag: FfiRosterPresence_Tags.AwaitingEcho - }; - /** - * Sent, echo not back yet. Not a fault. - */ - class AwaitingEcho_ extends UniffiEnum implements AwaitingEcho__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiRosterPresence"; - readonly tag = FfiRosterPresence_Tags.AwaitingEcho; - constructor() { - super("FfiRosterPresence", "AwaitingEcho"); - } - - static new(): AwaitingEcho_ { - return new AwaitingEcho_(); - } - - static instanceOf(obj: any): obj is AwaitingEcho_ { - return obj.tag === FfiRosterPresence_Tags.AwaitingEcho; - } - - } - - type Present__interface = { - tag: FfiRosterPresence_Tags.Present - }; - class Present_ extends UniffiEnum implements Present__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiRosterPresence"; - readonly tag = FfiRosterPresence_Tags.Present; - constructor() { - super("FfiRosterPresence", "Present"); - } - - static new(): Present_ { - return new Present_(); - } - - static instanceOf(obj: any): obj is Present_ { - return obj.tag === FfiRosterPresence_Tags.Present; - } - - } - - type Missing__interface = { - tag: FfiRosterPresence_Tags.Missing; - inner: -Readonly<{sinceTs: bigint; republishedAtTs?: bigint}> - }; - /** - * It was in the roster and is gone. - */ - class Missing_ extends UniffiEnum implements Missing__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiRosterPresence"; - readonly tag = FfiRosterPresence_Tags.Missing; - readonly inner: -Readonly<{sinceTs: bigint; republishedAtTs?: bigint}>; - constructor( -inner: {sinceTs: bigint; republishedAtTs?: bigint }) { - super("FfiRosterPresence", "Missing"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {sinceTs: bigint; republishedAtTs?: bigint }): Missing_ { - return new Missing_(inner); - } - - static instanceOf(obj: any): obj is Missing_ { - return obj.tag === FfiRosterPresence_Tags.Missing; - } - - } - - type Excluded__interface = { - tag: FfiRosterPresence_Tags.Excluded; - inner: -Readonly<{reason: FfiJoinExclusionReason}> - }; - /** - * On the server, but the session refuses to project it. The self-heal - * deliberately does not re-send here. - */ - class Excluded_ extends UniffiEnum implements Excluded__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiRosterPresence"; - readonly tag = FfiRosterPresence_Tags.Excluded; - readonly inner: -Readonly<{reason: FfiJoinExclusionReason}>; - constructor( -inner: {reason: FfiJoinExclusionReason }) { - super("FfiRosterPresence", "Excluded"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {reason: FfiJoinExclusionReason }): Excluded_ { - return new Excluded_(inner); - } - - static instanceOf(obj: any): obj is Excluded_ { - return obj.tag === FfiRosterPresence_Tags.Excluded; - } - - } - - function instanceOf(obj: any): obj is FfiRosterPresence { - return obj[uniffiTypeNameSymbol] === "FfiRosterPresence"; - } - - return Object.freeze({ - instanceOf, - AwaitingEcho: AwaitingEcho_, - Present: Present_, - Missing: Missing_, - Excluded: Excluded_ - }); - -})(); -/** - * Whether the session projects our own membership — i.e. whether anybody - * can see us. - */ -export type FfiRosterPresence = InstanceType< - typeof FfiRosterPresence['AwaitingEcho' | 'Present' | 'Missing' | 'Excluded'] ->; - -// FfiConverter for enum FfiRosterPresence -const FfiConverterTypeFfiRosterPresence = (() => { - type TypeName = FfiRosterPresence; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new FfiRosterPresence.AwaitingEcho(); - case 2: return new FfiRosterPresence.Present(); - case 3: return new FfiRosterPresence.Missing({sinceTs: FfiConverterUInt64.readFromCursor(c), republishedAtTs: FfiConverterOptionalUInt64.readFromCursor(c) }); - case 4: return new FfiRosterPresence.Excluded({reason: FfiConverterTypeFfiJoinExclusionReason.readFromCursor(c) }); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case FfiRosterPresence_Tags.AwaitingEcho: { - c.writeI32(1); - return; - } - case FfiRosterPresence_Tags.Present: { - c.writeI32(2); - return; - } - case FfiRosterPresence_Tags.Missing: { - c.writeI32(3); - const inner = value.inner; - FfiConverterUInt64.writeIntoCursor(inner.sinceTs, c); - FfiConverterOptionalUInt64.writeIntoCursor(inner.republishedAtTs, c); - return; - } - case FfiRosterPresence_Tags.Excluded: { - c.writeI32(4); - const inner = value.inner; - FfiConverterTypeFfiJoinExclusionReason.writeIntoCursor(inner.reason, c); - return; - } - default: - // Throwing from here means that FfiRosterPresence_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case FfiRosterPresence_Tags.AwaitingEcho: { - return 4; - } - case FfiRosterPresence_Tags.Present: { - return 4; - } - case FfiRosterPresence_Tags.Missing: { - const inner = value.inner; - let size = 4; - size += FfiConverterUInt64.allocationSize(inner.sinceTs); - size += FfiConverterOptionalUInt64.allocationSize(inner.republishedAtTs); - return size; - } - case FfiRosterPresence_Tags.Excluded: { - const inner = value.inner; - let size = 4; - size += FfiConverterTypeFfiJoinExclusionReason.allocationSize(inner.reason); - return size; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - -/** - * How severe an [`FfiImpairment`] is, and therefore where to render it. - */ -export enum FfiSeverity { - /** - * We are, or are about to be, out of the call — or peers cannot use - * our media. - */ - Critical, - /** - * Degraded but functioning; a crash or a timeout would now hurt. - */ - Degraded, - /** - * Worth surfacing in diagnostics, not in the call UI. - */ - Notice -} - -const FfiConverterTypeFfiSeverity = (() => { - type TypeName = FfiSeverity; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return FfiSeverity.Critical; - case 2: return FfiSeverity.Degraded; - case 3: return FfiSeverity.Notice; - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value) { - case FfiSeverity.Critical: return c.writeI32(1); - case FfiSeverity.Degraded: return c.writeI32(2); - case FfiSeverity.Notice: return c.writeI32(3); - } - } - allocationSize(value: TypeName): number { - return 4; - } - } - return new FFIConverter(); -})(); - - -// Enum: FfiStatus -export enum FfiStatus_Tags { - Disconnected = "Disconnected", - Joining = "Joining", - Connected = "Connected", - Leaving = "Leaving" -} -/** - * The participation status, in full. - * - * This used to be four opaque variants with everything else hidden behind - * `debug_snapshot`'s unversioned JSON — which is a diagnostics dump, not a - * UI contract. Every field a host needs is now typed. - */ -export const FfiStatus = (() => { - - type Disconnected__interface = { - tag: FfiStatus_Tags.Disconnected; - inner: -Readonly<{cause: FfiDisconnectCause}> - }; - class Disconnected_ extends UniffiEnum implements Disconnected__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiStatus"; - readonly tag = FfiStatus_Tags.Disconnected; - readonly inner: -Readonly<{cause: FfiDisconnectCause}>; - constructor( -inner: {cause: FfiDisconnectCause }) { - super("FfiStatus", "Disconnected"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {cause: FfiDisconnectCause }): Disconnected_ { - return new Disconnected_(inner); - } - - static instanceOf(obj: any): obj is Disconnected_ { - return obj.tag === FfiStatus_Tags.Disconnected; - } - - } - - type Joining__interface = { - tag: FfiStatus_Tags.Joining; - inner: -Readonly<{ownMembership: FfiJoinProgress; encryption: FfiEncryptionStatus; impairments: Array}> - }; - class Joining_ extends UniffiEnum implements Joining__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiStatus"; - readonly tag = FfiStatus_Tags.Joining; - readonly inner: -Readonly<{ownMembership: FfiJoinProgress; encryption: FfiEncryptionStatus; impairments: Array}>; - constructor( -inner: {ownMembership: FfiJoinProgress; encryption: FfiEncryptionStatus; impairments: Array }) { - super("FfiStatus", "Joining"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {ownMembership: FfiJoinProgress; encryption: FfiEncryptionStatus; impairments: Array }): Joining_ { - return new Joining_(inner); - } - - static instanceOf(obj: any): obj is Joining_ { - return obj.tag === FfiStatus_Tags.Joining; - } - - } - - type Connected__interface = { - tag: FfiStatus_Tags.Connected; - inner: -Readonly<{keepAlive: FfiKeepAlive; membership: FfiMembershipPublication; roster: FfiRosterPresence; encryption: FfiEncryptionStatus; impairments: Array}> - }; - class Connected_ extends UniffiEnum implements Connected__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiStatus"; - readonly tag = FfiStatus_Tags.Connected; - readonly inner: -Readonly<{keepAlive: FfiKeepAlive; membership: FfiMembershipPublication; roster: FfiRosterPresence; encryption: FfiEncryptionStatus; impairments: Array}>; - constructor( -inner: {keepAlive: FfiKeepAlive; membership: FfiMembershipPublication; roster: FfiRosterPresence; encryption: FfiEncryptionStatus; impairments: Array }) { - super("FfiStatus", "Connected"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {keepAlive: FfiKeepAlive; membership: FfiMembershipPublication; roster: FfiRosterPresence; encryption: FfiEncryptionStatus; impairments: Array }): Connected_ { - return new Connected_(inner); - } - - static instanceOf(obj: any): obj is Connected_ { - return obj.tag === FfiStatus_Tags.Connected; - } - - } - - type Leaving__interface = { - tag: FfiStatus_Tags.Leaving; - inner: -Readonly<{leaveEventSent: boolean; delayedLeave?: FfiDelayedLeaveOutcome; impairments: Array}> - }; - class Leaving_ extends UniffiEnum implements Leaving__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiStatus"; - readonly tag = FfiStatus_Tags.Leaving; - readonly inner: -Readonly<{leaveEventSent: boolean; delayedLeave?: FfiDelayedLeaveOutcome; impairments: Array}>; - constructor( -inner: {leaveEventSent: boolean; delayedLeave?: FfiDelayedLeaveOutcome; impairments: Array }) { - super("FfiStatus", "Leaving"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {leaveEventSent: boolean; delayedLeave?: FfiDelayedLeaveOutcome; impairments: Array }): Leaving_ { - return new Leaving_(inner); - } - - static instanceOf(obj: any): obj is Leaving_ { - return obj.tag === FfiStatus_Tags.Leaving; - } - - } - - function instanceOf(obj: any): obj is FfiStatus { - return obj[uniffiTypeNameSymbol] === "FfiStatus"; - } - - return Object.freeze({ - instanceOf, - Disconnected: Disconnected_, - Joining: Joining_, - Connected: Connected_, - Leaving: Leaving_ - }); - -})(); -/** - * The participation status, in full. - * - * This used to be four opaque variants with everything else hidden behind - * `debug_snapshot`'s unversioned JSON — which is a diagnostics dump, not a - * UI contract. Every field a host needs is now typed. - */ -export type FfiStatus = InstanceType< - typeof FfiStatus['Disconnected' | 'Joining' | 'Connected' | 'Leaving'] ->; - -// FfiConverter for enum FfiStatus -const FfiConverterTypeFfiStatus = (() => { - type TypeName = FfiStatus; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new FfiStatus.Disconnected({cause: FfiConverterTypeFfiDisconnectCause.readFromCursor(c) }); - case 2: return new FfiStatus.Joining({ownMembership: FfiConverterTypeFfiJoinProgress.readFromCursor(c), encryption: FfiConverterTypeFfiEncryptionStatus.readFromCursor(c), impairments: FfiConverterSequenceTypeFfiImpairment.readFromCursor(c) }); - case 3: return new FfiStatus.Connected({keepAlive: FfiConverterTypeFfiKeepAlive.readFromCursor(c), membership: FfiConverterTypeFfiMembershipPublication.readFromCursor(c), roster: FfiConverterTypeFfiRosterPresence.readFromCursor(c), encryption: FfiConverterTypeFfiEncryptionStatus.readFromCursor(c), impairments: FfiConverterSequenceTypeFfiImpairment.readFromCursor(c) }); - case 4: return new FfiStatus.Leaving({leaveEventSent: FfiConverterBool.readFromCursor(c), delayedLeave: FfiConverterOptionalTypeFfiDelayedLeaveOutcome.readFromCursor(c), impairments: FfiConverterSequenceTypeFfiImpairment.readFromCursor(c) }); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case FfiStatus_Tags.Disconnected: { - c.writeI32(1); - const inner = value.inner; - FfiConverterTypeFfiDisconnectCause.writeIntoCursor(inner.cause, c); - return; - } - case FfiStatus_Tags.Joining: { - c.writeI32(2); - const inner = value.inner; - FfiConverterTypeFfiJoinProgress.writeIntoCursor(inner.ownMembership, c); - FfiConverterTypeFfiEncryptionStatus.writeIntoCursor(inner.encryption, c); - FfiConverterSequenceTypeFfiImpairment.writeIntoCursor(inner.impairments, c); - return; - } - case FfiStatus_Tags.Connected: { - c.writeI32(3); - const inner = value.inner; - FfiConverterTypeFfiKeepAlive.writeIntoCursor(inner.keepAlive, c); - FfiConverterTypeFfiMembershipPublication.writeIntoCursor(inner.membership, c); - FfiConverterTypeFfiRosterPresence.writeIntoCursor(inner.roster, c); - FfiConverterTypeFfiEncryptionStatus.writeIntoCursor(inner.encryption, c); - FfiConverterSequenceTypeFfiImpairment.writeIntoCursor(inner.impairments, c); - return; - } - case FfiStatus_Tags.Leaving: { - c.writeI32(4); - const inner = value.inner; - FfiConverterBool.writeIntoCursor(inner.leaveEventSent, c); - FfiConverterOptionalTypeFfiDelayedLeaveOutcome.writeIntoCursor(inner.delayedLeave, c); - FfiConverterSequenceTypeFfiImpairment.writeIntoCursor(inner.impairments, c); - return; - } - default: - // Throwing from here means that FfiStatus_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case FfiStatus_Tags.Disconnected: { - const inner = value.inner; - let size = 4; - size += FfiConverterTypeFfiDisconnectCause.allocationSize(inner.cause); - return size; - } - case FfiStatus_Tags.Joining: { - const inner = value.inner; - let size = 4; - size += FfiConverterTypeFfiJoinProgress.allocationSize(inner.ownMembership); - size += FfiConverterTypeFfiEncryptionStatus.allocationSize(inner.encryption); - size += FfiConverterSequenceTypeFfiImpairment.allocationSize(inner.impairments); - return size; - } - case FfiStatus_Tags.Connected: { - const inner = value.inner; - let size = 4; - size += FfiConverterTypeFfiKeepAlive.allocationSize(inner.keepAlive); - size += FfiConverterTypeFfiMembershipPublication.allocationSize(inner.membership); - size += FfiConverterTypeFfiRosterPresence.allocationSize(inner.roster); - size += FfiConverterTypeFfiEncryptionStatus.allocationSize(inner.encryption); - size += FfiConverterSequenceTypeFfiImpairment.allocationSize(inner.impairments); - return size; - } - case FfiStatus_Tags.Leaving: { - const inner = value.inner; - let size = 4; - size += FfiConverterBool.allocationSize(inner.leaveEventSent); - size += FfiConverterOptionalTypeFfiDelayedLeaveOutcome.allocationSize(inner.delayedLeave); - size += FfiConverterSequenceTypeFfiImpairment.allocationSize(inner.impairments); - return size; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - - -// Enum: FfiTransportIntent -export enum FfiTransportIntent_Tags { - Publish = "Publish", - ReceiveOnly = "ReceiveOnly" -} -export const FfiTransportIntent = (() => { - - type Publish__interface = { - tag: FfiTransportIntent_Tags.Publish; - inner: -Readonly<{transport: FfiRtcTransport}> - }; - class Publish_ extends UniffiEnum implements Publish__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiTransportIntent"; - readonly tag = FfiTransportIntent_Tags.Publish; - readonly inner: -Readonly<{transport: FfiRtcTransport}>; - constructor( -inner: {transport: FfiRtcTransport }) { - super("FfiTransportIntent", "Publish"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {transport: FfiRtcTransport }): Publish_ { - return new Publish_(inner); - } - - static instanceOf(obj: any): obj is Publish_ { - return obj.tag === FfiTransportIntent_Tags.Publish; - } - - } - - type ReceiveOnly__interface = { - tag: FfiTransportIntent_Tags.ReceiveOnly; - inner: -Readonly<{canSubscribe: Array}> - }; - class ReceiveOnly_ extends UniffiEnum implements ReceiveOnly__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "FfiTransportIntent"; - readonly tag = FfiTransportIntent_Tags.ReceiveOnly; - readonly inner: -Readonly<{canSubscribe: Array}>; - constructor( -inner: {canSubscribe: Array }) { - super("FfiTransportIntent", "ReceiveOnly"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {canSubscribe: Array }): ReceiveOnly_ { - return new ReceiveOnly_(inner); - } - - static instanceOf(obj: any): obj is ReceiveOnly_ { - return obj.tag === FfiTransportIntent_Tags.ReceiveOnly; - } - - } - - function instanceOf(obj: any): obj is FfiTransportIntent { - return obj[uniffiTypeNameSymbol] === "FfiTransportIntent"; - } - - return Object.freeze({ - instanceOf, - Publish: Publish_, - ReceiveOnly: ReceiveOnly_ - }); - -})(); -export type FfiTransportIntent = InstanceType< - typeof FfiTransportIntent['Publish' | 'ReceiveOnly'] ->; - -// FfiConverter for enum FfiTransportIntent -const FfiConverterTypeFfiTransportIntent = (() => { - type TypeName = FfiTransportIntent; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new FfiTransportIntent.Publish({transport: FfiConverterTypeFfiRtcTransport.readFromCursor(c) }); - case 2: return new FfiTransportIntent.ReceiveOnly({canSubscribe: FfiConverterSequenceString.readFromCursor(c) }); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case FfiTransportIntent_Tags.Publish: { - c.writeI32(1); - const inner = value.inner; - FfiConverterTypeFfiRtcTransport.writeIntoCursor(inner.transport, c); - return; - } - case FfiTransportIntent_Tags.ReceiveOnly: { - c.writeI32(2); - const inner = value.inner; - FfiConverterSequenceString.writeIntoCursor(inner.canSubscribe, c); - return; - } - default: - // Throwing from here means that FfiTransportIntent_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case FfiTransportIntent_Tags.Publish: { - const inner = value.inner; - let size = 4; - size += FfiConverterTypeFfiRtcTransport.allocationSize(inner.transport); - return size; - } - case FfiTransportIntent_Tags.ReceiveOnly: { - const inner = value.inner; - let size = 4; - size += FfiConverterSequenceString.allocationSize(inner.canSubscribe); - return size; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - - -// Error type: RtcError -export enum RtcError_Tags { - InvalidInput = "InvalidInput", - Http = "Http", - Driver = "Driver", - Rejected = "Rejected", - Unsupported = "Unsupported", - RateLimited = "RateLimited", - Stopped = "Stopped", - AlreadyJoined = "AlreadyJoined", - NotJoined = "NotJoined", - SlotClosed = "SlotClosed", - NoTransport = "NoTransport", - TokenRefused = "TokenRefused", - EncryptionSetup = "EncryptionSetup" -} -/** - * Errors across the FFI, both directions. A foreign driver maps its - * homeserver errors onto these: `Rejected` = 403 `M_FORBIDDEN`, - * `Unsupported` = 404 `M_UNRECOGNIZED` — both read as "this homeserver will - * never do delayed events" by the own-membership machine. - */ -export const RtcError = (() => { - - type InvalidInput__interface = { - tag: RtcError_Tags.InvalidInput; - inner: -Readonly< -[string -]> - }; - class InvalidInput_ extends UniffiError implements InvalidInput__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.InvalidInput; - readonly inner: -Readonly< -[string -]>; - constructor(v0: string) { - super("RtcError", "InvalidInput"); - - this.inner = Object.freeze([v0]); - } - static new(v0: string): InvalidInput_ { - return new InvalidInput_(v0); - } - - static instanceOf(obj: any): obj is InvalidInput_ { - return obj.tag === RtcError_Tags.InvalidInput; - } - static hasInner(obj: any): obj is InvalidInput_ { - return InvalidInput_.instanceOf(obj); - } - - static getInner(obj: InvalidInput_): -Readonly< -[string -]> { - return obj.inner; - } - - } - - type Http__interface = { - tag: RtcError_Tags.Http; - inner: -Readonly< -[string -]> - }; - /** - * A homeserver HTTP failure — transient as far as this crate knows. - */ - class Http_ extends UniffiError implements Http__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.Http; - readonly inner: -Readonly< -[string -]>; - constructor(v0: string) { - super("RtcError", "Http"); - - this.inner = Object.freeze([v0]); - } - static new(v0: string): Http_ { - return new Http_(v0); - } - - static instanceOf(obj: any): obj is Http_ { - return obj.tag === RtcError_Tags.Http; - } - static hasInner(obj: any): obj is Http_ { - return Http_.instanceOf(obj); - } - - static getInner(obj: Http_): -Readonly< -[string -]> { - return obj.inner; - } - - } - - type Driver__interface = { - tag: RtcError_Tags.Driver; - inner: -Readonly< -[string -]> - }; - /** - * Anything the driver could not classify. - */ - class Driver_ extends UniffiError implements Driver__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.Driver; - readonly inner: -Readonly< -[string -]>; - constructor(v0: string) { - super("RtcError", "Driver"); - - this.inner = Object.freeze([v0]); - } - static new(v0: string): Driver_ { - return new Driver_(v0); - } - - static instanceOf(obj: any): obj is Driver_ { - return obj.tag === RtcError_Tags.Driver; - } - static hasInner(obj: any): obj is Driver_ { - return Driver_.instanceOf(obj); - } - - static getInner(obj: Driver_): -Readonly< -[string -]> { - return obj.inner; - } - - } - - type Rejected__interface = { - tag: RtcError_Tags.Rejected; - inner: -Readonly< -[string -]> - }; - class Rejected_ extends UniffiError implements Rejected__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.Rejected; - readonly inner: -Readonly< -[string -]>; - constructor(v0: string) { - super("RtcError", "Rejected"); - - this.inner = Object.freeze([v0]); - } - static new(v0: string): Rejected_ { - return new Rejected_(v0); - } - - static instanceOf(obj: any): obj is Rejected_ { - return obj.tag === RtcError_Tags.Rejected; - } - static hasInner(obj: any): obj is Rejected_ { - return Rejected_.instanceOf(obj); - } - - static getInner(obj: Rejected_): -Readonly< -[string -]> { - return obj.inner; - } - - } - - type Unsupported__interface = { - tag: RtcError_Tags.Unsupported; - inner: -Readonly< -[string -]> - }; - class Unsupported_ extends UniffiError implements Unsupported__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.Unsupported; - readonly inner: -Readonly< -[string -]>; - constructor(v0: string) { - super("RtcError", "Unsupported"); - - this.inner = Object.freeze([v0]); - } - static new(v0: string): Unsupported_ { - return new Unsupported_(v0); - } - - static instanceOf(obj: any): obj is Unsupported_ { - return obj.tag === RtcError_Tags.Unsupported; - } - static hasInner(obj: any): obj is Unsupported_ { - return Unsupported_.instanceOf(obj); - } - - static getInner(obj: Unsupported_): -Readonly< -[string -]> { - return obj.inner; - } - - } - - type RateLimited__interface = { - tag: RtcError_Tags.RateLimited; - inner: -Readonly<{retryAfterMs?: bigint}> - }; - /** - * `M_LIMIT_EXCEEDED`: back off for `retry_after_ms` before retrying. - */ - class RateLimited_ extends UniffiError implements RateLimited__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.RateLimited; - readonly inner: -Readonly<{retryAfterMs?: bigint}>; - constructor( -inner: {retryAfterMs?: bigint }) { - super("RtcError", "RateLimited"); - - this.inner = Object.freeze(inner); - } - static new( -inner: {retryAfterMs?: bigint }): RateLimited_ { - return new RateLimited_(inner); - } - - static instanceOf(obj: any): obj is RateLimited_ { - return obj.tag === RtcError_Tags.RateLimited; - } - static hasInner(obj: any): obj is RateLimited_ { - return RateLimited_.instanceOf(obj); - } - - static getInner(obj: RateLimited_): -Readonly<{retryAfterMs?: bigint}> { - return obj.inner; - } - - } - - type Stopped__interface = { - tag: RtcError_Tags.Stopped - }; - /** - * The manager behind the call has stopped; build a new one. - */ - class Stopped_ extends UniffiError implements Stopped__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.Stopped; - constructor() { - super("RtcError", "Stopped"); - } - - static new(): Stopped_ { - return new Stopped_(); - } - - static instanceOf(obj: any): obj is Stopped_ { - return obj.tag === RtcError_Tags.Stopped; - } - static hasInner(obj: any): obj is Stopped_ { - return false; - } - - } - - type AlreadyJoined__interface = { - tag: RtcError_Tags.AlreadyJoined - }; - class AlreadyJoined_ extends UniffiError implements AlreadyJoined__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.AlreadyJoined; - constructor() { - super("RtcError", "AlreadyJoined"); - } - - static new(): AlreadyJoined_ { - return new AlreadyJoined_(); - } - - static instanceOf(obj: any): obj is AlreadyJoined_ { - return obj.tag === RtcError_Tags.AlreadyJoined; - } - static hasInner(obj: any): obj is AlreadyJoined_ { - return false; - } - - } - - type NotJoined__interface = { - tag: RtcError_Tags.NotJoined - }; - class NotJoined_ extends UniffiError implements NotJoined__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.NotJoined; - constructor() { - super("RtcError", "NotJoined"); - } - - static new(): NotJoined_ { - return new NotJoined_(); - } - - static instanceOf(obj: any): obj is NotJoined_ { - return obj.tag === RtcError_Tags.NotJoined; - } - static hasInner(obj: any): obj is NotJoined_ { - return false; - } - - } - - type SlotClosed__interface = { - tag: RtcError_Tags.SlotClosed - }; - class SlotClosed_ extends UniffiError implements SlotClosed__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.SlotClosed; - constructor() { - super("RtcError", "SlotClosed"); - } - - static new(): SlotClosed_ { - return new SlotClosed_(); - } - - static instanceOf(obj: any): obj is SlotClosed_ { - return obj.tag === RtcError_Tags.SlotClosed; - } - static hasInner(obj: any): obj is SlotClosed_ { - return false; - } - - } - - type NoTransport__interface = { - tag: RtcError_Tags.NoTransport; - inner: -Readonly< -[string -]> - }; - /** - * The homeserver advertises no usable RTC transport — a configuration - * problem; retrying will not help. - */ - class NoTransport_ extends UniffiError implements NoTransport__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.NoTransport; - readonly inner: -Readonly< -[string -]>; - constructor(v0: string) { - super("RtcError", "NoTransport"); - - this.inner = Object.freeze([v0]); - } - static new(v0: string): NoTransport_ { - return new NoTransport_(v0); - } - - static instanceOf(obj: any): obj is NoTransport_ { - return obj.tag === RtcError_Tags.NoTransport; - } - static hasInner(obj: any): obj is NoTransport_ { - return NoTransport_.instanceOf(obj); - } - - static getInner(obj: NoTransport_): -Readonly< -[string -]> { - return obj.inner; - } - - } - - type TokenRefused__interface = { - tag: RtcError_Tags.TokenRefused; - inner: -Readonly< -[string -]> - }; - /** - * A transport exists but its token could not be minted — auth or - * network; retrying may help. - */ - class TokenRefused_ extends UniffiError implements TokenRefused__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.TokenRefused; - readonly inner: -Readonly< -[string -]>; - constructor(v0: string) { - super("RtcError", "TokenRefused"); - - this.inner = Object.freeze([v0]); - } - static new(v0: string): TokenRefused_ { - return new TokenRefused_(v0); - } - - static instanceOf(obj: any): obj is TokenRefused_ { - return obj.tag === RtcError_Tags.TokenRefused; - } - static hasInner(obj: any): obj is TokenRefused_ { - return TokenRefused_.instanceOf(obj); - } - - static getInner(obj: TokenRefused_): -Readonly< -[string -]> { - return obj.inner; - } - - } - - type EncryptionSetup__interface = { - tag: RtcError_Tags.EncryptionSetup; - inner: -Readonly< -[string -]> - }; - /** - * A crate precondition, not a caller mistake. - */ - class EncryptionSetup_ extends UniffiError implements EncryptionSetup__interface { - /** - * @private - * This field is private and should not be used, use `tag` instead. - */ - readonly [uniffiTypeNameSymbol] = "RtcError"; - readonly tag = RtcError_Tags.EncryptionSetup; - readonly inner: -Readonly< -[string -]>; - constructor(v0: string) { - super("RtcError", "EncryptionSetup"); - - this.inner = Object.freeze([v0]); - } - static new(v0: string): EncryptionSetup_ { - return new EncryptionSetup_(v0); - } - - static instanceOf(obj: any): obj is EncryptionSetup_ { - return obj.tag === RtcError_Tags.EncryptionSetup; - } - static hasInner(obj: any): obj is EncryptionSetup_ { - return EncryptionSetup_.instanceOf(obj); - } - - static getInner(obj: EncryptionSetup_): -Readonly< -[string -]> { - return obj.inner; - } - - } - - function instanceOf(obj: any): obj is RtcError { - return obj[uniffiTypeNameSymbol] === "RtcError"; - } - - return Object.freeze({ - instanceOf, - InvalidInput: InvalidInput_, - Http: Http_, - Driver: Driver_, - Rejected: Rejected_, - Unsupported: Unsupported_, - RateLimited: RateLimited_, - Stopped: Stopped_, - AlreadyJoined: AlreadyJoined_, - NotJoined: NotJoined_, - SlotClosed: SlotClosed_, - NoTransport: NoTransport_, - TokenRefused: TokenRefused_, - EncryptionSetup: EncryptionSetup_ - }); - -})(); -/** - * Errors across the FFI, both directions. A foreign driver maps its - * homeserver errors onto these: `Rejected` = 403 `M_FORBIDDEN`, - * `Unsupported` = 404 `M_UNRECOGNIZED` — both read as "this homeserver will - * never do delayed events" by the own-membership machine. - */ -export type RtcError = InstanceType< - typeof RtcError['InvalidInput' | 'Http' | 'Driver' | 'Rejected' | 'Unsupported' | 'RateLimited' | 'Stopped' | 'AlreadyJoined' | 'NotJoined' | 'SlotClosed' | 'NoTransport' | 'TokenRefused' | 'EncryptionSetup'] ->; - -// FfiConverter for enum RtcError -const FfiConverterTypeRtcError = (() => { - type TypeName = RtcError; - class FFIConverter extends AbstractFfiConverterByteArray { - readFromCursor(c: Cursor): TypeName { - switch (c.readI32()) { - case 1: return new RtcError.InvalidInput(FfiConverterString.readFromCursor(c)); - case 2: return new RtcError.Http(FfiConverterString.readFromCursor(c)); - case 3: return new RtcError.Driver(FfiConverterString.readFromCursor(c)); - case 4: return new RtcError.Rejected(FfiConverterString.readFromCursor(c)); - case 5: return new RtcError.Unsupported(FfiConverterString.readFromCursor(c)); - case 6: return new RtcError.RateLimited({retryAfterMs: FfiConverterOptionalUInt64.readFromCursor(c) }); - case 7: return new RtcError.Stopped(); - case 8: return new RtcError.AlreadyJoined(); - case 9: return new RtcError.NotJoined(); - case 10: return new RtcError.SlotClosed(); - case 11: return new RtcError.NoTransport(FfiConverterString.readFromCursor(c)); - case 12: return new RtcError.TokenRefused(FfiConverterString.readFromCursor(c)); - case 13: return new RtcError.EncryptionSetup(FfiConverterString.readFromCursor(c)); - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - writeIntoCursor(value: TypeName, c: Cursor): void { - switch (value.tag) { - case RtcError_Tags.InvalidInput: { - c.writeI32(1); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner[0], c); - return; - } - case RtcError_Tags.Http: { - c.writeI32(2); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner[0], c); - return; - } - case RtcError_Tags.Driver: { - c.writeI32(3); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner[0], c); - return; - } - case RtcError_Tags.Rejected: { - c.writeI32(4); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner[0], c); - return; - } - case RtcError_Tags.Unsupported: { - c.writeI32(5); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner[0], c); - return; - } - case RtcError_Tags.RateLimited: { - c.writeI32(6); - const inner = value.inner; - FfiConverterOptionalUInt64.writeIntoCursor(inner.retryAfterMs, c); - return; - } - case RtcError_Tags.Stopped: { - c.writeI32(7); - return; - } - case RtcError_Tags.AlreadyJoined: { - c.writeI32(8); - return; - } - case RtcError_Tags.NotJoined: { - c.writeI32(9); - return; - } - case RtcError_Tags.SlotClosed: { - c.writeI32(10); - return; - } - case RtcError_Tags.NoTransport: { - c.writeI32(11); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner[0], c); - return; - } - case RtcError_Tags.TokenRefused: { - c.writeI32(12); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner[0], c); - return; - } - case RtcError_Tags.EncryptionSetup: { - c.writeI32(13); - const inner = value.inner; - FfiConverterString.writeIntoCursor(inner[0], c); - return; - } - default: - // Throwing from here means that RtcError_Tags hasn't matched an ordinal. - throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - allocationSize(value: TypeName): number { - switch (value.tag) { - case RtcError_Tags.InvalidInput: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner[0]); - return size; - } - case RtcError_Tags.Http: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner[0]); - return size; - } - case RtcError_Tags.Driver: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner[0]); - return size; - } - case RtcError_Tags.Rejected: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner[0]); - return size; - } - case RtcError_Tags.Unsupported: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner[0]); - return size; - } - case RtcError_Tags.RateLimited: { - const inner = value.inner; - let size = 4; - size += FfiConverterOptionalUInt64.allocationSize(inner.retryAfterMs); - return size; - } - case RtcError_Tags.Stopped: { - return 4; - } - case RtcError_Tags.AlreadyJoined: { - return 4; - } - case RtcError_Tags.NotJoined: { - return 4; - } - case RtcError_Tags.SlotClosed: { - return 4; - } - case RtcError_Tags.NoTransport: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner[0]); - return size; - } - case RtcError_Tags.TokenRefused: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner[0]); - return size; - } - case RtcError_Tags.EncryptionSetup: { - const inner = value.inner; - let size = 4; - size += FfiConverterString.allocationSize(inner[0]); - return size; - } - default: throw new UniffiInternalError.UnexpectedEnumCase(); - } - } - } - return new FFIConverter(); -})(); - -export interface ConnectionsListener { - - onConnectionsChange(connections: Array): void; -} - - -export class ConnectionsListenerImpl extends UniffiAbstractObject implements ConnectionsListener { - - readonly [uniffiTypeNameSymbol] = "ConnectionsListenerImpl"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeConnectionsListenerImplObjectFactory.bless(pointer); -} - - - - - onConnectionsChange(connections: Array): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_connectionslistener_on_connections_change( - uniffiTypeConnectionsListenerImplObjectFactory.clonePointer(this), - FfiConverterSequenceTypeFfiConnectionWithMembers.lower(connections, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeConnectionsListenerImplObjectFactory.pointer(this); - uniffiTypeConnectionsListenerImplObjectFactory.freePointer(pointer); - uniffiTypeConnectionsListenerImplObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is ConnectionsListenerImpl { - return uniffiTypeConnectionsListenerImplObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeConnectionsListenerImplObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeConnectionsListenerImplObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): ConnectionsListener { - const instance = Object.create(ConnectionsListenerImpl.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "ConnectionsListenerImpl"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: ConnectionsListener): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: ConnectionsListener): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_connectionslistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_connectionslistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is ConnectionsListener { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ConnectionsListenerImpl"; - }, -}})(); -const FfiConverterTypeConnectionsListener = new FfiConverterObjectWithCallbacks(uniffiTypeConnectionsListenerImplObjectFactory); - -// Add a vtable for the callbacks that go in ConnectionsListener. - -// Put the implementation in a struct so we don't pollute the top-level namespace -const uniffiCallbackInterfaceConnectionsListener: { vtable: any; register: () => void; } = { - // Create the VTable using a series of closures. - // ts automatically converts these into C callback functions. - vtable: { - on_connections_change: ( - uniffiHandle: bigint, - connections: Uint8Array,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeConnectionsListener.lift(uniffiHandle); - return jsCallback.onConnectionsChange( - FfiConverterSequenceTypeFfiConnectionWithMembers.lift(connections) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - uniffi_free: (uniffiHandle: UniffiHandle): void => { - // this will throw a stale handle error if the handle isn't found. - FfiConverterTypeConnectionsListener.drop(uniffiHandle); - }, - uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { - return FfiConverterTypeConnectionsListener.clone(uniffiHandle); - } - }, - register: () => {nativeModule().ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_connectionslistener( - uniffiCallbackInterfaceConnectionsListener.vtable - ); - }, -}; - -/** - * One end of the driver's connectivity stream: the host emits the new - * verdict whenever its homeserver connection comes or goes (a syncing - * client: sync running or not). `false` from `emit` means no consumer is - * left — unhook the handler. - */ -export interface ConnectivitySinkLike { - - emit(connected: boolean): boolean; -} -/** - * @deprecated Use `ConnectivitySinkLike` instead. - */ -export type ConnectivitySinkInterface = ConnectivitySinkLike; - - -/** - * One end of the driver's connectivity stream: the host emits the new - * verdict whenever its homeserver connection comes or goes (a syncing - * client: sync running or not). `false` from `emit` means no consumer is - * left — unhook the handler. - */ -export class ConnectivitySink extends UniffiAbstractObject implements ConnectivitySinkLike { - - readonly [uniffiTypeNameSymbol] = "ConnectivitySink"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeConnectivitySinkObjectFactory.bless(pointer); -} - - - - - emit(connected: boolean): boolean { - return FfiConverterBool.lift(uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_connectivitysink_emit( - uniffiTypeConnectivitySinkObjectFactory.clonePointer(this), - FfiConverterBool.lower(connected, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - )); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeConnectivitySinkObjectFactory.pointer(this); - uniffiTypeConnectivitySinkObjectFactory.freePointer(pointer); - uniffiTypeConnectivitySinkObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is ConnectivitySink { - return uniffiTypeConnectivitySinkObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeConnectivitySinkObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeConnectivitySinkObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): ConnectivitySinkLike { - const instance = Object.create(ConnectivitySink.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "ConnectivitySink"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: ConnectivitySinkLike): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: ConnectivitySinkLike): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_connectivitysink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_connectivitysink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is ConnectivitySinkLike { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ConnectivitySink"; - }, -}})(); -const FfiConverterTypeConnectivitySink = new FfiConverterObject(uniffiTypeConnectivitySinkObjectFactory); - -/** - * The FFI driver object — the one place a foreign [`MatrixDriverCallback`] - * becomes a [`crate::driver::MatrixDriver`]. Room-scoped and room-lived, - * like matrix-rust-sdk's widget `MatrixDriver`: construct it once per room - * and share it across managers (one room can hold several slots). - * - * It is both the FFI handle *and* the adapter: the trait impls below - * translate JSON-string payloads and FFI records into the crate's driver - * types. The foreign `subscribe_*` handshake happens in [`Self::new`], each - * sink feeding one inbound channel; the Rust trait's `subscribe_*` methods - * (fresh receiver per call) are served by fanning those channels out - * internally — so any number of managers consume a foreign driver exactly - * like a native one. - */ -export interface FfiMatrixDriverLike { - -} -/** - * @deprecated Use `FfiMatrixDriverLike` instead. - */ -export type FfiMatrixDriverInterface = FfiMatrixDriverLike; - - -/** - * The FFI driver object — the one place a foreign [`MatrixDriverCallback`] - * becomes a [`crate::driver::MatrixDriver`]. Room-scoped and room-lived, - * like matrix-rust-sdk's widget `MatrixDriver`: construct it once per room - * and share it across managers (one room can hold several slots). - * - * It is both the FFI handle *and* the adapter: the trait impls below - * translate JSON-string payloads and FFI records into the crate's driver - * types. The foreign `subscribe_*` handshake happens in [`Self::new`], each - * sink feeding one inbound channel; the Rust trait's `subscribe_*` methods - * (fresh receiver per call) are served by fanning those channels out - * internally — so any number of managers consume a foreign driver exactly - * like a native one. - */ -export class FfiMatrixDriver extends UniffiAbstractObject implements FfiMatrixDriverLike { - - readonly [uniffiTypeNameSymbol] = "FfiMatrixDriver"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; -/** - * Performs the `subscribe_*` handshake with the foreign driver - * (synchronously, exactly once). - */ - constructor(callback: MatrixDriverCallback) { - super(); - const pointer = - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_constructor_ffimatrixdriver_new( - FfiConverterTypeMatrixDriverCallback.lower(callback, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeFfiMatrixDriverObjectFactory.bless(pointer); - } - - - - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeFfiMatrixDriverObjectFactory.pointer(this); - uniffiTypeFfiMatrixDriverObjectFactory.freePointer(pointer); - uniffiTypeFfiMatrixDriverObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is FfiMatrixDriver { - return uniffiTypeFfiMatrixDriverObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeFfiMatrixDriverObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeFfiMatrixDriverObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): FfiMatrixDriverLike { - const instance = Object.create(FfiMatrixDriver.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "FfiMatrixDriver"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: FfiMatrixDriverLike): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: FfiMatrixDriverLike): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_ffimatrixdriver(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_ffimatrixdriver(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is FfiMatrixDriverLike { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "FfiMatrixDriver"; - }, -}})(); -const FfiConverterTypeFfiMatrixDriver = new FfiConverterObject(uniffiTypeFfiMatrixDriverObjectFactory); - -export interface KeyMapListener { - -/** - * The full map plus the one key that changed — route `change` to the LK - * room(s) of that member. - */ - onKeyMapChange(keyMap: Array, change: FfiMediaKey): void; -} - - -export class KeyMapListenerImpl extends UniffiAbstractObject implements KeyMapListener { - - readonly [uniffiTypeNameSymbol] = "KeyMapListenerImpl"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeKeyMapListenerImplObjectFactory.bless(pointer); -} - - - - -/** - * The full map plus the one key that changed — route `change` to the LK - * room(s) of that member. - */ - onKeyMapChange(keyMap: Array, change: FfiMediaKey): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_keymaplistener_on_key_map_change( - uniffiTypeKeyMapListenerImplObjectFactory.clonePointer(this), - FfiConverterSequenceTypeFfiMediaKey.lower(keyMap, nativeModule().rustbuffer_alloc), - FfiConverterTypeFfiMediaKey.lower(change, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeKeyMapListenerImplObjectFactory.pointer(this); - uniffiTypeKeyMapListenerImplObjectFactory.freePointer(pointer); - uniffiTypeKeyMapListenerImplObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is KeyMapListenerImpl { - return uniffiTypeKeyMapListenerImplObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeKeyMapListenerImplObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeKeyMapListenerImplObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): KeyMapListener { - const instance = Object.create(KeyMapListenerImpl.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "KeyMapListenerImpl"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: KeyMapListener): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: KeyMapListener): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_keymaplistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_keymaplistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is KeyMapListener { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "KeyMapListenerImpl"; - }, -}})(); -const FfiConverterTypeKeyMapListener = new FfiConverterObjectWithCallbacks(uniffiTypeKeyMapListenerImplObjectFactory); - -// Add a vtable for the callbacks that go in KeyMapListener. - -// Put the implementation in a struct so we don't pollute the top-level namespace -const uniffiCallbackInterfaceKeyMapListener: { vtable: any; register: () => void; } = { - // Create the VTable using a series of closures. - // ts automatically converts these into C callback functions. - vtable: { - on_key_map_change: ( - uniffiHandle: bigint, - keyMap: Uint8Array, - change: Uint8Array,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeKeyMapListener.lift(uniffiHandle); - return jsCallback.onKeyMapChange( - FfiConverterSequenceTypeFfiMediaKey.lift(keyMap), - FfiConverterTypeFfiMediaKey.lift(change) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - uniffi_free: (uniffiHandle: UniffiHandle): void => { - // this will throw a stale handle error if the handle isn't found. - FfiConverterTypeKeyMapListener.drop(uniffiHandle); - }, - uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { - return FfiConverterTypeKeyMapListener.clone(uniffiHandle); - } - }, - register: () => {nativeModule().ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_keymaplistener( - uniffiCallbackInterfaceKeyMapListener.vtable - ); - }, -}; - -export interface KeyRejectedListener { - -/** - * An inbound media key was discarded: `member_id` names whose, `reason` - * says why. - * - * **Secondary** to `FfiMembership::media_key.rejection` and - * `FfiImpairment::MediaKeyRejected`, which a UI attaching late still - * finds; this is for logging and telemetry. - */ - onKeyRejected(memberId: string, reason: FfiKeyRejection): void; -} - - -export class KeyRejectedListenerImpl extends UniffiAbstractObject implements KeyRejectedListener { - - readonly [uniffiTypeNameSymbol] = "KeyRejectedListenerImpl"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeKeyRejectedListenerImplObjectFactory.bless(pointer); -} - - - - -/** - * An inbound media key was discarded: `member_id` names whose, `reason` - * says why. - * - * **Secondary** to `FfiMembership::media_key.rejection` and - * `FfiImpairment::MediaKeyRejected`, which a UI attaching late still - * finds; this is for logging and telemetry. - */ - onKeyRejected(memberId: string, reason: FfiKeyRejection): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_keyrejectedlistener_on_key_rejected( - uniffiTypeKeyRejectedListenerImplObjectFactory.clonePointer(this), - FfiConverterString.lower(memberId, nativeModule().rustbuffer_alloc), - FfiConverterTypeFfiKeyRejection.lower(reason, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeKeyRejectedListenerImplObjectFactory.pointer(this); - uniffiTypeKeyRejectedListenerImplObjectFactory.freePointer(pointer); - uniffiTypeKeyRejectedListenerImplObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is KeyRejectedListenerImpl { - return uniffiTypeKeyRejectedListenerImplObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeKeyRejectedListenerImplObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeKeyRejectedListenerImplObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): KeyRejectedListener { - const instance = Object.create(KeyRejectedListenerImpl.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "KeyRejectedListenerImpl"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: KeyRejectedListener): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: KeyRejectedListener): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_keyrejectedlistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_keyrejectedlistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is KeyRejectedListener { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "KeyRejectedListenerImpl"; - }, -}})(); -const FfiConverterTypeKeyRejectedListener = new FfiConverterObjectWithCallbacks(uniffiTypeKeyRejectedListenerImplObjectFactory); - -// Add a vtable for the callbacks that go in KeyRejectedListener. - -// Put the implementation in a struct so we don't pollute the top-level namespace -const uniffiCallbackInterfaceKeyRejectedListener: { vtable: any; register: () => void; } = { - // Create the VTable using a series of closures. - // ts automatically converts these into C callback functions. - vtable: { - on_key_rejected: ( - uniffiHandle: bigint, - memberId: Uint8Array, - reason: Uint8Array,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeKeyRejectedListener.lift(uniffiHandle); - return jsCallback.onKeyRejected( - FfiConverterString.lift(memberId), - FfiConverterTypeFfiKeyRejection.lift(reason) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - uniffi_free: (uniffiHandle: UniffiHandle): void => { - // this will throw a stale handle error if the handle isn't found. - FfiConverterTypeKeyRejectedListener.drop(uniffiHandle); - }, - uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { - return FfiConverterTypeKeyRejectedListener.clone(uniffiHandle); - } - }, - register: () => {nativeModule().ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_keyrejectedlistener( - uniffiCallbackInterfaceKeyRejectedListener.vtable - ); - }, -}; - -export interface MembershipsListener { - -/** - * One tile per membership; use the connections output to acquire each - * tile's media (`membership.connections` -> LK room, - * `membership.transport_identity` -> participant). - */ - onMembershipsChange(memberships: Array): void; -} - - -export class MembershipsListenerImpl extends UniffiAbstractObject implements MembershipsListener { - - readonly [uniffiTypeNameSymbol] = "MembershipsListenerImpl"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeMembershipsListenerImplObjectFactory.bless(pointer); -} - - - - -/** - * One tile per membership; use the connections output to acquire each - * tile's media (`membership.connections` -> LK room, - * `membership.transport_identity` -> participant). - */ - onMembershipsChange(memberships: Array): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_membershipslistener_on_memberships_change( - uniffiTypeMembershipsListenerImplObjectFactory.clonePointer(this), - FfiConverterSequenceTypeFfiMembership.lower(memberships, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeMembershipsListenerImplObjectFactory.pointer(this); - uniffiTypeMembershipsListenerImplObjectFactory.freePointer(pointer); - uniffiTypeMembershipsListenerImplObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is MembershipsListenerImpl { - return uniffiTypeMembershipsListenerImplObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeMembershipsListenerImplObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeMembershipsListenerImplObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): MembershipsListener { - const instance = Object.create(MembershipsListenerImpl.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "MembershipsListenerImpl"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: MembershipsListener): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: MembershipsListener): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_membershipslistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_membershipslistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is MembershipsListener { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "MembershipsListenerImpl"; - }, -}})(); -const FfiConverterTypeMembershipsListener = new FfiConverterObjectWithCallbacks(uniffiTypeMembershipsListenerImplObjectFactory); - -// Add a vtable for the callbacks that go in MembershipsListener. - -// Put the implementation in a struct so we don't pollute the top-level namespace -const uniffiCallbackInterfaceMembershipsListener: { vtable: any; register: () => void; } = { - // Create the VTable using a series of closures. - // ts automatically converts these into C callback functions. - vtable: { - on_memberships_change: ( - uniffiHandle: bigint, - memberships: Uint8Array,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeMembershipsListener.lift(uniffiHandle); - return jsCallback.onMembershipsChange( - FfiConverterSequenceTypeFfiMembership.lift(memberships) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - uniffi_free: (uniffiHandle: UniffiHandle): void => { - // this will throw a stale handle error if the handle isn't found. - FfiConverterTypeMembershipsListener.drop(uniffiHandle); - }, - uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { - return FfiConverterTypeMembershipsListener.clone(uniffiHandle); - } - }, - register: () => {nativeModule().ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_membershipslistener( - uniffiCallbackInterfaceMembershipsListener.vtable - ); - }, -}; - -export interface SessionListener { - -/** - * The room's view of the session changed (seed done, slot opened or - * closed, roster moved): what `session()` answers now. - */ - onSessionChange(session: FfiSessionSnapshot): void; -} - - -export class SessionListenerImpl extends UniffiAbstractObject implements SessionListener { - - readonly [uniffiTypeNameSymbol] = "SessionListenerImpl"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeSessionListenerImplObjectFactory.bless(pointer); -} - - - - -/** - * The room's view of the session changed (seed done, slot opened or - * closed, roster moved): what `session()` answers now. - */ - onSessionChange(session: FfiSessionSnapshot): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_sessionlistener_on_session_change( - uniffiTypeSessionListenerImplObjectFactory.clonePointer(this), - FfiConverterTypeFfiSessionSnapshot.lower(session, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeSessionListenerImplObjectFactory.pointer(this); - uniffiTypeSessionListenerImplObjectFactory.freePointer(pointer); - uniffiTypeSessionListenerImplObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is SessionListenerImpl { - return uniffiTypeSessionListenerImplObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeSessionListenerImplObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeSessionListenerImplObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): SessionListener { - const instance = Object.create(SessionListenerImpl.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "SessionListenerImpl"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: SessionListener): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: SessionListener): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_sessionlistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_sessionlistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is SessionListener { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "SessionListenerImpl"; - }, -}})(); -const FfiConverterTypeSessionListener = new FfiConverterObjectWithCallbacks(uniffiTypeSessionListenerImplObjectFactory); - -// Add a vtable for the callbacks that go in SessionListener. - -// Put the implementation in a struct so we don't pollute the top-level namespace -const uniffiCallbackInterfaceSessionListener: { vtable: any; register: () => void; } = { - // Create the VTable using a series of closures. - // ts automatically converts these into C callback functions. - vtable: { - on_session_change: ( - uniffiHandle: bigint, - session: Uint8Array,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeSessionListener.lift(uniffiHandle); - return jsCallback.onSessionChange( - FfiConverterTypeFfiSessionSnapshot.lift(session) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - uniffi_free: (uniffiHandle: UniffiHandle): void => { - // this will throw a stale handle error if the handle isn't found. - FfiConverterTypeSessionListener.drop(uniffiHandle); - }, - uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { - return FfiConverterTypeSessionListener.clone(uniffiHandle); - } - }, - register: () => {nativeModule().ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_sessionlistener( - uniffiCallbackInterfaceSessionListener.vtable - ); - }, -}; - -export interface StatusListener { - - onStatusChange(status: FfiStatus): void; -} - - -export class StatusListenerImpl extends UniffiAbstractObject implements StatusListener { - - readonly [uniffiTypeNameSymbol] = "StatusListenerImpl"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeStatusListenerImplObjectFactory.bless(pointer); -} - - - - - onStatusChange(status: FfiStatus): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_statuslistener_on_status_change( - uniffiTypeStatusListenerImplObjectFactory.clonePointer(this), - FfiConverterTypeFfiStatus.lower(status, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeStatusListenerImplObjectFactory.pointer(this); - uniffiTypeStatusListenerImplObjectFactory.freePointer(pointer); - uniffiTypeStatusListenerImplObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is StatusListenerImpl { - return uniffiTypeStatusListenerImplObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeStatusListenerImplObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeStatusListenerImplObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): StatusListener { - const instance = Object.create(StatusListenerImpl.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "StatusListenerImpl"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: StatusListener): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: StatusListener): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_statuslistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_statuslistener(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is StatusListener { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "StatusListenerImpl"; - }, -}})(); -const FfiConverterTypeStatusListener = new FfiConverterObjectWithCallbacks(uniffiTypeStatusListenerImplObjectFactory); - -// Add a vtable for the callbacks that go in StatusListener. - -// Put the implementation in a struct so we don't pollute the top-level namespace -const uniffiCallbackInterfaceStatusListener: { vtable: any; register: () => void; } = { - // Create the VTable using a series of closures. - // ts automatically converts these into C callback functions. - vtable: { - on_status_change: ( - uniffiHandle: bigint, - status: Uint8Array,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeStatusListener.lift(uniffiHandle); - return jsCallback.onStatusChange( - FfiConverterTypeFfiStatus.lift(status) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - uniffi_free: (uniffiHandle: UniffiHandle): void => { - // this will throw a stale handle error if the handle isn't found. - FfiConverterTypeStatusListener.drop(uniffiHandle); - }, - uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { - return FfiConverterTypeStatusListener.clone(uniffiHandle); - } - }, - register: () => {nativeModule().ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_statuslistener( - uniffiCallbackInterfaceStatusListener.vtable - ); - }, -}; - -/** - * FFI wrapper around [`ParticipationManager`]. - */ -export interface FfiParticipationManagerLike { - - closeSlot(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; -/** - * Wanted connections the host cannot currently use, with the members - * whose media is affected. Empty is the healthy case. - */ - connectionProblems(): Array; - connections(): Array; -/** - * Diagnostics JSON: an unversioned dump for bug reports, **not** a UI - * contract. Everything a UI needs is typed on `status()`, - * `session()`, `memberships()` and `connection_problems()`. - */ - debugSnapshot(): string; -/** - * Whether the driver currently reports the homeserver reachable. Inside a - * participation the same fact is `FfiImpairment::HomeserverUnreachable` - * in the status; this covers the lobby and the post-call screen. - */ - isHomeserverConnected(): boolean; - join(intent: FfiTransportIntent, params: FfiJoinParams, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; - keyMap(): Array; -/** - * `code` defaults to MSC4143's plain `leave`. - */ - leave(code: string | undefined, reason: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; -/** - * The session's joined projection plus left members still holding our - * keys (see [`FfiMembershipState`]). - */ - memberships(): Array; - openSlot(applicationType: string, encrypted: boolean, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; -/** - * Open this manager's slot (`m.per_member` encryption when `encrypted`). - * Our member id for this participation; `None` while not joined. - * - * Every self-referential check needs it — am I in the roster - * (`session().excluded_candidates`), which LiveKit participant is me - * (`own_membership().transport_identity`). Matching on - * `(user_id, device_id)` is not a substitute: one device may hold - * several RTC members, and a rejoin mints a fresh id. - */ - ownMemberId(): string | undefined; -/** - * Our own entry in `memberships()`, when the session projects it. - */ - ownMembership(): FfiMembership | undefined; -/** - * Our LiveKit participant identity, known from the moment `join()` - * starts (before our membership echo). `None` while not joined. - */ - ownTransportIdentity(): string | undefined; -/** - * The live session snapshot (slot open?, encrypted?, members, start - * time) — the same record `compute_sessions_from_events` returns. - */ - session(): FfiSessionSnapshot; - setConnectionsListener(listener: ConnectionsListener): void; - setKeyMapListener(listener: KeyMapListener): void; - setKeyRejectedListener(listener: KeyRejectedListener): void; - setMembershipsListener(listener: MembershipsListener): void; - setSessionListener(listener: SessionListener): void; - setStatusListener(listener: StatusListener): void; - status(): FfiStatus; -/** - * Change `application["m.call.intent"]` (e.g. `"audio"` / `"video"`) - * while joined: the membership is re-published with it. `None` removes - * the intent. Rejects with `NotJoined` outside a participation. - */ - updateApplication(intent: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; -} -/** - * @deprecated Use `FfiParticipationManagerLike` instead. - */ -export type FfiParticipationManagerInterface = FfiParticipationManagerLike; - - -/** - * FFI wrapper around [`ParticipationManager`]. - */ -export class FfiParticipationManager extends UniffiAbstractObject implements FfiParticipationManagerLike { - - readonly [uniffiTypeNameSymbol] = "FfiParticipationManager"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; -/** - * One manager per `(room, slot)`; `user_id`/`device_id` are who we - * publish as. Any number of managers may share one driver. - */ - constructor(roomId: string, slotId: string, userId: string, deviceId: string, driver: FfiMatrixDriverLike, config: FfiParticipationConfig) { - super(); - const pointer = - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_constructor_ffiparticipationmanager_new( - FfiConverterString.lower(roomId, nativeModule().rustbuffer_alloc), - FfiConverterString.lower(slotId, nativeModule().rustbuffer_alloc), - FfiConverterString.lower(userId, nativeModule().rustbuffer_alloc), - FfiConverterString.lower(deviceId, nativeModule().rustbuffer_alloc), - FfiConverterTypeFfiMatrixDriver.lower(driver, nativeModule().rustbuffer_alloc), - FfiConverterTypeFfiParticipationConfig.lower(config, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeFfiParticipationManagerObjectFactory.bless(pointer); - } - - - - - async closeSlot(asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_close_slot( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_void, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_void, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_void, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_void, - /*liftFunc:*/ (_v) => {}, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * Wanted connections the host cannot currently use, with the members - * whose media is affected. Empty is the healthy case. - */ - connectionProblems(): Array { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_connection_problems( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterSequenceTypeFfiConnectionProblem.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - - connections(): Array { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_connections( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterSequenceTypeFfiConnectionWithMembers.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - -/** - * Diagnostics JSON: an unversioned dump for bug reports, **not** a UI - * contract. Everything a UI needs is typed on `status()`, - * `session()`, `memberships()` and `connection_problems()`. - */ - debugSnapshot(): string { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_debug_snapshot( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterString.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - -/** - * Whether the driver currently reports the homeserver reachable. Inside a - * participation the same fact is `FfiImpairment::HomeserverUnreachable` - * in the status; this covers the lobby and the post-call screen. - */ - isHomeserverConnected(): boolean { - return FfiConverterBool.lift(uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_is_homeserver_connected( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - )); - } - - async join(intent: FfiTransportIntent, params: FfiJoinParams, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_join( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this),FfiConverterTypeFfiTransportIntent.lower(intent, nativeModule().rustbuffer_alloc),FfiConverterTypeFfiJoinParams.lower(params, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_void, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_void, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_void, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_void, - /*liftFunc:*/ (_v) => {}, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - - keyMap(): Array { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_key_map( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterSequenceTypeFfiMediaKey.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - -/** - * `code` defaults to MSC4143's plain `leave`. - */ - async leave(code: string | undefined, reason: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_leave( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this),FfiConverterOptionalString.lower(code, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(reason, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_void, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_void, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_void, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_void, - /*liftFunc:*/ (_v) => {}, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * The session's joined projection plus left members still holding our - * keys (see [`FfiMembershipState`]). - */ - memberships(): Array { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_memberships( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterSequenceTypeFfiMembership.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - - async openSlot(applicationType: string, encrypted: boolean, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_open_slot( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this),FfiConverterString.lower(applicationType, nativeModule().rustbuffer_alloc),FfiConverterBool.lower(encrypted, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_void, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_void, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_void, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_void, - /*liftFunc:*/ (_v) => {}, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * Open this manager's slot (`m.per_member` encryption when `encrypted`). - * Our member id for this participation; `None` while not joined. - * - * Every self-referential check needs it — am I in the roster - * (`session().excluded_candidates`), which LiveKit participant is me - * (`own_membership().transport_identity`). Matching on - * `(user_id, device_id)` is not a substitute: one device may hold - * several RTC members, and a rejoin mints a fresh id. - */ - ownMemberId(): string | undefined { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_own_member_id( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterOptionalString.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - -/** - * Our own entry in `memberships()`, when the session projects it. - */ - ownMembership(): FfiMembership | undefined { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_own_membership( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterOptionalTypeFfiMembership.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - -/** - * Our LiveKit participant identity, known from the moment `join()` - * starts (before our membership echo). `None` while not joined. - */ - ownTransportIdentity(): string | undefined { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_own_transport_identity( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterOptionalString.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - -/** - * The live session snapshot (slot open?, encrypted?, members, start - * time) — the same record `compute_sessions_from_events` returns. - */ - session(): FfiSessionSnapshot { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_session( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterTypeFfiSessionSnapshot.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - - setConnectionsListener(listener: ConnectionsListener): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_connections_listener( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - FfiConverterTypeConnectionsListener.lower(listener, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - setKeyMapListener(listener: KeyMapListener): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_key_map_listener( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - FfiConverterTypeKeyMapListener.lower(listener, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - setKeyRejectedListener(listener: KeyRejectedListener): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_key_rejected_listener( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - FfiConverterTypeKeyRejectedListener.lower(listener, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - setMembershipsListener(listener: MembershipsListener): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_memberships_listener( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - FfiConverterTypeMembershipsListener.lower(listener, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - setSessionListener(listener: SessionListener): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_session_listener( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - FfiConverterTypeSessionListener.lower(listener, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - setStatusListener(listener: StatusListener): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_status_listener( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - FfiConverterTypeStatusListener.lower(listener, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - status(): FfiStatus { - const __rb: Uint8Array = uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_status( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - try { - return FfiConverterTypeFfiStatus.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - } - -/** - * Change `application["m.call.intent"]` (e.g. `"audio"` / `"video"`) - * while joined: the membership is re-published with it. `None` removes - * the intent. Rejects with `NotJoined` outside a participation. - */ - async updateApplication(intent: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_update_application( - uniffiTypeFfiParticipationManagerObjectFactory.clonePointer(this),FfiConverterOptionalString.lower(intent, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_void, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_void, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_void, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_void, - /*liftFunc:*/ (_v) => {}, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeFfiParticipationManagerObjectFactory.pointer(this); - uniffiTypeFfiParticipationManagerObjectFactory.freePointer(pointer); - uniffiTypeFfiParticipationManagerObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is FfiParticipationManager { - return uniffiTypeFfiParticipationManagerObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeFfiParticipationManagerObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeFfiParticipationManagerObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): FfiParticipationManagerLike { - const instance = Object.create(FfiParticipationManager.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "FfiParticipationManager"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: FfiParticipationManagerLike): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: FfiParticipationManagerLike): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_ffiparticipationmanager(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_ffiparticipationmanager(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is FfiParticipationManagerLike { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "FfiParticipationManager"; - }, -}})(); -const FfiConverterTypeFfiParticipationManager = new FfiConverterObject(uniffiTypeFfiParticipationManagerObjectFactory); - -/** - * Where the crate's log lines go. Nothing is logged until a host installs - * one with [`set_log_sink`]: the crate speaks through the `log` facade and - * has no output of its own, so that its lines land in the host's log (and - * its rageshakes) rather than on a console the host does not read. - * - * `target` is the Rust module path (`matrix_rtc::own_membership::machine`), - * `message` the formatted line. Called synchronously from wherever the - * crate logs; keep it cheap and never call back into the crate from it. - */ -export interface LogSink { - - log(level: FfiLogLevel, target: string, message: string): void; -} - - -/** - * Where the crate's log lines go. Nothing is logged until a host installs - * one with [`set_log_sink`]: the crate speaks through the `log` facade and - * has no output of its own, so that its lines land in the host's log (and - * its rageshakes) rather than on a console the host does not read. - * - * `target` is the Rust module path (`matrix_rtc::own_membership::machine`), - * `message` the formatted line. Called synchronously from wherever the - * crate logs; keep it cheap and never call back into the crate from it. - */ -export class LogSinkImpl extends UniffiAbstractObject implements LogSink { - - readonly [uniffiTypeNameSymbol] = "LogSinkImpl"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeLogSinkImplObjectFactory.bless(pointer); -} - - - - - log(level: FfiLogLevel, target: string, message: string): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_logsink_log( - uniffiTypeLogSinkImplObjectFactory.clonePointer(this), - FfiConverterTypeFfiLogLevel.lower(level, nativeModule().rustbuffer_alloc), - FfiConverterString.lower(target, nativeModule().rustbuffer_alloc), - FfiConverterString.lower(message, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeLogSinkImplObjectFactory.pointer(this); - uniffiTypeLogSinkImplObjectFactory.freePointer(pointer); - uniffiTypeLogSinkImplObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is LogSinkImpl { - return uniffiTypeLogSinkImplObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeLogSinkImplObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeLogSinkImplObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): LogSink { - const instance = Object.create(LogSinkImpl.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "LogSinkImpl"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: LogSink): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: LogSink): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_logsink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_logsink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is LogSink { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "LogSinkImpl"; - }, -}})(); -const FfiConverterTypeLogSink = new FfiConverterObjectWithCallbacks(uniffiTypeLogSinkImplObjectFactory); - -// Add a vtable for the callbacks that go in LogSink. - -// Put the implementation in a struct so we don't pollute the top-level namespace -const uniffiCallbackInterfaceLogSink: { vtable: any; register: () => void; } = { - // Create the VTable using a series of closures. - // ts automatically converts these into C callback functions. - vtable: { - log: ( - uniffiHandle: bigint, - level: Uint8Array, - target: Uint8Array, - message: Uint8Array,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeLogSink.lift(uniffiHandle); - return jsCallback.log( - FfiConverterTypeFfiLogLevel.lift(level), - FfiConverterString.lift(target), - FfiConverterString.lift(message) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - uniffi_free: (uniffiHandle: UniffiHandle): void => { - // this will throw a stale handle error if the handle isn't found. - FfiConverterTypeLogSink.drop(uniffiHandle); - }, - uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { - return FfiConverterTypeLogSink.clone(uniffiHandle); - } - }, - register: () => {nativeModule().ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_logsink( - uniffiCallbackInterfaceLogSink.vtable - ); - }, -}; - -/** - * One end of a driver event stream: Rust-exported objects handed to the - * foreign driver through the `subscribe_*` methods. The host calls `emit` - * from its own event handlers (e.g. matrix-js-sdk listeners); `false` means - * the Rust side dropped the stream — unhook the handler (this plays the - * role of matrix-rust-sdk's `EventHandlerDropGuard`). - */ -export interface RoomEventSinkLike { - -/** - * Any room event — sticky or state; the session dispatches on type. - * `event_json` is the full event object (see `session::dispatch`), the - * *decrypted* one for encrypted events, with `origin` carrying the - * decryption metadata. Returns `false` once no consumer is left. - */ - emit(eventJson: string, origin: FfiEventOrigin): boolean; -} -/** - * @deprecated Use `RoomEventSinkLike` instead. - */ -export type RoomEventSinkInterface = RoomEventSinkLike; - - -/** - * One end of a driver event stream: Rust-exported objects handed to the - * foreign driver through the `subscribe_*` methods. The host calls `emit` - * from its own event handlers (e.g. matrix-js-sdk listeners); `false` means - * the Rust side dropped the stream — unhook the handler (this plays the - * role of matrix-rust-sdk's `EventHandlerDropGuard`). - */ -export class RoomEventSink extends UniffiAbstractObject implements RoomEventSinkLike { - - readonly [uniffiTypeNameSymbol] = "RoomEventSink"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeRoomEventSinkObjectFactory.bless(pointer); -} - - - - -/** - * Any room event — sticky or state; the session dispatches on type. - * `event_json` is the full event object (see `session::dispatch`), the - * *decrypted* one for encrypted events, with `origin` carrying the - * decryption metadata. Returns `false` once no consumer is left. - */ - emit(eventJson: string, origin: FfiEventOrigin): boolean { - return FfiConverterBool.lift(uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_roomeventsink_emit( - uniffiTypeRoomEventSinkObjectFactory.clonePointer(this), - FfiConverterString.lower(eventJson, nativeModule().rustbuffer_alloc), - FfiConverterTypeFfiEventOrigin.lower(origin, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - )); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeRoomEventSinkObjectFactory.pointer(this); - uniffiTypeRoomEventSinkObjectFactory.freePointer(pointer); - uniffiTypeRoomEventSinkObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is RoomEventSink { - return uniffiTypeRoomEventSinkObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeRoomEventSinkObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeRoomEventSinkObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): RoomEventSinkLike { - const instance = Object.create(RoomEventSink.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "RoomEventSink"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: RoomEventSinkLike): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: RoomEventSinkLike): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_roomeventsink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_roomeventsink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is RoomEventSinkLike { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "RoomEventSink"; - }, -}})(); -const FfiConverterTypeRoomEventSink = new FfiConverterObject(uniffiTypeRoomEventSinkObjectFactory); - -export interface ToDeviceSinkLike { - -/** - * A decrypted to-device message with its origin metadata. - * `sender_cross_signed` is the MSC4153 verdict on the sending device - * (`None` = the host cannot tell, treated as not signed: media keys - * from such devices are rejected unless configured otherwise). - */ - emit(eventType: string, sender: string, contentJson: string, origin: FfiEventOrigin, senderCrossSigned: boolean | undefined): boolean; -} -/** - * @deprecated Use `ToDeviceSinkLike` instead. - */ -export type ToDeviceSinkInterface = ToDeviceSinkLike; - - -export class ToDeviceSink extends UniffiAbstractObject implements ToDeviceSinkLike { - - readonly [uniffiTypeNameSymbol] = "ToDeviceSink"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeToDeviceSinkObjectFactory.bless(pointer); -} - - - - -/** - * A decrypted to-device message with its origin metadata. - * `sender_cross_signed` is the MSC4153 verdict on the sending device - * (`None` = the host cannot tell, treated as not signed: media keys - * from such devices are rejected unless configured otherwise). - */ - emit(eventType: string, sender: string, contentJson: string, origin: FfiEventOrigin, senderCrossSigned: boolean | undefined): boolean { - return FfiConverterBool.lift(uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_todevicesink_emit( - uniffiTypeToDeviceSinkObjectFactory.clonePointer(this), - FfiConverterString.lower(eventType, nativeModule().rustbuffer_alloc), - FfiConverterString.lower(sender, nativeModule().rustbuffer_alloc), - FfiConverterString.lower(contentJson, nativeModule().rustbuffer_alloc), - FfiConverterTypeFfiEventOrigin.lower(origin, nativeModule().rustbuffer_alloc), - FfiConverterOptionalBoolean.lower(senderCrossSigned, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - )); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeToDeviceSinkObjectFactory.pointer(this); - uniffiTypeToDeviceSinkObjectFactory.freePointer(pointer); - uniffiTypeToDeviceSinkObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is ToDeviceSink { - return uniffiTypeToDeviceSinkObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeToDeviceSinkObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeToDeviceSinkObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): ToDeviceSinkLike { - const instance = Object.create(ToDeviceSink.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "ToDeviceSink"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: ToDeviceSinkLike): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: ToDeviceSinkLike): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_todevicesink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_todevicesink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is ToDeviceSinkLike { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "ToDeviceSink"; - }, -}})(); -const FfiConverterTypeToDeviceSink = new FfiConverterObject(uniffiTypeToDeviceSinkObjectFactory); - -export interface StateUpdateSinkLike { - -/** - * A batch of changed room-state events (applied atomically by the - * session: one snapshot per batch). State events are never encrypted, - * so their origin is `Cleartext`. - */ - emit(eventsJson: Array): boolean; -} -/** - * @deprecated Use `StateUpdateSinkLike` instead. - */ -export type StateUpdateSinkInterface = StateUpdateSinkLike; - - -export class StateUpdateSink extends UniffiAbstractObject implements StateUpdateSinkLike { - - readonly [uniffiTypeNameSymbol] = "StateUpdateSink"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeStateUpdateSinkObjectFactory.bless(pointer); -} - - - - -/** - * A batch of changed room-state events (applied atomically by the - * session: one snapshot per batch). State events are never encrypted, - * so their origin is `Cleartext`. - */ - emit(eventsJson: Array): boolean { - return FfiConverterBool.lift(uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_stateupdatesink_emit( - uniffiTypeStateUpdateSinkObjectFactory.clonePointer(this), - FfiConverterSequenceString.lower(eventsJson, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - )); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeStateUpdateSinkObjectFactory.pointer(this); - uniffiTypeStateUpdateSinkObjectFactory.freePointer(pointer); - uniffiTypeStateUpdateSinkObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is StateUpdateSink { - return uniffiTypeStateUpdateSinkObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeStateUpdateSinkObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeStateUpdateSinkObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): StateUpdateSinkLike { - const instance = Object.create(StateUpdateSink.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "StateUpdateSink"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: StateUpdateSinkLike): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: StateUpdateSinkLike): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_stateupdatesink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_stateupdatesink(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is StateUpdateSinkLike { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "StateUpdateSink"; - }, -}})(); -const FfiConverterTypeStateUpdateSink = new FfiConverterObject(uniffiTypeStateUpdateSinkObjectFactory); - -/** - * The host-implemented Matrix driver: the same seam as - * [`crate::driver::MatrixDriver`], flattened for FFI. matrix-rust-sdk hosts - * adapt their `MatrixDriver`; a matrix-js-sdk host implements this directly. - * - * Inbound events are a driver job too: the `subscribe_*` methods hand the - * host a sink to emit into. Each is called synchronously, **exactly once**, - * during [`FfiMatrixDriver`] construction — store the sink and hook the - * actual event handlers whenever convenient afterwards. Single-sink - * semantics: fan-out to multiple managers happens on the Rust side. - * - * (`async_trait` must sit *under* the uniffi attribute: uniffi parses the - * original `async fn` tokens.) - */ -export interface MatrixDriverCallback { - - sendStickyEvent(roomId: string, eventType: string, contentJson: string, durationMs: bigint, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; - sendStateEvent(roomId: string, eventType: string, stateKey: string, contentJson: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; -/** - * Returns the MSC4140 delay id (not an event id). `sticky_duration_ms` - * makes it a delayed *sticky* event (MSC4354 + MSC4140); ignore it if - * the host SDK cannot express both yet. - */ - sendDelayedEvent(roomId: string, eventType: string, contentJson: string, delayMs: bigint, stickyDurationMs: bigint | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; -/** - * Delayed state event — compat only (`StateEvents`). - */ - sendDelayedStateEvent(roomId: string, eventType: string, stateKey: string, contentJson: string, delayMs: bigint, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; - restartDelayedEvent(roomId: string, delayId: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; - cancelDelayedEvent(roomId: string, delayId: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; -/** - * MSC4195: hand the delayed leave to the SFU. `livekit_service_url` is - * the transport we publish on (`None` for a receive-only member) and - * `delay_ms` the armed delay — what an adapter that delegates through - * the authorisation service's token endpoint needs. - * MSC4195 via the homeserver: one authenticated - * `POST /_matrix/client/unstable/io.element.msc4195/rtc/livekit/delegate_delayed_leave` - * with `{ url, room_id, slot_id, member, delay_id, delay_timeout }` (see - * `FfiHomeserverDelegationRequest`). A client that cannot make - * authenticated homeserver calls (a widget) throws `Unsupported`; the - * crate then tries the authorisation service. - */ - delegateDelayedLeaveViaHomeserver(request: FfiHomeserverDelegationRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; -/** - * MSC4195 via the authorisation service: the `get_token` (or, with - * `legacy_sfu_get`, `sfu/get`) request the adapter already makes, with - * `delay_id`, `delay_timeout` (= `delay_timeout_ms`) and the adapter's - * own CS API URL (`delay_cs_api_url`) added. Discard the token. - */ - delegateDelayedLeaveViaTransport(request: FfiTransportDelegationRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; - sendToDevice(recipients: Array, eventType: string, contentJson: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise>; -/** - * `GET /_matrix/client/v1/rtc/transports`, with well-known fallback. - */ - getRtcTransports(asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise>; -/** - * MSC4195 token exchange, OpenID token included (see - * [`FfiLivekitTokenRequest`]). - */ - getLivekitToken(request: FfiLivekitTokenRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise; -/** - * Latest `limit` timeline events of `event_type`, as JSON strings. - */ - readEvents(eventType: string, stateKey: string | undefined, limit: number, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise>; -/** - * Current state entries of `event_type` (`state_key: None` = any). - */ - readState(eventType: string, stateKey: string | undefined, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise>; -/** - * Live room events (sticky member events, slot/state changes). Store - * the sink; call `emit` from the host SDK's event handlers. - */ - subscribeRoomEvents(sink: RoomEventSinkLike): void; -/** - * Decrypted inbound to-device events with origin metadata. - */ - subscribeToDeviceEvents(sink: ToDeviceSinkLike): void; -/** - * Room-state update batches (what notices a slot closing promptly). - */ - subscribeStateUpdates(sink: StateUpdateSinkLike): void; -/** - * Whether the homeserver is reachable right now (a syncing client: its - * sync loop is running). - */ - isHomeserverConnected(): boolean; -/** - * Live connectivity verdicts. Store the sink; `emit` the new value from - * the host SDK's sync-state handler. - */ - subscribeConnectivity(sink: ConnectivitySinkLike): void; -} - - -/** - * The host-implemented Matrix driver: the same seam as - * [`crate::driver::MatrixDriver`], flattened for FFI. matrix-rust-sdk hosts - * adapt their `MatrixDriver`; a matrix-js-sdk host implements this directly. - * - * Inbound events are a driver job too: the `subscribe_*` methods hand the - * host a sink to emit into. Each is called synchronously, **exactly once**, - * during [`FfiMatrixDriver`] construction — store the sink and hook the - * actual event handlers whenever convenient afterwards. Single-sink - * semantics: fan-out to multiple managers happens on the Rust side. - * - * (`async_trait` must sit *under* the uniffi attribute: uniffi parses the - * original `async fn` tokens.) - */ -export class MatrixDriverCallbackImpl extends UniffiAbstractObject implements MatrixDriverCallback { - - readonly [uniffiTypeNameSymbol] = "MatrixDriverCallbackImpl"; - readonly [destructorGuardSymbol]: UniffiGcObject; - readonly [pointerLiteralSymbol]: UniffiHandle; - // No primary constructor declared for this class. -private constructor(pointer: UniffiHandle) { - super(); - this[pointerLiteralSymbol] = pointer; - this[destructorGuardSymbol] = uniffiTypeMatrixDriverCallbackImplObjectFactory.bless(pointer); -} - - - - - async sendStickyEvent(roomId: string, eventType: string, contentJson: string, durationMs: bigint, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_sticky_event( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterString.lower(roomId, nativeModule().rustbuffer_alloc),FfiConverterString.lower(eventType, nativeModule().rustbuffer_alloc),FfiConverterString.lower(contentJson, nativeModule().rustbuffer_alloc),FfiConverterUInt64.lower(durationMs, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer, - // Async returns always go through the JS-side converter: the - // FFI symbol returns the future handle (u64), and the user-level - // RustBuffer comes back via the shared `rust_future_complete_*` - // export. The bytes the runtime hands back must be deserialized - // here using the per-callable return-type converter. - // Borrowed view over foreign memory: the call site owns the free, - // as on the sync paths. Unconditional — a no-op where buffers are - // already JS-owned. - /*liftFunc:*/ (__rb) => { - try { - return FfiConverterTypeFfiSendEventResponse.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - - async sendStateEvent(roomId: string, eventType: string, stateKey: string, contentJson: string, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_state_event( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterString.lower(roomId, nativeModule().rustbuffer_alloc),FfiConverterString.lower(eventType, nativeModule().rustbuffer_alloc),FfiConverterString.lower(stateKey, nativeModule().rustbuffer_alloc),FfiConverterString.lower(contentJson, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer, - // Async returns always go through the JS-side converter: the - // FFI symbol returns the future handle (u64), and the user-level - // RustBuffer comes back via the shared `rust_future_complete_*` - // export. The bytes the runtime hands back must be deserialized - // here using the per-callable return-type converter. - // Borrowed view over foreign memory: the call site owns the free, - // as on the sync paths. Unconditional — a no-op where buffers are - // already JS-owned. - /*liftFunc:*/ (__rb) => { - try { - return FfiConverterTypeFfiSendEventResponse.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * Returns the MSC4140 delay id (not an event id). `sticky_duration_ms` - * makes it a delayed *sticky* event (MSC4354 + MSC4140); ignore it if - * the host SDK cannot express both yet. - */ - async sendDelayedEvent(roomId: string, eventType: string, contentJson: string, delayMs: bigint, stickyDurationMs: bigint | undefined, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_delayed_event( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterString.lower(roomId, nativeModule().rustbuffer_alloc),FfiConverterString.lower(eventType, nativeModule().rustbuffer_alloc),FfiConverterString.lower(contentJson, nativeModule().rustbuffer_alloc),FfiConverterUInt64.lower(delayMs, nativeModule().rustbuffer_alloc),FfiConverterOptionalUInt64.lower(stickyDurationMs, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer, - // Async returns always go through the JS-side converter: the - // FFI symbol returns the future handle (u64), and the user-level - // RustBuffer comes back via the shared `rust_future_complete_*` - // export. The bytes the runtime hands back must be deserialized - // here using the per-callable return-type converter. - // Borrowed view over foreign memory: the call site owns the free, - // as on the sync paths. Unconditional — a no-op where buffers are - // already JS-owned. - /*liftFunc:*/ (__rb) => { - try { - return FfiConverterString.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * Delayed state event — compat only (`StateEvents`). - */ - async sendDelayedStateEvent(roomId: string, eventType: string, stateKey: string, contentJson: string, delayMs: bigint, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_delayed_state_event( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterString.lower(roomId, nativeModule().rustbuffer_alloc),FfiConverterString.lower(eventType, nativeModule().rustbuffer_alloc),FfiConverterString.lower(stateKey, nativeModule().rustbuffer_alloc),FfiConverterString.lower(contentJson, nativeModule().rustbuffer_alloc),FfiConverterUInt64.lower(delayMs, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer, - // Async returns always go through the JS-side converter: the - // FFI symbol returns the future handle (u64), and the user-level - // RustBuffer comes back via the shared `rust_future_complete_*` - // export. The bytes the runtime hands back must be deserialized - // here using the per-callable return-type converter. - // Borrowed view over foreign memory: the call site owns the free, - // as on the sync paths. Unconditional — a no-op where buffers are - // already JS-owned. - /*liftFunc:*/ (__rb) => { - try { - return FfiConverterString.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - - async restartDelayedEvent(roomId: string, delayId: string, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_restart_delayed_event( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterString.lower(roomId, nativeModule().rustbuffer_alloc),FfiConverterString.lower(delayId, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_void, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_void, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_void, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_void, - /*liftFunc:*/ (_v) => {}, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - - async cancelDelayedEvent(roomId: string, delayId: string, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_cancel_delayed_event( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterString.lower(roomId, nativeModule().rustbuffer_alloc),FfiConverterString.lower(delayId, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_void, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_void, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_void, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_void, - /*liftFunc:*/ (_v) => {}, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * MSC4195: hand the delayed leave to the SFU. `livekit_service_url` is - * the transport we publish on (`None` for a receive-only member) and - * `delay_ms` the armed delay — what an adapter that delegates through - * the authorisation service's token endpoint needs. - * MSC4195 via the homeserver: one authenticated - * `POST /_matrix/client/unstable/io.element.msc4195/rtc/livekit/delegate_delayed_leave` - * with `{ url, room_id, slot_id, member, delay_id, delay_timeout }` (see - * `FfiHomeserverDelegationRequest`). A client that cannot make - * authenticated homeserver calls (a widget) throws `Unsupported`; the - * crate then tries the authorisation service. - */ - async delegateDelayedLeaveViaHomeserver(request: FfiHomeserverDelegationRequest, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_delegate_delayed_leave_via_homeserver( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterTypeFfiHomeserverDelegationRequest.lower(request, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_void, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_void, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_void, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_void, - /*liftFunc:*/ (_v) => {}, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * MSC4195 via the authorisation service: the `get_token` (or, with - * `legacy_sfu_get`, `sfu/get`) request the adapter already makes, with - * `delay_id`, `delay_timeout` (= `delay_timeout_ms`) and the adapter's - * own CS API URL (`delay_cs_api_url`) added. Discard the token. - */ - async delegateDelayedLeaveViaTransport(request: FfiTransportDelegationRequest, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_delegate_delayed_leave_via_transport( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterTypeFfiTransportDelegationRequest.lower(request, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_void, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_void, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_void, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_void, - /*liftFunc:*/ (_v) => {}, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - - async sendToDevice(recipients: Array, eventType: string, contentJson: string, asyncOpts_?: { signal: AbortSignal }): Promise> /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_to_device( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterSequenceTypeFfiToDeviceRecipient.lower(recipients, nativeModule().rustbuffer_alloc),FfiConverterString.lower(eventType, nativeModule().rustbuffer_alloc),FfiConverterString.lower(contentJson, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer, - // Async returns always go through the JS-side converter: the - // FFI symbol returns the future handle (u64), and the user-level - // RustBuffer comes back via the shared `rust_future_complete_*` - // export. The bytes the runtime hands back must be deserialized - // here using the per-callable return-type converter. - // Borrowed view over foreign memory: the call site owns the free, - // as on the sync paths. Unconditional — a no-op where buffers are - // already JS-owned. - /*liftFunc:*/ (__rb) => { - try { - return FfiConverterSequenceTypeFfiToDeviceDelivery.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * `GET /_matrix/client/v1/rtc/transports`, with well-known fallback. - */ - async getRtcTransports(asyncOpts_?: { signal: AbortSignal }): Promise> /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_get_rtc_transports( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer, - // Async returns always go through the JS-side converter: the - // FFI symbol returns the future handle (u64), and the user-level - // RustBuffer comes back via the shared `rust_future_complete_*` - // export. The bytes the runtime hands back must be deserialized - // here using the per-callable return-type converter. - // Borrowed view over foreign memory: the call site owns the free, - // as on the sync paths. Unconditional — a no-op where buffers are - // already JS-owned. - /*liftFunc:*/ (__rb) => { - try { - return FfiConverterSequenceTypeFfiRtcTransport.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * MSC4195 token exchange, OpenID token included (see - * [`FfiLivekitTokenRequest`]). - */ - async getLivekitToken(request: FfiLivekitTokenRequest, asyncOpts_?: { signal: AbortSignal }): Promise /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_get_livekit_token( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterTypeFfiLivekitTokenRequest.lower(request, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer, - // Async returns always go through the JS-side converter: the - // FFI symbol returns the future handle (u64), and the user-level - // RustBuffer comes back via the shared `rust_future_complete_*` - // export. The bytes the runtime hands back must be deserialized - // here using the per-callable return-type converter. - // Borrowed view over foreign memory: the call site owns the free, - // as on the sync paths. Unconditional — a no-op where buffers are - // already JS-owned. - /*liftFunc:*/ (__rb) => { - try { - return FfiConverterTypeFfiLivekitToken.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * Latest `limit` timeline events of `event_type`, as JSON strings. - */ - async readEvents(eventType: string, stateKey: string | undefined, limit: number, asyncOpts_?: { signal: AbortSignal }): Promise> /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_read_events( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterString.lower(eventType, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(stateKey, nativeModule().rustbuffer_alloc),FfiConverterUInt32.lower(limit, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer, - // Async returns always go through the JS-side converter: the - // FFI symbol returns the future handle (u64), and the user-level - // RustBuffer comes back via the shared `rust_future_complete_*` - // export. The bytes the runtime hands back must be deserialized - // here using the per-callable return-type converter. - // Borrowed view over foreign memory: the call site owns the free, - // as on the sync paths. Unconditional — a no-op where buffers are - // already JS-owned. - /*liftFunc:*/ (__rb) => { - try { - return FfiConverterSequenceString.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * Current state entries of `event_type` (`state_key: None` = any). - */ - async readState(eventType: string, stateKey: string | undefined, asyncOpts_?: { signal: AbortSignal }): Promise> /*throws*/ { - return await uniffiRustCallAsync( - /*rustCaller:*/ uniffiCaller, - /*rustFutureFunc:*/ () => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_read_state( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this),FfiConverterString.lower(eventType, nativeModule().rustbuffer_alloc),FfiConverterOptionalString.lower(stateKey, nativeModule().rustbuffer_alloc) - ); - }, - /*pollFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer, - /*cancelFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer, - /*completeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer, - /*freeFunc:*/ nativeModule().ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer, - // Async returns always go through the JS-side converter: the - // FFI symbol returns the future handle (u64), and the user-level - // RustBuffer comes back via the shared `rust_future_complete_*` - // export. The bytes the runtime hands back must be deserialized - // here using the per-callable return-type converter. - // Borrowed view over foreign memory: the call site owns the free, - // as on the sync paths. Unconditional — a no-op where buffers are - // already JS-owned. - /*liftFunc:*/ (__rb) => { - try { - return FfiConverterSequenceString.lift(__rb); - } finally { - nativeModule().rustbuffer_free(__rb); - } - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - /*asyncOpts:*/ asyncOpts_, - /*errorHandler:*/ FfiConverterTypeRtcError.lift.bind(FfiConverterTypeRtcError) - ); - } - -/** - * Live room events (sticky member events, slot/state changes). Store - * the sink; call `emit` from the host SDK's event handlers. - */ - subscribeRoomEvents(sink: RoomEventSinkLike): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_room_events( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this), - FfiConverterTypeRoomEventSink.lower(sink, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - -/** - * Decrypted inbound to-device events with origin metadata. - */ - subscribeToDeviceEvents(sink: ToDeviceSinkLike): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_to_device_events( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this), - FfiConverterTypeToDeviceSink.lower(sink, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - -/** - * Room-state update batches (what notices a slot closing promptly). - */ - subscribeStateUpdates(sink: StateUpdateSinkLike): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_state_updates( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this), - FfiConverterTypeStateUpdateSink.lower(sink, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - -/** - * Whether the homeserver is reachable right now (a syncing client: its - * sync loop is running). - */ - isHomeserverConnected(): boolean { - return FfiConverterBool.lift(uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { - return nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_is_homeserver_connected( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - )); - } - -/** - * Live connectivity verdicts. Store the sink; `emit` the new value from - * the host SDK's sync-state handler. - */ - subscribeConnectivity(sink: ConnectivitySinkLike): void {uniffiCaller.rustCall( - /*caller:*/ (callStatus) => { nativeModule().ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_connectivity( - uniffiTypeMatrixDriverCallbackImplObjectFactory.clonePointer(this), - FfiConverterTypeConnectivitySink.lower(sink, nativeModule().rustbuffer_alloc), - callStatus); - }, - /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString), - ); - } - - - uniffiDestroy(): void { - const ptr = (this as any)[destructorGuardSymbol]; - if (ptr !== undefined) { - const pointer = uniffiTypeMatrixDriverCallbackImplObjectFactory.pointer(this); - uniffiTypeMatrixDriverCallbackImplObjectFactory.freePointer(pointer); - uniffiTypeMatrixDriverCallbackImplObjectFactory.unbless(ptr); - delete (this as any)[destructorGuardSymbol]; - } - } - - static instanceOf(obj_: any): obj_ is MatrixDriverCallbackImpl { - return uniffiTypeMatrixDriverCallbackImplObjectFactory.isConcreteType(obj_); - } - - -} - -const uniffiTypeMatrixDriverCallbackImplObjectFactory: UniffiObjectFactory = (() => { - - /// - const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry((heldValue: UniffiHandle) => { - uniffiTypeMatrixDriverCallbackImplObjectFactory.freePointer(heldValue); - }) : null; - - return { - create(pointer: UniffiHandle): MatrixDriverCallback { - const instance = Object.create(MatrixDriverCallbackImpl.prototype); - instance[pointerLiteralSymbol] = pointer; - instance[destructorGuardSymbol] = this.bless(pointer); - instance[uniffiTypeNameSymbol] = "MatrixDriverCallbackImpl"; - return instance; - }, - - - bless(p: UniffiHandle): UniffiGcObject { - const ptr = { - p, // make sure this object doesn't get optimized away. - markDestroyed: () => undefined, - }; - if (registry) { - registry.register(ptr, p, ptr); - } - return ptr; - }, - - unbless(ptr_: UniffiGcObject) { - if (registry) { - registry.unregister(ptr_); - } - }, - - pointer(obj_: MatrixDriverCallback): UniffiHandle { - if ((obj_ as any)[destructorGuardSymbol] === undefined) { - throw new UniffiInternalError.UnexpectedNullPointer(); - } - return (obj_ as any)[pointerLiteralSymbol]; - }, - - clonePointer(obj_: MatrixDriverCallback): UniffiHandle { - const pointer = this.pointer(obj_); - return uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_clone_matrixdrivercallback(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - freePointer(pointer: UniffiHandle): void { - uniffiCaller.rustCall( - /*caller:*/ (callStatus) => nativeModule().ubrn_uniffi_matrix_rtc_fn_free_matrixdrivercallback(pointer, callStatus), - /*liftString:*/ FfiConverterString.lift - ); - }, - - isConcreteType(obj_: any): obj_ is MatrixDriverCallback { - return obj_[destructorGuardSymbol] && obj_[uniffiTypeNameSymbol] === "MatrixDriverCallbackImpl"; - }, -}})(); -const FfiConverterTypeMatrixDriverCallback = new FfiConverterObjectWithCallbacks(uniffiTypeMatrixDriverCallbackImplObjectFactory); - -// Add a vtable for the callbacks that go in MatrixDriverCallback. - -// Put the implementation in a struct so we don't pollute the top-level namespace -const uniffiCallbackInterfaceMatrixDriverCallback: { vtable: any; register: () => void; } = { - // Create the VTable using a series of closures. - // ts automatically converts these into C callback functions. - vtable: { - send_sticky_event: ( - uniffiHandle: bigint, - roomId: Uint8Array, - eventType: Uint8Array, - contentJson: Uint8Array, - durationMs: bigint, - uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.sendStickyEvent( - FfiConverterString.lift(roomId), - FfiConverterString.lift(eventType), - FfiConverterString.lift(contentJson), - FfiConverterUInt64.lift(durationMs), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: FfiSendEventResponse) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: FfiConverterTypeFfiSendEventResponse.lower(returnValue, nativeModule().rustbuffer_alloc), - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: /*empty*/ new Uint8Array(0), - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - send_state_event: ( - uniffiHandle: bigint, - roomId: Uint8Array, - eventType: Uint8Array, - stateKey: Uint8Array, - contentJson: Uint8Array, - uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.sendStateEvent( - FfiConverterString.lift(roomId), - FfiConverterString.lift(eventType), - FfiConverterString.lift(stateKey), - FfiConverterString.lift(contentJson), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: FfiSendEventResponse) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: FfiConverterTypeFfiSendEventResponse.lower(returnValue, nativeModule().rustbuffer_alloc), - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: /*empty*/ new Uint8Array(0), - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - send_delayed_event: ( - uniffiHandle: bigint, - roomId: Uint8Array, - eventType: Uint8Array, - contentJson: Uint8Array, - delayMs: bigint, - stickyDurationMs: Uint8Array, - uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.sendDelayedEvent( - FfiConverterString.lift(roomId), - FfiConverterString.lift(eventType), - FfiConverterString.lift(contentJson), - FfiConverterUInt64.lift(delayMs), - FfiConverterOptionalUInt64.lift(stickyDurationMs), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: string) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: FfiConverterString.lower(returnValue, nativeModule().rustbuffer_alloc), - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: /*empty*/ new Uint8Array(0), - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - send_delayed_state_event: ( - uniffiHandle: bigint, - roomId: Uint8Array, - eventType: Uint8Array, - stateKey: Uint8Array, - contentJson: Uint8Array, - delayMs: bigint, - uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.sendDelayedStateEvent( - FfiConverterString.lift(roomId), - FfiConverterString.lift(eventType), - FfiConverterString.lift(stateKey), - FfiConverterString.lift(contentJson), - FfiConverterUInt64.lift(delayMs), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: string) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: FfiConverterString.lower(returnValue, nativeModule().rustbuffer_alloc), - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: /*empty*/ new Uint8Array(0), - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - restart_delayed_event: ( - uniffiHandle: bigint, - roomId: Uint8Array, - delayId: Uint8Array, - uniffiFutureCallback: UniffiForeignFutureCompletevoid, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.restartDelayedEvent( - FfiConverterString.lift(roomId), - FfiConverterString.lift(delayId), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: void) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultVoid */{ - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultVoid */{ - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - cancel_delayed_event: ( - uniffiHandle: bigint, - roomId: Uint8Array, - delayId: Uint8Array, - uniffiFutureCallback: UniffiForeignFutureCompletevoid, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.cancelDelayedEvent( - FfiConverterString.lift(roomId), - FfiConverterString.lift(delayId), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: void) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultVoid */{ - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultVoid */{ - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - delegate_delayed_leave_via_homeserver: ( - uniffiHandle: bigint, - request: Uint8Array, - uniffiFutureCallback: UniffiForeignFutureCompletevoid, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.delegateDelayedLeaveViaHomeserver( - FfiConverterTypeFfiHomeserverDelegationRequest.lift(request), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: void) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultVoid */{ - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultVoid */{ - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - delegate_delayed_leave_via_transport: ( - uniffiHandle: bigint, - request: Uint8Array, - uniffiFutureCallback: UniffiForeignFutureCompletevoid, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.delegateDelayedLeaveViaTransport( - FfiConverterTypeFfiTransportDelegationRequest.lift(request), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: void) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultVoid */{ - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultVoid */{ - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - send_to_device: ( - uniffiHandle: bigint, - recipients: Uint8Array, - eventType: Uint8Array, - contentJson: Uint8Array, - uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise> => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.sendToDevice( - FfiConverterSequenceTypeFfiToDeviceRecipient.lift(recipients), - FfiConverterString.lift(eventType), - FfiConverterString.lift(contentJson), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: Array) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: FfiConverterSequenceTypeFfiToDeviceDelivery.lower(returnValue, nativeModule().rustbuffer_alloc), - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: /*empty*/ new Uint8Array(0), - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - get_rtc_transports: ( - uniffiHandle: bigint, - uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise> => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.getRtcTransports({ signal } - ) - }; - const uniffiHandleSuccess = (returnValue: Array) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: FfiConverterSequenceTypeFfiRtcTransport.lower(returnValue, nativeModule().rustbuffer_alloc), - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: /*empty*/ new Uint8Array(0), - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - get_livekit_token: ( - uniffiHandle: bigint, - request: Uint8Array, - uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.getLivekitToken( - FfiConverterTypeFfiLivekitTokenRequest.lift(request), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: FfiLivekitToken) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: FfiConverterTypeFfiLivekitToken.lower(returnValue, nativeModule().rustbuffer_alloc), - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: /*empty*/ new Uint8Array(0), - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - read_events: ( - uniffiHandle: bigint, - eventType: Uint8Array, - stateKey: Uint8Array, - limit: number, - uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise> => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.readEvents( - FfiConverterString.lift(eventType), - FfiConverterOptionalString.lift(stateKey), - FfiConverterUInt32.lift(limit), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: Array) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: FfiConverterSequenceString.lower(returnValue, nativeModule().rustbuffer_alloc), - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: /*empty*/ new Uint8Array(0), - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - read_state: ( - uniffiHandle: bigint, - eventType: Uint8Array, - stateKey: Uint8Array, - uniffiFutureCallback: UniffiForeignFutureCompleterustBuffer, - uniffiCallbackData: bigint) => { - const uniffiMakeCall = - async (signal: AbortSignal) - : Promise> => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return await jsCallback.readState( - FfiConverterString.lift(eventType), - FfiConverterOptionalString.lift(stateKey), { signal } - ) - }; - const uniffiHandleSuccess = (returnValue: Array) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: FfiConverterSequenceString.lower(returnValue, nativeModule().rustbuffer_alloc), - call_status: uniffiCaller.createCallStatus() - } - ); - }; - const uniffiHandleError = (code: number, errorBuf: UniffiByteArray) => { - uniffiFutureCallback.call( - uniffiFutureCallback, - uniffiCallbackData, - /* UniffiForeignFutureResultRustBuffer */{ - return_value: /*empty*/ new Uint8Array(0), - // TODO create callstatus with error. - call_status: uniffiCaller.createErrorStatus(code, errorBuf), - } - ); - }; - const uniffiForeignFuture = uniffiTraitInterfaceCallAsyncWithError( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*isErrorType:*/ RtcError.instanceOf, - /*lowerError:*/ FfiConverterTypeRtcError.lower.bind(FfiConverterTypeRtcError), - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ); - return uniffiForeignFuture; - }, - subscribe_room_events: ( - uniffiHandle: bigint, - sink: bigint,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return jsCallback.subscribeRoomEvents( - FfiConverterTypeRoomEventSink.lift(sink) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - subscribe_to_device_events: ( - uniffiHandle: bigint, - sink: bigint,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return jsCallback.subscribeToDeviceEvents( - FfiConverterTypeToDeviceSink.lift(sink) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - subscribe_state_updates: ( - uniffiHandle: bigint, - sink: bigint,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return jsCallback.subscribeStateUpdates( - FfiConverterTypeStateUpdateSink.lift(sink) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - is_homeserver_connected: ( - uniffiHandle: bigint,) => { - const uniffiMakeCall = - () - : boolean => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return jsCallback.isHomeserverConnected( - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => { - UniffiResult.writeSuccess(uniffiResult, FfiConverterBool.lower(obj, nativeModule().rustbuffer_alloc)); - }; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - subscribe_connectivity: ( - uniffiHandle: bigint, - sink: bigint,) => { - const uniffiMakeCall = - () - : void => { - const jsCallback = FfiConverterTypeMatrixDriverCallback.lift(uniffiHandle); - return jsCallback.subscribeConnectivity( - FfiConverterTypeConnectivitySink.lift(sink) - ) - }; - const uniffiResult = UniffiResult.ready(); - const uniffiHandleSuccess = (obj: any) => {}; - const uniffiHandleError = (code: number, errBuf: UniffiByteArray) => { - UniffiResult.writeError(uniffiResult, code, errBuf); - }; - uniffiTraitInterfaceCall( - /*makeCall:*/ uniffiMakeCall, - /*handleSuccess:*/ uniffiHandleSuccess, - /*handleError:*/ uniffiHandleError, - /*lowerString:*/ FfiConverterString.lower.bind(FfiConverterString), - /*alloc:*/ nativeModule().rustbuffer_alloc, - ) - return uniffiResult; - }, - uniffi_free: (uniffiHandle: UniffiHandle): void => { - // this will throw a stale handle error if the handle isn't found. - FfiConverterTypeMatrixDriverCallback.drop(uniffiHandle); - }, - uniffi_clone: (uniffiHandle: UniffiHandle): UniffiHandle => { - return FfiConverterTypeMatrixDriverCallback.clone(uniffiHandle); - } - }, - register: () => {nativeModule().ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_matrixdrivercallback( - uniffiCallbackInterfaceMatrixDriverCallback.vtable - ); - }, -}; - -// FfiConverter for bigint | undefined -const FfiConverterOptionalUInt64 = new FfiConverterOptional(FfiConverterUInt64); - -// FfiConverter for Array -const FfiConverterSequenceString = new FfiConverterArray(FfiConverterString); - -// FfiConverter for string | undefined -const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiRtcTransport = new FfiConverterArray(FfiConverterTypeFfiRtcTransport); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiMember = new FfiConverterArray(FfiConverterTypeFfiMember); - -// FfiConverter for FfiKeyRejection | undefined -const FfiConverterOptionalTypeFfiKeyRejection = new FfiConverterOptional(FfiConverterTypeFfiKeyRejection); - -// FfiConverter for boolean | undefined -const FfiConverterOptionalBoolean = new FfiConverterOptional(FfiConverterBool); - -// FfiConverter for FfiMediaKeyState | undefined -const FfiConverterOptionalTypeFfiMediaKeyState = new FfiConverterOptional(FfiConverterTypeFfiMediaKeyState); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiSessionRead = new FfiConverterArray(FfiConverterTypeFfiSessionRead); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiExcludedCandidate = new FfiConverterArray(FfiConverterTypeFfiExcludedCandidate); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiImpairment = new FfiConverterArray(FfiConverterTypeFfiImpairment); - -// FfiConverter for FfiDelayedLeaveOutcome | undefined -const FfiConverterOptionalTypeFfiDelayedLeaveOutcome = new FfiConverterOptional(FfiConverterTypeFfiDelayedLeaveOutcome); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiConnectionWithMembers = new FfiConverterArray(FfiConverterTypeFfiConnectionWithMembers); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiConnectionProblem = new FfiConverterArray(FfiConverterTypeFfiConnectionProblem); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiMediaKey = new FfiConverterArray(FfiConverterTypeFfiMediaKey); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiMembership = new FfiConverterArray(FfiConverterTypeFfiMembership); - -// FfiConverter for FfiMembership | undefined -const FfiConverterOptionalTypeFfiMembership = new FfiConverterOptional(FfiConverterTypeFfiMembership); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiToDeviceRecipient = new FfiConverterArray(FfiConverterTypeFfiToDeviceRecipient); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiToDeviceDelivery = new FfiConverterArray(FfiConverterTypeFfiToDeviceDelivery); - -// FfiConverter for Array -const FfiConverterSequenceTypeFfiSessionSnapshot = new FfiConverterArray(FfiConverterTypeFfiSessionSnapshot); - - -/** - * This should be called before anything else. - * - * It is likely that this is being done for you by the library's `index.ts`. - * - * It checks versions of uniffi between when the Rust scaffolding was generated - * and when the bindings were generated. - * - * It also initializes the machinery to enable Rust to talk back to Javascript. - */ -function uniffiEnsureInitialized() { - // Get the bindings contract version from our ComponentInterface - const bindingsContractVersion = 30; - // Get the scaffolding contract version by calling the into the dylib - const scaffoldingContractVersion = nativeModule().ubrn_ffi_matrix_rtc_uniffi_contract_version(); - if (bindingsContractVersion !== scaffoldingContractVersion) { - throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_func_compute_sessions_from_events() !== 27010) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_func_compute_sessions_from_events"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_func_impairment_severity() !== 9139) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_func_impairment_severity"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_func_set_log_sink() !== 7798) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_func_set_log_sink"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_connectionslistener_on_connections_change() !== 24219) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_connectionslistener_on_connections_change"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_connectivitysink_emit() !== 45059) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_connectivitysink_emit"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_constructor_ffimatrixdriver_new() !== 16380) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_constructor_ffimatrixdriver_new"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_constructor_ffiparticipationmanager_new() !== 2422) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_constructor_ffiparticipationmanager_new"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_close_slot() !== 63268) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_close_slot"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_connection_problems() !== 17464) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_connection_problems"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_connections() !== 38871) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_connections"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_debug_snapshot() !== 11860) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_debug_snapshot"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_is_homeserver_connected() !== 218) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_is_homeserver_connected"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_join() !== 18117) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_join"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_key_map() !== 32581) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_key_map"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_leave() !== 35402) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_leave"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_memberships() !== 15145) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_memberships"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_open_slot() !== 28952) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_open_slot"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_member_id() !== 453) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_member_id"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_membership() !== 25006) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_membership"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_transport_identity() !== 34101) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_transport_identity"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_session() !== 13049) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_session"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_connections_listener() !== 33842) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_connections_listener"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_key_map_listener() !== 53147) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_key_map_listener"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_key_rejected_listener() !== 1468) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_key_rejected_listener"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_memberships_listener() !== 46727) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_memberships_listener"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_session_listener() !== 784) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_session_listener"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_status_listener() !== 8439) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_status_listener"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_status() !== 23619) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_status"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_update_application() !== 28805) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_update_application"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_keymaplistener_on_key_map_change() !== 2308) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_keymaplistener_on_key_map_change"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_keyrejectedlistener_on_key_rejected() !== 53044) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_keyrejectedlistener_on_key_rejected"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_logsink_log() !== 15220) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_logsink_log"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_sticky_event() !== 39725) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_sticky_event"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_state_event() !== 11746) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_state_event"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_delayed_event() !== 9018) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_delayed_event"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_delayed_state_event() !== 29945) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_delayed_state_event"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_restart_delayed_event() !== 2361) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_restart_delayed_event"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_cancel_delayed_event() !== 48021) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_cancel_delayed_event"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_delegate_delayed_leave_via_homeserver() !== 43539) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_delegate_delayed_leave_via_homeserver"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_delegate_delayed_leave_via_transport() !== 6420) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_delegate_delayed_leave_via_transport"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_to_device() !== 43316) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_to_device"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_get_rtc_transports() !== 33640) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_get_rtc_transports"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_get_livekit_token() !== 25518) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_get_livekit_token"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_read_events() !== 28203) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_read_events"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_read_state() !== 63481) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_read_state"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_room_events() !== 8803) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_room_events"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_to_device_events() !== 45060) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_to_device_events"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_state_updates() !== 58784) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_state_updates"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_is_homeserver_connected() !== 56819) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_is_homeserver_connected"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_connectivity() !== 55109) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_connectivity"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_membershipslistener_on_memberships_change() !== 29319) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_membershipslistener_on_memberships_change"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_roomeventsink_emit() !== 34604) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_roomeventsink_emit"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_sessionlistener_on_session_change() !== 30825) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_sessionlistener_on_session_change"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_stateupdatesink_emit() !== 7988) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_stateupdatesink_emit"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_statuslistener_on_status_change() !== 45246) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_statuslistener_on_status_change"); - } - if (nativeModule().ubrn_uniffi_matrix_rtc_checksum_method_todevicesink_emit() !== 57061) { - throw new UniffiInternalError.ApiChecksumMismatch("uniffi_matrix_rtc_checksum_method_todevicesink_emit"); - } - - uniffiCallbackInterfaceConnectionsListener.register(); - uniffiCallbackInterfaceKeyMapListener.register(); - uniffiCallbackInterfaceKeyRejectedListener.register(); - uniffiCallbackInterfaceMembershipsListener.register(); - uniffiCallbackInterfaceSessionListener.register(); - uniffiCallbackInterfaceStatusListener.register(); - uniffiCallbackInterfaceLogSink.register(); - uniffiCallbackInterfaceMatrixDriverCallback.register(); - } - -export default Object.freeze({ - initialize: uniffiEnsureInitialized, - converters: { - FfiConverterTypeConnectionsListener, - FfiConverterTypeConnectivitySink, - FfiConverterTypeFfiComponent, - FfiConverterTypeFfiConnectionData, - FfiConverterTypeFfiConnectionProblem, - FfiConverterTypeFfiConnectionProblemKind, - FfiConverterTypeFfiConnectionWithMembers, - FfiConverterTypeFfiDelayedLeaveOutcome, - FfiConverterTypeFfiDelegationRoute, - FfiConverterTypeFfiDeviceAttribution, - FfiConverterTypeFfiDisconnectCause, - FfiConverterTypeFfiElementCallCompat, - FfiConverterTypeFfiEncryptionStatus, - FfiConverterTypeFfiEventOrigin, - FfiConverterTypeFfiExcludedCandidate, - FfiConverterTypeFfiHomeserverDelegationRequest, - FfiConverterTypeFfiImpairment, - FfiConverterTypeFfiJoinError, - FfiConverterTypeFfiJoinExclusionReason, - FfiConverterTypeFfiJoinParams, - FfiConverterTypeFfiJoinProgress, - FfiConverterTypeFfiKeepAlive, - FfiConverterTypeFfiKeyRejection, - FfiConverterTypeFfiLivekitToken, - FfiConverterTypeFfiLivekitTokenRequest, - FfiConverterTypeFfiLogLevel, - FfiConverterTypeFfiMatrixDriver, - FfiConverterTypeFfiMediaKey, - FfiConverterTypeFfiMediaKeyState, - FfiConverterTypeFfiMember, - FfiConverterTypeFfiMembership, - FfiConverterTypeFfiMembershipPublication, - FfiConverterTypeFfiMembershipState, - FfiConverterTypeFfiParticipationConfig, - FfiConverterTypeFfiParticipationManager, - FfiConverterTypeFfiRosterPresence, - FfiConverterTypeFfiRtcTransport, - FfiConverterTypeFfiSendEventResponse, - FfiConverterTypeFfiSessionRead, - FfiConverterTypeFfiSessionSnapshot, - FfiConverterTypeFfiSeverity, - FfiConverterTypeFfiStatus, - FfiConverterTypeFfiToDeviceDelivery, - FfiConverterTypeFfiToDeviceRecipient, - FfiConverterTypeFfiTransportDelegationRequest, - FfiConverterTypeFfiTransportIntent, - FfiConverterTypeKeyMapListener, - FfiConverterTypeKeyRejectedListener, - FfiConverterTypeLogSink, - FfiConverterTypeMatrixDriverCallback, - FfiConverterTypeMembershipsListener, - FfiConverterTypeRoomEventSink, - FfiConverterTypeRtcError, - FfiConverterTypeSessionListener, - FfiConverterTypeStateUpdateSink, - FfiConverterTypeStatusListener, - FfiConverterTypeToDeviceSink, - } -}); \ No newline at end of file diff --git a/src/matrix-rtc-sdk/generated/wasm-bindgen/index.d.ts b/src/matrix-rtc-sdk/generated/wasm-bindgen/index.d.ts deleted file mode 100644 index 204a74eea..000000000 --- a/src/matrix-rtc-sdk/generated/wasm-bindgen/index.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2026 Element Creations Ltd. - -SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial -Please see LICENSE in the repository root for full details. -*/ - -// Hand-written declaration for the wasm-bindgen glue next to it, which ubrn -// emits as plain JavaScript. Only the loading entry points are declared; the -// exported `ubrn_*` FFI functions are reached through matrix_rtc.ts alone. -// Kept out of the sync script's way: it is not generated. - -/** What wasm-bindgen's loader accepts as the module to instantiate. */ -export type InitInput = - | RequestInfo - | URL - | Response - | BufferSource - | WebAssembly.Module; - -export default function initAsync( - moduleOrPath?: - | { module_or_path?: InitInput | Promise } - | InitInput - | Promise, -): Promise; - -export function initSync( - module: { module: BufferSource | WebAssembly.Module } | BufferSource | WebAssembly.Module, -): unknown; diff --git a/src/matrix-rtc-sdk/generated/wasm-bindgen/index.js b/src/matrix-rtc-sdk/generated/wasm-bindgen/index.js deleted file mode 100644 index fd45f635d..000000000 --- a/src/matrix-rtc-sdk/generated/wasm-bindgen/index.js +++ /dev/null @@ -1,3250 +0,0 @@ -let wasm; - -let cachedUint8ArrayMemory0 = null; - -function getUint8ArrayMemory0() { - if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) { - cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer); - } - return cachedUint8ArrayMemory0; -} - -function getArrayU8FromWasm0(ptr, len) { - ptr = ptr >>> 0; - return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len); -} - -function addToExternrefTable0(obj) { - const idx = wasm.__externref_table_alloc(); - wasm.__wbindgen_export_3.set(idx, obj); - return idx; -} - -function handleError(f, args) { - try { - return f.apply(this, args); - } catch (e) { - const idx = addToExternrefTable0(e); - wasm.__wbindgen_exn_store(idx); - } -} - -function _assertClass(instance, klass) { - if (!(instance instanceof klass)) { - throw new Error(`expected instance of ${klass.name}`); - } -} - -let WASM_VECTOR_LEN = 0; - -function passArray8ToWasm0(arg, malloc) { - const ptr = malloc(arg.length * 1, 1) >>> 0; - getUint8ArrayMemory0().set(arg, ptr / 1); - WASM_VECTOR_LEN = arg.length; - return ptr; -} - -function isLikeNone(x) { - return x === undefined || x === null; -} - -let cachedDataViewMemory0 = null; - -function getDataViewMemory0() { - if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) { - cachedDataViewMemory0 = new DataView(wasm.memory.buffer); - } - return cachedDataViewMemory0; -} - -const cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } ); - -if (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); }; - -function getStringFromWasm0(ptr, len) { - ptr = ptr >>> 0; - return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len)); -} - -const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(state => { - wasm.__wbindgen_export_5.get(state.dtor)(state.a, state.b) -}); - -function makeMutClosure(arg0, arg1, dtor, f) { - const state = { a: arg0, b: arg1, cnt: 1, dtor }; - const real = (...args) => { - // First up with a closure we increment the internal reference - // count. This ensures that the Rust closure environment won't - // be deallocated while we're invoking it. - state.cnt++; - const a = state.a; - state.a = 0; - try { - return f(a, state.b, ...args); - } finally { - if (--state.cnt === 0) { - wasm.__wbindgen_export_5.get(state.dtor)(a, state.b); - CLOSURE_DTORS.unregister(state); - } else { - state.a = a; - } - } - }; - real.original = state; - CLOSURE_DTORS.register(real, state, state); - return real; -} -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_connectionslistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_connectionslistener(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_memberships(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_memberships(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} application_type - * @param {number} encrypted - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_open_slot(ptr, application_type, encrypted) { - const ptr0 = passArray8ToWasm0(application_type, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_open_slot(ptr, ptr0, len0, encrypted); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_own_member_id(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_own_member_id(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_status(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_status(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} intent - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_update_application(ptr, intent) { - const ptr0 = passArray8ToWasm0(intent, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_update_application(ptr, ptr0, len0); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_keymaplistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_keymaplistener(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_keymaplistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_keymaplistener(handle, f_status_.__wbg_ptr); -} - -/** - * @param {any} vtable - */ -export function ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_keymaplistener(vtable) { - wasm.ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_keymaplistener(vtable); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} key_map - * @param {Uint8Array} change - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_keymaplistener_on_key_map_change(ptr, key_map, change, f_status_) { - const ptr0 = passArray8ToWasm0(key_map, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(change, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_keymaplistener_on_key_map_change(ptr, ptr0, len0, ptr1, len1, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_keyrejectedlistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_keyrejectedlistener(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_keyrejectedlistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_keyrejectedlistener(handle, f_status_.__wbg_ptr); -} - -/** - * @param {any} vtable - */ -export function ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_keyrejectedlistener(vtable) { - wasm.ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_keyrejectedlistener(vtable); -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_own_membership(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_own_membership(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_own_transport_identity(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_own_transport_identity(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_session(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_session(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {bigint} listener - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_connections_listener(ptr, listener, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_connections_listener(ptr, listener, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {bigint} listener - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_key_map_listener(ptr, listener, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_key_map_listener(ptr, listener, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {bigint} listener - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_key_rejected_listener(ptr, listener, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_key_rejected_listener(ptr, listener, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {bigint} listener - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_memberships_listener(ptr, listener, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_memberships_listener(ptr, listener, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {bigint} listener - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_session_listener(ptr, listener, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_session_listener(ptr, listener, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {bigint} listener - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_status_listener(ptr, listener, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_set_status_listener(ptr, listener, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} member_id - * @param {Uint8Array} reason - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_keyrejectedlistener_on_key_rejected(ptr, member_id, reason, f_status_) { - const ptr0 = passArray8ToWasm0(member_id, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(reason, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_keyrejectedlistener_on_key_rejected(ptr, ptr0, len0, ptr1, len1, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_logsink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_logsink(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_logsink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_logsink(handle, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} room_id - * @param {Uint8Array} delay_id - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_restart_delayed_event(ptr, room_id, delay_id) { - const ptr0 = passArray8ToWasm0(room_id, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(delay_id, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_restart_delayed_event(ptr, ptr0, len0, ptr1, len1); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} room_id - * @param {Uint8Array} delay_id - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_cancel_delayed_event(ptr, room_id, delay_id) { - const ptr0 = passArray8ToWasm0(room_id, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(delay_id, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_cancel_delayed_event(ptr, ptr0, len0, ptr1, len1); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} request - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_delegate_delayed_leave_via_homeserver(ptr, request) { - const ptr0 = passArray8ToWasm0(request, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_delegate_delayed_leave_via_homeserver(ptr, ptr0, len0); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} request - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_delegate_delayed_leave_via_transport(ptr, request) { - const ptr0 = passArray8ToWasm0(request, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_delegate_delayed_leave_via_transport(ptr, ptr0, len0); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} recipients - * @param {Uint8Array} event_type - * @param {Uint8Array} content_json - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_to_device(ptr, recipients, event_type, content_json) { - const ptr0 = passArray8ToWasm0(recipients, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(event_type, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ptr2 = passArray8ToWasm0(content_json, wasm.__wbindgen_malloc); - const len2 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_to_device(ptr, ptr0, len0, ptr1, len1, ptr2, len2); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_get_rtc_transports(ptr) { - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_get_rtc_transports(ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} request - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_get_livekit_token(ptr, request) { - const ptr0 = passArray8ToWasm0(request, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_get_livekit_token(ptr, ptr0, len0); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} event_type - * @param {Uint8Array} state_key - * @param {number} limit - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_read_events(ptr, event_type, state_key, limit) { - const ptr0 = passArray8ToWasm0(event_type, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(state_key, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_read_events(ptr, ptr0, len0, ptr1, len1, limit); - return BigInt.asUintN(64, ret); -} - -/** - * @param {any} vtable - */ -export function ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_logsink(vtable) { - wasm.ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_logsink(vtable); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} level - * @param {Uint8Array} target - * @param {Uint8Array} message - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_logsink_log(ptr, level, target, message, f_status_) { - const ptr0 = passArray8ToWasm0(level, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(target, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ptr2 = passArray8ToWasm0(message, wasm.__wbindgen_malloc); - const len2 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_logsink_log(ptr, ptr0, len0, ptr1, len1, ptr2, len2, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_matrixdrivercallback(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_matrixdrivercallback(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_matrixdrivercallback(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_matrixdrivercallback(handle, f_status_.__wbg_ptr); -} - -/** - * @param {any} vtable - */ -export function ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_matrixdrivercallback(vtable) { - wasm.ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_matrixdrivercallback(vtable); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} room_id - * @param {Uint8Array} event_type - * @param {Uint8Array} content_json - * @param {bigint} duration_ms - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_sticky_event(ptr, room_id, event_type, content_json, duration_ms) { - const ptr0 = passArray8ToWasm0(room_id, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(event_type, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ptr2 = passArray8ToWasm0(content_json, wasm.__wbindgen_malloc); - const len2 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_sticky_event(ptr, ptr0, len0, ptr1, len1, ptr2, len2, duration_ms); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} room_id - * @param {Uint8Array} event_type - * @param {Uint8Array} state_key - * @param {Uint8Array} content_json - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_state_event(ptr, room_id, event_type, state_key, content_json) { - const ptr0 = passArray8ToWasm0(room_id, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(event_type, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ptr2 = passArray8ToWasm0(state_key, wasm.__wbindgen_malloc); - const len2 = WASM_VECTOR_LEN; - const ptr3 = passArray8ToWasm0(content_json, wasm.__wbindgen_malloc); - const len3 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_state_event(ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} room_id - * @param {Uint8Array} event_type - * @param {Uint8Array} content_json - * @param {bigint} delay_ms - * @param {Uint8Array} sticky_duration_ms - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_delayed_event(ptr, room_id, event_type, content_json, delay_ms, sticky_duration_ms) { - const ptr0 = passArray8ToWasm0(room_id, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(event_type, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ptr2 = passArray8ToWasm0(content_json, wasm.__wbindgen_malloc); - const len2 = WASM_VECTOR_LEN; - const ptr3 = passArray8ToWasm0(sticky_duration_ms, wasm.__wbindgen_malloc); - const len3 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_delayed_event(ptr, ptr0, len0, ptr1, len1, ptr2, len2, delay_ms, ptr3, len3); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} room_id - * @param {Uint8Array} event_type - * @param {Uint8Array} state_key - * @param {Uint8Array} content_json - * @param {bigint} delay_ms - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_delayed_state_event(ptr, room_id, event_type, state_key, content_json, delay_ms) { - const ptr0 = passArray8ToWasm0(room_id, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(event_type, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ptr2 = passArray8ToWasm0(state_key, wasm.__wbindgen_malloc); - const len2 = WASM_VECTOR_LEN; - const ptr3 = passArray8ToWasm0(content_json, wasm.__wbindgen_malloc); - const len3 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_send_delayed_state_event(ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, delay_ms); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} event_type - * @param {Uint8Array} state_key - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_read_state(ptr, event_type, state_key) { - const ptr0 = passArray8ToWasm0(event_type, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(state_key, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_read_state(ptr, ptr0, len0, ptr1, len1); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {bigint} sink - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_room_events(ptr, sink, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_room_events(ptr, sink, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {bigint} sink - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_to_device_events(ptr, sink, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_to_device_events(ptr, sink, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {bigint} sink - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_state_updates(ptr, sink, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_state_updates(ptr, sink, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} event_json - * @param {Uint8Array} origin - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_roomeventsink_emit(ptr, event_json, origin, f_status_) { - const ptr0 = passArray8ToWasm0(event_json, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(origin, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_roomeventsink_emit(ptr, ptr0, len0, ptr1, len1, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_sessionlistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_sessionlistener(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_sessionlistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_sessionlistener(handle, f_status_.__wbg_ptr); -} - -/** - * @param {any} vtable - */ -export function ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_sessionlistener(vtable) { - wasm.ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_sessionlistener(vtable); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} session - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_sessionlistener_on_session_change(ptr, session, f_status_) { - const ptr0 = passArray8ToWasm0(session, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_sessionlistener_on_session_change(ptr, ptr0, len0, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_stateupdatesink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_stateupdatesink(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_stateupdatesink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_stateupdatesink(handle, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} events_json - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_stateupdatesink_emit(ptr, events_json, f_status_) { - const ptr0 = passArray8ToWasm0(events_json, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_stateupdatesink_emit(ptr, ptr0, len0, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_statuslistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_statuslistener(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_connectionslistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_connectionslistener(handle, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_is_homeserver_connected(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_is_homeserver_connected(ptr, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} ptr - * @param {bigint} sink - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_connectivity(ptr, sink, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_matrixdrivercallback_subscribe_connectivity(ptr, sink, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_membershipslistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_membershipslistener(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_membershipslistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_membershipslistener(handle, f_status_.__wbg_ptr); -} - -/** - * @param {any} vtable - */ -export function ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_membershipslistener(vtable) { - wasm.ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_membershipslistener(vtable); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} memberships - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_membershipslistener_on_memberships_change(ptr, memberships, f_status_) { - const ptr0 = passArray8ToWasm0(memberships, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_membershipslistener_on_memberships_change(ptr, ptr0, len0, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_roomeventsink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_roomeventsink(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_roomeventsink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_roomeventsink(handle, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_statuslistener(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_statuslistener(handle, f_status_.__wbg_ptr); -} - -/** - * @param {any} vtable - */ -export function ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_statuslistener(vtable) { - wasm.ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_statuslistener(vtable); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} status - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_statuslistener_on_status_change(ptr, status, f_status_) { - const ptr0 = passArray8ToWasm0(status, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_statuslistener_on_status_change(ptr, ptr0, len0, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_u8(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_u8(handle, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_i8(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_i8(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_i8(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_i8(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_i8(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_i8(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_i8(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_i8(handle, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_u16(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_u16(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_u16(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_u16(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_u16(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_u16(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_u16(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_u16(handle, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_todevicesink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_todevicesink(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_todevicesink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_todevicesink(handle, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} event_type - * @param {Uint8Array} sender - * @param {Uint8Array} content_json - * @param {Uint8Array} origin - * @param {Uint8Array} sender_cross_signed - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_todevicesink_emit(ptr, event_type, sender, content_json, origin, sender_cross_signed, f_status_) { - const ptr0 = passArray8ToWasm0(event_type, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(sender, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ptr2 = passArray8ToWasm0(content_json, wasm.__wbindgen_malloc); - const len2 = WASM_VECTOR_LEN; - const ptr3 = passArray8ToWasm0(origin, wasm.__wbindgen_malloc); - const len3 = WASM_VECTOR_LEN; - const ptr4 = passArray8ToWasm0(sender_cross_signed, wasm.__wbindgen_malloc); - const len4 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_todevicesink_emit(ptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {Uint8Array} events_json - * @param {Uint8Array} compat - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_func_compute_sessions_from_events(events_json, compat, f_status_) { - const ptr0 = passArray8ToWasm0(events_json, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(compat, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_func_compute_sessions_from_events(ptr0, len0, ptr1, len1, f_status_.__wbg_ptr); - var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v3; -} - -/** - * @param {Uint8Array} impairment - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_func_impairment_severity(impairment, f_status_) { - const ptr0 = passArray8ToWasm0(impairment, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_func_impairment_severity(ptr0, len0, f_status_.__wbg_ptr); - var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v2; -} - -/** - * @param {bigint} sink - * @param {Uint8Array} max_level - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_func_set_log_sink(sink, max_level, f_status_) { - const ptr0 = passArray8ToWasm0(max_level, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_func_set_log_sink(sink, ptr0, len0, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_u8(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_u8(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_u8(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_u8(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_u8(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_u8(handle); -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_i16(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_i16(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_i16(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_i16(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_i16(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_i16(handle); -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_u64(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_u64(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_u64(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_u64(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_u64(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_u64(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_u64(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_u64(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_i64(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_i64(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_i64(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_i64(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_i64(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_i64(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_i64(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_i64(handle, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_i16(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_i16(handle, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_u32(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_u32(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_u32(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_u32(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_u32(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_u32(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_u32(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_u32(handle, f_status_.__wbg_ptr); - return ret >>> 0; -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_i32(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_i32(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_i32(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_i32(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_i32(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_i32(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_i32(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_i32(handle, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_f32(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_f32(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_f32(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_f32(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_f32(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_f32(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_f32(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_f32(handle, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_void(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_void(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_void(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_void(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_void(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_void(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_void(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_ffi_matrix_rtc_rust_future_complete_void(handle, f_status_.__wbg_ptr); -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_func_compute_sessions_from_events() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_func_compute_sessions_from_events(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_func_impairment_severity() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_func_impairment_severity(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_func_set_log_sink() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_func_set_log_sink(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_connectionslistener_on_connections_change() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_connectionslistener_on_connections_change(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_connectivitysink_emit() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_connectivitysink_emit(); - return ret; -} - -/** - * @param {any} vtable - */ -export function ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_connectionslistener(vtable) { - wasm.ubrn_uniffi_matrix_rtc_fn_init_callback_vtable_connectionslistener(vtable); -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_f64(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_f64(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_f64(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_f64(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_f64(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_f64(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_f64(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_f64(handle, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {any} callback - * @param {bigint} callback_data - */ -export function ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer(handle, callback, callback_data) { - wasm.ubrn_ffi_matrix_rtc_rust_future_poll_rust_buffer(handle, callback, callback_data); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_cancel_rust_buffer(handle); -} - -/** - * @param {bigint} handle - */ -export function ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer(handle) { - wasm.ubrn_ffi_matrix_rtc_rust_future_free_rust_buffer(handle); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_ffi_matrix_rtc_rust_future_complete_rust_buffer(handle, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_close_slot() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_close_slot(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_connection_problems() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_connection_problems(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_connections() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_connections(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_transport_identity() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_transport_identity(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_session() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_session(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_connections_listener() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_connections_listener(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_key_map_listener() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_key_map_listener(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_key_rejected_listener() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_key_rejected_listener(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_memberships_listener() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_memberships_listener(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_session_listener() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_session_listener(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_status_listener() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_set_status_listener(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_status() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_status(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_debug_snapshot() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_debug_snapshot(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_is_homeserver_connected() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_is_homeserver_connected(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_join() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_join(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_key_map() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_key_map(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_leave() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_leave(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_memberships() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_memberships(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_open_slot() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_open_slot(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_member_id() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_member_id(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_membership() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_own_membership(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_update_application() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_ffiparticipationmanager_update_application(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_keymaplistener_on_key_map_change() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_keymaplistener_on_key_map_change(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_keyrejectedlistener_on_key_rejected() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_keyrejectedlistener_on_key_rejected(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_to_device() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_to_device(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_get_rtc_transports() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_get_rtc_transports(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_get_livekit_token() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_get_livekit_token(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_read_events() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_read_events(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_read_state() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_read_state(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_room_events() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_room_events(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_to_device_events() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_to_device_events(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_state_updates() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_state_updates(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_logsink_log() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_logsink_log(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_sticky_event() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_sticky_event(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_state_event() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_state_event(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_delayed_event() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_delayed_event(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_delayed_state_event() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_send_delayed_state_event(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_restart_delayed_event() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_restart_delayed_event(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_cancel_delayed_event() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_cancel_delayed_event(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_delegate_delayed_leave_via_homeserver() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_delegate_delayed_leave_via_homeserver(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_delegate_delayed_leave_via_transport() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_delegate_delayed_leave_via_transport(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_is_homeserver_connected() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_is_homeserver_connected(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_connectivity() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_matrixdrivercallback_subscribe_connectivity(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_membershipslistener_on_memberships_change() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_membershipslistener_on_memberships_change(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_roomeventsink_emit() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_roomeventsink_emit(); - return ret; -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} connections - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_method_connectionslistener_on_connections_change(ptr, connections, f_status_) { - const ptr0 = passArray8ToWasm0(connections, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_method_connectionslistener_on_connections_change(ptr, ptr0, len0, f_status_.__wbg_ptr); -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_sessionlistener_on_session_change() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_sessionlistener_on_session_change(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_stateupdatesink_emit() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_stateupdatesink_emit(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_statuslistener_on_status_change() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_statuslistener_on_status_change(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_method_todevicesink_emit() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_method_todevicesink_emit(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_constructor_ffimatrixdriver_new() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_constructor_ffimatrixdriver_new(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_checksum_constructor_ffiparticipationmanager_new() { - const ret = wasm.ubrn_uniffi_matrix_rtc_checksum_constructor_ffiparticipationmanager_new(); - return ret; -} - -/** - * @returns {number} - */ -export function ubrn_ffi_matrix_rtc_uniffi_contract_version() { - const ret = wasm.ubrn_ffi_matrix_rtc_uniffi_contract_version(); - return ret >>> 0; -} - -/** - * @param {Uint8Array} room_id - * @param {Uint8Array} slot_id - * @param {Uint8Array} user_id - * @param {Uint8Array} device_id - * @param {bigint} driver - * @param {Uint8Array} config - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_constructor_ffiparticipationmanager_new(room_id, slot_id, user_id, device_id, driver, config, f_status_) { - const ptr0 = passArray8ToWasm0(room_id, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(slot_id, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ptr2 = passArray8ToWasm0(user_id, wasm.__wbindgen_malloc); - const len2 = WASM_VECTOR_LEN; - const ptr3 = passArray8ToWasm0(device_id, wasm.__wbindgen_malloc); - const len3 = WASM_VECTOR_LEN; - const ptr4 = passArray8ToWasm0(config, wasm.__wbindgen_malloc); - const len4 = WASM_VECTOR_LEN; - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_constructor_ffiparticipationmanager_new(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, driver, ptr4, len4, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_close_slot(ptr) { - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_close_slot(ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_connection_problems(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_connection_problems(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_connections(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_connections(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_debug_snapshot(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_debug_snapshot(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_is_homeserver_connected(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_is_homeserver_connected(ptr, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} intent - * @param {Uint8Array} params - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_join(ptr, intent, params) { - const ptr0 = passArray8ToWasm0(intent, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(params, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_join(ptr, ptr0, len0, ptr1, len1); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} ptr - * @param {RustCallStatus} f_status_ - * @returns {Uint8Array} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_key_map(ptr, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_key_map(ptr, f_status_.__wbg_ptr); - var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - return v1; -} - -/** - * @param {bigint} ptr - * @param {Uint8Array} code - * @param {Uint8Array} reason - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_leave(ptr, code, reason) { - const ptr0 = passArray8ToWasm0(code, wasm.__wbindgen_malloc); - const len0 = WASM_VECTOR_LEN; - const ptr1 = passArray8ToWasm0(reason, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_ffiparticipationmanager_leave(ptr, ptr0, len0, ptr1, len1); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_connectivitysink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_connectivitysink(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_connectivitysink(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_connectivitysink(handle, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} ptr - * @param {number} connected - * @param {RustCallStatus} f_status_ - * @returns {number} - */ -export function ubrn_uniffi_matrix_rtc_fn_method_connectivitysink_emit(ptr, connected, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_method_connectivitysink_emit(ptr, connected, f_status_.__wbg_ptr); - return ret; -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_ffimatrixdriver(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_ffimatrixdriver(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_ffimatrixdriver(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_ffimatrixdriver(handle, f_status_.__wbg_ptr); -} - -/** - * @param {bigint} callback - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_constructor_ffimatrixdriver_new(callback, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_constructor_ffimatrixdriver_new(callback, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - * @returns {bigint} - */ -export function ubrn_uniffi_matrix_rtc_fn_clone_ffiparticipationmanager(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - const ret = wasm.ubrn_uniffi_matrix_rtc_fn_clone_ffiparticipationmanager(handle, f_status_.__wbg_ptr); - return BigInt.asUintN(64, ret); -} - -/** - * @param {bigint} handle - * @param {RustCallStatus} f_status_ - */ -export function ubrn_uniffi_matrix_rtc_fn_free_ffiparticipationmanager(handle, f_status_) { - _assertClass(f_status_, RustCallStatus); - wasm.ubrn_uniffi_matrix_rtc_fn_free_ffiparticipationmanager(handle, f_status_.__wbg_ptr); -} - -function __wbg_adapter_24(arg0, arg1) { - wasm._dyn_core_e48f7a02345547b9___ops__function__FnMut_____Output______as_wasm_bindgen_65e498d0bf4959ae___closure__WasmClosure___describe__invoke______(arg0, arg1); -} - -function __wbg_adapter_27(arg0, arg1, arg2) { - wasm.closure572_externref_shim(arg0, arg1, arg2); -} - -const ForeignFutureCompleteF32Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompletef32_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteF32 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteF32Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompletef32_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteF32} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteF32); - wasm.foreignfuturecompletef32_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteF64Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompletef64_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteF64 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteF64Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompletef64_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteF64} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteF64); - wasm.foreignfuturecompletef64_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteI16Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompletei16_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteI16 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteI16Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompletei16_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteI16} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteI16); - wasm.foreignfuturecompletei16_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteI32Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompletei32_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteI32 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteI32Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompletei32_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteI32} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteI32); - wasm.foreignfuturecompletei32_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteI64Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompletei64_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteI64 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteI64Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompletei64_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteI64} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteI64); - wasm.foreignfuturecompletei64_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteI8Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompletei8_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteI8 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteI8Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompletei8_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteI8} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteI8); - wasm.foreignfuturecompletei8_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteRustBufferFinalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompleterustbuffer_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteRustBuffer { - - static __wrap(ptr) { - ptr = ptr >>> 0; - const obj = Object.create(ForeignFutureCompleteRustBuffer.prototype); - obj.__wbg_ptr = ptr; - ForeignFutureCompleteRustBufferFinalization.register(obj, obj.__wbg_ptr, obj); - return obj; - } - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteRustBufferFinalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompleterustbuffer_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteRustBuffer} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteRustBuffer); - wasm.foreignfuturecompleterustbuffer_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteU16Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompleteu16_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteU16 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteU16Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompleteu16_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteU16} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteU16); - wasm.foreignfuturecompleteu16_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteU32Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompleteu32_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteU32 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteU32Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompleteu32_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteU32} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteU32); - wasm.foreignfuturecompleteu32_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteU64Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompleteu64_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteU64 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteU64Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompleteu64_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteU64} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteU64); - wasm.foreignfuturecompleteu64_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteU8Finalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompleteu8_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteU8 { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteU8Finalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompleteu8_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteU8} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteU8); - wasm.foreignfuturecompleteu8_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const ForeignFutureCompleteVoidFinalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_foreignfuturecompletevoid_free(ptr >>> 0, 1)); - -export class ForeignFutureCompleteVoid { - - static __wrap(ptr) { - ptr = ptr >>> 0; - const obj = Object.create(ForeignFutureCompleteVoid.prototype); - obj.__wbg_ptr = ptr; - ForeignFutureCompleteVoidFinalization.register(obj, obj.__wbg_ptr, obj); - return obj; - } - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - ForeignFutureCompleteVoidFinalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_foreignfuturecompletevoid_free(ptr, 0); - } - /** - * @param {ForeignFutureCompleteVoid} _ctx - * @param {bigint} callback_data - * @param {any} result - */ - call(_ctx, callback_data, result) { - _assertClass(_ctx, ForeignFutureCompleteVoid); - wasm.foreignfuturecompletevoid_call(this.__wbg_ptr, _ctx.__wbg_ptr, callback_data, result); - } -} - -const RustCallStatusFinalization = (typeof FinalizationRegistry === 'undefined') - ? { register: () => {}, unregister: () => {} } - : new FinalizationRegistry(ptr => wasm.__wbg_rustcallstatus_free(ptr >>> 0, 1)); - -export class RustCallStatus { - - __destroy_into_raw() { - const ptr = this.__wbg_ptr; - this.__wbg_ptr = 0; - RustCallStatusFinalization.unregister(this); - return ptr; - } - - free() { - const ptr = this.__destroy_into_raw(); - wasm.__wbg_rustcallstatus_free(ptr, 0); - } - /** - * @returns {number} - */ - get code() { - const ret = wasm.__wbg_get_rustcallstatus_code(this.__wbg_ptr); - return ret; - } - /** - * @param {number} arg0 - */ - set code(arg0) { - wasm.__wbg_set_rustcallstatus_code(this.__wbg_ptr, arg0); - } - /** - * @param {Uint8Array | null} [bytes] - */ - set errorBuf(bytes) { - var ptr0 = isLikeNone(bytes) ? 0 : passArray8ToWasm0(bytes, wasm.__wbindgen_malloc); - var len0 = WASM_VECTOR_LEN; - wasm.rustcallstatus_set_error_buf(this.__wbg_ptr, ptr0, len0); - } - constructor() { - const ret = wasm.rustcallstatus_new(); - this.__wbg_ptr = ret >>> 0; - RustCallStatusFinalization.register(this, this.__wbg_ptr, this); - return this; - } - /** - * @returns {Uint8Array | undefined} - */ - get errorBuf() { - const ptr = this.__destroy_into_raw(); - const ret = wasm.rustcallstatus_error_buf(ptr); - let v1; - if (ret[0] !== 0) { - v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice(); - wasm.__wbindgen_free(ret[0], ret[1] * 1, 1); - } - return v1; - } -} - -async function __wbg_load(module, imports) { - if (typeof Response === 'function' && module instanceof Response) { - if (typeof WebAssembly.instantiateStreaming === 'function') { - try { - return await WebAssembly.instantiateStreaming(module, imports); - - } catch (e) { - if (module.headers.get('Content-Type') != 'application/wasm') { - console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e); - - } else { - throw e; - } - } - } - - const bytes = await module.arrayBuffer(); - return await WebAssembly.instantiate(bytes, imports); - - } else { - const instance = await WebAssembly.instantiate(module, imports); - - if (instance instanceof WebAssembly.Instance) { - return { instance, module }; - - } else { - return instance; - } - } -} - -function __wbg_get_imports() { - const imports = {}; - imports.wbg = {}; - imports.wbg.__wbg_buffer_609cc3eee51ed158 = function(arg0) { - const ret = arg0.buffer; - return ret; - }; - imports.wbg.__wbg_call_0056921d632def66 = function(arg0, arg1, arg2) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2)); - return ret; - }; - imports.wbg.__wbg_call_00ed0f3262ca10fc = function(arg0, arg1, arg2) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2)); - return ret; - }; - imports.wbg.__wbg_call_02529374d31ad97c = function(arg0, arg1, arg2) { - arg0.call(arg1, BigInt.asUintN(64, arg2)); - }; - imports.wbg.__wbg_call_03c16dfcbc9e20c2 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, ForeignFutureCompleteRustBuffer.__wrap(arg5), BigInt.asUintN(64, arg6)); - return ret; - }; - imports.wbg.__wbg_call_0433755a93443d6e = function(arg0, arg1, arg2, arg3) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), BigInt.asUintN(64, arg3)); - return ret; - }; - imports.wbg.__wbg_call_21960420ca81bc05 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - var v2 = getArrayU8FromWasm0(arg7, arg8).slice(); - wasm.__wbindgen_free(arg7, arg8 * 1, 1); - var v3 = getArrayU8FromWasm0(arg9, arg10).slice(); - wasm.__wbindgen_free(arg9, arg10 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, v2, v3, ForeignFutureCompleteRustBuffer.__wrap(arg11), BigInt.asUintN(64, arg12)); - return ret; - }; - imports.wbg.__wbg_call_2317578a4ec85f27 = function(arg0, arg1, arg2) { - arg0.call(arg1, BigInt.asUintN(64, arg2)); - }; - imports.wbg.__wbg_call_2798409ff618ef7d = function(arg0, arg1, arg2) { - arg0.call(arg1, BigInt.asUintN(64, arg2)); - }; - imports.wbg.__wbg_call_2f24f710f0dd8d10 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1); - return ret; - }; - imports.wbg.__wbg_call_4022622bc30aaf84 = function(arg0, arg1, arg2) { - arg0.call(arg1, BigInt.asUintN(64, arg2)); - }; - imports.wbg.__wbg_call_45ca295cb4469524 = function(arg0, arg1, arg2, arg3) { - arg0.call(arg1, BigInt.asUintN(64, arg2), arg3); - }; - imports.wbg.__wbg_call_4614c0a573de577f = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - var v2 = getArrayU8FromWasm0(arg7, arg8).slice(); - wasm.__wbindgen_free(arg7, arg8 * 1, 1); - var v3 = getArrayU8FromWasm0(arg9, arg10).slice(); - wasm.__wbindgen_free(arg9, arg10 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, v2, v3, BigInt.asUintN(64, arg11), ForeignFutureCompleteRustBuffer.__wrap(arg12), BigInt.asUintN(64, arg13)); - return ret; - }; - imports.wbg.__wbg_call_5718592162c98368 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - var v2 = getArrayU8FromWasm0(arg7, arg8).slice(); - wasm.__wbindgen_free(arg7, arg8 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, v2, ForeignFutureCompleteRustBuffer.__wrap(arg9), BigInt.asUintN(64, arg10)); - return ret; - }; - imports.wbg.__wbg_call_63c160b52f6d962d = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - var v2 = getArrayU8FromWasm0(arg7, arg8).slice(); - wasm.__wbindgen_free(arg7, arg8 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, v2); - return ret; - }; - imports.wbg.__wbg_call_65360e4d1b0f41fa = function(arg0, arg1, arg2) { - arg0.call(arg1, BigInt.asUintN(64, arg2)); - }; - imports.wbg.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) { - const ret = arg0.call(arg1); - return ret; - }, arguments) }; - imports.wbg.__wbg_call_6791e83bb1bb6601 = function(arg0, arg1, arg2) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2)); - return ret; - }; - imports.wbg.__wbg_call_67bcb4b184601516 = function(arg0, arg1, arg2) { - arg0.call(arg1, BigInt.asUintN(64, arg2)); - }; - imports.wbg.__wbg_call_79e16370d6861b4f = function(arg0, arg1, arg2, arg3, arg4) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0); - return ret; - }; - imports.wbg.__wbg_call_7cccdd69e0791ae2 = function() { return handleError(function (arg0, arg1, arg2) { - const ret = arg0.call(arg1, arg2); - return ret; - }, arguments) }; - imports.wbg.__wbg_call_87edfa0175375a83 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, ForeignFutureCompleteRustBuffer.__wrap(arg7), BigInt.asUintN(64, arg8)); - return ret; - }; - imports.wbg.__wbg_call_9108746ed497928f = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, arg7 >>> 0, ForeignFutureCompleteRustBuffer.__wrap(arg8), BigInt.asUintN(64, arg9)); - return ret; - }; - imports.wbg.__wbg_call_94b3adcf4a0499cf = function(arg0, arg1, arg2) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2)); - return ret; - }; - imports.wbg.__wbg_call_98882f14cac8324a = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, ForeignFutureCompleteVoid.__wrap(arg5), BigInt.asUintN(64, arg6)); - return ret; - }; - imports.wbg.__wbg_call_9a894f10d06a53c9 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, ForeignFutureCompleteVoid.__wrap(arg7), BigInt.asUintN(64, arg8)); - return ret; - }; - imports.wbg.__wbg_call_9f7a841426436a44 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, ForeignFutureCompleteVoid.__wrap(arg7), BigInt.asUintN(64, arg8)); - return ret; - }; - imports.wbg.__wbg_call_a6145cafbb6c59f0 = function(arg0, arg1, arg2) { - arg0.call(arg1, BigInt.asUintN(64, arg2)); - }; - imports.wbg.__wbg_call_a79f116fab0f1a0a = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1); - return ret; - }; - imports.wbg.__wbg_call_abeb9928262c69b8 = function(arg0, arg1, arg2, arg3, arg4) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0); - return ret; - }; - imports.wbg.__wbg_call_ac8db65a5eb7c738 = function(arg0, arg1, arg2, arg3, arg4) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), ForeignFutureCompleteRustBuffer.__wrap(arg3), BigInt.asUintN(64, arg4)); - return ret; - }; - imports.wbg.__wbg_call_b66d526ecf55c81d = function(arg0, arg1, arg2) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2)); - return ret; - }; - imports.wbg.__wbg_call_b9d1054c432bc102 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, ForeignFutureCompleteVoid.__wrap(arg5), BigInt.asUintN(64, arg6)); - return ret; - }; - imports.wbg.__wbg_call_bd656bf95b67af57 = function(arg0, arg1, arg2, arg3, arg4) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0); - return ret; - }; - imports.wbg.__wbg_call_c7fa2ece3851d664 = function(arg0, arg1, arg2) { - arg0.call(arg1, BigInt.asUintN(64, arg2)); - }; - imports.wbg.__wbg_call_c9c4e766b640b52d = function(arg0, arg1, arg2, arg3) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), BigInt.asUintN(64, arg3)); - return ret; - }; - imports.wbg.__wbg_call_ca06027b14b17766 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - var v2 = getArrayU8FromWasm0(arg7, arg8).slice(); - wasm.__wbindgen_free(arg7, arg8 * 1, 1); - var v3 = getArrayU8FromWasm0(arg10, arg11).slice(); - wasm.__wbindgen_free(arg10, arg11 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, v2, BigInt.asUintN(64, arg9), v3, ForeignFutureCompleteRustBuffer.__wrap(arg12), BigInt.asUintN(64, arg13)); - return ret; - }; - imports.wbg.__wbg_call_db19d6a7a08fbd37 = function(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - var v1 = getArrayU8FromWasm0(arg5, arg6).slice(); - wasm.__wbindgen_free(arg5, arg6 * 1, 1); - var v2 = getArrayU8FromWasm0(arg7, arg8).slice(); - wasm.__wbindgen_free(arg7, arg8 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0, v1, v2, BigInt.asUintN(64, arg9), ForeignFutureCompleteRustBuffer.__wrap(arg10), BigInt.asUintN(64, arg11)); - return ret; - }; - imports.wbg.__wbg_call_df53672c5883e9e7 = function(arg0, arg1, arg2, arg3, arg4) { - var v0 = getArrayU8FromWasm0(arg3, arg4).slice(); - wasm.__wbindgen_free(arg3, arg4 * 1, 1); - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), v0); - return ret; - }; - imports.wbg.__wbg_call_e1d35efce0e1a1e6 = function(arg0, arg1, arg2) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2)); - return ret; - }; - imports.wbg.__wbg_call_e561c9090f51461d = function(arg0, arg1, arg2, arg3) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), BigInt.asUintN(64, arg3)); - return ret; - }; - imports.wbg.__wbg_call_f95ee156aae25631 = function(arg0, arg1, arg2) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2)); - return ret; - }; - imports.wbg.__wbg_call_fb7f89f8d567b160 = function(arg0, arg1, arg2) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2)); - return ret; - }; - imports.wbg.__wbg_call_fedc2bfb0eb6df90 = function(arg0, arg1, arg2) { - arg0.call(arg1, BigInt.asUintN(64, arg2)); - }; - imports.wbg.__wbg_call_ff7e7c3b656ecebf = function(arg0, arg1, arg2) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2)); - return ret; - }; - imports.wbg.__wbg_call_ffd94e4913c24a7a = function(arg0, arg1, arg2, arg3) { - const ret = arg0.call(arg1, BigInt.asUintN(64, arg2), BigInt.asUintN(64, arg3)); - return ret; - }; - imports.wbg.__wbg_callstatus_ab813cdd9fb59b5c = function(arg0) { - const ret = arg0.call_status; - _assertClass(ret, RustCallStatus); - var ptr1 = ret.__destroy_into_raw(); - return ptr1; - }; - imports.wbg.__wbg_canceldelayedevent_f1442079ae4bb697 = function(arg0) { - const ret = arg0.cancel_delayed_event; - return ret; - }; - imports.wbg.__wbg_clearTimeout_5a54f8841c30079a = function(arg0) { - const ret = clearTimeout(arg0); - return ret; - }; - imports.wbg.__wbg_code_a1790f546af56cdc = function(arg0) { - const ret = arg0.code; - return ret; - }; - imports.wbg.__wbg_code_b18c52258a7d4327 = function(arg0) { - const ret = arg0.code; - return ret; - }; - imports.wbg.__wbg_crypto_86f2631e91b51511 = function(arg0) { - const ret = arg0.crypto; - return ret; - }; - imports.wbg.__wbg_delegatedelayedleaveviahomeserver_d871a6b6bc347229 = function(arg0) { - const ret = arg0.delegate_delayed_leave_via_homeserver; - return ret; - }; - imports.wbg.__wbg_delegatedelayedleaveviatransport_aa4b046ef4e220a1 = function(arg0) { - const ret = arg0.delegate_delayed_leave_via_transport; - return ret; - }; - imports.wbg.__wbg_errorbuf_59fafcd45c02f900 = function(arg0, arg1) { - const ret = arg1.errorBuf; - var ptr1 = isLikeNone(ret) ? 0 : passArray8ToWasm0(ret, wasm.__wbindgen_malloc); - var len1 = WASM_VECTOR_LEN; - getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); - getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); - }; - imports.wbg.__wbg_errorbuf_9e8687be915296d2 = function(arg0, arg1) { - const ret = arg1.errorBuf; - var ptr1 = isLikeNone(ret) ? 0 : passArray8ToWasm0(ret, wasm.__wbindgen_malloc); - var len1 = WASM_VECTOR_LEN; - getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); - getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); - }; - imports.wbg.__wbg_free_b85a6024660bd07c = function(arg0) { - const ret = arg0.free; - return ret; - }; - imports.wbg.__wbg_getRandomValues_b3f15fcbfabb0f8b = function() { return handleError(function (arg0, arg1) { - arg0.getRandomValues(arg1); - }, arguments) }; - imports.wbg.__wbg_getlivekittoken_5f81591c0acaddc6 = function(arg0) { - const ret = arg0.get_livekit_token; - return ret; - }; - imports.wbg.__wbg_getrtctransports_3911836191336767 = function(arg0) { - const ret = arg0.get_rtc_transports; - return ret; - }; - imports.wbg.__wbg_handle_c2870606e589531b = function(arg0) { - const ret = arg0.handle; - return ret; - }; - imports.wbg.__wbg_ishomeserverconnected_751e70b3c02b3223 = function(arg0) { - const ret = arg0.is_homeserver_connected; - return ret; - }; - imports.wbg.__wbg_log_f27a8f2ebe07bb7c = function(arg0) { - const ret = arg0.log; - return ret; - }; - imports.wbg.__wbg_msCrypto_d562bbe83e0d4b91 = function(arg0) { - const ret = arg0.msCrypto; - return ret; - }; - imports.wbg.__wbg_new_a12002a7f91c75be = function(arg0) { - const ret = new Uint8Array(arg0); - return ret; - }; - imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) { - const ret = new Function(getStringFromWasm0(arg0, arg1)); - return ret; - }; - imports.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a = function(arg0, arg1, arg2) { - const ret = new Uint8Array(arg0, arg1 >>> 0, arg2 >>> 0); - return ret; - }; - imports.wbg.__wbg_newwithlength_a381634e90c276d4 = function(arg0) { - const ret = new Uint8Array(arg0 >>> 0); - return ret; - }; - imports.wbg.__wbg_node_e1f24f89a7336c2e = function(arg0) { - const ret = arg0.node; - return ret; - }; - imports.wbg.__wbg_now_807e54c39636c349 = function() { - const ret = Date.now(); - return ret; - }; - imports.wbg.__wbg_onconnectionschange_cb540732b536bde5 = function(arg0) { - const ret = arg0.on_connections_change; - return ret; - }; - imports.wbg.__wbg_onkeymapchange_7af99be63015699f = function(arg0) { - const ret = arg0.on_key_map_change; - return ret; - }; - imports.wbg.__wbg_onkeyrejected_0811c486ecda07ea = function(arg0) { - const ret = arg0.on_key_rejected; - return ret; - }; - imports.wbg.__wbg_onmembershipschange_72a01e47629908a2 = function(arg0) { - const ret = arg0.on_memberships_change; - return ret; - }; - imports.wbg.__wbg_onsessionchange_799b89dbe5987804 = function(arg0) { - const ret = arg0.on_session_change; - return ret; - }; - imports.wbg.__wbg_onstatuschange_926e83644f91f32d = function(arg0) { - const ret = arg0.on_status_change; - return ret; - }; - imports.wbg.__wbg_pointee_26637032edb8983c = function(arg0) { - const ret = arg0.pointee; - return isLikeNone(ret) ? 0xFFFFFF : ret; - }; - imports.wbg.__wbg_process_3975fd6c72f520aa = function(arg0) { - const ret = arg0.process; - return ret; - }; - imports.wbg.__wbg_queueMicrotask_97d92b4fcc8a61c5 = function(arg0) { - queueMicrotask(arg0); - }; - imports.wbg.__wbg_queueMicrotask_d3219def82552485 = function(arg0) { - const ret = arg0.queueMicrotask; - return ret; - }; - imports.wbg.__wbg_randomFillSync_f8c153b79f285817 = function() { return handleError(function (arg0, arg1) { - arg0.randomFillSync(arg1); - }, arguments) }; - imports.wbg.__wbg_readevents_73801c97c6d3e238 = function(arg0) { - const ret = arg0.read_events; - return ret; - }; - imports.wbg.__wbg_readstate_98bb4b03f7217a30 = function(arg0) { - const ret = arg0.read_state; - return ret; - }; - imports.wbg.__wbg_require_b74f47fc2d022fd6 = function() { return handleError(function () { - const ret = module.require; - return ret; - }, arguments) }; - imports.wbg.__wbg_resolve_4851785c9c5f573d = function(arg0) { - const ret = Promise.resolve(arg0); - return ret; - }; - imports.wbg.__wbg_restartdelayedevent_0d0c2a4a4627841f = function(arg0) { - const ret = arg0.restart_delayed_event; - return ret; - }; - imports.wbg.__wbg_returnvalue_03774948f0205329 = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_returnvalue_21195623004109c3 = function(arg0, arg1) { - const ret = arg1.return_value; - const ptr1 = passArray8ToWasm0(ret, wasm.__wbindgen_malloc); - const len1 = WASM_VECTOR_LEN; - getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true); - getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true); - }; - imports.wbg.__wbg_returnvalue_2620087eeddb8b84 = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_returnvalue_38e0584d82a3ca2e = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_returnvalue_3e9d3c06adc527d8 = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_returnvalue_6e396db732507afb = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_returnvalue_7debfc20c2457c0f = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_returnvalue_92b4f6af41751b5a = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_returnvalue_a10e08181b6e3347 = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_returnvalue_b2583433f7d5bc58 = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_returnvalue_fe6442da8edb6e26 = function(arg0) { - const ret = arg0.return_value; - return ret; - }; - imports.wbg.__wbg_senddelayedevent_1a17e9af52ac70ce = function(arg0) { - const ret = arg0.send_delayed_event; - return ret; - }; - imports.wbg.__wbg_senddelayedstateevent_7310e92bccc3dd9a = function(arg0) { - const ret = arg0.send_delayed_state_event; - return ret; - }; - imports.wbg.__wbg_sendstateevent_b46311c2c989f673 = function(arg0) { - const ret = arg0.send_state_event; - return ret; - }; - imports.wbg.__wbg_sendstickyevent_ae6f44183a0c7825 = function(arg0) { - const ret = arg0.send_sticky_event; - return ret; - }; - imports.wbg.__wbg_sendtodevice_7aac4e0ebd535903 = function(arg0) { - const ret = arg0.send_to_device; - return ret; - }; - imports.wbg.__wbg_setTimeout_db2dbaeefb6f39c7 = function() { return handleError(function (arg0, arg1) { - const ret = setTimeout(arg0, arg1); - return ret; - }, arguments) }; - imports.wbg.__wbg_set_65595bdd868b3009 = function(arg0, arg1, arg2) { - arg0.set(arg1, arg2 >>> 0); - }; - imports.wbg.__wbg_static_accessor_GLOBAL_88a902d13a557d07 = function() { - const ret = typeof global === 'undefined' ? null : global; - return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); - }; - imports.wbg.__wbg_static_accessor_GLOBAL_THIS_56578be7e9f832b0 = function() { - const ret = typeof globalThis === 'undefined' ? null : globalThis; - return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); - }; - imports.wbg.__wbg_static_accessor_SELF_37c5d418e4bf5819 = function() { - const ret = typeof self === 'undefined' ? null : self; - return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); - }; - imports.wbg.__wbg_static_accessor_WINDOW_5de37043a91a9c40 = function() { - const ret = typeof window === 'undefined' ? null : window; - return isLikeNone(ret) ? 0 : addToExternrefTable0(ret); - }; - imports.wbg.__wbg_subarray_aa9065fa9dc5df96 = function(arg0, arg1, arg2) { - const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0); - return ret; - }; - imports.wbg.__wbg_subscribeconnectivity_8fdd26bf00625517 = function(arg0) { - const ret = arg0.subscribe_connectivity; - return ret; - }; - imports.wbg.__wbg_subscriberoomevents_d547d19b370bf4a1 = function(arg0) { - const ret = arg0.subscribe_room_events; - return ret; - }; - imports.wbg.__wbg_subscribestateupdates_376ee2dec3ce8226 = function(arg0) { - const ret = arg0.subscribe_state_updates; - return ret; - }; - imports.wbg.__wbg_subscribetodeviceevents_a2b80a0df19c8813 = function(arg0) { - const ret = arg0.subscribe_to_device_events; - return ret; - }; - imports.wbg.__wbg_then_44b73946d2fb3e7d = function(arg0, arg1) { - const ret = arg0.then(arg1); - return ret; - }; - imports.wbg.__wbg_unifficlone_25a64f9a81fb5b28 = function(arg0) { - const ret = arg0.uniffi_clone; - return ret; - }; - imports.wbg.__wbg_unifficlone_6471a1309ee8fc26 = function(arg0) { - const ret = arg0.uniffi_clone; - return ret; - }; - imports.wbg.__wbg_unifficlone_6b800bc71dff8203 = function(arg0) { - const ret = arg0.uniffi_clone; - return ret; - }; - imports.wbg.__wbg_unifficlone_95a28cf009142cf6 = function(arg0) { - const ret = arg0.uniffi_clone; - return ret; - }; - imports.wbg.__wbg_unifficlone_9de5c992227b473d = function(arg0) { - const ret = arg0.uniffi_clone; - return ret; - }; - imports.wbg.__wbg_unifficlone_f4e9653dc2b93c0c = function(arg0) { - const ret = arg0.uniffi_clone; - return ret; - }; - imports.wbg.__wbg_unifficlone_f8d7fe966d3a99d9 = function(arg0) { - const ret = arg0.uniffi_clone; - return ret; - }; - imports.wbg.__wbg_unifficlone_fe0240768db0e3d6 = function(arg0) { - const ret = arg0.uniffi_clone; - return ret; - }; - imports.wbg.__wbg_uniffifree_00c9e670fc140d79 = function(arg0) { - const ret = arg0.uniffi_free; - return ret; - }; - imports.wbg.__wbg_uniffifree_2b26526e84ac127f = function(arg0) { - const ret = arg0.uniffi_free; - return ret; - }; - imports.wbg.__wbg_uniffifree_313a3d469f2be86d = function(arg0) { - const ret = arg0.uniffi_free; - return ret; - }; - imports.wbg.__wbg_uniffifree_7f877a9bb1d1f761 = function(arg0) { - const ret = arg0.uniffi_free; - return ret; - }; - imports.wbg.__wbg_uniffifree_8bebc19643df1faf = function(arg0) { - const ret = arg0.uniffi_free; - return ret; - }; - imports.wbg.__wbg_uniffifree_af6c094a1e08186f = function(arg0) { - const ret = arg0.uniffi_free; - return ret; - }; - imports.wbg.__wbg_uniffifree_b48fc51f60f5be76 = function(arg0) { - const ret = arg0.uniffi_free; - return ret; - }; - imports.wbg.__wbg_uniffifree_c315e1fbfd7f9e6a = function(arg0) { - const ret = arg0.uniffi_free; - return ret; - }; - imports.wbg.__wbg_versions_4e31226f5e8dc909 = function(arg0) { - const ret = arg0.versions; - return ret; - }; - imports.wbg.__wbindgen_cb_drop = function(arg0) { - const obj = arg0.original; - if (obj.cnt-- == 1) { - obj.a = 0; - return true; - } - const ret = false; - return ret; - }; - imports.wbg.__wbindgen_closure_wrapper2297 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 561, __wbg_adapter_24); - return ret; - }; - imports.wbg.__wbindgen_closure_wrapper2321 = function(arg0, arg1, arg2) { - const ret = makeMutClosure(arg0, arg1, 573, __wbg_adapter_27); - return ret; - }; - imports.wbg.__wbindgen_init_externref_table = function() { - const table = wasm.__wbindgen_export_3; - const offset = table.grow(4); - table.set(0, undefined); - table.set(offset + 0, undefined); - table.set(offset + 1, null); - table.set(offset + 2, true); - table.set(offset + 3, false); - ; - }; - imports.wbg.__wbindgen_is_function = function(arg0) { - const ret = typeof(arg0) === 'function'; - return ret; - }; - imports.wbg.__wbindgen_is_object = function(arg0) { - const val = arg0; - const ret = typeof(val) === 'object' && val !== null; - return ret; - }; - imports.wbg.__wbindgen_is_string = function(arg0) { - const ret = typeof(arg0) === 'string'; - return ret; - }; - imports.wbg.__wbindgen_is_undefined = function(arg0) { - const ret = arg0 === undefined; - return ret; - }; - imports.wbg.__wbindgen_memory = function() { - const ret = wasm.memory; - return ret; - }; - imports.wbg.__wbindgen_string_new = function(arg0, arg1) { - const ret = getStringFromWasm0(arg0, arg1); - return ret; - }; - imports.wbg.__wbindgen_throw = function(arg0, arg1) { - throw new Error(getStringFromWasm0(arg0, arg1)); - }; - - return imports; -} - -function __wbg_init_memory(imports, memory) { - -} - -function __wbg_finalize_init(instance, module) { - wasm = instance.exports; - __wbg_init.__wbindgen_wasm_module = module; - cachedDataViewMemory0 = null; - cachedUint8ArrayMemory0 = null; - - - wasm.__wbindgen_start(); - return wasm; -} - -function initSync(module) { - if (wasm !== undefined) return wasm; - - - if (typeof module !== 'undefined') { - if (Object.getPrototypeOf(module) === Object.prototype) { - ({module} = module) - } else { - console.warn('using deprecated parameters for `initSync()`; pass a single object instead') - } - } - - const imports = __wbg_get_imports(); - - __wbg_init_memory(imports); - - if (!(module instanceof WebAssembly.Module)) { - module = new WebAssembly.Module(module); - } - - const instance = new WebAssembly.Instance(module, imports); - - return __wbg_finalize_init(instance, module); -} - -async function __wbg_init(module_or_path) { - if (wasm !== undefined) return wasm; - - - if (typeof module_or_path !== 'undefined') { - if (Object.getPrototypeOf(module_or_path) === Object.prototype) { - ({module_or_path} = module_or_path) - } else { - console.warn('using deprecated parameters for the initialization function; pass a single object instead') - } - } - - - const imports = __wbg_get_imports(); - - if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) { - module_or_path = fetch(module_or_path); - } - - __wbg_init_memory(imports); - - const { instance, module } = await __wbg_load(await module_or_path, imports); - - return __wbg_finalize_init(instance, module); -} - -export { initSync }; -export default __wbg_init; diff --git a/src/matrix-rtc-sdk/generated/wasm-bindgen/index_bg.wasm b/src/matrix-rtc-sdk/generated/wasm-bindgen/index_bg.wasm deleted file mode 100644 index 24fdf7b66..000000000 Binary files a/src/matrix-rtc-sdk/generated/wasm-bindgen/index_bg.wasm and /dev/null differ diff --git a/src/matrix-rtc-sdk/index.ts b/src/matrix-rtc-sdk/index.ts index f14e4255a..92d924197 100644 --- a/src/matrix-rtc-sdk/index.ts +++ b/src/matrix-rtc-sdk/index.ts @@ -7,17 +7,18 @@ Please see LICENSE in the repository root for full details. /** * The MatrixRTC SDK: the Rust `matrix-rtc` crate through its uniffi web - * bindings. Everything Element Call needs to *participate* in a MatrixRTC - * session — the session projection, our own membership with its keep-alive, - * transport tokens and the media key exchange — lives in the crate; this - * module loads it and re-exports the surface Element Call uses. + * bindings, shipped as the `@element-hq/matrix-rtc` npm package. Everything + * Element Call needs to *participate* in a MatrixRTC session — the session + * projection, our own membership with its keep-alive, transport tokens and + * the media key exchange — lives in the crate; this module loads it and + * re-exports the surface Element Call uses. * - * The bindings under `generated/` are vendored by - * `scripts/sync-matrix-rtc-sdk.sh` and never edited by hand. + * Nothing else imports the package directly: the boot below is the one place + * the wasm is loaded and the crate's logging is wired up, so a caller cannot + * end up with a silent or half-initialised SDK. */ -import initAsync, { type InitInput } from "./generated/wasm-bindgen/index.js"; -import bindings from "./generated/matrix_rtc"; +import { initAsync, type WasmSource } from "@element-hq/matrix-rtc"; import { installMatrixRtcLogSink } from "./logSink"; export { @@ -38,7 +39,7 @@ export { FfiTransportIntent, RtcError, computeSessionsFromEvents, -} from "./generated/matrix_rtc"; +} from "@element-hq/matrix-rtc"; export type { FfiConnectionData, FfiConnectionWithMembers, @@ -62,14 +63,14 @@ export type { RoomEventSinkLike, StateUpdateSinkLike, ToDeviceSinkLike, -} from "./generated/matrix_rtc"; +} from "@element-hq/matrix-rtc"; /** * Where to load the wasm from. A URL (or anything `fetch` accepts) in a * browser; bytes or a compiled module where there is nothing to fetch from, * such as tests. */ -export type MatrixRtcWasmSource = InitInput; +export type MatrixRtcWasmSource = WasmSource; let loading: Promise | null = null; @@ -77,25 +78,28 @@ let loading: Promise | null = null; * Loads and initialises the SDK. Idempotent: the first call decides the * source, later calls await the same load. * - * Without a `source`, the wasm is the one bundled next to this module (an - * asset URL in the app builds). A host that serves the file from somewhere - * else, or a test runner with no server, passes its own. + * Without a `source`, the wasm is the package's own copy as the bundler + * placed it (an asset URL in the app builds). A host that serves the file + * from somewhere else, or a test runner with no server, passes its own. */ export async function initMatrixRtcSdk( source?: MatrixRtcWasmSource, ): Promise { loading ??= (async (): Promise => { - await initAsync({ module_or_path: source ?? (await bundledWasm()) }); - bindings.initialize(); + await initAsync(source ?? (await bundledWasm())); // The crate is silent until told where to log. installMatrixRtcLogSink(); })(); await loading; } -/** The wasm as the bundler placed it, resolved lazily so nothing is fetched until needed. */ +/** + * The wasm as the bundler placed it, resolved lazily so nothing is fetched + * until needed. Asked for explicitly, rather than leaving the package to its + * `import.meta.url` default, so that the dev server's dependency + * pre-bundling, which rewrites module URLs, cannot lose track of it. + */ async function bundledWasm(): Promise { - const { default: url } = - await import("./generated/wasm-bindgen/index_bg.wasm?url"); + const { default: url } = await import("@element-hq/matrix-rtc/wasm?url"); return url; } diff --git a/src/matrix-rtc-sdk/logSink.ts b/src/matrix-rtc-sdk/logSink.ts index c93fcf83a..4465dc08c 100644 --- a/src/matrix-rtc-sdk/logSink.ts +++ b/src/matrix-rtc-sdk/logSink.ts @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details. import { type Logger, logger as rootLogger } from "matrix-js-sdk/lib/logger"; -import { FfiLogLevel, type LogSink, setLogSink } from "./generated/matrix_rtc"; +import { FfiLogLevel, type LogSink, setLogSink } from "@element-hq/matrix-rtc"; /** * A {@link LogSink} that writes the crate's lines to a matrix-js-sdk logger, diff --git a/src/utils/test-matrix-rtc.ts b/src/utils/test-matrix-rtc.ts index 09e2ed4bd..6f857f17b 100644 --- a/src/utils/test-matrix-rtc.ts +++ b/src/utils/test-matrix-rtc.ts @@ -6,26 +6,25 @@ Please see LICENSE in the repository root for full details. */ import { readFileSync } from "node:fs"; -import { resolve } from "node:path"; +import { createRequire } from "node:module"; +import { join } from "node:path"; import { initMatrixRtcSdk } from "../matrix-rtc-sdk"; /** * Loads the MatrixRTC SDK for a unit test. The browser builds fetch the wasm - * by URL; under vitest there is no server, so the bytes come from disk. + * by URL; under vitest there is no server, so the bytes come from disk: the + * `.wasm` the installed package exports as `@element-hq/matrix-rtc/wasm`. * * Only suites that construct a participation manager need this; do not put * it in the global setup, where every test file would pay for the boot. */ export async function initMatrixRtcSdkForTests(): Promise { - // Relative to this file: under the jsdom environment `import.meta.url` is - // not a file URL and `process.cwd()` is not the repository, but vitest - // still provides `__dirname`. - const wasm = readFileSync( - resolve( - __dirname, - "../matrix-rtc-sdk/generated/wasm-bindgen/index_bg.wasm", - ), + // Resolved from this file's directory: under the jsdom environment + // `import.meta.url` is not a file URL and `process.cwd()` is not the + // repository, but vitest still provides `__dirname`. + const wasm = createRequire(join(__dirname, "test-matrix-rtc.ts")).resolve( + "@element-hq/matrix-rtc/wasm", ); - await initMatrixRtcSdk(wasm); + await initMatrixRtcSdk(readFileSync(wasm)); } diff --git a/vitest.config.ts b/vitest.config.ts index 0a5b6511c..50fbc8c0e 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -59,7 +59,6 @@ export default defineConfig((configEnv) => "src/utils/test-fixtures.ts", "src/utils/test-matrix-rtc.ts", "src/utils/test-participation.ts", - "src/matrix-rtc-sdk/generated/**", "playwright/**", ], },