@growy/strapi-plugin-encrypted-field 1.7.3 → 1.8.1

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.3",
3
+ "version": "1.8.1",
4
4
  "description": "Campo personalizado de texto cifrado para Strapi",
5
5
  "strapi": {
6
6
  "name": "encrypted-field",
@@ -2,11 +2,14 @@ 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) => {
12
+ allModels.forEach((model) => {
10
13
  const attributes = model.attributes || {};
11
14
 
12
15
  // Debug: mostrar todos los campos del modelo
@@ -110,8 +113,9 @@ module.exports = ({ strapi }) => {
110
113
  if (Object.prototype.hasOwnProperty.call(result, key)) {
111
114
  const value = result[key];
112
115
  if (typeof value === 'string' && value) {
113
- strapi.log.info(`Descifrando campo ${key} en ${event.model.uid}`);
114
- result[key] = decrypt(value, strapi);
116
+ const decrypted = decrypt(value, strapi);
117
+ strapi.log.info(`Descifrando campo ${key} en ${event.model.uid}: ${value.substring(0, 20)}... -> ${decrypted}`);
118
+ result[key] = decrypted;
115
119
  }
116
120
  }
117
121
  }
@@ -132,7 +136,9 @@ module.exports = ({ strapi }) => {
132
136
  if (Object.prototype.hasOwnProperty.call(item, key)) {
133
137
  const value = item[key];
134
138
  if (typeof value === 'string' && value) {
135
- item[key] = decrypt(value, strapi);
139
+ const decrypted = decrypt(value, strapi);
140
+ strapi.log.info(`Descifrando campo ${key}: ${value.substring(0, 20)}... -> ${decrypted}`);
141
+ item[key] = decrypted;
136
142
  }
137
143
  }
138
144
  }