dobo 1.0.12 → 1.0.14

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.
Files changed (42) hide show
  1. package/bajo/init.js +2 -2
  2. package/bajo/method/attachment/copy-uploaded.js +2 -2
  3. package/bajo/method/attachment/create.js +2 -2
  4. package/bajo/method/attachment/remove.js +1 -1
  5. package/bajo/method/get-schema.js +1 -1
  6. package/bajo/method/model/exists.js +1 -1
  7. package/bajo/method/prep-pagination.js +1 -1
  8. package/bajo/method/record/create.js +1 -1
  9. package/bajo/method/record/remove.js +1 -1
  10. package/bajo/method/record/update.js +1 -1
  11. package/bajo/method/sanitize/date.js +1 -1
  12. package/bajo/method/stat/histogram.js +1 -1
  13. package/bajo/method/validate.js +1 -1
  14. package/bajo/start.js +1 -1
  15. package/bajoCli/applet/connection.js +4 -4
  16. package/bajoCli/applet/lib/post-process.js +5 -5
  17. package/bajoCli/applet/model-clear.js +1 -1
  18. package/bajoCli/applet/model-rebuild.js +14 -14
  19. package/bajoCli/applet/record-create.js +6 -6
  20. package/bajoCli/applet/record-find.js +3 -3
  21. package/bajoCli/applet/record-get.js +1 -1
  22. package/bajoCli/applet/record-remove.js +1 -1
  23. package/bajoCli/applet/record-update.js +8 -8
  24. package/bajoCli/applet/schema.js +4 -4
  25. package/bajoCli/applet/stat-count.js +3 -3
  26. package/bajoI18N/resource/en-US.json +157 -27
  27. package/bajoI18N/resource/id.json +125 -75
  28. package/lib/add-fixtures.js +5 -5
  29. package/lib/build-bulk-action.js +2 -2
  30. package/lib/check-unique.js +2 -2
  31. package/lib/collect-connections.js +2 -2
  32. package/lib/collect-drivers.js +3 -3
  33. package/lib/collect-feature.js +3 -3
  34. package/lib/collect-schemas.js +3 -3
  35. package/lib/generic-prop-sanitizer.js +2 -9
  36. package/lib/mem-db/instantiate.js +1 -1
  37. package/lib/mem-db/method/record/create.js +1 -1
  38. package/lib/mem-db/method/record/get.js +1 -1
  39. package/lib/mem-db/start.js +2 -2
  40. package/lib/resolve-method.js +2 -2
  41. package/lib/sanitize-schema.js +5 -5
  42. package/package.json +1 -1
@@ -2,7 +2,7 @@ async function get ({ schema, id, options = {} }) {
2
2
  const { thrownNotFound = true } = options
3
3
  const { find } = this.app.bajo.lib._
4
4
  const result = find(this.memDb.storage[schema.name], { id })
5
- if (!result && thrownNotFound) throw this.error('Record \'%s@%s\' not found!', id, schema.name, { statusCode: 404 })
5
+ if (!result && thrownNotFound) throw this.error('recordNotFound%s%s', id, schema.name, { statusCode: 404 })
6
6
  return { data: result }
7
7
  }
8
8
 
@@ -9,10 +9,10 @@ async function start () {
9
9
  return names.includes(s.connection)
10
10
  })
11
11
  if (schemas.length === 0) return
12
- this.log.debug('Adding fixture for memory database')
12
+ this.log.debug('addingFixtureToMemDb')
13
13
  for (const schema of schemas) {
14
14
  if (schema.persistence) {
15
- this.log.warn('\'%s\' is a memory persistence model. Adding records from fixture is ignored!', schema.name)
15
+ this.log.warn('addingMemoryPersistenceIgnored', schema.name)
16
16
  continue
17
17
  }
18
18
  let { success, error } = await addFixtures.call(this, schema.name)
@@ -4,11 +4,11 @@ async function resolveMethod (name, method, options = {}) {
4
4
  const { camelCase } = this.app.bajo.lib._
5
5
  const { schema, driver, connection } = this.getInfo(name)
6
6
  const [group, action] = method.split('-')
7
- if (!options.force && (schema.disabled ?? []).includes(action)) throw this.error('Method \'%s@%s\' is disabled', camelCase(method), name)
7
+ if (!options.force && (schema.disabled ?? []).includes(action)) throw this.error('methodIsDisabled%s%s', camelCase(method), name)
8
8
  let file
9
9
  if (connection.name === 'memory') file = `${this.app[driver.ns].dir.pkg}/lib/mem-db/method/${group}/${action}.js`
10
10
  else file = `${this.app[driver.ns].dir.pkg}/${this.name}/method/${group}/${action}.js`
11
- if (!fs.existsSync(file)) throw this.error('Method \'%s@%s\' is unsupported', camelCase(method), name)
11
+ if (!fs.existsSync(file)) throw this.error('methodUnsupported%s%s', camelCase(method), name)
12
12
  const handler = await importModule(file)
13
13
  return { handler, schema, driver, connection }
14
14
  }
@@ -4,7 +4,7 @@ async function sanitizeFeature (item) {
4
4
  const { get, isPlainObject, mergeWith, isArray } = this.app.bajo.lib._
5
5
  for (const f of item.feature) {
6
6
  const feature = get(this.feature, f.name) // source from collectFeature
7
- if (!feature) this.fatal('Unknown feature \'%s@%s\'', f.name, item.name)
7
+ if (!feature) this.fatal('unknownFeature%s%s', f.name, item.name)
8
8
  let [ns, path] = f.name.split('.')
9
9
  if (!path) ns = this.name
10
10
  const input = await feature.call(this.app[ns], f)
@@ -22,14 +22,14 @@ async function sanitizeFeature (item) {
22
22
 
23
23
  async function sanitizeIndexes (item) {
24
24
  for (const idx of item.indexes) {
25
- if (!(typeof idx.fields === 'string' || Array.isArray(idx.fields))) this.fatal('Only accept array of field names or single string of field name \'%s@%s\'', 'indexes', item.name)
25
+ if (!(typeof idx.fields === 'string' || Array.isArray(idx.fields))) this.fatal('onlyAccepFields%s%s', 'indexes', item.name)
26
26
  }
27
27
  }
28
28
 
29
29
  async function sanitizeFullText (item) {
30
30
  for (const f of item.fullText.fields ?? []) {
31
31
  const prop = item.properties.find(p => p.name === f)
32
- if (!prop) this.fatal('Invalid field name \'%s@%s\'', f, item.name)
32
+ if (!prop) this.fatal('invalidFieldName%s%s', f, item.name)
33
33
  // if (prop.type !== 'text') fatal.call(this, 'Fulltext index only available for field type \'text\' in \'%s@%s\'', f, item.name)
34
34
  }
35
35
  }
@@ -39,7 +39,7 @@ async function sanitizeSchema (items) {
39
39
  const { map, keys, findIndex, find, each, isString, get, isPlainObject, camelCase, uniq, filter } = this.app.bajo.lib._
40
40
  const propTypes = keys(this.propType)
41
41
  const schemas = []
42
- this.log.debug('Loading DB schemas')
42
+ this.log.debug('loadingDbSchemas')
43
43
  for (const k in items) {
44
44
  this.log.trace('- %s (%d)', k, keys(items[k]).length)
45
45
  for (const f in items[k]) {
@@ -187,7 +187,7 @@ async function sanitizeSchema (items) {
187
187
  }
188
188
  this.schemas = schemas
189
189
  freeze(this.schemas)
190
- this.log.debug('Loaded schemas: %s', join(map(this.schemas, 'name')))
190
+ this.log.debug('loadedSchemas%s', join(map(this.schemas, 'name')))
191
191
  }
192
192
 
193
193
  export default sanitizeSchema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dobo",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Database ORM/ODM for Bajo Framework",
5
5
  "main": "index.js",
6
6
  "scripts": {