sumba 2.47.0 → 2.47.3
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/.github/FUNDING.yml +0 -0
- package/.github/workflows/repo-lockdown.yml +0 -0
- package/.jsdoc.conf.json +0 -0
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/docs/Sumba.html +0 -0
- package/docs/data/search.json +0 -0
- package/docs/fonts/Inconsolata-Regular.ttf +0 -0
- package/docs/fonts/OpenSans-Regular.ttf +0 -0
- package/docs/fonts/WorkSans-Bold.ttf +0 -0
- package/docs/global.html +0 -0
- package/docs/index.html +0 -0
- package/docs/index.js.html +0 -0
- package/docs/lib_config.js.html +0 -0
- package/docs/lib_constant.js.html +0 -0
- package/docs/lib_token-schema.js.html +0 -0
- package/docs/scripts/core.js +0 -0
- package/docs/scripts/core.min.js +0 -0
- package/docs/scripts/resize.js +0 -0
- package/docs/scripts/search.js +0 -0
- package/docs/scripts/search.min.js +5 -5
- package/docs/scripts/third-party/Apache-License-2.0.txt +0 -0
- package/docs/scripts/third-party/fuse.js +0 -0
- package/docs/scripts/third-party/hljs-line-num-original.js +0 -0
- package/docs/scripts/third-party/hljs-line-num.js +0 -0
- package/docs/scripts/third-party/hljs-original.js +0 -0
- package/docs/scripts/third-party/hljs.js +0 -0
- package/docs/scripts/third-party/popper.js +0 -0
- package/docs/scripts/third-party/tippy.js +0 -0
- package/docs/scripts/third-party/tocbot.js +0 -0
- package/docs/scripts/third-party/tocbot.min.js +0 -0
- package/docs/static/bitcoin.jpeg +0 -0
- package/docs/static/home.md +0 -0
- package/docs/static/logo-ecosystem.png +0 -0
- package/docs/static/logo.png +0 -0
- package/docs/styles/clean-jsdoc-theme-base.css +0 -0
- package/docs/styles/clean-jsdoc-theme-dark.css +0 -0
- package/docs/styles/clean-jsdoc-theme-light.css +0 -0
- package/docs/styles/clean-jsdoc-theme-scrollbar.css +0 -0
- package/docs/styles/clean-jsdoc-theme-without-scrollbar.min.css +0 -0
- package/docs/styles/clean-jsdoc-theme.min.css +0 -0
- package/extend/bajo/hook.js +300 -300
- package/extend/bajo/intl/en-US.json +0 -0
- package/extend/bajo/intl/id.json +0 -0
- package/extend/bajoCli/applet/create-new-site.js +21 -21
- package/extend/bajoCli/applet/populate-model-with-site.js +54 -54
- package/extend/bajoCli/applet/remove-site.js +20 -20
- package/extend/bajoCli/applet.js +0 -0
- package/extend/bajoTemplate/layout/centered.html +0 -0
- package/extend/bajoTemplate/layout/default.html +0 -0
- package/extend/bajoTemplate/layout/email.html +0 -0
- package/extend/bajoTemplate/layout/email.id.html +0 -0
- package/extend/bajoTemplate/layout/error.html +0 -0
- package/extend/bajoTemplate/layout/info.html +0 -0
- package/extend/bajoTemplate/partial/403.html +0 -0
- package/extend/bajoTemplate/partial/_admin/reset-user-password.html +0 -0
- package/extend/bajoTemplate/partial/_mail/help-contact-form.html +0 -0
- package/extend/bajoTemplate/partial/_mail/help-contact-form.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/mystuff-change-password.html +0 -0
- package/extend/bajoTemplate/partial/_mail/mystuff-change-password.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/mystuff-reset-api-key.html +0 -0
- package/extend/bajoTemplate/partial/_mail/mystuff-reset-api-key.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-activation-success.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-activation-success.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-forgot-password-changed.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-forgot-password-changed.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-forgot-password-link.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-forgot-password-link.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-signup-success-active.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-signup-success-active.id.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-signup-success.html +0 -0
- package/extend/bajoTemplate/partial/_mail/user-signup-success.id.html +0 -0
- package/extend/bajoTemplate/partial/api-key-modal.html +0 -0
- package/extend/bajoTemplate/partial/app-launcher.html +0 -0
- package/extend/bajoTemplate/partial/help/contact-form/form.html +0 -0
- package/extend/bajoTemplate/partial/help/contact-form/success.html +0 -0
- package/extend/bajoTemplate/partial/help/trouble-tickets/add.html +0 -0
- package/extend/bajoTemplate/partial/help/trouble-tickets/details.html +0 -0
- package/extend/bajoTemplate/partial/help/trouble-tickets/list.html +0 -0
- package/extend/bajoTemplate/partial/layout/address.html +0 -0
- package/extend/bajoTemplate/partial/layout/breadcrumb.html +0 -0
- package/extend/bajoTemplate/partial/layout/footer.html +0 -0
- package/extend/bajoTemplate/partial/layout/more-info.html +0 -0
- package/extend/bajoTemplate/partial/layout/more-info.id.html +0 -0
- package/extend/bajoTemplate/partial/layout/navbar.html +0 -0
- package/extend/bajoTemplate/partial/layout/sidebar.html +0 -0
- package/extend/bajoTemplate/partial/layout/socmed.html +0 -0
- package/extend/bajoTemplate/partial/list-item/change-password.html +0 -0
- package/extend/bajoTemplate/partial/list-item/forgot-password.html +0 -0
- package/extend/bajoTemplate/partial/list-item/goto-home.html +0 -0
- package/extend/bajoTemplate/partial/list-item/member-links.html +0 -0
- package/extend/bajoTemplate/partial/list-item/oauth-signin.html +0 -0
- package/extend/bajoTemplate/partial/list-item/signin.html +0 -0
- package/extend/bajoTemplate/partial/list-item/signout.html +0 -0
- package/extend/bajoTemplate/partial/list-item/user-signup.html +0 -0
- package/extend/bajoTemplate/partial/list-item/your-profile.html +0 -0
- package/extend/bajoTemplate/partial/signin.html +0 -0
- package/extend/bajoTemplate/partial/signout.html +0 -0
- package/extend/bajoTemplate/partial/user/activation.html +0 -0
- package/extend/bajoTemplate/partial/user/forgot-password-nomail.id.md +0 -0
- package/extend/bajoTemplate/partial/user/forgot-password-nomail.md +0 -0
- package/extend/bajoTemplate/partial/user/forgot-password.html +0 -0
- package/extend/bajoTemplate/partial/user/fpl-invalid.html +0 -0
- package/extend/bajoTemplate/partial/user/fpl-invalid.id.md +0 -0
- package/extend/bajoTemplate/partial/user/fpl-invalid.md +0 -0
- package/extend/bajoTemplate/partial/user/fpl.html +0 -0
- package/extend/bajoTemplate/partial/user/signup/form.html +0 -0
- package/extend/bajoTemplate/partial/user/signup/success-mail.id.md +0 -0
- package/extend/bajoTemplate/partial/user/signup/success-mail.md +0 -0
- package/extend/bajoTemplate/partial/user/signup/success-nomail.id.md +0 -0
- package/extend/bajoTemplate/partial/user/signup/success-nomail.md +0 -0
- package/extend/bajoTemplate/partial/user/signup/success.html +0 -0
- package/extend/bajoTemplate/partial/your-stuff/change-password.html +0 -0
- package/extend/bajoTemplate/partial/your-stuff/profile/edit.html +0 -0
- package/extend/bajoTemplate/partial/your-stuff/profile/view.html +0 -0
- package/extend/bajoTemplate/partial/your-stuff/reset-api-key.html +0 -0
- package/extend/bajoTemplate/template/403.html +0 -0
- package/extend/bajoTemplate/template/_admin/reset-user-password.html +0 -0
- package/extend/bajoTemplate/template/_mail/help-contact-form.html +0 -0
- package/extend/bajoTemplate/template/_mail/mystuff-change-password.html +0 -0
- package/extend/bajoTemplate/template/_mail/mystuff-reset-api-key.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-activation-success.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-forgot-password-changed.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-forgot-password-link.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-signup-success-active.html +0 -0
- package/extend/bajoTemplate/template/_mail/user-signup-success.html +0 -0
- package/extend/bajoTemplate/template/help/contact-form/form.html +0 -0
- package/extend/bajoTemplate/template/help/contact-form/success.html +0 -0
- package/extend/bajoTemplate/template/help/trouble-tickets/add.html +0 -0
- package/extend/bajoTemplate/template/help/trouble-tickets/details.html +0 -0
- package/extend/bajoTemplate/template/help/trouble-tickets/list.html +0 -0
- package/extend/bajoTemplate/template/info/about-us.md +0 -0
- package/extend/bajoTemplate/template/info/cookie-policy.md +0 -0
- package/extend/bajoTemplate/template/info/privacy.md +0 -0
- package/extend/bajoTemplate/template/info/terms-conditions.md +0 -0
- package/extend/bajoTemplate/template/signin.html +0 -0
- package/extend/bajoTemplate/template/signout.html +0 -0
- package/extend/bajoTemplate/template/user/activation.html +0 -0
- package/extend/bajoTemplate/template/user/forgot-password.html +0 -0
- package/extend/bajoTemplate/template/user/fpl-invalid.html +0 -0
- package/extend/bajoTemplate/template/user/fpl.html +0 -0
- package/extend/bajoTemplate/template/user/signup/form.html +0 -0
- package/extend/bajoTemplate/template/user/signup/success.html +0 -0
- package/extend/bajoTemplate/template/your-stuff/change-password.html +0 -0
- package/extend/bajoTemplate/template/your-stuff/profile/edit.html +0 -0
- package/extend/bajoTemplate/template/your-stuff/profile/view.html +0 -0
- package/extend/bajoTemplate/template/your-stuff/reset-api-key.html +0 -0
- package/extend/dobo/feature/address.js +0 -0
- package/extend/dobo/feature/category.js +0 -0
- package/extend/dobo/feature/country.js +4 -2
- package/extend/dobo/feature/email.js +0 -0
- package/extend/dobo/feature/lat-lng.js +0 -0
- package/extend/dobo/feature/lat.js +0 -0
- package/extend/dobo/feature/lng.js +0 -0
- package/extend/dobo/feature/notes.js +0 -0
- package/extend/dobo/feature/person-in-charge.js +0 -0
- package/extend/dobo/feature/phone.js +0 -0
- package/extend/dobo/feature/site-id.js +0 -0
- package/extend/dobo/feature/site-ids.js +0 -0
- package/extend/dobo/feature/slug.js +0 -0
- package/extend/dobo/feature/social.js +0 -0
- package/extend/dobo/feature/status.js +0 -0
- package/extend/dobo/feature/team-id.js +0 -0
- package/extend/dobo/feature/team-ids.js +0 -0
- package/extend/dobo/feature/ts.js +0 -0
- package/extend/dobo/feature/url.js +0 -0
- package/extend/dobo/feature/user-id.js +0 -0
- package/extend/dobo/fixture/contact-form-cat.json +0 -0
- package/extend/dobo/fixture/site.json +0 -0
- package/extend/dobo/fixture/team-user.json +0 -0
- package/extend/dobo/fixture/team.json +0 -0
- package/extend/dobo/fixture/ticket-cat.json +0 -0
- package/extend/dobo/fixture/user.json +0 -0
- package/extend/dobo/model.js +303 -303
- package/extend/dobo/model.json +161 -161
- package/extend/masohiSocketIo/middleware/server/auth.js +0 -0
- package/extend/sumba/route/anonymous.json +5 -5
- package/extend/sumba/route/secure.json +8 -8
- package/extend/waibuBootstrap/theme/component/widget/nav-dropdown-user.js +0 -0
- package/extend/waibuDb/schema/anonymous-guard.js +0 -0
- package/extend/waibuDb/schema/attrib-guard.js +0 -0
- package/extend/waibuDb/schema/contact-form-cat.json +0 -0
- package/extend/waibuDb/schema/contact-form.json +0 -0
- package/extend/waibuDb/schema/download.js +0 -0
- package/extend/waibuDb/schema/model-guard.js +0 -0
- package/extend/waibuDb/schema/secure-guard.js +0 -0
- package/extend/waibuDb/schema/site-setting.js +0 -0
- package/extend/waibuDb/schema/site.js +0 -0
- package/extend/waibuDb/schema/team-setting.js +0 -0
- package/extend/waibuDb/schema/team-user.js +0 -0
- package/extend/waibuDb/schema/team.json +0 -0
- package/extend/waibuDb/schema/ticket-cat.json +0 -0
- package/extend/waibuDb/schema/ticket.js +0 -0
- package/extend/waibuDb/schema/user-setting.js +0 -0
- package/extend/waibuDb/schema/user.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/action-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/anonymous-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/attrib-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/contact-form/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/contact-form-cat/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/download/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/query-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/reset-user-password.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/secure-guard/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/site-setting/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/site.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/team/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/team-setting/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/team-user/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/ticket/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/ticket-cat/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/user/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/user-setting/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/x/cache/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/x/session/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/x/site/@action.js +0 -0
- package/extend/waibuMpa/extend/waibuAdmin/route/x/site-setting/@action.js +0 -0
- package/extend/waibuMpa/route/access-token.js +0 -0
- package/extend/waibuMpa/route/help/contact-form.js +0 -0
- package/extend/waibuMpa/route/help/trouble-tickets/add.js +0 -0
- package/extend/waibuMpa/route/help/trouble-tickets/details/@id.js +0 -0
- package/extend/waibuMpa/route/help/trouble-tickets/list.js +0 -0
- package/extend/waibuMpa/route/info/@item.js +0 -0
- package/extend/waibuMpa/route/signin.js +0 -0
- package/extend/waibuMpa/route/signout.js +0 -0
- package/extend/waibuMpa/route/user/activation.js +0 -0
- package/extend/waibuMpa/route/user/forgot-password/@fpl.js +0 -0
- package/extend/waibuMpa/route/user/forgot-password.js +0 -0
- package/extend/waibuMpa/route/user/signup.js +0 -0
- package/extend/waibuMpa/route/your-stuff/change-password.js +0 -0
- package/extend/waibuMpa/route/your-stuff/download/@action.js +0 -0
- package/extend/waibuMpa/route/your-stuff/download/get.js +0 -0
- package/extend/waibuMpa/route/your-stuff/profile/edit.js +0 -0
- package/extend/waibuMpa/route/your-stuff/profile.js +0 -0
- package/extend/waibuMpa/route/your-stuff/reset-api-key.js +0 -0
- package/extend/waibuRestApi/route/info/get.js +0 -0
- package/extend/waibuRestApi/route/manage/anonymous-guard/model-builder.json +0 -0
- package/extend/waibuRestApi/route/manage/secure-guard/model-builder.json +0 -0
- package/extend/waibuRestApi/route/manage/team/model-builder.json +0 -0
- package/extend/waibuRestApi/route/manage/ticket-cat/model-builder.json +0 -0
- package/extend/waibuRestApi/route/manage/user/model-builder.json +0 -0
- package/extend/waibuRestApi/route/user/access-token/@type/create.js +0 -0
- package/extend/waibuRestApi/route/user/api-key/get.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/api-key/get.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/api-key/update.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/change-password/update.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/profile/get.js +0 -0
- package/extend/waibuRestApi/route/your-stuff/profile/update.js +0 -0
- package/extend/waibuSocketIo/middleware/server/auth.js +0 -0
- package/extend/waibuStatic/asset/user-profile.png +0 -0
- package/index.js +2 -1
- package/lib/config.js +202 -202
- package/lib/constant.js +0 -0
- package/logo.png +0 -0
- package/package.json +1 -1
- package/wiki/CHANGES.md +395 -383
- package/wiki/CONFIG.md +0 -0
- package/wiki/CONTRIBUTING.md +0 -0
- package/wiki/DEV-GUIDE.md +0 -0
- package/wiki/ECOSYSTEM.md +0 -0
- package/wiki/GETTING-STARTED.md +0 -0
- package/wiki/USER-GUIDE.md +0 -0
package/extend/dobo/model.js
CHANGED
|
@@ -1,303 +1,303 @@
|
|
|
1
|
-
const buildEnd = async function (model) {
|
|
2
|
-
const prop = model.properties.find(prop => prop.name === 'models')
|
|
3
|
-
if (prop) prop.values = this.getModelNames(true)
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const options = {
|
|
7
|
-
attachment: false,
|
|
8
|
-
cache: { ttlDur: 0 }
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const allTeams = {
|
|
12
|
-
name: 'allTeams',
|
|
13
|
-
type: 'boolean',
|
|
14
|
-
default: true,
|
|
15
|
-
required: true
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const routeGuard = {
|
|
19
|
-
properties: [
|
|
20
|
-
{
|
|
21
|
-
name: 'path',
|
|
22
|
-
maxLength: 255,
|
|
23
|
-
required: true
|
|
24
|
-
},
|
|
25
|
-
allTeams,
|
|
26
|
-
'teamIds,sumba:teamIds',
|
|
27
|
-
{
|
|
28
|
-
name: 'weight',
|
|
29
|
-
type: 'smallint',
|
|
30
|
-
index: true,
|
|
31
|
-
default: 0
|
|
32
|
-
},
|
|
33
|
-
'siteId,sumba:siteId'
|
|
34
|
-
],
|
|
35
|
-
features: [
|
|
36
|
-
'sumba:status',
|
|
37
|
-
'dobo:updatedAt',
|
|
38
|
-
'dobo:immutable'
|
|
39
|
-
],
|
|
40
|
-
indexes: [{
|
|
41
|
-
type: 'unique',
|
|
42
|
-
fields: ['siteId', 'path']
|
|
43
|
-
}],
|
|
44
|
-
options: { ...options }
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
const download = {
|
|
48
|
-
baseName: 'download',
|
|
49
|
-
properties: [
|
|
50
|
-
'description,,50,true',
|
|
51
|
-
'file,text,,,true',
|
|
52
|
-
'type,,20,true',
|
|
53
|
-
'jobQueue,object',
|
|
54
|
-
{
|
|
55
|
-
name: 'size',
|
|
56
|
-
type: 'integer',
|
|
57
|
-
default: 0,
|
|
58
|
-
index: true
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
name: 'download',
|
|
62
|
-
type: 'string',
|
|
63
|
-
virtual: true,
|
|
64
|
-
getValue: async function (val, rec) {
|
|
65
|
-
return rec.status === 'COMPLETE' ? 'download' : 'nA'
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
features: ['sumba:siteId', 'sumba:userId', 'dobo:createdAt', 'dobo:updatedAt', {
|
|
70
|
-
name: 'sumba:status',
|
|
71
|
-
default: 'QUEUE',
|
|
72
|
-
values: ['QUEUE', 'MQUEUE', 'PROCESSING', 'COMPLETE', 'FAIL']
|
|
73
|
-
}]
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async function model () {
|
|
77
|
-
const { merge, cloneDeep } = this.app.lib._
|
|
78
|
-
return [download, {
|
|
79
|
-
baseName: 'attrib-guard',
|
|
80
|
-
properties: [
|
|
81
|
-
{
|
|
82
|
-
name: 'models',
|
|
83
|
-
type: 'array',
|
|
84
|
-
required: true
|
|
85
|
-
},
|
|
86
|
-
'hiddenFields,array',
|
|
87
|
-
allTeams,
|
|
88
|
-
'teamIds,sumba:teamIds',
|
|
89
|
-
'siteId,sumba:siteId'
|
|
90
|
-
],
|
|
91
|
-
features: [
|
|
92
|
-
'sumba:status',
|
|
93
|
-
'dobo:updatedAt',
|
|
94
|
-
'dobo:immutable'
|
|
95
|
-
],
|
|
96
|
-
options: { ...options },
|
|
97
|
-
buildEnd
|
|
98
|
-
}, {
|
|
99
|
-
baseName: 'action-guard',
|
|
100
|
-
properties: [
|
|
101
|
-
{
|
|
102
|
-
name: 'models',
|
|
103
|
-
type: 'array',
|
|
104
|
-
required: true
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
name: 'value',
|
|
108
|
-
type: 'array',
|
|
109
|
-
required: true,
|
|
110
|
-
values: ['*', 'READ', 'CREATE', 'UPDATE', 'REMOVE', 'EXPORT', 'IMPORT'],
|
|
111
|
-
default: ['*']
|
|
112
|
-
},
|
|
113
|
-
allTeams,
|
|
114
|
-
'teamIds,sumba:teamIds',
|
|
115
|
-
'siteId,sumba:siteId'
|
|
116
|
-
],
|
|
117
|
-
features: [
|
|
118
|
-
'sumba:status',
|
|
119
|
-
'dobo:updatedAt',
|
|
120
|
-
'dobo:immutable'
|
|
121
|
-
],
|
|
122
|
-
options: { ...options },
|
|
123
|
-
buildEnd
|
|
124
|
-
}, {
|
|
125
|
-
baseName: 'query-guard',
|
|
126
|
-
properties: [
|
|
127
|
-
{
|
|
128
|
-
name: 'models',
|
|
129
|
-
type: 'array',
|
|
130
|
-
required: true
|
|
131
|
-
},
|
|
132
|
-
'field,,50,true,true',
|
|
133
|
-
{
|
|
134
|
-
name: 'condition',
|
|
135
|
-
type: 'string',
|
|
136
|
-
maxLength: 20,
|
|
137
|
-
required: true,
|
|
138
|
-
values: ['IN', 'NIN', 'EQ', 'NE', 'GT', 'GTE', 'LT', 'LTE', 'BETWEEN'],
|
|
139
|
-
default: 'IN'
|
|
140
|
-
},
|
|
141
|
-
'value,array,,,true',
|
|
142
|
-
allTeams,
|
|
143
|
-
'teamIds,sumba:teamIds',
|
|
144
|
-
'siteId,sumba:siteId'
|
|
145
|
-
],
|
|
146
|
-
features: [
|
|
147
|
-
'sumba:status',
|
|
148
|
-
'dobo:updatedAt',
|
|
149
|
-
'dobo:immutable'
|
|
150
|
-
],
|
|
151
|
-
options: { ...options },
|
|
152
|
-
buildEnd
|
|
153
|
-
},
|
|
154
|
-
merge(cloneDeep(routeGuard), { baseName: 'anonymous-guard' }),
|
|
155
|
-
merge(cloneDeep(routeGuard), { baseName: 'secure-guard' }),
|
|
156
|
-
{
|
|
157
|
-
buildLevel: 2,
|
|
158
|
-
baseName: 'user',
|
|
159
|
-
properties: [{
|
|
160
|
-
name: 'username',
|
|
161
|
-
type: 'string',
|
|
162
|
-
minLength: 5,
|
|
163
|
-
maxLength: 50,
|
|
164
|
-
rules: ['alphanum']
|
|
165
|
-
}, {
|
|
166
|
-
name: 'password',
|
|
167
|
-
type: 'string',
|
|
168
|
-
minLength: 8,
|
|
169
|
-
maxLength: 100
|
|
170
|
-
}, {
|
|
171
|
-
name: 'token',
|
|
172
|
-
type: 'string',
|
|
173
|
-
maxLength: 100,
|
|
174
|
-
index: true
|
|
175
|
-
}, {
|
|
176
|
-
name: 'salt',
|
|
177
|
-
type: 'string',
|
|
178
|
-
maxLength: 100,
|
|
179
|
-
required: true
|
|
180
|
-
}, {
|
|
181
|
-
name: 'apiKey',
|
|
182
|
-
type: 'string',
|
|
183
|
-
maxLength: 100,
|
|
184
|
-
virtual: true,
|
|
185
|
-
getValue: async function (val, rec) {
|
|
186
|
-
if (!rec.salt) return
|
|
187
|
-
return await this.plugin.hash(rec.salt)
|
|
188
|
-
}
|
|
189
|
-
}, {
|
|
190
|
-
name: 'provider',
|
|
191
|
-
type: 'string',
|
|
192
|
-
maxLength: 50,
|
|
193
|
-
index: true,
|
|
194
|
-
default: 'local'
|
|
195
|
-
}, {
|
|
196
|
-
name: 'email',
|
|
197
|
-
type: 'string',
|
|
198
|
-
maxLength: 100,
|
|
199
|
-
required: true,
|
|
200
|
-
rules: ['email']
|
|
201
|
-
}, {
|
|
202
|
-
name: 'firstName',
|
|
203
|
-
type: 'string',
|
|
204
|
-
maxLength: 50,
|
|
205
|
-
required: true,
|
|
206
|
-
index: true
|
|
207
|
-
}, {
|
|
208
|
-
name: 'lastName',
|
|
209
|
-
type: 'string',
|
|
210
|
-
maxLength: 50,
|
|
211
|
-
required: true,
|
|
212
|
-
index: true
|
|
213
|
-
}],
|
|
214
|
-
rules: [{ rule: 'trim', fields: ['username', 'firstName', 'lastName'] }],
|
|
215
|
-
indexes: [{
|
|
216
|
-
fields: ['username', 'siteId'],
|
|
217
|
-
type: 'unique'
|
|
218
|
-
}, {
|
|
219
|
-
fields: ['email', 'siteId'],
|
|
220
|
-
type: 'unique'
|
|
221
|
-
}],
|
|
222
|
-
hidden: ['password'],
|
|
223
|
-
features: [
|
|
224
|
-
'sumba:address',
|
|
225
|
-
'sumba:social',
|
|
226
|
-
{
|
|
227
|
-
name: 'sumba:status',
|
|
228
|
-
default: 'UNVERIFIED',
|
|
229
|
-
values: ['UNVERIFIED', 'ACTIVE', 'INACTIVE']
|
|
230
|
-
},
|
|
231
|
-
'sumba:siteId',
|
|
232
|
-
'dobo:createdAt',
|
|
233
|
-
'dobo:updatedAt',
|
|
234
|
-
'dobo:immutable'
|
|
235
|
-
],
|
|
236
|
-
hooks: [{
|
|
237
|
-
name: 'afterRecordValidation',
|
|
238
|
-
handler: async function (body, options) {
|
|
239
|
-
const { isBcrypt, hash } = this.app.bajoExtra
|
|
240
|
-
const { has } = this.app.lib._
|
|
241
|
-
|
|
242
|
-
if (has(body, 'password') && !isBcrypt(body.password)) body.password = await hash(body.password, 'bcrypt')
|
|
243
|
-
}
|
|
244
|
-
}, {
|
|
245
|
-
name: 'beforeCreateRecord',
|
|
246
|
-
handler: async function (body, options = {}) {
|
|
247
|
-
const { token, salt } = await this.plugin.resetToken()
|
|
248
|
-
body.token = token
|
|
249
|
-
body.salt = salt
|
|
250
|
-
}
|
|
251
|
-
}, {
|
|
252
|
-
name: 'beforeRecordValidation',
|
|
253
|
-
handler: async function (body, options = {}) {
|
|
254
|
-
const { set } = this.app.lib._
|
|
255
|
-
const password = await this.plugin.passwordRule(options.req)
|
|
256
|
-
const rule = { password }
|
|
257
|
-
set(options, 'validation.params.rule', rule)
|
|
258
|
-
}
|
|
259
|
-
}, {
|
|
260
|
-
name: 'beforeUpdateRecord',
|
|
261
|
-
handler: async function (id, body, options = {}) {
|
|
262
|
-
if (body.salt) {
|
|
263
|
-
const { token, salt } = await this.plugin.resetToken(body.salt)
|
|
264
|
-
body.token = token
|
|
265
|
-
body.salt = salt
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}]
|
|
269
|
-
}, {
|
|
270
|
-
baseName: 'ticket',
|
|
271
|
-
properties: [
|
|
272
|
-
'subject,,255,true,true',
|
|
273
|
-
{
|
|
274
|
-
name: 'cat',
|
|
275
|
-
type: 'string',
|
|
276
|
-
maxLength: 50,
|
|
277
|
-
index: true,
|
|
278
|
-
required: true,
|
|
279
|
-
values: async function ({ req } = {}) {
|
|
280
|
-
const { getModel } = this.app.dobo
|
|
281
|
-
const model = await getModel('SumbaTicketCat')
|
|
282
|
-
const opts = { req, noMagic: true, dataOnly: true, fields: ['name'] }
|
|
283
|
-
const results = await model.findAllRecords({ sort: { level: 1, name: 1 } }, opts)
|
|
284
|
-
return results.map(r => r.name)
|
|
285
|
-
}
|
|
286
|
-
},
|
|
287
|
-
'message,text,,,true'
|
|
288
|
-
],
|
|
289
|
-
features: [
|
|
290
|
-
'dobo:createdAt',
|
|
291
|
-
'dobo:updatedAt',
|
|
292
|
-
'sumba:siteId',
|
|
293
|
-
'sumba:userId',
|
|
294
|
-
{
|
|
295
|
-
name: 'sumba:status',
|
|
296
|
-
default: 'OPEN',
|
|
297
|
-
values: ['OPEN', 'CLOSED']
|
|
298
|
-
}
|
|
299
|
-
]
|
|
300
|
-
}]
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
export default model
|
|
1
|
+
const buildEnd = async function (model) {
|
|
2
|
+
const prop = model.properties.find(prop => prop.name === 'models')
|
|
3
|
+
if (prop) prop.values = this.getModelNames(true)
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const options = {
|
|
7
|
+
attachment: false,
|
|
8
|
+
cache: { ttlDur: 0 }
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const allTeams = {
|
|
12
|
+
name: 'allTeams',
|
|
13
|
+
type: 'boolean',
|
|
14
|
+
default: true,
|
|
15
|
+
required: true
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const routeGuard = {
|
|
19
|
+
properties: [
|
|
20
|
+
{
|
|
21
|
+
name: 'path',
|
|
22
|
+
maxLength: 255,
|
|
23
|
+
required: true
|
|
24
|
+
},
|
|
25
|
+
allTeams,
|
|
26
|
+
'teamIds,sumba:teamIds',
|
|
27
|
+
{
|
|
28
|
+
name: 'weight',
|
|
29
|
+
type: 'smallint',
|
|
30
|
+
index: true,
|
|
31
|
+
default: 0
|
|
32
|
+
},
|
|
33
|
+
'siteId,sumba:siteId'
|
|
34
|
+
],
|
|
35
|
+
features: [
|
|
36
|
+
'sumba:status',
|
|
37
|
+
'dobo:updatedAt',
|
|
38
|
+
'dobo:immutable'
|
|
39
|
+
],
|
|
40
|
+
indexes: [{
|
|
41
|
+
type: 'unique',
|
|
42
|
+
fields: ['siteId', 'path']
|
|
43
|
+
}],
|
|
44
|
+
options: { ...options }
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const download = {
|
|
48
|
+
baseName: 'download',
|
|
49
|
+
properties: [
|
|
50
|
+
'description,,50,true',
|
|
51
|
+
'file,text,,,true',
|
|
52
|
+
'type,,20,true',
|
|
53
|
+
'jobQueue,object',
|
|
54
|
+
{
|
|
55
|
+
name: 'size',
|
|
56
|
+
type: 'integer',
|
|
57
|
+
default: 0,
|
|
58
|
+
index: true
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'download',
|
|
62
|
+
type: 'string',
|
|
63
|
+
virtual: true,
|
|
64
|
+
getValue: async function (val, rec) {
|
|
65
|
+
return rec.status === 'COMPLETE' ? 'download' : 'nA'
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
features: ['sumba:siteId', 'sumba:userId', 'dobo:createdAt', 'dobo:updatedAt', {
|
|
70
|
+
name: 'sumba:status',
|
|
71
|
+
default: 'QUEUE',
|
|
72
|
+
values: ['QUEUE', 'MQUEUE', 'PROCESSING', 'COMPLETE', 'FAIL']
|
|
73
|
+
}]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function model () {
|
|
77
|
+
const { merge, cloneDeep } = this.app.lib._
|
|
78
|
+
return [download, {
|
|
79
|
+
baseName: 'attrib-guard',
|
|
80
|
+
properties: [
|
|
81
|
+
{
|
|
82
|
+
name: 'models',
|
|
83
|
+
type: 'array',
|
|
84
|
+
required: true
|
|
85
|
+
},
|
|
86
|
+
'hiddenFields,array',
|
|
87
|
+
allTeams,
|
|
88
|
+
'teamIds,sumba:teamIds',
|
|
89
|
+
'siteId,sumba:siteId'
|
|
90
|
+
],
|
|
91
|
+
features: [
|
|
92
|
+
'sumba:status',
|
|
93
|
+
'dobo:updatedAt',
|
|
94
|
+
'dobo:immutable'
|
|
95
|
+
],
|
|
96
|
+
options: { ...options },
|
|
97
|
+
buildEnd
|
|
98
|
+
}, {
|
|
99
|
+
baseName: 'action-guard',
|
|
100
|
+
properties: [
|
|
101
|
+
{
|
|
102
|
+
name: 'models',
|
|
103
|
+
type: 'array',
|
|
104
|
+
required: true
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
name: 'value',
|
|
108
|
+
type: 'array',
|
|
109
|
+
required: true,
|
|
110
|
+
values: ['*', 'READ', 'CREATE', 'UPDATE', 'REMOVE', 'EXPORT', 'IMPORT'],
|
|
111
|
+
default: ['*']
|
|
112
|
+
},
|
|
113
|
+
allTeams,
|
|
114
|
+
'teamIds,sumba:teamIds',
|
|
115
|
+
'siteId,sumba:siteId'
|
|
116
|
+
],
|
|
117
|
+
features: [
|
|
118
|
+
'sumba:status',
|
|
119
|
+
'dobo:updatedAt',
|
|
120
|
+
'dobo:immutable'
|
|
121
|
+
],
|
|
122
|
+
options: { ...options },
|
|
123
|
+
buildEnd
|
|
124
|
+
}, {
|
|
125
|
+
baseName: 'query-guard',
|
|
126
|
+
properties: [
|
|
127
|
+
{
|
|
128
|
+
name: 'models',
|
|
129
|
+
type: 'array',
|
|
130
|
+
required: true
|
|
131
|
+
},
|
|
132
|
+
'field,,50,true,true',
|
|
133
|
+
{
|
|
134
|
+
name: 'condition',
|
|
135
|
+
type: 'string',
|
|
136
|
+
maxLength: 20,
|
|
137
|
+
required: true,
|
|
138
|
+
values: ['IN', 'NIN', 'EQ', 'NE', 'GT', 'GTE', 'LT', 'LTE', 'BETWEEN'],
|
|
139
|
+
default: 'IN'
|
|
140
|
+
},
|
|
141
|
+
'value,array,,,true',
|
|
142
|
+
allTeams,
|
|
143
|
+
'teamIds,sumba:teamIds',
|
|
144
|
+
'siteId,sumba:siteId'
|
|
145
|
+
],
|
|
146
|
+
features: [
|
|
147
|
+
'sumba:status',
|
|
148
|
+
'dobo:updatedAt',
|
|
149
|
+
'dobo:immutable'
|
|
150
|
+
],
|
|
151
|
+
options: { ...options },
|
|
152
|
+
buildEnd
|
|
153
|
+
},
|
|
154
|
+
merge(cloneDeep(routeGuard), { baseName: 'anonymous-guard' }),
|
|
155
|
+
merge(cloneDeep(routeGuard), { baseName: 'secure-guard' }),
|
|
156
|
+
{
|
|
157
|
+
buildLevel: 2,
|
|
158
|
+
baseName: 'user',
|
|
159
|
+
properties: [{
|
|
160
|
+
name: 'username',
|
|
161
|
+
type: 'string',
|
|
162
|
+
minLength: 5,
|
|
163
|
+
maxLength: 50,
|
|
164
|
+
rules: ['alphanum']
|
|
165
|
+
}, {
|
|
166
|
+
name: 'password',
|
|
167
|
+
type: 'string',
|
|
168
|
+
minLength: 8,
|
|
169
|
+
maxLength: 100
|
|
170
|
+
}, {
|
|
171
|
+
name: 'token',
|
|
172
|
+
type: 'string',
|
|
173
|
+
maxLength: 100,
|
|
174
|
+
index: true
|
|
175
|
+
}, {
|
|
176
|
+
name: 'salt',
|
|
177
|
+
type: 'string',
|
|
178
|
+
maxLength: 100,
|
|
179
|
+
required: true
|
|
180
|
+
}, {
|
|
181
|
+
name: 'apiKey',
|
|
182
|
+
type: 'string',
|
|
183
|
+
maxLength: 100,
|
|
184
|
+
virtual: true,
|
|
185
|
+
getValue: async function (val, rec) {
|
|
186
|
+
if (!rec.salt) return
|
|
187
|
+
return await this.plugin.hash(rec.salt)
|
|
188
|
+
}
|
|
189
|
+
}, {
|
|
190
|
+
name: 'provider',
|
|
191
|
+
type: 'string',
|
|
192
|
+
maxLength: 50,
|
|
193
|
+
index: true,
|
|
194
|
+
default: 'local'
|
|
195
|
+
}, {
|
|
196
|
+
name: 'email',
|
|
197
|
+
type: 'string',
|
|
198
|
+
maxLength: 100,
|
|
199
|
+
required: true,
|
|
200
|
+
rules: ['email']
|
|
201
|
+
}, {
|
|
202
|
+
name: 'firstName',
|
|
203
|
+
type: 'string',
|
|
204
|
+
maxLength: 50,
|
|
205
|
+
required: true,
|
|
206
|
+
index: true
|
|
207
|
+
}, {
|
|
208
|
+
name: 'lastName',
|
|
209
|
+
type: 'string',
|
|
210
|
+
maxLength: 50,
|
|
211
|
+
required: true,
|
|
212
|
+
index: true
|
|
213
|
+
}],
|
|
214
|
+
rules: [{ rule: 'trim', fields: ['username', 'firstName', 'lastName'] }],
|
|
215
|
+
indexes: [{
|
|
216
|
+
fields: ['username', 'siteId'],
|
|
217
|
+
type: 'unique'
|
|
218
|
+
}, {
|
|
219
|
+
fields: ['email', 'siteId'],
|
|
220
|
+
type: 'unique'
|
|
221
|
+
}],
|
|
222
|
+
hidden: ['password'],
|
|
223
|
+
features: [
|
|
224
|
+
'sumba:address',
|
|
225
|
+
'sumba:social',
|
|
226
|
+
{
|
|
227
|
+
name: 'sumba:status',
|
|
228
|
+
default: 'UNVERIFIED',
|
|
229
|
+
values: ['UNVERIFIED', 'ACTIVE', 'INACTIVE']
|
|
230
|
+
},
|
|
231
|
+
'sumba:siteId',
|
|
232
|
+
'dobo:createdAt',
|
|
233
|
+
'dobo:updatedAt',
|
|
234
|
+
'dobo:immutable'
|
|
235
|
+
],
|
|
236
|
+
hooks: [{
|
|
237
|
+
name: 'afterRecordValidation',
|
|
238
|
+
handler: async function (body, options) {
|
|
239
|
+
const { isBcrypt, hash } = this.app.bajoExtra
|
|
240
|
+
const { has } = this.app.lib._
|
|
241
|
+
|
|
242
|
+
if (has(body, 'password') && !isBcrypt(body.password)) body.password = await hash(body.password, 'bcrypt')
|
|
243
|
+
}
|
|
244
|
+
}, {
|
|
245
|
+
name: 'beforeCreateRecord',
|
|
246
|
+
handler: async function (body, options = {}) {
|
|
247
|
+
const { token, salt } = await this.plugin.resetToken()
|
|
248
|
+
body.token = token
|
|
249
|
+
body.salt = salt
|
|
250
|
+
}
|
|
251
|
+
}, {
|
|
252
|
+
name: 'beforeRecordValidation',
|
|
253
|
+
handler: async function (body, options = {}) {
|
|
254
|
+
const { set } = this.app.lib._
|
|
255
|
+
const password = await this.plugin.passwordRule(options.req)
|
|
256
|
+
const rule = { password }
|
|
257
|
+
set(options, 'validation.params.rule', rule)
|
|
258
|
+
}
|
|
259
|
+
}, {
|
|
260
|
+
name: 'beforeUpdateRecord',
|
|
261
|
+
handler: async function (id, body, options = {}) {
|
|
262
|
+
if (body.salt) {
|
|
263
|
+
const { token, salt } = await this.plugin.resetToken(body.salt)
|
|
264
|
+
body.token = token
|
|
265
|
+
body.salt = salt
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}]
|
|
269
|
+
}, {
|
|
270
|
+
baseName: 'ticket',
|
|
271
|
+
properties: [
|
|
272
|
+
'subject,,255,true,true',
|
|
273
|
+
{
|
|
274
|
+
name: 'cat',
|
|
275
|
+
type: 'string',
|
|
276
|
+
maxLength: 50,
|
|
277
|
+
index: true,
|
|
278
|
+
required: true,
|
|
279
|
+
values: async function ({ req } = {}) {
|
|
280
|
+
const { getModel } = this.app.dobo
|
|
281
|
+
const model = await getModel('SumbaTicketCat')
|
|
282
|
+
const opts = { req, noMagic: true, dataOnly: true, fields: ['name'] }
|
|
283
|
+
const results = await model.findAllRecords({ sort: { level: 1, name: 1 } }, opts)
|
|
284
|
+
return results.map(r => r.name)
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
'message,text,,,true'
|
|
288
|
+
],
|
|
289
|
+
features: [
|
|
290
|
+
'dobo:createdAt',
|
|
291
|
+
'dobo:updatedAt',
|
|
292
|
+
'sumba:siteId',
|
|
293
|
+
'sumba:userId',
|
|
294
|
+
{
|
|
295
|
+
name: 'sumba:status',
|
|
296
|
+
default: 'OPEN',
|
|
297
|
+
values: ['OPEN', 'CLOSED']
|
|
298
|
+
}
|
|
299
|
+
]
|
|
300
|
+
}]
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export default model
|