New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

absync

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

absync - npm Package Compare versions

Comparing version 2.3.0 to 2.4.0

.gitattributes

2

package.json
{
"name": "absync",
"version": "2.3.0",
"version": "2.4.0",
"description": "absync",

@@ -5,0 +5,0 @@ "main": "dist/development/absync.concat.js",

@@ -104,3 +104,5 @@ /* globals angular */

absync.on( configuration.entityName, self.__onEntityOnWebsocket.bind( self ) );
absync.on( configuration.collectionName, self.__onCollectionOnWebsocket.bind( self ) );
if( configuration.collectionName ) {
absync.on( configuration.collectionName, self.__onCollectionOnWebsocket.bind( self ) );
}

@@ -110,3 +112,5 @@ // Now we listen on the root scope for the same events we're firing above.

$rootScope.$on( configuration.entityName, self.__onEntityReceived.bind( self ) );
$rootScope.$on( configuration.collectionName, self.__onCollectionReceived.bind( self ) );
if( configuration.collectionName ) {
$rootScope.$on( configuration.collectionName, self.__onCollectionReceived.bind( self ) );
}

@@ -230,3 +234,3 @@ // Wait for data to be available.

* @param {Boolean} [forceReload=false] Should the data be loaded, even if the service already has a local cache?
* @returns {Promise<Array<configuration.model>>|IPromise<Array>|IPromise<void>|Q.Promise<Array<configuration.model>>}
* @returns {Promise<Array<configuration.model>>|IPromise<Array>|IPromise<void>|Q.Promise<Array<configuration.model>>|angular.IPromise<TResult>}
*/

@@ -328,3 +332,3 @@ CacheService.prototype.ensureLoaded = function CacheService$ensureLoaded( forceReload ) {

* @param {Boolean} [forceReload=false] Should the entity be retrieved from the server, even if it is already in the cache?
* @returns {Promise<configuration.model>|IPromise<TResult>|IPromise<void>}
* @returns {Promise<configuration.model>|IPromise<TResult>|IPromise<void>|angular.IPromise<TResult>}
*/

@@ -387,3 +391,3 @@ CacheService.prototype.read = function CacheService$read( id, forceReload ) {

* @param {String} id The ID of the entity.
* @returns {Promise<configuration.model>|IPromise<TResult>|IPromise<void>}
* @returns {Promise<configuration.model>|IPromise<TResult>|IPromise<void>|angular.IPromise<TResult>}
* @private

@@ -421,3 +425,3 @@ */

* @param {configuration.model} entity
* @return {Promise<configuration.model>|IPromise<TResult>} A promise that will be resolved with the updated entity.
* @return {Promise<configuration.model>|IPromise<TResult>|angular.IPromise<TResult>} A promise that will be resolved with the updated entity.
*/

@@ -440,3 +444,3 @@ CacheService.prototype.update = function CacheService$update( entity ) {

.put( configuration.entityUri + "/" + entity.id, wrappedEntity )
.then( afterEntityStored, onEntityStorageFailure );
.then( afterEntityStored.bind( self ), onEntityStorageFailure.bind( self ) );

@@ -447,34 +451,26 @@ } else {

.post( configuration.collectionUri, wrappedEntity )
.then( afterEntityStored, onEntityStorageFailure );
.then( afterEntityStored.bind( self ), onEntityStorageFailure.bind( self ) );
}
};
/**
* Invoked when the entity was stored on the server.
* @param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server.
*/
function afterEntityStored( serverResponse ) {
// Writing an entity to the backend will usually invoke an update event to be
// broadcast over websockets, where we would also retrieve the updated record.
// We still put the updated record we receive here into the cache to ensure early consistency.
// TODO: This might actually not be optimal. Consider only handling the websocket update.
if( serverResponse.data[ configuration.entityName ] ) {
var newEntity = self.deserializer( serverResponse.data[ configuration.entityName ] );
CacheService.prototype.patch = function CacheService$patch( entity ) {
var self = this;
// If early cache updates are forced, put the return entity into the cache.
if( self.forceEarlyCacheUpdate ) {
self.__updateCacheWithEntity( newEntity );
}
return newEntity;
}
throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
}
// First create a copy of the object, which has complex properties reduced to their respective IDs.
var reduced = self.reduceComplex( entity );
// Now serialize the object.
var serialized = self.serializer( reduced );
/**
* Invoked when there was an error while trying to store the entity on the server.
* @param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server.
*/
function onEntityStorageFailure( serverResponse ) {
self.logInterface.error( self.logPrefix + "Unable to store entity on the server.",
serverResponse );
self.logInterface.error( serverResponse );
// Wrap the entity in a new object, with a single property, named after the entity type.
var wrappedEntity = {};
wrappedEntity[ configuration.entityName ] = serialized;
// Check if the entity has an "id" property, if it has, we will update. Otherwise, we create.
if( "undefined" !== typeof entity.id ) {
return self.httpInterface
.patch( configuration.entityUri + "/" + entity.id, wrappedEntity )
.then( afterEntityStored.bind( self ), onEntityStorageFailure.bind( self ) );
} else {
throw new Error( "Attempted to patch an entity that was never stored on the server." );
}

@@ -489,2 +485,37 @@ };

/**
* Invoked when the entity was stored on the server.
* @param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server.
*/
function afterEntityStored( serverResponse ) {
var self = this;
// Writing an entity to the backend will usually invoke an update event to be
// broadcast over websockets, where we would also retrieve the updated record.
// We still put the updated record we receive here into the cache to ensure early consistency.
// TODO: This might actually not be optimal. Consider only handling the websocket update.
if( serverResponse.data[ configuration.entityName ] ) {
var newEntity = self.deserializer( serverResponse.data[ configuration.entityName ] );
// If early cache updates are forced, put the return entity into the cache.
if( self.forceEarlyCacheUpdate ) {
self.__updateCacheWithEntity( newEntity );
}
return newEntity;
}
throw new Error( "The response from the server was not in the expected format. It should have a member named '" + configuration.entityName + "'." );
}
/**
* Invoked when there was an error while trying to store the entity on the server.
* @param {angular.IHttpPromiseCallbackArg|Object} serverResponse The reply sent from the server.
*/
function onEntityStorageFailure( serverResponse ) {
var self = this;
self.logInterface.error( self.logPrefix + "Unable to store entity on the server.",
serverResponse );
self.logInterface.error( serverResponse );
}
/**
* Remove an entity from the cache and have it deleted on the backend.

@@ -705,3 +736,3 @@ * @param {Object} entity

* instances in cache; otherwise, only properties that are string representations of complex type IDs will be replaced.
* @returns {IPromise<TResult>|IPromise<any[]>|IPromise<{}>}
* @returns {IPromise<TResult>|IPromise<any[]>|IPromise<{}>|angular.IPromise<TResult>}
*/

@@ -708,0 +739,0 @@ CacheService.prototype.populateComplex = function CacheService$populateComplex( entity, propertyName, cache, force ) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc