Always return all schema config fields in maskRow

Config object starts empty so the frontend had nothing to render for
plaintext fields (region, username etc). Now populates all schema-defined
fields with empty string when not yet saved.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-07-01 19:22:12 +00:00
parent e7b08ccf31
commit f5f87fdd1f

View file

@ -12,12 +12,17 @@ function decryptSecrets(row) {
function maskRow(row) {
const schema = INTEGRATIONS[row.slug]
// Always return all schema-defined config fields, even if not yet saved
const config = {}
for (const f of schema?.configFields ?? []) {
config[f] = row.config?.[f] ?? ''
}
const existing = decryptSecrets(row)
const masked = {}
for (const f of schema?.secretFields ?? []) {
masked[f] = existing[f] ? MASKED : null
}
return { slug: row.slug, name: row.name, config: row.config, secrets: masked, enabled: row.enabled, updated_at: row.updated_at }
return { slug: row.slug, name: row.name, config, secrets: masked, enabled: row.enabled, updated_at: row.updated_at }
}
export async function integrationRoutes(app) {