waibu-db 1.1.23 → 1.1.24

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.
@@ -1,8 +1,9 @@
1
1
  async function addHandler ({ req, reply, model, params = {}, template, addOnsHandler, templateDisabled = 'waibuDb.template:/disabled.html' } = {}) {
2
- const { pascalCase } = this.app.bajo
2
+ const { pascalCase } = this.lib.aneka
3
3
  const { recordCreate, recordGet, getSchemaExt } = this.app.waibuDb
4
4
  const { buildUrl } = this.app.waibuMpa
5
- const { pick, map, merge, defaultsDeep, omit, isEmpty } = this.lib._
5
+ const { defaultsDeep } = this.lib.aneka
6
+ const { pick, map, merge, omit, isEmpty } = this.lib._
6
7
  const options = {}
7
8
  model = model ?? pascalCase(req.params.model)
8
9
  const { schema } = await getSchemaExt(model, 'add', { params })
@@ -1,5 +1,5 @@
1
1
  async function deleteHandler ({ req, reply, model, params = {}, templateDisabled = 'waibuDb.template:/disabled.html' } = {}) {
2
- const { pascalCase } = this.app.bajo
2
+ const { pascalCase } = this.lib.aneka
3
3
  const { recordRemove, getSchemaExt } = this.app.waibuDb
4
4
  const { buildUrl } = this.app.waibuMpa
5
5
  const { reduce } = this.lib._
@@ -1,7 +1,7 @@
1
1
  import attachmentHandler from './helper/attachment-handler.js'
2
2
 
3
3
  async function detailsHandler ({ req, reply, model, params = {}, id, template, addOnsHandler, templateDisabled = 'waibuDb.template:/disabled.html' } = {}) {
4
- const { pascalCase } = this.app.bajo
4
+ const { pascalCase } = this.lib.aneka
5
5
  const { recordGet, getSchemaExt } = this.app.waibuDb
6
6
  const { merge } = this.lib._
7
7
  const options = {}
@@ -1,11 +1,13 @@
1
1
  import attachmentHandler from './helper/attachment-handler.js'
2
2
 
3
3
  async function editHandler ({ req, reply, model, id, params = {}, template, addOnsHandler, templateDisabled = 'waibuDb.template:/disabled.html' } = {}) {
4
- const { pascalCase, getPluginDataDir } = this.app.bajo
4
+ const { pascalCase } = this.lib.aneka
5
+ const { getPluginDataDir } = this.app.bajo
5
6
  const { recordUpdate, recordGet, getSchemaExt } = this.app.waibuDb
6
7
  const { buildUrl } = this.app.waibuMpa
7
8
  const { fs } = this.lib
8
- const { merge, defaultsDeep, isEmpty, omit } = this.lib._
9
+ const { defaultsDeep } = this.lib.aneka
10
+ const { merge, isEmpty, omit } = this.lib._
9
11
  const options = {}
10
12
  let error
11
13
  let resp
@@ -1,5 +1,5 @@
1
1
  async function exportHandler ({ req, reply, model, params = {}, templateDisabled = 'waibuDb.template:/disabled.html' } = {}) {
2
- const { pascalCase } = this.app.bajo
2
+ const { pascalCase } = this.lib.aneka
3
3
  const { getSchemaExt } = this.app.waibuDb
4
4
  const { buildUrl } = this.app.waibuMpa
5
5
  const options = {}
@@ -1,5 +1,5 @@
1
1
  async function listHandler ({ req, reply, model, template, params = {}, addOnsHandler, templateDisabled = 'waibuDb.template:/disabled.html' } = {}) {
2
- const { pascalCase } = this.app.bajo
2
+ const { pascalCase } = this.lib.aneka
3
3
  const { recordFind, getSchemaExt } = this.app.waibuDb
4
4
  const { get, merge, isArray, upperFirst } = this.lib._
5
5
  const qsKey = this.app.waibu.config.qsKey
package/lib/prep-crud.js CHANGED
@@ -1,6 +1,6 @@
1
1
  function prepCrud ({ model, body, id, req, reply, options = {}, args }) {
2
2
  const { parseFilter } = this.app.waibu
3
- const { pascalCase } = this.app.bajo
3
+ const { pascalCase } = this.lib.aneka
4
4
  const { cloneDeep, has } = this.lib._
5
5
  const cfgWeb = this.app.waibu.getConfig()
6
6
  const opts = cloneDeep(options)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu-db",
3
- "version": "1.1.23",
3
+ "version": "1.1.24",
4
4
  "description": "DB Helper",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,6 +1,6 @@
1
1
  function modelsMenu (locals, req) {
2
2
  const { getPluginPrefix } = this.app.waibu
3
- const { pascalCase } = this.app.bajo
3
+ const { pascalCase } = this.lib.aneka
4
4
  const { getAppTitle } = this.app.waibuMpa
5
5
  const { camelCase, map, pick, groupBy, keys, kebabCase, filter, get } = this.lib._
6
6
 
@@ -5,7 +5,7 @@ const defReadonly = ['id', 'createdAt', 'updatedAt']
5
5
  const defFormatter = {}
6
6
 
7
7
  function getCommons (action, schema, ext, opts = {}) {
8
- const { defaultsDeep } = this.app.bajo
8
+ const { defaultsDeep } = this.lib.aneka
9
9
  const { merge, map, get, set, without, uniq, pull } = this.lib._
10
10
  const calcFields = get(ext, `view.${action}.calcFields`, get(ext, 'common.calcFields', []))
11
11
  const forceVisible = get(ext, `view.${action}.forceVisible`, get(ext, 'common.forceVisible', []))
@@ -69,7 +69,7 @@ function autoLayout ({ action, schema, ext, layout }) {
69
69
  }
70
70
 
71
71
  function customLayout ({ action, schema, ext, layout, readonly }) {
72
- const { defaultsDeep } = this.app.bajo
72
+ const { defaultsDeep } = this.lib.aneka
73
73
  const { isEmpty } = this.lib._
74
74
  const items = [...layout]
75
75
  for (const item of items) {
@@ -87,7 +87,7 @@ function customLayout ({ action, schema, ext, layout, readonly }) {
87
87
  }
88
88
 
89
89
  function applyLayout (action, schema, ext) {
90
- const { defaultsDeep } = this.app.bajo
90
+ const { defaultsDeep } = this.lib.aneka
91
91
  const { set, get, isEmpty, find } = this.lib._
92
92
  const { fields, card, calcFields } = getCommons.call(this, action, schema, ext)
93
93
  const layout = get(ext, `view.${action}.layout`, get(ext, 'common.layout', []))
@@ -160,7 +160,8 @@ const handler = {
160
160
  }
161
161
 
162
162
  async function getSchemaExt (model, view, opts = {}) {
163
- const { readConfig, defaultsDeep } = this.app.bajo
163
+ const { readConfig } = this.app.bajo
164
+ const { defaultsDeep } = this.lib.aneka
164
165
  const { getSchema } = this.app.dobo
165
166
  const { pick } = this.lib._
166
167