twilio-sync
Advanced tools
Comparing version 0.3.0-alpha.12 to 0.3.0-alpha.14
@@ -55,2 +55,6 @@ 'use strict'; | ||
var _logger = require('./logger'); | ||
var _logger2 = _interopRequireDefault(_logger); | ||
var _configuration = require('./configuration'); | ||
@@ -153,2 +157,10 @@ | ||
if (!token) { | ||
throw new Error('Sync library needs a valid Twilio token to be passed'); | ||
} | ||
if (options.hasOwnProperty('logLevel')) { | ||
_logger2.default.setLevel(options.logLevel); | ||
} | ||
var productId = options.productId || SYNC_PRODUCT_ID; | ||
@@ -272,2 +284,3 @@ options.twilsockClient = options.twilsockClient || new _twilsock2.default(token, options); | ||
* @return {Promise<Document>} | ||
* @public | ||
*/ | ||
@@ -300,2 +313,3 @@ | ||
* @return {Promise<Map>} | ||
* @public | ||
*/ | ||
@@ -328,2 +342,3 @@ | ||
* @return {Promise<List>} | ||
* @public | ||
*/ | ||
@@ -330,0 +345,0 @@ |
@@ -14,2 +14,6 @@ 'use strict'; | ||
exports.default = { | ||
setLevel: function setLevel(level) { | ||
_loglevel2.default.setLevel(level); | ||
}, | ||
trace: function trace() { | ||
@@ -16,0 +20,0 @@ _loglevel2.default.trace('Sync T: ', arguments); |
@@ -31,2 +31,6 @@ 'use strict'; | ||
var _logger = require('./logger'); | ||
var _logger2 = _interopRequireDefault(_logger); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -69,2 +73,3 @@ | ||
value: function get(uri) { | ||
_logger2.default.debug('GET ', uri, 'ID: ', this._headers['Twilio-Request-Id']); | ||
return this._transport.get(uri, this._headers); | ||
@@ -80,2 +85,3 @@ } | ||
_logger2.default.debug('POST ', uri, 'ID: ', this._headers['Twilio-Request-Id']); | ||
return this._transport.post(uri, headers, body); | ||
@@ -91,2 +97,3 @@ } | ||
_logger2.default.debug('PUT ', uri, 'ID: ', this._headers['Twilio-Request-Id']); | ||
return this._transport.put(uri, headers, body); | ||
@@ -97,2 +104,3 @@ } | ||
value: function _delete(uri) { | ||
_logger2.default.debug('DELETE ', uri, 'ID: ', this._headers['Twilio-Request-Id']); | ||
return this._transport.delete(uri, this._headers); | ||
@@ -99,0 +107,0 @@ } |
@@ -64,4 +64,7 @@ 'use strict'; | ||
* @property {Object} value Value of a document | ||
* | ||
* @fires Document#updated | ||
* @fires Document#updatedRemotely | ||
* @fires Document#removed | ||
* @fires Document#removedRemotely | ||
*/ | ||
@@ -101,5 +104,2 @@ var SyncDocument = function (_SyncEntity) { | ||
} }, | ||
revision: { enumerable: true, get: function get() { | ||
return _this._revision; | ||
} }, | ||
value: { enumerable: true, get: function get() { | ||
@@ -401,3 +401,3 @@ return _this._data; | ||
/** | ||
* Fired when document inner data changed | ||
* Fired when document value changed | ||
* @event Document#updated | ||
@@ -408,2 +408,8 @@ * @type {Object} | ||
/** | ||
* Fired when document value changed remotely | ||
* @event Document#updatedRemotely | ||
* @type {Object} | ||
*/ | ||
/** | ||
* Fired when document removed from server | ||
@@ -413,2 +419,7 @@ * @event Document#removed | ||
/** | ||
* Fired when document removed from server remotely | ||
* @event Document#removedRemotely | ||
*/ | ||
module.exports = exports['default']; |
@@ -79,6 +79,13 @@ 'use strict'; | ||
* @classdesc List collection to store an ordered list of values | ||
* @property {String} sid - List unique id | ||
* @property {String} uniqueName - List unique name | ||
* | ||
* @fires List#itemAdded | ||
* @fires List#itemAddedRemotely | ||
* @fires List#itemUpdated | ||
* @fires List#itemUpdatedRemotely | ||
* @fires List#itemRemoved | ||
* @fires List#itemRemovedRemotely | ||
* @fires List#collectionRemoved | ||
* @fires List#collectionRemovedRemotely | ||
*/ | ||
@@ -114,10 +121,11 @@ var SyncList = function (_SyncEntity) { | ||
uri: { get: function get() { | ||
return _this._descriptor.url; | ||
} }, | ||
sid: { enumerable: true, get: function get() { | ||
return _this._descriptor.sid; | ||
} }, | ||
uri: { enumerable: true, get: function get() { | ||
return _this._descriptor.url; | ||
} }, | ||
revision: { enumerable: true, get: function get() { | ||
return _this._revision; | ||
uniqueName: { enumerable: true, get: function get() { | ||
return _this._descriptor.uniqueName; | ||
} } | ||
@@ -584,3 +592,3 @@ }); | ||
/** | ||
* Fired when item is added to List | ||
* Fired when item is added to the List | ||
* @event List#itemAdded | ||
@@ -591,3 +599,9 @@ * @type {Item} Added item | ||
/** | ||
* Fired when item is added to List | ||
* Fired when item is added to List by remote actor | ||
* @event List#itemAddedRemotely | ||
* @type {Item} Added item | ||
*/ | ||
/** | ||
* Fired when item is updated | ||
* @event List#itemUpdated | ||
@@ -598,3 +612,9 @@ * @type {Item} Updated item | ||
/** | ||
* Fired when item is added to List | ||
* Fired when item is updated by remote actor | ||
* @event List#itemUpdatedRemotely | ||
* @type {Item} Updated item | ||
*/ | ||
/** | ||
* Fired when item is removed from the List | ||
* @event List#itemRemoved | ||
@@ -605,2 +625,8 @@ * @type {String} item key | ||
/** | ||
* Fired when item is removed from the List by remote actor | ||
* @event List#itemRemovedRemotely | ||
* @type {String} item key | ||
*/ | ||
/** | ||
* Fired when List is removed from server | ||
@@ -610,2 +636,7 @@ * @event List#collectionRemoved | ||
/** | ||
* Fired when List is removed from server by remote actor | ||
* @event List#collectionRemovedRemotely | ||
*/ | ||
module.exports = exports['default']; |
@@ -76,6 +76,12 @@ 'use strict'; | ||
* @property {String} sid - Map unique id | ||
* @property {String} uniqueName - Map unique name | ||
* | ||
* @fires Map#itemAdded | ||
* @fires Map#itemAddedRemotely | ||
* @fires Map#itemUpdated | ||
* @fires Map#itemUpdatedRemotely | ||
* @fires Map#itemRemoved | ||
* @fires Map#itemRemovedRemotely | ||
* @fires Map#collectionRemoved | ||
* @fires Map#collectionRemovedRemotely | ||
*/ | ||
@@ -113,10 +119,11 @@ var SyncMap = function (_SyncEntity) { | ||
uri: { get: function get() { | ||
return _this._descriptor.url; | ||
} }, | ||
sid: { enumerable: true, get: function get() { | ||
return _this._descriptor.sid; | ||
} }, | ||
uri: { enumerable: true, get: function get() { | ||
return _this._descriptor.url; | ||
} }, | ||
revision: { enumerable: true, get: function get() { | ||
return _this._revision; | ||
uniqueName: { enumerable: true, get: function get() { | ||
return _this._descriptor.uniqueName; | ||
} } | ||
@@ -706,3 +713,3 @@ }); | ||
/** | ||
* Fired when item is added to Map | ||
* Fired when item is added to the Map | ||
* @event Map#itemAdded | ||
@@ -713,3 +720,9 @@ * @type {Item} Added item | ||
/** | ||
* Fired when item is added to Map | ||
* Fired when item is added to the Map by remote actor | ||
* @event Map#itemAdded | ||
* @type {Item} Added item | ||
*/ | ||
/** | ||
* Fired when item is updated | ||
* @event Map#itemUpdated | ||
@@ -720,3 +733,9 @@ * @type {Item} Updated item | ||
/** | ||
* Fired when item is added to Map | ||
* Fired when item is updated by remote actor | ||
* @event Map#itemUpdatedRemotely | ||
* @type {Item} Updated item | ||
*/ | ||
/** | ||
* Fired when item is removed from the Map | ||
* @event Map#itemRemoved | ||
@@ -727,2 +746,8 @@ * @type {String} item key | ||
/** | ||
* Fired when item is removed from the Map by remote actor | ||
* @event Map#itemRemovedRemotely | ||
* @type {String} item key | ||
*/ | ||
/** | ||
* Fired when Map is removed from server | ||
@@ -732,2 +757,7 @@ * @event Map#collectionRemoved | ||
/** | ||
* Fired when Map is removed from server by remote actor | ||
* @event Map#collectionRemovedRemotely | ||
*/ | ||
module.exports = exports['default']; |
{ | ||
"name": "twilio-sync", | ||
"version": "0.3.0-alpha.12", | ||
"version": "0.3.0-alpha.14", | ||
"description": "Twilio Sync client library", | ||
@@ -20,3 +20,3 @@ "main": "lib/index.js", | ||
"twilio-notifications": "^0.2.0-alpha", | ||
"twilio-transport": "^0.0.4", | ||
"twilio-transport": "^0.0.5", | ||
"twilsock": "^0.2.0-alpha", | ||
@@ -23,0 +23,0 @@ "uuid": "^2.0.2" |
@@ -8,12 +8,14 @@ Twilio Sync JavaScript client library | ||
## Include library ## | ||
To use this library you will need an AccessManager from Twilio Common library. | ||
You may include it from CDN: | ||
## Obtaining token ## | ||
Check out the token session in documentation on the Twilio website | ||
## Using nodejs library ## | ||
``` | ||
<script src="https://media.twiliocdn.com/sdk/js/common/v0.1/twilio-common.js"></script> | ||
npm install --save twilio-sync | ||
``` | ||
Then include datasync lib on your page | ||
## Using prebuilt library on webpage ## | ||
Just include sync lib on your page | ||
``` | ||
<script type="text/javascript" src="https://media.twiliocdn.com/sdk/js/sync/v0.2/twilio-sync.js"></script> | ||
<script type="text/javascript" src="https://media.twiliocdn.com/sdk/js/sync/v0.3/twilio-sync.js"></script> | ||
``` | ||
@@ -24,5 +26,4 @@ | ||
``` | ||
var accessManager = new Twilio.AccessManager(token); | ||
var client = new Twilio.Sync.Client(accessManager); | ||
var client = new Twilio.Sync.Client(token); | ||
``` | ||
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
High entropy strings
Supply chain riskContains high entropy strings. This could be a sign of encrypted data, leaked secrets or obfuscated code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
28
2
2
677546
72
3927
+ Addedtwilio-transport@0.0.5(transitive)
- Removedtwilio-transport@0.0.4(transitive)
Updatedtwilio-transport@^0.0.5