@amityco/ts-sdk-react-native 7.26.1-0905139c.0 → 7.26.1-bbd0bc2a.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 +3 -48
- package/dist/index.esm.js +3 -48
- package/dist/index.umd.js +1 -1
- package/dist/postRepository/events/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/postRepository/events/parentPost.d.ts +0 -32
- package/dist/postRepository/events/parentPost.d.ts.map +0 -1
- package/dist/postRepository/events/tests/parentPost.test.d.ts +0 -2
- package/dist/postRepository/events/tests/parentPost.test.d.ts.map +0 -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;AAkBnD;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,2BAA0B,
|
|
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;AAkBnD;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,2BAA0B,MACmC,CAAC;AAEpF;;;;;;;;;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
|
@@ -399,13 +399,7 @@ const normalize = (source) => Object.keys(source)
|
|
|
399
399
|
* @category Cache
|
|
400
400
|
* @hidden
|
|
401
401
|
*/
|
|
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
|
-
val !== null && typeof val === 'object' ? normalize(val) : val);
|
|
402
|
+
const encodeKey = (key) => JSON.stringify(key, (_, val) => (typeof val === 'object' ? normalize(val) : val));
|
|
409
403
|
/**
|
|
410
404
|
* Decodes a string back into a {@link Amity.CacheKey}
|
|
411
405
|
|
|
@@ -16690,39 +16684,6 @@ removeReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
16690
16684
|
return !((_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName));
|
|
16691
16685
|
};
|
|
16692
16686
|
|
|
16693
|
-
/**
|
|
16694
|
-
* Resolves the id of the parent post that a child-post payload belongs to.
|
|
16695
|
-
*
|
|
16696
|
-
* `parentId` and `parentPostId` name the same post, but a payload does not
|
|
16697
|
-
* always carry both — and the delete/create child handlers decide *whether* a
|
|
16698
|
-
* post is a child from `parentId` while reading the cache with `parentPostId`.
|
|
16699
|
-
* When only the former is set that read builds `['post', 'get', undefined]`,
|
|
16700
|
-
* which cannot match anything and, when the value is null, breaks key encoding
|
|
16701
|
-
* outright. Reading whichever id is present keeps the decision and the lookup
|
|
16702
|
-
* on the same post.
|
|
16703
|
-
*
|
|
16704
|
-
* @param post the child post payload
|
|
16705
|
-
* @returns the parent post id, or undefined when the payload carries neither
|
|
16706
|
-
*
|
|
16707
|
-
* @category Post Events
|
|
16708
|
-
* @hidden
|
|
16709
|
-
*/
|
|
16710
|
-
const resolveParentPostId = (post) => {
|
|
16711
|
-
if (post.parentPostId)
|
|
16712
|
-
return post.parentPostId;
|
|
16713
|
-
if (post.parentId) {
|
|
16714
|
-
// Diagnostic: we do not know yet whether the server actually emits this
|
|
16715
|
-
// shape. If this warning is never seen in practice the fallback can go.
|
|
16716
|
-
console.warn('[AmitySDK] post payload carries `parentId` without `parentPostId` — falling back to `parentId`', {
|
|
16717
|
-
postId: post.postId,
|
|
16718
|
-
parentId: post.parentId,
|
|
16719
|
-
parentPostId: post.parentPostId,
|
|
16720
|
-
});
|
|
16721
|
-
return post.parentId;
|
|
16722
|
-
}
|
|
16723
|
-
return undefined;
|
|
16724
|
-
};
|
|
16725
|
-
|
|
16726
16687
|
const processDeleteChildPost = (payload) => {
|
|
16727
16688
|
var _a;
|
|
16728
16689
|
const post = payload.posts[0];
|
|
@@ -16734,10 +16695,7 @@ const processDeleteChildPost = (payload) => {
|
|
|
16734
16695
|
}
|
|
16735
16696
|
else {
|
|
16736
16697
|
// child post in a parent post
|
|
16737
|
-
const
|
|
16738
|
-
if (!parentPostId)
|
|
16739
|
-
return;
|
|
16740
|
-
const parentPost = (_a = pullFromCache(['post', 'get', parentPostId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16698
|
+
const parentPost = (_a = pullFromCache(['post', 'get', post.parentPostId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16741
16699
|
if (!parentPost)
|
|
16742
16700
|
return;
|
|
16743
16701
|
pushToCache(['post', 'get', parentPost.postId], Object.assign(Object.assign({}, parentPost), { children: parentPost.children.filter(childId => childId !== post.postId) }));
|
|
@@ -16748,10 +16706,7 @@ const processCreateChildPost = (payload) => {
|
|
|
16748
16706
|
const post = payload.posts[0];
|
|
16749
16707
|
if (!post.parentId)
|
|
16750
16708
|
return;
|
|
16751
|
-
const
|
|
16752
|
-
if (!parentPostId)
|
|
16753
|
-
return;
|
|
16754
|
-
const parentPost = (_a = pullFromCache(['post', 'get', parentPostId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16709
|
+
const parentPost = (_a = pullFromCache(['post', 'get', post.parentPostId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16755
16710
|
if (!parentPost)
|
|
16756
16711
|
return;
|
|
16757
16712
|
pushToCache(['post', 'get', parentPost.postId], Object.assign(Object.assign({}, parentPost), { children: [...new Set([post.postId, ...parentPost.children])] }));
|
package/dist/index.esm.js
CHANGED
|
@@ -364,13 +364,7 @@ const normalize = (source) => Object.keys(source)
|
|
|
364
364
|
* @category Cache
|
|
365
365
|
* @hidden
|
|
366
366
|
*/
|
|
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
|
-
val !== null && typeof val === 'object' ? normalize(val) : val);
|
|
367
|
+
const encodeKey = (key) => JSON.stringify(key, (_, val) => (typeof val === 'object' ? normalize(val) : val));
|
|
374
368
|
/**
|
|
375
369
|
* Decodes a string back into a {@link Amity.CacheKey}
|
|
376
370
|
|
|
@@ -16671,39 +16665,6 @@ removeReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
16671
16665
|
return !((_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName));
|
|
16672
16666
|
};
|
|
16673
16667
|
|
|
16674
|
-
/**
|
|
16675
|
-
* Resolves the id of the parent post that a child-post payload belongs to.
|
|
16676
|
-
*
|
|
16677
|
-
* `parentId` and `parentPostId` name the same post, but a payload does not
|
|
16678
|
-
* always carry both — and the delete/create child handlers decide *whether* a
|
|
16679
|
-
* post is a child from `parentId` while reading the cache with `parentPostId`.
|
|
16680
|
-
* When only the former is set that read builds `['post', 'get', undefined]`,
|
|
16681
|
-
* which cannot match anything and, when the value is null, breaks key encoding
|
|
16682
|
-
* outright. Reading whichever id is present keeps the decision and the lookup
|
|
16683
|
-
* on the same post.
|
|
16684
|
-
*
|
|
16685
|
-
* @param post the child post payload
|
|
16686
|
-
* @returns the parent post id, or undefined when the payload carries neither
|
|
16687
|
-
*
|
|
16688
|
-
* @category Post Events
|
|
16689
|
-
* @hidden
|
|
16690
|
-
*/
|
|
16691
|
-
const resolveParentPostId = (post) => {
|
|
16692
|
-
if (post.parentPostId)
|
|
16693
|
-
return post.parentPostId;
|
|
16694
|
-
if (post.parentId) {
|
|
16695
|
-
// Diagnostic: we do not know yet whether the server actually emits this
|
|
16696
|
-
// shape. If this warning is never seen in practice the fallback can go.
|
|
16697
|
-
console.warn('[AmitySDK] post payload carries `parentId` without `parentPostId` — falling back to `parentId`', {
|
|
16698
|
-
postId: post.postId,
|
|
16699
|
-
parentId: post.parentId,
|
|
16700
|
-
parentPostId: post.parentPostId,
|
|
16701
|
-
});
|
|
16702
|
-
return post.parentId;
|
|
16703
|
-
}
|
|
16704
|
-
return undefined;
|
|
16705
|
-
};
|
|
16706
|
-
|
|
16707
16668
|
const processDeleteChildPost = (payload) => {
|
|
16708
16669
|
var _a;
|
|
16709
16670
|
const post = payload.posts[0];
|
|
@@ -16715,10 +16676,7 @@ const processDeleteChildPost = (payload) => {
|
|
|
16715
16676
|
}
|
|
16716
16677
|
else {
|
|
16717
16678
|
// child post in a parent post
|
|
16718
|
-
const
|
|
16719
|
-
if (!parentPostId)
|
|
16720
|
-
return;
|
|
16721
|
-
const parentPost = (_a = pullFromCache(['post', 'get', parentPostId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16679
|
+
const parentPost = (_a = pullFromCache(['post', 'get', post.parentPostId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16722
16680
|
if (!parentPost)
|
|
16723
16681
|
return;
|
|
16724
16682
|
pushToCache(['post', 'get', parentPost.postId], Object.assign(Object.assign({}, parentPost), { children: parentPost.children.filter(childId => childId !== post.postId) }));
|
|
@@ -16729,10 +16687,7 @@ const processCreateChildPost = (payload) => {
|
|
|
16729
16687
|
const post = payload.posts[0];
|
|
16730
16688
|
if (!post.parentId)
|
|
16731
16689
|
return;
|
|
16732
|
-
const
|
|
16733
|
-
if (!parentPostId)
|
|
16734
|
-
return;
|
|
16735
|
-
const parentPost = (_a = pullFromCache(['post', 'get', parentPostId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16690
|
+
const parentPost = (_a = pullFromCache(['post', 'get', post.parentPostId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
16736
16691
|
if (!parentPost)
|
|
16737
16692
|
return;
|
|
16738
16693
|
pushToCache(['post', 'get', parentPost.postId], Object.assign(Object.assign({}, parentPost), { children: [...new Set([post.postId, ...parentPost.children])] }));
|