@amityco/ts-sdk-react-native 7.26.1-0905139c.0 → 7.26.1-30c953a9.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/dist/cache/utils/index.d.ts.map +1 -1
- package/dist/index.cjs.js +26 -7
- package/dist/index.esm.js +26 -7
- package/dist/index.umd.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cache/utils/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAC1C,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD,eAAO,MAAM,sBAAsB,QAAa,CAAC;AACjD,eAAO,MAAM,cAAc,QAAa,CAAC;AACzC,eAAO,MAAM,wBAAwB,QAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cache/utils/index.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,QAAQ,CAAC;AACnC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAC1C,eAAO,MAAM,oBAAoB,eAAe,CAAC;AAEjD,eAAO,MAAM,sBAAsB,QAAa,CAAC;AACjD,eAAO,MAAM,cAAc,QAAa,CAAC;AACzC,eAAO,MAAM,wBAAwB,QAAa,CAAC;AAyBnD;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,2BAA0B,MAuB5C,CAAC;AAEL;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,QAAS,MAAM,mBAAoC,CAAC;AAE1E;;;;;;;;GAQG;AACH,eAAO,MAAM,YAAY,cAAe,GAAG,aAAa,GAAG,KAAG,OAa7D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,4BAA6B,GAAG,2BACU,CAAC;AAEhE;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,cAAe,MAAM,WAAW,KAAG,OACS,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -390,6 +390,12 @@ const CACHE_LIFESPAN_TOMBSTONE = 3 * MINUTE; // 3 minutes
|
|
|
390
390
|
const normalize = (source) => Object.keys(source)
|
|
391
391
|
.sort()
|
|
392
392
|
.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: source[key] })), {});
|
|
393
|
+
/**
|
|
394
|
+
* Keys already reported by encodeKey, so one recurring bad payload does not
|
|
395
|
+
* flood the console — a null segment usually arrives on a realtime event that
|
|
396
|
+
* repeats.
|
|
397
|
+
*/
|
|
398
|
+
const reportedNullKeys = new Set();
|
|
393
399
|
/**
|
|
394
400
|
* Encodes a given {@link Amity.CacheKey} to a plain string
|
|
395
401
|
*
|
|
@@ -399,13 +405,26 @@ const normalize = (source) => Object.keys(source)
|
|
|
399
405
|
* @category Cache
|
|
400
406
|
* @hidden
|
|
401
407
|
*/
|
|
402
|
-
const encodeKey = (key) => JSON.stringify(key, (_, val) =>
|
|
403
|
-
// `typeof null` is `'object'`, so a nullish segment would reach normalize()
|
|
404
|
-
// and throw on Object.keys(null) — taking down whichever cache read built
|
|
405
|
-
// the key. Amity.Serializable does not admit null in the first place, so a
|
|
406
|
-
// null here is a payload that broke its own contract: encode it as null and
|
|
407
|
-
// let the miss be a miss.
|
|
408
|
-
|
|
408
|
+
const encodeKey = (key) => JSON.stringify(key, (_, val) => {
|
|
409
|
+
// `typeof null` is `'object'`, so a nullish segment would reach normalize()
|
|
410
|
+
// and throw on Object.keys(null) — taking down whichever cache read built
|
|
411
|
+
// the key. Amity.Serializable does not admit null in the first place, so a
|
|
412
|
+
// null here is a payload that broke its own contract: encode it as null and
|
|
413
|
+
// let the miss be a miss.
|
|
414
|
+
if (val === null) {
|
|
415
|
+
// Diagnostic: the guard makes the key harmless, but it hides which
|
|
416
|
+
// caller built it. Printing the whole key names the domain and the shape
|
|
417
|
+
// ('post'/'get'/null vs something else), which is the one thing needed
|
|
418
|
+
// to find the producer.
|
|
419
|
+
const printed = JSON.stringify(key);
|
|
420
|
+
if (!reportedNullKeys.has(printed)) {
|
|
421
|
+
reportedNullKeys.add(printed);
|
|
422
|
+
console.warn('[AmitySDK] null segment in cache key', printed);
|
|
423
|
+
}
|
|
424
|
+
return val;
|
|
425
|
+
}
|
|
426
|
+
return typeof val === 'object' ? normalize(val) : val;
|
|
427
|
+
});
|
|
409
428
|
/**
|
|
410
429
|
* Decodes a string back into a {@link Amity.CacheKey}
|
|
411
430
|
|
package/dist/index.esm.js
CHANGED
|
@@ -355,6 +355,12 @@ const CACHE_LIFESPAN_TOMBSTONE = 3 * MINUTE; // 3 minutes
|
|
|
355
355
|
const normalize = (source) => Object.keys(source)
|
|
356
356
|
.sort()
|
|
357
357
|
.reduce((acc, key) => (Object.assign(Object.assign({}, acc), { [key]: source[key] })), {});
|
|
358
|
+
/**
|
|
359
|
+
* Keys already reported by encodeKey, so one recurring bad payload does not
|
|
360
|
+
* flood the console — a null segment usually arrives on a realtime event that
|
|
361
|
+
* repeats.
|
|
362
|
+
*/
|
|
363
|
+
const reportedNullKeys = new Set();
|
|
358
364
|
/**
|
|
359
365
|
* Encodes a given {@link Amity.CacheKey} to a plain string
|
|
360
366
|
*
|
|
@@ -364,13 +370,26 @@ const normalize = (source) => Object.keys(source)
|
|
|
364
370
|
* @category Cache
|
|
365
371
|
* @hidden
|
|
366
372
|
*/
|
|
367
|
-
const encodeKey = (key) => JSON.stringify(key, (_, val) =>
|
|
368
|
-
// `typeof null` is `'object'`, so a nullish segment would reach normalize()
|
|
369
|
-
// and throw on Object.keys(null) — taking down whichever cache read built
|
|
370
|
-
// the key. Amity.Serializable does not admit null in the first place, so a
|
|
371
|
-
// null here is a payload that broke its own contract: encode it as null and
|
|
372
|
-
// let the miss be a miss.
|
|
373
|
-
|
|
373
|
+
const encodeKey = (key) => JSON.stringify(key, (_, val) => {
|
|
374
|
+
// `typeof null` is `'object'`, so a nullish segment would reach normalize()
|
|
375
|
+
// and throw on Object.keys(null) — taking down whichever cache read built
|
|
376
|
+
// the key. Amity.Serializable does not admit null in the first place, so a
|
|
377
|
+
// null here is a payload that broke its own contract: encode it as null and
|
|
378
|
+
// let the miss be a miss.
|
|
379
|
+
if (val === null) {
|
|
380
|
+
// Diagnostic: the guard makes the key harmless, but it hides which
|
|
381
|
+
// caller built it. Printing the whole key names the domain and the shape
|
|
382
|
+
// ('post'/'get'/null vs something else), which is the one thing needed
|
|
383
|
+
// to find the producer.
|
|
384
|
+
const printed = JSON.stringify(key);
|
|
385
|
+
if (!reportedNullKeys.has(printed)) {
|
|
386
|
+
reportedNullKeys.add(printed);
|
|
387
|
+
console.warn('[AmitySDK] null segment in cache key', printed);
|
|
388
|
+
}
|
|
389
|
+
return val;
|
|
390
|
+
}
|
|
391
|
+
return typeof val === 'object' ? normalize(val) : val;
|
|
392
|
+
});
|
|
374
393
|
/**
|
|
375
394
|
* Decodes a string back into a {@link Amity.CacheKey}
|
|
376
395
|
|