@nathapp/na-cli 1.0.1-rc.6 → 1.0.2
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/README.md +88 -20
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/dist/templates/k8s-cert-manager/README.md +60 -0
- package/dist/templates/k8s-cert-manager/cloudflare-cert-manager-issuer.yaml +26 -0
- package/dist/templates/k8s-deployment/templates/_deployment.tpl +1 -1
- package/dist/templates/k8s-deployment/templates/_endpointslice.tpl +42 -0
- package/dist/templates/k8s-deployment/templates/_gateway.tpl +94 -0
- package/dist/templates/k8s-deployment/templates/_grpcroute.tpl +186 -0
- package/dist/templates/k8s-deployment/templates/_httproute.tpl +209 -0
- package/dist/templates/k8s-deployment/templates/_ingressroute.tpl +178 -0
- package/dist/templates/k8s-deployment/templates/_middleware.tpl +553 -0
- package/dist/templates/k8s-deployment/templates/_serverstransport.tpl +73 -0
- package/dist/templates/k8s-deployment/templates/_service.tpl +4 -1
- package/dist/templates/k8s-helm-chart/templates/endpointslice.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/gateway.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/grpcroute.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/httproute.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/ingressroute.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/middleware.yaml +1 -0
- package/dist/templates/k8s-helm-chart/templates/serverstransport.yaml +1 -0
- package/dist/templates/k8s-helm-chart/values.yaml +3 -5
- package/dist/templates/nestjs-api/{.env → .env.local} +5 -0
- package/dist/templates/nestjs-api/.gitignore-rename +2 -1
- package/dist/templates/nestjs-api/Dockerfile +33 -13
- package/dist/templates/nestjs-api/package.json +49 -39
- package/dist/templates/nestjs-api/src/i18n/en_US/date.json +7 -0
- package/dist/templates/nestjs-api/src/i18n/en_US/validation.json +16 -0
- package/dist/templates/nestjs-api/src/i18n/zh_CN/date.json +7 -0
- package/dist/templates/nestjs-api/src/i18n/zh_CN/validation.json +16 -0
- package/dist/templates/nestjs-api/src/i18n/zh_TW/date.json +7 -0
- package/dist/templates/nestjs-api/src/i18n/zh_TW/validation.json +16 -0
- package/dist/templates/nestjs-api/test/jest-test.json +26 -0
- package/dist/templates/nestjs-library/.npmignore-rename +4 -0
- package/dist/templates/nestjs-library/package.json +8 -8
- package/dist/templates/ts-library/.npmignore-rename +4 -0
- package/dist/templates/turbo-nestjs-vuexy/README.md +3 -0
- package/dist/templates/turbo-nestjs-vuexy/package.json +49 -0
- package/dist/templates/turbo-nestjs-vuexy/packages/eslint-config/README.md +3 -0
- package/dist/templates/turbo-nestjs-vuexy/packages/eslint-config/library.js +43 -0
- package/dist/templates/turbo-nestjs-vuexy/packages/eslint-config/package.json +18 -0
- package/dist/templates/turbo-nestjs-vuexy/packages/eslint-config/vue.js +236 -0
- package/dist/templates/{ts-library/tsconfig.json → turbo-nestjs-vuexy/packages/typescript-config/base.json} +4 -6
- package/dist/templates/turbo-nestjs-vuexy/packages/typescript-config/nestjs.json +12 -0
- package/dist/templates/turbo-nestjs-vuexy/packages/typescript-config/package.json +9 -0
- package/dist/templates/turbo-nestjs-vuexy/packages/typescript-config/vue.json +82 -0
- package/dist/templates/turbo-nestjs-vuexy/turbo.json +24 -0
- package/dist/templates/vuexy-portal/.editorconfig +1 -0
- package/dist/templates/vuexy-portal/.eslintrc.cjs +237 -0
- package/dist/templates/vuexy-portal/.gitignore-rename +42 -0
- package/dist/templates/vuexy-portal/.stylelintrc.json +46 -0
- package/dist/templates/vuexy-portal/Dockerfile +43 -0
- package/dist/templates/vuexy-portal/README.md +35 -0
- package/dist/templates/vuexy-portal/auto-imports.d.ts +1131 -0
- package/dist/templates/vuexy-portal/components.d.ts +68 -0
- package/dist/templates/vuexy-portal/dev.Dockerfile +25 -0
- package/dist/templates/vuexy-portal/docker-compose.dev.yml +14 -0
- package/dist/templates/vuexy-portal/docker-compose.prod.yml +13 -0
- package/dist/templates/vuexy-portal/entrypoint.sh +6 -0
- package/dist/templates/vuexy-portal/env.d.ts +12 -0
- package/dist/templates/vuexy-portal/index.html +57 -0
- package/dist/templates/vuexy-portal/nginx.conf +14 -0
- package/dist/templates/vuexy-portal/package.json +140 -0
- package/dist/templates/vuexy-portal/pnpm-lock.yaml +7963 -0
- package/dist/templates/vuexy-portal/prod.Dockerfile +41 -0
- package/dist/templates/vuexy-portal/public/favicon.ico +0 -0
- package/dist/templates/vuexy-portal/public/images/avatars/avatar-1.png +0 -0
- package/dist/templates/vuexy-portal/public/images/avatars/avatar-2.png +0 -0
- package/dist/templates/vuexy-portal/public/images/svg/discord.svg +10 -0
- package/dist/templates/vuexy-portal/public/images/svg/gift.svg +8 -0
- package/dist/templates/vuexy-portal/public/images/svg/keyboard.svg +8 -0
- package/dist/templates/vuexy-portal/public/images/svg/laptop.svg +8 -0
- package/dist/templates/vuexy-portal/public/images/svg/lightbulb.svg +8 -0
- package/dist/templates/vuexy-portal/public/images/svg/rocket.svg +8 -0
- package/dist/templates/vuexy-portal/public/loader.css +79 -0
- package/dist/templates/vuexy-portal/public/mockServiceWorker.js +287 -0
- package/dist/templates/vuexy-portal/shims.d.ts +15 -0
- package/dist/templates/vuexy-portal/src/@core/components/AppBarSearch.vue +278 -0
- package/dist/templates/vuexy-portal/src/@core/components/AppDrawerHeaderSection.vue +30 -0
- package/dist/templates/vuexy-portal/src/@core/components/AppStepper.vue +371 -0
- package/dist/templates/vuexy-portal/src/@core/components/BuyNow.vue +92 -0
- package/dist/templates/vuexy-portal/src/@core/components/CardStatisticsVerticalSimple.vue +35 -0
- package/dist/templates/vuexy-portal/src/@core/components/CustomizerSection.vue +27 -0
- package/dist/templates/vuexy-portal/src/@core/components/DialogCloseBtn.vue +25 -0
- package/dist/templates/vuexy-portal/src/@core/components/DropZone.vue +135 -0
- package/dist/templates/vuexy-portal/src/@core/components/I18n.vue +48 -0
- package/dist/templates/vuexy-portal/src/@core/components/MoreBtn.vue +24 -0
- package/dist/templates/vuexy-portal/src/@core/components/Notifications.vue +245 -0
- package/dist/templates/vuexy-portal/src/@core/components/ProductDescriptionEditor.vue +198 -0
- package/dist/templates/vuexy-portal/src/@core/components/ScrollToTop.vue +41 -0
- package/dist/templates/vuexy-portal/src/@core/components/Shortcuts.vue +99 -0
- package/dist/templates/vuexy-portal/src/@core/components/TablePagination.vue +39 -0
- package/dist/templates/vuexy-portal/src/@core/components/TheCustomizer.vue +618 -0
- package/dist/templates/vuexy-portal/src/@core/components/ThemeSwitcher.vue +61 -0
- package/dist/templates/vuexy-portal/src/@core/components/TiptapEditor.vue +166 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppAutocomplete.vue +57 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppCombobox.vue +57 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppDateTimePicker.vue +543 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppSelect.vue +50 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppTextField.vue +78 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppTextarea.vue +50 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomCheckboxes.vue +81 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomCheckboxesWithIcon.vue +95 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomCheckboxesWithImage.vue +93 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomRadios.vue +81 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomRadiosWithIcon.vue +88 -0
- package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomRadiosWithImage.vue +99 -0
- package/dist/templates/vuexy-portal/src/@core/components/cards/AppCardActions.vue +167 -0
- package/dist/templates/vuexy-portal/src/@core/components/cards/AppCardCode.vue +152 -0
- package/dist/templates/vuexy-portal/src/@core/components/cards/CardStatisticsHorizontal.vue +41 -0
- package/dist/templates/vuexy-portal/src/@core/components/cards/CardStatisticsVertical.vue +48 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_components.scss +185 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_dark.scss +16 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_default-layout-w-horizontal-nav.scss +45 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_default-layout-w-vertical-nav.scss +103 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_default-layout.scss +16 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_horizontal-nav.scss +194 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_index.scss +48 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_layouts.scss +63 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_misc.scss +20 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_mixins.scss +63 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_route-transitions.scss +70 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_utilities.scss +181 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_utils.scss +90 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_variables.scss +198 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/_vertical-nav.scss +255 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/libs/_perfect-scrollbar.scss +35 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/libs/vuetify/_index.scss +1 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/libs/vuetify/_overrides.scss +264 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/libs/vuetify/_variables.scss +62 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_default-layout-horizontal-nav.scss +27 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_default-layout-vertical-nav.scss +45 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_default-layout.scss +3 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_horizontal-nav.scss +98 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_index.scss +7 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_misc.scss +7 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_nav.scss +33 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_vertical-nav.scss +80 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/skins/_bordered.scss +72 -0
- package/dist/templates/vuexy-portal/src/@core/scss/base/skins/_index.scss +1 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/_default-layout-w-horizontal-nav.scss +9 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/_default-layout-w-vertical-nav.scss +20 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/_horizontal-nav.scss +40 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/_mixins.scss +6 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/_utilities.scss +49 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/_variables.scss +102 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/_vertical-nav.scss +47 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/index.scss +17 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/apex-chart.scss +108 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/full-calendar.scss +351 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/shepherd.scss +94 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/swiper.scss +5 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/_variables.scss +351 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_alert.scss +114 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_avatar.scss +27 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_badge.scss +25 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_button.scss +280 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_cards.scss +3 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_checkbox.scss +57 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_chip.scss +102 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_dialog.scss +27 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_expansion-panels.scss +106 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_field.scss +308 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_list.scss +30 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_menu.scss +35 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_otp-input.scss +17 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_pagination.scss +140 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_progress.scss +13 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_radio.scss +46 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_rating.scss +20 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_slider.scss +27 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_snackbar.scss +10 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_switch.scss +58 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_table.scss +48 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_tabs.scss +91 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_textarea.scss +9 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_timeline.scss +99 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_tooltip.scss +6 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/index.scss +25 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/index.scss +3 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/overrides.scss +18 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/pages/misc.scss +20 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/pages/page-auth.scss +63 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_default-layout-horizontal-nav.scss +7 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_default-layout-vertical-nav.scss +8 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_horizontal-nav.scss +47 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_index.scss +6 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_misc.scss +3 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_nav.scss +27 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_vertical-nav.scss +35 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/skins/_bordered.scss +82 -0
- package/dist/templates/vuexy-portal/src/@core/scss/template/skins/_index.scss +1 -0
- package/dist/templates/vuexy-portal/src/@custom/assets/images/user-profile-header.png +0 -0
- package/dist/templates/vuexy-portal/src/@custom/components/ConfirmationDialog.vue +155 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNav.vue +35 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNavGroup.vue +110 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNavLayout.vue +150 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNavLink.vue +56 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNavPopper.vue +175 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/TransitionExpand.vue +92 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/VNodeRenderer.tsx +17 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNav.vue +236 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNavGroup.vue +267 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNavLayout.vue +232 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNavLink.vue +68 -0
- package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNavSectionTitle.vue +37 -0
- package/dist/templates/vuexy-portal/src/@layouts/styles/_classes.scss +3 -0
- package/dist/templates/vuexy-portal/src/@layouts/styles/_default-layout.scss +35 -0
- package/dist/templates/vuexy-portal/src/@layouts/styles/_global.scss +10 -0
- package/dist/templates/vuexy-portal/src/@layouts/styles/_mixins.scss +30 -0
- package/dist/templates/vuexy-portal/src/@layouts/styles/_placeholders.scss +53 -0
- package/dist/templates/vuexy-portal/src/@layouts/styles/_rtl.scss +7 -0
- package/dist/templates/vuexy-portal/src/@layouts/styles/_variables.scss +29 -0
- package/dist/templates/vuexy-portal/src/@layouts/styles/index.scss +3 -0
- package/dist/templates/vuexy-portal/src/App.vue +26 -0
- package/dist/templates/vuexy-portal/src/assets/images/avatars/avatar-1.png +0 -0
- package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/border-light.svg +16 -0
- package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/collapsed-light.svg +17 -0
- package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/compact-light.svg +11 -0
- package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/default-light.svg +17 -0
- package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/horizontal-light.svg +12 -0
- package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/ltr-light.svg +15 -0
- package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/rtl-light.svg +15 -0
- package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/wide-light.svg +11 -0
- package/dist/templates/vuexy-portal/src/assets/images/logo.svg +6 -0
- package/dist/templates/vuexy-portal/src/assets/images/misc/3d-safe-box-with-golden-dollar-coins.png +0 -0
- package/dist/templates/vuexy-portal/src/assets/images/misc/3d-space-rocket-with-smoke.png +0 -0
- package/dist/templates/vuexy-portal/src/assets/images/misc/dollar-coins-flying-pink-piggy-bank.png +0 -0
- package/dist/templates/vuexy-portal/src/assets/images/misc/fleet-car.png +0 -0
- package/dist/templates/vuexy-portal/src/assets/images/pages/misc-mask-dark.png +0 -0
- package/dist/templates/vuexy-portal/src/assets/images/pages/misc-mask-light.png +0 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/Card.svg +8 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/Check.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/Diamond.svg +12 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/Suitcase.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/Wallet.svg +10 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/address.svg +25 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/auth-v1-bottom-shape.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/auth-v1-top-shape.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/cart.svg +5 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/checkbox-checked.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/checkbox-indeterminate.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/checkbox-unchecked.svg +10 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/discord.svg +10 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/gift.svg +8 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/home.svg +5 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/keyboard.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/laptop.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/lightbulb.svg +8 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/office.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/paper-send.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/payment.svg +21 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/radio-checked.svg +3 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/radio-unchecked.svg +3 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/rocket.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/trending.svg +14 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/user-info.svg +4 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/user.svg +6 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-account.svg +6 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-address.svg +18 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-personal.svg +6 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-social-link.svg +6 -0
- package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-submit.svg +6 -0
- package/dist/templates/vuexy-portal/src/assets/styles/styles.scss +1 -0
- package/dist/templates/vuexy-portal/src/assets/styles/variables/_template.scss +6 -0
- package/dist/templates/vuexy-portal/src/assets/styles/variables/_vuetify.scss +7 -0
- package/dist/templates/vuexy-portal/src/components/AppLoadingIndicator.vue +63 -0
- package/dist/templates/vuexy-portal/src/components/AppPricing.vue +247 -0
- package/dist/templates/vuexy-portal/src/components/AppSearchHeader.vue +77 -0
- package/dist/templates/vuexy-portal/src/components/ErrorHeader.vue +40 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/AddAuthenticatorAppDialog.vue +101 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/AddEditAddressDialog.vue +238 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/AddEditPermissionDialog.vue +93 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/AddEditRoleDialog.vue +302 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/AddPaymentMethodDialog.vue +120 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/CardAddEditDialog.vue +153 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/ConfirmDialog.vue +151 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/CreateAppDialog.vue +459 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/EnableOneTimePasswordDialog.vue +85 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/PaymentProvidersDialog.vue +123 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/PricingPlanDialog.vue +34 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/ReferAndEarnDialog.vue +181 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/ShareProjectDialog.vue +198 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/TwoFactorAuthDialog.vue +120 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/UserInfoEditDialog.vue +246 -0
- package/dist/templates/vuexy-portal/src/components/dialogs/UserUpgradePlanDialog.vue +101 -0
- package/dist/templates/vuexy-portal/src/layouts/blank.vue +42 -0
- package/dist/templates/vuexy-portal/src/layouts/components/DefaultLayoutWithHorizontalNav.vue +75 -0
- package/dist/templates/vuexy-portal/src/layouts/components/DefaultLayoutWithVerticalNav.vue +79 -0
- package/dist/templates/vuexy-portal/src/layouts/components/Footer.vue +17 -0
- package/dist/templates/vuexy-portal/src/layouts/components/NavSearchBar.vue +266 -0
- package/dist/templates/vuexy-portal/src/layouts/components/NavbarShortcuts.vue +45 -0
- package/dist/templates/vuexy-portal/src/layouts/components/NavbarThemeSwitcher.vue +22 -0
- package/dist/templates/vuexy-portal/src/layouts/components/UserProfile.vue +114 -0
- package/dist/templates/vuexy-portal/src/layouts/default.vue +30 -0
- package/dist/templates/vuexy-portal/src/pages/[...error].vue +46 -0
- package/dist/templates/vuexy-portal/src/pages/account-settings/[tab].vue +57 -0
- package/dist/templates/vuexy-portal/src/pages/index.vue +32 -0
- package/dist/templates/vuexy-portal/src/pages/login.vue +178 -0
- package/dist/templates/vuexy-portal/src/pages/not-authorized.vue +47 -0
- package/dist/templates/vuexy-portal/src/pages/second-page.vue +13 -0
- package/dist/templates/vuexy-portal/src/plugins/casl/shims-ability.d.ts +8 -0
- package/dist/templates/vuexy-portal/src/plugins/i18n/locales/en_US.json +88 -0
- package/dist/templates/vuexy-portal/src/plugins/i18n/locales/zh_CN.json +88 -0
- package/dist/templates/vuexy-portal/src/plugins/i18n/vue-i18n.d.ts +17 -0
- package/dist/templates/vuexy-portal/src/plugins/iconify/icons.css +21039 -0
- package/dist/templates/vuexy-portal/src/plugins/iconify/package.json +3 -0
- package/dist/templates/vuexy-portal/src/views/account-settings/AccountSettingsSecurity.vue +179 -0
- package/dist/templates/vuexy-portal/typed-router.d.ts +146 -0
- package/dist/utils/template.js +122 -47
- package/dist/utils/template.js.map +1 -1
- package/package.json +1 -1
- package/.gitlab-ci.yml +0 -143
- package/Makefile +0 -62
- package/dist/templates/db-schema/.gitlab-ci.yml +0 -139
- package/dist/templates/db-schema/Makefile +0 -885
- package/dist/templates/k8s-deployment/.gitlab-ci.yml +0 -128
- package/dist/templates/k8s-deployment/Makefile +0 -196
- package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/script/Makefile +0 -12
- package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/script/Makefile +0 -8
- package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/script/Makefile +0 -49
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/Makefile +0 -9
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/script/Makefile +0 -14
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/_t-0100-readiness-liveness.ts +0 -84
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/hub.ts +0 -372
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contact.ts +0 -158
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contract.ts +0 -328
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-kyc.ts +0 -304
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-app.ts +0 -823
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-web.ts +0 -493
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-profile.ts +0 -277
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-whitelist.ts +0 -133
- package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/t-0200-start.ts +0 -172
- package/dist/templates/mxw-base-api-express/.dockerignore +0 -2
- package/dist/templates/mxw-base-api-express/.env +0 -10
- package/dist/templates/mxw-base-api-express/.gitignore-rename +0 -3
- package/dist/templates/mxw-base-api-express/.gitlab-ci.yml +0 -174
- package/dist/templates/mxw-base-api-express/.nvmrc +0 -1
- package/dist/templates/mxw-base-api-express/Dockerfile +0 -14
- package/dist/templates/mxw-base-api-express/Makefile +0 -84
- package/dist/templates/mxw-base-api-express/README.md +0 -71
- package/dist/templates/mxw-base-api-express/package.json +0 -55
- package/dist/templates/mxw-base-api-express/src/app-service.test.ts +0 -94
- package/dist/templates/mxw-base-api-express/src/app-service.ts +0 -498
- package/dist/templates/mxw-base-api-express/src/auth/auth-user.test.ts +0 -215
- package/dist/templates/mxw-base-api-express/src/auth/auth-user.ts +0 -86
- package/dist/templates/mxw-base-api-express/src/auth/auth.ts +0 -81
- package/dist/templates/mxw-base-api-express/src/core-service.ts +0 -72
- package/dist/templates/mxw-base-api-express/src/crud.ts +0 -84
- package/dist/templates/mxw-base-api-express/src/http-handler.ts +0 -71
- package/dist/templates/mxw-base-api-express/src/server.ts +0 -54
- package/dist/templates/mxw-base-api-express/src/test.ts +0 -38
- package/dist/templates/mxw-base-api-express/src/utils/api-utilities.ts +0 -52
- package/dist/templates/mxw-base-api-express/src/utils/file-utilities.ts +0 -55
- package/dist/templates/mxw-base-api-express/tsconfig.json +0 -32
- package/dist/templates/nestjs-api/.dockerignore +0 -6
- package/dist/templates/nestjs-api/.gitlab-ci.yml +0 -174
- package/dist/templates/nestjs-api/.nvmrc +0 -1
- package/dist/templates/nestjs-api/.prettierrc +0 -4
- package/dist/templates/nestjs-api/Makefile +0 -95
- package/dist/templates/nestjs-api/nest-cli.json +0 -11
- package/dist/templates/nestjs-api/src/app.controller.spec.ts +0 -24
- package/dist/templates/nestjs-api/src/app.controller.ts +0 -27
- package/dist/templates/nestjs-api/src/app.module.ts +0 -49
- package/dist/templates/nestjs-api/src/app.service.ts +0 -27
- package/dist/templates/nestjs-api/src/main.ts +0 -26
- package/dist/templates/nestjs-api/test/app.e2e-spec.ts +0 -47
- package/dist/templates/nestjs-api/tsconfig.build.json +0 -4
- package/dist/templates/nestjs-api/tsconfig.json +0 -24
- package/dist/templates/nestjs-library/.eslintrc.js +0 -24
- package/dist/templates/nestjs-library/.gitlab-ci.yml +0 -138
- package/dist/templates/nestjs-library/.prettierrc +0 -6
- package/dist/templates/nestjs-library/Makefile +0 -60
- package/dist/templates/nestjs-library/index.ts +0 -1
- package/dist/templates/nestjs-library/lib/index.ts +0 -2
- package/dist/templates/nestjs-library/test/app/controller/hello.controller.ts +0 -7
- package/dist/templates/nestjs-library/tsconfig.build.json +0 -7
- package/dist/templates/nestjs-library/tsconfig.json +0 -18
- package/dist/templates/ts-library/.dockerignore +0 -2
- package/dist/templates/ts-library/.eslintrc.js +0 -24
- package/dist/templates/ts-library/.gitlab-ci.yml +0 -136
- package/dist/templates/ts-library/.prettierrc +0 -6
- package/dist/templates/ts-library/Makefile +0 -58
- package/dist/templates/ts-library/index.ts +0 -1
- package/dist/templates/ts-library/lib/index.ts +0 -1
- package/dist/templates/ts-library/lib/samples/index.ts +0 -5
- package/dist/templates/ts-library/lib/samples/samples-function.ts +0 -3
- package/dist/templates/ts-library/test/sample.e2e-spec.ts +0 -10
- package/dist/templates/ts-library/tsconfig.build.json +0 -4
- package/dist/utils/help.js +0 -8
- package/dist/utils/help.js.map +0 -1
- package/tsconfig.json +0 -24
- /package/dist/templates/{nestjs-api/.eslintrc.js → turbo-nestjs-vuexy/packages/eslint-config/nest.js} +0 -0
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import { describe, it, before, after, beforeEach, afterEach } from 'mocha';
|
|
4
|
-
import { expect } from 'chai';
|
|
5
|
-
import Sinon from "sinon";
|
|
6
|
-
import jwt from "jsonwebtoken";
|
|
7
|
-
import AuthUser from './auth-user';
|
|
8
|
-
import { CREDENTIAL_TYPE } from './auth';
|
|
9
|
-
import { errors } from 'mxw-libs-errors';
|
|
10
|
-
|
|
11
|
-
let sandbox: Sinon.SinonSandbox;
|
|
12
|
-
let clock: Sinon.SinonFakeTimers;
|
|
13
|
-
|
|
14
|
-
const JWT_SECRET = "secret";
|
|
15
|
-
|
|
16
|
-
describe('Suite: AuthUser', () => {
|
|
17
|
-
before(function () {
|
|
18
|
-
clock = Sinon.useFakeTimers({
|
|
19
|
-
now: new Date().getTime(),
|
|
20
|
-
shouldAdvanceTime: true
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
beforeEach(function () {
|
|
25
|
-
sandbox = Sinon.createSandbox();
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
afterEach(function () {
|
|
29
|
-
if (sandbox) {
|
|
30
|
-
sandbox.restore();
|
|
31
|
-
sandbox = undefined;
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
after(function () {
|
|
36
|
-
if (clock) {
|
|
37
|
-
clock.restore();
|
|
38
|
-
clock = undefined;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
describe("Create credential", async () => {
|
|
43
|
-
it("Create token with minimum fields", async () => {
|
|
44
|
-
AuthUser.init(JWT_SECRET, "1m");
|
|
45
|
-
|
|
46
|
-
const token = AuthUser.Instance.createToken({
|
|
47
|
-
userId: 1,
|
|
48
|
-
type: CREDENTIAL_TYPE.USER,
|
|
49
|
-
username: "bean"
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
expect(token).is.a("string").lengthOf.greaterThan(0);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it("Create token with all fields", async () => {
|
|
56
|
-
AuthUser.init(JWT_SECRET, "1m");
|
|
57
|
-
|
|
58
|
-
const token = AuthUser.Instance.createToken({
|
|
59
|
-
id: 1,
|
|
60
|
-
userId: 1,
|
|
61
|
-
type: CREDENTIAL_TYPE.USER,
|
|
62
|
-
orgId: 100,
|
|
63
|
-
email: "bean@happy.com",
|
|
64
|
-
username: "bean"
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
expect(token).is.a("string").lengthOf.greaterThan(0);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it("Create token with missing field", async () => {
|
|
71
|
-
AuthUser.init(JWT_SECRET, "1m");
|
|
72
|
-
|
|
73
|
-
const fields = {
|
|
74
|
-
id: 1,
|
|
75
|
-
userId: 1,
|
|
76
|
-
type: CREDENTIAL_TYPE.USER,
|
|
77
|
-
orgId: 100,
|
|
78
|
-
email: "bean@happy.com",
|
|
79
|
-
username: "bean"
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
delete fields.userId;
|
|
83
|
-
|
|
84
|
-
try {
|
|
85
|
-
AuthUser.Instance.createToken(fields);
|
|
86
|
-
expect.fail("It should be failed");
|
|
87
|
-
}
|
|
88
|
-
catch (error) {
|
|
89
|
-
expect(error).has.property("code").eq(errors.PARAMETER_MISSING);
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
describe("Verify credential", async () => {
|
|
95
|
-
it("Verify token", async () => {
|
|
96
|
-
AuthUser.init(JWT_SECRET, "1m");
|
|
97
|
-
|
|
98
|
-
const token = AuthUser.Instance.createToken({
|
|
99
|
-
userId: 1,
|
|
100
|
-
type: CREDENTIAL_TYPE.USER,
|
|
101
|
-
username: "bean"
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
const credential = AuthUser.Instance.verifyToken(token, CREDENTIAL_TYPE.USER);
|
|
105
|
-
|
|
106
|
-
expect(credential).has.property("userId").is.a("number").eq(1);
|
|
107
|
-
expect(credential).has.property("type").is.a("number").eq(CREDENTIAL_TYPE.USER);
|
|
108
|
-
expect(credential).has.property("username").is.a("string").eq("bean");
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it("Accept all token type", async () => {
|
|
112
|
-
AuthUser.init(JWT_SECRET, "1m");
|
|
113
|
-
|
|
114
|
-
const token = AuthUser.Instance.createToken({
|
|
115
|
-
userId: 1,
|
|
116
|
-
type: CREDENTIAL_TYPE.USER,
|
|
117
|
-
username: "bean"
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
const credential = AuthUser.Instance.verifyToken(token, null);
|
|
121
|
-
|
|
122
|
-
expect(credential).has.property("userId").is.a("number").eq(1);
|
|
123
|
-
expect(credential).has.property("type").is.a("number").eq(CREDENTIAL_TYPE.USER);
|
|
124
|
-
expect(credential).has.property("username").is.a("string").eq("bean");
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
it("Verify broken token", async () => {
|
|
128
|
-
const token = jwt.sign({
|
|
129
|
-
hello: "world"
|
|
130
|
-
}, JWT_SECRET, { expiresIn: "1m" });
|
|
131
|
-
|
|
132
|
-
try {
|
|
133
|
-
AuthUser.Instance.verifyToken(token, CREDENTIAL_TYPE.USER);
|
|
134
|
-
expect.fail("It should be failed");
|
|
135
|
-
}
|
|
136
|
-
catch (error) {
|
|
137
|
-
expect(error).has.property("code").eq(errors.PARAMETER_MISSING);
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it("Verify invalid token", async () => {
|
|
142
|
-
try {
|
|
143
|
-
AuthUser.Instance.verifyToken("Trust me.. I am good", CREDENTIAL_TYPE.USER);
|
|
144
|
-
expect.fail("It should be failed");
|
|
145
|
-
}
|
|
146
|
-
catch (error) {
|
|
147
|
-
expect(error).has.property("code").eq(errors.INVALID_SIGNATURE);
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
it("Verify mismatched token type", async () => {
|
|
152
|
-
AuthUser.init(JWT_SECRET, "1m");
|
|
153
|
-
|
|
154
|
-
const token = AuthUser.Instance.createToken({
|
|
155
|
-
userId: 1,
|
|
156
|
-
type: CREDENTIAL_TYPE.USER,
|
|
157
|
-
username: "bean"
|
|
158
|
-
});
|
|
159
|
-
|
|
160
|
-
try {
|
|
161
|
-
AuthUser.Instance.verifyToken(token, CREDENTIAL_TYPE.GUEST);
|
|
162
|
-
expect.fail("It should be failed");
|
|
163
|
-
}
|
|
164
|
-
catch (error) {
|
|
165
|
-
expect(error).has.property("code").eq(errors.INVALID_FORMAT);
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
it("Verify invalid token type", async () => {
|
|
170
|
-
AuthUser.init(JWT_SECRET, "1m");
|
|
171
|
-
|
|
172
|
-
const stub = sandbox.stub(AuthUser.Instance as any, "checkCredential").callsFake((cred: Credential, type?: CREDENTIAL_TYPE) => {
|
|
173
|
-
return cred;
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
const token = AuthUser.Instance.createToken({
|
|
177
|
-
userId: 1,
|
|
178
|
-
type: 100,
|
|
179
|
-
username: "bean"
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
stub.restore();
|
|
183
|
-
|
|
184
|
-
try {
|
|
185
|
-
AuthUser.Instance.verifyToken(token, null);
|
|
186
|
-
expect.fail("It should be failed");
|
|
187
|
-
}
|
|
188
|
-
catch (error) {
|
|
189
|
-
expect(error).has.property("code").eq(errors.INVALID_FORMAT);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it("Verify expired token", async () => {
|
|
194
|
-
AuthUser.init(JWT_SECRET, "1m");
|
|
195
|
-
|
|
196
|
-
const token = AuthUser.Instance.createToken({
|
|
197
|
-
userId: 1,
|
|
198
|
-
type: CREDENTIAL_TYPE.USER,
|
|
199
|
-
username: "bean"
|
|
200
|
-
});
|
|
201
|
-
|
|
202
|
-
await clock.tickAsync(60000);
|
|
203
|
-
|
|
204
|
-
try {
|
|
205
|
-
const credential = AuthUser.Instance.verifyToken(token, CREDENTIAL_TYPE.USER);
|
|
206
|
-
expect.fail("It should be failed");
|
|
207
|
-
}
|
|
208
|
-
catch (error) {
|
|
209
|
-
expect(error).has.property("code").eq(errors.EXPIRED);
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
});
|
|
214
|
-
|
|
215
|
-
});
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { allowNull, allowNullOrEmpty, checkFormat, checkNumber, checkString, isUndefinedOrNull, isUndefinedOrNullOrEmpty, notAllowNullOrEmpty } from "mxw-libs-utils";
|
|
4
|
-
import { errors, throwError } from "mxw-libs-errors";
|
|
5
|
-
|
|
6
|
-
import { BearerToken, CREDENTIAL_TYPE } from "./auth";
|
|
7
|
-
|
|
8
|
-
export * from "./auth";
|
|
9
|
-
|
|
10
|
-
export class Credential {
|
|
11
|
-
id?: number;
|
|
12
|
-
userId: number;
|
|
13
|
-
type: CREDENTIAL_TYPE;
|
|
14
|
-
orgId?: number;
|
|
15
|
-
email?: string;
|
|
16
|
-
username: string;
|
|
17
|
-
iat?: number;
|
|
18
|
-
exp?: number;
|
|
19
|
-
|
|
20
|
-
static check(cred: Credential, type: CREDENTIAL_TYPE) {
|
|
21
|
-
if (isUndefinedOrNullOrEmpty(cred)) {
|
|
22
|
-
throwError(errors.NOT_INITIALIZED, "Missing credential");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return checkFormat({
|
|
26
|
-
id: allowNull(checkNumber),
|
|
27
|
-
userId: notAllowNullOrEmpty(checkNumber),
|
|
28
|
-
type: function (value) {
|
|
29
|
-
const credType = checkNumber(value);
|
|
30
|
-
|
|
31
|
-
if (type === credType) {
|
|
32
|
-
return credType;
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
if (isUndefinedOrNull(type)) {
|
|
36
|
-
for (const t in CREDENTIAL_TYPE) {
|
|
37
|
-
if (Number(t) === credType) {
|
|
38
|
-
return credType;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
throwError(errors.INVALID_PARAMETER, "Invalid credential type", { credType });
|
|
45
|
-
},
|
|
46
|
-
orgId: allowNull(checkNumber),
|
|
47
|
-
email: allowNullOrEmpty(checkString),
|
|
48
|
-
username: notAllowNullOrEmpty(checkString),
|
|
49
|
-
iat: allowNull(checkNumber, undefined),
|
|
50
|
-
exp: allowNull(checkNumber, undefined)
|
|
51
|
-
}, cred) as Credential;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export class GuestCredential extends Credential {
|
|
56
|
-
static check(cred: GuestCredential) {
|
|
57
|
-
return super.check(cred, CREDENTIAL_TYPE.GUEST) as GuestCredential;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export class UserCredential extends Credential {
|
|
62
|
-
static check(cred: UserCredential) {
|
|
63
|
-
return super.check(cred, CREDENTIAL_TYPE.USER) as UserCredential;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export default class BasicAuth extends BearerToken<GuestCredential | UserCredential> {
|
|
68
|
-
private static self: BasicAuth;
|
|
69
|
-
|
|
70
|
-
constructor(secret: string, expiresIn: string, options?: any) {
|
|
71
|
-
super(secret, expiresIn, options);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
public static get Instance() {
|
|
75
|
-
return this.self || throwError(errors.NOT_INITIALIZED, "BasicAuth initialization is required");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public static init(secret: string, expiresIn: string, options?: any) {
|
|
79
|
-
this.self = new BasicAuth(secret, expiresIn, options);
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
protected checkCredential(cred: GuestCredential | UserCredential, type?: CREDENTIAL_TYPE) {
|
|
83
|
-
return Credential.check(cred, type);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { allowNullOrEmpty, checkFormat, checkString, isUndefinedOrNullOrEmpty, notAllowNullOrEmpty } from "mxw-libs-utils";
|
|
4
|
-
import jwt, { SignOptions, VerifyOptions } from "jsonwebtoken";
|
|
5
|
-
import { describeError, errors, throwError } from "mxw-libs-errors";
|
|
6
|
-
|
|
7
|
-
export enum CREDENTIAL_TYPE {
|
|
8
|
-
GUEST = 0,
|
|
9
|
-
USER = 1,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface AuthCredential<C> {
|
|
13
|
-
cred: C;
|
|
14
|
-
checkCredential(type?: CREDENTIAL_TYPE): C;
|
|
15
|
-
auth(cred: C): AuthCredential<C>;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export abstract class BearerToken<C> {
|
|
19
|
-
private jwtSecret: string;
|
|
20
|
-
private signOptions: SignOptions;
|
|
21
|
-
private verifyOptions: VerifyOptions;
|
|
22
|
-
|
|
23
|
-
constructor(jwtSecret: string, jwtExpiresIn?: string, options?: any) {
|
|
24
|
-
const params: {
|
|
25
|
-
jwtSecret: string,
|
|
26
|
-
jwtExpiresIn?: string,
|
|
27
|
-
} = checkFormat({
|
|
28
|
-
jwtSecret: notAllowNullOrEmpty(checkString),
|
|
29
|
-
jwtExpiresIn: allowNullOrEmpty(checkString)
|
|
30
|
-
}, { jwtSecret, jwtExpiresIn });
|
|
31
|
-
|
|
32
|
-
this.signOptions = {};
|
|
33
|
-
|
|
34
|
-
if (params.jwtExpiresIn) {
|
|
35
|
-
this.signOptions.expiresIn = params.jwtExpiresIn;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
this.verifyOptions = {};
|
|
39
|
-
|
|
40
|
-
if (!isUndefinedOrNullOrEmpty(options?.JWT_SIGN_ALGO)) {
|
|
41
|
-
this.signOptions.algorithm = options?.JWT_SIGN_ALGO;
|
|
42
|
-
this.verifyOptions.algorithms = [options?.JWT_SIGN_ALGO];
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
this.jwtSecret = params.jwtSecret;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
protected abstract checkCredential(cred: C, type?: CREDENTIAL_TYPE): C;
|
|
49
|
-
|
|
50
|
-
public createToken(cred: C, overrides?: any) {
|
|
51
|
-
const payload = this.checkCredential(cred);
|
|
52
|
-
|
|
53
|
-
if (!this.signOptions.expiresIn) {
|
|
54
|
-
throwError(errors.NOT_INITIALIZED, "Session expiry is not initialized");
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
return jwt.sign({
|
|
58
|
-
...overrides, ...payload
|
|
59
|
-
}, this.jwtSecret, this.signOptions);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
public verifyToken(token: string, type: CREDENTIAL_TYPE) {
|
|
63
|
-
try {
|
|
64
|
-
const cred: any = jwt.verify(token, this.jwtSecret, this.verifyOptions) || throwError(errors.UNEXPECTED_MESSAGE, "Missing session", { token });
|
|
65
|
-
return this.checkCredential(cred, type);
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
const { code, message } = describeError(error);
|
|
69
|
-
|
|
70
|
-
if (errors.INVALID_FORMAT == code) {
|
|
71
|
-
throwError(errors.INVALID_FORMAT, message, { token, error });
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
switch (error.name) {
|
|
75
|
-
case "TokenExpiredError": throwError(errors.EXPIRED, "Session expired", { token });
|
|
76
|
-
case "JsonWebTokenError": throwError(errors.INVALID_SIGNATURE, "Invalid token", { token });
|
|
77
|
-
}
|
|
78
|
-
throw error;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// for local development only
|
|
3
|
-
if (process.env.NODE_ENV == "local") require('dotenv').config()
|
|
4
|
-
import { CLogger, clog, levels } from "mxw-libs-clogger";
|
|
5
|
-
import { errors, throwError } from "mxw-libs-errors";
|
|
6
|
-
import { isUndefinedOrNull } from "mxw-libs-utils";
|
|
7
|
-
import AppService from "./app-service";
|
|
8
|
-
|
|
9
|
-
const { name, version } = require("../package.json");
|
|
10
|
-
|
|
11
|
-
export default class CoreService {
|
|
12
|
-
private static self: CoreService;
|
|
13
|
-
|
|
14
|
-
public static get Instance(): CoreService {
|
|
15
|
-
return this.self || throwError(errors.NOT_INITIALIZED, "CoreService initialization is required");
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static init(logLevel?: string) {
|
|
19
|
-
CLogger.Instance.init(levels.NORMAL);
|
|
20
|
-
|
|
21
|
-
if (isUndefinedOrNull(logLevel)) {
|
|
22
|
-
for (const [index, argv] of process.argv.entries()) {
|
|
23
|
-
if ("logLevel" == argv)
|
|
24
|
-
logLevel = process.argv[index + 1];
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (!isUndefinedOrNull(levels[logLevel])) {
|
|
29
|
-
CLogger.Instance.level = levels[logLevel];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const self = this.self = new this();
|
|
33
|
-
|
|
34
|
-
return self;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public static async term() {
|
|
38
|
-
try {
|
|
39
|
-
clog(levels.WARNING, "Service is terminating...");
|
|
40
|
-
|
|
41
|
-
if (this.self) {
|
|
42
|
-
// Terminate service
|
|
43
|
-
await AppService.term();
|
|
44
|
-
|
|
45
|
-
this.self = undefined;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
clog(levels.WARNING, "Service is terminated");
|
|
49
|
-
}
|
|
50
|
-
catch (error) {
|
|
51
|
-
clog(levels.CRITICAL, "Service failed to terminate:", error);
|
|
52
|
-
throw error;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public async run() {
|
|
57
|
-
try {
|
|
58
|
-
clog(levels.WARNING, "Service", name, "(" + version + ") is starting...");
|
|
59
|
-
|
|
60
|
-
// Initialize service
|
|
61
|
-
const instance = await AppService.init();
|
|
62
|
-
const url = await instance.run();
|
|
63
|
-
|
|
64
|
-
clog(levels.WARNING, "Service is serving", url);
|
|
65
|
-
return this;
|
|
66
|
-
}
|
|
67
|
-
catch (error) {
|
|
68
|
-
clog(levels.CRITICAL, "Service failed to start:", error);
|
|
69
|
-
throw error;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { allowNull, checkFormat, checkNumber, renameKey } from "mxw-libs-utils";
|
|
4
|
-
import { AuthCredential, CREDENTIAL_TYPE } from "./auth/auth";
|
|
5
|
-
|
|
6
|
-
export * from "./auth/auth";
|
|
7
|
-
|
|
8
|
-
export class BaseList {
|
|
9
|
-
public static renameKey(obj: any, keys?: { [key: string]: string }) {
|
|
10
|
-
if (!keys) return { ...obj };
|
|
11
|
-
|
|
12
|
-
return renameKey({ ...obj }, (key) => {
|
|
13
|
-
if (keys[key]) {
|
|
14
|
-
return keys[key];
|
|
15
|
-
}
|
|
16
|
-
return key;
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
public static diff(rec: any, out: any) {
|
|
21
|
-
let diff = [];
|
|
22
|
-
|
|
23
|
-
for (const key in rec) {
|
|
24
|
-
if (undefined === out[key]) {
|
|
25
|
-
diff.push(key);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return diff;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
class Pagination {
|
|
33
|
-
private _page: number;
|
|
34
|
-
private _pageSize: number;
|
|
35
|
-
|
|
36
|
-
constructor(page?: number, pageSize?: number) {
|
|
37
|
-
this.pagination(page, pageSize);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
public pagination(page?: number, pageSize?: number) {
|
|
41
|
-
const params: {
|
|
42
|
-
page: number,
|
|
43
|
-
pageSize: number
|
|
44
|
-
} = checkFormat({
|
|
45
|
-
page: allowNull(checkNumber, this._page),
|
|
46
|
-
pageSize: allowNull(checkNumber, this._pageSize)
|
|
47
|
-
}, { page, pageSize });
|
|
48
|
-
|
|
49
|
-
this._page = params.page;
|
|
50
|
-
this._pageSize = params.pageSize;
|
|
51
|
-
|
|
52
|
-
return this;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
public get page() {
|
|
56
|
-
return this._page;
|
|
57
|
-
}
|
|
58
|
-
public get pageSize() {
|
|
59
|
-
return this._pageSize;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export default abstract class CRUD<C, CI, UI, DI> extends Pagination implements AuthCredential<C>{
|
|
64
|
-
private _cred: C;
|
|
65
|
-
|
|
66
|
-
public abstract picklist(overrides?: any);
|
|
67
|
-
public abstract list(overrides?: any);
|
|
68
|
-
public abstract getDetail(id: number, overrides?: any);
|
|
69
|
-
public abstract create(params: CI);
|
|
70
|
-
public abstract update(params: UI);
|
|
71
|
-
public abstract delete(id: number | DI);
|
|
72
|
-
|
|
73
|
-
public abstract checkCredential(type?: CREDENTIAL_TYPE): C;
|
|
74
|
-
|
|
75
|
-
public auth(cred: C, type = CREDENTIAL_TYPE.USER) {
|
|
76
|
-
this._cred = cred;
|
|
77
|
-
this.checkCredential(type);
|
|
78
|
-
return this;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public get cred() {
|
|
82
|
-
return this._cred;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Request, Response, NextFunction } from "express";
|
|
4
|
-
import { clog, levels } from "mxw-libs-clogger";
|
|
5
|
-
import { errors, throwError } from "mxw-libs-errors";
|
|
6
|
-
|
|
7
|
-
export const finalHandler = (req: Request, res: Response, next: NextFunction) => {
|
|
8
|
-
if (!res.headersSent) {
|
|
9
|
-
res.statusCode = 404;
|
|
10
|
-
throwError(errors.NOT_FOUND, "Resource not found");
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
resLog(null, req, res);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export const errorHandler = (error: any, req: Request, res: Response, next: NextFunction) => {
|
|
17
|
-
const { code, message } = errors.describeError(error);
|
|
18
|
-
|
|
19
|
-
let statusCode: number;
|
|
20
|
-
|
|
21
|
-
// Respect the status code that caller specified
|
|
22
|
-
if (200 !== res.statusCode) {
|
|
23
|
-
statusCode = res.statusCode;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
// Define the default status code that based on error code
|
|
27
|
-
switch (code) {
|
|
28
|
-
case errors.UNAUTHORISED:
|
|
29
|
-
case errors.EXPIRED:
|
|
30
|
-
statusCode = 401;
|
|
31
|
-
break;
|
|
32
|
-
case "TooManyRequests":
|
|
33
|
-
statusCode = 429;
|
|
34
|
-
break;
|
|
35
|
-
default:
|
|
36
|
-
statusCode = 500;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
res.status(statusCode).send({
|
|
41
|
-
ret: code,
|
|
42
|
-
message
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
resLog(error, req, res);
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const resLog = (error: any, req: Request, res: Response) => {
|
|
49
|
-
const ip = req.headers?.['x-forwarded-for'] || req.headers?.['x-real-ip'] || "0.0.0.0";
|
|
50
|
-
|
|
51
|
-
try {
|
|
52
|
-
const contentLength = res.getHeaders()["content-length"];
|
|
53
|
-
|
|
54
|
-
if (!error) {
|
|
55
|
-
if (!req["logExcluded"]) {
|
|
56
|
-
clog(levels.ERROR, `RES: ${req.method} ${req.url} HTTP/${req.httpVersion} @${ip}`,
|
|
57
|
-
`OK ${contentLength || "-"}, elapsed: ${res["elapsed"] + "ms" || "--"}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
const { code, message, reason } = errors.describeError(error);
|
|
62
|
-
|
|
63
|
-
clog(levels.ERROR, `RES: ${req.method} ${req.url} HTTP/${req.httpVersion} @${ip}`,
|
|
64
|
-
`${res.statusCode}: ${code || "?"}, ${contentLength || "-"}, elapsed: ${res["elapsed"] + "ms" || "--"}, ${reason || message || "Unknown error"}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
catch (err) {
|
|
68
|
-
clog(levels.ERROR, `RES: ${req.method} ${req.url} HTTP/${req.httpVersion} @${ip}`,
|
|
69
|
-
`${res.statusCode}: ${"?"} -, elapsed: ${res["elapsed"] + "ms" || "--"}, ${error}`);
|
|
70
|
-
}
|
|
71
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { CLogger, clog, levels } from "mxw-libs-clogger";
|
|
4
|
-
import CoreService from "./core-service"
|
|
5
|
-
|
|
6
|
-
CoreService.init().run().catch(async () => {
|
|
7
|
-
await CoreService.term().catch(() => { });
|
|
8
|
-
process.exit(-1);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
async function exitHandler(cleanup = false) {
|
|
12
|
-
if (cleanup) {
|
|
13
|
-
await CoreService.term().catch(() => { });
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//do something when app is closing
|
|
18
|
-
process.on("exit", exitHandler.bind(null, false));
|
|
19
|
-
|
|
20
|
-
//catches ctrl+c event
|
|
21
|
-
process.on("SIGINT", exitHandler.bind(null, true));
|
|
22
|
-
|
|
23
|
-
//catches SIGHUP (1) event to increase log depth (circled)
|
|
24
|
-
process.on("SIGHUP", () => {
|
|
25
|
-
CLogger.Instance.depth = null;
|
|
26
|
-
clog(levels.CRITICAL, "Logger depth:", CLogger.Instance.depth);
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
//catches SIGUSR1 (10) event to increase log width (circled)
|
|
30
|
-
process.on("SIGUSR1", () => {
|
|
31
|
-
CLogger.Instance.width = null;
|
|
32
|
-
clog(levels.CRITICAL, "Logger width:", CLogger.Instance.width);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
//catches SIGUSR2 (12) event to increase log severity (circled)
|
|
36
|
-
process.on("SIGUSR2", () => {
|
|
37
|
-
CLogger.Instance.level = null;
|
|
38
|
-
clog(levels.CRITICAL, "Logger level:", CLogger.Instance.level);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
//catches uncaught exceptions
|
|
42
|
-
process.on("uncaughtException", (error) => {
|
|
43
|
-
exitHandler.bind(null, true);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
//catches unhandled rejection
|
|
47
|
-
process.on("unhandledRejection", (reason) => {
|
|
48
|
-
if (process.stderr.writable) {
|
|
49
|
-
process.stderr.write(`unhandledRejection: ${reason}`);
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// listen for TERM signal .e.g. kill
|
|
54
|
-
process.on("SIGTERM", exitHandler.bind(null, true));
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { expect } from 'chai';
|
|
4
|
-
|
|
5
|
-
export interface TARGET {
|
|
6
|
-
key: string;
|
|
7
|
-
type: string;
|
|
8
|
-
value: any;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export function assertValue(value: any, target: TARGET) {
|
|
12
|
-
if (null === target.value || undefined === target.value) {
|
|
13
|
-
if (!target.key) {
|
|
14
|
-
expect(value).is.not.exist;
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
expect(value).has.property(target.key).is.not.exist;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
if ("object" === target.type) {
|
|
22
|
-
if (!target.key) {
|
|
23
|
-
expect(value).to.deep.equal(target.value);
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
expect(value).has.property(target.key).to.deep.equal(target.value);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
if (!target.key) {
|
|
31
|
-
expect(value).is.a(target.type).is.eq(target.value);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
expect(value).has.property(target.key).is.a(target.type).is.eq(target.value);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|