@amityco/ts-sdk 0.0.1-beta-34 → 0.0.1-beta-35
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/tests/encodeKey.test.d.ts +2 -0
- package/dist/cache/utils/tests/encodeKey.test.d.ts.map +1 -0
- package/dist/cache/utils/tests/partialMatch.test.d.ts +2 -0
- package/dist/cache/utils/tests/partialMatch.test.d.ts.map +1 -0
- package/dist/client/api/tests/activeClient.test.d.ts +2 -0
- package/dist/client/api/tests/activeClient.test.d.ts.map +1 -0
- package/dist/client/api/tests/activeUser.test.d.ts +2 -0
- package/dist/client/api/tests/activeUser.test.d.ts.map +1 -0
- package/dist/index.cjs.js +9 -0
- package/dist/index.esm.js +9 -0
- package/dist/index.umd.js +1 -1
- package/dist/post/events/tests/onPostApproved.test.d.ts +2 -0
- package/dist/post/events/tests/onPostApproved.test.d.ts.map +1 -0
- package/dist/post/events/tests/onPostCreated.test.d.ts +2 -0
- package/dist/post/events/tests/onPostCreated.test.d.ts.map +1 -0
- package/dist/post/events/tests/onPostDeclined.test.d.ts +2 -0
- package/dist/post/events/tests/onPostDeclined.test.d.ts.map +1 -0
- package/dist/post/events/tests/onPostDeleted.test.d.ts +2 -0
- package/dist/post/events/tests/onPostDeleted.test.d.ts.map +1 -0
- package/dist/post/events/tests/onPostFlagged.test.d.ts +2 -0
- package/dist/post/events/tests/onPostFlagged.test.d.ts.map +1 -0
- package/dist/post/events/tests/onPostReactionAdded.test.d.ts +2 -0
- package/dist/post/events/tests/onPostReactionAdded.test.d.ts.map +1 -0
- package/dist/post/events/tests/onPostReactionRemoved.test.d.ts +2 -0
- package/dist/post/events/tests/onPostReactionRemoved.test.d.ts.map +1 -0
- package/dist/post/events/tests/onPostUnflagged.test.d.ts +2 -0
- package/dist/post/events/tests/onPostUnflagged.test.d.ts.map +1 -0
- package/dist/post/events/tests/onPostUpdated.test.d.ts +2 -0
- package/dist/post/events/tests/onPostUpdated.test.d.ts.map +1 -0
- package/dist/post/observers/livePosts.d.ts.map +1 -1
- package/dist/post/observers/tests/livePosts.test.d.ts +2 -0
- package/dist/post/observers/tests/livePosts.test.d.ts.map +1 -0
- package/dist/utils/tests/dummy/post.d.ts +15 -0
- package/dist/utils/tests/dummy/post.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/cache/utils/tests/encodeKey.test.ts +19 -0
- package/src/cache/utils/tests/partialMatch.test.ts +13 -0
- package/src/client/api/tests/activeClient.test.ts +20 -0
- package/src/client/api/tests/activeUser.test.ts +20 -0
- package/src/post/events/tests/onPostApproved.test.ts +33 -0
- package/src/post/events/tests/onPostCreated.test.ts +33 -0
- package/src/post/events/tests/onPostDeclined.test.ts +33 -0
- package/src/post/events/tests/onPostDeleted.test.ts +33 -0
- package/src/post/events/tests/onPostFlagged.test.ts +33 -0
- package/src/post/events/tests/onPostReactionAdded.test.ts +40 -0
- package/src/post/events/tests/onPostReactionRemoved.test.ts +40 -0
- package/src/post/events/tests/onPostUnflagged.test.ts +33 -0
- package/src/post/events/tests/onPostUpdated.test.ts +33 -0
- package/src/post/observers/livePosts.ts +10 -0
- package/src/post/observers/tests/livePosts.test.ts +273 -0
- package/src/utils/tests/dummy/post.ts +34 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encodeKey.test.d.ts","sourceRoot":"","sources":["../../../../src/cache/utils/tests/encodeKey.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"partialMatch.test.d.ts","sourceRoot":"","sources":["../../../../src/cache/utils/tests/partialMatch.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activeClient.test.d.ts","sourceRoot":"","sources":["../../../../src/client/api/tests/activeClient.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activeUser.test.d.ts","sourceRoot":"","sources":["../../../../src/client/api/tests/activeUser.test.ts"],"names":[],"mappings":""}
|
package/dist/index.cjs.js
CHANGED
|
@@ -27396,6 +27396,9 @@ const livePosts = (params, callback, config) => {
|
|
|
27396
27396
|
posts = filterByPropEquality(posts, 'isDeleted', params.isDeleted);
|
|
27397
27397
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
27398
27398
|
posts = posts.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
27399
|
+
if (params.tags) {
|
|
27400
|
+
posts = posts.filter(p => { var _a; return (_a = p.tags) === null || _a === void 0 ? void 0 : _a.some(t => { var _a; return (_a = params.tags) === null || _a === void 0 ? void 0 : _a.includes(t); }); });
|
|
27401
|
+
}
|
|
27399
27402
|
callback({
|
|
27400
27403
|
onNextPage: onFetch,
|
|
27401
27404
|
data: posts,
|
|
@@ -27414,6 +27417,12 @@ const livePosts = (params, callback, config) => {
|
|
|
27414
27417
|
}
|
|
27415
27418
|
else if (['onDelete', 'onDeclined'].includes(action)) {
|
|
27416
27419
|
collection.data = collection.data.filter(p => p !== post.postId);
|
|
27420
|
+
/*
|
|
27421
|
+
* if isDeleted is true, collection should add deleted items to the
|
|
27422
|
+
* begining of the collection
|
|
27423
|
+
*/
|
|
27424
|
+
if (params.isDeleted)
|
|
27425
|
+
collection.data.unshift(post.postId);
|
|
27417
27426
|
}
|
|
27418
27427
|
pushToCache(cacheKey, collection);
|
|
27419
27428
|
responder(collection);
|
package/dist/index.esm.js
CHANGED
|
@@ -27381,6 +27381,9 @@ const livePosts = (params, callback, config) => {
|
|
|
27381
27381
|
posts = filterByPropEquality(posts, 'isDeleted', params.isDeleted);
|
|
27382
27382
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
27383
27383
|
posts = posts.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
27384
|
+
if (params.tags) {
|
|
27385
|
+
posts = posts.filter(p => { var _a; return (_a = p.tags) === null || _a === void 0 ? void 0 : _a.some(t => { var _a; return (_a = params.tags) === null || _a === void 0 ? void 0 : _a.includes(t); }); });
|
|
27386
|
+
}
|
|
27384
27387
|
callback({
|
|
27385
27388
|
onNextPage: onFetch,
|
|
27386
27389
|
data: posts,
|
|
@@ -27399,6 +27402,12 @@ const livePosts = (params, callback, config) => {
|
|
|
27399
27402
|
}
|
|
27400
27403
|
else if (['onDelete', 'onDeclined'].includes(action)) {
|
|
27401
27404
|
collection.data = collection.data.filter(p => p !== post.postId);
|
|
27405
|
+
/*
|
|
27406
|
+
* if isDeleted is true, collection should add deleted items to the
|
|
27407
|
+
* begining of the collection
|
|
27408
|
+
*/
|
|
27409
|
+
if (params.isDeleted)
|
|
27410
|
+
collection.data.unshift(post.postId);
|
|
27402
27411
|
}
|
|
27403
27412
|
pushToCache(cacheKey, collection);
|
|
27404
27413
|
responder(collection);
|