passbolt-styleguide
Version:
Passbolt styleguide contains common styling assets used by the different sites, plugin, etc.
37 lines (34 loc) • 1.44 kB
JavaScript
/**
* Passbolt ~ Open source password manager for teams
* Copyright (c) Passbolt SA (https://www.passbolt.com)
*
* Licensed under GNU Affero General Public License version 3 of the or any later version.
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Passbolt SA (https://www.passbolt.com)
* @license https://opensource.org/licenses/AGPL-3.0 AGPL License
* @link https://www.passbolt.com Passbolt(tm)
* @since 5.7.0
*/
import { v4 as uuidv4 } from "uuid";
import { defaultSecretRevisionDto } from "./secretRevisionEntity.test.data";
/**
* Default resource secret revisions dtos
* @param {object} data
* @param {object} options
* @param {object} [options.count = 10] if count, set the number of item`
* @param {object} [options.withSecrets = false] if true, set the secrets with `readSecret()`
* @param {object} [options.withCreator = false] if true, set the creator field with a user dto
* @returns {*[]}
*/
export const defaultResourceSecretRevisionsDtos = (data = {}, options = {}) => {
const count = options?.count || 10;
data.resource_id = data.resource_id || uuidv4(); // Validate same user id build rules
const dtos = [];
for (let i = 0; i < count; i++) {
const dto = defaultSecretRevisionDto(data, options);
dtos.push(dto);
}
return dtos;
};