fix(etcd): preserve raw key identity in browser actions

This commit is contained in:
二丫讲梵 authored and GitHub committed 2026-07-27 13:18:53 +08:00
1 parent 122853d089
commit 39d0f5b30f
69 files changed
+6577 -742

No files matched your search

+12 -1
View File
@@ -412,6 +412,9 @@ export const etcdSupportsTtl = forward("etcdSupportsTtl");
export const etcdGet = forward("etcdGet");
export const etcdPut = forward("etcdPut");
export const etcdDelete = forward("etcdDelete");
export const etcdRename = forward("etcdRename");
export const etcdHistory = forward("etcdHistory");
export const etcdStatus = forward("etcdStatus");
// ZooKeeper
export const zookeeperListPrefix = forward("zookeeperListPrefix");
@@ -620,18 +623,26 @@ export type {
RedisSlowlogEntry,
RedisNodeEndpoint,
KvValueEncoding,
KvInt64,
KvValue,
KvKeyMetadata,
KvKeySummary,
KvListPrefixResponse,
KvListPrefixOptions,
KvGetResponse,
KvGetOptions,
KvGetResponse,
KvWriteMode,
KvCreateMode,
KvPutOptions,
KvPutResponse,
KvDeleteOptions,
KvDeleteResponse,
KvHistoryEventType,
KvHistoryEvent,
KvHistoryResponse,
KvStatusMember,
KvPrometheusMetrics,
KvStatusResponse,
DocumentQueryResult,
MongoDocumentResult,
HistoryEntry,
+24 -5
View File
@@ -72,6 +72,7 @@ import type {
RedisCommandResult,
RedisSlowlogEntry,
RedisNodeEndpoint,
KvInt64,
KvValue,
KvListPrefixResponse,
KvListPrefixOptions,
@@ -79,7 +80,10 @@ import type {
KvGetOptions,
KvPutOptions,
KvPutResponse,
KvDeleteOptions,
KvDeleteResponse,
KvHistoryResponse,
KvStatusResponse,
DocumentQueryResult,
MongoDocumentResult,
MongoCollectionStatsResult,
@@ -2054,8 +2058,8 @@ export async function redisClusterMasterNodes(connectionId: string): Promise<Red
// etcd
// ---------------------------------------------------------------------------
export async function etcdListPrefix(connectionId: string, prefix: string, limit: number, continuation?: string | null): Promise<KvListPrefixResponse> {
return post("/api/etcd/list-prefix", { connectionId, prefix, limit, continuation });
export async function etcdListPrefix(connectionId: string, prefix: string, limit: number, continuation?: string | null, options?: KvListPrefixOptions | null): Promise<KvListPrefixResponse> {
return post("/api/etcd/list-prefix", { connectionId, prefix, limit, continuation, revision: options?.revision ?? null, includeValues: options?.includeValues ?? null });
}
export async function etcdSupportsTtl(connectionId: string): Promise<boolean> {
@@ -2063,7 +2067,7 @@ export async function etcdSupportsTtl(connectionId: string): Promise<boolean> {
}
export async function etcdGet(connectionId: string, key: string, options?: KvGetOptions | null): Promise<KvGetResponse> {
return post("/api/etcd/get", { connectionId, key, metadataOnly: options?.metadataOnly ?? null });
return post("/api/etcd/get", { connectionId, key, keyBytes: options?.keyBytes ?? null, revision: options?.revision ?? null, metadataOnly: options?.metadataOnly ?? null });
}
export async function etcdPut(connectionId: string, key: string, value: KvValue, options?: KvPutOptions | number | null): Promise<KvPutResponse> {
@@ -2076,11 +2080,26 @@ export async function etcdPut(connectionId: string, key: string, value: KvValue,
lease: legacyLease ?? putOptions?.lease ?? null,
ttl: putOptions?.ttl ?? null,
preserveLease: putOptions?.preserveLease ?? null,
keyBytes: putOptions?.keyBytes ?? null,
expectedModRevision: putOptions?.expectedModRevision ?? null,
expectedCreateRevision: putOptions?.expectedCreateRevision ?? null,
});
}
export async function etcdDelete(connectionId: string, key: string): Promise<KvDeleteResponse> {
return post("/api/etcd/delete", { connectionId, key });
export async function etcdDelete(connectionId: string, key: string, options?: KvDeleteOptions | null): Promise<KvDeleteResponse> {
return post("/api/etcd/delete", { connectionId, key, keyBytes: options?.keyBytes ?? null, expectedModRevision: options?.expectedModRevision ?? null });
}
export async function etcdRename(connectionId: string, request: { key: string; keyBytes?: KvValue | null; newKey: string; expectedModRevision?: KvInt64 | null }): Promise<{ renamed: boolean; revision?: KvInt64 | null }> {
return post("/api/etcd/rename", { connectionId, request });
}
export async function etcdHistory(connectionId: string, request: { key: string; keyBytes?: KvValue | null; startRevision?: KvInt64 | null; endRevision?: KvInt64 | null; limit: number }): Promise<KvHistoryResponse> {
return post("/api/etcd/history", { connectionId, request });
}
export async function etcdStatus(connectionId: string): Promise<KvStatusResponse> {
return post("/api/etcd/status", { connectionId });
}
// ---------------------------------------------------------------------------
+174 -12
View File
@@ -1770,6 +1770,7 @@ export async function redisClusterMasterNodes(connectionId: string): Promise<Red
// --- etcd ---
export type KvValueEncoding = "utf8" | "base64";
export type KvInt64 = string;
export interface KvValue {
encoding: KvValueEncoding;
@@ -1777,10 +1778,10 @@ export interface KvValue {
}
export interface KvKeyMetadata {
createRevision?: number | null;
modRevision?: number | null;
version?: number | null;
lease?: number | null;
createRevision?: KvInt64 | number | null;
modRevision?: KvInt64 | number | null;
version?: KvInt64 | number | null;
lease?: KvInt64 | number | null;
ttl?: number | null;
valueSize?: number | null;
czxid?: number | null;
@@ -1797,27 +1798,36 @@ export interface KvKeyMetadata {
export interface KvKeySummary extends KvKeyMetadata {
key: string;
keyIdentity?: string | null;
keyBytes?: KvValue | null;
value?: KvValue | null;
}
export interface KvListPrefixResponse {
keys: KvKeySummary[];
continuation?: string | null;
revision?: number | null;
revision?: KvInt64 | number | null;
}
export interface KvListPrefixOptions {
recursive?: boolean | null;
revision?: KvInt64 | null;
includeValues?: boolean | null;
}
export interface KvGetResponse {
found: boolean;
key?: string | null;
keyIdentity?: string | null;
keyBytes?: KvValue | null;
value?: KvValue | null;
metadata?: KvKeyMetadata | null;
}
export interface KvGetOptions {
metadataOnly?: boolean | null;
keyBytes?: KvValue | null;
revision?: KvInt64 | null;
}
export interface KvPutResponse {
@@ -1832,20 +1842,159 @@ export type KvWriteMode = "upsert" | "create" | "update";
export type KvCreateMode = "persistent" | "ephemeral" | "persistent_sequential" | "ephemeral_sequential";
export interface KvPutOptions {
lease?: number | null;
lease?: KvInt64 | number | null;
ttl?: number | null;
preserveLease?: boolean | null;
writeMode?: KvWriteMode | null;
createMode?: KvCreateMode | null;
keyBytes?: KvValue | null;
expectedModRevision?: KvInt64 | null;
expectedCreateRevision?: KvInt64 | null;
}
export interface KvDeleteOptions {
keyBytes?: KvValue | null;
expectedModRevision?: KvInt64 | null;
}
export interface KvDeleteResponse {
deleted: number;
revision?: number | null;
revision?: KvInt64 | number | null;
}
export async function etcdListPrefix(connectionId: string, prefix: string, limit: number, continuation?: string | null): Promise<KvListPrefixResponse> {
return invoke("etcd_list_prefix", { connectionId, prefix, limit, continuation });
export type KvHistoryEventType = "put" | "delete";
export interface KvHistoryEvent {
eventType: KvHistoryEventType;
revision: KvInt64;
value?: KvValue | null;
previousValue?: KvValue | null;
metadata?: KvKeyMetadata | null;
}
export interface KvHistoryResponse {
events: KvHistoryEvent[];
observedRevision: KvInt64;
truncated: boolean;
}
export interface KvStatusMember {
endpoint: string;
memberId?: KvInt64 | null;
name?: string | null;
version?: string | null;
leaderId?: KvInt64 | null;
revision?: KvInt64 | null;
raftTerm?: KvInt64 | null;
raftIndex?: KvInt64 | null;
raftAppliedIndex?: KvInt64 | null;
dbSize?: KvInt64 | null;
dbSizeInUse?: KvInt64 | null;
learner: boolean;
reachable: boolean;
latencyMs?: number | null;
errors: string[];
}
export interface KvPrometheusMetrics {
available: boolean;
sourceUrl?: string | null;
error?: string | null;
collectedAtMs?: number | null;
sampleCount?: number | null;
serverVersion?: string | null;
clusterVersion?: string | null;
goVersion?: string | null;
authRevision?: number | null;
hasLeader?: number | null;
isLeader?: number | null;
leaderChangesTotal?: number | null;
proposalsCommittedTotal?: number | null;
proposalsAppliedTotal?: number | null;
proposalsPending?: number | null;
proposalsFailedTotal?: number | null;
grpcRequestsTotal?: number | null;
grpcFailuresTotal?: number | null;
grpcMethodRequestsTotal: Record<string, number>;
grpcMethodFailuresTotal: Record<string, number>;
requestDurationSecondsSumByType: Record<string, number>;
requestDurationSecondsCountByType: Record<string, number>;
mvccPutTotal?: number | null;
mvccDeleteTotal?: number | null;
mvccRangeTotal?: number | null;
mvccTxnTotal?: number | null;
mvccCurrentRevision?: number | null;
mvccCompactRevision?: number | null;
mvccKeysTotal?: number | null;
mvccEventsTotal?: number | null;
mvccPendingEventsTotal?: number | null;
mvccSlowWatcherTotal?: number | null;
mvccWatchStreamTotal?: number | null;
mvccWatcherTotal?: number | null;
mvccTotalPutSizeBytes?: number | null;
openReadTransactions?: number | null;
leaseGrantedTotal?: number | null;
leaseRenewedTotal?: number | null;
leaseRevokedTotal?: number | null;
leaseExpiredTotal?: number | null;
leaseTtlSecondsSum?: number | null;
leaseTtlSecondsCount?: number | null;
clientReceivedBytesTotal?: number | null;
clientSentBytesTotal?: number | null;
peerReceivedBytesTotal?: number | null;
peerSentBytesTotal?: number | null;
peerReceivedFailuresTotal?: number | null;
peerSentFailuresTotal?: number | null;
walFsyncDurationSecondsSum?: number | null;
walFsyncDurationSecondsCount?: number | null;
walWriteBytesTotal?: number | null;
walWriteDurationSecondsSum?: number | null;
walWriteDurationSecondsCount?: number | null;
backendCommitDurationSecondsSum?: number | null;
backendCommitDurationSecondsCount?: number | null;
backendSnapshotDurationSecondsSum?: number | null;
backendSnapshotDurationSecondsCount?: number | null;
backendDefragDurationSecondsSum?: number | null;
backendDefragDurationSecondsCount?: number | null;
diskDefragInflight?: number | null;
snapshotApplyInProgress?: number | null;
quotaBackendBytes?: number | null;
knownPeers?: number | null;
heartbeatSendFailuresTotal?: number | null;
readIndexesFailedTotal?: number | null;
slowApplyTotal?: number | null;
slowReadIndexesTotal?: number | null;
healthSuccessTotal?: number | null;
healthFailuresTotal?: number | null;
residentMemoryBytes?: number | null;
virtualMemoryBytes?: number | null;
cpuSecondsTotal?: number | null;
processStartTimeSeconds?: number | null;
processReceivedBytesTotal?: number | null;
processTransmittedBytesTotal?: number | null;
openFds?: number | null;
maxFds?: number | null;
goroutines?: number | null;
goThreads?: number | null;
goMaxProcs?: number | null;
goHeapAllocBytes?: number | null;
goHeapInuseBytes?: number | null;
goHeapSysBytes?: number | null;
goHeapObjects?: number | null;
goNextGcBytes?: number | null;
goGcDurationSecondsSum?: number | null;
goGcDurationSecondsCount?: number | null;
dbSizeMetricBytes?: number | null;
dbSizeInUseMetricBytes?: number | null;
}
export interface KvStatusResponse {
clusterId?: KvInt64 | null;
revision?: KvInt64 | null;
leaderId?: KvInt64 | null;
keyCount?: KvInt64 | null;
alarms: string[];
members: KvStatusMember[];
metrics?: KvPrometheusMetrics | null;
}
export async function etcdListPrefix(connectionId: string, prefix: string, limit: number, continuation?: string | null, options?: KvListPrefixOptions | null): Promise<KvListPrefixResponse> {
return invoke("etcd_list_prefix", { connectionId, prefix, limit, continuation, revision: options?.revision ?? null, includeValues: options?.includeValues ?? null });
}
export async function etcdSupportsTtl(connectionId: string): Promise<boolean> {
@@ -1853,7 +2002,7 @@ export async function etcdSupportsTtl(connectionId: string): Promise<boolean> {
}
export async function etcdGet(connectionId: string, key: string, options?: KvGetOptions | null): Promise<KvGetResponse> {
return invoke("etcd_get", { connectionId, key, metadataOnly: options?.metadataOnly ?? null });
return invoke("etcd_get", { connectionId, key, keyBytes: options?.keyBytes ?? null, revision: options?.revision ?? null, metadataOnly: options?.metadataOnly ?? null });
}
export async function etcdPut(connectionId: string, key: string, value: KvValue, options?: KvPutOptions | number | null): Promise<KvPutResponse> {
@@ -1866,11 +2015,24 @@ export async function etcdPut(connectionId: string, key: string, value: KvValue,
lease: legacyLease ?? putOptions?.lease ?? null,
ttl: putOptions?.ttl ?? null,
preserveLease: putOptions?.preserveLease ?? null,
keyBytes: putOptions?.keyBytes ?? null,
expectedModRevision: putOptions?.expectedModRevision ?? null,
expectedCreateRevision: putOptions?.expectedCreateRevision ?? null,
});
}
export async function etcdDelete(connectionId: string, key: string): Promise<KvDeleteResponse> {
return invoke("etcd_delete", { connectionId, key });
export async function etcdDelete(connectionId: string, key: string, options?: KvDeleteOptions | null): Promise<KvDeleteResponse> {
return invoke("etcd_delete", { connectionId, key, keyBytes: options?.keyBytes ?? null, expectedModRevision: options?.expectedModRevision ?? null });
}
export async function etcdRename(connectionId: string, request: { key: string; keyBytes?: KvValue | null; newKey: string; expectedModRevision?: KvInt64 | null }): Promise<{ renamed: boolean; revision?: KvInt64 | null }> {
return invoke("etcd_rename", { connectionId, request });
}
export async function etcdHistory(connectionId: string, request: { key: string; keyBytes?: KvValue | null; startRevision?: KvInt64 | null; endRevision?: KvInt64 | null; limit: number }): Promise<KvHistoryResponse> {
return invoke("etcd_history", { connectionId, request });
}
export async function etcdStatus(connectionId: string): Promise<KvStatusResponse> {
return invoke("etcd_status", { connectionId });
}
// --- ZooKeeper ---