@nathapp/na-cli 1.0.1-rc.6 → 1.0.1

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.
Files changed (387) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +0 -0
  3. package/dist/templates/k8s-cert-manager/README.md +60 -0
  4. package/dist/templates/k8s-cert-manager/cloudflare-cert-manager-issuer.yaml +26 -0
  5. package/dist/templates/k8s-deployment/templates/_deployment.tpl +1 -1
  6. package/dist/templates/k8s-deployment/templates/_endpointslice.tpl +42 -0
  7. package/dist/templates/k8s-deployment/templates/_gateway.tpl +94 -0
  8. package/dist/templates/k8s-deployment/templates/_grpcroute.tpl +186 -0
  9. package/dist/templates/k8s-deployment/templates/_httproute.tpl +209 -0
  10. package/dist/templates/k8s-deployment/templates/_ingressroute.tpl +178 -0
  11. package/dist/templates/k8s-deployment/templates/_middleware.tpl +553 -0
  12. package/dist/templates/k8s-deployment/templates/_serverstransport.tpl +73 -0
  13. package/dist/templates/k8s-deployment/templates/_service.tpl +4 -1
  14. package/dist/templates/k8s-helm-chart/templates/endpointslice.yaml +1 -0
  15. package/dist/templates/k8s-helm-chart/templates/gateway.yaml +1 -0
  16. package/dist/templates/k8s-helm-chart/templates/grpcroute.yaml +1 -0
  17. package/dist/templates/k8s-helm-chart/templates/httproute.yaml +1 -0
  18. package/dist/templates/k8s-helm-chart/templates/ingressroute.yaml +1 -0
  19. package/dist/templates/k8s-helm-chart/templates/middleware.yaml +1 -0
  20. package/dist/templates/k8s-helm-chart/templates/serverstransport.yaml +1 -0
  21. package/dist/templates/k8s-helm-chart/values.yaml +3 -5
  22. package/dist/templates/nestjs-api/{.env → .env.local} +5 -0
  23. package/dist/templates/nestjs-api/.gitignore-rename +2 -1
  24. package/dist/templates/nestjs-api/Dockerfile +33 -13
  25. package/dist/templates/nestjs-api/package.json +23 -14
  26. package/dist/templates/nestjs-api/src/i18n/en_US/date.json +7 -0
  27. package/dist/templates/nestjs-api/src/i18n/en_US/validation.json +16 -0
  28. package/dist/templates/nestjs-api/src/i18n/zh_CN/date.json +7 -0
  29. package/dist/templates/nestjs-api/src/i18n/zh_CN/validation.json +16 -0
  30. package/dist/templates/nestjs-api/src/i18n/zh_TW/date.json +7 -0
  31. package/dist/templates/nestjs-api/src/i18n/zh_TW/validation.json +16 -0
  32. package/dist/templates/nestjs-library/.npmignore-rename +4 -0
  33. package/dist/templates/nestjs-library/package.json +2 -2
  34. package/dist/templates/ts-library/.npmignore-rename +4 -0
  35. package/dist/templates/turbo-nestjs-vuexy/README.md +3 -0
  36. package/dist/templates/turbo-nestjs-vuexy/package.json +49 -0
  37. package/dist/templates/turbo-nestjs-vuexy/packages/eslint-config/README.md +3 -0
  38. package/dist/templates/turbo-nestjs-vuexy/packages/eslint-config/library.js +43 -0
  39. package/dist/templates/turbo-nestjs-vuexy/packages/eslint-config/package.json +18 -0
  40. package/dist/templates/turbo-nestjs-vuexy/packages/eslint-config/vue.js +236 -0
  41. package/dist/templates/{ts-library/tsconfig.json → turbo-nestjs-vuexy/packages/typescript-config/base.json} +4 -6
  42. package/dist/templates/turbo-nestjs-vuexy/packages/typescript-config/nestjs.json +12 -0
  43. package/dist/templates/turbo-nestjs-vuexy/packages/typescript-config/package.json +9 -0
  44. package/dist/templates/turbo-nestjs-vuexy/packages/typescript-config/vue.json +82 -0
  45. package/dist/templates/turbo-nestjs-vuexy/turbo.json +24 -0
  46. package/dist/templates/vuexy-portal/.editorconfig +1 -0
  47. package/dist/templates/vuexy-portal/.eslintrc.cjs +237 -0
  48. package/dist/templates/vuexy-portal/.gitignore-rename +42 -0
  49. package/dist/templates/vuexy-portal/.stylelintrc.json +46 -0
  50. package/dist/templates/vuexy-portal/Dockerfile +43 -0
  51. package/dist/templates/vuexy-portal/README.md +35 -0
  52. package/dist/templates/vuexy-portal/auto-imports.d.ts +1131 -0
  53. package/dist/templates/vuexy-portal/components.d.ts +68 -0
  54. package/dist/templates/vuexy-portal/dev.Dockerfile +25 -0
  55. package/dist/templates/vuexy-portal/docker-compose.dev.yml +14 -0
  56. package/dist/templates/vuexy-portal/docker-compose.prod.yml +13 -0
  57. package/dist/templates/vuexy-portal/entrypoint.sh +6 -0
  58. package/dist/templates/vuexy-portal/env.d.ts +12 -0
  59. package/dist/templates/vuexy-portal/index.html +57 -0
  60. package/dist/templates/vuexy-portal/nginx.conf +14 -0
  61. package/dist/templates/vuexy-portal/package.json +140 -0
  62. package/dist/templates/vuexy-portal/pnpm-lock.yaml +7963 -0
  63. package/dist/templates/vuexy-portal/prod.Dockerfile +41 -0
  64. package/dist/templates/vuexy-portal/public/favicon.ico +0 -0
  65. package/dist/templates/vuexy-portal/public/images/avatars/avatar-1.png +0 -0
  66. package/dist/templates/vuexy-portal/public/images/avatars/avatar-2.png +0 -0
  67. package/dist/templates/vuexy-portal/public/images/svg/discord.svg +10 -0
  68. package/dist/templates/vuexy-portal/public/images/svg/gift.svg +8 -0
  69. package/dist/templates/vuexy-portal/public/images/svg/keyboard.svg +8 -0
  70. package/dist/templates/vuexy-portal/public/images/svg/laptop.svg +8 -0
  71. package/dist/templates/vuexy-portal/public/images/svg/lightbulb.svg +8 -0
  72. package/dist/templates/vuexy-portal/public/images/svg/rocket.svg +8 -0
  73. package/dist/templates/vuexy-portal/public/loader.css +79 -0
  74. package/dist/templates/vuexy-portal/public/mockServiceWorker.js +287 -0
  75. package/dist/templates/vuexy-portal/shims.d.ts +15 -0
  76. package/dist/templates/vuexy-portal/src/@core/components/AppBarSearch.vue +278 -0
  77. package/dist/templates/vuexy-portal/src/@core/components/AppDrawerHeaderSection.vue +30 -0
  78. package/dist/templates/vuexy-portal/src/@core/components/AppStepper.vue +371 -0
  79. package/dist/templates/vuexy-portal/src/@core/components/BuyNow.vue +92 -0
  80. package/dist/templates/vuexy-portal/src/@core/components/CardStatisticsVerticalSimple.vue +35 -0
  81. package/dist/templates/vuexy-portal/src/@core/components/CustomizerSection.vue +27 -0
  82. package/dist/templates/vuexy-portal/src/@core/components/DialogCloseBtn.vue +25 -0
  83. package/dist/templates/vuexy-portal/src/@core/components/DropZone.vue +135 -0
  84. package/dist/templates/vuexy-portal/src/@core/components/I18n.vue +48 -0
  85. package/dist/templates/vuexy-portal/src/@core/components/MoreBtn.vue +24 -0
  86. package/dist/templates/vuexy-portal/src/@core/components/Notifications.vue +245 -0
  87. package/dist/templates/vuexy-portal/src/@core/components/ProductDescriptionEditor.vue +198 -0
  88. package/dist/templates/vuexy-portal/src/@core/components/ScrollToTop.vue +41 -0
  89. package/dist/templates/vuexy-portal/src/@core/components/Shortcuts.vue +99 -0
  90. package/dist/templates/vuexy-portal/src/@core/components/TablePagination.vue +39 -0
  91. package/dist/templates/vuexy-portal/src/@core/components/TheCustomizer.vue +618 -0
  92. package/dist/templates/vuexy-portal/src/@core/components/ThemeSwitcher.vue +61 -0
  93. package/dist/templates/vuexy-portal/src/@core/components/TiptapEditor.vue +166 -0
  94. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppAutocomplete.vue +57 -0
  95. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppCombobox.vue +57 -0
  96. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppDateTimePicker.vue +543 -0
  97. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppSelect.vue +50 -0
  98. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppTextField.vue +78 -0
  99. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/AppTextarea.vue +50 -0
  100. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomCheckboxes.vue +81 -0
  101. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomCheckboxesWithIcon.vue +95 -0
  102. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomCheckboxesWithImage.vue +93 -0
  103. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomRadios.vue +81 -0
  104. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomRadiosWithIcon.vue +88 -0
  105. package/dist/templates/vuexy-portal/src/@core/components/app-form-elements/CustomRadiosWithImage.vue +99 -0
  106. package/dist/templates/vuexy-portal/src/@core/components/cards/AppCardActions.vue +167 -0
  107. package/dist/templates/vuexy-portal/src/@core/components/cards/AppCardCode.vue +152 -0
  108. package/dist/templates/vuexy-portal/src/@core/components/cards/CardStatisticsHorizontal.vue +41 -0
  109. package/dist/templates/vuexy-portal/src/@core/components/cards/CardStatisticsVertical.vue +48 -0
  110. package/dist/templates/vuexy-portal/src/@core/scss/base/_components.scss +185 -0
  111. package/dist/templates/vuexy-portal/src/@core/scss/base/_dark.scss +16 -0
  112. package/dist/templates/vuexy-portal/src/@core/scss/base/_default-layout-w-horizontal-nav.scss +45 -0
  113. package/dist/templates/vuexy-portal/src/@core/scss/base/_default-layout-w-vertical-nav.scss +103 -0
  114. package/dist/templates/vuexy-portal/src/@core/scss/base/_default-layout.scss +16 -0
  115. package/dist/templates/vuexy-portal/src/@core/scss/base/_horizontal-nav.scss +194 -0
  116. package/dist/templates/vuexy-portal/src/@core/scss/base/_index.scss +48 -0
  117. package/dist/templates/vuexy-portal/src/@core/scss/base/_layouts.scss +63 -0
  118. package/dist/templates/vuexy-portal/src/@core/scss/base/_misc.scss +20 -0
  119. package/dist/templates/vuexy-portal/src/@core/scss/base/_mixins.scss +63 -0
  120. package/dist/templates/vuexy-portal/src/@core/scss/base/_route-transitions.scss +70 -0
  121. package/dist/templates/vuexy-portal/src/@core/scss/base/_utilities.scss +181 -0
  122. package/dist/templates/vuexy-portal/src/@core/scss/base/_utils.scss +90 -0
  123. package/dist/templates/vuexy-portal/src/@core/scss/base/_variables.scss +198 -0
  124. package/dist/templates/vuexy-portal/src/@core/scss/base/_vertical-nav.scss +255 -0
  125. package/dist/templates/vuexy-portal/src/@core/scss/base/libs/_perfect-scrollbar.scss +35 -0
  126. package/dist/templates/vuexy-portal/src/@core/scss/base/libs/vuetify/_index.scss +1 -0
  127. package/dist/templates/vuexy-portal/src/@core/scss/base/libs/vuetify/_overrides.scss +264 -0
  128. package/dist/templates/vuexy-portal/src/@core/scss/base/libs/vuetify/_variables.scss +62 -0
  129. package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_default-layout-horizontal-nav.scss +27 -0
  130. package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_default-layout-vertical-nav.scss +45 -0
  131. package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_default-layout.scss +3 -0
  132. package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_horizontal-nav.scss +98 -0
  133. package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_index.scss +7 -0
  134. package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_misc.scss +7 -0
  135. package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_nav.scss +33 -0
  136. package/dist/templates/vuexy-portal/src/@core/scss/base/placeholders/_vertical-nav.scss +80 -0
  137. package/dist/templates/vuexy-portal/src/@core/scss/base/skins/_bordered.scss +72 -0
  138. package/dist/templates/vuexy-portal/src/@core/scss/base/skins/_index.scss +1 -0
  139. package/dist/templates/vuexy-portal/src/@core/scss/template/_default-layout-w-horizontal-nav.scss +9 -0
  140. package/dist/templates/vuexy-portal/src/@core/scss/template/_default-layout-w-vertical-nav.scss +20 -0
  141. package/dist/templates/vuexy-portal/src/@core/scss/template/_horizontal-nav.scss +40 -0
  142. package/dist/templates/vuexy-portal/src/@core/scss/template/_mixins.scss +6 -0
  143. package/dist/templates/vuexy-portal/src/@core/scss/template/_utilities.scss +49 -0
  144. package/dist/templates/vuexy-portal/src/@core/scss/template/_variables.scss +102 -0
  145. package/dist/templates/vuexy-portal/src/@core/scss/template/_vertical-nav.scss +47 -0
  146. package/dist/templates/vuexy-portal/src/@core/scss/template/index.scss +17 -0
  147. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/apex-chart.scss +108 -0
  148. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/full-calendar.scss +351 -0
  149. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/shepherd.scss +94 -0
  150. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/swiper.scss +5 -0
  151. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/_variables.scss +351 -0
  152. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_alert.scss +114 -0
  153. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_avatar.scss +27 -0
  154. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_badge.scss +25 -0
  155. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_button.scss +280 -0
  156. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_cards.scss +3 -0
  157. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_checkbox.scss +57 -0
  158. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_chip.scss +102 -0
  159. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_dialog.scss +27 -0
  160. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_expansion-panels.scss +106 -0
  161. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_field.scss +308 -0
  162. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_list.scss +30 -0
  163. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_menu.scss +35 -0
  164. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_otp-input.scss +17 -0
  165. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_pagination.scss +140 -0
  166. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_progress.scss +13 -0
  167. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_radio.scss +46 -0
  168. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_rating.scss +20 -0
  169. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_slider.scss +27 -0
  170. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_snackbar.scss +10 -0
  171. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_switch.scss +58 -0
  172. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_table.scss +48 -0
  173. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_tabs.scss +91 -0
  174. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_textarea.scss +9 -0
  175. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_timeline.scss +99 -0
  176. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/_tooltip.scss +6 -0
  177. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/components/index.scss +25 -0
  178. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/index.scss +3 -0
  179. package/dist/templates/vuexy-portal/src/@core/scss/template/libs/vuetify/overrides.scss +18 -0
  180. package/dist/templates/vuexy-portal/src/@core/scss/template/pages/misc.scss +20 -0
  181. package/dist/templates/vuexy-portal/src/@core/scss/template/pages/page-auth.scss +63 -0
  182. package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_default-layout-horizontal-nav.scss +7 -0
  183. package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_default-layout-vertical-nav.scss +8 -0
  184. package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_horizontal-nav.scss +47 -0
  185. package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_index.scss +6 -0
  186. package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_misc.scss +3 -0
  187. package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_nav.scss +27 -0
  188. package/dist/templates/vuexy-portal/src/@core/scss/template/placeholders/_vertical-nav.scss +35 -0
  189. package/dist/templates/vuexy-portal/src/@core/scss/template/skins/_bordered.scss +82 -0
  190. package/dist/templates/vuexy-portal/src/@core/scss/template/skins/_index.scss +1 -0
  191. package/dist/templates/vuexy-portal/src/@custom/assets/images/user-profile-header.png +0 -0
  192. package/dist/templates/vuexy-portal/src/@custom/components/ConfirmationDialog.vue +155 -0
  193. package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNav.vue +35 -0
  194. package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNavGroup.vue +110 -0
  195. package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNavLayout.vue +150 -0
  196. package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNavLink.vue +56 -0
  197. package/dist/templates/vuexy-portal/src/@layouts/components/HorizontalNavPopper.vue +175 -0
  198. package/dist/templates/vuexy-portal/src/@layouts/components/TransitionExpand.vue +92 -0
  199. package/dist/templates/vuexy-portal/src/@layouts/components/VNodeRenderer.tsx +17 -0
  200. package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNav.vue +236 -0
  201. package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNavGroup.vue +267 -0
  202. package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNavLayout.vue +232 -0
  203. package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNavLink.vue +68 -0
  204. package/dist/templates/vuexy-portal/src/@layouts/components/VerticalNavSectionTitle.vue +37 -0
  205. package/dist/templates/vuexy-portal/src/@layouts/styles/_classes.scss +3 -0
  206. package/dist/templates/vuexy-portal/src/@layouts/styles/_default-layout.scss +35 -0
  207. package/dist/templates/vuexy-portal/src/@layouts/styles/_global.scss +10 -0
  208. package/dist/templates/vuexy-portal/src/@layouts/styles/_mixins.scss +30 -0
  209. package/dist/templates/vuexy-portal/src/@layouts/styles/_placeholders.scss +53 -0
  210. package/dist/templates/vuexy-portal/src/@layouts/styles/_rtl.scss +7 -0
  211. package/dist/templates/vuexy-portal/src/@layouts/styles/_variables.scss +29 -0
  212. package/dist/templates/vuexy-portal/src/@layouts/styles/index.scss +3 -0
  213. package/dist/templates/vuexy-portal/src/App.vue +26 -0
  214. package/dist/templates/vuexy-portal/src/assets/images/avatars/avatar-1.png +0 -0
  215. package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/border-light.svg +16 -0
  216. package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/collapsed-light.svg +17 -0
  217. package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/compact-light.svg +11 -0
  218. package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/default-light.svg +17 -0
  219. package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/horizontal-light.svg +12 -0
  220. package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/ltr-light.svg +15 -0
  221. package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/rtl-light.svg +15 -0
  222. package/dist/templates/vuexy-portal/src/assets/images/customizer-icons/wide-light.svg +11 -0
  223. package/dist/templates/vuexy-portal/src/assets/images/logo.svg +6 -0
  224. package/dist/templates/vuexy-portal/src/assets/images/misc/3d-safe-box-with-golden-dollar-coins.png +0 -0
  225. package/dist/templates/vuexy-portal/src/assets/images/misc/3d-space-rocket-with-smoke.png +0 -0
  226. package/dist/templates/vuexy-portal/src/assets/images/misc/dollar-coins-flying-pink-piggy-bank.png +0 -0
  227. package/dist/templates/vuexy-portal/src/assets/images/misc/fleet-car.png +0 -0
  228. package/dist/templates/vuexy-portal/src/assets/images/pages/misc-mask-dark.png +0 -0
  229. package/dist/templates/vuexy-portal/src/assets/images/pages/misc-mask-light.png +0 -0
  230. package/dist/templates/vuexy-portal/src/assets/images/svg/Card.svg +8 -0
  231. package/dist/templates/vuexy-portal/src/assets/images/svg/Check.svg +4 -0
  232. package/dist/templates/vuexy-portal/src/assets/images/svg/Diamond.svg +12 -0
  233. package/dist/templates/vuexy-portal/src/assets/images/svg/Suitcase.svg +4 -0
  234. package/dist/templates/vuexy-portal/src/assets/images/svg/Wallet.svg +10 -0
  235. package/dist/templates/vuexy-portal/src/assets/images/svg/address.svg +25 -0
  236. package/dist/templates/vuexy-portal/src/assets/images/svg/auth-v1-bottom-shape.svg +4 -0
  237. package/dist/templates/vuexy-portal/src/assets/images/svg/auth-v1-top-shape.svg +4 -0
  238. package/dist/templates/vuexy-portal/src/assets/images/svg/cart.svg +5 -0
  239. package/dist/templates/vuexy-portal/src/assets/images/svg/checkbox-checked.svg +4 -0
  240. package/dist/templates/vuexy-portal/src/assets/images/svg/checkbox-indeterminate.svg +4 -0
  241. package/dist/templates/vuexy-portal/src/assets/images/svg/checkbox-unchecked.svg +10 -0
  242. package/dist/templates/vuexy-portal/src/assets/images/svg/discord.svg +10 -0
  243. package/dist/templates/vuexy-portal/src/assets/images/svg/gift.svg +8 -0
  244. package/dist/templates/vuexy-portal/src/assets/images/svg/home.svg +5 -0
  245. package/dist/templates/vuexy-portal/src/assets/images/svg/keyboard.svg +4 -0
  246. package/dist/templates/vuexy-portal/src/assets/images/svg/laptop.svg +4 -0
  247. package/dist/templates/vuexy-portal/src/assets/images/svg/lightbulb.svg +8 -0
  248. package/dist/templates/vuexy-portal/src/assets/images/svg/office.svg +4 -0
  249. package/dist/templates/vuexy-portal/src/assets/images/svg/paper-send.svg +4 -0
  250. package/dist/templates/vuexy-portal/src/assets/images/svg/payment.svg +21 -0
  251. package/dist/templates/vuexy-portal/src/assets/images/svg/radio-checked.svg +3 -0
  252. package/dist/templates/vuexy-portal/src/assets/images/svg/radio-unchecked.svg +3 -0
  253. package/dist/templates/vuexy-portal/src/assets/images/svg/rocket.svg +4 -0
  254. package/dist/templates/vuexy-portal/src/assets/images/svg/trending.svg +14 -0
  255. package/dist/templates/vuexy-portal/src/assets/images/svg/user-info.svg +4 -0
  256. package/dist/templates/vuexy-portal/src/assets/images/svg/user.svg +6 -0
  257. package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-account.svg +6 -0
  258. package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-address.svg +18 -0
  259. package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-personal.svg +6 -0
  260. package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-social-link.svg +6 -0
  261. package/dist/templates/vuexy-portal/src/assets/images/svg/wizard-submit.svg +6 -0
  262. package/dist/templates/vuexy-portal/src/assets/styles/styles.scss +1 -0
  263. package/dist/templates/vuexy-portal/src/assets/styles/variables/_template.scss +6 -0
  264. package/dist/templates/vuexy-portal/src/assets/styles/variables/_vuetify.scss +7 -0
  265. package/dist/templates/vuexy-portal/src/components/AppLoadingIndicator.vue +63 -0
  266. package/dist/templates/vuexy-portal/src/components/AppPricing.vue +247 -0
  267. package/dist/templates/vuexy-portal/src/components/AppSearchHeader.vue +77 -0
  268. package/dist/templates/vuexy-portal/src/components/ErrorHeader.vue +40 -0
  269. package/dist/templates/vuexy-portal/src/components/dialogs/AddAuthenticatorAppDialog.vue +101 -0
  270. package/dist/templates/vuexy-portal/src/components/dialogs/AddEditAddressDialog.vue +238 -0
  271. package/dist/templates/vuexy-portal/src/components/dialogs/AddEditPermissionDialog.vue +93 -0
  272. package/dist/templates/vuexy-portal/src/components/dialogs/AddEditRoleDialog.vue +302 -0
  273. package/dist/templates/vuexy-portal/src/components/dialogs/AddPaymentMethodDialog.vue +120 -0
  274. package/dist/templates/vuexy-portal/src/components/dialogs/CardAddEditDialog.vue +153 -0
  275. package/dist/templates/vuexy-portal/src/components/dialogs/ConfirmDialog.vue +151 -0
  276. package/dist/templates/vuexy-portal/src/components/dialogs/CreateAppDialog.vue +459 -0
  277. package/dist/templates/vuexy-portal/src/components/dialogs/EnableOneTimePasswordDialog.vue +85 -0
  278. package/dist/templates/vuexy-portal/src/components/dialogs/PaymentProvidersDialog.vue +123 -0
  279. package/dist/templates/vuexy-portal/src/components/dialogs/PricingPlanDialog.vue +34 -0
  280. package/dist/templates/vuexy-portal/src/components/dialogs/ReferAndEarnDialog.vue +181 -0
  281. package/dist/templates/vuexy-portal/src/components/dialogs/ShareProjectDialog.vue +198 -0
  282. package/dist/templates/vuexy-portal/src/components/dialogs/TwoFactorAuthDialog.vue +120 -0
  283. package/dist/templates/vuexy-portal/src/components/dialogs/UserInfoEditDialog.vue +246 -0
  284. package/dist/templates/vuexy-portal/src/components/dialogs/UserUpgradePlanDialog.vue +101 -0
  285. package/dist/templates/vuexy-portal/src/layouts/blank.vue +42 -0
  286. package/dist/templates/vuexy-portal/src/layouts/components/DefaultLayoutWithHorizontalNav.vue +75 -0
  287. package/dist/templates/vuexy-portal/src/layouts/components/DefaultLayoutWithVerticalNav.vue +79 -0
  288. package/dist/templates/vuexy-portal/src/layouts/components/Footer.vue +17 -0
  289. package/dist/templates/vuexy-portal/src/layouts/components/NavSearchBar.vue +266 -0
  290. package/dist/templates/vuexy-portal/src/layouts/components/NavbarShortcuts.vue +45 -0
  291. package/dist/templates/vuexy-portal/src/layouts/components/NavbarThemeSwitcher.vue +22 -0
  292. package/dist/templates/vuexy-portal/src/layouts/components/UserProfile.vue +114 -0
  293. package/dist/templates/vuexy-portal/src/layouts/default.vue +30 -0
  294. package/dist/templates/vuexy-portal/src/pages/[...error].vue +46 -0
  295. package/dist/templates/vuexy-portal/src/pages/account-settings/[tab].vue +57 -0
  296. package/dist/templates/vuexy-portal/src/pages/index.vue +32 -0
  297. package/dist/templates/vuexy-portal/src/pages/login.vue +178 -0
  298. package/dist/templates/vuexy-portal/src/pages/not-authorized.vue +47 -0
  299. package/dist/templates/vuexy-portal/src/pages/second-page.vue +13 -0
  300. package/dist/templates/vuexy-portal/src/plugins/casl/shims-ability.d.ts +8 -0
  301. package/dist/templates/vuexy-portal/src/plugins/i18n/locales/en_US.json +88 -0
  302. package/dist/templates/vuexy-portal/src/plugins/i18n/locales/zh_CN.json +88 -0
  303. package/dist/templates/vuexy-portal/src/plugins/i18n/vue-i18n.d.ts +17 -0
  304. package/dist/templates/vuexy-portal/src/plugins/iconify/icons.css +21039 -0
  305. package/dist/templates/vuexy-portal/src/plugins/iconify/package.json +3 -0
  306. package/dist/templates/vuexy-portal/src/views/account-settings/AccountSettingsSecurity.vue +179 -0
  307. package/dist/templates/vuexy-portal/typed-router.d.ts +146 -0
  308. package/dist/utils/template.js +1 -0
  309. package/dist/utils/template.js.map +1 -1
  310. package/package.json +1 -1
  311. package/.gitlab-ci.yml +0 -143
  312. package/Makefile +0 -62
  313. package/dist/templates/db-schema/.gitlab-ci.yml +0 -139
  314. package/dist/templates/db-schema/Makefile +0 -885
  315. package/dist/templates/k8s-deployment/.gitlab-ci.yml +0 -128
  316. package/dist/templates/k8s-deployment/Makefile +0 -196
  317. package/dist/templates/k8s-deployment/resources/charts/mysql/charts/mysql-install/script/Makefile +0 -12
  318. package/dist/templates/k8s-deployment/resources/charts/redis/charts/redis-install/script/Makefile +0 -8
  319. package/dist/templates/k8s-deployment/services/charts/hooks/charts/pre-delete-rsc/script/Makefile +0 -49
  320. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-cypress/Makefile +0 -9
  321. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/script/Makefile +0 -14
  322. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/_t-0100-readiness-liveness.ts +0 -84
  323. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/hub.ts +0 -372
  324. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contact.ts +0 -158
  325. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-contract.ts +0 -328
  326. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-kyc.ts +0 -304
  327. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-app.ts +0 -823
  328. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-onboard-web.ts +0 -493
  329. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-profile.ts +0 -277
  330. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/individual-whitelist.ts +0 -133
  331. package/dist/templates/k8s-deployment/services/charts/tests/charts/e2e-test-js/tests/t-0200-start.ts +0 -172
  332. package/dist/templates/mxw-base-api-express/.dockerignore +0 -2
  333. package/dist/templates/mxw-base-api-express/.env +0 -10
  334. package/dist/templates/mxw-base-api-express/.gitlab-ci.yml +0 -174
  335. package/dist/templates/mxw-base-api-express/.nvmrc +0 -1
  336. package/dist/templates/mxw-base-api-express/Makefile +0 -84
  337. package/dist/templates/mxw-base-api-express/src/app-service.test.ts +0 -94
  338. package/dist/templates/mxw-base-api-express/src/app-service.ts +0 -498
  339. package/dist/templates/mxw-base-api-express/src/auth/auth-user.test.ts +0 -215
  340. package/dist/templates/mxw-base-api-express/src/auth/auth-user.ts +0 -86
  341. package/dist/templates/mxw-base-api-express/src/auth/auth.ts +0 -81
  342. package/dist/templates/mxw-base-api-express/src/core-service.ts +0 -72
  343. package/dist/templates/mxw-base-api-express/src/crud.ts +0 -84
  344. package/dist/templates/mxw-base-api-express/src/http-handler.ts +0 -71
  345. package/dist/templates/mxw-base-api-express/src/server.ts +0 -54
  346. package/dist/templates/mxw-base-api-express/src/test.ts +0 -38
  347. package/dist/templates/mxw-base-api-express/src/utils/api-utilities.ts +0 -52
  348. package/dist/templates/mxw-base-api-express/src/utils/file-utilities.ts +0 -55
  349. package/dist/templates/mxw-base-api-express/tsconfig.json +0 -32
  350. package/dist/templates/nestjs-api/.dockerignore +0 -6
  351. package/dist/templates/nestjs-api/.gitlab-ci.yml +0 -174
  352. package/dist/templates/nestjs-api/.nvmrc +0 -1
  353. package/dist/templates/nestjs-api/.prettierrc +0 -4
  354. package/dist/templates/nestjs-api/Makefile +0 -95
  355. package/dist/templates/nestjs-api/nest-cli.json +0 -11
  356. package/dist/templates/nestjs-api/src/app.controller.spec.ts +0 -24
  357. package/dist/templates/nestjs-api/src/app.controller.ts +0 -27
  358. package/dist/templates/nestjs-api/src/app.module.ts +0 -49
  359. package/dist/templates/nestjs-api/src/app.service.ts +0 -27
  360. package/dist/templates/nestjs-api/src/main.ts +0 -26
  361. package/dist/templates/nestjs-api/test/app.e2e-spec.ts +0 -47
  362. package/dist/templates/nestjs-api/tsconfig.build.json +0 -4
  363. package/dist/templates/nestjs-api/tsconfig.json +0 -24
  364. package/dist/templates/nestjs-library/.eslintrc.js +0 -24
  365. package/dist/templates/nestjs-library/.gitlab-ci.yml +0 -138
  366. package/dist/templates/nestjs-library/.prettierrc +0 -6
  367. package/dist/templates/nestjs-library/Makefile +0 -60
  368. package/dist/templates/nestjs-library/index.ts +0 -1
  369. package/dist/templates/nestjs-library/lib/index.ts +0 -2
  370. package/dist/templates/nestjs-library/test/app/controller/hello.controller.ts +0 -7
  371. package/dist/templates/nestjs-library/tsconfig.build.json +0 -7
  372. package/dist/templates/nestjs-library/tsconfig.json +0 -18
  373. package/dist/templates/ts-library/.dockerignore +0 -2
  374. package/dist/templates/ts-library/.eslintrc.js +0 -24
  375. package/dist/templates/ts-library/.gitlab-ci.yml +0 -136
  376. package/dist/templates/ts-library/.prettierrc +0 -6
  377. package/dist/templates/ts-library/Makefile +0 -58
  378. package/dist/templates/ts-library/index.ts +0 -1
  379. package/dist/templates/ts-library/lib/index.ts +0 -1
  380. package/dist/templates/ts-library/lib/samples/index.ts +0 -5
  381. package/dist/templates/ts-library/lib/samples/samples-function.ts +0 -3
  382. package/dist/templates/ts-library/test/sample.e2e-spec.ts +0 -10
  383. package/dist/templates/ts-library/tsconfig.build.json +0 -4
  384. package/dist/utils/help.js +0 -8
  385. package/dist/utils/help.js.map +0 -1
  386. package/tsconfig.json +0 -24
  387. /package/dist/templates/{nestjs-api/.eslintrc.js → turbo-nestjs-vuexy/packages/eslint-config/nest.js} +0 -0
@@ -1,498 +0,0 @@
1
- "use strict";
2
-
3
- import { Server } from "http";
4
- import express, { Express, Router, Request, Response, NextFunction, RequestHandler } from "express";
5
- import cors from "cors";
6
- import bodyParser from "body-parser";
7
- import responseTime from "response-time";
8
- import multer from "multer";
9
-
10
- import { finalHandler, errorHandler } from "./http-handler";
11
- import { allowNullOrEmpty, checkFormat, checkPositiveNumber, checkString, isUndefinedOrNull, isUndefinedOrNullOrEmpty, notAllowNullOrEmpty } from "mxw-libs-utils";
12
- import { clog, levels } from "mxw-libs-clogger";
13
- import { createError, describeError, errors, throwError } from "mxw-libs-errors";
14
- import { ApiService } from "mxw-libs-api-token";
15
- import { Mysql as DB } from "mxw-libs-database";
16
- import { EmailAgent, EmailServiceEnvironment } from "mxw-libs-email-notify";
17
- import AuthUser, { CREDENTIAL_TYPE } from "./auth/auth-user";
18
-
19
-
20
- const { name, version } = require("../package.json");
21
-
22
- const DEFAULT_FILE_CACHE_DIR = "/tmp"; // Default received file cache directory
23
- const DEFAULT_MAX_FILE_SIZE = 20000 * (1000 * 1024); // Default to 20MB of max file size
24
-
25
- enum AuthType {
26
- API = "API",
27
- NIL = "NIL",
28
- JWT = "JWT",
29
- JWT_GUEST = "JWT_GUEST",
30
- JWT_USER = "JWT_USER",
31
- }
32
-
33
- enum ContentType {
34
- JSON = "JSON",
35
- RAW = "RAW",
36
- FILE = "FILE",
37
- }
38
-
39
- enum HttpMethod {
40
- GET = "GET",
41
- POST = "POST",
42
- PATCH = "PATCH",
43
- PUT = "PUT",
44
- DELETE = "DELETE",
45
- HEAD = "HEAD",
46
- OPTIONS = "OPTIONS",
47
- }
48
-
49
- type CallFunc = (req: Request, res: Response) => Promise<void>;
50
-
51
- export function goodRes(res: Response, data?: any, statusCode?: number) {
52
- const resp = {
53
- ret: "0"
54
- }
55
- if (!isUndefinedOrNull(data)) {
56
- delete data.ret;
57
- resp["data"] = data;
58
- }
59
-
60
- if (!isUndefinedOrNull(statusCode)) {
61
- res.status(statusCode).json(resp);
62
- }
63
- else {
64
- res.json(resp);
65
- }
66
- }
67
-
68
- export function errorRes(res: Response, ret: number | string, message: string, data?: any, statusCode?: number) {
69
- const resp = {
70
- ret,
71
- msg: message,
72
- }
73
-
74
- if (!isUndefinedOrNull(data)) {
75
- delete data.ret;
76
- delete data.msg;
77
- if (!isUndefinedOrNull(data)) {
78
- resp["data"] = data;
79
- }
80
- }
81
-
82
- if (!isUndefinedOrNull(statusCode)) {
83
- res.status(statusCode).json(resp);
84
- } else {
85
- res.json(resp)
86
- }
87
- }
88
-
89
- export default class AppService {
90
- private static self: AppService;
91
-
92
- private app: Express;
93
- private listener: Server;
94
-
95
- private whitelist: { [walletAddress: string]: boolean } = {};
96
-
97
- public config: {
98
- JWT_SECRET: string;
99
-
100
- SERVICE_DOMAIN: string;
101
- SERVICE_SESSION_TIMEOUT?: number;
102
- SERVICE_WALLET_JSON: string;
103
- SERVICE_WALLET_PASSWORD: string;
104
-
105
- MYSQL_URL: string;
106
-
107
- CACHE_DIR?: string;
108
- MAX_FILE_SIZE?: number;
109
- };
110
-
111
- private mailConfig: EmailServiceEnvironment;
112
-
113
- public static get Instance() {
114
- return this.self || throwError(errors.NOT_INITIALIZED, "AppService initialization is required");
115
- }
116
-
117
- private async onLiveness(req: Request, res: Response) {
118
- res.json();
119
- }
120
-
121
- public async onReadiness(req: Request, res: Response) {
122
- res.json();
123
- }
124
-
125
- private async onRoot(req: Request, res: Response) {
126
- res.json({
127
- message: `Welcome to the coolest API on earth - ${name}:${version}!`
128
- });
129
- }
130
-
131
- public static async init() {
132
- const self = new this();
133
-
134
- try {
135
- const checkPathString = function (value) {
136
- let v: string = checkString(value);
137
- if (!v.endsWith("/")) {
138
- v = v + "/";
139
- }
140
- return v;
141
- }
142
-
143
- self.config = checkFormat({
144
- JWT_SECRET: notAllowNullOrEmpty(checkString),
145
-
146
- SERVICE_DOMAIN: notAllowNullOrEmpty(checkString),
147
- SERVICE_SESSION_TIMEOUT: allowNullOrEmpty(checkPositiveNumber, 60000),
148
- SERVICE_WALLET_JSON: notAllowNullOrEmpty(checkString),
149
- SERVICE_WALLET_PASSWORD: notAllowNullOrEmpty(checkString),
150
-
151
- MYSQL_URL: notAllowNullOrEmpty(checkString),
152
-
153
- CACHE_DIR: allowNullOrEmpty(checkPathString),
154
- MAX_FILE_SIZE: allowNullOrEmpty(checkPositiveNumber)
155
- }, {
156
- JWT_SECRET: process.env.JWT_SECRET,
157
-
158
- SERVICE_DOMAIN: process.env.SERVICE_DOMAIN,
159
- SERVICE_SESSION_TIMEOUT: process.env.SERVICE_SESSION_TIMEOUT,
160
- SERVICE_WALLET_JSON: process.env.SERVICE_WALLET_JSON,
161
- SERVICE_WALLET_PASSWORD: process.env.SERVICE_WALLET_PASSWORD,
162
-
163
- MYSQL_URL: process.env.MYSQL_URL,
164
-
165
- CACHE_DIR: process.env.CACHE_DIR,
166
- MAX_FILE_SIZE: process.env.MAX_FILE_SIZE,
167
- });
168
- /*
169
- // Set email agent settings
170
- self.mailConfig = {
171
- domain: process.env.EMAIL_NOTIFY_DOMAIN,
172
- url: process.env.EMAIL_NOTIFY_URL,
173
- requestTimeout: process.env.EMAIL_NOTIFY_REQUEST_TIMEOUT ? Number(process.env.EMAIL_NOTIFY_REQUEST_TIMEOUT) : 10000,
174
- wallet: process.env.EMAIL_NOTIFY_WALLET_JSON,
175
- password: process.env.EMAIL_NOTIFY_WALLET_PASSWORD
176
- }
177
- */
178
- }
179
- catch (error) {
180
- const { message } = describeError(error);
181
- throwError(errors.NOT_CONFIGURED, "Environment: " + message, { error });
182
- }
183
-
184
- if (process.env.WHITELIST) {
185
- if ("*" === process.env.WHITELIST) {
186
- self.whitelist["*"] = true;
187
- }
188
- else {
189
- for (const walletAddress of process.env.WHITELIST.split(",")) {
190
- self.whitelist[walletAddress.trim()] = true;
191
- }
192
- }
193
- }
194
-
195
- // Initialize server
196
- self.app = express();
197
-
198
- self.app.set("x-powered-by", false);
199
-
200
- const origins: string[] | string =
201
- !isUndefinedOrNullOrEmpty(process.env.CORS)
202
- ? process.env.CORS == "*"
203
- ? "*"
204
- : process.env.CORS.split(",")
205
- : "*";
206
-
207
- const corsOptions = {
208
- origin: origins,
209
- allowedHeaders: "Origin,X-Requested-With,Content-Type,Accept,Lang,Authorization,Accept-Version,Content-Language,app-id,Location",
210
- exposedHeaders: "X-Requested-With,X-Metadata",
211
- preflightContinue: false
212
- };
213
-
214
- self.app.use(cors(corsOptions));
215
-
216
- self.app.use(bodyParser.json({
217
- limit: 20 * 1024 * 1024, // default to 1MB of max body size
218
- }));
219
-
220
- self.app.use(responseTime((req: Request, res: Response, time: number) => {
221
- res["elapsed"] = time.toFixed(3);
222
- }));
223
-
224
- this.self = self;
225
-
226
- return self;
227
- }
228
-
229
- public static async term() {
230
- if (this.self) {
231
- if (this.self.listener) {
232
- await new Promise<void>((resolve, reject) => {
233
- try {
234
- this.self.listener.close((error) => {
235
- if (error) return reject(error);
236
- return resolve();
237
- });
238
- }
239
- catch (error) {
240
- return reject(error);
241
- }
242
- });
243
-
244
- this.self.listener = undefined;
245
- }
246
-
247
- await DB.Instance.term(null);
248
-
249
- this.self = undefined;
250
- }
251
- }
252
-
253
- public async run() {
254
- // Initialize service token verifier
255
- await ApiService.Instance.init({
256
- domain: this.config.SERVICE_DOMAIN,
257
- sessionTimeout: this.config.SERVICE_SESSION_TIMEOUT,
258
- wallet: this.config.SERVICE_WALLET_JSON,
259
- password: this.config.SERVICE_WALLET_PASSWORD
260
- });
261
-
262
- // Initialize dependencies and modules
263
- await DB.Instance.init(null, this.config.MYSQL_URL);
264
-
265
- // Initialize modules
266
- AuthUser.init(
267
- this.config.JWT_SECRET,
268
- undefined,
269
- {
270
- JWT_SIGN_ALGO: process.env.JWT_SIGN_ALGO
271
- }
272
- );
273
-
274
- const router = express.Router();
275
-
276
- // ** Health endpoints **
277
- this.entryPoint(router, "/", this.onRoot, undefined, [HttpMethod.GET, HttpMethod.POST], AuthType.NIL, ContentType.JSON, true);
278
- this.entryPoint(router, "/liveness", this.onLiveness, undefined, [HttpMethod.GET, HttpMethod.POST], AuthType.NIL, ContentType.RAW, true);
279
- this.entryPoint(router, "/readiness", this.onReadiness, undefined, [HttpMethod.GET, HttpMethod.POST], AuthType.NIL, ContentType.RAW, true);
280
-
281
- this.app.use(router);
282
- this.app.use(finalHandler); // Make sure this handler is place at the last of the router stack
283
-
284
- this.app.use(errorHandler);
285
-
286
- return new Promise<string>((resolve, reject) => {
287
- try {
288
- this.listener = this.app.listen(8080, () => {
289
- return resolve("http://0.0.0.0:8080");
290
- });
291
- }
292
- catch (error) {
293
- return reject(error);
294
- }
295
- });
296
- }
297
-
298
- private entryPoint(router: Router, uri: string, func: CallFunc, preCheckFunc: CallFunc, methods: HttpMethod[], authType: AuthType, contentType: ContentType, logExcluded: boolean, overrides?: any) {
299
- for (const method of methods) {
300
- let methodPreHandler: RequestHandler;
301
-
302
- if (ContentType.FILE === contentType) {
303
- const options: multer.Options = {
304
- dest: this.config.CACHE_DIR || DEFAULT_FILE_CACHE_DIR,
305
- limits: {
306
- fileSize: this.config.MAX_FILE_SIZE || DEFAULT_MAX_FILE_SIZE
307
- }
308
- };
309
- const upload = multer(options);
310
-
311
- methodPreHandler = async (req: Request, res: Response, next: NextFunction) => {
312
- req["logExcluded"] = logExcluded;
313
-
314
- if (!logExcluded) {
315
- const ip = req.headers?.['x-forwarded-for'] || req.headers?.['x-real-ip'] || "0.0.0.0";
316
- clog(levels.NORMAL, `REQ: ${req.method} ${req.url} HTTP/${req.httpVersion} @${ip}`);
317
- }
318
-
319
- await this.onAuth(authType, req, next);
320
-
321
- return upload.single(overrides?.fieldName || "file")(req, res, next);
322
- };
323
- }
324
- else {
325
- methodPreHandler = async (req: Request, res: Response, next: NextFunction) => {
326
- req["logExcluded"] = logExcluded;
327
-
328
- if (!logExcluded) {
329
- const ip = req.headers?.['x-forwarded-for'] || req.headers?.['x-real-ip'] || "0.0.0.0";
330
- clog(levels.NORMAL, `REQ: ${req.method} ${req.url} HTTP/${req.httpVersion} @${ip}`);
331
- }
332
-
333
- await this.onAuth(authType, req, next);
334
-
335
- switch (req.method) {
336
- case "GET":
337
- case "HEAD":
338
- break;
339
-
340
- case "POST":
341
- case "PUT":
342
- case "PATCH":
343
- case "DELETE":
344
- switch (contentType) {
345
- case ContentType.JSON:
346
- if (!req.is("json")) {
347
- const contentType = req.headers?.['content-type'];
348
- throwError(errors.INVALID_FORMAT, "Content type is not supported", { contentType });
349
- }
350
- }
351
- break;
352
- }
353
-
354
- return next();
355
- };
356
- }
357
-
358
- const methodHandler = async (req: Request, res: Response, next: NextFunction) => {
359
- try {
360
- preCheckFunc && await preCheckFunc.apply(this, [req, res]);
361
- func && await func.apply(this, [req, res]);
362
-
363
- return next();
364
- }
365
- catch (error) {
366
- let { code, message, reason } = errors.describeError(error);
367
-
368
- clog(levels.ERROR, `ERROR ${code}:`, reason || message);
369
-
370
- if (errors.DATABASE_ERROR == code) {
371
- code = isUndefinedOrNullOrEmpty(error.ret) ? "SYSTEM_BUSY" : error.ret;
372
- if (!isUndefinedOrNullOrEmpty(error.msg)) {
373
- message = error.msg;
374
- }
375
- }
376
-
377
- try {
378
- const translated = await this.translateError(req.headers["content-language"], code, message);
379
-
380
- code = translated.code;
381
- message = translated.message;
382
- }
383
- catch (error) { }
384
-
385
- return next(createError(code, message, { error }));
386
- }
387
- };
388
-
389
- switch (method) {
390
- case HttpMethod.GET: router.get(uri, methodPreHandler, methodHandler); break;
391
- case HttpMethod.POST: router.post(uri, methodPreHandler, methodHandler); break;
392
- case HttpMethod.PATCH: router.patch(uri, methodPreHandler, methodHandler); break;
393
- case HttpMethod.PUT: router.put(uri, methodPreHandler, methodHandler); break;
394
- case HttpMethod.DELETE: router.delete(uri, methodPreHandler, methodHandler); break;
395
- case HttpMethod.HEAD: router.head(uri, methodPreHandler, methodHandler); break;
396
- case HttpMethod.OPTIONS: router.options(uri, methodPreHandler, methodHandler); break;
397
- }
398
- }
399
- }
400
-
401
- private async onAuth(authType: AuthType, req: Request, next: NextFunction) {
402
- try {
403
- switch (authType) {
404
- case AuthType.JWT:
405
- {
406
- const credential = (req.headers["authorization"] || "").split(" ")?.[1];
407
- req["cred"] = AuthUser.Instance.verifyToken(credential, null);
408
- }
409
- return;
410
-
411
- case AuthType.JWT_GUEST:
412
- {
413
- const credential = (req.headers["authorization"] || "").split(" ")?.[1];
414
- req["cred"] = AuthUser.Instance.verifyToken(credential, CREDENTIAL_TYPE.GUEST);
415
- }
416
- return;
417
-
418
- case AuthType.JWT_USER:
419
- {
420
- const credential = (req.headers["authorization"] || "").split(" ")?.[1];
421
- req["cred"] = AuthUser.Instance.verifyToken(credential, CREDENTIAL_TYPE.USER);
422
- }
423
- return;
424
-
425
- case AuthType.API:
426
- {
427
- const credential = (req.headers["authorization"] || "").split(" ")?.[1];
428
-
429
- if (credential) {
430
- try {
431
- const walletAddress = ApiService.Instance.verifyToken(credential);
432
-
433
- if (walletAddress) {
434
- // Check whitelist
435
- if (this.whitelist["*"] || this.whitelist[walletAddress]) {
436
- req["walletAddress"] = walletAddress;
437
- return;
438
- }
439
- }
440
- } catch (error) {
441
- const { message } = describeError(error)
442
- clog(levels.ERROR, "failed to verify api token ", message)
443
- return next(createError(errors.UNAUTHORISED, message));
444
- }
445
- }
446
- }
447
- break;
448
-
449
- case AuthType.NIL:
450
- return;
451
- }
452
- }
453
- catch (error) {
454
- const { code, message } = describeError(error);
455
-
456
- if (errors.EXPIRED === code) {
457
- //throw error;
458
- return next(createError(code, message))
459
- }
460
- }
461
-
462
- return next(createError(errors.UNAUTHORISED, "Unauthorised"));
463
- }
464
-
465
- private async translateError(language: string, code: string, message: string) {
466
- if (!language) {
467
- language = "en_US"; // Default language
468
- }
469
-
470
- const codeId = !isNaN(Number(code)) ? Number(code) : 0;
471
- clog(levels.DETAIL, "Translating error", language, "(", codeId, ")", code, ":", message);
472
-
473
- try {
474
- const results = await DB.Instance.callQuery(null, "sp_cm_get_err_msg_sys", [codeId, code, message, language, 1]);
475
-
476
- let translatedMessage = "";
477
- if (0 < results.recordsets.length && 0 < results.recordsets[0].length) {
478
- if (!isUndefinedOrNullOrEmpty(results.recordsets[0][0].msg)) {
479
- translatedMessage = results.recordsets[0][0].msg;
480
- }
481
- }
482
- clog(levels.INFO, "Translated error", language, "(", codeId, ")", code, ":", translatedMessage);
483
- return { code, message: translatedMessage };
484
- }
485
- catch (error) {
486
- if (errors.NOT_CONFIGURED != error.code) {
487
- clog(levels.ERROR, "Translate error message failed", language, "(", codeId, ")", code, ":", message, "ERROR:", JSON.stringify(error));
488
- }
489
- return errors.throwError("SYSTEM_BUSY", "System busy", {
490
- language,
491
- codeId,
492
- code,
493
- message,
494
- error
495
- });
496
- }
497
- }
498
- }