use object as param in refresh function
Signed-off-by: Kiss Miklos <miklos@roadie.io>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-catalog-node': minor
|
||||
---
|
||||
|
||||
Added refresh function to the `EntityProviderConnection` to be able to schedule refreshes from entity providers.
|
||||
@@ -2,4 +2,4 @@
|
||||
'@backstage/plugin-catalog-backend': minor
|
||||
---
|
||||
|
||||
Added refresh function to the EntityProviderConnection to be able to schedule refreshes from entity providers.
|
||||
Added the `refresh` function to the Connection of the entity providers.
|
||||
|
||||
@@ -22,6 +22,7 @@ import { ProcessingDatabase } from '../database/types';
|
||||
import {
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
EntityProviderRefreshOptions,
|
||||
EntityProviderMutation,
|
||||
} from '@backstage/plugin-catalog-node';
|
||||
|
||||
@@ -61,12 +62,12 @@ class Connection implements EntityProviderConnection {
|
||||
}
|
||||
}
|
||||
|
||||
async refresh(keys: string[]): Promise<void> {
|
||||
async refresh(options: EntityProviderRefreshOptions): Promise<void> {
|
||||
const db = this.config.processingDatabase;
|
||||
|
||||
await db.transaction(async (tx: any) => {
|
||||
return db.refreshByRefreshKeys(tx, {
|
||||
keys,
|
||||
keys: options.keys,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ export interface EntityProvider {
|
||||
// @public
|
||||
export interface EntityProviderConnection {
|
||||
applyMutation(mutation: EntityProviderMutation): Promise<void>;
|
||||
refresh(keys: string[]): Promise<void>;
|
||||
refresh(options: EntityProviderRefreshOptions): Promise<void>;
|
||||
}
|
||||
|
||||
// @public
|
||||
@@ -141,6 +141,11 @@ export type EntityProviderMutation =
|
||||
removed: DeferredEntity[];
|
||||
};
|
||||
|
||||
// @public (undocumented)
|
||||
export type EntityProviderRefreshOptions = {
|
||||
keys: string[];
|
||||
};
|
||||
|
||||
// @public
|
||||
export type EntityRelationSpec = {
|
||||
source: CompoundEntityRef;
|
||||
|
||||
@@ -32,4 +32,5 @@ export type {
|
||||
EntityProvider,
|
||||
EntityProviderConnection,
|
||||
EntityProviderMutation,
|
||||
EntityProviderRefreshOptions,
|
||||
} from './provider';
|
||||
|
||||
@@ -26,6 +26,13 @@ export type EntityProviderMutation =
|
||||
| { type: 'full'; entities: DeferredEntity[] }
|
||||
| { type: 'delta'; added: DeferredEntity[]; removed: DeferredEntity[] };
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export type EntityProviderRefreshOptions = {
|
||||
keys: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
* The EntityProviderConnection is the connection between the catalog and the entity provider.
|
||||
* The EntityProvider use this connection to add and remove entities from the catalog.
|
||||
@@ -40,7 +47,7 @@ export interface EntityProviderConnection {
|
||||
/**
|
||||
* Schedules a refresh on all of the entities that has a matching refresh key associated with the provided keys.
|
||||
*/
|
||||
refresh(keys: string[]): Promise<void>;
|
||||
refresh(options: EntityProviderRefreshOptions): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user