dobo 2.6.5 → 2.6.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/collect-models.js +7 -7
- package/package.json +1 -1
- package/wiki/CHANGES.md +1 -0
package/lib/collect-models.js
CHANGED
|
@@ -110,15 +110,15 @@ async function findAllFeats (model, inputs = [], indexes = [], isExtender) {
|
|
|
110
110
|
* @param {Object} model - Model
|
|
111
111
|
* @param {Array} [inputs] - Array of properties
|
|
112
112
|
*/
|
|
113
|
-
async function findAllIndexes (model, inputs = []) {
|
|
114
|
-
const
|
|
113
|
+
async function findAllIndexes (model, inputs = [], indexes = []) {
|
|
114
|
+
const items = []
|
|
115
115
|
for (const index of inputs) {
|
|
116
116
|
index.type = index.type ?? 'index'
|
|
117
117
|
index.fields = index.fields ?? []
|
|
118
118
|
if (!index.name) index.name = `${model.name}_${index.fields.join('_')}_${index.type}`
|
|
119
|
-
|
|
119
|
+
items.push(index)
|
|
120
120
|
}
|
|
121
|
-
model.indexes = indexes
|
|
121
|
+
model.indexes = [...items, ...indexes]
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/**
|
|
@@ -262,7 +262,7 @@ async function createSchema (item) {
|
|
|
262
262
|
if (!isPlainObject(extender)) this.plugin.fatal('invalidModelExtender%s%s', ns, item.name)
|
|
263
263
|
await findAllProps.call(this, item, extender.properties ?? [], indexes, true)
|
|
264
264
|
await findAllFeats.call(this, item, extender.features ?? [], indexes, true)
|
|
265
|
-
await findAllIndexes.call(this, item, extender.indexes ?? [], true)
|
|
265
|
+
await findAllIndexes.call(this, item, extender.indexes ?? [], indexes, true)
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
}
|
|
@@ -305,9 +305,9 @@ async function collectModels () {
|
|
|
305
305
|
item.name = item.name ?? defName
|
|
306
306
|
item.collName = item.collName ?? item.name
|
|
307
307
|
item.file = file
|
|
308
|
+
item.ns = this.ns
|
|
308
309
|
const schema = await createSchema.call(me, item)
|
|
309
|
-
schema
|
|
310
|
-
schemas.push(item)
|
|
310
|
+
schemas.push(schema)
|
|
311
311
|
}, { glob: 'model/*.*', prefix: this.ns })
|
|
312
312
|
schemas = orderBy(schemas, ['buildLevel', 'name'])
|
|
313
313
|
for (const schema of schemas) {
|
package/package.json
CHANGED