Get configuration data for a key.
Retrieves the configuration value stored under the specified key.
Returns the stored data, or undefined if the key doesn't exist.
Use the type parameter <T> to specify the expected type of the configuration
data for type safety. The repository does not validate types at runtime.
The stored configuration data, or undefined if not found
May throw if the stored data cannot be deserialized
// Get view configuration
const repo = platform.get(PlatformServiceName.ConfigRepository);
const cardConfig = repo.get('webclient_view.company').card;
Name of the configuration key to retrieve
Check if a configuration key exists.
Returns true if configuration data has been stored under the specified key,
false otherwise. Use this to check for the existence of optional configuration
before attempting to retrieve it.
true if the configuration exists, false otherwise
// Check before loading view config
const repo = platform.get(PlatformServiceName.ConfigRepository);
if (repo.has('person_table_columns')) {
const columns = repo.get('person_table_columns');
renderTable(columns);
} else {
// Use default columns
renderTable(defaultColumns);
}
Name of the configuration key to check
Save configuration data under a key.
Important: This method requires admin privileges. The backend endpoint is protected and will reject requests from non-admin users.
Stores the provided data persistently under the specified key. If the key already exists, its value is overwritten. The data is serialized and saved to the database, making it available to all users across the application.
After saving, the repository state is updated, triggering any subscriptions. The data can be any serializable JavaScript value (objects, arrays, primitives).
Promise that resolves when the data is saved
Error if save fails, data cannot be serialized, or user lacks admin privileges
// Admin: Set plugin configuration
const repo = platform.get(PlatformServiceName.ConfigRepository);
const pluginConfig: PluginConfiguration = {
enabled: true,
apiEndpoint: 'https://api.example.com',
settings: {
timeout: 5000,
retries: 3
}
};
await repo.set('my_plugin_config', pluginConfig);
Name of the configuration key to set
Configuration data to store (must be serializable)
Subscribe to state changes with optional transformation and filtering.
The subscription will immediately invoke the callback with the current state (if any), then continue to call it whenever the state changes. The map and filter options allow you to transform and selectively receive updates.
Unsubscribe function - call this to stop receiving updates
// Basic subscription
const unsubscribe = repository.subscribe((state) => {
console.log('State updated:', state);
});
// With transformations
const unsubscribe = repository.subscribe(
(userName) => console.log('User:', userName),
{ map: [(state) => state.user?.name] }
);
Function called with state updates (after map/filter applied)
Rest ...args: unknown[]Optional options: StateOptionsOptional transformations and filters for the subscription
Subscribe to state changes with optional transformation and filtering.
The subscription will immediately invoke the callback with the current state (if any), then continue to call it whenever the state changes. The map and filter options allow you to transform and selectively receive updates.
Unsubscribe function - call this to stop receiving updates
// Basic subscription
const unsubscribe = repository.subscribe((state) => {
console.log('State updated:', state);
});
// With transformations
const unsubscribe = repository.subscribe(
(userName) => console.log('User:', userName),
{ map: [(state) => state.user?.name] }
);
Repository for storing and retrieving application-wide configuration data.
ConfigRepository provides persistent key-value storage for configuration that applies to all users across the application. Typical use cases include:
Each plugin or package typically manages its own configuration namespace, storing settings that define how components should be rendered or behave for all users.
Important: This repository is NOT for user preferences. User-specific settings should use UserPreferencesRepository instead.
Configuration data is:
The repository extends StateRepository, providing reactive state management with automatic UI updates when configuration changes.
Access the repository through the platform service:
Example
Read view configuration
Example
Read plugin configuration with type safety
See
StateRepository for subscription patterns