refactor: trim matrix helper exports · openclaw/openclaw@d47055a
steipete
·
2026-05-02
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -6,7 +6,7 @@ import { resolveStateDir } from "openclaw/plugin-sdk/state-paths";
|
6 | 6 | import { resolveLegacyMatrixFlatStoreTarget } from "./migration-config.js"; |
7 | 7 | import { resolveMatrixLegacyFlatStoragePaths } from "./storage-paths.js"; |
8 | 8 | |
9 | | -export type MatrixLegacyStateMigrationResult = { |
| 9 | +type MatrixLegacyStateMigrationResult = { |
10 | 10 | migrated: boolean; |
11 | 11 | changes: string[]; |
12 | 12 | warnings: string[]; |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -export type MatrixRoomKeyBackupStatusLike = { |
| 1 | +type MatrixRoomKeyBackupStatusLike = { |
2 | 2 | serverVersion: string | null; |
3 | 3 | activeVersion: string | null; |
4 | 4 | trusted: boolean | null; |
@@ -8,7 +8,7 @@ export type MatrixRoomKeyBackupStatusLike = {
|
8 | 8 | keyLoadError: string | null; |
9 | 9 | }; |
10 | 10 | |
11 | | -export type MatrixRoomKeyBackupIssueCode = |
| 11 | +type MatrixRoomKeyBackupIssueCode = |
12 | 12 | | "missing-server-backup" |
13 | 13 | | "key-load-failed" |
14 | 14 | | "key-not-loaded" |
@@ -18,7 +18,7 @@ export type MatrixRoomKeyBackupIssueCode =
|
18 | 18 | | "indeterminate" |
19 | 19 | | "ok"; |
20 | 20 | |
21 | | -export type MatrixRoomKeyBackupIssue = { |
| 21 | +type MatrixRoomKeyBackupIssue = { |
22 | 22 | code: MatrixRoomKeyBackupIssueCode; |
23 | 23 | summary: string; |
24 | 24 | message: string | null; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -32,7 +32,6 @@ import {
|
32 | 32 | resolveGlobalMatrixEnvConfig, |
33 | 33 | resolveMatrixEnvAuthReadiness, |
34 | 34 | resolveScopedMatrixEnvConfig, |
35 | | -type MatrixEnvConfig, |
36 | 35 | } from "./env-auth.js"; |
37 | 36 | import { repairCurrentTokenStorageMetaDeviceId } from "./storage.js"; |
38 | 37 | import type { MatrixAuth, MatrixResolvedConfig } from "./types.js"; |
@@ -449,10 +448,8 @@ function buildMatrixNetworkFields(params: {
|
449 | 448 | export { getMatrixScopedEnvVarNames } from "../../env-vars.js"; |
450 | 449 | export { |
451 | 450 | hasReadyMatrixEnvAuth, |
452 | | -resolveGlobalMatrixEnvConfig, |
453 | 451 | resolveMatrixEnvAuthReadiness, |
454 | 452 | resolveScopedMatrixEnvConfig, |
455 | | -type MatrixEnvConfig, |
456 | 453 | } from "./env-auth.js"; |
457 | 454 | export { |
458 | 455 | resolveValidatedMatrixHomeserverUrl, |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | 1 | import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id"; |
2 | 2 | import { getMatrixScopedEnvVarNames } from "../../env-vars.js"; |
3 | 3 | |
4 | | -export type MatrixEnvConfig = { |
| 4 | +type MatrixEnvConfig = { |
5 | 5 | homeserver: string; |
6 | 6 | userId: string; |
7 | 7 | accessToken?: string; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -15,7 +15,7 @@ import {
|
15 | 15 | import type { MatrixAuth } from "./types.js"; |
16 | 16 | import type { MatrixStoragePaths } from "./types.js"; |
17 | 17 | |
18 | | -export const DEFAULT_ACCOUNT_KEY = "default"; |
| 18 | +const DEFAULT_ACCOUNT_KEY = "default"; |
19 | 19 | const STORAGE_META_FILENAME = "storage-meta.json"; |
20 | 20 | const THREAD_BINDINGS_FILENAME = "thread-bindings.json"; |
21 | 21 | const LEGACY_CRYPTO_MIGRATION_FILENAME = "legacy-crypto-migration.json"; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -3,10 +3,7 @@ import { resolveMatrixDefaultOrOnlyAccountId } from "../account-selection.js";
|
3 | 3 | import type { CoreConfig } from "../types.js"; |
4 | 4 | import { resolveMatrixConfigFieldPath } from "./config-paths.js"; |
5 | 5 | |
6 | | -export function resolveMatrixEncryptionConfigPath( |
7 | | -cfg: CoreConfig, |
8 | | -accountId?: string | null, |
9 | | -): string { |
| 6 | +function resolveMatrixEncryptionConfigPath(cfg: CoreConfig, accountId?: string | null): string { |
10 | 7 | const effectiveAccountId = |
11 | 8 | normalizeOptionalAccountId(accountId) ?? resolveMatrixDefaultOrOnlyAccountId(cfg); |
12 | 9 | return resolveMatrixConfigFieldPath(cfg, effectiveAccountId, "encryption"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
|
1 | | -export const MATRIX_MEDIA_SIZE_LIMIT_ERROR_MESSAGE = "Matrix media exceeds configured size limit"; |
| 1 | +const MATRIX_MEDIA_SIZE_LIMIT_ERROR_MESSAGE = "Matrix media exceeds configured size limit"; |
2 | 2 | |
3 | 3 | export class MatrixMediaSizeLimitError extends Error { |
4 | 4 | readonly code = "MATRIX_MEDIA_SIZE_LIMIT" as const; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -35,7 +35,7 @@ function formatMatrixAttachmentMarker(params: {
|
35 | 35 | return params.unavailable ? `[matrix ${label} unavailable]` : `[matrix ${label}]`; |
36 | 36 | } |
37 | 37 | |
38 | | -export function isLikelyBareFilename(text: string): boolean { |
| 38 | +function isLikelyBareFilename(text: string): boolean { |
39 | 39 | const trimmed = text.trim(); |
40 | 40 | if (!trimmed || trimmed.includes("\n") || /\s/.test(trimmed)) { |
41 | 41 | return false; |
@@ -97,7 +97,7 @@ export function resolveMatrixMessageBody(params: {
|
97 | 97 | return attachment.caption; |
98 | 98 | } |
99 | 99 | |
100 | | -export function formatMatrixAttachmentText(params: { |
| 100 | +function formatMatrixAttachmentText(params: { |
101 | 101 | attachment?: MatrixMessageAttachmentSummary; |
102 | 102 | tooLarge?: boolean; |
103 | 103 | unavailable?: boolean; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -12,7 +12,7 @@ type MatrixMonitorAllowListMatch = {
|
12 | 12 | matchSource?: "wildcard" | "id" | "prefixed-id" | "prefixed-user"; |
13 | 13 | }; |
14 | 14 | |
15 | | -export type MatrixMonitorAccessState = { |
| 15 | +type MatrixMonitorAccessState = { |
16 | 16 | effectiveAllowFrom: string[]; |
17 | 17 | effectiveGroupAllowFrom: string[]; |
18 | 18 | effectiveRoomUsers: string[]; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -67,9 +67,7 @@ export function normalizeMatrixAllowList(list?: Array<string | number>) {
|
67 | 67 | return normalizeAllowList(list).map((entry) => normalizeMatrixAllowListEntry(entry)); |
68 | 68 | } |
69 | 69 | |
70 | | -export type MatrixAllowListMatch = AllowlistMatch< |
71 | | -"wildcard" | "id" | "prefixed-id" | "prefixed-user" |
72 | | ->; |
| 70 | +type MatrixAllowListMatch = AllowlistMatch<"wildcard" | "id" | "prefixed-id" | "prefixed-user">; |
73 | 71 | |
74 | 72 | type MatrixAllowListMatchSource = NonNullable<MatrixAllowListMatch["matchSource"]>; |
75 | 73 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。