Delete a filter from the database.
Permanently removes the specified filter. This operation cannot be undone.
Promise that resolves when the filter is deleted
Error if deletion fails due to permissions or other issues
const repo = platform.get(PlatformServiceName.FilterRepository);
await repo.delete(filter);
Save a filter definition to the database.
Creates a new filter or updates an existing one. The filter will be stored persistently and become available for use in queries and filter expressions.
If a filter with the same id already exists, it will be updated with the
new values. Otherwise, a new filter is created.
Promise that resolves when the filter is saved
Error if save fails due to validation or permission issues
const repo = platform.get(PlatformServiceName.FilterRepository);
const filter: Filter = {
id: 'my_deals',
limetype: 'deal',
name: { 'en': 'My Deals' },
filter: { key: 'owner', op: Operator.EQUALS, exp: currentUserId }
};
await repo.save(filter);
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 managing saved filter definitions.
FilterRepository provides methods to create, update, and delete Filter definitions. Filters are named, reusable query expressions that can be applied to limetypes to define subsets of objects (e.g., "My Active Deals", "High Priority Tickets").
Filters can be:
iduseris set)The repository extends StateRepository, enabling:
Example
Basic usage
See