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.
- package/bajo/init.js +2 -2
- package/bajo/method/attachment/copy-uploaded.js +2 -2
- package/bajo/method/attachment/create.js +2 -2
- package/bajo/method/attachment/remove.js +1 -1
- package/bajo/method/get-schema.js +1 -1
- package/bajo/method/model/exists.js +1 -1
- package/bajo/method/prep-pagination.js +1 -1
- package/bajo/method/record/create.js +1 -1
- package/bajo/method/record/remove.js +1 -1
- package/bajo/method/record/update.js +1 -1
- package/bajo/method/sanitize/date.js +1 -1
- package/bajo/method/stat/histogram.js +1 -1
- package/bajo/method/validate.js +1 -1
- package/bajo/start.js +1 -1
- package/bajoCli/applet/connection.js +4 -4
- package/bajoCli/applet/lib/post-process.js +5 -5
- package/bajoCli/applet/model-clear.js +1 -1
- package/bajoCli/applet/model-rebuild.js +14 -14
- package/bajoCli/applet/record-create.js +6 -6
- package/bajoCli/applet/record-find.js +3 -3
- package/bajoCli/applet/record-get.js +1 -1
- package/bajoCli/applet/record-remove.js +1 -1
- package/bajoCli/applet/record-update.js +8 -8
- package/bajoCli/applet/schema.js +4 -4
- package/bajoCli/applet/stat-count.js +3 -3
- package/bajoI18N/resource/en-US.json +157 -27
- package/bajoI18N/resource/id.json +125 -75
- package/lib/add-fixtures.js +5 -5
- package/lib/build-bulk-action.js +2 -2
- package/lib/check-unique.js +2 -2
- package/lib/collect-connections.js +2 -2
- package/lib/collect-drivers.js +3 -3
- package/lib/collect-feature.js +3 -3
- package/lib/collect-schemas.js +3 -3
- package/lib/generic-prop-sanitizer.js +2 -9
- package/lib/mem-db/instantiate.js +1 -1
- package/lib/mem-db/method/record/create.js +1 -1
- package/lib/mem-db/method/record/get.js +1 -1
- package/lib/mem-db/start.js +2 -2
- package/lib/resolve-method.js +2 -2
- package/lib/sanitize-schema.js +5 -5
- 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('
|
|
5
|
+
if (!result && thrownNotFound) throw this.error('recordNotFound%s%s', id, schema.name, { statusCode: 404 })
|
|
6
6
|
return { data: result }
|
|
7
7
|
}
|
|
8
8
|
|
package/lib/mem-db/start.js
CHANGED
|
@@ -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('
|
|
12
|
+
this.log.debug('addingFixtureToMemDb')
|
|
13
13
|
for (const schema of schemas) {
|
|
14
14
|
if (schema.persistence) {
|
|
15
|
-
this.log.warn('
|
|
15
|
+
this.log.warn('addingMemoryPersistenceIgnored', schema.name)
|
|
16
16
|
continue
|
|
17
17
|
}
|
|
18
18
|
let { success, error } = await addFixtures.call(this, schema.name)
|
package/lib/resolve-method.js
CHANGED
|
@@ -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('
|
|
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('
|
|
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
|
}
|
package/lib/sanitize-schema.js
CHANGED
|
@@ -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('
|
|
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('
|
|
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('
|
|
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('
|
|
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('
|
|
190
|
+
this.log.debug('loadedSchemas%s', join(map(this.schemas, 'name')))
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
export default sanitizeSchema
|