sumba 1.2.3 → 1.2.5

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.
@@ -2,7 +2,8 @@ export async function collect ({ type = '', handler, container, file, ns, dir })
2
2
  const { readConfig } = this.app.bajo
3
3
  const { routePath, routePathHandlers } = this.app.waibu
4
4
  const { camelCase, find, isString, isEmpty } = this.lib._
5
- const items = await readConfig(file, { ignoreError: true })
5
+ let items = await readConfig(file, { ignoreError: true })
6
+ if (isEmpty(items)) items = []
6
7
 
7
8
  for (let item of items) {
8
9
  if (isString(item)) item = { path: item }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumba",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Bajo Framework's Biz Suite",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "common": {
3
3
  "layout": [
4
- { "name": "meta", "fields": ["id", "createdAt", "updatedAt"] },
5
- { "name": "account", "fields": ["username", "email", "password", "status", "firstName", "lastName"] },
4
+ { "name": "meta", "fields": ["id:3", "createdAt:3", "updatedAt:3", "status:3"] },
5
+ { "name": "account", "fields": ["username", "email", "provider", "password", "firstName", "lastName"] },
6
6
  { "name": "address", "fields": ["address1:12", "address2:12", "city:6-md 8-sm", "zipCode:2-md 4-sm", "provinceState:4-md", "country:6-md", "phone:6-md", "website:12"] },
7
7
  { "name": "socialMedia", "fields": ["socX:3-md 6-sm", "socInstagram:3-md 6-sm", "socFacebook:3-md 6-sm", "socLinkedIn:3-md 6-sm"] }
8
8
  ],
@@ -18,7 +18,7 @@
18
18
  "sort": "username:1",
19
19
  "limit": 10
20
20
  },
21
- "fields": ["createdAt", "status", "username", "email", "firstName", "lastName", "city", "zipCode", "provinceState", "country", "phone"],
21
+ "fields": ["createdAt", "status", "username", "provider", "email", "firstName", "lastName", "city", "zipCode", "provinceState", "country", "phone"],
22
22
  "stat": {
23
23
  "aggregate": [
24
24
  { "fields": ["status"], "group": "status", "aggregate": ["count"] },
@@ -53,7 +53,7 @@
53
53
  }
54
54
  }
55
55
  },
56
- "readonly": ["id", "createdAt", "updatedAt", "username"]
56
+ "readonly": ["id", "createdAt", "updatedAt", "username", "provider"]
57
57
  }
58
58
  }
59
59
  }
@@ -33,7 +33,7 @@ const resetUserPassword = {
33
33
  error = err
34
34
  }
35
35
  }
36
- return reply.view('sumba.template:/_admin/reset-user-password.html', { form, error })
36
+ return await reply.view('sumba.template:/_admin/reset-user-password.html', { form, error })
37
37
  }
38
38
  }
39
39
 
@@ -12,13 +12,13 @@ const contactForm = {
12
12
  try {
13
13
  const { data } = await recordCreate({ model: 'SumbaContactForm', req, reply, options: { noFlash: true } })
14
14
  req.flash('notify', req.t('contactFormSubmitted'))
15
- return reply.view('sumba.template:/help/contact-form/success.html', { form: req.body, data })
15
+ return await reply.view('sumba.template:/help/contact-form/success.html', { form: req.body, data })
16
16
  } catch (err) {
17
17
  error = err
18
18
  }
19
19
  }
20
20
  const cats = await recordFind({ model: 'SumbaContactFormCat', req, options: { sort: 'level:1+name:1', limit: -1, dataOnly: true } })
21
- return reply.view('sumba.template:/help/contact-form/form.html', { form, error, cats })
21
+ return await reply.view('sumba.template:/help/contact-form/form.html', { form, error, cats })
22
22
  }
23
23
  }
24
24
 
@@ -17,7 +17,7 @@ const add = {
17
17
  }
18
18
  }
19
19
  const cats = await recordFind({ model: 'SumbaTicketCat', req, options: { sort: 'level:1+name:1', limit: -1, dataOnly: true } })
20
- return reply.view('sumba.template:/help/trouble-tickets/add.html', { form, error, cats })
20
+ return await reply.view('sumba.template:/help/trouble-tickets/add.html', { form, error, cats })
21
21
  }
22
22
  }
23
23
 
@@ -33,7 +33,7 @@ const id = {
33
33
  return `<c:div margin="bottom-3"><c:badge background="color:${isMe ? 'primary' : 'secondary'}" t:content="${isMe ? 'you' : 'us'}" /> <small>${req.format(val, 'datetime')}</small></c:div> ${message}`
34
34
  }
35
35
  }
36
- return reply.view('sumba.template:/help/trouble-tickets/details.html', { list, schema, master, form, error })
36
+ return await reply.view('sumba.template:/help/trouble-tickets/details.html', { list, schema, master, form, error })
37
37
  }
38
38
  }
39
39
 
@@ -16,7 +16,7 @@ const list = {
16
16
  return `<strong>${val}</strong><br />${getExcerpt(rec.message, 35)}`
17
17
  }
18
18
  }
19
- return reply.view('sumba.template:/help/trouble-tickets/list.html', { list, schema })
19
+ return await reply.view('sumba.template:/help/trouble-tickets/list.html', { list, schema })
20
20
  }
21
21
  }
22
22
 
@@ -1,7 +1,7 @@
1
1
  const infoItem = {
2
2
  method: 'GET',
3
3
  handler: async function (req, reply) {
4
- return reply.view(`sumba.template:/info/${req.params.item}.md`)
4
+ return await reply.view(`sumba.template:/info/${req.params.item}.md`)
5
5
  }
6
6
  }
7
7
 
@@ -13,7 +13,7 @@ const signin = {
13
13
  error = err
14
14
  }
15
15
  }
16
- return reply.view('sumba.template:/signin.html', { form: { username, referer }, error })
16
+ return await reply.view('sumba.template:/signin.html', { form: { username, referer }, error })
17
17
  }
18
18
  }
19
19
 
@@ -18,7 +18,7 @@ const signout = {
18
18
  req.flash('notify', req.t('signoutSuccessfully'))
19
19
  return reply.redirectTo(url, { query, params })
20
20
  }
21
- return reply.view('sumba.template:/signout.html', { form: { referer } })
21
+ return await reply.view('sumba.template:/signout.html', { form: { referer } })
22
22
  }
23
23
  }
24
24
 
@@ -19,7 +19,7 @@ const userActivation = {
19
19
  error = err
20
20
  }
21
21
  }
22
- return reply.view('sumba.template:/user/activation.html', { form, error })
22
+ return await reply.view('sumba.template:/user/activation.html', { form, error })
23
23
  }
24
24
  }
25
25
 
@@ -27,7 +27,7 @@ const forgotPasswordLink = {
27
27
 
28
28
  const form = defaultsDeep(req.body, {})
29
29
  const user = await getUser.call(this, req, reply)
30
- if (isString(user)) return reply.view(user)
30
+ if (isString(user)) return await reply.view(user)
31
31
  form.username = user.username
32
32
  let error
33
33
  if (req.method === 'POST') {
@@ -56,7 +56,7 @@ const forgotPasswordLink = {
56
56
  error = err
57
57
  }
58
58
  }
59
- return reply.view('sumba.template:/user/fpl.html', { form, error })
59
+ return await reply.view('sumba.template:/user/fpl.html', { form, error })
60
60
  }
61
61
  }
62
62
 
@@ -3,7 +3,7 @@ const model = 'SumbaUser'
3
3
  const profile = {
4
4
  method: ['GET', 'POST'],
5
5
  handler: async function (req, reply) {
6
- if (!this.app.masohiMail) return reply.view('sumba.template:/user/forgot-password.html')
6
+ if (!this.app.masohiMail) return await reply.view('sumba.template:/user/forgot-password.html')
7
7
  const { sendMail } = this.app.waibu
8
8
  const { defaultsDeep } = this.lib.aneka
9
9
  const { dayjs } = this.lib
@@ -32,7 +32,7 @@ const profile = {
32
32
  error = err
33
33
  }
34
34
  }
35
- return reply.view('sumba.template:/user/forgot-password.html', { form, error })
35
+ return await reply.view('sumba.template:/user/forgot-password.html', { form, error })
36
36
  }
37
37
  }
38
38
 
@@ -26,12 +26,12 @@ const signup = {
26
26
  req.body.provider = 'local'
27
27
  const { data } = await recordCreate({ model: 'SumbaUser', req, reply, options: { validation, noFlash: true, forceNoHidden: true } })
28
28
  req.flash('notify', req.t('userCreated'))
29
- return reply.view('sumba.template:/user/signup/success.html', { form: req.body, data })
29
+ return await reply.view('sumba.template:/user/signup/success.html', { form: req.body, data })
30
30
  } catch (err) {
31
31
  error = err
32
32
  }
33
33
  }
34
- return reply.view('sumba.template:/user/signup/form.html', { form, error })
34
+ return await reply.view('sumba.template:/user/signup/form.html', { form, error })
35
35
  }
36
36
  }
37
37
 
@@ -36,7 +36,7 @@ const profile = {
36
36
  error = err
37
37
  }
38
38
  }
39
- return reply.view('sumba.template:/your-stuff/change-password.html', { form, error })
39
+ return await reply.view('sumba.template:/your-stuff/change-password.html', { form, error })
40
40
  }
41
41
  }
42
42
 
@@ -22,7 +22,7 @@ const profile = {
22
22
  error = err
23
23
  }
24
24
  }
25
- return reply.view('sumba.template:/your-stuff/profile/edit.html', { form, error })
25
+ return await reply.view('sumba.template:/your-stuff/profile/edit.html', { form, error })
26
26
  }
27
27
  }
28
28
 
@@ -7,7 +7,7 @@ const profile = {
7
7
  const resp = await recordGet({ model: 'SumbaUser', req, id: req.user.id, options })
8
8
  const form = resp.data
9
9
  form.token = await hash(form.salt)
10
- return reply.view('sumba.template:/your-stuff/profile/view.html', { form })
10
+ return await reply.view('sumba.template:/your-stuff/profile/view.html', { form })
11
11
  }
12
12
  }
13
13
 
@@ -33,7 +33,7 @@ const resetApiKey = {
33
33
  error = err
34
34
  }
35
35
  }
36
- return reply.view('sumba.template:/your-stuff/reset-api-key.html', { form, error })
36
+ return await reply.view('sumba.template:/your-stuff/reset-api-key.html', { form, error })
37
37
  }
38
38
  }
39
39