@amityco/ts-sdk 7.28.1-ff89ba3b.0 → 7.29.1-cc0fba8.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/@types/domains/channel.d.ts +1 -13
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/observers/searchChannels/SearchChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/client/api/resumeSession.d.ts.map +1 -1
- package/dist/client/api/setupLoginSubscriptions.d.ts.map +1 -1
- package/dist/core/microtasks.d.ts.map +1 -1
- package/dist/core/query/sorting.d.ts +0 -19
- package/dist/core/query/sorting.d.ts.map +1 -1
- package/dist/index.cjs.js +26 -204
- package/dist/index.esm.js +27 -203
- package/dist/index.umd.js +2 -2
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +0 -1
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts.map +1 -1
- package/dist/messageRepository/api/createMessage.d.ts.map +1 -1
- package/dist/utils/tests/dummy/channel.d.ts +0 -4
- package/dist/utils/tests/dummy/channel.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/channelRepository/observers/tests/integrations/getChannelsSortByLastMessage.integration.test.d.ts +0 -2
- package/dist/channelRepository/observers/tests/integrations/getChannelsSortByLastMessage.integration.test.d.ts.map +0 -1
- package/dist/channelRepository/utils/channelActivityOnLoginHandler.d.ts +0 -16
- package/dist/channelRepository/utils/channelActivityOnLoginHandler.d.ts.map +0 -1
- package/dist/channelRepository/utils/tests/integrations/channelActivity.integration.test.d.ts +0 -2
- package/dist/channelRepository/utils/tests/integrations/channelActivity.integration.test.d.ts.map +0 -1
- package/dist/channelRepository/utils/tests/updateChannelActivityTimestamps.test.d.ts +0 -2
- package/dist/channelRepository/utils/tests/updateChannelActivityTimestamps.test.d.ts.map +0 -1
- package/dist/channelRepository/utils/updateChannelActivityTimestamps.d.ts +0 -34
- package/dist/channelRepository/utils/updateChannelActivityTimestamps.d.ts.map +0 -1
- package/dist/core/query/tests/sorting.test.d.ts +0 -2
- package/dist/core/query/tests/sorting.test.d.ts.map +0 -1
- package/dist/core/tests/microtasks.test.d.ts +0 -2
- package/dist/core/tests/microtasks.test.d.ts.map +0 -1
|
@@ -64,12 +64,6 @@ declare global {
|
|
|
64
64
|
pinnedMessage?: Amity.RawPinnedMessage | null;
|
|
65
65
|
isPublic?: boolean;
|
|
66
66
|
lastActivity: Amity.timestamp;
|
|
67
|
-
/**
|
|
68
|
-
* Time of the channel's newest message, or its creation time when it has none.
|
|
69
|
-
* `null` only for channels the backend backfill has not reached yet; consumers
|
|
70
|
-
* fall back to `createdAt`. Moved by new messages only, never by member changes.
|
|
71
|
-
*/
|
|
72
|
-
lastMessageAt: Amity.timestamp | null;
|
|
73
67
|
attachedTo?: {
|
|
74
68
|
postId?: string;
|
|
75
69
|
videoStreamId?: string;
|
|
@@ -97,17 +91,11 @@ declare global {
|
|
|
97
91
|
myMembership: (callback: Amity.LiveObjectCallback<Amity.Membership<'channel'> | undefined>) => Amity.Unsubscriber;
|
|
98
92
|
avatar?: Amity.File<'image'>;
|
|
99
93
|
};
|
|
100
|
-
/**
|
|
101
|
-
* Sort field for the channel query (`GET /api/v3/channels`).
|
|
102
|
-
* `lastActivity` (default) moves a channel on any activity, including member changes.
|
|
103
|
-
* `lastMessage` moves a channel only when a message is posted.
|
|
104
|
-
*/
|
|
105
|
-
type ChannelSortBy = 'lastActivity' | 'lastMessage' | 'lastCreated' | 'firstCreated' | 'displayName';
|
|
106
94
|
type QueryChannels = {
|
|
107
95
|
channelIds?: Amity.Channel['channelId'][];
|
|
108
96
|
displayName?: string;
|
|
109
97
|
membership?: 'all' | 'member' | 'notMember';
|
|
110
|
-
sortBy?:
|
|
98
|
+
sortBy?: 'displayName' | 'firstCreated' | 'lastCreated' | 'lastActivity';
|
|
111
99
|
types?: Amity.ChannelType[];
|
|
112
100
|
isDeleted?: Amity.Channel['isDeleted'];
|
|
113
101
|
tags?: Amity.Taggable['tags'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,oBAAY,gCAAgC;IAC1C,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,SAAS,cAAc;CACxB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,WAAW,GAAG,WAAW,GAAG,cAAc,GAAG,WAAW,GAAG,MAAM,CAAC;QAEvE,KAAK,gBAAgB,GAAG,gCAAgC,CAAC;QAEzD,KAAK,uBAAuB,GACxB,QAAQ,GACR,QAAQ,GACR,cAAc,GACd,eAAe,GACf,iBAAiB,GACjB,uBAAuB,GACvB,yBAAyB,GACzB,0BAA0B,GAC1B,4BAA4B,CAAC;QAEjC,WAAW,iBAAiB;YAC1B,gBAAgB,qBAAqB;YACrC,eAAe,oBAAoB;YACnC,OAAO,YAAY;YACnB,QAAQ,aAAa;YACrB,QAAQ,aAAa;YACrB,QAAQ,aAAa;YACrB,MAAM,WAAW;YACjB,MAAM,WAAW;YACjB,MAAM,WAAW;YACjB,QAAQ,aAAa;YACrB,aAAa,kBAAkB;YAC/B,eAAe,oBAAoB;YACnC,UAAU,eAAe;YACzB,YAAY,iBAAiB;YAC7B,4BAA4B,iCAAiC;SAC9D;QAED,KAAK,eAAe,GAAG;YACrB,SAAS,EAAE,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;YACtC,UAAU,EAAE,KAAK,CAAC,SAAS,CAAC;SAC7B,CAAC;QAEF,KAAK,qBAAqB,GAAG;YAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;SAChB,CAAC;QAEF,KAAK,6BAA6B,GAAG,KAAK,CAAC,oBAAoB,CAAC,qBAAqB,CAAC,CAAC;QAEvF,KAAK,kCAAkC,GAAG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.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChannelLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;
|
|
1
|
+
{"version":3,"file":"ChannelLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AA4C1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AAcvF,qBAAa,+BAAgC,SAAQ,wBAAwB,CAC3E,SAAS,EACT,KAAK,CAAC,qBAAqB,EAC3B,KAAK,CAAC,OAAO,EACb,2BAA2B,GAAG,iCAAiC,CAChE;IACC,OAAO,CAAC,qBAAqB,CAA+B;IAE5D,OAAO,CAAC,KAAK,CAA8B;gBAGzC,KAAK,EAAE,KAAK,CAAC,qBAAqB,EAClC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC;IAgCvD,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,UAAU;IAI9E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,SAAS,CAAC;IAI1D,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAkCzE,OAAO,CAAC,WAAW;IA4DnB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,MAAM,CAAC,wBAAwB;IAKvC,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAQtC,OAAO,CAAC,gBAAgB;CA+YzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchChannelLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/channelRepository/observers/searchChannels/SearchChannelLiveCollectionController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAiC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAQxF,qBAAa,qCAAsC,SAAQ,wBAAwB,CACjF,SAAS,EACT,KAAK,CAAC,2BAA2B,EACjC,KAAK,CAAC,OAAO,EACb,iCAAiC,CAClC;IACC,OAAO,CAAC,qBAAqB,CAAqC;gBAGhE,KAAK,EAAE,KAAK,CAAC,2BAA2B,EACxC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC;IAkBvD,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAqBzE,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,UAAU;IAI9E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,SAAS,CAAC;IAI1D,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,gBAAgB;
|
|
1
|
+
{"version":3,"file":"SearchChannelLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/channelRepository/observers/searchChannels/SearchChannelLiveCollectionController.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAiC1F,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AAQxF,qBAAa,qCAAsC,SAAQ,wBAAwB,CACjF,SAAS,EACT,KAAK,CAAC,2BAA2B,EACjC,KAAK,CAAC,OAAO,EACb,iCAAiC,CAClC;IACC,OAAO,CAAC,qBAAqB,CAAqC;gBAGhE,KAAK,EAAE,KAAK,CAAC,2BAA2B,EACxC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,OAAO,CAAC;IAkBvD,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;IAqBzE,SAAS,CAAC,KAAK;cAUC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,cAAc,GAAG,KAAK,CAAC,UAAU;IAI9E,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,SAAS,CAAC;IAI1D,OAAO,CAAC,WAAW;IAOnB,OAAO,CAAC,gBAAgB;CA0TzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resumeSession.d.ts","sourceRoot":"","sources":["../../../src/client/api/resumeSession.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resumeSession.d.ts","sourceRoot":"","sources":["../../../src/client/api/resumeSession.ts"],"names":[],"mappings":"AA0CA,UAAU,MAAM;IACd,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAKD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,WAChB,MAAM,kBACE,MAAM,cAAc,WAC3B,MAAM,mBAAmB,KACjC,QAAQ,OAAO,CA8HjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupLoginSubscriptions.d.ts","sourceRoot":"","sources":["../../../src/client/api/setupLoginSubscriptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"setupLoginSubscriptions.d.ts","sourceRoot":"","sources":["../../../src/client/api/setupLoginSubscriptions.ts"],"names":[],"mappings":"AAwBA;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,iBAAkB,MAAM,YAAY,KAAG,MAAM,YAAY,EAiE5F,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"microtasks.d.ts","sourceRoot":"","sources":["../../src/core/microtasks.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,YAAY,SAAU,QAAQ,
|
|
1
|
+
{"version":3,"file":"microtasks.d.ts","sourceRoot":"","sources":["../../src/core/microtasks.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,YAAY,SAAU,QAAQ,SAQ1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,SAAU,QAAQ,SAGxC,CAAC"}
|
|
@@ -61,25 +61,6 @@ export declare const sortByLastUpdated: SortingFunc<{
|
|
|
61
61
|
export declare const sortByLastActivity: SortingFunc<{
|
|
62
62
|
lastActivity: Date | number | string;
|
|
63
63
|
}>;
|
|
64
|
-
/**
|
|
65
|
-
* Sorting a channel collection by the time of its newest message (newest first).
|
|
66
|
-
* Channels whose `lastMessageAt` is `null` sort last, ordered by `createdAt`
|
|
67
|
-
* (newest first) among themselves, matching the server's `sortBy=lastMessage`
|
|
68
|
-
* order so the local sort agrees with the page order.
|
|
69
|
-
*/
|
|
70
|
-
export declare const sortByLastMessage: SortingFunc<{
|
|
71
|
-
lastMessageAt?: Date | number | string | null;
|
|
72
|
-
createdAt: Date | number | string;
|
|
73
|
-
}>;
|
|
74
|
-
/**
|
|
75
|
-
* Code-point ordering of objects having a displayName, empty or missing names
|
|
76
|
-
* first. This is the server's `sortBy=displayName` order for channels
|
|
77
|
-
* (case-sensitive, uppercase before lowercase); a localized or case-insensitive
|
|
78
|
-
* comparison would disagree with the page order.
|
|
79
|
-
*/
|
|
80
|
-
export declare const sortByDisplayNameCodePoint: SortingFunc<{
|
|
81
|
-
displayName?: string | null;
|
|
82
|
-
}>;
|
|
83
64
|
/**
|
|
84
65
|
* Filter items by untilAt timestamp based on sort direction
|
|
85
66
|
* - For 'lastCreated' (newest first): untilAt acts as lower bound, excludes items older than boundary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sorting.d.ts","sourceRoot":"","sources":["../../../src/core/query/sorting.ts"],"names":[],"mappings":"AAIA,aAAK,WAAW,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,CAMnE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAGrD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC;IAAE,cAAc,EAAE,MAAM,CAAA;CAAE,CAG/D,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,CAG7D,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC;IAAE,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAA;CAAE,CAGhC,CAAC;AAEnD;;GAEG;AACH,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC;IAC/C,gBAAgB,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC;CAC1C,CAC8C,CAAC;AAEhD;;GAEG;A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 @@ exports.AmityLiveViewerCountMode = void 0;
|
|
|
344
344
|
|
|
345
345
|
function getVersion() {
|
|
346
346
|
try {
|
|
347
|
-
// the string ''v7.
|
|
348
|
-
return 'v7.
|
|
347
|
+
// the string ''v7.29.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
348
|
+
return 'v7.29.0-cjs';
|
|
349
349
|
}
|
|
350
350
|
catch (error) {
|
|
351
351
|
return '__dev__';
|
|
@@ -1631,41 +1631,6 @@ const sortByLastUpdated = ({ updatedAt: a = 0 }, { updatedAt: b = 0 }) => new Da
|
|
|
1631
1631
|
* Sorting a collection by the items with most recent activity
|
|
1632
1632
|
*/
|
|
1633
1633
|
const sortByLastActivity = ({ lastActivity: a }, { lastActivity: b }) => new Date(b).valueOf() - new Date(a).valueOf();
|
|
1634
|
-
/**
|
|
1635
|
-
* Sorting a channel collection by the time of its newest message (newest first).
|
|
1636
|
-
* Channels whose `lastMessageAt` is `null` sort last, ordered by `createdAt`
|
|
1637
|
-
* (newest first) among themselves, matching the server's `sortBy=lastMessage`
|
|
1638
|
-
* order so the local sort agrees with the page order.
|
|
1639
|
-
*/
|
|
1640
|
-
const sortByLastMessage = (a, b) => {
|
|
1641
|
-
var _a, _b;
|
|
1642
|
-
const aAt = (_a = a.lastMessageAt) !== null && _a !== void 0 ? _a : null;
|
|
1643
|
-
const bAt = (_b = b.lastMessageAt) !== null && _b !== void 0 ? _b : null;
|
|
1644
|
-
if (aAt !== null && bAt !== null)
|
|
1645
|
-
return new Date(bAt).valueOf() - new Date(aAt).valueOf();
|
|
1646
|
-
if (aAt !== null)
|
|
1647
|
-
return -1;
|
|
1648
|
-
if (bAt !== null)
|
|
1649
|
-
return 1;
|
|
1650
|
-
return new Date(b.createdAt).valueOf() - new Date(a.createdAt).valueOf();
|
|
1651
|
-
};
|
|
1652
|
-
/**
|
|
1653
|
-
* Code-point ordering of objects having a displayName, empty or missing names
|
|
1654
|
-
* first. This is the server's `sortBy=displayName` order for channels
|
|
1655
|
-
* (case-sensitive, uppercase before lowercase); a localized or case-insensitive
|
|
1656
|
-
* comparison would disagree with the page order.
|
|
1657
|
-
*/
|
|
1658
|
-
const sortByDisplayNameCodePoint = ({ displayName: a }, { displayName: b }) => {
|
|
1659
|
-
const x = a !== null && a !== void 0 ? a : '';
|
|
1660
|
-
const y = b !== null && b !== void 0 ? b : '';
|
|
1661
|
-
if (x === y)
|
|
1662
|
-
return 0;
|
|
1663
|
-
if (!x)
|
|
1664
|
-
return -1;
|
|
1665
|
-
if (!y)
|
|
1666
|
-
return 1;
|
|
1667
|
-
return x < y ? -1 : 1;
|
|
1668
|
-
};
|
|
1669
1634
|
/**
|
|
1670
1635
|
* Filter items by untilAt timestamp based on sort direction
|
|
1671
1636
|
* - For 'lastCreated' (newest first): untilAt acts as lower bound, excludes items older than boundary
|
|
@@ -1750,13 +1715,8 @@ const scheduleTask = (task) => {
|
|
|
1750
1715
|
clearTimeout(timer);
|
|
1751
1716
|
tasks.push(task);
|
|
1752
1717
|
timer = setTimeout(() => {
|
|
1753
|
-
|
|
1754
|
-
// while the batch runs (an event handler that fires an event) must land in
|
|
1755
|
-
// a fresh queue and its own timer, not in the array being drained and then
|
|
1756
|
-
// discarded.
|
|
1757
|
-
const batch = tasks;
|
|
1718
|
+
tasks.forEach(fn => fn());
|
|
1758
1719
|
tasks = [];
|
|
1759
|
-
batch.forEach(fn => fn());
|
|
1760
1720
|
}, 0);
|
|
1761
1721
|
};
|
|
1762
1722
|
|
|
@@ -8106,140 +8066,6 @@ const postCommentCountEngineOnLoginHandler = () => onSessionStateChange(state =>
|
|
|
8106
8066
|
}
|
|
8107
8067
|
});
|
|
8108
8068
|
|
|
8109
|
-
const BOTH_FIELDS = { lastActivity: true, lastMessageAt: true };
|
|
8110
|
-
/**
|
|
8111
|
-
* The channel cache is keyed by `channelInternalId`, but a message names its
|
|
8112
|
-
* channel by whichever id the producer had: the raw MQTT payload carries the
|
|
8113
|
-
* internal id, a converted `Amity.InternalMessage` carries the public id, and
|
|
8114
|
-
* the optimistic message carries the sub-channel's `channelId`. Try the direct
|
|
8115
|
-
* key first, then match any of the three ids.
|
|
8116
|
-
*/
|
|
8117
|
-
const findCachedChannel = (channelId) => {
|
|
8118
|
-
var _a, _b, _c;
|
|
8119
|
-
const direct = (_a = pullFromCache(['channel', 'get', channelId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
8120
|
-
if (direct)
|
|
8121
|
-
return direct;
|
|
8122
|
-
return (_c = (_b = queryCache(['channel', 'get'])) === null || _b === void 0 ? void 0 : _b.find(({ data }) => data.channelInternalId === channelId ||
|
|
8123
|
-
data.channelId === channelId ||
|
|
8124
|
-
data.channelPublicId === channelId)) === null || _c === void 0 ? void 0 : _c.data;
|
|
8125
|
-
};
|
|
8126
|
-
const isNewer = (stored, at) => !stored || convertDateStringToTimestamp(stored) < convertDateStringToTimestamp(at);
|
|
8127
|
-
const isSameInstant = (stored, at) => !!stored && convertDateStringToTimestamp(stored) === convertDateStringToTimestamp(at);
|
|
8128
|
-
/** Pushes the changed fields in one write and emits one `local.channel.updated`. */
|
|
8129
|
-
const commit = (channel, changes) => {
|
|
8130
|
-
if (Object.keys(changes).length === 0)
|
|
8131
|
-
return false;
|
|
8132
|
-
const updated = shallowClone(channel, changes);
|
|
8133
|
-
// Write back under the key the cache actually uses (the resolver key), not
|
|
8134
|
-
// under `channel.channelId`, which can differ from `channelInternalId`.
|
|
8135
|
-
pushToCache(['channel', 'get', getResolver('channel')(updated)], updated);
|
|
8136
|
-
fireEvent('local.channel.updated', {
|
|
8137
|
-
channels: [updated],
|
|
8138
|
-
channelUsers: [],
|
|
8139
|
-
users: [],
|
|
8140
|
-
files: [],
|
|
8141
|
-
});
|
|
8142
|
-
return true;
|
|
8143
|
-
};
|
|
8144
|
-
/**
|
|
8145
|
-
* Single owner of every local write to a channel's ordering timestamps,
|
|
8146
|
-
* `lastActivity` and `lastMessageAt` (ChannelActivityService v1).
|
|
8147
|
-
*
|
|
8148
|
-
* - Monotonic per field: a field moves only when `at` is newer than the stored
|
|
8149
|
-
* value (or the stored value is `null`), so a late or replayed event never
|
|
8150
|
-
* moves a channel down the list.
|
|
8151
|
-
* - One write: both fields are read, compared and pushed in a single cache
|
|
8152
|
-
* update, followed by one `local.channel.updated` event so every open channel
|
|
8153
|
-
* collection re-sorts once.
|
|
8154
|
-
* - Server channel payloads never go through here; they overwrite unguarded.
|
|
8155
|
-
*
|
|
8156
|
-
* @returns `true` when at least one field moved
|
|
8157
|
-
* @category private
|
|
8158
|
-
*/
|
|
8159
|
-
const updateChannelActivityTimestamps = (channelId, at, fields = BOTH_FIELDS) => {
|
|
8160
|
-
const client = getActiveClient();
|
|
8161
|
-
if (!client.cache || !channelId || !at)
|
|
8162
|
-
return false;
|
|
8163
|
-
const channel = findCachedChannel(channelId);
|
|
8164
|
-
if (!channel)
|
|
8165
|
-
return false;
|
|
8166
|
-
const changes = {};
|
|
8167
|
-
if (fields.lastActivity && isNewer(channel.lastActivity, at))
|
|
8168
|
-
changes.lastActivity = at;
|
|
8169
|
-
if (fields.lastMessageAt && isNewer(channel.lastMessageAt, at))
|
|
8170
|
-
changes.lastMessageAt = at;
|
|
8171
|
-
return commit(channel, changes);
|
|
8172
|
-
};
|
|
8173
|
-
/**
|
|
8174
|
-
* Local correction for the current user's own send (ChannelActivityService v1
|
|
8175
|
-
* REQ-009, Trigger Matrix row 1b). Once the server confirms the message, each
|
|
8176
|
-
* field that still holds the device-clock `localAt` written at send time is
|
|
8177
|
-
* replaced by the server's `serverAt`, even when that is older. A field a newer
|
|
8178
|
-
* message has already moved is left alone. One write, one change notification,
|
|
8179
|
-
* nothing when neither field still holds `localAt`.
|
|
8180
|
-
*
|
|
8181
|
-
* @returns `true` when at least one field was replaced
|
|
8182
|
-
* @category private
|
|
8183
|
-
*/
|
|
8184
|
-
const confirmOwnMessage = (channelId, localAt, serverAt) => {
|
|
8185
|
-
const client = getActiveClient();
|
|
8186
|
-
if (!client.cache || !channelId || !localAt || !serverAt)
|
|
8187
|
-
return false;
|
|
8188
|
-
if (isSameInstant(localAt, serverAt))
|
|
8189
|
-
return false;
|
|
8190
|
-
const channel = findCachedChannel(channelId);
|
|
8191
|
-
if (!channel)
|
|
8192
|
-
return false;
|
|
8193
|
-
const changes = {};
|
|
8194
|
-
if (isSameInstant(channel.lastActivity, localAt))
|
|
8195
|
-
changes.lastActivity = serverAt;
|
|
8196
|
-
if (isSameInstant(channel.lastMessageAt, localAt))
|
|
8197
|
-
changes.lastMessageAt = serverAt;
|
|
8198
|
-
return commit(channel, changes);
|
|
8199
|
-
};
|
|
8200
|
-
|
|
8201
|
-
/**
|
|
8202
|
-
* Session-wide owner of the local `lastActivity` / `lastMessageAt` updates
|
|
8203
|
-
* (ChannelActivityService v1, Web migration rows W1 – W5).
|
|
8204
|
-
*
|
|
8205
|
-
* Registered once per session from `setupLoginSubscriptions` and
|
|
8206
|
-
* `resumeSession`, so the update runs whether or not a channel collection is
|
|
8207
|
-
* open, and exactly once per message however many collections are open.
|
|
8208
|
-
*
|
|
8209
|
-
* It listens to the raw events rather than `onMessageCreatedMqtt`, so it does
|
|
8210
|
-
* not duplicate that subscriber's side effects (mark-read, unread recount).
|
|
8211
|
-
*
|
|
8212
|
-
* @category private
|
|
8213
|
-
*/
|
|
8214
|
-
const channelActivityOnLoginHandler = () => {
|
|
8215
|
-
const client = getActiveClient();
|
|
8216
|
-
const disposers = [
|
|
8217
|
-
// Any user's new message, in any message feed of the channel. The raw
|
|
8218
|
-
// payload's `channelId` is the channel's internal id.
|
|
8219
|
-
createEventSubscriber(client, 'channelActivity', 'message.created', payload => {
|
|
8220
|
-
payload.messages.forEach(message => {
|
|
8221
|
-
updateChannelActivityTimestamps(message.channelId, message.createdAt);
|
|
8222
|
-
});
|
|
8223
|
-
}),
|
|
8224
|
-
// The current user's own send fires this three times: with the optimistic
|
|
8225
|
-
// message at send time (Syncing), on the create response (Synced), and on
|
|
8226
|
-
// failure (Error). The device-clock time of the Syncing / Error fires was
|
|
8227
|
-
// already applied synchronously in createMessageOptimistic, and replaying it
|
|
8228
|
-
// here could undo the server correction made on the response
|
|
8229
|
-
// (confirmOwnMessage). Only the server-confirmed fire goes through the guard.
|
|
8230
|
-
createEventSubscriber(client, 'channelActivity', 'local.message.created', payload => {
|
|
8231
|
-
payload.messages.forEach(message => {
|
|
8232
|
-
if (message.syncState !== "synced" /* Amity.SyncState.Synced */)
|
|
8233
|
-
return;
|
|
8234
|
-
updateChannelActivityTimestamps(message.channelId, message.createdAt);
|
|
8235
|
-
});
|
|
8236
|
-
}),
|
|
8237
|
-
];
|
|
8238
|
-
return () => {
|
|
8239
|
-
disposers.forEach(fn => fn());
|
|
8240
|
-
};
|
|
8241
|
-
};
|
|
8242
|
-
|
|
8243
8069
|
const EVENTS = [
|
|
8244
8070
|
'disconnected',
|
|
8245
8071
|
'error',
|
|
@@ -8429,7 +8255,7 @@ const setupLoginSubscriptions = (unsubWatcher) => {
|
|
|
8429
8255
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
8430
8256
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
8431
8257
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
8432
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler(), blockingUserSyncEngineOnLoginHandler(), blockRealtimeOnLoginHandler(), resetAutoSubscriptionsOnLogout(), CursorController.clearOnLogout(), postCommentCountEngineOnLoginHandler()
|
|
8258
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler(), reactionSyncEngineOnLoginHandler(), blockedUserSyncEngineOnLoginHandler(), blockingUserSyncEngineOnLoginHandler(), blockRealtimeOnLoginHandler(), resetAutoSubscriptionsOnLogout(), CursorController.clearOnLogout(), postCommentCountEngineOnLoginHandler());
|
|
8433
8259
|
if (client.useLegacyUnreadCount) {
|
|
8434
8260
|
subscriptions.push(readReceiptSyncEngineOnLoginHandler());
|
|
8435
8261
|
}
|
|
@@ -9690,7 +9516,7 @@ const resumeSession = async (params, sessionHandler, config) => {
|
|
|
9690
9516
|
// NOTE: This is a temporary solution to handle the channel marker when the user is forced to leave
|
|
9691
9517
|
// the channel because currently backend can't handle this, so every time a user is banned from
|
|
9692
9518
|
// a channel or the channel is deleted the channel's unread count will not be reset to zero
|
|
9693
|
-
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler()
|
|
9519
|
+
onChannelDeleted(removeChannelMarkerCache), onChannelMemberBanned(removeChannelMarkerCache), markReadEngineOnLoginHandler(), analyticsEngineOnLoginHandler(), objectResolverEngineOnLoginHandler());
|
|
9694
9520
|
if (client.useLegacyUnreadCount) {
|
|
9695
9521
|
subscriptions$1.push(readReceiptSyncEngineOnLoginHandler());
|
|
9696
9522
|
}
|
|
@@ -19875,16 +19701,9 @@ const createMessageOptimistic = (bundle) => {
|
|
|
19875
19701
|
}
|
|
19876
19702
|
// as reused to update created and updated time, which should be the same
|
|
19877
19703
|
const createdTime = new Date().toISOString();
|
|
19878
|
-
const message = Object.assign({
|
|
19879
|
-
// The optimistic message must name its channel so the session-wide channel
|
|
19880
|
-
// activity handler can move lastActivity / lastMessageAt at send time.
|
|
19881
|
-
channelId: subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.channelId, creatorId: client.userId, creatorPrivateId: getActiveUser()._id, channelSegment: ((_b = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _b !== void 0 ? _b : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime, syncState: "syncing" /* Amity.SyncState.Syncing */, isDeleted: false }, bundleWithMessageId);
|
|
19704
|
+
const message = Object.assign({ creatorId: client.userId, creatorPrivateId: getActiveUser()._id, channelSegment: ((_b = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _b !== void 0 ? _b : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime, syncState: "syncing" /* Amity.SyncState.Syncing */, isDeleted: false }, bundleWithMessageId);
|
|
19882
19705
|
const cachedAt = UNSYNCED_OBJECT_CACHED_AT_VALUE;
|
|
19883
19706
|
pushToCache(['message', 'get', message.messageId], message, { cachedAt });
|
|
19884
|
-
// Own-send update (ChannelActivityService row 1): move the channel at send
|
|
19885
|
-
// time, synchronously, so the confirmation on the send response always sees
|
|
19886
|
-
// this value rather than racing the scheduled local event below.
|
|
19887
|
-
updateChannelActivityTimestamps(message.channelId, message.createdAt);
|
|
19888
19707
|
fireEvent('local.message.created', { messages: [message] });
|
|
19889
19708
|
return message;
|
|
19890
19709
|
};
|
|
@@ -19924,9 +19743,6 @@ const createMessage = async (bundle) => {
|
|
|
19924
19743
|
if (client.cache) {
|
|
19925
19744
|
ingestInCache(data, { cachedAt });
|
|
19926
19745
|
}
|
|
19927
|
-
// The own-send update wrote the device-clock createdAt; replace it with the
|
|
19928
|
-
// server's now that the message is confirmed (ChannelActivityService REQ-009).
|
|
19929
|
-
confirmOwnMessage(optimisticData === null || optimisticData === void 0 ? void 0 : optimisticData.channelId, optimisticData === null || optimisticData === void 0 ? void 0 : optimisticData.createdAt, messages[0].createdAt);
|
|
19930
19746
|
fireEvent('local.message.created', {
|
|
19931
19747
|
messages: [Object.assign(Object.assign({}, messages[0]), { syncState: "synced" /* Amity.SyncState.Synced */ })],
|
|
19932
19748
|
});
|
|
@@ -22370,16 +22186,17 @@ class ChannelLiveCollectionController extends LiveCollectionController {
|
|
|
22370
22186
|
case 'lastCreated':
|
|
22371
22187
|
channels = channels.sort(sortByLastCreated);
|
|
22372
22188
|
break;
|
|
22373
|
-
case 'lastMessage':
|
|
22374
|
-
channels = channels.sort(sortByLastMessage);
|
|
22375
|
-
break;
|
|
22376
22189
|
case 'displayName':
|
|
22377
22190
|
/*
|
|
22378
|
-
* The server returns channels with empty | null displayName's first
|
|
22379
|
-
*
|
|
22380
|
-
*
|
|
22191
|
+
* The server returns channels with empty | null displayName's first before
|
|
22192
|
+
* returning sorted list of channels with displayNames
|
|
22193
|
+
*
|
|
22194
|
+
* This section needs to be updated as displayNames can be null as well
|
|
22381
22195
|
*/
|
|
22382
|
-
channels = channels
|
|
22196
|
+
channels = channels
|
|
22197
|
+
// this needs to be aligned with the backend data type
|
|
22198
|
+
.map(c => (c.displayName ? c : Object.assign(Object.assign({}, c), { displayName: '' })))
|
|
22199
|
+
.sort(sortByDisplayName);
|
|
22383
22200
|
break;
|
|
22384
22201
|
default:
|
|
22385
22202
|
channels = channels.sort(sortByLastActivity);
|
|
@@ -22429,8 +22246,9 @@ class ChannelLiveCollectionController extends LiveCollectionController {
|
|
|
22429
22246
|
objectResolverEngine.resolve(message.channelId, "channel" /* Amity.ReferenceType.CHANNEL */);
|
|
22430
22247
|
}
|
|
22431
22248
|
else {
|
|
22432
|
-
|
|
22433
|
-
|
|
22249
|
+
updateChannelCache(channelCache, {
|
|
22250
|
+
lastActivity: message.createdAt,
|
|
22251
|
+
});
|
|
22434
22252
|
callback(message);
|
|
22435
22253
|
}
|
|
22436
22254
|
});
|
|
@@ -22448,7 +22266,9 @@ class ChannelLiveCollectionController extends LiveCollectionController {
|
|
|
22448
22266
|
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
22449
22267
|
if (!cacheData)
|
|
22450
22268
|
return;
|
|
22451
|
-
|
|
22269
|
+
updateChannelCache(cacheData, {
|
|
22270
|
+
lastActivity: message.createdAt,
|
|
22271
|
+
});
|
|
22452
22272
|
callback(message);
|
|
22453
22273
|
});
|
|
22454
22274
|
}, 'channelId', 'channel'),
|
|
@@ -23186,7 +23006,9 @@ class SearchChannelLiveCollectionController extends LiveCollectionController {
|
|
|
23186
23006
|
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
23187
23007
|
if (!cacheData)
|
|
23188
23008
|
return;
|
|
23189
|
-
|
|
23009
|
+
updateChannelCache(cacheData, {
|
|
23010
|
+
lastActivity: message.createdAt,
|
|
23011
|
+
});
|
|
23190
23012
|
callback(message);
|
|
23191
23013
|
});
|
|
23192
23014
|
}, 'channelId', 'channel'),
|
|
@@ -23203,7 +23025,9 @@ class SearchChannelLiveCollectionController extends LiveCollectionController {
|
|
|
23203
23025
|
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
23204
23026
|
if (!cacheData)
|
|
23205
23027
|
return;
|
|
23206
|
-
|
|
23028
|
+
updateChannelCache(cacheData, {
|
|
23029
|
+
lastActivity: message.createdAt,
|
|
23030
|
+
});
|
|
23207
23031
|
callback(message);
|
|
23208
23032
|
});
|
|
23209
23033
|
}, 'channelId', 'channel'),
|
|
@@ -37822,12 +37646,10 @@ exports.restoreCache = restoreCache;
|
|
|
37822
37646
|
exports.runQuery = runQuery;
|
|
37823
37647
|
exports.sortByChannelSegment = sortByChannelSegment;
|
|
37824
37648
|
exports.sortByDisplayName = sortByDisplayName;
|
|
37825
|
-
exports.sortByDisplayNameCodePoint = sortByDisplayNameCodePoint;
|
|
37826
37649
|
exports.sortByFirstCreated = sortByFirstCreated;
|
|
37827
37650
|
exports.sortByFirstUpdated = sortByFirstUpdated;
|
|
37828
37651
|
exports.sortByLastActivity = sortByLastActivity;
|
|
37829
37652
|
exports.sortByLastCreated = sortByLastCreated;
|
|
37830
|
-
exports.sortByLastMessage = sortByLastMessage;
|
|
37831
37653
|
exports.sortByLastUpdated = sortByLastUpdated;
|
|
37832
37654
|
exports.sortByLocalSortingDate = sortByLocalSortingDate;
|
|
37833
37655
|
exports.sortByName = sortByName;
|