@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.
- package/CHANGELOG.md +210 -0
- package/README.md +22 -17
- package/dist/browser.js +7873 -0
- package/dist/browser.js.map +1 -0
- package/dist/docs/assets/css/main.css +2660 -0
- package/dist/docs/assets/images/icons.png +0 -0
- package/dist/docs/assets/images/icons@2x.png +0 -0
- package/dist/docs/assets/images/widgets.png +0 -0
- package/dist/docs/assets/images/widgets@2x.png +0 -0
- package/dist/docs/assets/js/main.js +248 -0
- package/dist/docs/assets/js/search.js +1 -0
- package/dist/docs/classes/AggregatedDeliveryReceipt.html +3286 -0
- package/dist/docs/classes/Client.html +4181 -0
- package/dist/docs/classes/Conversation.html +4397 -0
- package/dist/docs/classes/DetailedDeliveryReceipt.html +3265 -0
- package/dist/docs/classes/Media.html +3295 -0
- package/dist/docs/classes/Message.html +3713 -0
- package/dist/docs/classes/MessageBuilder.html +3280 -0
- package/dist/docs/classes/Participant.html +3517 -0
- package/dist/docs/classes/PushNotification.html +3232 -0
- package/dist/docs/classes/RestPaginator.html +3262 -0
- package/dist/docs/classes/UnsentMessage.html +3144 -0
- package/dist/docs/classes/User.html +3451 -0
- package/dist/docs/index.html +3394 -212
- package/dist/docs/interfaces/ClientOptions.html +3136 -0
- package/dist/docs/interfaces/ConversationState.html +3152 -0
- package/dist/docs/interfaces/CreateConversationOptions.html +3168 -0
- package/dist/docs/interfaces/LastMessage.html +3152 -0
- package/dist/docs/interfaces/Paginator.html +3243 -0
- package/dist/docs/interfaces/PushNotificationData.html +3168 -0
- package/dist/docs/interfaces/SendEmailOptions.html +3136 -0
- package/dist/docs/interfaces/SendMediaOptions.html +3170 -0
- package/dist/docs/modules.html +3425 -0
- package/dist/lib.d.ts +1952 -0
- package/dist/lib.js +7873 -0
- package/dist/lib.js.map +1 -0
- package/dist/post-install.js +29 -0
- package/dist/react-native.js +4038 -0
- package/dist/react-native.js.map +1 -0
- package/dist/twilio-conversations.js +40912 -0
- package/dist/twilio-conversations.min.js +156 -0
- package/package.json +59 -48
- package/.circleci/config.yml +0 -650
- package/.deepsource.toml +0 -6
- package/.env.example +0 -13
- package/browser/aggregateddeliveryreceipt.js +0 -152
- package/browser/client.js +0 -991
- package/browser/configuration.js +0 -80
- package/browser/conversation.js +0 -1826
- package/browser/data/conversations.js +0 -632
- package/browser/data/messages.js +0 -522
- package/browser/data/participants.js +0 -411
- package/browser/data/users.js +0 -281
- package/browser/detaileddeliveryreceipt.js +0 -44
- package/browser/index.js +0 -4
- package/browser/interfaces/limits.js +0 -3
- package/browser/interfaces/notificationtypes.js +0 -21
- package/browser/interfaces/paginator.js +0 -53
- package/browser/interfaces/responsecodes.js +0 -20
- package/browser/interfaces/transport.js +0 -3
- package/browser/logger.js +0 -141
- package/browser/media.js +0 -198
- package/browser/message.js +0 -685
- package/browser/participant.js +0 -415
- package/browser/pushnotification.js +0 -49
- package/browser/restpaginator.js +0 -74
- package/browser/services/network.js +0 -223
- package/browser/services/readhorizon.js +0 -181
- package/browser/services/typingindicator.js +0 -142
- package/browser/session.js +0 -505
- package/browser/sessionerror.js +0 -93
- package/browser/sri.json +0 -1
- package/browser/synclist.js +0 -90
- package/browser/synclistdescriptor.js +0 -29
- package/browser/syncpaginator.js +0 -63
- package/browser/user.js +0 -431
- package/browser/util/deferred.js +0 -56
- package/browser/util/index.js +0 -108
- package/dist/@twilio/conversations.js +0 -35533
- package/dist/@twilio/conversations.min.js +0 -204
- package/dist/docs/AggregatedDeliveryReceipt.html +0 -948
- package/dist/docs/Client.html +0 -5075
- package/dist/docs/Conversation.html +0 -6018
- package/dist/docs/DetailedDeliveryReceipt.html +0 -641
- package/dist/docs/Media.html +0 -694
- package/dist/docs/Message.html +0 -1934
- package/dist/docs/Paginator.html +0 -605
- package/dist/docs/Participant.html +0 -1510
- package/dist/docs/PushNotification.html +0 -836
- package/dist/docs/SessionError.html +0 -379
- package/dist/docs/User.html +0 -1315
- package/dist/docs/classes.list.html +0 -4431
- package/dist/docs/fonts/glyphicons-halflings-regular.eot +0 -0
- package/dist/docs/fonts/glyphicons-halflings-regular.svg +0 -288
- package/dist/docs/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/dist/docs/fonts/glyphicons-halflings-regular.woff +0 -0
- package/dist/docs/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/dist/docs/img/glyphicons-halflings-white.png +0 -0
- package/dist/docs/img/glyphicons-halflings.png +0 -0
- package/dist/docs/quicksearch.html +0 -31
- package/dist/docs/scripts/docstrap.lib.js +0 -11
- package/dist/docs/scripts/fulltext-search-ui.js +0 -89
- package/dist/docs/scripts/fulltext-search.js +0 -36
- package/dist/docs/scripts/lunr.min.js +0 -6
- package/dist/docs/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/dist/docs/scripts/prettify/jquery.min.js +0 -6
- package/dist/docs/scripts/prettify/lang-css.js +0 -21
- package/dist/docs/scripts/prettify/prettify.js +0 -496
- package/dist/docs/scripts/sunlight.js +0 -1157
- package/dist/docs/scripts/toc.js +0 -203
- package/dist/docs/styles/darkstrap.css +0 -960
- package/dist/docs/styles/prettify-tomorrow.css +0 -132
- package/dist/docs/styles/site.cerulean.css +0 -7008
- package/dist/docs/styles/site.cosmo.css +0 -7061
- package/dist/docs/styles/site.cyborg.css +0 -7048
- package/dist/docs/styles/site.darkly.css +0 -7171
- package/dist/docs/styles/site.darkstrap.css +0 -5638
- package/dist/docs/styles/site.dibs-bootstrap.css +0 -5899
- package/dist/docs/styles/site.flatly.css +0 -7147
- package/dist/docs/styles/site.journal.css +0 -6973
- package/dist/docs/styles/site.lumen.css +0 -7298
- package/dist/docs/styles/site.paper.css +0 -7623
- package/dist/docs/styles/site.readable.css +0 -6997
- package/dist/docs/styles/site.sandstone.css +0 -7035
- package/dist/docs/styles/site.simplex.css +0 -7023
- package/dist/docs/styles/site.slate.css +0 -7343
- package/dist/docs/styles/site.spacelab.css +0 -7055
- package/dist/docs/styles/site.superhero.css +0 -7131
- package/dist/docs/styles/site.united.css +0 -6895
- package/dist/docs/styles/site.yeti.css +0 -7195
- package/dist/docs/styles/sunlight.dark.css +0 -345
- package/dist/docs/styles/sunlight.default.css +0 -344
- package/dist/sri.json +0 -1
- package/lib/aggregateddeliveryreceipt.d.ts +0 -98
- package/lib/aggregateddeliveryreceipt.js +0 -112
- package/lib/client.d.ts +0 -317
- package/lib/client.js +0 -633
- package/lib/configuration.d.ts +0 -21
- package/lib/configuration.js +0 -41
- package/lib/conversation.d.ts +0 -460
- package/lib/conversation.js +0 -940
- package/lib/data/conversations.d.ts +0 -57
- package/lib/data/conversations.js +0 -296
- package/lib/data/messages.d.ts +0 -75
- package/lib/data/messages.js +0 -208
- package/lib/data/participants.d.ts +0 -94
- package/lib/data/participants.js +0 -204
- package/lib/data/users.d.ts +0 -42
- package/lib/data/users.js +0 -113
- package/lib/detaileddeliveryreceipt.d.ts +0 -45
- package/lib/detaileddeliveryreceipt.js +0 -34
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -3
- package/lib/interfaces/limits.d.ts +0 -8
- package/lib/interfaces/limits.js +0 -2
- package/lib/interfaces/notificationtypes.d.ts +0 -8
- package/lib/interfaces/notificationtypes.js +0 -11
- package/lib/interfaces/paginator.d.ts +0 -52
- package/lib/interfaces/paginator.js +0 -28
- package/lib/interfaces/responsecodes.d.ts +0 -8
- package/lib/interfaces/responsecodes.js +0 -10
- package/lib/interfaces/transport.d.ts +0 -13
- package/lib/interfaces/transport.js +0 -2
- package/lib/logger.d.ts +0 -18
- package/lib/logger.js +0 -35
- package/lib/media.d.ts +0 -52
- package/lib/media.js +0 -69
- package/lib/message.d.ts +0 -136
- package/lib/message.js +0 -305
- package/lib/participant.d.ts +0 -142
- package/lib/participant.js +0 -219
- package/lib/pushnotification.d.ts +0 -48
- package/lib/pushnotification.js +0 -39
- package/lib/restpaginator.d.ts +0 -19
- package/lib/restpaginator.js +0 -36
- package/lib/services/network.d.ts +0 -22
- package/lib/services/network.js +0 -87
- package/lib/services/readhorizon.d.ts +0 -28
- package/lib/services/readhorizon.js +0 -112
- package/lib/services/typingindicator.d.ts +0 -50
- package/lib/services/typingindicator.js +0 -102
- package/lib/session.d.ts +0 -63
- package/lib/session.js +0 -213
- package/lib/sessionerror.d.ts +0 -12
- package/lib/sessionerror.js +0 -24
- package/lib/sri.json +0 -1
- package/lib/synclist.d.ts +0 -24
- package/lib/synclist.js +0 -28
- package/lib/synclistdescriptor.d.ts +0 -27
- package/lib/synclistdescriptor.js +0 -19
- package/lib/syncpaginator.d.ts +0 -22
- package/lib/syncpaginator.js +0 -37
- package/lib/user.d.ts +0 -98
- package/lib/user.js +0 -219
- package/lib/util/deferred.d.ts +0 -12
- package/lib/util/deferred.js +0 -22
- package/lib/util/index.d.ts +0 -28
- package/lib/util/index.js +0 -82
- package/tools/rtd-sdk-cdn-pin/.gitrepo +0 -12
- package/tools/rtd-sdk-cdn-pin/README.md +0 -54
- package/tools/rtd-sdk-cdn-pin/bintray-settings.xml.template +0 -16
- package/tools/rtd-sdk-cdn-pin/cdn-common/cdn-prepare.sh +0 -67
- package/tools/rtd-sdk-cdn-pin/cdn-pin-latest.sh +0 -19
- package/tools/rtd-sdk-cdn-pin/cdn-pin.sh +0 -19
- package/tools/rtd-sdk-cdn-pin/cdn-upload.sh +0 -13
- package/tools/rtd-sdk-cdn-pin/fetch/common/fetch-bintray-android.sh +0 -34
- package/tools/rtd-sdk-cdn-pin/fetch/common/fetch-npm.sh +0 -18
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-chat-android.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-chat-js.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-conversations-android.sh +0 -6
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-conversations-js.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-sync-android.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch/twilio-sync-js.sh +0 -5
- package/tools/rtd-sdk-cdn-pin/fetch-artifact.sh +0 -26
- package/tools/sdk-release-tool/.gitrepo +0 -12
- package/tools/sdk-release-tool/Makefile +0 -49
- package/tools/sdk-release-tool/README.md +0 -275
- package/tools/sdk-release-tool/delete +0 -3
- package/tools/sdk-release-tool/download +0 -3
- package/tools/sdk-release-tool/get-cors +0 -3
- package/tools/sdk-release-tool/list +0 -3
- package/tools/sdk-release-tool/pin +0 -3
- package/tools/sdk-release-tool/pin-latest +0 -3
- package/tools/sdk-release-tool/requirements.txt +0 -4
- package/tools/sdk-release-tool/sdk-release-tool +0 -3
- package/tools/sdk-release-tool/sdk_release_tools/__init__.py +0 -0
- package/tools/sdk-release-tool/sdk_release_tools/__main__.py +0 -110
- package/tools/sdk-release-tool/sdk_release_tools/aws.py +0 -70
- package/tools/sdk-release-tool/sdk_release_tools/cli.py +0 -181
- package/tools/sdk-release-tool/sdk_release_tools/log.py +0 -24
- package/tools/sdk-release-tool/sdk_release_tools/ops.py +0 -295
- package/tools/sdk-release-tool/sdk_release_tools/rpm.py +0 -28
- package/tools/sdk-release-tool/sdk_release_tools/util.py +0 -186
- package/tools/sdk-release-tool/sdk_release_tools/versions.py +0 -362
- package/tools/sdk-release-tool/signal-sdk-js.json +0 -28
- package/tools/sdk-release-tool/tests/test_versions.py +0 -94
- package/tools/sdk-release-tool/twilio-accessmanager-android.json +0 -19
- package/tools/sdk-release-tool/twilio-accessmanager-ios.json +0 -26
- package/tools/sdk-release-tool/twilio-auth-ios.json +0 -29
- package/tools/sdk-release-tool/twilio-authenticator-ios.json +0 -29
- package/tools/sdk-release-tool/twilio-chat-android-2.json +0 -19
- package/tools/sdk-release-tool/twilio-chat-android.json +0 -22
- package/tools/sdk-release-tool/twilio-chat-ios.json +0 -26
- package/tools/sdk-release-tool/twilio-chat-js.json +0 -27
- package/tools/sdk-release-tool/twilio-client-android-aar.json +0 -22
- package/tools/sdk-release-tool/twilio-client-android.json +0 -22
- package/tools/sdk-release-tool/twilio-client-ios.json +0 -20
- package/tools/sdk-release-tool/twilio-client-js.json +0 -17
- package/tools/sdk-release-tool/twilio-client-sounds-js.json +0 -14
- package/tools/sdk-release-tool/twilio-common-android-maven.json +0 -16
- package/tools/sdk-release-tool/twilio-common-android.json +0 -22
- package/tools/sdk-release-tool/twilio-common-ios-rtc.json +0 -25
- package/tools/sdk-release-tool/twilio-common-ios.json +0 -25
- package/tools/sdk-release-tool/twilio-common-js.json +0 -19
- package/tools/sdk-release-tool/twilio-conversations-android.json +0 -22
- package/tools/sdk-release-tool/twilio-conversations-ios.json +0 -26
- package/tools/sdk-release-tool/twilio-conversations-js.json +0 -27
- package/tools/sdk-release-tool/twilio-flex-js.json +0 -20
- package/tools/sdk-release-tool/twilio-flex-webchat-js.json +0 -16
- package/tools/sdk-release-tool/twilio-frame-chat-android.json +0 -22
- package/tools/sdk-release-tool/twilio-frame-chat-ios.json +0 -23
- package/tools/sdk-release-tool/twilio-frame-chat-js.json +0 -23
- package/tools/sdk-release-tool/twilio-ip-messaging-android-maven.json +0 -16
- package/tools/sdk-release-tool/twilio-ip-messaging-android.json +0 -22
- package/tools/sdk-release-tool/twilio-ip-messaging-ios.json +0 -25
- package/tools/sdk-release-tool/twilio-ip-messaging-js.json +0 -21
- package/tools/sdk-release-tool/twilio-sync-android.json +0 -22
- package/tools/sdk-release-tool/twilio-sync-ios.json +0 -26
- package/tools/sdk-release-tool/twilio-sync-js.json +0 -39
- package/tools/sdk-release-tool/twilio-taskrouter-js.json +0 -17
- package/tools/sdk-release-tool/twilio-video-android.json +0 -22
- package/tools/sdk-release-tool/twilio-video-cpp-linux-cross-rootfs.json +0 -13
- package/tools/sdk-release-tool/twilio-video-cpp.json +0 -33
- package/tools/sdk-release-tool/twilio-video-ios.json +0 -25
- package/tools/sdk-release-tool/twilio-video-js.json +0 -19
- package/tools/sdk-release-tool/twilio-video-jsdocs.json +0 -14
- package/tools/sdk-release-tool/twilio-voice-android.json +0 -22
- package/tools/sdk-release-tool/twilio-voice-ios.json +0 -29
- package/tools/sdk-release-tool/unpin +0 -3
- package/tools/sdk-release-tool/unpin-latest +0 -3
- package/tools/sdk-release-tool/upload +0 -3
- package/twilio-chat.js.iml +0 -9
package/browser/synclist.js
DELETED
@@ -1,90 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _regenerator = require("babel-runtime/regenerator");
|
4
|
-
|
5
|
-
var _regenerator2 = _interopRequireDefault(_regenerator);
|
6
|
-
|
7
|
-
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
|
8
|
-
|
9
|
-
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
10
|
-
|
11
|
-
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
12
|
-
|
13
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
14
|
-
|
15
|
-
var _createClass2 = require("babel-runtime/helpers/createClass");
|
16
|
-
|
17
|
-
var _createClass3 = _interopRequireDefault(_createClass2);
|
18
|
-
|
19
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
20
|
-
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
22
|
-
var index_1 = require("./util/index");
|
23
|
-
var restpaginator_1 = require("./restpaginator");
|
24
|
-
var synclistdescriptor_1 = require("./synclistdescriptor");
|
25
|
-
/**
|
26
|
-
* Provides async pagination interface for sync list
|
27
|
-
*
|
28
|
-
* @property {Network} network Network transport
|
29
|
-
* @property {string} syncListUrl Url to the sync list endpoint
|
30
|
-
*/
|
31
|
-
|
32
|
-
var SyncList = function () {
|
33
|
-
/**
|
34
|
-
* @param {SyncListServices} services - services needed for SyncList service
|
35
|
-
* @private
|
36
|
-
*/
|
37
|
-
function SyncList(services) {
|
38
|
-
(0, _classCallCheck3.default)(this, SyncList);
|
39
|
-
|
40
|
-
this.services = services;
|
41
|
-
}
|
42
|
-
|
43
|
-
(0, _createClass3.default)(SyncList, [{
|
44
|
-
key: "getPage",
|
45
|
-
value: function () {
|
46
|
-
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee(args) {
|
47
|
-
var _this = this;
|
48
|
-
|
49
|
-
var links, url, response;
|
50
|
-
return _regenerator2.default.wrap(function _callee$(_context) {
|
51
|
-
while (1) {
|
52
|
-
switch (_context.prev = _context.next) {
|
53
|
-
case 0:
|
54
|
-
args = args || {};
|
55
|
-
_context.next = 3;
|
56
|
-
return this.services.session.getSessionLinks();
|
57
|
-
|
58
|
-
case 3:
|
59
|
-
links = _context.sent;
|
60
|
-
url = new index_1.UriBuilder(links.syncListUrl).arg('PageToken', args.pageToken).build();
|
61
|
-
_context.next = 7;
|
62
|
-
return this.services.network.get(url);
|
63
|
-
|
64
|
-
case 7:
|
65
|
-
response = _context.sent;
|
66
|
-
return _context.abrupt("return", new restpaginator_1.RestPaginator(response.body.channels.map(function (x) {
|
67
|
-
return new synclistdescriptor_1.SyncListDescriptor(x);
|
68
|
-
}), function (pageToken) {
|
69
|
-
return _this.getPage({ pageToken: pageToken });
|
70
|
-
}, response.body.meta.previous_token, response.body.meta.next_token));
|
71
|
-
|
72
|
-
case 9:
|
73
|
-
case "end":
|
74
|
-
return _context.stop();
|
75
|
-
}
|
76
|
-
}
|
77
|
-
}, _callee, this);
|
78
|
-
}));
|
79
|
-
|
80
|
-
function getPage(_x) {
|
81
|
-
return _ref.apply(this, arguments);
|
82
|
-
}
|
83
|
-
|
84
|
-
return getPage;
|
85
|
-
}()
|
86
|
-
}]);
|
87
|
-
return SyncList;
|
88
|
-
}();
|
89
|
-
|
90
|
-
exports.SyncList = SyncList;
|
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
4
|
-
|
5
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
6
|
-
|
7
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
8
|
-
|
9
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
10
|
-
|
11
|
-
var SyncListDescriptor =
|
12
|
-
/**
|
13
|
-
* @param {Object} descriptor - sync list descriptor data object
|
14
|
-
* @private
|
15
|
-
*/
|
16
|
-
function SyncListDescriptor(descriptor) {
|
17
|
-
(0, _classCallCheck3.default)(this, SyncListDescriptor);
|
18
|
-
|
19
|
-
this.channel_sid = descriptor.channel_sid;
|
20
|
-
this.status = descriptor.status;
|
21
|
-
this.channel = descriptor.channel;
|
22
|
-
this.messages = descriptor.messages;
|
23
|
-
this.roster = descriptor.roster;
|
24
|
-
this.lastConsumedMessageIndex = descriptor.last_consumed_message_index;
|
25
|
-
this.notificationLevel = descriptor.notification_level;
|
26
|
-
this.descriptor = descriptor;
|
27
|
-
};
|
28
|
-
|
29
|
-
exports.SyncListDescriptor = SyncListDescriptor;
|
package/browser/syncpaginator.js
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
|
-
var _promise = require('babel-runtime/core-js/promise');
|
4
|
-
|
5
|
-
var _promise2 = _interopRequireDefault(_promise);
|
6
|
-
|
7
|
-
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
|
8
|
-
|
9
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
10
|
-
|
11
|
-
var _createClass2 = require('babel-runtime/helpers/createClass');
|
12
|
-
|
13
|
-
var _createClass3 = _interopRequireDefault(_createClass2);
|
14
|
-
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
|
-
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
/**
|
19
|
-
* @classdesc Pagination helper class for Sync
|
20
|
-
*
|
21
|
-
* @property {Array} items Array of elements on current page
|
22
|
-
* @property {boolean} hasNextPage
|
23
|
-
* @property {boolean} hasPrevPage
|
24
|
-
*/
|
25
|
-
|
26
|
-
var SyncPaginator = function () {
|
27
|
-
/**
|
28
|
-
* @param {Array} items Array of element for current page
|
29
|
-
* @param {Object} params
|
30
|
-
*/
|
31
|
-
function SyncPaginator(items, pageSize, anchor, direction, source) {
|
32
|
-
(0, _classCallCheck3.default)(this, SyncPaginator);
|
33
|
-
|
34
|
-
this.hasNextPage = direction === 'backwards' ? anchor !== 'end' : items.length === pageSize;
|
35
|
-
this.hasPrevPage = direction === 'backwards' ? items.length === pageSize && items.length > 0 && items[0].index !== 0 : anchor !== 'end';
|
36
|
-
this.state = {
|
37
|
-
source: source,
|
38
|
-
nextPageArgs: this.hasNextPage ? [pageSize, items[items.length - 1].index, 'forward'] : null,
|
39
|
-
prevPageArgs: this.hasPrevPage ? [pageSize, items.length > 0 ? items[0].index : 'end', 'backwards'] : null,
|
40
|
-
items: items
|
41
|
-
};
|
42
|
-
}
|
43
|
-
|
44
|
-
(0, _createClass3.default)(SyncPaginator, [{
|
45
|
-
key: 'nextPage',
|
46
|
-
value: function nextPage() {
|
47
|
-
return this.hasNextPage ? this.state.source.apply(null, this.state.nextPageArgs) : _promise2.default.reject(new Error('No next page for query'));
|
48
|
-
}
|
49
|
-
}, {
|
50
|
-
key: 'prevPage',
|
51
|
-
value: function prevPage() {
|
52
|
-
return this.hasPrevPage ? this.state.source.apply(null, this.state.prevPageArgs) : _promise2.default.reject(new Error('No prev page for query'));
|
53
|
-
}
|
54
|
-
}, {
|
55
|
-
key: 'items',
|
56
|
-
get: function get() {
|
57
|
-
return this.state.items;
|
58
|
-
}
|
59
|
-
}]);
|
60
|
-
return SyncPaginator;
|
61
|
-
}();
|
62
|
-
|
63
|
-
exports.SyncPaginator = SyncPaginator;
|
package/browser/user.js
DELETED
@@ -1,431 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _stringify = require("babel-runtime/core-js/json/stringify");
|
4
|
-
|
5
|
-
var _stringify2 = _interopRequireDefault(_stringify);
|
6
|
-
|
7
|
-
var _regenerator = require("babel-runtime/regenerator");
|
8
|
-
|
9
|
-
var _regenerator2 = _interopRequireDefault(_regenerator);
|
10
|
-
|
11
|
-
var _asyncToGenerator2 = require("babel-runtime/helpers/asyncToGenerator");
|
12
|
-
|
13
|
-
var _asyncToGenerator3 = _interopRequireDefault(_asyncToGenerator2);
|
14
|
-
|
15
|
-
var _promise = require("babel-runtime/core-js/promise");
|
16
|
-
|
17
|
-
var _promise2 = _interopRequireDefault(_promise);
|
18
|
-
|
19
|
-
var _getPrototypeOf = require("babel-runtime/core-js/object/get-prototype-of");
|
20
|
-
|
21
|
-
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf);
|
22
|
-
|
23
|
-
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
24
|
-
|
25
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
26
|
-
|
27
|
-
var _createClass2 = require("babel-runtime/helpers/createClass");
|
28
|
-
|
29
|
-
var _createClass3 = _interopRequireDefault(_createClass2);
|
30
|
-
|
31
|
-
var _possibleConstructorReturn2 = require("babel-runtime/helpers/possibleConstructorReturn");
|
32
|
-
|
33
|
-
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
|
34
|
-
|
35
|
-
var _inherits2 = require("babel-runtime/helpers/inherits");
|
36
|
-
|
37
|
-
var _inherits3 = _interopRequireDefault(_inherits2);
|
38
|
-
|
39
|
-
var _metadata = require("babel-runtime/core-js/reflect/metadata");
|
40
|
-
|
41
|
-
var _metadata2 = _interopRequireDefault(_metadata);
|
42
|
-
|
43
|
-
var _defineProperty = require("babel-runtime/core-js/object/define-property");
|
44
|
-
|
45
|
-
var _defineProperty2 = _interopRequireDefault(_defineProperty);
|
46
|
-
|
47
|
-
var _typeof2 = require("babel-runtime/helpers/typeof");
|
48
|
-
|
49
|
-
var _typeof3 = _interopRequireDefault(_typeof2);
|
50
|
-
|
51
|
-
var _getOwnPropertyDescriptor = require("babel-runtime/core-js/object/get-own-property-descriptor");
|
52
|
-
|
53
|
-
var _getOwnPropertyDescriptor2 = _interopRequireDefault(_getOwnPropertyDescriptor);
|
54
|
-
|
55
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
56
|
-
|
57
|
-
var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) {
|
58
|
-
var c = arguments.length,
|
59
|
-
r = c < 3 ? target : desc === null ? desc = (0, _getOwnPropertyDescriptor2.default)(target, key) : desc,
|
60
|
-
d;
|
61
|
-
if ((typeof Reflect === "undefined" ? "undefined" : (0, _typeof3.default)(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
|
62
|
-
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
63
|
-
}return c > 3 && r && (0, _defineProperty2.default)(target, key, r), r;
|
64
|
-
};
|
65
|
-
var __metadata = undefined && undefined.__metadata || function (k, v) {
|
66
|
-
if ((typeof Reflect === "undefined" ? "undefined" : (0, _typeof3.default)(Reflect)) === "object" && typeof _metadata2.default === "function") return (0, _metadata2.default)(k, v);
|
67
|
-
};
|
68
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
69
|
-
var events_1 = require("events");
|
70
|
-
var logger_1 = require("./logger");
|
71
|
-
var util_1 = require("./util");
|
72
|
-
var twilio_sdk_type_validator_1 = require("twilio-sdk-type-validator");
|
73
|
-
var log = logger_1.Logger.scope('User');
|
74
|
-
/**
|
75
|
-
* @classdesc Extended user information.
|
76
|
-
* Note that <code>isOnline</code> and <code>isNotifiable</code> properties are eligible
|
77
|
-
* to use only if reachability function is enabled.
|
78
|
-
* You may check if it is enabled by reading value of {@link Client}'s <code>reachabilityEnabled</code> property.
|
79
|
-
*
|
80
|
-
* @property {String} identity - User identity
|
81
|
-
* @property {String} friendlyName - User friendly name, null if not set
|
82
|
-
* @property {any} attributes - Object with custom attributes for user
|
83
|
-
* @property {Boolean} isOnline - User real-time conversation connection status
|
84
|
-
* @property {Boolean} isNotifiable - User push notification registration status
|
85
|
-
* @property {Boolean} isSubscribed - Check if this user receives real-time status updates
|
86
|
-
*
|
87
|
-
* @fires User#updated
|
88
|
-
* @fires User#userSubscribed
|
89
|
-
* @fires User#userUnsubscribed
|
90
|
-
*
|
91
|
-
* @constructor
|
92
|
-
* @param {String} identity - Identity of user
|
93
|
-
* @param {String} entityId - id of user's object
|
94
|
-
* @param {Object} datasync - datasync service
|
95
|
-
* @param {Object} session - session service
|
96
|
-
*/
|
97
|
-
|
98
|
-
var User = function (_events_1$EventEmitte) {
|
99
|
-
(0, _inherits3.default)(User, _events_1$EventEmitte);
|
100
|
-
|
101
|
-
/**
|
102
|
-
* The update reason for <code>updated</code> event emitted on User
|
103
|
-
* @typedef {('friendlyName' | 'attributes' | 'reachabilityOnline' | 'reachabilityNotifiable')} User#UpdateReason
|
104
|
-
*/
|
105
|
-
function User(identity, entityName, services) {
|
106
|
-
(0, _classCallCheck3.default)(this, User);
|
107
|
-
|
108
|
-
var _this = (0, _possibleConstructorReturn3.default)(this, (User.__proto__ || (0, _getPrototypeOf2.default)(User)).call(this));
|
109
|
-
|
110
|
-
_this.subscribed = 'initializing';
|
111
|
-
_this.setMaxListeners(0);
|
112
|
-
_this.services = services;
|
113
|
-
_this.state = {
|
114
|
-
identity: identity,
|
115
|
-
entityName: entityName,
|
116
|
-
friendlyName: null,
|
117
|
-
attributes: {},
|
118
|
-
online: null,
|
119
|
-
notifiable: null
|
120
|
-
};
|
121
|
-
return _this;
|
122
|
-
}
|
123
|
-
|
124
|
-
(0, _createClass3.default)(User, [{
|
125
|
-
key: "_update",
|
126
|
-
|
127
|
-
// Handles service updates
|
128
|
-
value: function _update(key, value) {
|
129
|
-
var updateReasons = [];
|
130
|
-
log.debug('User for', this.state.identity, 'updated:', key, value);
|
131
|
-
switch (key) {
|
132
|
-
case 'friendlyName':
|
133
|
-
if (this.state.friendlyName !== value.value) {
|
134
|
-
updateReasons.push('friendlyName');
|
135
|
-
this.state.friendlyName = value.value;
|
136
|
-
}
|
137
|
-
break;
|
138
|
-
case 'attributes':
|
139
|
-
var updateAttributes = util_1.parseAttributes(value.value, "Retrieved malformed attributes from the server for user: " + this.state.identity, log);
|
140
|
-
if (!util_1.isDeepEqual(this.state.attributes, updateAttributes)) {
|
141
|
-
this.state.attributes = updateAttributes;
|
142
|
-
updateReasons.push('attributes');
|
143
|
-
}
|
144
|
-
break;
|
145
|
-
case 'reachability':
|
146
|
-
if (this.state.online !== value.online) {
|
147
|
-
this.state.online = value.online;
|
148
|
-
updateReasons.push('reachabilityOnline');
|
149
|
-
}
|
150
|
-
if (this.state.notifiable !== value.notifiable) {
|
151
|
-
this.state.notifiable = value.notifiable;
|
152
|
-
updateReasons.push('reachabilityNotifiable');
|
153
|
-
}
|
154
|
-
break;
|
155
|
-
default:
|
156
|
-
return;
|
157
|
-
}
|
158
|
-
if (updateReasons.length > 0) {
|
159
|
-
this.emit('updated', { user: this, updateReasons: updateReasons });
|
160
|
-
}
|
161
|
-
}
|
162
|
-
// Fetch reachability info
|
163
|
-
|
164
|
-
}, {
|
165
|
-
key: "_updateReachabilityInfo",
|
166
|
-
value: function _updateReachabilityInfo(map, update) {
|
167
|
-
var _this2 = this;
|
168
|
-
|
169
|
-
if (!this.services.session.reachabilityEnabled) {
|
170
|
-
return _promise2.default.resolve();
|
171
|
-
}
|
172
|
-
return map.get('reachability').then(update).catch(function (err) {
|
173
|
-
log.warn('Failed to get reachability info for ', _this2.state.identity, err);
|
174
|
-
});
|
175
|
-
}
|
176
|
-
// Fetch user
|
177
|
-
|
178
|
-
}, {
|
179
|
-
key: "_fetch",
|
180
|
-
value: function () {
|
181
|
-
var _ref = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee() {
|
182
|
-
var _this3 = this;
|
183
|
-
|
184
|
-
return _regenerator2.default.wrap(function _callee$(_context) {
|
185
|
-
while (1) {
|
186
|
-
switch (_context.prev = _context.next) {
|
187
|
-
case 0:
|
188
|
-
if (this.state.entityName) {
|
189
|
-
_context.next = 2;
|
190
|
-
break;
|
191
|
-
}
|
192
|
-
|
193
|
-
return _context.abrupt("return", this);
|
194
|
-
|
195
|
-
case 2:
|
196
|
-
this.promiseToFetch = this.services.syncClient.map({ id: this.state.entityName, mode: 'open_existing', includeItems: true }).then(function (map) {
|
197
|
-
_this3.entity = map;
|
198
|
-
map.on('itemUpdated', function (args) {
|
199
|
-
log.debug(_this3.state.entityName + ' (' + _this3.state.identity + ') itemUpdated: ' + args.item.key);
|
200
|
-
return _this3._update(args.item.key, args.item.data);
|
201
|
-
});
|
202
|
-
return _promise2.default.all([map.get('friendlyName').then(function (item) {
|
203
|
-
return _this3._update(item.key, item.data);
|
204
|
-
}), map.get('attributes').then(function (item) {
|
205
|
-
return _this3._update(item.key, item.data);
|
206
|
-
}), _this3._updateReachabilityInfo(map, function (item) {
|
207
|
-
return _this3._update(item.key, item.data);
|
208
|
-
})]);
|
209
|
-
}).then(function () {
|
210
|
-
log.debug('Fetched for', _this3.identity);
|
211
|
-
_this3.subscribed = 'subscribed';
|
212
|
-
_this3.emit('userSubscribed', _this3);
|
213
|
-
return _this3;
|
214
|
-
}).catch(function (err) {
|
215
|
-
_this3.promiseToFetch = null;
|
216
|
-
throw err;
|
217
|
-
});
|
218
|
-
return _context.abrupt("return", this.promiseToFetch);
|
219
|
-
|
220
|
-
case 4:
|
221
|
-
case "end":
|
222
|
-
return _context.stop();
|
223
|
-
}
|
224
|
-
}
|
225
|
-
}, _callee, this);
|
226
|
-
}));
|
227
|
-
|
228
|
-
function _fetch() {
|
229
|
-
return _ref.apply(this, arguments);
|
230
|
-
}
|
231
|
-
|
232
|
-
return _fetch;
|
233
|
-
}()
|
234
|
-
}, {
|
235
|
-
key: "_ensureFetched",
|
236
|
-
value: function _ensureFetched() {
|
237
|
-
return this.promiseToFetch || this._fetch();
|
238
|
-
}
|
239
|
-
/**
|
240
|
-
* Updates user attributes.
|
241
|
-
* @param {any} attributes new attributes for User.
|
242
|
-
* @returns {Promise<User>}
|
243
|
-
*/
|
244
|
-
|
245
|
-
}, {
|
246
|
-
key: "updateAttributes",
|
247
|
-
value: function () {
|
248
|
-
var _ref2 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee2(attributes) {
|
249
|
-
return _regenerator2.default.wrap(function _callee2$(_context2) {
|
250
|
-
while (1) {
|
251
|
-
switch (_context2.prev = _context2.next) {
|
252
|
-
case 0:
|
253
|
-
if (!(this.subscribed == 'unsubscribed')) {
|
254
|
-
_context2.next = 2;
|
255
|
-
break;
|
256
|
-
}
|
257
|
-
|
258
|
-
throw new Error('Can\'t modify unsubscribed object');
|
259
|
-
|
260
|
-
case 2:
|
261
|
-
_context2.next = 4;
|
262
|
-
return this.services.session.addCommand('editUserAttributes', {
|
263
|
-
username: this.state.identity,
|
264
|
-
attributes: (0, _stringify2.default)(attributes)
|
265
|
-
});
|
266
|
-
|
267
|
-
case 4:
|
268
|
-
return _context2.abrupt("return", this);
|
269
|
-
|
270
|
-
case 5:
|
271
|
-
case "end":
|
272
|
-
return _context2.stop();
|
273
|
-
}
|
274
|
-
}
|
275
|
-
}, _callee2, this);
|
276
|
-
}));
|
277
|
-
|
278
|
-
function updateAttributes(_x) {
|
279
|
-
return _ref2.apply(this, arguments);
|
280
|
-
}
|
281
|
-
|
282
|
-
return updateAttributes;
|
283
|
-
}()
|
284
|
-
/**
|
285
|
-
* Update Users friendlyName.
|
286
|
-
* @param {String|null} friendlyName - Updated friendlyName
|
287
|
-
* @returns {Promise<User>}
|
288
|
-
*/
|
289
|
-
|
290
|
-
}, {
|
291
|
-
key: "updateFriendlyName",
|
292
|
-
value: function () {
|
293
|
-
var _ref3 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee3(friendlyName) {
|
294
|
-
return _regenerator2.default.wrap(function _callee3$(_context3) {
|
295
|
-
while (1) {
|
296
|
-
switch (_context3.prev = _context3.next) {
|
297
|
-
case 0:
|
298
|
-
if (!(this.subscribed == 'unsubscribed')) {
|
299
|
-
_context3.next = 2;
|
300
|
-
break;
|
301
|
-
}
|
302
|
-
|
303
|
-
throw new Error('Can\'t modify unsubscribed object');
|
304
|
-
|
305
|
-
case 2:
|
306
|
-
_context3.next = 4;
|
307
|
-
return this.services.session.addCommand('editUserFriendlyName', {
|
308
|
-
username: this.state.identity,
|
309
|
-
friendlyName: friendlyName
|
310
|
-
});
|
311
|
-
|
312
|
-
case 4:
|
313
|
-
return _context3.abrupt("return", this);
|
314
|
-
|
315
|
-
case 5:
|
316
|
-
case "end":
|
317
|
-
return _context3.stop();
|
318
|
-
}
|
319
|
-
}
|
320
|
-
}, _callee3, this);
|
321
|
-
}));
|
322
|
-
|
323
|
-
function updateFriendlyName(_x2) {
|
324
|
-
return _ref3.apply(this, arguments);
|
325
|
-
}
|
326
|
-
|
327
|
-
return updateFriendlyName;
|
328
|
-
}()
|
329
|
-
/**
|
330
|
-
* Removes User from subscription list.
|
331
|
-
* @returns {Promise<void>} Promise of completion
|
332
|
-
*/
|
333
|
-
|
334
|
-
}, {
|
335
|
-
key: "unsubscribe",
|
336
|
-
value: function () {
|
337
|
-
var _ref4 = (0, _asyncToGenerator3.default)( /*#__PURE__*/_regenerator2.default.mark(function _callee4() {
|
338
|
-
return _regenerator2.default.wrap(function _callee4$(_context4) {
|
339
|
-
while (1) {
|
340
|
-
switch (_context4.prev = _context4.next) {
|
341
|
-
case 0:
|
342
|
-
if (!this.promiseToFetch) {
|
343
|
-
_context4.next = 7;
|
344
|
-
break;
|
345
|
-
}
|
346
|
-
|
347
|
-
_context4.next = 3;
|
348
|
-
return this.promiseToFetch;
|
349
|
-
|
350
|
-
case 3:
|
351
|
-
this.entity.close();
|
352
|
-
this.promiseToFetch = null;
|
353
|
-
this.subscribed = 'unsubscribed';
|
354
|
-
this.emit('userUnsubscribed', this);
|
355
|
-
|
356
|
-
case 7:
|
357
|
-
case "end":
|
358
|
-
return _context4.stop();
|
359
|
-
}
|
360
|
-
}
|
361
|
-
}, _callee4, this);
|
362
|
-
}));
|
363
|
-
|
364
|
-
function unsubscribe() {
|
365
|
-
return _ref4.apply(this, arguments);
|
366
|
-
}
|
367
|
-
|
368
|
-
return unsubscribe;
|
369
|
-
}()
|
370
|
-
}, {
|
371
|
-
key: "identity",
|
372
|
-
get: function get() {
|
373
|
-
return this.state.identity;
|
374
|
-
},
|
375
|
-
set: function set(identity) {
|
376
|
-
this.state.identity = identity;
|
377
|
-
}
|
378
|
-
}, {
|
379
|
-
key: "entityName",
|
380
|
-
set: function set(name) {
|
381
|
-
this.state.entityName = name;
|
382
|
-
}
|
383
|
-
}, {
|
384
|
-
key: "attributes",
|
385
|
-
get: function get() {
|
386
|
-
return this.state.attributes;
|
387
|
-
}
|
388
|
-
}, {
|
389
|
-
key: "friendlyName",
|
390
|
-
get: function get() {
|
391
|
-
return this.state.friendlyName;
|
392
|
-
}
|
393
|
-
}, {
|
394
|
-
key: "isOnline",
|
395
|
-
get: function get() {
|
396
|
-
return this.state.online;
|
397
|
-
}
|
398
|
-
}, {
|
399
|
-
key: "isNotifiable",
|
400
|
-
get: function get() {
|
401
|
-
return this.state.notifiable;
|
402
|
-
}
|
403
|
-
}, {
|
404
|
-
key: "isSubscribed",
|
405
|
-
get: function get() {
|
406
|
-
return this.subscribed == 'subscribed';
|
407
|
-
}
|
408
|
-
}]);
|
409
|
-
return User;
|
410
|
-
}(events_1.EventEmitter);
|
411
|
-
|
412
|
-
__decorate([twilio_sdk_type_validator_1.validateTypesAsync(['string', 'number', 'boolean', 'object', twilio_sdk_type_validator_1.literal(null)]), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", _promise2.default)], User.prototype, "updateAttributes", null);
|
413
|
-
__decorate([twilio_sdk_type_validator_1.validateTypesAsync(['string', twilio_sdk_type_validator_1.literal(null)]), __metadata("design:type", Function), __metadata("design:paramtypes", [String]), __metadata("design:returntype", _promise2.default)], User.prototype, "updateFriendlyName", null);
|
414
|
-
exports.User = User;
|
415
|
-
/**
|
416
|
-
* Fired when User's properties or reachability status have been updated.
|
417
|
-
* @event User#updated
|
418
|
-
* @type {Object}
|
419
|
-
* @property {User} user - Updated User
|
420
|
-
* @property {User#UpdateReason[]} updateReasons - Array of User's updated event reasons
|
421
|
-
*/
|
422
|
-
/**
|
423
|
-
* Fired when Client is subscribed to User.
|
424
|
-
* @event User#userSubscribed
|
425
|
-
* @type {User}
|
426
|
-
*/
|
427
|
-
/**
|
428
|
-
* Fired when Client is unsubscribed from this User.
|
429
|
-
* @event User#userUnsubscribed
|
430
|
-
* @type {User}
|
431
|
-
*/
|
package/browser/util/deferred.js
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
var _promise = require("babel-runtime/core-js/promise");
|
4
|
-
|
5
|
-
var _promise2 = _interopRequireDefault(_promise);
|
6
|
-
|
7
|
-
var _classCallCheck2 = require("babel-runtime/helpers/classCallCheck");
|
8
|
-
|
9
|
-
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
|
10
|
-
|
11
|
-
var _createClass2 = require("babel-runtime/helpers/createClass");
|
12
|
-
|
13
|
-
var _createClass3 = _interopRequireDefault(_createClass2);
|
14
|
-
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
|
-
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
18
|
-
|
19
|
-
var Deferred = function () {
|
20
|
-
function Deferred() {
|
21
|
-
var _this = this;
|
22
|
-
|
23
|
-
(0, _classCallCheck3.default)(this, Deferred);
|
24
|
-
|
25
|
-
this._promise = new _promise2.default(function (resolve, reject) {
|
26
|
-
_this._resolve = resolve;
|
27
|
-
_this._reject = reject;
|
28
|
-
});
|
29
|
-
}
|
30
|
-
|
31
|
-
(0, _createClass3.default)(Deferred, [{
|
32
|
-
key: "update",
|
33
|
-
value: function update(value) {
|
34
|
-
this._resolve(value);
|
35
|
-
}
|
36
|
-
}, {
|
37
|
-
key: "set",
|
38
|
-
value: function set(value) {
|
39
|
-
this.current = value;
|
40
|
-
this._resolve(value);
|
41
|
-
}
|
42
|
-
}, {
|
43
|
-
key: "fail",
|
44
|
-
value: function fail(e) {
|
45
|
-
this._reject(e);
|
46
|
-
}
|
47
|
-
}, {
|
48
|
-
key: "promise",
|
49
|
-
get: function get() {
|
50
|
-
return this._promise;
|
51
|
-
}
|
52
|
-
}]);
|
53
|
-
return Deferred;
|
54
|
-
}();
|
55
|
-
|
56
|
-
exports.Deferred = Deferred;
|