@devanachat/sdk 0.14.0 → 0.16.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +73 -1
  2. package/build/index.cjs.js +521 -54
  3. package/build/index.cjs.js.map +1 -1
  4. package/build/index.mjs +520 -54
  5. package/build/index.mjs.map +1 -1
  6. package/build/index.umd.js +1 -1
  7. package/build/index.umd.js.map +1 -1
  8. package/build/types/AbstractChatClient.d.ts +15 -2
  9. package/build/types/Permissions.d.ts +4 -0
  10. package/build/types/index.d.ts +4 -2
  11. package/build/types/protocol/index.d.ts +17 -2
  12. package/build/types/protocol/schemes/Activity.d.ts +16 -0
  13. package/build/types/protocol/schemes/SavedItem.d.ts +7 -0
  14. package/build/types/protocol/schemes/commands/GetActivities.d.ts +3 -0
  15. package/build/types/protocol/schemes/commands/GetPermissionOverwrites.d.ts +17 -1
  16. package/build/types/protocol/schemes/commands/GetSavedItems.d.ts +3 -0
  17. package/build/types/protocol/schemes/commands/SaveItem.d.ts +5 -0
  18. package/build/types/protocol/schemes/commands/UnsaveItem.d.ts +5 -0
  19. package/build/types/protocol/schemes/commands/UpdateActivities.d.ts +4 -0
  20. package/build/types/protocol/schemes/events/Activities.d.ts +9 -0
  21. package/build/types/protocol/schemes/events/ActivityDeleted.d.ts +3 -0
  22. package/build/types/protocol/schemes/events/ActivityUpdated.d.ts +4 -0
  23. package/build/types/protocol/schemes/events/Error.d.ts +3 -1
  24. package/build/types/protocol/schemes/events/ItemSaved.d.ts +6 -0
  25. package/build/types/protocol/schemes/events/ItemUnsaved.d.ts +5 -0
  26. package/build/types/protocol/schemes/events/NewActivity.d.ts +8 -0
  27. package/build/types/protocol/schemes/events/PermissionOverwritesList.d.ts +4 -0
  28. package/build/types/protocol/schemes/events/SavedItems.d.ts +6 -0
  29. package/build/types/state-tracker/ActivitiesManager.d.ts +63 -0
  30. package/build/types/state-tracker/ChatStateTracker.d.ts +13 -0
  31. package/build/types/state-tracker/PermissionsManager.d.ts +8 -2
  32. package/build/types/state-tracker/SavedItemsManager.d.ts +46 -0
  33. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,7 +4,79 @@ All notable changes to this project are documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the project follows
5
5
  [semver](https://semver.org) (`0.x` minor releases may break the API).
6
6
 
7
- ## [Unreleased]
7
+ ## [0.16.0]
8
+
9
+ ### Added
10
+
11
+ - `GetPermissionOverwrites` takes a list: `queries`, each a `location` with a `target`, answered with
12
+ `PermissionOverwritesList` - its `results` hold one `PermissionOverwrites` for every query, in their order, an empty
13
+ `allow`/`deny` where nothing is set. One request takes at most 50 queries referring to at most 4 different
14
+ locations, and fails as a whole when you may not read one of them. The types: `GetPermissionOverwritesBatch`,
15
+ `GetPermissionOverwritesQuery` and the `PermissionOverwritesList` event.
16
+
17
+ ### Changed
18
+
19
+ - `PermissionsManager` fetches every overwrite a permission check needs with one request instead of one request per
20
+ layer and role: a topic of a space where you hold 3 roles takes 1 request instead of 13, and so does every reconnect.
21
+ Checks of the room or the space of a topic already checked need no request; a role you get later is fetched alone.
22
+ `getOverwrites()` sends a list of one query and, as before, answers from the cache, which follows only your own
23
+ overwrites and those of your roles in the locations you belong to; for live overwrites of another target send
24
+ `GetPermissionOverwrites` yourself.
25
+
26
+ ### Deprecated
27
+
28
+ - `GetPermissionOverwrites` with a single `location` and `target` (`GetSinglePermissionOverwrites`), answered with
29
+ `PermissionOverwrites`. The server still accepts it for now; send `queries` instead.
30
+
31
+ ## [0.15.0]
32
+
33
+ ### Added
34
+
35
+ - Activities: your latest personal events from all spaces - a mention of you or of your role, a reply to you, a
36
+ reaction to your message, a reply in a thread you follow and a missed call - and the activities the server publishes
37
+ itself, with a `title`, a `description` and a `link`. Private conversations keep their own unread state: apart from a
38
+ missed call they make no activities. Bots have none: their `GetActivities` and `UpdateActivity` fail with
39
+ `UserTypeException`. The protocol: the `GetActivities` command answered with `Activities` - up to 20 `Activity`
40
+ objects, newest first, and the `seenAt` time; with `withMessages` also the messages they point at and their actors
41
+ (`users`), which are empty otherwise. The `UpdateActivity` command (`seenAt` marks the list as seen, `clear` empties
42
+ it) is answered with `ActivityUpdated`, which every session of the user gets. The event `NewActivity` carries the
43
+ new activity with its `message` and its actor (`users`), `ActivityDeleted` an activity the server deleted. Activities
44
+ of one group (`groupKey`: reactions to one message, replies in one thread) join while unseen: `count` grows,
45
+ `actorIds` keeps the last three and `messageId` points at the newest message. `Activity.isRead` is set once the
46
+ message of the activity is acknowledged (`Ack`; reactions excepted); a live `NewActivity` of a message comes a few
47
+ seconds late and only to those who have not acknowledged it by then, so an activity in the topic you are reading
48
+ does not show at all.
49
+ - `ChatStateTracker.activities` (`ActivitiesManager`): `get(fetchWithMessages)` resolves with an observable collection
50
+ of the activities keyed by id, `getMessages()` and `getUsers()` with the collections of their messages and actors,
51
+ and `seenAt` (with a `seenAtChange` event) tells when the list was last seen; the activities created later that are
52
+ not `isRead` are the unread ones. Nothing is fetched until you ask; afterwards a reconnect fetches again what was
53
+ fetched, with one request, into the same collections - also when the first fetch failed because the connection was
54
+ not ready. A live activity joins its group the way the server does; `ActivityUpdated`, `ActivityDeleted`,
55
+ `FollowedTopicUpdated` (an acknowledgement, also from another device), edits and deletions of the messages and
56
+ deleted rooms change the collections; leaving a room hides its activities and rejoining brings them back. The
57
+ collection order is not meaningful - sort by `createdAt`. Activities are not part of the state snapshot.
58
+ - Saved items: rooms (private conversations included) and messages you save to keep at hand. The protocol: the
59
+ `SaveItem` and `UnsaveItem` commands (`type` `Room` or `Message` and the `id`), answered with `ItemSaved` (the
60
+ `SavedItem` and, for a message, its `Message`) and `ItemUnsaved`, which the other sessions of the user get as
61
+ events when something changed; the `GetSavedItems` command answered with `SavedItems` - the items, newest first, and
62
+ with `withMessages` the saved messages too. Items of rooms you are not a member of are left out until you rejoin.
63
+ Saving over the server limit fails with `ErrorCode.SavedItemsLimitReached` (`subcode` `Room` or `Message`). Bots have
64
+ none: their commands fail with `ErrorCode.UserType`.
65
+ - `ChatStateTracker.savedItems` (`SavedItemsManager`): `get(fetchWithMessages)` resolves with an observable collection
66
+ of the items keyed by `savedItemKey(type, id)`, `getMessages()` with the collection of the saved messages, and
67
+ `isSaved()`. Nothing is fetched until you ask; afterwards a reconnect fetches again what was fetched, with one request,
68
+ into the same collections. `ItemSaved` / `ItemUnsaved` (also from another device), edits and deletions of the saved
69
+ messages and deleted rooms change the collections; leaving a room hides its items and rejoining brings them back. The
70
+ collection order is not meaningful - sort by `SavedItem.savedAt`. Saved items are not part of the state snapshot.
71
+ - The `StartCalls` permission (`2 ** 34`, up to the room layer): starting a call in a room, in every call mode. It
72
+ takes effect only together with `JoinCalls`, as whoever starts a call joins it.
73
+
74
+ ### Changed
75
+
76
+ - Room call permissions mean the same in every call mode. `JoinCalls` lets you join an ongoing call and no longer
77
+ start one: without `StartCalls` the `JoinCall` that would start a call fails with the `AccessDeniedException` error.
78
+ `ManageCalls` no longer lets you start an event (`Stage`). Whoever starts an event speaks in it, also without
79
+ `ManageCalls`. Private conversations still check none of these.
8
80
 
9
81
  ## [0.14.0]
10
82