From b4e0e85cdd08e08450866e4967aee787c5b47d7a Mon Sep 17 00:00:00 2001 From: Elliot Kozil Date: Mon, 2 Nov 2026 11:58:43 -0600 Subject: [PATCH 1/4] fix(pg): support pg:promote on Advanced-tier databases data-api rejects the legacy /client/v11 wait_status and database endpoints for Advanced-tier databases, so pg:promote failed with not_allowed_on_advanced. For Advanced databases, use the /data/postgres/v1 wait_status endpoint, warn on non-leader pool attachments instead of checking follower status, and skip reattaching the connection-pooling:default pooler. --- src/commands/pg/promote.ts | 65 ++++++--- test/unit/commands/pg/promote.unit.test.ts | 159 +++++++++++++++++++++ 2 files changed, 208 insertions(+), 16 deletions(-) diff --git a/src/commands/pg/promote.ts b/src/commands/pg/promote.ts index f36f0edf62..9ebdd608d1 100644 --- a/src/commands/pg/promote.ts +++ b/src/commands/pg/promote.ts @@ -5,6 +5,8 @@ import {color, utils} from '@heroku/heroku-cli-util' import {Args, ux} from '@oclif/core' import tsheredoc from 'tsheredoc' +import {parseAttachmentFactors} from '../../lib/data/parse-attachment-factors.js' +import {WaitStatus} from '../../lib/data/types.js' import {getRelease} from '../../lib/pg/fetcher.js' import {PgDatabase, PgStatus} from '../../lib/pg/types.js' import {nls} from '../../nls.js' @@ -30,6 +32,8 @@ export default class Promote extends Command { const {database} = args const dbResolver = new utils.pg.DatabaseResolver(this.heroku) const attachment = await dbResolver.getAttachment(app, database) + // data-api rejects the legacy /client/v11 wait_status and follower endpoints for Advanced-tier databases + const isAdvanced = utils.pg.isAdvancedDatabase(attachment.addon) ux.action.start(`Ensuring an alternate alias for existing ${color.datastore('DATABASE_URL')}`) const {body: attachments} = await this.heroku.get(`/apps/${app}/addon-attachments`) const current = attachments.find(a => a.name === 'DATABASE') @@ -64,14 +68,24 @@ export default class Promote extends Command { } if (!force) { - const {body: status} = await this.heroku.get(`/client/v11/databases/${attachment.addon.id}/wait_status`, { - hostname: utils.pg.host(), - }) - if (status['waiting?']) { + let status: WaitStatus + if (isAdvanced) { + ({body: status} = await this.heroku.get(`/data/postgres/v1/${attachment.addon.id}/wait_status`, { + hostname: utils.pg.host(), + })) + } else { + const {body} = await this.heroku.get(`/client/v11/databases/${attachment.addon.id}/wait_status`, { + hostname: utils.pg.host(), + }) + status = {message: body.message, waiting: body['waiting?']} + } + + if (status.waiting) { + const waitCommand = isAdvanced ? 'heroku data:pg:wait' : 'heroku pg:wait' ux.error(heredoc(` Database cannot be promoted while in state: ${status.message} - Promoting this database can lead to application errors and outage. Please run ${color.code('heroku pg:wait')} to wait for database to become available. + Promoting this database can lead to application errors and outage. Please run ${color.code(waitCommand)} to wait for database to become available. To ignore this error, you can pass the --force flag to promote the database and risk application issues. `)) @@ -94,7 +108,14 @@ export default class Promote extends Command { }) ux.action.stop() const currentPooler = attachments.find(a => a.namespace === 'connection-pooling:default' && a.addon?.id === current?.addon?.id && a.name === 'DATABASE_CONNECTION_POOL') - if (currentPooler) { + if (currentPooler && isAdvanced) { + // Advanced-tier databases have no connection-pooling:default namespace, so reattaching would leave an empty attachment + ux.warn(heredoc(` + ${color.attachment(currentPooler.name + '_URL')} still points to ${color.addon(current?.addon?.name as string)}. + + ${color.code('heroku pg:promote')} doesn't reattach connection pooling to Advanced-tier databases. + `)) + } else if (currentPooler) { ux.action.start('Reattaching pooler to new leader') await this.heroku.post('/addon-attachments', { body: { @@ -108,18 +129,30 @@ export default class Promote extends Command { ux.action.stop() } - const {body: promotedDatabaseDetails} = await this.heroku.get(`/client/v11/databases/${attachment.addon.id}`, { - hostname: utils.pg.host(), - }) - if (promotedDatabaseDetails.following) { - const unfollowLeaderCmd = `heroku pg:unfollow ${attachment.addon.name}` - ux.warn(heredoc(` - Your database has been promoted but it is currently a follower database in read-only mode. + if (isAdvanced) { + const {pool} = parseAttachmentFactors(attachment.namespace) + if (pool && pool !== 'leader') { + ux.warn(heredoc(` + Your database has been promoted but ${color.attachment(attachment.name)} connects to the ${color.name(pool)} follower pool in read-only mode. - Promoting a database with ${color.code('heroku pg:promote')} doesn't automatically unfollow its leader. + To make ${color.datastore('DATABASE_URL')} writable, promote an attachment that uses the ${color.name('leader')} pool. + Use ${color.code(`heroku data:pg:attachments ${attachment.addon.name} -a ${app}`)} to list the attachments on the database. + `)) + } + } else { + const {body: promotedDatabaseDetails} = await this.heroku.get(`/client/v11/databases/${attachment.addon.id}`, { + hostname: utils.pg.host(), + }) + if (promotedDatabaseDetails.following) { + const unfollowLeaderCmd = `heroku pg:unfollow ${attachment.addon.name}` + ux.warn(heredoc(` + Your database has been promoted but it is currently a follower database in read-only mode. - Use ${color.code(unfollowLeaderCmd)} to stop this follower from replicating from its leader (${color.datastore(promotedDatabaseDetails.leader as string)}) and convert it into a writable database. - `)) + Promoting a database with ${color.code('heroku pg:promote')} doesn't automatically unfollow its leader. + + Use ${color.code(unfollowLeaderCmd)} to stop this follower from replicating from its leader (${color.datastore(promotedDatabaseDetails.leader as string)}) and convert it into a writable database. + `)) + } } const {body: formation} = await this.heroku.get(`/apps/${app}/formation`) diff --git a/test/unit/commands/pg/promote.unit.test.ts b/test/unit/commands/pg/promote.unit.test.ts index 3456b45ba5..7308962a90 100644 --- a/test/unit/commands/pg/promote.unit.test.ts +++ b/test/unit/commands/pg/promote.unit.test.ts @@ -6,6 +6,7 @@ import tsheredoc from 'tsheredoc' import Cmd from '../../../../src/commands/pg/promote.js' import * as fixtures from '../../../fixtures/addons/fixtures.js' +import {addon as advancedAddon, essentialAddon} from '../../../fixtures/data/pg/fixtures.js' const heredoc = tsheredoc @@ -897,3 +898,161 @@ describe('pg:promote when promoted database is a follower', function () { expect(stderr).to.include('Your database has been promoted but it is currently a follower') }) }) + +function resolveToAdvanced(namespace: null | string) { + nock('https://api.heroku.com') + .post('/actions/addon-attachments/resolve') + .reply(200, [{addon: advancedAddon, name: 'ADVANCED', namespace}]) +} + +function promoteAdvanced(namespace: null | string) { + return nock('https://api.heroku.com') + .post('/addon-attachments', { + addon: {name: advancedAddon.name}, + app: {name: 'myapp'}, + confirm: 'myapp', + name: 'DATABASE', + namespace, + }) + .reply(201) +} + +describe('pg:promote when database is Advanced-tier', function () { + const currentLeader = {addon: {id: 'c23b5a31-3c0a-4c49-9a2b-2ad9b2b4ab70', name: 'postgres-2'}, name: 'DATABASE', namespace: null} + const currentLeaderAlias = {...currentLeader, name: 'RED'} + + beforeEach(function () { + nock('https://api.heroku.com') + .get('/apps/myapp/formation') + .reply(200, []) + }) + + afterEach(function () { + nock.cleanAll() + }) + + it('checks the Advanced wait status and promotes the database', async function () { + resolveToAdvanced(null) + nock('https://api.heroku.com') + .get('/apps/myapp/addon-attachments') + .reply(200, [currentLeader, currentLeaderAlias]) + promoteAdvanced(null) + const dataApi = nock('https://api.data.heroku.com') + .get(`/data/postgres/v1/${advancedAddon.id}/wait_status`) + .reply(200, {message: null, waiting: false}) + + const {stderr} = await runCommand(Cmd, ['--app', 'myapp', 'DATABASE']) + + dataApi.done() + expectOutput(stderr, heredoc(` + Ensuring an alternate alias for existing ⛁ DATABASE_URL... RED_URL + Promoting ⛁ ${advancedAddon.name} to ⛁ DATABASE_URL on ⬢ myapp... done + `)) + }) + + it('errors and points to data:pg:wait when the Advanced database is waiting', async function () { + resolveToAdvanced(null) + nock('https://api.heroku.com') + .get('/apps/myapp/addon-attachments') + .reply(200, [currentLeader, currentLeaderAlias]) + nock('https://api.data.heroku.com') + .get(`/data/postgres/v1/${advancedAddon.id}/wait_status`) + .reply(200, {message: 'Modifying', waiting: true}) + + const {error} = await runCommand(Cmd, ['--app', 'myapp', 'DATABASE']) + + expect(ansis.strip(error!.message)).to.equal(heredoc(` + Database cannot be promoted while in state: Modifying + + Promoting this database can lead to application errors and outage. Please run heroku data:pg:wait to wait for database to become available. + + To ignore this error, you can pass the --force flag to promote the database and risk application issues. + `)) + }) + + it('skips the Advanced wait status when --force is present', async function () { + resolveToAdvanced(null) + nock('https://api.heroku.com') + .get('/apps/myapp/addon-attachments') + .reply(200, [currentLeader, currentLeaderAlias]) + const promoted = promoteAdvanced(null) + + const {stderr} = await runCommand(Cmd, ['--app', 'myapp', '--force', 'DATABASE']) + + promoted.done() + expect(stderr).to.include('Promoting') + }) + + it('warns when the promoted attachment uses a follower pool', async function () { + const namespace = 'pool:analytics|proxy:false|role:owner' + resolveToAdvanced(namespace) + nock('https://api.heroku.com') + .get('/apps/myapp/addon-attachments') + .reply(200, [currentLeader, currentLeaderAlias]) + promoteAdvanced(namespace) + nock('https://api.data.heroku.com') + .get(`/data/postgres/v1/${advancedAddon.id}/wait_status`) + .reply(200, {message: null, waiting: false}) + + const {stderr} = await runCommand(Cmd, ['--app', 'myapp', 'DATABASE']) + + expect(ansis.strip(stderr)).to.include('analytics follower pool') + }) + + it('does not warn when the promoted attachment uses the leader pool', async function () { + const namespace = 'pool:leader|proxy:false|role:owner' + resolveToAdvanced(namespace) + nock('https://api.heroku.com') + .get('/apps/myapp/addon-attachments') + .reply(200, [currentLeader, currentLeaderAlias]) + promoteAdvanced(namespace) + nock('https://api.data.heroku.com') + .get(`/data/postgres/v1/${advancedAddon.id}/wait_status`) + .reply(200, {message: null, waiting: false}) + + const {stderr} = await runCommand(Cmd, ['--app', 'myapp', 'DATABASE']) + + expect(stderr).not.to.include('Warning') + }) + + it('does not reattach the connection pooler to an Advanced database', async function () { + resolveToAdvanced(null) + nock('https://api.heroku.com') + .get('/apps/myapp/addon-attachments') + .reply(200, [ + currentLeader, + currentLeaderAlias, + {...currentLeader, name: 'DATABASE_CONNECTION_POOL', namespace: 'connection-pooling:default'}, + ]) + promoteAdvanced(null) + nock('https://api.data.heroku.com') + .get(`/data/postgres/v1/${advancedAddon.id}/wait_status`) + .reply(200, {message: null, waiting: false}) + + const {stderr} = await runCommand(Cmd, ['--app', 'myapp', 'DATABASE']) + + expect(stderr).not.to.include('Reattaching pooler') + expect(ansis.strip(stderr)).to.include('DATABASE_CONNECTION_POOL_URL still points to postgres-2') + }) + + it('keeps using the legacy endpoints for Essential-tier databases', async function () { + nock('https://api.heroku.com') + .post('/actions/addon-attachments/resolve') + .reply(200, [{addon: essentialAddon, name: 'ESSENTIAL', namespace: null}]) + .get('/apps/myapp/addon-attachments') + .reply(200, [currentLeader, currentLeaderAlias]) + .post('/addon-attachments', { + addon: {name: essentialAddon.name}, app: {name: 'myapp'}, confirm: 'myapp', name: 'DATABASE', namespace: null, + }) + .reply(201) + const dataApi = nock('https://api.data.heroku.com') + .get(`/client/v11/databases/${essentialAddon.id}/wait_status`) + .reply(200, {message: 'available', 'waiting?': false}) + .get(`/client/v11/databases/${essentialAddon.id}`) + .reply(200, {following: null}) + + await runCommand(Cmd, ['--app', 'myapp', 'DATABASE']) + + dataApi.done() + }) +}) From 205bd30e7fa6345af298f7f9be8685c8d902ac20 Mon Sep 17 00:00:00 2001 From: Elliot Kozil Date: Thu, 12 Nov 2026 06:44:47 -0600 Subject: [PATCH 2/4] feat(pg): add data:pg:promote alias for pg:promote --- src/commands/pg/promote.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/commands/pg/promote.ts b/src/commands/pg/promote.ts index 9ebdd608d1..924c2c6e90 100644 --- a/src/commands/pg/promote.ts +++ b/src/commands/pg/promote.ts @@ -14,6 +14,7 @@ import {nls} from '../../nls.js' const heredoc = tsheredoc export default class Promote extends Command { + static aliases = ['data:pg:promote'] static args = { database: Args.string({description: nls('pg:database:arg:description'), required: true}), } From e7da2cd23e68e724a5f57e72501ed60815f9227f Mon Sep 17 00:00:00 2001 From: Elliot Kozil Date: Thu, 12 Nov 2026 09:39:42 -0600 Subject: [PATCH 3/4] fix(pg): send namespace_config for Advanced attachments in pg:promote Platform API is deprecating the raw namespace param on addon-attachment creation. Namespaced Advanced attachments are now sent as namespace_config, both for the promoted attachment and for the alias created for the current DATABASE. Platform only returns the namespace string it built from that config, so it's split back into its key/value pairs and resolves to the same existing namespace. Legacy-tier request bodies are unchanged. --- src/commands/pg/promote.ts | 25 ++++++++- test/unit/commands/pg/promote.unit.test.ts | 61 +++++++++++++++++----- 2 files changed, 72 insertions(+), 14 deletions(-) diff --git a/src/commands/pg/promote.ts b/src/commands/pg/promote.ts index 924c2c6e90..66682293fc 100644 --- a/src/commands/pg/promote.ts +++ b/src/commands/pg/promote.ts @@ -1,4 +1,6 @@ /* eslint-disable complexity */ +import type {pg} from '@heroku/heroku-cli-util' + import {Command, flags} from '@heroku-cli/command' import * as Heroku from '@heroku-cli/schema' import {color, utils} from '@heroku/heroku-cli-util' @@ -13,6 +15,18 @@ import {nls} from '../../nls.js' const heredoc = tsheredoc +// Platform API is deprecating the raw namespace param, so Advanced-tier namespaces go out as namespace_config. Platform +// only returns the namespace it built from that config (sorted key:value pairs joined by `|`), so splitting it back +// apart, keeping every value a string, resolves to the same existing namespace. +function namespaceParams(namespace: null | string | undefined, isAdvanced: boolean) { + if (!isAdvanced || !namespace) return {namespace} + const factors = namespace.split('|').map(factor => { + const separator = factor.indexOf(':') + return [factor.slice(0, separator), factor.slice(separator + 1)] + }) + return {namespace_config: Object.fromEntries(factors)} +} + export default class Promote extends Command { static aliases = ['data:pg:promote'] static args = { @@ -56,12 +70,19 @@ export default class Promote extends Command { // The current add-on occupying the DATABASE attachment has no // other attachments. In order to promote this database without // error, we can create a secondary attachment, just-in-time. + let currentIsAdvanced = false + if (current.namespace) { + // The attachment list doesn't include the add-on's plan, which tells us its tier + const {body: currentAddon} = await this.heroku.get(`/addons/${current.addon?.id}`) + currentIsAdvanced = utils.pg.isAdvancedDatabase(currentAddon) + } + const {body: backup} = await this.heroku.post('/addon-attachments', { body: { addon: {name: current.addon?.name}, app: {name: app}, confirm: app, - namespace: current.namespace, + ...namespaceParams(current.namespace, currentIsAdvanced), }, }) ux.action.stop(color.attachment(backup.name + '_URL')) @@ -104,7 +125,7 @@ export default class Promote extends Command { app: {name: app}, confirm: app, name: as || 'DATABASE', - namespace: attachment.namespace || null, + ...namespaceParams(attachment.namespace || null, isAdvanced), }, }) ux.action.stop() diff --git a/test/unit/commands/pg/promote.unit.test.ts b/test/unit/commands/pg/promote.unit.test.ts index 7308962a90..59a4fd13b2 100644 --- a/test/unit/commands/pg/promote.unit.test.ts +++ b/test/unit/commands/pg/promote.unit.test.ts @@ -396,11 +396,13 @@ describe('pg:promote when argument is a credential attachment', function () { namespace: 'credential:hello', }, { - addon: {name: addon.name}, + addon: {id: addon.id, name: addon.name}, name: 'DATABASE', namespace: 'credential:goodbye', }, ]) + .get(`/addons/${addon.id}`) + .reply(200, addon) .post('/addon-attachments', { addon: {name: addon.name}, app: {name: 'myapp'}, @@ -905,14 +907,14 @@ function resolveToAdvanced(namespace: null | string) { .reply(200, [{addon: advancedAddon, name: 'ADVANCED', namespace}]) } -function promoteAdvanced(namespace: null | string) { +function promoteAdvanced(namespaceParams: {namespace: null} | {namespace_config: Record}) { return nock('https://api.heroku.com') .post('/addon-attachments', { addon: {name: advancedAddon.name}, app: {name: 'myapp'}, confirm: 'myapp', name: 'DATABASE', - namespace, + ...namespaceParams, }) .reply(201) } @@ -936,7 +938,7 @@ describe('pg:promote when database is Advanced-tier', function () { nock('https://api.heroku.com') .get('/apps/myapp/addon-attachments') .reply(200, [currentLeader, currentLeaderAlias]) - promoteAdvanced(null) + promoteAdvanced({namespace: null}) const dataApi = nock('https://api.data.heroku.com') .get(`/data/postgres/v1/${advancedAddon.id}/wait_status`) .reply(200, {message: null, waiting: false}) @@ -975,7 +977,7 @@ describe('pg:promote when database is Advanced-tier', function () { nock('https://api.heroku.com') .get('/apps/myapp/addon-attachments') .reply(200, [currentLeader, currentLeaderAlias]) - const promoted = promoteAdvanced(null) + const promoted = promoteAdvanced({namespace: null}) const {stderr} = await runCommand(Cmd, ['--app', 'myapp', '--force', 'DATABASE']) @@ -984,37 +986,72 @@ describe('pg:promote when database is Advanced-tier', function () { }) it('warns when the promoted attachment uses a follower pool', async function () { - const namespace = 'pool:analytics|proxy:false|role:owner' - resolveToAdvanced(namespace) + resolveToAdvanced('pool:analytics|proxy:false|role:owner') nock('https://api.heroku.com') .get('/apps/myapp/addon-attachments') .reply(200, [currentLeader, currentLeaderAlias]) - promoteAdvanced(namespace) + const promoted = promoteAdvanced({namespace_config: {pool: 'analytics', proxy: 'false', role: 'owner'}}) nock('https://api.data.heroku.com') .get(`/data/postgres/v1/${advancedAddon.id}/wait_status`) .reply(200, {message: null, waiting: false}) const {stderr} = await runCommand(Cmd, ['--app', 'myapp', 'DATABASE']) + promoted.done() expect(ansis.strip(stderr)).to.include('analytics follower pool') }) it('does not warn when the promoted attachment uses the leader pool', async function () { - const namespace = 'pool:leader|proxy:false|role:owner' - resolveToAdvanced(namespace) + resolveToAdvanced('pool:leader|proxy:false|role:owner') nock('https://api.heroku.com') .get('/apps/myapp/addon-attachments') .reply(200, [currentLeader, currentLeaderAlias]) - promoteAdvanced(namespace) + const promoted = promoteAdvanced({namespace_config: {pool: 'leader', proxy: 'false', role: 'owner'}}) nock('https://api.data.heroku.com') .get(`/data/postgres/v1/${advancedAddon.id}/wait_status`) .reply(200, {message: null, waiting: false}) const {stderr} = await runCommand(Cmd, ['--app', 'myapp', 'DATABASE']) + promoted.done() expect(stderr).not.to.include('Warning') }) + it('creates the alternate alias with namespace_config when the current DATABASE is a namespaced Advanced attachment', async function () { + nock('https://api.heroku.com') + .post('/actions/addon-attachments/resolve') + .reply(200, [{addon: essentialAddon, name: 'ESSENTIAL', namespace: null}]) + .get('/apps/myapp/addon-attachments') + .reply(200, [{ + addon: {id: advancedAddon.id, name: advancedAddon.name}, name: 'DATABASE', namespace: 'pool:analytics|proxy:false|role:owner', + }]) + .get(`/addons/${advancedAddon.id}`) + .reply(200, advancedAddon) + .post('/addon-attachments', { + addon: {name: advancedAddon.name}, + app: {name: 'myapp'}, + confirm: 'myapp', + namespace_config: {pool: 'analytics', proxy: 'false', role: 'owner'}, + }) + .reply(201, {name: 'GOLD'}) + .post('/addon-attachments', { + addon: {name: essentialAddon.name}, app: {name: 'myapp'}, confirm: 'myapp', name: 'DATABASE', namespace: null, + }) + .reply(201) + nock('https://api.data.heroku.com') + .get(`/client/v11/databases/${essentialAddon.id}/wait_status`) + .reply(200, {message: 'available', 'waiting?': false}) + .get(`/client/v11/databases/${essentialAddon.id}`) + .reply(200, {following: null}) + + const {stderr} = await runCommand(Cmd, ['--app', 'myapp', 'DATABASE']) + + expectOutput(stderr, heredoc(` + Ensuring an alternate alias for existing ⛁ DATABASE_URL... GOLD_URL + Promoting ⛁ ${essentialAddon.name} to ⛁ DATABASE_URL on ⬢ myapp... done + `)) + }) + it('does not reattach the connection pooler to an Advanced database', async function () { resolveToAdvanced(null) nock('https://api.heroku.com') @@ -1024,7 +1061,7 @@ describe('pg:promote when database is Advanced-tier', function () { currentLeaderAlias, {...currentLeader, name: 'DATABASE_CONNECTION_POOL', namespace: 'connection-pooling:default'}, ]) - promoteAdvanced(null) + promoteAdvanced({namespace: null}) nock('https://api.data.heroku.com') .get(`/data/postgres/v1/${advancedAddon.id}/wait_status`) .reply(200, {message: null, waiting: false}) From a63fc2492609c64f933f4e9c14e9f97013e836c0 Mon Sep 17 00:00:00 2001 From: Elliot Kozil Date: Thu, 12 Nov 2026 10:18:52 -0600 Subject: [PATCH 4/4] refactor(pg): build pg:promote namespace_config from parseAttachmentFactors --- src/commands/pg/promote.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/commands/pg/promote.ts b/src/commands/pg/promote.ts index 66682293fc..d8e8a02a66 100644 --- a/src/commands/pg/promote.ts +++ b/src/commands/pg/promote.ts @@ -16,14 +16,11 @@ import {nls} from '../../nls.js' const heredoc = tsheredoc // Platform API is deprecating the raw namespace param, so Advanced-tier namespaces go out as namespace_config. Platform -// only returns the namespace it built from that config (sorted key:value pairs joined by `|`), so splitting it back -// apart, keeping every value a string, resolves to the same existing namespace. +// only returns the namespace it built from that config, so parsing its factors back out, with every value as a string, +// resolves to the same existing namespace. function namespaceParams(namespace: null | string | undefined, isAdvanced: boolean) { if (!isAdvanced || !namespace) return {namespace} - const factors = namespace.split('|').map(factor => { - const separator = factor.indexOf(':') - return [factor.slice(0, separator), factor.slice(separator + 1)] - }) + const factors = Object.entries(parseAttachmentFactors(namespace)).map(([key, value]) => [key, String(value)]) return {namespace_config: Object.fromEntries(factors)} }