feat: Extend collection of usage metrics during license renewal (no-changelog) (#8369)

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
Cornelius Suermann
2024-01-22 12:29:28 +01:00
committed by GitHub
parent ebf2b0d55c
commit d597c2ab29
9 changed files with 212 additions and 16 deletions

View File

@@ -18,6 +18,31 @@ async function encryptCredentialData(credential: CredentialsEntity) {
return coreCredential.getDataToSave() as ICredentialsDb;
}
const emptyAttributes = {
name: 'test',
type: 'test',
data: '',
nodesAccess: [],
};
export async function createManyCredentials(
amount: number,
attributes: Partial<CredentialsEntity> = emptyAttributes,
) {
return await Promise.all(
Array(amount)
.fill(0)
.map(async () => await createCredentials(attributes)),
);
}
export async function createCredentials(attributes: Partial<CredentialsEntity> = emptyAttributes) {
const credentialsRepository = Container.get(CredentialsRepository);
const entity = credentialsRepository.create(attributes);
return await credentialsRepository.save(entity);
}
/**
* Save a credential to the test DB, sharing it with a user.
*/