dobo 1.1.2 → 1.1.4

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.
@@ -18,7 +18,6 @@ async function modelRebuild (...args) {
18
18
  const isMatch = outmatch(map(names.split(' '), m => trim(m)))
19
19
  names = schemas.filter(isMatch)
20
20
  if (names.length === 0) return this.print.fail('No schema matched', true, { exit: this.app.bajo.applet })
21
- names = names.sort()
22
21
  console.log(boxen(names.join(' '), { title: this.print.write('schema%d', names.length), padding: 0.5, borderStyle: 'round' }))
23
22
  const answer = await confirm({
24
23
  message: this.print.write('schemasWillBeRebuiltContinue'),
@@ -36,7 +35,7 @@ async function modelRebuild (...args) {
36
35
  const result = { succed: 0, failed: 0, skipped: 0 }
37
36
  const skipped = []
38
37
  for (const s of names) {
39
- const { schema, instance, connection } = this.getInfo(s)
38
+ const { schema, instance } = this.getInfo(s)
40
39
  const spin = this.print.spinner({ showCounter: true }).start('rebuilding%s', schema.name)
41
40
  if (!instance) {
42
41
  spin.warn('clientInstanceNotConnected%s', schema.connection, schema.name)
@@ -44,10 +43,12 @@ async function modelRebuild (...args) {
44
43
  result.skipped++
45
44
  continue
46
45
  }
46
+ /*
47
47
  if (connection.memory) {
48
48
  spin.warn('memoryDbSkipped%s', schema.name)
49
49
  continue
50
50
  }
51
+ */
51
52
  const exists = await this.modelExists(schema.name, false, { spinner: spin })
52
53
  if (exists) {
53
54
  if (this.app.bajo.config.force) {
@@ -18,6 +18,7 @@ async function handler ({ file, alias, ns }) {
18
18
  mod.ns = ns
19
19
  mod.attachment = mod.attachment ?? true
20
20
  mod.feature = mod.feature ?? []
21
+ mod.buildLevel = mod.buildLevel ?? 999
21
22
  const feats = []
22
23
  if (isArray(mod.feature)) {
23
24
  each(mod.feature, f => {
@@ -1,6 +1,7 @@
1
1
  async function multiRelRows ({ schema, records, options = {} }) {
2
2
  const { isSet } = this.app.bajo
3
- const props = schema.properties.filter(p => isSet(p.rel))
3
+ const props = schema.properties.filter(p => isSet(p.rel) && !(options.hidden ?? []).includes(p.name))
4
+ // const props = schema.properties.filter(p => isSet(p.rel))
4
5
  const rels = {}
5
6
  options.rels = options.rels ?? []
6
7
  if (props.length > 0) {
@@ -36,7 +36,7 @@ async function sanitizeFullText (item) {
36
36
 
37
37
  async function sanitizeSchema (items) {
38
38
  const { freeze, fatal, importModule, defaultsDeep, join, breakNsPath, runHook } = this.app.bajo
39
- const { map, keys, findIndex, find, each, isString, get, isPlainObject, camelCase, uniq, filter } = this.lib._
39
+ const { orderBy, map, keys, findIndex, find, each, isString, get, isPlainObject, camelCase, uniq, filter } = this.lib._
40
40
  const propTypes = keys(this.propType)
41
41
  const schemas = []
42
42
  this.log.debug('loadingDbSchemas')
@@ -185,7 +185,7 @@ async function sanitizeSchema (items) {
185
185
  schema.sortables = sortables
186
186
  await runHook(`dobo.${camelCase(schema.name)}:afterSanitizeSchema`, schema)
187
187
  }
188
- this.schemas = schemas
188
+ this.schemas = orderBy(schemas, ['buildLevel', 'name'])
189
189
  freeze(this.schemas)
190
190
  this.log.debug('loadedSchemas%s', join(map(this.schemas, 'name')))
191
191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dobo",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Database ORM/ODM for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -2,8 +2,10 @@ async function findAll (name, filter = {}, options = {}) {
2
2
  filter.page = 1
3
3
  filter.limit = 100
4
4
  options.dataOnly = true
5
+ const match = filter.match
5
6
  const all = []
6
7
  for (;;) {
8
+ filter.match = match
7
9
  const results = await this.recordFind(name, filter, options)
8
10
  if (results.length === 0) break
9
11
  all.push(...results)
@@ -9,7 +9,7 @@ async function attachment (req, reply) {
9
9
  const file = `${getPluginDataDir('dobo')}/attachment/${pascalCase(req.params.model)}/${req.params.id}/${req.params.field}/${req.params.file}`
10
10
  const mimeType = mime.getType(path.extname(file))
11
11
  if (!fs.existsSync(file)) {
12
- if (!req.query.notfound) throw this.error('_notFound', { noView: true })
12
+ if (!req.query.notfound) throw this.error('_notFound', { noContent: true })
13
13
  const [, ext] = mimeType.split('/')
14
14
  const replacer = isString(req.query.notfound) ? req.query.notfound : `waibuStatic.asset:/not-found.${ext}`
15
15
  return reply.redirectTo(routePath(replacer))