baselinejs
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -11,11 +11,11 @@ var _ = require( 'underscore' ); | ||
options = _.defaults( {}, options, { | ||
idFieldName : "id" | ||
idFieldName : 'id' | ||
} ); | ||
if( _.isUndefined( this.collectionName ) ) throw new Error( 'The collectionName attribute must be defined on collection service instances.' ); | ||
//if( _.isUndefined( this.fieldNames ) ) throw new Error( 'The fieldNames attribute must be defined on data service instances.' ); | ||
// if( _.isUndefined( this.fieldNames ) ) throw new Error( 'The fieldNames attribute must be defined on data service instances.' ); | ||
this.length = 0; | ||
//this._fieldNames = this.fieldNames; | ||
// this._fieldNames = this.fieldNames; | ||
this._recordIds = []; | ||
@@ -113,4 +113,4 @@ this._recordsById = {}; | ||
// but jury is still out, so we will do it this way for now. nevermind, don't like this, let's keep things explicit. only way | ||
// to add a column is through merge, or | ||
//if( _.isUndefined( this._recordsById[ recordId ][ fieldName ] ) ) throw new Error( 'Field \'' + fieldName + '\' not present for record id ' + recordId + ' in table \'' + this.collectionName + '\'.' ); | ||
// to add a column is through merge, or | ||
// if( _.isUndefined( this._recordsById[ recordId ][ fieldName ] ) ) throw new Error( 'Field \'' + fieldName + '\' not present for record id ' + recordId + ' in table \'' + this.collectionName + '\'.' ); | ||
this._recordsById[ recordId ][ fieldName ] = this._copyFieldValue( fieldValue ); | ||
@@ -253,12 +253,17 @@ | ||
this._sync( url, method, dto, { | ||
success : function( returnedJson ) { | ||
if( method === 'create' ) _this._newRecordIds = _.without( _this._newRecordIds, recordId ); | ||
return new Promise( function( resolve, reject ) { | ||
_this._sync( url, method, dto, { | ||
success : function( returnedJson ) { | ||
if( method === 'create' ) _this._newRecordIds = _.without( _this._newRecordIds, recordId ); | ||
if( options.merge ) _this._mergeDTO( returnedJson, method ); | ||
if( options.success ) options.success.apply( this, arguments ); | ||
}, | ||
error : function() { | ||
if( options.error ) options.error.apply( this, arguments ); | ||
} | ||
if( options.merge ) _this._mergeDTO( returnedJson, method ); | ||
if( options.success ) options.success.apply( this, arguments ); | ||
resolve( returnedJson ); | ||
}, | ||
error : function() { | ||
if( options.error ) options.error.apply( this, arguments ); | ||
reject.apply( this, arguments ); | ||
} | ||
} ); | ||
} ); | ||
@@ -265,0 +270,0 @@ }, |
{ | ||
"name": "baselinejs", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "Share code and data between the client and the server in full stack JavaScript applications.", | ||
@@ -5,0 +5,0 @@ "main": "baseline.js", |
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
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
109655
422