feat: Add presence heartbeat for Matrix online status

- matrix-gateway: POST /internal/matrix/presence/online endpoint
- usePresenceHeartbeat hook with activity tracking
- Auto away after 5 min inactivity
- Offline on page close/visibility change
- Integrated in MatrixChatRoom component
This commit is contained in:
Apple
2025-11-27 00:19:40 -08:00
parent 5bed515852
commit 3de3c8cb36
6371 changed files with 1317450 additions and 932 deletions

22
node-network-app/node_modules/@babel/core/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

19
node-network-app/node_modules/@babel/core/README.md generated vendored Normal file
View File

@@ -0,0 +1,19 @@
# @babel/core
> Babel compiler core.
See our website [@babel/core](https://babeljs.io/docs/babel-core) for more information or the [issues](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen) associated with this package.
## Install
Using npm:
```sh
npm install --save-dev @babel/core
```
or using yarn:
```sh
yarn add @babel/core --dev
```

82
node-network-app/node_modules/@babel/core/package.json generated vendored Normal file
View File

@@ -0,0 +1,82 @@
{
"name": "@babel/core",
"version": "7.28.5",
"description": "Babel compiler core.",
"main": "./lib/index.js",
"author": "The Babel Team (https://babel.dev/team)",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-core"
},
"homepage": "https://babel.dev/docs/en/next/babel-core",
"bugs": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3A%22pkg%3A%20core%22+is%3Aopen",
"keywords": [
"6to5",
"babel",
"classes",
"const",
"es6",
"harmony",
"let",
"modules",
"transpile",
"transpiler",
"var",
"babel-core",
"compiler"
],
"engines": {
"node": ">=6.9.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/babel"
},
"browser": {
"./lib/config/files/index.js": "./lib/config/files/index-browser.js",
"./lib/config/resolve-targets.js": "./lib/config/resolve-targets-browser.js",
"./lib/transform-file.js": "./lib/transform-file-browser.js",
"./src/config/files/index.ts": "./src/config/files/index-browser.ts",
"./src/config/resolve-targets.ts": "./src/config/resolve-targets-browser.ts",
"./src/transform-file.ts": "./src/transform-file-browser.ts"
},
"dependencies": {
"@babel/code-frame": "^7.27.1",
"@babel/generator": "^7.28.5",
"@babel/helper-compilation-targets": "^7.27.2",
"@babel/helper-module-transforms": "^7.28.3",
"@babel/helpers": "^7.28.4",
"@babel/parser": "^7.28.5",
"@babel/template": "^7.27.2",
"@babel/traverse": "^7.28.5",
"@babel/types": "^7.28.5",
"@jridgewell/remapping": "^2.3.5",
"convert-source-map": "^2.0.0",
"debug": "^4.1.0",
"gensync": "^1.0.0-beta.2",
"json5": "^2.2.3",
"semver": "^6.3.1"
},
"devDependencies": {
"@babel/helper-transform-fixture-test-runner": "^7.28.5",
"@babel/plugin-syntax-flow": "^7.27.1",
"@babel/plugin-transform-flow-strip-types": "^7.27.1",
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
"@babel/preset-env": "^7.28.5",
"@babel/preset-typescript": "^7.28.5",
"@jridgewell/trace-mapping": "^0.3.28",
"@types/convert-source-map": "^2.0.0",
"@types/debug": "^4.1.0",
"@types/resolve": "^1.3.2",
"@types/semver": "^5.4.0",
"rimraf": "^3.0.0",
"ts-node": "^11.0.0-beta.1",
"tsx": "^4.20.3"
},
"type": "commonjs"
}

View File

@@ -0,0 +1,115 @@
/* c8 ignore start */
import type { Handler } from "gensync";
import type {
ConfigFile,
IgnoreFile,
RelativeConfig,
FilePackageData,
} from "./types.ts";
import type { CallerMetadata } from "../validation/options.ts";
export type { ConfigFile, IgnoreFile, RelativeConfig, FilePackageData };
export function findConfigUpwards(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
rootDir: string,
): string | null {
return null;
}
// eslint-disable-next-line require-yield
export function* findPackageData(filepath: string): Handler<FilePackageData> {
return {
filepath,
directories: [],
pkg: null,
isPackage: false,
};
}
// eslint-disable-next-line require-yield
export function* findRelativeConfig(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
pkgData: FilePackageData,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
envName: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
caller: CallerMetadata | undefined,
): Handler<RelativeConfig> {
return { config: null, ignore: null };
}
// eslint-disable-next-line require-yield
export function* findRootConfig(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
dirname: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
envName: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
caller: CallerMetadata | undefined,
): Handler<ConfigFile | null> {
return null;
}
// eslint-disable-next-line require-yield
export function* loadConfig(
name: string,
dirname: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
envName: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
caller: CallerMetadata | undefined,
): Handler<ConfigFile> {
throw new Error(`Cannot load ${name} relative to ${dirname} in a browser`);
}
// eslint-disable-next-line require-yield
export function* resolveShowConfigPath(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
dirname: string,
): Handler<string | null> {
return null;
}
export const ROOT_CONFIG_FILENAMES: string[] = [];
type Resolved =
| { loader: "require"; filepath: string }
| { loader: "import"; filepath: string };
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function resolvePlugin(name: string, dirname: string): Resolved | null {
return null;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export function resolvePreset(name: string, dirname: string): Resolved | null {
return null;
}
export function loadPlugin(
name: string,
dirname: string,
): Handler<{
filepath: string;
value: unknown;
}> {
throw new Error(
`Cannot load plugin ${name} relative to ${dirname} in a browser`,
);
}
export function loadPreset(
name: string,
dirname: string,
): Handler<{
filepath: string;
value: unknown;
}> {
throw new Error(
`Cannot load preset ${name} relative to ${dirname} in a browser`,
);
}

View File

@@ -0,0 +1,29 @@
type indexBrowserType = typeof import("./index-browser");
type indexType = typeof import("./index");
// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of index-browser, since this file may be replaced at bundle time with index-browser.
({}) as any as indexBrowserType as indexType;
export { findPackageData } from "./package.ts";
export {
findConfigUpwards,
findRelativeConfig,
findRootConfig,
loadConfig,
resolveShowConfigPath,
ROOT_CONFIG_FILENAMES,
} from "./configuration.ts";
export type {
ConfigFile,
IgnoreFile,
RelativeConfig,
FilePackageData,
} from "./types.ts";
export {
loadPlugin,
loadPreset,
resolvePlugin,
resolvePreset,
} from "./plugins.ts";

View File

@@ -0,0 +1,42 @@
/* c8 ignore start */
import type { InputOptions } from "./validation/options.ts";
import getTargets, {
type InputTargets,
} from "@babel/helper-compilation-targets";
import type { Targets } from "@babel/helper-compilation-targets";
export function resolveBrowserslistConfigFile(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
browserslistConfigFile: string,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
configFilePath: string,
): string | void {
return undefined;
}
export function resolveTargets(
options: InputOptions,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
root: string,
): Targets {
const optTargets = options.targets;
let targets: InputTargets;
if (typeof optTargets === "string" || Array.isArray(optTargets)) {
targets = { browsers: optTargets };
} else if (optTargets) {
if ("esmodules" in optTargets) {
targets = { ...optTargets, esmodules: "intersect" };
} else {
// https://github.com/microsoft/TypeScript/issues/17002
targets = optTargets as InputTargets;
}
}
return getTargets(targets, {
ignoreBrowserslistConfig: true,
browserslistEnv: options.browserslistEnv,
});
}

View File

@@ -0,0 +1,53 @@
type browserType = typeof import("./resolve-targets-browser");
type nodeType = typeof import("./resolve-targets");
// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of index-browser, since this file may be replaced at bundle time with index-browser.
({}) as any as browserType as nodeType;
import type { InputOptions } from "./validation/options.ts";
import path from "node:path";
import getTargets, {
type InputTargets,
} from "@babel/helper-compilation-targets";
import type { Targets } from "@babel/helper-compilation-targets";
export function resolveBrowserslistConfigFile(
browserslistConfigFile: string,
configFileDir: string,
): string | undefined {
return path.resolve(configFileDir, browserslistConfigFile);
}
export function resolveTargets(options: InputOptions, root: string): Targets {
const optTargets = options.targets;
let targets: InputTargets;
if (typeof optTargets === "string" || Array.isArray(optTargets)) {
targets = { browsers: optTargets };
} else if (optTargets) {
if ("esmodules" in optTargets) {
targets = { ...optTargets, esmodules: "intersect" };
} else {
// https://github.com/microsoft/TypeScript/issues/17002
targets = optTargets as InputTargets;
}
}
const { browserslistConfigFile } = options;
let configFile;
let ignoreBrowserslistConfig = false;
if (typeof browserslistConfigFile === "string") {
configFile = browserslistConfigFile;
} else {
ignoreBrowserslistConfig = browserslistConfigFile === false;
}
return getTargets(targets, {
ignoreBrowserslistConfig,
configFile,
configPath: root,
browserslistEnv: options.browserslistEnv,
});
}

View File

@@ -0,0 +1,33 @@
/* c8 ignore start */
// duplicated from transform-file so we do not have to import anything here
type TransformFile = {
(filename: string, callback: (error: Error, file: null) => void): void;
(
filename: string,
opts: any,
callback: (error: Error, file: null) => void,
): void;
};
export const transformFile: TransformFile = function transformFile(
filename,
opts,
callback?: (error: Error, file: null) => void,
) {
if (typeof opts === "function") {
callback = opts;
}
callback(new Error("Transforming files is not supported in browsers"), null);
};
export function transformFileSync(): never {
throw new Error("Transforming files is not supported in browsers");
}
export function transformFileAsync() {
return Promise.reject(
new Error("Transforming files is not supported in browsers"),
);
}

View File

@@ -0,0 +1,55 @@
import gensync, { type Handler } from "gensync";
import loadConfig from "./config/index.ts";
import type { InputOptions, ResolvedConfig } from "./config/index.ts";
import { run } from "./transformation/index.ts";
import type { FileResult, FileResultCallback } from "./transformation/index.ts";
import * as fs from "./gensync-utils/fs.ts";
type transformFileBrowserType = typeof import("./transform-file-browser");
type transformFileType = typeof import("./transform-file");
// Kind of gross, but essentially asserting that the exports of this module are the same as the
// exports of transform-file-browser, since this file may be replaced at bundle time with
// transform-file-browser.
({}) as any as transformFileBrowserType as transformFileType;
const transformFileRunner = gensync(function* (
filename: string,
opts?: InputOptions,
): Handler<FileResult | null> {
const options = { ...opts, filename };
const config: ResolvedConfig | null = yield* loadConfig(options);
if (config === null) return null;
const code = yield* fs.readFile(filename, "utf8");
return yield* run(config, code);
});
// @ts-expect-error TS doesn't detect that this signature is compatible
export function transformFile(
filename: string,
callback: FileResultCallback,
): void;
export function transformFile(
filename: string,
opts: InputOptions | undefined | null,
callback: FileResultCallback,
): void;
export function transformFile(
...args: Parameters<typeof transformFileRunner.errback>
) {
transformFileRunner.errback(...args);
}
export function transformFileSync(
...args: Parameters<typeof transformFileRunner.sync>
) {
return transformFileRunner.sync(...args);
}
export function transformFileAsync(
...args: Parameters<typeof transformFileRunner.async>
) {
return transformFileRunner.async(...args);
}