fix: restaurar utilitários de acesso remoto
This commit is contained in:
parent
192a5c2909
commit
38e4bbea7f
1 changed files with 17 additions and 1 deletions
|
|
@ -249,6 +249,15 @@ type MachineRemoteAccessEntry = {
|
||||||
metadata: Record<string, unknown> | null
|
metadata: Record<string, unknown> | null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export type MachineRemoteAccess = {
|
||||||
|
provider: string | null
|
||||||
|
identifier: string | null
|
||||||
|
url: string | null
|
||||||
|
notes: string | null
|
||||||
|
lastVerifiedAt: number | null
|
||||||
|
metadata: Record<string, unknown> | null
|
||||||
|
}
|
||||||
|
|
||||||
function collectInitials(name: string): string {
|
function collectInitials(name: string): string {
|
||||||
const words = name.split(/\s+/).filter(Boolean)
|
const words = name.split(/\s+/).filter(Boolean)
|
||||||
if (words.length === 0) return "?"
|
if (words.length === 0) return "?"
|
||||||
|
|
@ -309,7 +318,7 @@ function normalizeMachineRemoteAccessEntry(raw: unknown): MachineRemoteAccessEnt
|
||||||
id: null,
|
id: null,
|
||||||
clientId: createRemoteAccessClientId(),
|
clientId: createRemoteAccessClientId(),
|
||||||
provider: null,
|
provider: null,
|
||||||
identifier: trimmed,
|
identifier: isUrl ? null : trimmed,
|
||||||
url: isUrl ? trimmed : null,
|
url: isUrl ? trimmed : null,
|
||||||
notes: null,
|
notes: null,
|
||||||
lastVerifiedAt: null,
|
lastVerifiedAt: null,
|
||||||
|
|
@ -341,6 +350,13 @@ function normalizeMachineRemoteAccessEntry(raw: unknown): MachineRemoteAccessEnt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function normalizeMachineRemoteAccess(raw: unknown): MachineRemoteAccess | null {
|
||||||
|
const entry = normalizeMachineRemoteAccessEntry(raw)
|
||||||
|
if (!entry) return null
|
||||||
|
const { provider, identifier, url, notes, lastVerifiedAt, metadata } = entry
|
||||||
|
return { provider, identifier, url, notes, lastVerifiedAt, metadata }
|
||||||
|
}
|
||||||
|
|
||||||
export function normalizeMachineRemoteAccessList(raw: unknown): MachineRemoteAccessEntry[] {
|
export function normalizeMachineRemoteAccessList(raw: unknown): MachineRemoteAccessEntry[] {
|
||||||
if (!raw) return []
|
if (!raw) return []
|
||||||
const source = Array.isArray(raw) ? raw : [raw]
|
const source = Array.isArray(raw) ? raw : [raw]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue