1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-09-01 13:47:27 +02:00

Use key deletion from client application store

This commit is contained in:
Thomas Heartman 2025-07-16 13:19:19 +02:00
parent fb9ff7b210
commit 2e0a05d078

View File

@ -32,15 +32,26 @@ const mapRow = (row): IClientInstance => ({
environment: row.environment,
});
const mapToDb = (client: INewClientInstance) => ({
app_name: client.appName,
instance_id: client.instanceId,
sdk_version: client.sdkVersion || '',
sdk_type: client.sdkType,
client_ip: client.clientIp,
last_seen: client.lastSeen || 'now()',
environment: client.environment || 'default',
});
const mapToDb = (client: INewClientInstance) => {
const initialMap = {
app_name: client.appName,
instance_id: client.instanceId,
sdk_version: client.sdkVersion,
sdk_type: client.sdkType,
client_ip: client.clientIp,
last_seen: client.lastSeen || 'now()',
environment: client.environment,
};
Object.keys(initialMap).forEach((k) => {
if (initialMap[k] === undefined) {
// not using !temp[k] to allow false and null values to get through
delete initialMap[k];
}
});
return initialMap;
};
export default class ClientInstanceStore implements IClientInstanceStore {
private db: Db;