@growy/strapi-plugin-encrypted-field 1.7.2 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growy/strapi-plugin-encrypted-field",
3
- "version": "1.7.2",
3
+ "version": "1.8.0",
4
4
  "description": "Campo personalizado de texto cifrado para Strapi",
5
5
  "strapi": {
6
6
  "name": "encrypted-field",
@@ -2,13 +2,27 @@ const { encrypt, decrypt, validateValue, isEncryptedField } = require('./utils/c
2
2
 
3
3
  module.exports = ({ strapi }) => {
4
4
 
5
- const models = Object.values(strapi.contentTypes);
5
+ // Obtener tanto content types como componentes
6
+ const contentTypes = Object.values(strapi.contentTypes);
7
+ const components = Object.values(strapi.components);
8
+ const allModels = [...contentTypes, ...components];
6
9
 
7
- strapi.log.info(`Total de modelos encontrados: ${models.length}`);
10
+ strapi.log.info(`Total de content types: ${contentTypes.length}, componentes: ${components.length}`);
8
11
 
9
- models.forEach((model) => {
10
- const encryptedFields = Object.entries(model.attributes || {})
11
- .filter(([key, attr]) => isEncryptedField(attr))
12
+ allModels.forEach((model) => {
13
+ const attributes = model.attributes || {};
14
+
15
+ // Debug: mostrar todos los campos del modelo
16
+ strapi.log.debug(`Modelo ${model.uid}: ${Object.keys(attributes).length} atributos`);
17
+
18
+ const encryptedFields = Object.entries(attributes)
19
+ .filter(([key, attr]) => {
20
+ const isEncrypted = isEncryptedField(attr);
21
+ if (attr.customField) {
22
+ strapi.log.debug(` - ${key}: customField = ${attr.customField}, isEncrypted = ${isEncrypted}`);
23
+ }
24
+ return isEncrypted;
25
+ })
12
26
  .map(([key]) => key);
13
27
 
14
28
  if (encryptedFields.length === 0) return;