Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit 6c28ffb

Browse files
author
Gerkin
committed
0.2.0-rc.3
1 parent 102aeb0 commit 6c28ffb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+303
-195
lines changed

build/isolated/dist/diaspora.js

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* @file diaspora
33
*
44
* Multi-Layer ORM for Javascript Client+Server
5-
* Isolated build compiled on 2017-10-30 01:39:01
5+
* Isolated build compiled on 2017-10-30 03:01:21
66
*
77
* @license GPL-3.0
88
* @version 0.2.0-rc.3
@@ -2393,7 +2393,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
23932393
/**
23942394
* Returns a copy of this entity attributes.
23952395
*
2396-
* @method toObject
23972396
* @memberof EntityFactory.Entity
23982397
* @instance
23992398
* @author gerkin
@@ -2420,7 +2419,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
24202419
/**
24212420
* Save this entity in specified data source.
24222421
*
2423-
* @method persist
24242422
* @memberof EntityFactory.Entity
24252423
* @instance
24262424
* @fires EntityFactory.Entity#beforeUpdate
@@ -2490,7 +2488,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
24902488
/**
24912489
* Reload this entity from specified data source.
24922490
*
2493-
* @method fetch
24942491
* @memberof EntityFactory.Entity
24952492
* @instance
24962493
* @fires EntityFactory.Entity#beforeFind
@@ -2543,7 +2540,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
25432540
/**
25442541
* Delete this entity from the specified data source.
25452542
*
2546-
* @method destroy
25472543
* @memberof EntityFactory.Entity
25482544
* @instance
25492545
* @fires EntityFactory.Entity#beforeDelete
@@ -2630,7 +2626,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
26302626
/**
26312627
* Generate the query to get this unique entity in the desired data source.
26322628
*
2633-
* @method uidQuery
26342629
* @memberof EntityFactory.Entity
26352630
* @instance
26362631
* @author gerkin
@@ -2646,7 +2641,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
26462641
/**
26472642
* Return the table of this entity in the specified data source.
26482643
*
2649-
* @method table
26502644
* @memberof EntityFactory.Entity
26512645
* @instance
26522646
* @author gerkin
@@ -2673,12 +2667,33 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
26732667
throw new EntityValidationError(validationErrors, 'Validation failed');
26742668
}
26752669
},
2670+
2671+
/**
2672+
* Remove all editable properties & replace them with provided object.
2673+
*
2674+
* @memberof EntityFactory.Entity
2675+
* @instance
2676+
* @author gerkin
2677+
* @param {Object} [newContent={}] - Replacement content.
2678+
* @returns {EntityFactory.Entity} Returns `this`.
2679+
*/
26762680
replaceAttributes: function replaceAttributes() {
26772681
var newContent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
26782682

26792683
newContent.idHash = attributes.idHash;
26802684
attributes = newContent;
2685+
return this;
26812686
},
2687+
2688+
/**
2689+
* Generate a diff update query by checking deltas with last source interaction.
2690+
*
2691+
* @memberof EntityFactory.Entity
2692+
* @instance
2693+
* @author gerkin
2694+
* @param {Adapters.DiasporaAdapter} dataSource - Data source to diff with.
2695+
* @returns {Object} Diff query.
2696+
*/
26822697
getDiff: function getDiff(dataSource) {
26832698
var dataStoreEntity = this.dataSources[dataSource.name];
26842699
var dataStoreObject = dataStoreEntity.toObject();
@@ -2702,7 +2717,6 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
27022717
source = _.omit(source.toObject(), ['id']);
27032718
}
27042719
// Check keys provided in source
2705-
var sourceKeys = _.keys(source);
27062720
var sourceDModel = _.difference(source, modelAttrsKeys);
27072721
if (0 !== sourceDModel.length) {
27082722
// Later, add a criteria for schemaless models
@@ -3683,6 +3697,14 @@ function _inherits(subClass, superClass) { if (typeof superClass !== "function"
36833697
});
36843698
return this;
36853699
}
3700+
3701+
/**
3702+
* Returns a POJO representation of this set's data.
3703+
*
3704+
* @author gerkin
3705+
* @returns {Object} POJO representation of set & children.
3706+
*/
3707+
36863708
}, {
36873709
key: "toObject",
36883710
value: function toObject() {

build/isolated/dist/diaspora.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/isolated/dist/diaspora.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/isolated/src/diaspora.js

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,6 @@ function EntityFactory( name, modelDesc, model ) {
20422042
/**
20432043
* Returns a copy of this entity attributes.
20442044
*
2045-
* @method toObject
20462045
* @memberof EntityFactory.Entity
20472046
* @instance
20482047
* @author gerkin
@@ -2069,7 +2068,6 @@ function EntityFactory( name, modelDesc, model ) {
20692068
/**
20702069
* Save this entity in specified data source.
20712070
*
2072-
* @method persist
20732071
* @memberof EntityFactory.Entity
20742072
* @instance
20752073
* @fires EntityFactory.Entity#beforeUpdate
@@ -2134,7 +2132,6 @@ function EntityFactory( name, modelDesc, model ) {
21342132
/**
21352133
* Reload this entity from specified data source.
21362134
*
2137-
* @method fetch
21382135
* @memberof EntityFactory.Entity
21392136
* @instance
21402137
* @fires EntityFactory.Entity#beforeFind
@@ -2180,7 +2177,6 @@ function EntityFactory( name, modelDesc, model ) {
21802177
/**
21812178
* Delete this entity from the specified data source.
21822179
*
2183-
* @method destroy
21842180
* @memberof EntityFactory.Entity
21852181
* @instance
21862182
* @fires EntityFactory.Entity#beforeDelete
@@ -2260,7 +2256,6 @@ function EntityFactory( name, modelDesc, model ) {
22602256
/**
22612257
* Generate the query to get this unique entity in the desired data source.
22622258
*
2263-
* @method uidQuery
22642259
* @memberof EntityFactory.Entity
22652260
* @instance
22662261
* @author gerkin
@@ -2275,7 +2270,6 @@ function EntityFactory( name, modelDesc, model ) {
22752270
/**
22762271
* Return the table of this entity in the specified data source.
22772272
*
2278-
* @method table
22792273
* @memberof EntityFactory.Entity
22802274
* @instance
22812275
* @author gerkin
@@ -2301,12 +2295,29 @@ function EntityFactory( name, modelDesc, model ) {
23012295
throw new EntityValidationError( validationErrors, 'Validation failed' );
23022296
}
23032297
},
2304-
2298+
/**
2299+
* Remove all editable properties & replace them with provided object.
2300+
*
2301+
* @memberof EntityFactory.Entity
2302+
* @instance
2303+
* @author gerkin
2304+
* @param {Object} [newContent={}] - Replacement content.
2305+
* @returns {EntityFactory.Entity} Returns `this`.
2306+
*/
23052307
replaceAttributes( newContent = {}) {
23062308
newContent.idHash = attributes.idHash;
23072309
attributes = newContent;
2310+
return this;
23082311
},
2309-
2312+
/**
2313+
* Generate a diff update query by checking deltas with last source interaction.
2314+
*
2315+
* @memberof EntityFactory.Entity
2316+
* @instance
2317+
* @author gerkin
2318+
* @param {Adapters.DiasporaAdapter} dataSource - Data source to diff with.
2319+
* @returns {Object} Diff query.
2320+
*/
23102321
getDiff( dataSource ) {
23112322
const dataStoreEntity = this.dataSources[dataSource.name];
23122323
const dataStoreObject = dataStoreEntity.toObject();
@@ -2330,7 +2341,6 @@ function EntityFactory( name, modelDesc, model ) {
23302341
source = _.omit( source.toObject(), [ 'id' ]);
23312342
}
23322343
// Check keys provided in source
2333-
const sourceKeys = _.keys( source );
23342344
const sourceDModel = _.difference( source, modelAttrsKeys );
23352345
if ( 0 !== sourceDModel.length ) { // Later, add a criteria for schemaless models
23362346
throw new Error( `Source has unknown keys: ${ JSON.stringify( sourceDModel ) } in ${ JSON.stringify( source ) }` );
@@ -3113,6 +3123,12 @@ class Set {
31133123
return this;
31143124
}
31153125

3126+
/**
3127+
* Returns a POJO representation of this set's data.
3128+
*
3129+
* @author gerkin
3130+
* @returns {Object} POJO representation of set & children.
3131+
*/
31163132
toObject() {
31173133
return this.entities.map( entity => entity.toObject());
31183134
}

0 commit comments

Comments
 (0)