Developer Preview — This project is in active development. APIs may change. Provide feedback
Skip to content

@salesforce/b2c-tooling-sdk / config / ConfigSourceRegistry

Class: ConfigSourceRegistry

Defined in: packages/b2c-tooling-sdk/src/config/config-source-registry.ts:57

Registry for configuration sources.

The registry collects ConfigSource instances and makes them available to resolveConfig, which automatically includes globally registered sources in every resolution. Sources are sorted by priority alongside default and explicitly-passed sources.

Usage Modes

SDK Mode: Register sources directly via register():

typescript
globalConfigSourceRegistry.register(mySource);

CLI Mode: Sources are collected via the b2c:config-sources hook and registered during command initialization.

Constructors

Constructor

new ConfigSourceRegistry(): ConfigSourceRegistry

Returns

ConfigSourceRegistry

Accessors

size

Get Signature

get size(): number

Defined in: packages/b2c-tooling-sdk/src/config/config-source-registry.ts:112

Returns the number of registered sources.

Returns

number

Methods

clear()

clear(): void

Defined in: packages/b2c-tooling-sdk/src/config/config-source-registry.ts:105

Clears all registered sources.

Primarily useful for testing.

Returns

void


getSourceNames()

getSourceNames(): string[]

Defined in: packages/b2c-tooling-sdk/src/config/config-source-registry.ts:119

Returns the names of all registered sources.

Returns

string[]


getSources()

getSources(): ConfigSource[]

Defined in: packages/b2c-tooling-sdk/src/config/config-source-registry.ts:96

Returns all registered sources.

Returns a shallow copy to prevent external mutation of the registry.

Returns

ConfigSource[]

Array of registered config sources


register()

register(source): void

Defined in: packages/b2c-tooling-sdk/src/config/config-source-registry.ts:69

Registers a config source.

Sources participate in priority sorting alongside default sources when resolveConfig is called. Set the source's priority property to control ordering (lower number = higher priority).

Parameters

source

ConfigSource

The config source to register

Returns

void


unregister()

unregister(name): boolean

Defined in: packages/b2c-tooling-sdk/src/config/config-source-registry.ts:80

Unregisters a config source by name.

Parameters

name

string

The name of the source to remove

Returns

boolean

true if a source was removed, false if not found

Released under the Apache-2.0 License.