UNPKG

passbolt-styleguide

Version:

Passbolt styleguide contains common styling assets used by the different sites, plugin, etc.

62 lines (56 loc) 2.17 kB
/** * 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 4.10.0 */ import { TEST_RESOURCE_TYPE_PASSWORD_AND_DESCRIPTION } from "../../resourceType/resourceTypeEntity.test.data"; import { defaultIconDto } from "./iconEntity.test.data"; import { defaultCustomFieldsCollection } from "../../customField/customFieldsCollection.test.data"; import ResourceMetadataEntity from "./resourceMetadataEntity"; /** * Build minimal resource metadata dto. * @param {object} data The data to override the default dto. * @returns {object} */ export const minimalResourceMetadataDto = (data = {}) => { const metadataDto = { name: "Passbolt", resource_type_id: data?.resource_type_id || TEST_RESOURCE_TYPE_PASSWORD_AND_DESCRIPTION, ...data, }; return metadataDto; }; /** * Build default resource metadata dto. * @param {object} data The data to override the default dto. * @param {object} [options] * @param {object} [options.withIcon] * @param {object} [options.withCustomFields] * @returns {object} */ export const defaultResourceMetadataDto = (data = {}, options = {}) => { const metadataDto = { object_type: ResourceMetadataEntity.METADATA_OBJECT_TYPE, resource_type_id: data?.resource_type_id || TEST_RESOURCE_TYPE_PASSWORD_AND_DESCRIPTION, name: "Passbolt", username: "admin@passbolt.com", uris: ["https://passbolt.com"], description: "Description", ...data, }; if (options?.withIcon && !data.icon) { metadataDto.icon = defaultIconDto(); } if (options?.withCustomFields && !data.custom_fields) { metadataDto.custom_fields = defaultCustomFieldsCollection(); } return metadataDto; };