-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
91 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -505,8 +505,10 @@ Inclusion.include = function(objects, include, options, cb) { | |
function linkManyToMany(target, next) { | ||
const targetId = target[modelToIdName]; | ||
if (!targetId) { | ||
const err = new Error(g.f('LinkManyToMany received target that doesn\'t contain required "%s"', | ||
modelToIdName)); | ||
const err = new Error(g.f( | ||
'LinkManyToMany received target that doesn\'t contain required "%s"', | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bajtos
Author
Member
|
||
modelToIdName | ||
)); | ||
return next(err); | ||
} | ||
const objList = targetObjsMap[targetId.toString()]; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,7 +229,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett | |
hiddenProperty(ModelClass, '_warned', {}); | ||
|
||
// inherit ModelBaseClass static methods | ||
for (var i in ModelBaseClass) { | ||
for (const i in ModelBaseClass) { | ||
// We need to skip properties that are already in the subclass, for example, the event emitter methods | ||
if (i !== '_mixins' && !(i in ModelClass)) { | ||
ModelClass[i] = ModelBaseClass[i]; | ||
|
@@ -306,7 +306,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett | |
idNames = modelDefinition.idNames(); // Reload it after rebuild | ||
// Create a virtual property 'id' | ||
if (idNames.length === 1) { | ||
var idProp = idNames[0]; | ||
const idProp = idNames[0]; | ||
if (idProp !== 'id') { | ||
Object.defineProperty(ModelClass.prototype, 'id', { | ||
get: function() { | ||
|
@@ -323,7 +323,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett | |
get: function() { | ||
const compositeId = {}; | ||
const idNames = ModelClass.definition.idNames(); | ||
for (var i = 0, p; i < idNames.length; i++) { | ||
for (let i = 0, p; i < idNames.length; i++) { | ||
This comment has been minimized.
Sorry, something went wrong.
3z3qu13l
|
||
p = idNames[i]; | ||
compositeId[p] = this.__data[p]; | ||
} | ||
|
@@ -339,7 +339,7 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett | |
let forceId = ModelClass.settings.forceId; | ||
if (idNames.length > 0) { | ||
const idName = modelDefinition.idName(); | ||
idProp = ModelClass.definition.rawProperties[idName]; | ||
const idProp = ModelClass.definition.rawProperties[idName]; | ||
if (idProp.generated && forceId !== false) { | ||
forceId = 'auto'; | ||
} else if (!idProp.generated && forceId === 'auto') { | ||
|
@@ -624,16 +624,16 @@ ModelBuilder.prototype.define = function defineClass(className, properties, sett | |
const props = ModelClass.definition.properties; | ||
let keys = Object.keys(props); | ||
let size = keys.length; | ||
for (i = 0; i < size; i++) { | ||
for (let i = 0; i < size; i++) { | ||
const propertyName = keys[i]; | ||
ModelClass.registerProperty(propertyName); | ||
} | ||
|
||
const mixinSettings = settings.mixins || {}; | ||
keys = Object.keys(mixinSettings); | ||
size = keys.length; | ||
for (i = 0; i < size; i++) { | ||
var name = keys[i]; | ||
for (let i = 0; i < size; i++) { | ||
const name = keys[i]; | ||
let mixin = mixinSettings[name]; | ||
if (mixin === true) { | ||
mixin = {}; | ||
|
@@ -929,12 +929,9 @@ ModelBuilder.prototype.buildModels = function(schemas, createModel) { | |
for (let s = 0, n = schemas.length; s < n; s++) { | ||
const name = this.getSchemaName(schemas[s].name); | ||
schemas[s].name = name; | ||
var model; | ||
if (typeof createModel === 'function') { | ||
model = createModel(schemas[s].name, schemas[s].properties, schemas[s].options); | ||
} else { | ||
model = this.define(schemas[s].name, schemas[s].properties, schemas[s].options); | ||
} | ||
const model = typeof createModel === 'function' ? | ||
createModel(schemas[s].name, schemas[s].properties, schemas[s].options) : | ||
this.define(schemas[s].name, schemas[s].properties, schemas[s].options); | ||
models[name] = model; | ||
relations = relations.concat(model.definition.relations); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Template string would help