@roit/roit-data-firestore 1.2.39 → 1.2.41

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.
@@ -9,7 +9,6 @@ export declare class ArchiveService {
9
9
  private projectId;
10
10
  private firestore;
11
11
  private isInitialized;
12
- private isDebug;
13
12
  /**
14
13
  * Construtor privado para prevenir instanciação direta
15
14
  */
@@ -22,15 +22,6 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
25
  Object.defineProperty(exports, "__esModule", { value: true });
35
26
  exports.ArchiveService = void 0;
36
27
  const storage_1 = require("@google-cloud/storage");
@@ -46,65 +37,63 @@ class ArchiveService {
46
37
  */
47
38
  constructor() {
48
39
  this.isInitialized = false;
49
- this.isDebug = Boolean(ArchiveConfig_1.ArchiveConfig.getConfig().debug);
50
40
  // Construtor vazio - inicialização será feita em initialize()
51
41
  }
52
- static getInstance() {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- // Se existe uma instância, retorna ela
55
- if (ArchiveService.instance && ArchiveService.instance.isInitialized) {
56
- return ArchiveService.instance;
57
- }
58
- // Se está inicializando, aguarda
59
- if (ArchiveService.isInitializing) {
60
- yield ArchiveService.lock;
61
- return ArchiveService.instance;
62
- }
63
- // Inicializa a instância
64
- ArchiveService.isInitializing = true;
65
- try {
66
- if (!ArchiveService.instance) {
67
- ArchiveService.instance = new ArchiveService();
68
- }
69
- yield ArchiveService.instance.initialize();
70
- return ArchiveService.instance;
71
- }
72
- finally {
73
- ArchiveService.isInitializing = false;
74
- }
75
- });
42
+ static async getInstance() {
43
+ // Se existe uma instância, retorna ela
44
+ if (ArchiveService.instance && ArchiveService.instance.isInitialized) {
45
+ return ArchiveService.instance;
46
+ }
47
+ // Se está inicializando, aguarda
48
+ if (ArchiveService.isInitializing) {
49
+ await ArchiveService.lock;
50
+ return ArchiveService.instance;
51
+ }
52
+ // Inicializa a instância
53
+ ArchiveService.isInitializing = true;
54
+ try {
55
+ if (!ArchiveService.instance) {
56
+ ArchiveService.instance = new ArchiveService();
57
+ }
58
+ await ArchiveService.instance.initialize();
59
+ return ArchiveService.instance;
60
+ }
61
+ finally {
62
+ ArchiveService.isInitializing = false;
63
+ }
76
64
  }
77
- initialize() {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- if (this.isInitialized) {
80
- return;
81
- }
82
- this.config = ArchiveConfig_1.ArchiveConfig.getConfig();
83
- this.cacheResolver = CacheResolver_1.CacheResolver.getInstance();
84
- this.projectId = this.config.projectId;
85
- if (this.isDebug) {
86
- console.log(`[ARCHIVE SERVICE] Configuração: ${JSON.stringify(this.config)}`);
87
- }
88
- if (!this.firestore) {
89
- this.firestore = new firestore_1.Firestore({
90
- projectId: 'roit-intern-infra'
91
- });
92
- }
93
- // REGISTRAR O ARCHIVESERVICE COMO REPOSITORY
94
- this.cacheResolver.addRepository('ArchiveService', {
95
- cacheExpiresInSeconds: 3600,
96
- cacheProvider: CacheProviders_1.CacheProviders.REDIS_ARCHIVE
65
+ async initialize() {
66
+ if (this.isInitialized) {
67
+ return;
68
+ }
69
+ this.config = ArchiveConfig_1.ArchiveConfig.getConfig();
70
+ this.cacheResolver = CacheResolver_1.CacheResolver.getInstance();
71
+ this.projectId = this.config.projectId;
72
+ (0, ArchiveConfig_1.onDebugLog)(`Configuração: ${JSON.stringify(this.config)}`);
73
+ if (!this.firestore) {
74
+ this.firestore = new firestore_1.Firestore({
75
+ projectId: 'roit-intern-infra'
97
76
  });
98
- if (!this.config.enabled) {
99
- console.log('ArchiveService: Arquivamento desabilitado');
100
- return;
101
- }
77
+ }
78
+ // REGISTRAR O ARCHIVESERVICE COMO REPOSITORY
79
+ this.cacheResolver.addRepository('ArchiveService', {
80
+ cacheExpiresInSeconds: 3600,
81
+ cacheProvider: CacheProviders_1.CacheProviders.REDIS_ARCHIVE
82
+ });
83
+ if (!this.config.enabled) {
84
+ (0, ArchiveConfig_1.onDebugLog)('Arquivamento desabilitado');
85
+ return;
86
+ }
87
+ else {
102
88
  this.storage = new storage_1.Storage();
103
89
  this.bucketName = this.config.bucketName;
104
90
  if (!this.bucketName) {
105
- console.warn('ArchiveService: bucket_name não configurado');
91
+ (0, ArchiveConfig_1.onDebugWarn)('ArchiveService: bucket_name não configurado');
106
92
  }
107
- });
93
+ else {
94
+ (0, ArchiveConfig_1.onDebugLog)(`Bucket configurado: ${this.bucketName}`);
95
+ }
96
+ }
108
97
  }
109
98
  static resetInstance() {
110
99
  ArchiveService.instance = null;
@@ -125,100 +114,88 @@ class ArchiveService {
125
114
  }
126
115
  return documentData && documentData.fbArchivedAt;
127
116
  }
128
- pipeline(readStream, gunzip, writable) {
129
- return __awaiter(this, void 0, void 0, function* () {
130
- return new Promise((resolve, reject) => {
131
- readStream.pipe(gunzip).pipe(writable);
132
- writable.on('finish', resolve);
133
- writable.on('error', reject);
134
- });
117
+ async pipeline(readStream, gunzip, writable) {
118
+ return new Promise((resolve, reject) => {
119
+ readStream.pipe(gunzip).pipe(writable);
120
+ writable.on('finish', resolve);
121
+ writable.on('error', reject);
135
122
  });
136
123
  }
137
124
  /**
138
125
  * Recupera documento arquivado em formato JSON
139
126
  */
140
- retrieveJsonDocument(collectionName, docId) {
141
- return __awaiter(this, void 0, void 0, function* () {
142
- try {
143
- const filePath = `${this.projectId}/${collectionName}/${docId}.json.gz`;
144
- const bucket = this.storage.bucket(this.bucketName);
145
- const file = bucket.file(filePath);
146
- const [exists] = yield file.exists();
147
- if (!exists) {
148
- return null;
149
- }
150
- const readStream = file.createReadStream();
151
- const gunzip = zlib.createGunzip();
152
- const chunks = [];
153
- yield this.pipeline(readStream, gunzip, new stream_1.Writable({
154
- write(chunk, _enc, cb) {
155
- chunks.push(chunk);
156
- cb();
157
- }
158
- }));
159
- const result = Buffer.concat(chunks).toString('utf-8');
160
- return JSON.parse(result);
161
- }
162
- catch (error) {
163
- console.warn(`Erro ao recuperar documento JSON arquivado ${collectionName}/${docId}:`, error);
127
+ async retrieveJsonDocument(collectionName, docId) {
128
+ try {
129
+ const filePath = `${this.projectId}/${collectionName}/${docId}.json.gz`;
130
+ const bucket = this.storage.bucket(this.bucketName);
131
+ const file = bucket.file(filePath);
132
+ const [exists] = await file.exists();
133
+ if (!exists) {
164
134
  return null;
165
135
  }
166
- });
136
+ const readStream = file.createReadStream();
137
+ const gunzip = zlib.createGunzip();
138
+ const chunks = [];
139
+ await this.pipeline(readStream, gunzip, new stream_1.Writable({
140
+ write(chunk, _enc, cb) {
141
+ chunks.push(chunk);
142
+ cb();
143
+ }
144
+ }));
145
+ const result = Buffer.concat(chunks).toString('utf-8');
146
+ return JSON.parse(result);
147
+ }
148
+ catch (error) {
149
+ console.log(`${ArchiveConfig_1.DEBUG_PREFIX} Erro ao recuperar documento JSON arquivado ${collectionName}/${docId}:`, error);
150
+ return null;
151
+ }
167
152
  }
168
153
  /**
169
154
  * Verifica se um documento está arquivado e recupera seus dados completos
170
155
  */
171
- getArchivedDocument(collectionName, doc) {
172
- return __awaiter(this, void 0, void 0, function* () {
173
- if (!this.isEnabled()) {
174
- return null;
175
- }
176
- if (!this.bucketName) {
177
- console.warn('ArchiveService: bucket_name não configurado, não é possível recuperar documentos arquivados');
178
- return null;
179
- }
180
- const docId = doc.id;
181
- // Verificar cache se habilitado
182
- if (this.config.cache.enabled) {
183
- const cacheKey = `archived_${collectionName}_${docId}`;
184
- const cachedData = yield this.cacheResolver.getCacheResult('ArchiveService', 'getArchivedDocument', cacheKey);
185
- if (cachedData) {
186
- if (this.isDebug) {
187
- console.log(`Cache hit para documento arquivado: ${collectionName}/${docId}`);
188
- }
189
- return cachedData;
190
- }
156
+ async getArchivedDocument(collectionName, doc) {
157
+ if (!this.isEnabled()) {
158
+ return null;
159
+ }
160
+ if (!this.bucketName) {
161
+ console.warn(`${ArchiveConfig_1.DEBUG_PREFIX} ArchiveService: bucket_name não configurado, não é possível recuperar documentos arquivados`);
162
+ return null;
163
+ }
164
+ const docId = doc.id;
165
+ // Verificar cache se habilitado
166
+ if (this.config.cache.enabled) {
167
+ const cacheKey = `archived_${collectionName}_${docId}`;
168
+ const cachedData = await this.cacheResolver.getCacheResult('ArchiveService', 'getArchivedDocument', cacheKey);
169
+ if (cachedData) {
170
+ (0, ArchiveConfig_1.onDebugLog)(`Cache hit para documento arquivado: ${collectionName}/${docId}`);
171
+ return cachedData;
191
172
  }
192
- try {
193
- const archivedData = yield this.retrieveJsonDocument(collectionName, docId);
194
- if (archivedData) {
195
- // Salvar no cache se habilitado
196
- if (this.config.cache.enabled) {
197
- const cacheKey = `archived_${collectionName}_${docId}`;
198
- yield this.cacheResolver.cacheResult('ArchiveService', 'getArchivedDocument', archivedData, cacheKey);
199
- if (this.isDebug) {
200
- console.log(`Documento arquivado cacheado: ${collectionName}/${docId}`);
201
- }
202
- }
203
- return archivedData;
173
+ }
174
+ try {
175
+ const archivedData = await this.retrieveJsonDocument(collectionName, docId);
176
+ if (archivedData) {
177
+ // Salvar no cache se habilitado
178
+ if (this.config.cache.enabled) {
179
+ const cacheKey = `archived_${collectionName}_${docId}`;
180
+ await this.cacheResolver.cacheResult('ArchiveService', 'getArchivedDocument', archivedData, cacheKey);
181
+ (0, ArchiveConfig_1.onDebugLog)(`Documento arquivado cacheado: ${collectionName}/${docId}`);
204
182
  }
183
+ return archivedData;
205
184
  }
206
- catch (error) {
207
- console.warn(`Erro ao recuperar documento arquivado ${collectionName}/${docId}:`, error);
208
- }
209
- return null;
210
- });
185
+ }
186
+ catch (error) {
187
+ console.warn(`${ArchiveConfig_1.DEBUG_PREFIX} Erro ao recuperar documento arquivado ${collectionName}/${docId}:`, error);
188
+ }
189
+ return null;
211
190
  }
212
191
  /**
213
192
  * Limpa o cache de documentos arquivados
214
193
  */
215
- clearArchivedCache(collectionName, docId) {
216
- return __awaiter(this, void 0, void 0, function* () {
217
- if (!this.config.cache.enabled) {
218
- return;
219
- }
220
- yield this.cacheResolver.revokeArchiveCache(collectionName, docId);
221
- });
194
+ async clearArchivedCache(collectionName, docId) {
195
+ if (!this.config.cache.enabled) {
196
+ return;
197
+ }
198
+ await this.cacheResolver.revokeArchiveCache(collectionName, docId);
222
199
  }
223
200
  }
224
201
  exports.ArchiveService = ArchiveService;
@@ -1,13 +1,4 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
3
  exports.CacheResolver = void 0;
13
4
  const CacheableOptions_1 = require("../model/CacheableOptions");
@@ -15,10 +6,10 @@ const providers_1 = require("./providers");
15
6
  const RedisCacheProvider_1 = require("./providers/RedisCacheProvider");
16
7
  const CacheProviders_1 = require("../model/CacheProviders");
17
8
  const CurrentEnv_1 = require("../util/CurrentEnv");
18
- const IsDebug_1 = require("../util/IsDebug");
19
9
  const QueryPredicateFunctionTransform_1 = require("../query/QueryPredicateFunctionTransform");
20
10
  const RedisCacheArchiveProvider_1 = require("./providers/RedisCacheArchiveProvider");
21
11
  const ArchiveConfig_1 = require("../config/ArchiveConfig");
12
+ const IsDebug_1 = require("../util/IsDebug");
22
13
  class CacheResolver {
23
14
  constructor() {
24
15
  this.repositorys = new Map;
@@ -43,112 +34,97 @@ class CacheResolver {
43
34
  buildRepositoryKey(repositoryClassName) {
44
35
  return `${CurrentEnv_1.currentEnv}:${repositoryClassName}`;
45
36
  }
46
- getCacheResult(repositoryClassName, methodSignature, ...paramValue) {
47
- return __awaiter(this, void 0, void 0, function* () {
48
- if (!this.repositorys.get(repositoryClassName)) {
49
- return null;
50
- }
51
- const key = this.buildKey(repositoryClassName, methodSignature, paramValue);
52
- return this.cacheProvider.getCacheResult(key);
53
- });
37
+ async getCacheResult(repositoryClassName, methodSignature, ...paramValue) {
38
+ if (!this.repositorys.get(repositoryClassName)) {
39
+ return null;
40
+ }
41
+ const key = this.buildKey(repositoryClassName, methodSignature, paramValue);
42
+ return this.cacheProvider.getCacheResult(key);
54
43
  }
55
- revokeCacheFromRepository(repositoryClassName) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- const key = this.buildRepositoryKey(repositoryClassName);
58
- if (!this.repositorys.get(repositoryClassName)) {
59
- return;
60
- }
61
- const keys = yield this.cacheProvider.getKeys(`${key}`);
62
- if (keys && Array.isArray(keys)) {
63
- for (const key of keys) {
64
- if (IsDebug_1.isDebug) {
65
- console.debug('[DEBUG] Caching >', `Removing key: ${key}`);
66
- }
67
- yield this.cacheProvider.delete(key);
44
+ async revokeCacheFromRepository(repositoryClassName) {
45
+ const key = this.buildRepositoryKey(repositoryClassName);
46
+ if (!this.repositorys.get(repositoryClassName)) {
47
+ return;
48
+ }
49
+ const keys = await this.cacheProvider.getKeys(`${key}`);
50
+ if (keys && Array.isArray(keys)) {
51
+ for (const key of keys) {
52
+ if (IsDebug_1.isDebug) {
53
+ console.debug('[DEBUG] Caching >', `Removing key: ${key}`);
68
54
  }
55
+ await this.cacheProvider.delete(key);
69
56
  }
70
- yield this.cacheProvider.delete(key);
71
- // REVOGAR CACHE DO ARCHIVE PARA A MESMA COLLECTION
72
- yield this.revokeArchiveCacheForRepository(repositoryClassName);
73
- });
57
+ }
58
+ await this.cacheProvider.delete(key);
59
+ // REVOGAR CACHE DO ARCHIVE PARA A MESMA COLLECTION
60
+ await this.revokeArchiveCacheForRepository(repositoryClassName);
74
61
  }
75
- cacheResult(repositoryClassName, methodSignature, valueToCache, ...paramValue) {
76
- var _a, _b, _c;
77
- return __awaiter(this, void 0, void 0, function* () {
78
- const option = this.repositorys.get(repositoryClassName);
79
- if (option) {
80
- const key = this.buildKey(repositoryClassName, methodSignature, paramValue);
81
- const excludesMethod = Array.isArray(option === null || option === void 0 ? void 0 : option.excludesMethods) && ((_a = option === null || option === void 0 ? void 0 : option.excludesMethods) === null || _a === void 0 ? void 0 : _a.find(me => me == methodSignature));
82
- const notIncludeOnlyMethod = Array.isArray(option === null || option === void 0 ? void 0 : option.includeOnlyMethods) && ((_b = option === null || option === void 0 ? void 0 : option.includeOnlyMethods) === null || _b === void 0 ? void 0 : _b.length) > 0 && ((_c = option === null || option === void 0 ? void 0 : option.includeOnlyMethods) === null || _c === void 0 ? void 0 : _c.find(me => me == methodSignature)) == undefined;
83
- const notContainResult = (option === null || option === void 0 ? void 0 : option.cacheOnlyContainResults) ? ((Array.isArray(valueToCache) && valueToCache.length == 0) || !valueToCache) : false;
84
- if (excludesMethod || notIncludeOnlyMethod || notContainResult) {
85
- return false;
86
- }
87
- yield this.cacheProvider.saveCacheResult(key, valueToCache, option.cacheExpiresInSeconds);
88
- return true;
62
+ async cacheResult(repositoryClassName, methodSignature, valueToCache, ...paramValue) {
63
+ const option = this.repositorys.get(repositoryClassName);
64
+ if (option) {
65
+ const key = this.buildKey(repositoryClassName, methodSignature, paramValue);
66
+ const excludesMethod = Array.isArray(option?.excludesMethods) && option?.excludesMethods?.find(me => me == methodSignature);
67
+ const notIncludeOnlyMethod = Array.isArray(option?.includeOnlyMethods) && option?.includeOnlyMethods?.length > 0 && option?.includeOnlyMethods?.find(me => me == methodSignature) == undefined;
68
+ const notContainResult = option?.cacheOnlyContainResults ? ((Array.isArray(valueToCache) && valueToCache.length == 0) || !valueToCache) : false;
69
+ if (excludesMethod || notIncludeOnlyMethod || notContainResult) {
70
+ return false;
89
71
  }
90
- return false;
91
- });
72
+ await this.cacheProvider.saveCacheResult(key, valueToCache, option.cacheExpiresInSeconds);
73
+ return true;
74
+ }
75
+ return false;
92
76
  }
93
- revokeArchiveCache(collectionName, docId) {
94
- return __awaiter(this, void 0, void 0, function* () {
95
- const repositoryKey = this.buildRepositoryKey('ArchiveService');
96
- if (!this.repositorys.get('ArchiveService')) {
97
- return;
77
+ async revokeArchiveCache(collectionName, docId) {
78
+ const repositoryKey = this.buildRepositoryKey('ArchiveService');
79
+ if (!this.repositorys.get('ArchiveService')) {
80
+ return;
81
+ }
82
+ const keys = await this.cacheProvider.getKeys(`${repositoryKey}`);
83
+ if (!keys || !Array.isArray(keys)) {
84
+ return;
85
+ }
86
+ for (const key of keys) {
87
+ let shouldDelete = false;
88
+ if (collectionName && docId) {
89
+ // Limpar cache de documento específico
90
+ const cacheKey = `archived_${collectionName}_${docId}`;
91
+ shouldDelete = key.includes(`getArchivedDocument:${cacheKey}`);
98
92
  }
99
- const keys = yield this.cacheProvider.getKeys(`${repositoryKey}`);
100
- if (!keys || !Array.isArray(keys)) {
101
- return;
93
+ else if (collectionName) {
94
+ // Limpar cache de collection específica
95
+ shouldDelete = key.includes(`getArchivedDocument:archived_${collectionName}`);
102
96
  }
103
- for (const key of keys) {
104
- let shouldDelete = false;
105
- if (collectionName && docId) {
106
- // Limpar cache de documento específico
107
- const cacheKey = `archived_${collectionName}_${docId}`;
108
- shouldDelete = key.includes(`getArchivedDocument:${cacheKey}`);
109
- }
110
- else if (collectionName) {
111
- // Limpar cache de collection específica
112
- shouldDelete = key.includes(`getArchivedDocument:archived_${collectionName}`);
113
- }
114
- else {
115
- // Limpar todo o cache de arquivamento
116
- shouldDelete = key.includes('getArchivedDocument');
117
- }
118
- if (shouldDelete) {
119
- if (Boolean(ArchiveConfig_1.ArchiveConfig.getConfig().debug)) {
120
- console.debug('[DEBUG] Archive Cache >', `Removing key: ${key}`);
121
- }
122
- yield this.cacheProvider.delete(key);
123
- }
124
- }
125
- });
126
- }
127
- revokeArchiveCacheForRepository(repositoryClassName) {
128
- return __awaiter(this, void 0, void 0, function* () {
129
- // Verificar se ArchiveService está registrado
130
- if (!this.repositorys.get('ArchiveService')) {
131
- return;
97
+ else {
98
+ // Limpar todo o cache de arquivamento
99
+ shouldDelete = key.includes('getArchivedDocument');
132
100
  }
133
- // Obter a collection do repositório que está sendo revogado
134
- const repositoryOptions = QueryPredicateFunctionTransform_1.QueryPredicateFunctionTransform.classConfig.get(repositoryClassName);
135
- if (!repositoryOptions || !repositoryOptions.collection) {
136
- return;
101
+ if (shouldDelete) {
102
+ (0, ArchiveConfig_1.onDebugLog)(`Archive Cache > Removing key: ${key}`);
103
+ await this.cacheProvider.delete(key);
137
104
  }
138
- const collectionName = repositoryOptions.collection;
139
- // Revogar cache do archive para essa collection
140
- const archiveKeys = yield this.cacheProvider.getKeys(`${CurrentEnv_1.currentEnv}:ArchiveService`);
141
- if (archiveKeys && Array.isArray(archiveKeys)) {
142
- for (const key of archiveKeys) {
143
- if (key.includes(`getArchivedDocument:archived_${collectionName}`)) {
144
- if (Boolean(ArchiveConfig_1.ArchiveConfig.getConfig().debug)) {
145
- console.debug('[DEBUG] Archive Cache >', `Removing archive key: ${key}`);
146
- }
147
- yield this.cacheProvider.delete(key);
148
- }
105
+ }
106
+ }
107
+ async revokeArchiveCacheForRepository(repositoryClassName) {
108
+ // Verificar se ArchiveService está registrado
109
+ if (!this.repositorys.get('ArchiveService')) {
110
+ return;
111
+ }
112
+ // Obter a collection do repositório que está sendo revogado
113
+ const repositoryOptions = QueryPredicateFunctionTransform_1.QueryPredicateFunctionTransform.classConfig.get(repositoryClassName);
114
+ if (!repositoryOptions || !repositoryOptions.collection) {
115
+ return;
116
+ }
117
+ const collectionName = repositoryOptions.collection;
118
+ // Revogar cache do archive para essa collection
119
+ const archiveKeys = await this.cacheProvider.getKeys(`${CurrentEnv_1.currentEnv}:ArchiveService`);
120
+ if (archiveKeys && Array.isArray(archiveKeys)) {
121
+ for (const key of archiveKeys) {
122
+ if (key.includes(`getArchivedDocument:archived_${collectionName}`)) {
123
+ (0, ArchiveConfig_1.onDebugLog)(`Archive Cache > Removing archive key: ${key}`);
124
+ await this.cacheProvider.delete(key);
149
125
  }
150
126
  }
151
- });
127
+ }
152
128
  }
153
129
  }
154
130
  exports.CacheResolver = CacheResolver;
@@ -9,7 +9,6 @@ export declare class RedisCacheArchiveProvider implements CacheProvider {
9
9
  */
10
10
  private client;
11
11
  private isRedisReady;
12
- private isDebug;
13
12
  constructor();
14
13
  private handleTimeoutError;
15
14
  getKeys(query: string): Promise<string[]>;