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
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
async function populateModelWithSite (path, ...args) {
|
|
2
|
-
const { getModel } = this.app.dobo
|
|
3
|
-
const { importPkg } = this.app.bajo
|
|
4
|
-
const { isArray, has } = this.app.lib._
|
|
5
|
-
const confirm = await importPkg('bajoCli:@inquirer/confirm')
|
|
6
|
-
let [modelName, alias, keys] = args
|
|
7
|
-
if (!modelName) this.print.fatal('modelRequired')
|
|
8
|
-
if (!alias) this.print.fatal('aliasRequired')
|
|
9
|
-
const model = getModel(modelName, true)
|
|
10
|
-
if (!model) this.print.fatal('modelNotFound%s', modelName)
|
|
11
|
-
if (!model.hasProperty('siteId')) this.print.fatal('noSiteIdProperty%s', modelName)
|
|
12
|
-
const answer = await confirm({ message: this.print.buildText('aboutToRebuildModelWithSite%s%s', modelName, alias), default: false })
|
|
13
|
-
if (!answer) {
|
|
14
|
-
this.print.fail('aborted')
|
|
15
|
-
this.app.exit()
|
|
16
|
-
}
|
|
17
|
-
if (alias.includes(',')) alias = alias.split(',').map(item => item.trim())
|
|
18
|
-
keys = keys ? keys.split(',').map(item => item.trim()) : []
|
|
19
|
-
await this.app.dobo.start()
|
|
20
|
-
try {
|
|
21
|
-
const fixtures = await model.loadFixtures({ ignoreError: false, collectItems: true })
|
|
22
|
-
const siteModel = getModel('SumbaSite')
|
|
23
|
-
let sites = []
|
|
24
|
-
if (['all', '*'].includes(alias)) {
|
|
25
|
-
sites = await siteModel.findAllRecord({}, { dataOnly: true, fields: ['id', 'hostname'] })
|
|
26
|
-
} else {
|
|
27
|
-
if (!isArray(alias)) alias = [alias]
|
|
28
|
-
sites = await siteModel.findAllRecord({ query: { alias: { $in: alias } } }, { dataOnly: true, fields: ['id', 'hostname'] })
|
|
29
|
-
}
|
|
30
|
-
await model.transaction(async (trx) => {
|
|
31
|
-
for (const site of sites) {
|
|
32
|
-
for (const fixture of fixtures) {
|
|
33
|
-
const siteId = site.id + ''
|
|
34
|
-
fixture.siteId = siteId
|
|
35
|
-
const query = { siteId }
|
|
36
|
-
for (const key of keys) {
|
|
37
|
-
if (has(fixture, key)) query[key] = fixture[key]
|
|
38
|
-
}
|
|
39
|
-
const results = await model.findAllRecord({ query }, { fields: ['id'], trx })
|
|
40
|
-
for (const rec of results) {
|
|
41
|
-
await model.removeRecord(rec.id, { noCache: true, noResult: true, trx, throwNotFound: false })
|
|
42
|
-
}
|
|
43
|
-
await model.createRecord(fixture, { noCache: true, noResult: true, trx })
|
|
44
|
-
}
|
|
45
|
-
this.print.info('modelPopulated%s%s', site.hostname, fixtures.length)
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
} catch (err) {
|
|
49
|
-
this.print.fatal(err)
|
|
50
|
-
}
|
|
51
|
-
this.app.exit()
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export default populateModelWithSite
|
|
1
|
+
async function populateModelWithSite (path, ...args) {
|
|
2
|
+
const { getModel } = this.app.dobo
|
|
3
|
+
const { importPkg } = this.app.bajo
|
|
4
|
+
const { isArray, has } = this.app.lib._
|
|
5
|
+
const confirm = await importPkg('bajoCli:@inquirer/confirm')
|
|
6
|
+
let [modelName, alias, keys] = args
|
|
7
|
+
if (!modelName) this.print.fatal('modelRequired')
|
|
8
|
+
if (!alias) this.print.fatal('aliasRequired')
|
|
9
|
+
const model = getModel(modelName, true)
|
|
10
|
+
if (!model) this.print.fatal('modelNotFound%s', modelName)
|
|
11
|
+
if (!model.hasProperty('siteId')) this.print.fatal('noSiteIdProperty%s', modelName)
|
|
12
|
+
const answer = await confirm({ message: this.print.buildText('aboutToRebuildModelWithSite%s%s', modelName, alias), default: false })
|
|
13
|
+
if (!answer) {
|
|
14
|
+
this.print.fail('aborted')
|
|
15
|
+
this.app.exit()
|
|
16
|
+
}
|
|
17
|
+
if (alias.includes(',')) alias = alias.split(',').map(item => item.trim())
|
|
18
|
+
keys = keys ? keys.split(',').map(item => item.trim()) : []
|
|
19
|
+
await this.app.dobo.start()
|
|
20
|
+
try {
|
|
21
|
+
const fixtures = await model.loadFixtures({ ignoreError: false, collectItems: true })
|
|
22
|
+
const siteModel = getModel('SumbaSite')
|
|
23
|
+
let sites = []
|
|
24
|
+
if (['all', '*'].includes(alias)) {
|
|
25
|
+
sites = await siteModel.findAllRecord({}, { dataOnly: true, fields: ['id', 'hostname'] })
|
|
26
|
+
} else {
|
|
27
|
+
if (!isArray(alias)) alias = [alias]
|
|
28
|
+
sites = await siteModel.findAllRecord({ query: { alias: { $in: alias } } }, { dataOnly: true, fields: ['id', 'hostname'] })
|
|
29
|
+
}
|
|
30
|
+
await model.transaction(async (trx) => {
|
|
31
|
+
for (const site of sites) {
|
|
32
|
+
for (const fixture of fixtures) {
|
|
33
|
+
const siteId = site.id + ''
|
|
34
|
+
fixture.siteId = siteId
|
|
35
|
+
const query = { siteId }
|
|
36
|
+
for (const key of keys) {
|
|
37
|
+
if (has(fixture, key)) query[key] = fixture[key]
|
|
38
|
+
}
|
|
39
|
+
const results = await model.findAllRecord({ query }, { fields: ['id'], trx })
|
|
40
|
+
for (const rec of results) {
|
|
41
|
+
await model.removeRecord(rec.id, { noCache: true, noResult: true, trx, throwNotFound: false })
|
|
42
|
+
}
|
|
43
|
+
await model.createRecord(fixture, { noCache: true, noResult: true, trx })
|
|
44
|
+
}
|
|
45
|
+
this.print.info('modelPopulated%s%s', site.hostname, fixtures.length)
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
} catch (err) {
|
|
49
|
+
this.print.fatal(err)
|
|
50
|
+
}
|
|
51
|
+
this.app.exit()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default populateModelWithSite
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
async function removeSite (path, ...args) {
|
|
2
|
-
const { importPkg } = this.app.bajo
|
|
3
|
-
const { removeSite } = this.app.sumba
|
|
4
|
-
const confirm = await importPkg('bajoCli:@inquirer/confirm')
|
|
5
|
-
const [alias] = args
|
|
6
|
-
const answer = await confirm({ message: this.print.buildText('aboutToDeleteSite%s', alias), default: false })
|
|
7
|
-
if (!answer) {
|
|
8
|
-
this.print.fail('aborted')
|
|
9
|
-
this.app.exit()
|
|
10
|
-
}
|
|
11
|
-
await this.app.dobo.start()
|
|
12
|
-
try {
|
|
13
|
-
await removeSite(alias, true)
|
|
14
|
-
} catch (err) {
|
|
15
|
-
this.print.fatal(err.message)
|
|
16
|
-
}
|
|
17
|
-
this.app.exit()
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default removeSite
|
|
1
|
+
async function removeSite (path, ...args) {
|
|
2
|
+
const { importPkg } = this.app.bajo
|
|
3
|
+
const { removeSite } = this.app.sumba
|
|
4
|
+
const confirm = await importPkg('bajoCli:@inquirer/confirm')
|
|
5
|
+
const [alias] = args
|
|
6
|
+
const answer = await confirm({ message: this.print.buildText('aboutToDeleteSite%s', alias), default: false })
|
|
7
|
+
if (!answer) {
|
|
8
|
+
this.print.fail('aborted')
|
|
9
|
+
this.app.exit()
|
|
10
|
+
}
|
|
11
|
+
await this.app.dobo.start()
|
|
12
|
+
try {
|
|
13
|
+
await removeSite(alias, true)
|
|
14
|
+
} catch (err) {
|
|
15
|
+
this.print.fatal(err.message)
|
|
16
|
+
}
|
|
17
|
+
this.app.exit()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export default removeSite
|
package/extend/bajoCli/applet.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
async function country (opts = {}) {
|
|
2
2
|
opts.field = opts.field ?? 'country'
|
|
3
|
-
opts.enforceRule = true
|
|
3
|
+
opts.enforceRule = opts.enforceRule ?? true
|
|
4
|
+
opts.required = opts.required ?? true
|
|
5
|
+
if (!opts.enforceRule) opts.required = false
|
|
4
6
|
return {
|
|
5
7
|
properties: [{
|
|
6
8
|
name: opts.field,
|
|
7
9
|
type: 'string',
|
|
8
10
|
maxLength: 2,
|
|
9
11
|
index: opts.index ?? true,
|
|
10
|
-
required: opts.required
|
|
12
|
+
required: opts.required,
|
|
11
13
|
values: 'sumba:getCountriesValues',
|
|
12
14
|
rules: opts.enforceRule ? ['uppercase', { rule: 'length', params: 2 }] : [],
|
|
13
15
|
rulesMsg: opts.enforceRule ? { 'any.only': 'validCountryCodeRequired' } : undefined
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|