@pioneer-platform/pioneer-cache 1.1.11 → 1.1.12

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.
@@ -1 +1,2 @@
1
- $ tsc
1
+
2
+ $ tsc
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @pioneer-platform/pioneer-cache
2
2
 
3
+ ## 1.1.12
4
+
5
+ ### Patch Changes
6
+
7
+ - chore: fix: move @types/pdfkit to dependencies for Docker --production build
8
+ - Updated dependencies
9
+ - @pioneer-platform/redis-queue@8.12.2
10
+
3
11
  ## 1.1.11
4
12
 
5
13
  ### Patch Changes
@@ -227,7 +227,17 @@ class BalanceCache extends base_cache_1.BaseCache {
227
227
  const fetchPromises = items.map(async (item) => {
228
228
  try {
229
229
  // Use fetchFresh to get blockchain data and update cache
230
+ log.info(tag, `🔍 Fetching fresh ${item.caip}...`);
230
231
  const freshData = await this.fetchFresh({ caip: item.caip, pubkey: item.pubkey });
232
+ log.info(tag, `🔍 fetchFresh returned for ${item.caip}: caip=${freshData.caip}, balance=${freshData.balance}`);
233
+ // CRITICAL FIX: If fetchFresh returned defaultValue with empty CAIP (due to network init failure),
234
+ // restore the actual CAIP so the response isn't filtered out by the SDK
235
+ if (!freshData.caip || freshData.caip === '') {
236
+ log.warn(tag, `⚠️ RESTORING CAIP: fetchFresh returned empty CAIP for ${item.caip} (likely network init failed)`);
237
+ freshData.caip = item.caip;
238
+ freshData.pubkey = item.pubkey;
239
+ log.warn(tag, `⚠️ RESTORED CAIP: ${freshData.caip}`);
240
+ }
231
241
  return freshData;
232
242
  }
233
243
  catch (error) {
@@ -294,7 +304,17 @@ class BalanceCache extends base_cache_1.BaseCache {
294
304
  const fetchPromises = missedItems.map(async (item) => {
295
305
  try {
296
306
  // Use fetchFresh to ensure Redis is updated and requests are deduplicated
307
+ log.info(tag, `🔍 [CACHE MISS] Fetching fresh ${item.caip}...`);
297
308
  const freshData = await this.fetchFresh({ caip: item.caip, pubkey: item.pubkey });
309
+ log.info(tag, `🔍 [CACHE MISS] fetchFresh returned for ${item.caip}: caip='${freshData.caip}', balance=${freshData.balance}`);
310
+ // CRITICAL FIX: If fetchFresh returned defaultValue with empty CAIP (due to network init failure),
311
+ // restore the actual CAIP so the response isn't filtered out by the SDK
312
+ if (!freshData.caip || freshData.caip === '') {
313
+ log.warn(tag, `⚠️ [CACHE MISS] RESTORING CAIP: fetchFresh returned empty CAIP for ${item.caip} (likely network init failed)`);
314
+ freshData.caip = item.caip;
315
+ freshData.pubkey = item.pubkey;
316
+ log.warn(tag, `⚠️ [CACHE MISS] RESTORED CAIP: ${freshData.caip}`);
317
+ }
298
318
  results[item.index] = freshData;
299
319
  }
300
320
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pioneer-platform/pioneer-cache",
3
- "version": "1.1.11",
3
+ "version": "1.1.12",
4
4
  "description": "Unified caching system for Pioneer platform with Redis backend",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  "license": "MIT",
22
22
  "dependencies": {
23
23
  "@pioneer-platform/loggerdog": "^8.11.0",
24
- "@pioneer-platform/redis-queue": "^8.12.1",
24
+ "@pioneer-platform/redis-queue": "^8.12.2",
25
25
  "@pioneer-platform/default-redis": "^8.11.7"
26
26
  },
27
27
  "devDependencies": {
@@ -269,7 +269,19 @@ export class BalanceCache extends BaseCache<BalanceData> {
269
269
  const fetchPromises = items.map(async (item) => {
270
270
  try {
271
271
  // Use fetchFresh to get blockchain data and update cache
272
+ log.info(tag, `🔍 Fetching fresh ${item.caip}...`);
272
273
  const freshData = await this.fetchFresh({ caip: item.caip, pubkey: item.pubkey });
274
+ log.info(tag, `🔍 fetchFresh returned for ${item.caip}: caip=${freshData.caip}, balance=${freshData.balance}`);
275
+
276
+ // CRITICAL FIX: If fetchFresh returned defaultValue with empty CAIP (due to network init failure),
277
+ // restore the actual CAIP so the response isn't filtered out by the SDK
278
+ if (!freshData.caip || freshData.caip === '') {
279
+ log.warn(tag, `⚠️ RESTORING CAIP: fetchFresh returned empty CAIP for ${item.caip} (likely network init failed)`);
280
+ freshData.caip = item.caip;
281
+ freshData.pubkey = item.pubkey;
282
+ log.warn(tag, `⚠️ RESTORED CAIP: ${freshData.caip}`);
283
+ }
284
+
273
285
  return freshData;
274
286
  } catch (error) {
275
287
  log.error(tag, `Failed to fetch fresh ${item.caip}/${item.pubkey}:`, error);
@@ -346,7 +358,19 @@ export class BalanceCache extends BaseCache<BalanceData> {
346
358
  const fetchPromises = missedItems.map(async (item) => {
347
359
  try {
348
360
  // Use fetchFresh to ensure Redis is updated and requests are deduplicated
361
+ log.info(tag, `🔍 [CACHE MISS] Fetching fresh ${item.caip}...`);
349
362
  const freshData = await this.fetchFresh({ caip: item.caip, pubkey: item.pubkey });
363
+ log.info(tag, `🔍 [CACHE MISS] fetchFresh returned for ${item.caip}: caip='${freshData.caip}', balance=${freshData.balance}`);
364
+
365
+ // CRITICAL FIX: If fetchFresh returned defaultValue with empty CAIP (due to network init failure),
366
+ // restore the actual CAIP so the response isn't filtered out by the SDK
367
+ if (!freshData.caip || freshData.caip === '') {
368
+ log.warn(tag, `⚠️ [CACHE MISS] RESTORING CAIP: fetchFresh returned empty CAIP for ${item.caip} (likely network init failed)`);
369
+ freshData.caip = item.caip;
370
+ freshData.pubkey = item.pubkey;
371
+ log.warn(tag, `⚠️ [CACHE MISS] RESTORED CAIP: ${freshData.caip}`);
372
+ }
373
+
350
374
  results[item.index] = freshData;
351
375
  } catch (error) {
352
376
  log.error(tag, `Failed to fetch ${item.caip}/${item.pubkey}:`, error);