@twilio/conversations 1.3.0-rc8 → 2.0.0-rc.4

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 (282) hide show
  1. package/CHANGELOG.md +210 -0
  2. package/README.md +22 -17
  3. package/dist/browser.js +7873 -0
  4. package/dist/browser.js.map +1 -0
  5. package/dist/docs/assets/css/main.css +2660 -0
  6. package/dist/docs/assets/images/icons.png +0 -0
  7. package/dist/docs/assets/images/icons@2x.png +0 -0
  8. package/dist/docs/assets/images/widgets.png +0 -0
  9. package/dist/docs/assets/images/widgets@2x.png +0 -0
  10. package/dist/docs/assets/js/main.js +248 -0
  11. package/dist/docs/assets/js/search.js +1 -0
  12. package/dist/docs/classes/AggregatedDeliveryReceipt.html +3286 -0
  13. package/dist/docs/classes/Client.html +4181 -0
  14. package/dist/docs/classes/Conversation.html +4397 -0
  15. package/dist/docs/classes/DetailedDeliveryReceipt.html +3265 -0
  16. package/dist/docs/classes/Media.html +3295 -0
  17. package/dist/docs/classes/Message.html +3713 -0
  18. package/dist/docs/classes/MessageBuilder.html +3280 -0
  19. package/dist/docs/classes/Participant.html +3517 -0
  20. package/dist/docs/classes/PushNotification.html +3232 -0
  21. package/dist/docs/classes/RestPaginator.html +3262 -0
  22. package/dist/docs/classes/UnsentMessage.html +3144 -0
  23. package/dist/docs/classes/User.html +3451 -0
  24. package/dist/docs/index.html +3394 -212
  25. package/dist/docs/interfaces/ClientOptions.html +3136 -0
  26. package/dist/docs/interfaces/ConversationState.html +3152 -0
  27. package/dist/docs/interfaces/CreateConversationOptions.html +3168 -0
  28. package/dist/docs/interfaces/LastMessage.html +3152 -0
  29. package/dist/docs/interfaces/Paginator.html +3243 -0
  30. package/dist/docs/interfaces/PushNotificationData.html +3168 -0
  31. package/dist/docs/interfaces/SendEmailOptions.html +3136 -0
  32. package/dist/docs/interfaces/SendMediaOptions.html +3170 -0
  33. package/dist/docs/modules.html +3425 -0
  34. package/dist/lib.d.ts +1952 -0
  35. package/dist/lib.js +7873 -0
  36. package/dist/lib.js.map +1 -0
  37. package/dist/post-install.js +29 -0
  38. package/dist/react-native.js +4038 -0
  39. package/dist/react-native.js.map +1 -0
  40. package/dist/twilio-conversations.js +40912 -0
  41. package/dist/twilio-conversations.min.js +156 -0
  42. package/package.json +59 -48
  43. package/.circleci/config.yml +0 -650
  44. package/.deepsource.toml +0 -6
  45. package/.env.example +0 -13
  46. package/browser/aggregateddeliveryreceipt.js +0 -152
  47. package/browser/client.js +0 -991
  48. package/browser/configuration.js +0 -80
  49. package/browser/conversation.js +0 -1826
  50. package/browser/data/conversations.js +0 -632
  51. package/browser/data/messages.js +0 -522
  52. package/browser/data/participants.js +0 -411
  53. package/browser/data/users.js +0 -281
  54. package/browser/detaileddeliveryreceipt.js +0 -44
  55. package/browser/index.js +0 -4
  56. package/browser/interfaces/limits.js +0 -3
  57. package/browser/interfaces/notificationtypes.js +0 -21
  58. package/browser/interfaces/paginator.js +0 -53
  59. package/browser/interfaces/responsecodes.js +0 -20
  60. package/browser/interfaces/transport.js +0 -3
  61. package/browser/logger.js +0 -141
  62. package/browser/media.js +0 -198
  63. package/browser/message.js +0 -685
  64. package/browser/participant.js +0 -415
  65. package/browser/pushnotification.js +0 -49
  66. package/browser/restpaginator.js +0 -74
  67. package/browser/services/network.js +0 -223
  68. package/browser/services/readhorizon.js +0 -181
  69. package/browser/services/typingindicator.js +0 -142
  70. package/browser/session.js +0 -505
  71. package/browser/sessionerror.js +0 -93
  72. package/browser/sri.json +0 -1
  73. package/browser/synclist.js +0 -90
  74. package/browser/synclistdescriptor.js +0 -29
  75. package/browser/syncpaginator.js +0 -63
  76. package/browser/user.js +0 -431
  77. package/browser/util/deferred.js +0 -56
  78. package/browser/util/index.js +0 -108
  79. package/dist/@twilio/conversations.js +0 -35533
  80. package/dist/@twilio/conversations.min.js +0 -204
  81. package/dist/docs/AggregatedDeliveryReceipt.html +0 -948
  82. package/dist/docs/Client.html +0 -5075
  83. package/dist/docs/Conversation.html +0 -6018
  84. package/dist/docs/DetailedDeliveryReceipt.html +0 -641
  85. package/dist/docs/Media.html +0 -694
  86. package/dist/docs/Message.html +0 -1934
  87. package/dist/docs/Paginator.html +0 -605
  88. package/dist/docs/Participant.html +0 -1510
  89. package/dist/docs/PushNotification.html +0 -836
  90. package/dist/docs/SessionError.html +0 -379
  91. package/dist/docs/User.html +0 -1315
  92. package/dist/docs/classes.list.html +0 -4431
  93. package/dist/docs/fonts/glyphicons-halflings-regular.eot +0 -0
  94. package/dist/docs/fonts/glyphicons-halflings-regular.svg +0 -288
  95. package/dist/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
  96. package/dist/docs/fonts/glyphicons-halflings-regular.woff +0 -0
  97. package/dist/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
  98. package/dist/docs/img/glyphicons-halflings-white.png +0 -0
  99. package/dist/docs/img/glyphicons-halflings.png +0 -0
  100. package/dist/docs/quicksearch.html +0 -31
  101. package/dist/docs/scripts/docstrap.lib.js +0 -11
  102. package/dist/docs/scripts/fulltext-search-ui.js +0 -89
  103. package/dist/docs/scripts/fulltext-search.js +0 -36
  104. package/dist/docs/scripts/lunr.min.js +0 -6
  105. package/dist/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
  106. package/dist/docs/scripts/prettify/jquery.min.js +0 -6
  107. package/dist/docs/scripts/prettify/lang-css.js +0 -21
  108. package/dist/docs/scripts/prettify/prettify.js +0 -496
  109. package/dist/docs/scripts/sunlight.js +0 -1157
  110. package/dist/docs/scripts/toc.js +0 -203
  111. package/dist/docs/styles/darkstrap.css +0 -960
  112. package/dist/docs/styles/prettify-tomorrow.css +0 -132
  113. package/dist/docs/styles/site.cerulean.css +0 -7008
  114. package/dist/docs/styles/site.cosmo.css +0 -7061
  115. package/dist/docs/styles/site.cyborg.css +0 -7048
  116. package/dist/docs/styles/site.darkly.css +0 -7171
  117. package/dist/docs/styles/site.darkstrap.css +0 -5638
  118. package/dist/docs/styles/site.dibs-bootstrap.css +0 -5899
  119. package/dist/docs/styles/site.flatly.css +0 -7147
  120. package/dist/docs/styles/site.journal.css +0 -6973
  121. package/dist/docs/styles/site.lumen.css +0 -7298
  122. package/dist/docs/styles/site.paper.css +0 -7623
  123. package/dist/docs/styles/site.readable.css +0 -6997
  124. package/dist/docs/styles/site.sandstone.css +0 -7035
  125. package/dist/docs/styles/site.simplex.css +0 -7023
  126. package/dist/docs/styles/site.slate.css +0 -7343
  127. package/dist/docs/styles/site.spacelab.css +0 -7055
  128. package/dist/docs/styles/site.superhero.css +0 -7131
  129. package/dist/docs/styles/site.united.css +0 -6895
  130. package/dist/docs/styles/site.yeti.css +0 -7195
  131. package/dist/docs/styles/sunlight.dark.css +0 -345
  132. package/dist/docs/styles/sunlight.default.css +0 -344
  133. package/dist/sri.json +0 -1
  134. package/lib/aggregateddeliveryreceipt.d.ts +0 -98
  135. package/lib/aggregateddeliveryreceipt.js +0 -112
  136. package/lib/client.d.ts +0 -317
  137. package/lib/client.js +0 -633
  138. package/lib/configuration.d.ts +0 -21
  139. package/lib/configuration.js +0 -41
  140. package/lib/conversation.d.ts +0 -460
  141. package/lib/conversation.js +0 -940
  142. package/lib/data/conversations.d.ts +0 -57
  143. package/lib/data/conversations.js +0 -296
  144. package/lib/data/messages.d.ts +0 -75
  145. package/lib/data/messages.js +0 -208
  146. package/lib/data/participants.d.ts +0 -94
  147. package/lib/data/participants.js +0 -204
  148. package/lib/data/users.d.ts +0 -42
  149. package/lib/data/users.js +0 -113
  150. package/lib/detaileddeliveryreceipt.d.ts +0 -45
  151. package/lib/detaileddeliveryreceipt.js +0 -34
  152. package/lib/index.d.ts +0 -1
  153. package/lib/index.js +0 -3
  154. package/lib/interfaces/limits.d.ts +0 -8
  155. package/lib/interfaces/limits.js +0 -2
  156. package/lib/interfaces/notificationtypes.d.ts +0 -8
  157. package/lib/interfaces/notificationtypes.js +0 -11
  158. package/lib/interfaces/paginator.d.ts +0 -52
  159. package/lib/interfaces/paginator.js +0 -28
  160. package/lib/interfaces/responsecodes.d.ts +0 -8
  161. package/lib/interfaces/responsecodes.js +0 -10
  162. package/lib/interfaces/transport.d.ts +0 -13
  163. package/lib/interfaces/transport.js +0 -2
  164. package/lib/logger.d.ts +0 -18
  165. package/lib/logger.js +0 -35
  166. package/lib/media.d.ts +0 -52
  167. package/lib/media.js +0 -69
  168. package/lib/message.d.ts +0 -136
  169. package/lib/message.js +0 -305
  170. package/lib/participant.d.ts +0 -142
  171. package/lib/participant.js +0 -219
  172. package/lib/pushnotification.d.ts +0 -48
  173. package/lib/pushnotification.js +0 -39
  174. package/lib/restpaginator.d.ts +0 -19
  175. package/lib/restpaginator.js +0 -36
  176. package/lib/services/network.d.ts +0 -22
  177. package/lib/services/network.js +0 -87
  178. package/lib/services/readhorizon.d.ts +0 -28
  179. package/lib/services/readhorizon.js +0 -112
  180. package/lib/services/typingindicator.d.ts +0 -50
  181. package/lib/services/typingindicator.js +0 -102
  182. package/lib/session.d.ts +0 -63
  183. package/lib/session.js +0 -213
  184. package/lib/sessionerror.d.ts +0 -12
  185. package/lib/sessionerror.js +0 -24
  186. package/lib/sri.json +0 -1
  187. package/lib/synclist.d.ts +0 -24
  188. package/lib/synclist.js +0 -28
  189. package/lib/synclistdescriptor.d.ts +0 -27
  190. package/lib/synclistdescriptor.js +0 -19
  191. package/lib/syncpaginator.d.ts +0 -22
  192. package/lib/syncpaginator.js +0 -37
  193. package/lib/user.d.ts +0 -98
  194. package/lib/user.js +0 -219
  195. package/lib/util/deferred.d.ts +0 -12
  196. package/lib/util/deferred.js +0 -22
  197. package/lib/util/index.d.ts +0 -28
  198. package/lib/util/index.js +0 -82
  199. package/tools/rtd-sdk-cdn-pin/.gitrepo +0 -12
  200. package/tools/rtd-sdk-cdn-pin/README.md +0 -54
  201. package/tools/rtd-sdk-cdn-pin/bintray-settings.xml.template +0 -16
  202. package/tools/rtd-sdk-cdn-pin/cdn-common/cdn-prepare.sh +0 -67
  203. package/tools/rtd-sdk-cdn-pin/cdn-pin-latest.sh +0 -19
  204. package/tools/rtd-sdk-cdn-pin/cdn-pin.sh +0 -19
  205. package/tools/rtd-sdk-cdn-pin/cdn-upload.sh +0 -13
  206. package/tools/rtd-sdk-cdn-pin/fetch/common/fetch-bintray-android.sh +0 -34
  207. package/tools/rtd-sdk-cdn-pin/fetch/common/fetch-npm.sh +0 -18
  208. package/tools/rtd-sdk-cdn-pin/fetch/twilio-chat-android.sh +0 -5
  209. package/tools/rtd-sdk-cdn-pin/fetch/twilio-chat-js.sh +0 -5
  210. package/tools/rtd-sdk-cdn-pin/fetch/twilio-conversations-android.sh +0 -6
  211. package/tools/rtd-sdk-cdn-pin/fetch/twilio-conversations-js.sh +0 -5
  212. package/tools/rtd-sdk-cdn-pin/fetch/twilio-sync-android.sh +0 -5
  213. package/tools/rtd-sdk-cdn-pin/fetch/twilio-sync-js.sh +0 -5
  214. package/tools/rtd-sdk-cdn-pin/fetch-artifact.sh +0 -26
  215. package/tools/sdk-release-tool/.gitrepo +0 -12
  216. package/tools/sdk-release-tool/Makefile +0 -49
  217. package/tools/sdk-release-tool/README.md +0 -275
  218. package/tools/sdk-release-tool/delete +0 -3
  219. package/tools/sdk-release-tool/download +0 -3
  220. package/tools/sdk-release-tool/get-cors +0 -3
  221. package/tools/sdk-release-tool/list +0 -3
  222. package/tools/sdk-release-tool/pin +0 -3
  223. package/tools/sdk-release-tool/pin-latest +0 -3
  224. package/tools/sdk-release-tool/requirements.txt +0 -4
  225. package/tools/sdk-release-tool/sdk-release-tool +0 -3
  226. package/tools/sdk-release-tool/sdk_release_tools/__init__.py +0 -0
  227. package/tools/sdk-release-tool/sdk_release_tools/__main__.py +0 -110
  228. package/tools/sdk-release-tool/sdk_release_tools/aws.py +0 -70
  229. package/tools/sdk-release-tool/sdk_release_tools/cli.py +0 -181
  230. package/tools/sdk-release-tool/sdk_release_tools/log.py +0 -24
  231. package/tools/sdk-release-tool/sdk_release_tools/ops.py +0 -295
  232. package/tools/sdk-release-tool/sdk_release_tools/rpm.py +0 -28
  233. package/tools/sdk-release-tool/sdk_release_tools/util.py +0 -186
  234. package/tools/sdk-release-tool/sdk_release_tools/versions.py +0 -362
  235. package/tools/sdk-release-tool/signal-sdk-js.json +0 -28
  236. package/tools/sdk-release-tool/tests/test_versions.py +0 -94
  237. package/tools/sdk-release-tool/twilio-accessmanager-android.json +0 -19
  238. package/tools/sdk-release-tool/twilio-accessmanager-ios.json +0 -26
  239. package/tools/sdk-release-tool/twilio-auth-ios.json +0 -29
  240. package/tools/sdk-release-tool/twilio-authenticator-ios.json +0 -29
  241. package/tools/sdk-release-tool/twilio-chat-android-2.json +0 -19
  242. package/tools/sdk-release-tool/twilio-chat-android.json +0 -22
  243. package/tools/sdk-release-tool/twilio-chat-ios.json +0 -26
  244. package/tools/sdk-release-tool/twilio-chat-js.json +0 -27
  245. package/tools/sdk-release-tool/twilio-client-android-aar.json +0 -22
  246. package/tools/sdk-release-tool/twilio-client-android.json +0 -22
  247. package/tools/sdk-release-tool/twilio-client-ios.json +0 -20
  248. package/tools/sdk-release-tool/twilio-client-js.json +0 -17
  249. package/tools/sdk-release-tool/twilio-client-sounds-js.json +0 -14
  250. package/tools/sdk-release-tool/twilio-common-android-maven.json +0 -16
  251. package/tools/sdk-release-tool/twilio-common-android.json +0 -22
  252. package/tools/sdk-release-tool/twilio-common-ios-rtc.json +0 -25
  253. package/tools/sdk-release-tool/twilio-common-ios.json +0 -25
  254. package/tools/sdk-release-tool/twilio-common-js.json +0 -19
  255. package/tools/sdk-release-tool/twilio-conversations-android.json +0 -22
  256. package/tools/sdk-release-tool/twilio-conversations-ios.json +0 -26
  257. package/tools/sdk-release-tool/twilio-conversations-js.json +0 -27
  258. package/tools/sdk-release-tool/twilio-flex-js.json +0 -20
  259. package/tools/sdk-release-tool/twilio-flex-webchat-js.json +0 -16
  260. package/tools/sdk-release-tool/twilio-frame-chat-android.json +0 -22
  261. package/tools/sdk-release-tool/twilio-frame-chat-ios.json +0 -23
  262. package/tools/sdk-release-tool/twilio-frame-chat-js.json +0 -23
  263. package/tools/sdk-release-tool/twilio-ip-messaging-android-maven.json +0 -16
  264. package/tools/sdk-release-tool/twilio-ip-messaging-android.json +0 -22
  265. package/tools/sdk-release-tool/twilio-ip-messaging-ios.json +0 -25
  266. package/tools/sdk-release-tool/twilio-ip-messaging-js.json +0 -21
  267. package/tools/sdk-release-tool/twilio-sync-android.json +0 -22
  268. package/tools/sdk-release-tool/twilio-sync-ios.json +0 -26
  269. package/tools/sdk-release-tool/twilio-sync-js.json +0 -39
  270. package/tools/sdk-release-tool/twilio-taskrouter-js.json +0 -17
  271. package/tools/sdk-release-tool/twilio-video-android.json +0 -22
  272. package/tools/sdk-release-tool/twilio-video-cpp-linux-cross-rootfs.json +0 -13
  273. package/tools/sdk-release-tool/twilio-video-cpp.json +0 -33
  274. package/tools/sdk-release-tool/twilio-video-ios.json +0 -25
  275. package/tools/sdk-release-tool/twilio-video-js.json +0 -19
  276. package/tools/sdk-release-tool/twilio-video-jsdocs.json +0 -14
  277. package/tools/sdk-release-tool/twilio-voice-android.json +0 -22
  278. package/tools/sdk-release-tool/twilio-voice-ios.json +0 -29
  279. package/tools/sdk-release-tool/unpin +0 -3
  280. package/tools/sdk-release-tool/unpin-latest +0 -3
  281. package/tools/sdk-release-tool/upload +0 -3
  282. package/twilio-chat.js.iml +0 -9
@@ -1,112 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const sessionerror_1 = require("../sessionerror");
4
- class ConsumptionReportRequest {
5
- }
6
- class ConsumptionReportEntry {
7
- }
8
- class ReadHorizonPromise {
9
- }
10
- /**
11
- * @classdesc Provides read horizon management functionality
12
- */
13
- class ReadHorizon {
14
- constructor(services) {
15
- this.services = services;
16
- this.readHorizonRequests = new Map();
17
- this.readHorizonUpdateTimer = null;
18
- }
19
- getReportInterval() {
20
- return this.services.session.getConsumptionReportInterval().then(seconds => seconds * 1000);
21
- }
22
- delayedSendReadHorizon(delay) {
23
- if (this.readHorizonUpdateTimer !== null) {
24
- return;
25
- }
26
- this.sendConsumptionReport(true);
27
- this.readHorizonUpdateTimer = setTimeout(() => {
28
- this.sendConsumptionReport(false);
29
- }, delay);
30
- }
31
- sendConsumptionReport(keepTimer) {
32
- let reports = [];
33
- let promises = new Map();
34
- this.readHorizonRequests.forEach((request, conversationSid) => {
35
- reports.push(request.entry);
36
- promises.set(conversationSid, request.promises);
37
- });
38
- if (reports.length > 0) {
39
- this.services.session.addCommand('consumptionReportV2', { report: reports })
40
- .then(response => this.processConsumptionReportResponse(response, promises))
41
- .catch(err => this.processConsumptionReportError(err, promises));
42
- }
43
- if (!keepTimer) {
44
- this.readHorizonUpdateTimer = null;
45
- }
46
- this.readHorizonRequests.clear();
47
- }
48
- processConsumptionReportResponse(response, promises) {
49
- if (response && response.report && Array.isArray(response.report) && response.report.length > 0) {
50
- response.report.forEach(entry => {
51
- let responseEntry = entry;
52
- if (promises.has(responseEntry.channelSid)) {
53
- let unreadMessagesCount = null;
54
- if ((typeof responseEntry.unreadMessagesCount !== 'undefined') && responseEntry.unreadMessagesCount != null) {
55
- unreadMessagesCount = responseEntry.unreadMessagesCount;
56
- }
57
- promises.get(responseEntry.channelSid).forEach(promise => promise.resolve(unreadMessagesCount));
58
- promises.delete(responseEntry.channelSid);
59
- }
60
- });
61
- }
62
- this.processConsumptionReportError(new sessionerror_1.SessionError('Error while setting LastReadMessageIndex', null), promises);
63
- }
64
- processConsumptionReportError(err, promises) {
65
- promises.forEach(conversationPromises => conversationPromises.forEach(promise => promise.reject(err)));
66
- }
67
- /**
68
- * Updates read horizon value without any checks
69
- */
70
- updateLastReadMessageIndexForConversation(conversationSid, messageIdx) {
71
- return new Promise((resolve, reject) => {
72
- this.addPendingConsumptionHorizonRequest(conversationSid, { channelSid: conversationSid, messageIdx }, { resolve, reject });
73
- this.getReportInterval().then(delay => this.delayedSendReadHorizon(delay));
74
- });
75
- }
76
- /**
77
- * Move read horizon forward
78
- */
79
- advanceLastReadMessageIndexForConversation(conversationSid, messageIdx, currentConversationLastReadIndex) {
80
- let currentHorizon = this.readHorizonRequests.get(conversationSid);
81
- return new Promise((resolve, reject) => {
82
- if (currentHorizon && currentHorizon.entry) {
83
- if (currentHorizon.entry.messageIdx >= messageIdx) {
84
- this.addPendingConsumptionHorizonRequest(conversationSid, currentHorizon.entry, { resolve, reject });
85
- }
86
- else {
87
- this.addPendingConsumptionHorizonRequest(conversationSid, { channelSid: conversationSid, messageIdx }, { resolve, reject });
88
- }
89
- }
90
- else {
91
- if ((currentConversationLastReadIndex !== null) && messageIdx < currentConversationLastReadIndex) {
92
- this.addPendingConsumptionHorizonRequest(conversationSid, { channelSid: conversationSid, messageIdx: currentConversationLastReadIndex }, { resolve, reject });
93
- }
94
- else {
95
- this.addPendingConsumptionHorizonRequest(conversationSid, { channelSid: conversationSid, messageIdx }, { resolve, reject });
96
- }
97
- }
98
- this.getReportInterval().then(delay => this.delayedSendReadHorizon(delay));
99
- });
100
- }
101
- addPendingConsumptionHorizonRequest(conversationSid, entry, promise) {
102
- if (this.readHorizonRequests.has(conversationSid)) {
103
- let request = this.readHorizonRequests.get(conversationSid);
104
- request.entry = entry;
105
- request.promises.push(promise);
106
- }
107
- else {
108
- this.readHorizonRequests.set(conversationSid, { entry, promises: [promise] });
109
- }
110
- }
111
- }
112
- exports.ReadHorizon = ReadHorizon;
@@ -1,50 +0,0 @@
1
- import { Notifications } from 'twilio-notifications';
2
- import { Transport } from '../interfaces/transport';
3
- import { Configuration } from '../configuration';
4
- export interface TypingIndicatorServices {
5
- transport: Transport;
6
- notificationClient: Notifications;
7
- }
8
- /**
9
- * An important note in regards to typing timeout timers. There are two places that the SDK can get the "typing_timeout" attribute from. The first
10
- * place that the attribute appears in is the response received from POST -> /v1/typing REST call. In the body of that response, the value of the
11
- * "typing_timeout" attribute will be exactly the same as defined in the console. The second place that the attribute appears in is from a
12
- * notification of type "twilio.ipmsg.typing_indicator". In this case, the "typing_timeout" value will be +1 of that in the console. This
13
- * intentional. The timeout returned from the POST -> /v1/typing call should be used to disable further calls for that period of time. On contrary,
14
- * the timeout returned from the notification should be used as the timeout for the "typingEnded" event, +1 is to account for latency.
15
- *
16
- * @private
17
- */
18
- /**
19
- * @class TypingIndicator
20
- *
21
- * @constructor
22
- * @private
23
- */
24
- declare class TypingIndicator {
25
- private readonly services;
26
- private readonly config;
27
- private sentUpdates;
28
- private getConversation;
29
- private serviceTypingTimeout;
30
- constructor(config: Configuration, services: TypingIndicatorServices, getConversation: any);
31
- get typingTimeout(): number;
32
- /**
33
- * Initialize TypingIndicator controller
34
- * Registers for needed message types and sets listeners
35
- * @private
36
- */
37
- initialize(): void;
38
- /**
39
- * Remote participants typing events handler
40
- * @private
41
- */
42
- handleRemoteTyping(message: any): void;
43
- /**
44
- * Send typing event for the given conversation sid
45
- * @param {String} conversationSid
46
- */
47
- send(conversationSid: string): any;
48
- private _send;
49
- }
50
- export { TypingIndicator };
@@ -1,102 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const logger_1 = require("../logger");
4
- const notificationtypes_1 = require("../interfaces/notificationtypes");
5
- const log = logger_1.Logger.scope('TypingIndicator');
6
- /**
7
- * An important note in regards to typing timeout timers. There are two places that the SDK can get the "typing_timeout" attribute from. The first
8
- * place that the attribute appears in is the response received from POST -> /v1/typing REST call. In the body of that response, the value of the
9
- * "typing_timeout" attribute will be exactly the same as defined in the console. The second place that the attribute appears in is from a
10
- * notification of type "twilio.ipmsg.typing_indicator". In this case, the "typing_timeout" value will be +1 of that in the console. This
11
- * intentional. The timeout returned from the POST -> /v1/typing call should be used to disable further calls for that period of time. On contrary,
12
- * the timeout returned from the notification should be used as the timeout for the "typingEnded" event, +1 is to account for latency.
13
- *
14
- * @private
15
- */
16
- /**
17
- * @class TypingIndicator
18
- *
19
- * @constructor
20
- * @private
21
- */
22
- class TypingIndicator {
23
- constructor(config, services, getConversation) {
24
- this.config = config;
25
- this.services = services;
26
- this.getConversation = getConversation;
27
- this.serviceTypingTimeout = null;
28
- this.sentUpdates = new Map();
29
- }
30
- get typingTimeout() {
31
- return this.config.typingIndicatorTimeoutOverride
32
- || this.serviceTypingTimeout
33
- || this.config.typingIndicatorTimeoutDefault;
34
- }
35
- /**
36
- * Initialize TypingIndicator controller
37
- * Registers for needed message types and sets listeners
38
- * @private
39
- */
40
- initialize() {
41
- this.services.notificationClient.subscribe(notificationtypes_1.NotificationTypes.TYPING_INDICATOR, 'twilsock');
42
- this.services.notificationClient.on('message', (type, message) => {
43
- if (type === notificationtypes_1.NotificationTypes.TYPING_INDICATOR) {
44
- this.handleRemoteTyping(message);
45
- }
46
- });
47
- }
48
- /**
49
- * Remote participants typing events handler
50
- * @private
51
- */
52
- handleRemoteTyping(message) {
53
- log.trace('Got new typing indicator ', message);
54
- this.getConversation(message.channel_sid)
55
- .then(conversation => {
56
- if (!conversation) {
57
- return;
58
- }
59
- conversation.participants.forEach(participant => {
60
- if (participant.identity !== message.identity) {
61
- return;
62
- }
63
- const timeout = this.config.typingIndicatorTimeoutOverride + 1000 || message.typing_timeout * 1000;
64
- participant._startTyping(timeout);
65
- });
66
- })
67
- .catch(err => {
68
- log.error(err);
69
- throw err;
70
- });
71
- }
72
- /**
73
- * Send typing event for the given conversation sid
74
- * @param {String} conversationSid
75
- */
76
- send(conversationSid) {
77
- const lastUpdate = this.sentUpdates.get(conversationSid);
78
- if (lastUpdate && lastUpdate > (Date.now() - this.typingTimeout)) {
79
- return Promise.resolve();
80
- }
81
- this.sentUpdates.set(conversationSid, Date.now());
82
- return this._send(conversationSid);
83
- }
84
- _send(conversationSid) {
85
- log.trace('Sending typing indicator');
86
- const url = this.config.typingIndicatorUri;
87
- const headers = {
88
- 'Content-Type': 'application/x-www-form-urlencoded'
89
- };
90
- const body = 'ChannelSid=' + conversationSid;
91
- return this.services.transport.post(url, headers, body, this.config.productId)
92
- .then(response => {
93
- if (response.body.hasOwnProperty('typing_timeout')) {
94
- this.serviceTypingTimeout = response.body.typing_timeout * 1000;
95
- }
96
- }).catch(err => {
97
- log.error('Failed to send typing indicator:', err);
98
- throw err;
99
- });
100
- }
101
- }
102
- exports.TypingIndicator = TypingIndicator;
package/lib/session.d.ts DELETED
@@ -1,63 +0,0 @@
1
- import { MediaLimits } from './interfaces/limits';
2
- import { Configuration } from './configuration';
3
- import { SyncClient } from 'twilio-sync';
4
- interface SessionLinks {
5
- publicChannelsUrl: string;
6
- myChannelsUrl: string;
7
- typingUrl: string;
8
- syncListUrl: string;
9
- usersUrl: string;
10
- mediaServiceUrl: string;
11
- mediaSetServiceUrl: string;
12
- messagesReceiptsUrl: string;
13
- }
14
- export interface SessionServices {
15
- syncClient: SyncClient;
16
- }
17
- /**
18
- * Constructs the instance of Session
19
- *
20
- * @classdesc Provides the interface to send the command to the server
21
- * It is reliable, which means that it tracks the command object state
22
- * and waits the answer from the server.
23
- */
24
- declare class Session {
25
- readonly services: SessionServices;
26
- private endpointPlatform;
27
- private config;
28
- private pendingCommands;
29
- private sessionStreamPromise;
30
- private readonly sessionInfo;
31
- private currentContext;
32
- constructor(services: SessionServices, config: Configuration);
33
- get identity(): string;
34
- get reachabilityEnabled(): boolean;
35
- private handleContextUpdate;
36
- initialize(): Promise<Session>;
37
- /**
38
- * Sends the command to the server
39
- * @returns Promise the promise, which is being fulfilled only when service will reply
40
- */
41
- addCommand(action: string, params: any): Promise<any>;
42
- /**
43
- * @private
44
- */
45
- private processCommand;
46
- /**
47
- * @private
48
- */
49
- private processCommandResponse;
50
- private getSessionContext;
51
- getSessionLinks(): Promise<SessionLinks>;
52
- getMediaLimits(): Promise<MediaLimits>;
53
- getConversationsId(): Promise<string>;
54
- getMyConversationsId(): Promise<string>;
55
- getMaxUserInfosToSubscribe(): Promise<number>;
56
- getUsersData(): Promise<{
57
- user: string;
58
- identity: string;
59
- }>;
60
- getConsumptionReportInterval(): Promise<number>;
61
- getHttpCacheInterval(): Promise<number>;
62
- }
63
- export { SessionLinks, Session };
package/lib/session.js DELETED
@@ -1,213 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const uuid = require("uuid");
4
- const platform = require("platform");
5
- const responsecodes_1 = require("./interfaces/responsecodes");
6
- const logger_1 = require("./logger");
7
- const sessionerror_1 = require("./sessionerror");
8
- const deferred_1 = require("./util/deferred");
9
- const iso8601_duration_1 = require("iso8601-duration");
10
- const SDK_VERSION = require('./../package.json').version;
11
- const SESSION_PURPOSE = 'com.twilio.rtd.ipmsg';
12
- const log = logger_1.Logger.scope('Session');
13
- class Command {
14
- }
15
- function hasAllPropertiesSet(obj, properties) {
16
- return !(properties.some(prop => !obj.hasOwnProperty(prop)));
17
- }
18
- /**
19
- * Constructs the instance of Session
20
- *
21
- * @classdesc Provides the interface to send the command to the server
22
- * It is reliable, which means that it tracks the command object state
23
- * and waits the answer from the server.
24
- */
25
- class Session {
26
- constructor(services, config) {
27
- let platformInfo = typeof navigator !== 'undefined' ?
28
- platform.parse(navigator.userAgent) : platform;
29
- this.services = services;
30
- this.config = config;
31
- this.sessionInfo = new deferred_1.Deferred();
32
- this.currentContext = {};
33
- this.pendingCommands = new Map();
34
- this.sessionStreamPromise = null;
35
- this.endpointPlatform = [
36
- 'JS',
37
- SDK_VERSION,
38
- platformInfo.os,
39
- platformInfo.name,
40
- platformInfo.version
41
- ].join('|');
42
- }
43
- get identity() { return this.sessionInfo.current.identity; }
44
- get reachabilityEnabled() { return this.currentContext.reachabilityEnabled; }
45
- handleContextUpdate(updatedContext) {
46
- log.info('Session context updated');
47
- log.debug('new session context:', updatedContext);
48
- this.currentContext = updatedContext;
49
- if (!hasAllPropertiesSet(updatedContext, ['identity', 'userInfo', 'links', 'myChannels', 'channels'])) {
50
- return; // not enough data to proceed, wait
51
- }
52
- log.info('new session context accepted');
53
- this.sessionInfo.set(updatedContext);
54
- }
55
- initialize() {
56
- let context = {
57
- type: 'IpMsgSession',
58
- apiVersion: '4',
59
- endpointPlatform: this.endpointPlatform
60
- };
61
- this.sessionStreamPromise = this.services.syncClient.list({ purpose: SESSION_PURPOSE, context })
62
- .then(list => {
63
- log.info('Session created', list.sid);
64
- list.on('itemAdded', args => this.processCommandResponse(args.item));
65
- list.on('itemUpdated', args => this.processCommandResponse(args.item));
66
- list.on('contextUpdated', args => this.handleContextUpdate(args.context));
67
- return list;
68
- }).catch(function (err) {
69
- log.error('Failed to create session', err);
70
- throw err;
71
- });
72
- return this.sessionStreamPromise;
73
- }
74
- /**
75
- * Sends the command to the server
76
- * @returns Promise the promise, which is being fulfilled only when service will reply
77
- */
78
- addCommand(action, params) {
79
- return this.processCommand(action, params);
80
- }
81
- /**
82
- * @private
83
- */
84
- processCommand(action, params, createSessionIfNotFound = true) {
85
- let command = new Command();
86
- command.request = params;
87
- command.request.action = action;
88
- command.commandId = uuid.v4();
89
- log.info('Adding command: ', action, command.commandId);
90
- log.debug('command arguments:', params, createSessionIfNotFound);
91
- return new Promise((resolve, reject) => {
92
- this.sessionStreamPromise.then(list => {
93
- this.pendingCommands.set(command.commandId, { resolve, reject, commandId: command.commandId, request: command.request });
94
- return list.push(command);
95
- })
96
- .then(() => log.debug('Command accepted by server', command.commandId))
97
- .catch(err => {
98
- this.pendingCommands.delete(command.commandId);
99
- log.error('Failed to add a command to the session', err);
100
- if ((err.code == responsecodes_1.ResponseCodes.ACCESS_FORBIDDEN_FOR_IDENTITY || err.code === responsecodes_1.ResponseCodes.LIST_NOT_FOUND) && createSessionIfNotFound) {
101
- log.info('recreating session...');
102
- this.initialize();
103
- resolve(this.processCommand(action, params, false)); // second attempt
104
- }
105
- else {
106
- reject(new Error('Can\'t add command: ' + err.message));
107
- }
108
- });
109
- });
110
- }
111
- /**
112
- * @private
113
- */
114
- processCommandResponse(entity) {
115
- if (entity.data.hasOwnProperty('response') &&
116
- entity.data.hasOwnProperty('commandId') &&
117
- this.pendingCommands.has(entity.data.commandId)) {
118
- const data = entity.data;
119
- const commandId = data.commandId;
120
- if (data.response.status === responsecodes_1.ResponseCodes.HTTP_200_OK) {
121
- log.debug('Command succeeded: ', data);
122
- let resolve = this.pendingCommands.get(commandId).resolve;
123
- this.pendingCommands.delete(commandId);
124
- resolve(data.response);
125
- }
126
- else {
127
- log.error('Command failed: ', data);
128
- let reject = this.pendingCommands.get(commandId).reject;
129
- this.pendingCommands.delete(commandId);
130
- reject(new sessionerror_1.SessionError(data.response.statusText, data.response.status));
131
- }
132
- }
133
- }
134
- async getSessionContext() {
135
- const stream = await this.sessionStreamPromise;
136
- return stream.getContext();
137
- }
138
- async getSessionLinks() {
139
- const info = await this.sessionInfo.promise;
140
- return {
141
- publicChannelsUrl: this.config.baseUrl + info.links.publicChannelsUrl,
142
- myChannelsUrl: this.config.baseUrl + info.links.myChannelsUrl,
143
- typingUrl: this.config.baseUrl + info.links.typingUrl,
144
- syncListUrl: this.config.baseUrl + info.links.syncListUrl,
145
- usersUrl: this.config.baseUrl + info.links.usersUrl,
146
- mediaServiceUrl: info.links.mediaServiceUrl,
147
- mediaSetServiceUrl: info.links.mediaSetServiceUrl,
148
- messagesReceiptsUrl: this.config.baseUrl + info.links.messagesReceiptsUrl
149
- };
150
- }
151
- async getMediaLimits() {
152
- var _a, _b, _c, _d, _e;
153
- const DEFAULT_COUNT_LIMIT = 10;
154
- const DEFAULT_SIZE_LIMIT = 150;
155
- const DEFAULT_TYPES = ['text/plain', 'text/html'];
156
- const info = await this.sessionInfo.promise;
157
- return {
158
- mediaAttachmentsCountLimit: (_a = info.mediaAttachmentsCountLimit, (_a !== null && _a !== void 0 ? _a : DEFAULT_COUNT_LIMIT)),
159
- mediaAttachmentSizeLimitInMb: (_b = info.mediaAttachmentSizeLimitInMb, (_b !== null && _b !== void 0 ? _b : DEFAULT_SIZE_LIMIT)),
160
- mediaAttachmentsTotalSizeLimitInMb: (_c = info.mediaAttachmentsTotalSizeLimitInMb, (_c !== null && _c !== void 0 ? _c : DEFAULT_SIZE_LIMIT)),
161
- emailHistoriesAllowedMimeTypes: (_d = info.emailHistoriesAllowedMimeTypes, (_d !== null && _d !== void 0 ? _d : DEFAULT_TYPES)),
162
- emailBodiesAllowedMimeTypes: (_e = info.emailBodiesAllowedMimeTypes, (_e !== null && _e !== void 0 ? _e : DEFAULT_TYPES)),
163
- };
164
- }
165
- async getConversationsId() {
166
- const info = await this.sessionInfo.promise;
167
- return info.channels;
168
- }
169
- async getMyConversationsId() {
170
- const info = await this.sessionInfo.promise;
171
- return info.myChannels;
172
- }
173
- async getMaxUserInfosToSubscribe() {
174
- const info = await this.sessionInfo.promise;
175
- return this.config.userInfosToSubscribeOverride
176
- || info.userInfosToSubscribe
177
- || this.config.userInfosToSubscribeDefault;
178
- }
179
- async getUsersData() {
180
- const info = await this.sessionInfo.promise;
181
- return {
182
- user: info.userInfo,
183
- identity: info.identity
184
- };
185
- }
186
- async getConsumptionReportInterval() {
187
- let context = await this.getSessionContext();
188
- let consumptionIntervalToUse = this.config.consumptionReportIntervalOverride
189
- || context.consumptionReportInterval
190
- || this.config.consumptionReportIntervalDefault;
191
- try {
192
- return iso8601_duration_1.toSeconds(iso8601_duration_1.parse(consumptionIntervalToUse));
193
- }
194
- catch (e) {
195
- log.error('Failed to parse consumption report interval', consumptionIntervalToUse, 'using default value', this.config.consumptionReportIntervalDefault);
196
- return iso8601_duration_1.toSeconds(iso8601_duration_1.parse(this.config.consumptionReportIntervalDefault));
197
- }
198
- }
199
- async getHttpCacheInterval() {
200
- let context = await this.getSessionContext();
201
- let cacheIntervalToUse = this.config.httpCacheIntervalOverride
202
- || context.httpCacheInterval
203
- || this.config.httpCacheIntervalDefault;
204
- try {
205
- return iso8601_duration_1.toSeconds(iso8601_duration_1.parse(cacheIntervalToUse));
206
- }
207
- catch (e) {
208
- log.error('Failed to parse cache interval', cacheIntervalToUse, 'using default value', this.config.httpCacheIntervalDefault);
209
- return iso8601_duration_1.toSeconds(iso8601_duration_1.parse(this.config.httpCacheIntervalDefault));
210
- }
211
- }
212
- }
213
- exports.Session = Session;
@@ -1,12 +0,0 @@
1
- /**
2
- * @class
3
- * @classdesc Exception type for service-side errors.
4
- *
5
- * @property {Number} code - Error code
6
- * @property {String} message - Error description
7
- */
8
- declare class SessionError extends Error {
9
- code: number;
10
- constructor(message: string, code: number);
11
- }
12
- export { SessionError };
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- /**
4
- * @class
5
- * @classdesc Exception type for service-side errors.
6
- *
7
- * @property {Number} code - Error code
8
- * @property {String} message - Error description
9
- */
10
- class SessionError extends Error {
11
- constructor(message, code) {
12
- super();
13
- this.name = this.constructor.name;
14
- this.message = message;
15
- this.code = code;
16
- if (Error.captureStackTrace) {
17
- Error.captureStackTrace(this, this.constructor);
18
- }
19
- else {
20
- this.stack = (new Error()).stack;
21
- }
22
- }
23
- }
24
- exports.SessionError = SessionError;
package/lib/sri.json DELETED
@@ -1 +0,0 @@
1
- {"lib/aggregateddeliveryreceipt.js":"sha256-tZBQ/lAB8IeTHaNFIt9XIHubcnkiKHVfMhuvbtELTbE=","lib/client.js":"sha256-1+eda+gBlKXMxKIhIfDuYK5qv4bi6cQpIu7p3bgqMFQ=","lib/configuration.js":"sha256-Y3dGEJ1gnvTtjicgl8D+wpVylUw6emrGdQUYqr7nw88=","lib/conversation.js":"sha256-1BKCoU20Pa+dd22shsycH/yuNObw46tcJ1GV8dZB7Hc=","lib/detaileddeliveryreceipt.js":"sha256-I1Ah05qxwbGPpul2dzDl11COYdkK7YrCgxCZUPCv4u8=","lib/index.js":"sha256-mqKDgT4gOLAC3sSxHxHDRlnS/b9fKgadqSvG19SjpCg=","lib/logger.js":"sha256-/TclLyFDKBlD7lU4XYrJnBdiFD54Asggjo0Zleq5Czg=","lib/media.js":"sha256-W8AZ41hEGSD0wkiQclNCAeSTukeWP6916KtKesXDUes=","lib/message.js":"sha256-hZQaXRsKiuTpH7FpFF6MDVcnOLag4Nd6pjvey+8GH+k=","lib/participant.js":"sha256-RusrVQE1NGax5TkLxwjPSuRQvYqCYF/du2bZ/ti+1Rk=","lib/pushnotification.js":"sha256-Rn9S1xOTuiiKPA7RjyDU6J3ljk7ndPgFhk9ylcC4tHg=","lib/restpaginator.js":"sha256-BMuE+6NcX37g0MdiTgXeGX77N8W/mK34yFHkvJi2Vko=","lib/session.js":"sha256-EKdFzoysA+mNlWn1vl3ygIthtk3LICgAHcLhAdPepfc=","lib/sessionerror.js":"sha256-lLXyeBHSNiSHN0dQuf1CqGuIe2ZDtzqziVF5qw5cZrc=","lib/synclist.js":"sha256-8imXCECbLZRtsntAMQ0cOpsODWkaDpsCpgISfemKmMA=","lib/synclistdescriptor.js":"sha256-wYlF1ZO1Ym7fmnPEPqINTqh2v7J8QeMewq2lG5RwcOY=","lib/syncpaginator.js":"sha256-dUudOaWa4KtkkGLD5JQ5P6CnG7k6hWZc7TYiDfops34=","lib/user.js":"sha256-ywOp+b4ykyrvvtXT3/Q2WfXj+m5XqyT4sJOX4Xnp49E=","lib/data/conversations.js":"sha256-vqtqrviOA1Lu1Zs5kkJCxYiEMJAU1ARyJQ8pPih8t8U=","lib/data/messages.js":"sha256-4AAuZnIksjxJovLoXEryNwalwU1vc4ejKVe7wkkHUPc=","lib/data/participants.js":"sha256-4leIAa2PTifjJYL8dH4iQUtekBbazxFwVwai1tR0A/8=","lib/data/users.js":"sha256-A5rWRV7+HTPss6hwAD4Kc0Ftw4Apq387eSINv7IE/kE=","lib/interfaces/limits.js":"sha256-1DqoH1vIn6o1ng+XyBS6JRVVkf8Hj7ub/UD4x8loMjA=","lib/interfaces/notificationtypes.js":"sha256-WAl8kM1ex6Nbd6lPOftCvwMPJo+URQnvmKHPDfd6yDs=","lib/interfaces/paginator.js":"sha256-uR//QPr7gfI3ixd/1FIwpGlLmlNRwqgTPoAfun77Gko=","lib/interfaces/responsecodes.js":"sha256-q34uRlVfFCwfUCkrwctw/A8Vzpvv7MaFbGWHxHim7sI=","lib/interfaces/transport.js":"sha256-1DqoH1vIn6o1ng+XyBS6JRVVkf8Hj7ub/UD4x8loMjA=","lib/services/network.js":"sha256-mThXsnK8ElQQaTHPXAGnygeILG75LdId1ZsZh4ng5Wg=","lib/services/readhorizon.js":"sha256-V1uJfV6JE0147qzMsuyvJ1jhwl3OsaqxjZuBBQJNld8=","lib/services/typingindicator.js":"sha256-CC/NCUCq7UGo4ovq0wcTkuiZeLoPlKcd+wouF4+uEMQ=","lib/util/deferred.js":"sha256-l0iLU8vMjkjUuKe3K9AdMkwueBn5U7YqYBVF7HtvgTE=","lib/util/index.js":"sha256-+iOt9PFnO0/vcgK/UNfovsV3oUgoWdqXa9bZr34B8DA=","lib/aggregateddeliveryreceipt.d.ts":"sha256-ajq7Rbi1R+8G7W/0gU0WVe3eCdCaUX0czJNHtkWxL1s=","lib/client.d.ts":"sha256-uur1p6sYe2eVkLBL9lEcws3/jSRIRTN6Jo7JOidpdMQ=","lib/configuration.d.ts":"sha256-CmOTXgLl1OG0BX1Vs/iu20s50bPXrKoGsXjivFYs7EE=","lib/conversation.d.ts":"sha256-fb1jfULdMP/hladsV8FK9Fv4d1400otwuV5erm9D404=","lib/detaileddeliveryreceipt.d.ts":"sha256-G/Trfuxgt50CO5Ji+RjmVDV6iQ5RYH7cEdbUlikSR2A=","lib/index.d.ts":"sha256-lX8srbrNkAqWSxE75/tLnZAtnq2am2hlCuzsLTrJodI=","lib/logger.d.ts":"sha256-kUF94u2h0jfusrS8SDa4fcRIoSnjSu8TjjLq6DZ1m6E=","lib/media.d.ts":"sha256-W6iUaaC6oB2N31LeuhSGIATI9gj6I0epgHM3rlUBRbY=","lib/message.d.ts":"sha256-5IK5FeiACFD+8G2ynUvIdMLE04X7yhbALv8BTs5Toqg=","lib/participant.d.ts":"sha256-cwbtnenf4NpWtTs41o0q83hsVs/xEZII8irExprTDYI=","lib/pushnotification.d.ts":"sha256-HXSKgP5ugEsu/hc1uhdRmf6Sabx1ZYuYYiqhLbJ/JVI=","lib/restpaginator.d.ts":"sha256-qodsKOtWrit+kz1KEFHuKV7mYb7ZT5WE+zsUlb/nzLA=","lib/session.d.ts":"sha256-Z0OhsaoqsAj0STgR/lJ1Iw3uJlvoS0UIL6/xpSnDD9I=","lib/sessionerror.d.ts":"sha256-BT74HHKMz5+YbFiccJZWqRXSQI3YO+si+m70JISwsCs=","lib/synclist.d.ts":"sha256-Ds4L4ZiUjr0CT5RsW+Xt6B4hsPMAi/Jw6y/5Hr5NXZk=","lib/synclistdescriptor.d.ts":"sha256-Gp8slSSid6fLBUx8JV0InQMdB/INeTGTzGk6bhuQ+LY=","lib/syncpaginator.d.ts":"sha256-/oapr35TZjdoIhH74z+eozGdyt/4xugVh6C1nPORp4w=","lib/user.d.ts":"sha256-tJo2TLZVZSRdDbVsPCPL/wUyW/GF8ANuXd/+9IWWgpc=","lib/data/conversations.d.ts":"sha256-m91AZP8HBleYD3m+4PbHHaBewVU0cofCc4fl+XOI5xA=","lib/data/messages.d.ts":"sha256-e2akfAdCvYhpB1lVhdVOhVTKGFHmzqdU64+lwAtKjh4=","lib/data/participants.d.ts":"sha256-zaEs3VZpN5jjw1gXHFQmwQCBM3T5XXXAnfuR/ORu9oA=","lib/data/users.d.ts":"sha256-v1pcrJEJojRpaFH79QTmnBQ/U0xFucP/yx6vfIR6j7Y=","lib/interfaces/limits.d.ts":"sha256-88tiD25fd3zNaJt4znSC682bK+VKhjPG5rEgVbiAels=","lib/interfaces/notificationtypes.d.ts":"sha256-PnGFXum7KHnw98fA7ViQS2MXZFN5FlBUTZsqpXYMs9k=","lib/interfaces/paginator.d.ts":"sha256-q3RBDA/b3rQmqPTR9auCDxeEaco6wZt4uJRGHIplZYY=","lib/interfaces/responsecodes.d.ts":"sha256-n6RsEiBNV0Si/llOm8AFwEdhJIX66/FR3vubeKzMiKM=","lib/interfaces/transport.d.ts":"sha256-GzJszWUauuHnw7g2TnB23PazWxqH458VOBESAv5SPl4=","lib/services/network.d.ts":"sha256-p2KJNvXuZTSfUb/z8IOLoC1Hymv8nG9e2rApG25kfX0=","lib/services/readhorizon.d.ts":"sha256-Fjx+w8T+MoBiVzJf/zonKKc43ugUPnA/k0el4MW0b8U=","lib/services/typingindicator.d.ts":"sha256-a7kVyLOuDE99nEXEGo1q7mBct/ObQsHkQMrBvTvQKiY=","lib/util/deferred.d.ts":"sha256-2kmZDCogWutZlPi/y2BCHCksC6HZC03H06mESFQkUJs=","lib/util/index.d.ts":"sha256-J7UgmlE9ns0infheX8wN5KuT8lHMsKaE3EuId3FL2vs="}
package/lib/synclist.d.ts DELETED
@@ -1,24 +0,0 @@
1
- import { Network } from './services/network';
2
- import { Session } from './session';
3
- import { RestPaginator } from './restpaginator';
4
- import { SyncListDescriptor } from './synclistdescriptor';
5
- export interface SyncListServices {
6
- session: Session;
7
- network: Network;
8
- }
9
- /**
10
- * Provides async pagination interface for sync list
11
- *
12
- * @property {Network} network Network transport
13
- * @property {string} syncListUrl Url to the sync list endpoint
14
- */
15
- declare class SyncList {
16
- private readonly services;
17
- /**
18
- * @param {SyncListServices} services - services needed for SyncList service
19
- * @private
20
- */
21
- constructor(services: SyncListServices);
22
- getPage(args?: any): Promise<RestPaginator<SyncListDescriptor>>;
23
- }
24
- export { SyncList };
package/lib/synclist.js DELETED
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const index_1 = require("./util/index");
4
- const restpaginator_1 = require("./restpaginator");
5
- const synclistdescriptor_1 = require("./synclistdescriptor");
6
- /**
7
- * Provides async pagination interface for sync list
8
- *
9
- * @property {Network} network Network transport
10
- * @property {string} syncListUrl Url to the sync list endpoint
11
- */
12
- class SyncList {
13
- /**
14
- * @param {SyncListServices} services - services needed for SyncList service
15
- * @private
16
- */
17
- constructor(services) {
18
- this.services = services;
19
- }
20
- async getPage(args) {
21
- args = args || {};
22
- let links = await this.services.session.getSessionLinks();
23
- const url = new index_1.UriBuilder(links.syncListUrl).arg('PageToken', args.pageToken).build();
24
- let response = await this.services.network.get(url);
25
- return new restpaginator_1.RestPaginator(response.body.channels.map(x => new synclistdescriptor_1.SyncListDescriptor(x)), pageToken => this.getPage({ pageToken }), response.body.meta.previous_token, response.body.meta.next_token);
26
- }
27
- }
28
- exports.SyncList = SyncList;
@@ -1,27 +0,0 @@
1
- /**
2
- * Contains sync list item information.
3
- *
4
- * @property {string} channel_sid Conversation sid
5
- * @property {string} conversation Conversation entity name
6
- * @property {string} messages Conversation messages entity name
7
- * @property {string} roster Conversation roster entity name
8
- * @property {Number} lastReadMessageIndex Index of the last Message the User has read in this Conversation
9
-
10
- */
11
- import { Conversation } from './conversation';
12
- declare class SyncListDescriptor {
13
- readonly channel_sid: string;
14
- readonly status: string;
15
- readonly channel: string;
16
- readonly messages: string;
17
- readonly roster: string;
18
- readonly lastConsumedMessageIndex: number | null;
19
- readonly notificationLevel: Conversation.NotificationLevel;
20
- readonly descriptor: any;
21
- /**
22
- * @param {Object} descriptor - sync list descriptor data object
23
- * @private
24
- */
25
- constructor(descriptor: any);
26
- }
27
- export { SyncListDescriptor };