create-nexwire 4.3.0 → 4.4.0

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 (326) hide show
  1. package/README.md +10 -5
  2. package/express/src/framework/facade.ts +1 -0
  3. package/express/src/framework/http/logger.ts +13 -4
  4. package/express/src/framework/maker-cli/runtime/core.mjs +1 -2
  5. package/express/src/framework/notification/channels/mail.ts +8 -6
  6. package/express/src/middlewares/auth-middleware.ts +1 -2
  7. package/express/src/middlewares/role-middleware.ts +3 -13
  8. package/express/src/modules/auth/routes/index.ts +1 -2
  9. package/express/src/providers/notification.ts +2 -2
  10. package/express/src/resources/src/components/Switch.vue +60 -65
  11. package/express/src/resources/src/pages/auth/forgetPassword.vue +23 -30
  12. package/express/src/resources/src/pages/auth/login.vue +25 -28
  13. package/express/src/resources/src/pages/auth/register.vue +35 -39
  14. package/express/src/resources/src/pages/auth/resetPassword.vue +29 -37
  15. package/express/src/resources/src/pages/auth/verifyEmail.vue +15 -19
  16. package/express/src/resources/src/plugins/gum.ts +519 -203
  17. package/express/src/resources/src/stores/auth.ts +9 -6
  18. package/express/src/storage/database/nexwire.sqlite +0 -0
  19. package/fastify/.dockerignore +14 -0
  20. package/fastify/.env +44 -0
  21. package/fastify/.env.example +42 -0
  22. package/fastify/.vscode/extensions.json +6 -0
  23. package/fastify/.vscode/settings.json +37 -0
  24. package/fastify/LICENSE +21 -0
  25. package/fastify/README.md +232 -0
  26. package/fastify/biome.json +99 -0
  27. package/fastify/drizzle.config.ts +25 -0
  28. package/fastify/gitignore-stub +31 -0
  29. package/fastify/package.json +130 -0
  30. package/fastify/public/.gitkeep +0 -0
  31. package/fastify/src/config/app.ts +41 -0
  32. package/fastify/src/config/auth.ts +12 -0
  33. package/fastify/src/config/cache.ts +16 -0
  34. package/fastify/src/config/cookie.ts +15 -0
  35. package/fastify/src/config/cors.ts +12 -0
  36. package/fastify/src/config/database.ts +48 -0
  37. package/fastify/src/config/index.ts +83 -0
  38. package/fastify/src/config/jwt.ts +19 -0
  39. package/fastify/src/config/logging.ts +13 -0
  40. package/fastify/src/config/mail.ts +24 -0
  41. package/fastify/src/config/openapi.ts +36 -0
  42. package/fastify/src/config/queue.ts +30 -0
  43. package/fastify/src/config/rateLimit.ts +17 -0
  44. package/fastify/src/config/realtime.ts +15 -0
  45. package/fastify/src/config/redis.ts +18 -0
  46. package/fastify/src/config/security.ts +44 -0
  47. package/fastify/src/config/session.ts +17 -0
  48. package/fastify/src/config/storage.ts +22 -0
  49. package/fastify/src/config/validate.ts +50 -0
  50. package/fastify/src/database/migrations/sqlite/0000_init.sql +48 -0
  51. package/fastify/src/database/migrations/sqlite/meta/0000_snapshot.json +324 -0
  52. package/fastify/src/database/migrations/sqlite/meta/_journal.json +13 -0
  53. package/fastify/src/database/schema.ts +2 -0
  54. package/fastify/src/env.ts +76 -0
  55. package/fastify/src/framework/cache/cache.ts +114 -0
  56. package/fastify/src/framework/circuit-breaker/cb.ts +88 -0
  57. package/fastify/src/framework/database/app-schema.ts +37 -0
  58. package/fastify/src/framework/database/connection.ts +223 -0
  59. package/fastify/src/framework/database/migrate-hooks.ts +87 -0
  60. package/fastify/src/framework/database/paginate.ts +226 -0
  61. package/fastify/src/framework/database/schema.ts +20 -0
  62. package/fastify/src/framework/database/seed.ts +152 -0
  63. package/fastify/src/framework/events/dispatcher.ts +61 -0
  64. package/fastify/src/framework/facade.ts +96 -0
  65. package/fastify/src/framework/http/app.ts +176 -0
  66. package/fastify/src/framework/http/cors.ts +13 -0
  67. package/fastify/src/framework/http/fastify.d.ts +13 -0
  68. package/fastify/src/framework/http/logger.ts +110 -0
  69. package/fastify/src/framework/http/metrics.ts +22 -0
  70. package/fastify/src/framework/http/openapi.ts +48 -0
  71. package/fastify/src/framework/http/ratelimiter.ts +47 -0
  72. package/fastify/src/framework/http/security.ts +25 -0
  73. package/fastify/src/framework/http/static.ts +83 -0
  74. package/fastify/src/framework/http/validation.ts +49 -0
  75. package/fastify/src/framework/kernel.ts +43 -0
  76. package/fastify/src/framework/maker-cli/db/core.mjs +291 -0
  77. package/fastify/src/framework/maker-cli/db/index.mjs +204 -0
  78. package/fastify/src/framework/maker-cli/deploy/core.mjs +1046 -0
  79. package/fastify/src/framework/maker-cli/deploy/index.mjs +91 -0
  80. package/fastify/src/framework/maker-cli/index.mjs +65 -0
  81. package/fastify/src/framework/maker-cli/middleware/core.mjs +41 -0
  82. package/fastify/src/framework/maker-cli/middleware/index.mjs +17 -0
  83. package/fastify/src/framework/maker-cli/module/core.mjs +1066 -0
  84. package/fastify/src/framework/maker-cli/module/index.mjs +211 -0
  85. package/fastify/src/framework/maker-cli/provider/core.mjs +49 -0
  86. package/fastify/src/framework/maker-cli/provider/index.mjs +12 -0
  87. package/fastify/src/framework/maker-cli/runtime/build-ui.mjs +16 -0
  88. package/fastify/src/framework/maker-cli/runtime/core.mjs +560 -0
  89. package/fastify/src/framework/maker-cli/runtime/index.mjs +120 -0
  90. package/fastify/src/framework/maker-cli/runtime/redis-commander-patch.cjs +20 -0
  91. package/fastify/src/framework/maker-cli/stubs/controller/openapi.ts.stub +74 -0
  92. package/fastify/src/framework/maker-cli/stubs/controller/plain.ts.stub +77 -0
  93. package/fastify/src/framework/maker-cli/stubs/controller/standalone.ts.stub +51 -0
  94. package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.bun.stub +52 -0
  95. package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.pnpm.stub +55 -0
  96. package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.stub +51 -0
  97. package/fastify/src/framework/maker-cli/stubs/deploy/Dockerfile.yarn.stub +55 -0
  98. package/fastify/src/framework/maker-cli/stubs/deploy/README.stub +59 -0
  99. package/fastify/src/framework/maker-cli/stubs/deploy/compose/mysql.server.stub +45 -0
  100. package/fastify/src/framework/maker-cli/stubs/deploy/compose/postgres.server.stub +45 -0
  101. package/fastify/src/framework/maker-cli/stubs/deploy/compose/sqlite.stub +45 -0
  102. package/fastify/src/framework/maker-cli/stubs/deploy/env/mysql.server.stub +68 -0
  103. package/fastify/src/framework/maker-cli/stubs/deploy/env/postgres.server.stub +68 -0
  104. package/fastify/src/framework/maker-cli/stubs/deploy/env/sqlite.stub +67 -0
  105. package/fastify/src/framework/maker-cli/stubs/deploy/scripts/auto-migrate.sh.stub +41 -0
  106. package/fastify/src/framework/maker-cli/stubs/deploy/server/README.stub +78 -0
  107. package/fastify/src/framework/maker-cli/stubs/deploy/server/compose/noredis.stub +120 -0
  108. package/fastify/src/framework/maker-cli/stubs/deploy/server/compose/redis.dev.stub +133 -0
  109. package/fastify/src/framework/maker-cli/stubs/deploy/server/compose/redis.stub +131 -0
  110. package/fastify/src/framework/maker-cli/stubs/deploy/server/env/local.example.stub +11 -0
  111. package/fastify/src/framework/maker-cli/stubs/deploy/server/env/noredis.stub +25 -0
  112. package/fastify/src/framework/maker-cli/stubs/deploy/server/env/redis.stub +25 -0
  113. package/fastify/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/README.stub +16 -0
  114. package/fastify/src/framework/maker-cli/stubs/deploy/server/nginx-vhost/app.example.com.stub +13 -0
  115. package/fastify/src/framework/maker-cli/stubs/deploy/server/pgadmin/servers.stub +14 -0
  116. package/fastify/src/framework/maker-cli/stubs/deploy/server/redis/redis.conf.stub +7 -0
  117. package/fastify/src/framework/maker-cli/stubs/deploy/supervisor/noredis.stub +54 -0
  118. package/fastify/src/framework/maker-cli/stubs/deploy/supervisor/redis.stub +70 -0
  119. package/fastify/src/framework/maker-cli/stubs/deploy/workflow/local.json.stub +25 -0
  120. package/fastify/src/framework/maker-cli/stubs/deploy/workflow/remote.json.stub +24 -0
  121. package/fastify/src/framework/maker-cli/stubs/facade/name.ts.stub +12 -0
  122. package/fastify/src/framework/maker-cli/stubs/helper/name.ts.stub +14 -0
  123. package/fastify/src/framework/maker-cli/stubs/job/name.ts.stub +25 -0
  124. package/fastify/src/framework/maker-cli/stubs/middleware/name.local.ts.stub +15 -0
  125. package/fastify/src/framework/maker-cli/stubs/middleware/name.ts.stub +15 -0
  126. package/fastify/src/framework/maker-cli/stubs/model/name.mysql.ts.stub +10 -0
  127. package/fastify/src/framework/maker-cli/stubs/model/name.postgresql.ts.stub +10 -0
  128. package/fastify/src/framework/maker-cli/stubs/model/name.sqlite.ts.stub +10 -0
  129. package/fastify/src/framework/maker-cli/stubs/notification/controller.ts.stub +79 -0
  130. package/fastify/src/framework/maker-cli/stubs/notification/job.ts.stub +11 -0
  131. package/fastify/src/framework/maker-cli/stubs/notification/model.ts.stub +29 -0
  132. package/fastify/src/framework/maker-cli/stubs/notification/provider.ts.stub +174 -0
  133. package/fastify/src/framework/maker-cli/stubs/notification/route.api.ts.stub +71 -0
  134. package/fastify/src/framework/maker-cli/stubs/notification/route.plain.ts.stub +15 -0
  135. package/fastify/src/framework/maker-cli/stubs/notification/schema.plain.ts.stub +26 -0
  136. package/fastify/src/framework/maker-cli/stubs/notification/schema.ts.stub +26 -0
  137. package/fastify/src/framework/maker-cli/stubs/provider/module-barrel.ts.stub +19 -0
  138. package/fastify/src/framework/maker-cli/stubs/provider/module.ts.stub +21 -0
  139. package/fastify/src/framework/maker-cli/stubs/provider/name.ts.stub +21 -0
  140. package/fastify/src/framework/maker-cli/stubs/route/api.ts.stub +101 -0
  141. package/fastify/src/framework/maker-cli/stubs/route/plain.ts.stub +23 -0
  142. package/fastify/src/framework/maker-cli/stubs/route/standalone.api.ts.stub +120 -0
  143. package/fastify/src/framework/maker-cli/stubs/route/standalone.plain.ts.stub +50 -0
  144. package/fastify/src/framework/maker-cli/stubs/schedule/name.ts.stub +36 -0
  145. package/fastify/src/framework/maker-cli/stubs/schema/name.plain.ts.stub +14 -0
  146. package/fastify/src/framework/maker-cli/stubs/schema/name.ts.stub +33 -0
  147. package/fastify/src/framework/maker-cli/stubs/seeder/name.ts.stub +18 -0
  148. package/fastify/src/framework/maker-cli/stubs/seeder/standalone.ts.stub +22 -0
  149. package/fastify/src/framework/maker-cli/stubs/service/name.plain.ts.stub +67 -0
  150. package/fastify/src/framework/maker-cli/stubs/service/name.ts.stub +65 -0
  151. package/fastify/src/framework/maker-cli/stubs/test/unit.ts.stub +22 -0
  152. package/fastify/src/framework/maker-cli/stubs/type/name.ts.stub +22 -0
  153. package/fastify/src/framework/maker-cli/utils/env-config.mjs +44 -0
  154. package/fastify/src/framework/maker-cli/utils/env-db.mjs +61 -0
  155. package/fastify/src/framework/maker-cli/utils/file-ops.mjs +30 -0
  156. package/fastify/src/framework/maker-cli/utils/flags.mjs +14 -0
  157. package/fastify/src/framework/maker-cli/utils/help.mjs +379 -0
  158. package/fastify/src/framework/maker-cli/utils/naming.mjs +119 -0
  159. package/fastify/src/framework/maker-cli/utils/process.mjs +52 -0
  160. package/fastify/src/framework/maker-cli/utils/project-commands.mjs +201 -0
  161. package/fastify/src/framework/modules/discover.ts +57 -0
  162. package/fastify/src/framework/modules/routes.ts +31 -0
  163. package/fastify/src/framework/notification/channels/broadcast.ts +15 -0
  164. package/fastify/src/framework/notification/channels/mail.ts +42 -0
  165. package/fastify/src/framework/notification/contracts.ts +29 -0
  166. package/fastify/src/framework/notification/index.ts +59 -0
  167. package/fastify/src/framework/notification/registry.ts +15 -0
  168. package/fastify/src/framework/providers/adapter.ts +149 -0
  169. package/fastify/src/framework/providers/contracts.ts +126 -0
  170. package/fastify/src/framework/providers/loader.ts +105 -0
  171. package/fastify/src/framework/providers/registry.ts +88 -0
  172. package/fastify/src/framework/queue/clear.ts +22 -0
  173. package/fastify/src/framework/queue/queue.ts +401 -0
  174. package/fastify/src/framework/queue/ui.ts +194 -0
  175. package/fastify/src/framework/queue/worker.ts +61 -0
  176. package/fastify/src/framework/realtime/broadcast.ts +70 -0
  177. package/fastify/src/framework/realtime/index.ts +2 -0
  178. package/fastify/src/framework/realtime/socket-cookie.ts +72 -0
  179. package/fastify/src/framework/realtime/socket.ts +149 -0
  180. package/fastify/src/framework/realtime/types.ts +6 -0
  181. package/fastify/src/framework/realtime/ui.ts +16 -0
  182. package/fastify/src/framework/redis/client.ts +148 -0
  183. package/fastify/src/framework/runtime/runtime.ts +23 -0
  184. package/fastify/src/framework/runtime/server-adapter.ts +33 -0
  185. package/fastify/src/framework/scheduler/lock.ts +128 -0
  186. package/fastify/src/framework/scheduler/run.ts +48 -0
  187. package/fastify/src/framework/scheduler/scheduler.ts +155 -0
  188. package/fastify/src/framework/server.ts +162 -0
  189. package/fastify/src/framework/session/session.ts +160 -0
  190. package/fastify/src/framework/storage/storage.ts +744 -0
  191. package/fastify/src/framework/support/cookie.ts +71 -0
  192. package/fastify/src/framework/support/jwt.ts +33 -0
  193. package/fastify/src/framework/support/lifecycle.ts +35 -0
  194. package/fastify/src/framework/support/logger.ts +148 -0
  195. package/fastify/src/framework/support/mail.ts +56 -0
  196. package/fastify/src/framework/support/password.ts +23 -0
  197. package/fastify/src/framework/support/status-codes.ts +75 -0
  198. package/fastify/src/framework/support/upload.ts +181 -0
  199. package/fastify/src/framework/support/url.ts +41 -0
  200. package/fastify/src/middlewares/auth-middleware.ts +134 -0
  201. package/fastify/src/middlewares/role-middleware.ts +19 -0
  202. package/fastify/src/modules/auth/__tests__/forgetpass.test.ts +200 -0
  203. package/fastify/src/modules/auth/__tests__/login.test.ts +171 -0
  204. package/fastify/src/modules/auth/__tests__/logout.test.ts +60 -0
  205. package/fastify/src/modules/auth/__tests__/logoutalldevices.test.ts +49 -0
  206. package/fastify/src/modules/auth/__tests__/me.test.ts +91 -0
  207. package/fastify/src/modules/auth/__tests__/refreshtoken.test.ts +305 -0
  208. package/fastify/src/modules/auth/__tests__/register.test.ts +291 -0
  209. package/fastify/src/modules/auth/__tests__/resetpass.test.ts +206 -0
  210. package/fastify/src/modules/auth/__tests__/verifyemail.test.ts +183 -0
  211. package/fastify/src/modules/auth/controllers/auth.ts +252 -0
  212. package/fastify/src/modules/auth/controllers/role.ts +35 -0
  213. package/fastify/src/modules/auth/database/models/role.ts +14 -0
  214. package/fastify/src/modules/auth/database/models/user.ts +46 -0
  215. package/fastify/src/modules/auth/database/seeders/role.ts +18 -0
  216. package/fastify/src/modules/auth/database/seeders/user.ts +35 -0
  217. package/fastify/src/modules/auth/facade.ts +12 -0
  218. package/fastify/src/modules/auth/helpers/auth.ts +115 -0
  219. package/fastify/src/modules/auth/jobs/forgetpass.ts +20 -0
  220. package/fastify/src/modules/auth/jobs/registeruser.ts +23 -0
  221. package/fastify/src/modules/auth/jobs/verifyemail.ts +18 -0
  222. package/fastify/src/modules/auth/routes/index.ts +185 -0
  223. package/fastify/src/modules/auth/routes/role.ts +56 -0
  224. package/fastify/src/modules/auth/schemas/auth.ts +116 -0
  225. package/fastify/src/modules/auth/services/forgetpassword.ts +66 -0
  226. package/fastify/src/modules/auth/services/login.ts +63 -0
  227. package/fastify/src/modules/auth/services/logout.ts +25 -0
  228. package/fastify/src/modules/auth/services/logoutalldevices.ts +19 -0
  229. package/fastify/src/modules/auth/services/me.ts +31 -0
  230. package/fastify/src/modules/auth/services/refreshtoken.ts +110 -0
  231. package/fastify/src/modules/auth/services/register.ts +141 -0
  232. package/fastify/src/modules/auth/services/resetpassword.ts +69 -0
  233. package/fastify/src/modules/auth/services/verifyemail.ts +77 -0
  234. package/fastify/src/modules/auth/types/auth.ts +31 -0
  235. package/fastify/src/providers/README.md +107 -0
  236. package/fastify/src/providers/notification.ts +4 -0
  237. package/fastify/src/resources/index.html +17 -0
  238. package/fastify/src/resources/src/App.vue +5 -0
  239. package/fastify/src/resources/src/assets/css/styles.css +14761 -0
  240. package/fastify/src/resources/src/assets/css/styles.css.map +1 -0
  241. package/fastify/src/resources/src/assets/fonts/public-sans/public-sans-latin-ext.woff2 +0 -0
  242. package/fastify/src/resources/src/assets/fonts/public-sans/public-sans-latin.woff2 +0 -0
  243. package/fastify/src/resources/src/assets/images/favicon/favicon.ico +0 -0
  244. package/fastify/src/resources/src/assets/images/logo.png +0 -0
  245. package/fastify/src/resources/src/assets/scss/custom.css +217 -0
  246. package/fastify/src/resources/src/assets/scss/custom.css.map +1 -0
  247. package/fastify/src/resources/src/assets/scss/custom.scss +1346 -0
  248. package/fastify/src/resources/src/components/Button.vue +32 -0
  249. package/fastify/src/resources/src/components/Checkbox.vue +32 -0
  250. package/fastify/src/resources/src/components/Datepicker.vue +106 -0
  251. package/fastify/src/resources/src/components/FeatureButton.vue +53 -0
  252. package/fastify/src/resources/src/components/FloatButton.vue +33 -0
  253. package/fastify/src/resources/src/components/Href.vue +32 -0
  254. package/fastify/src/resources/src/components/Input.vue +243 -0
  255. package/fastify/src/resources/src/components/InputGroup.vue +147 -0
  256. package/fastify/src/resources/src/components/InputPasswordToggle.vue +229 -0
  257. package/fastify/src/resources/src/components/Modal.vue +71 -0
  258. package/fastify/src/resources/src/components/Pagebar.vue +26 -0
  259. package/fastify/src/resources/src/components/Refresh.vue +19 -0
  260. package/fastify/src/resources/src/components/Select.vue +384 -0
  261. package/fastify/src/resources/src/components/Spinner.vue +42 -0
  262. package/fastify/src/resources/src/components/Switch.vue +60 -0
  263. package/fastify/src/resources/src/components/TextArea.vue +117 -0
  264. package/fastify/src/resources/src/components/Toast.vue +56 -0
  265. package/fastify/src/resources/src/components/datatable/DataTableSkeleton.vue +98 -0
  266. package/fastify/src/resources/src/components/datatable/Pagination.vue +147 -0
  267. package/fastify/src/resources/src/components/datatable/SelectOpption.vue +64 -0
  268. package/fastify/src/resources/src/components/datatable/index.vue +199 -0
  269. package/fastify/src/resources/src/composables/useAuth.ts +52 -0
  270. package/fastify/src/resources/src/helpers/assets.ts +51 -0
  271. package/fastify/src/resources/src/helpers/nformatter.ts +10 -0
  272. package/fastify/src/resources/src/helpers/utils.ts +75 -0
  273. package/fastify/src/resources/src/layouts/AuthLayout.vue +20 -0
  274. package/fastify/src/resources/src/layouts/Layout/Footer.vue +23 -0
  275. package/fastify/src/resources/src/layouts/Layout/Header.vue +124 -0
  276. package/fastify/src/resources/src/layouts/Layout/Sidebar.vue +137 -0
  277. package/fastify/src/resources/src/layouts/Layout/index.vue +87 -0
  278. package/fastify/src/resources/src/main.ts +28 -0
  279. package/fastify/src/resources/src/pages/auth/forgetPassword.vue +76 -0
  280. package/fastify/src/resources/src/pages/auth/login.vue +96 -0
  281. package/fastify/src/resources/src/pages/auth/register.vue +129 -0
  282. package/fastify/src/resources/src/pages/auth/resetPassword.vue +110 -0
  283. package/fastify/src/resources/src/pages/auth/verifyEmail.vue +64 -0
  284. package/fastify/src/resources/src/pages/dashboard/index.vue +66 -0
  285. package/fastify/src/resources/src/plugins/axios.ts +31 -0
  286. package/fastify/src/resources/src/plugins/browserDetect.ts +55 -0
  287. package/fastify/src/resources/src/plugins/dialog.ts +216 -0
  288. package/fastify/src/resources/src/plugins/gum.ts +683 -0
  289. package/fastify/src/resources/src/plugins/pulse.ts +157 -0
  290. package/fastify/src/resources/src/plugins/routeProgress.ts +87 -0
  291. package/fastify/src/resources/src/router/index.ts +85 -0
  292. package/fastify/src/resources/src/stores/admin-ui.ts +148 -0
  293. package/fastify/src/resources/src/stores/auth.ts +187 -0
  294. package/fastify/src/resources/tsconfig.json +19 -0
  295. package/fastify/src/resources/vite.config.ts +64 -0
  296. package/fastify/src/storage/app/private/.gitkeep +0 -0
  297. package/fastify/src/storage/app/public/.gitkeep +0 -0
  298. package/fastify/src/storage/app/tmp/generated/.gitkeep +0 -0
  299. package/fastify/src/storage/database/nexwire.sqlite +0 -0
  300. package/fastify/src/storage/logs/.gitkeep +0 -0
  301. package/fastify/src/storage/logs/app.log +0 -0
  302. package/fastify/src/storage/logs/fatal.log +0 -0
  303. package/fastify/src/storage/tmp/.gitkeep +0 -0
  304. package/fastify/src/storage/trash/modules/.gitkeep +0 -0
  305. package/fastify/src/types/global.d.ts +32 -0
  306. package/fastify/tsconfig.json +19 -0
  307. package/fastify/vitest.config.ts +38 -0
  308. package/hono/src/framework/facade.ts +1 -0
  309. package/hono/src/framework/http/logger.ts +86 -81
  310. package/hono/src/framework/maker-cli/runtime/core.mjs +1 -2
  311. package/hono/src/framework/notification/channels/mail.ts +8 -6
  312. package/hono/src/middlewares/auth-middleware.ts +1 -2
  313. package/hono/src/middlewares/role-middleware.ts +3 -13
  314. package/hono/src/modules/auth/routes/index.ts +1 -2
  315. package/hono/src/providers/notification.ts +2 -2
  316. package/hono/src/resources/src/components/Switch.vue +60 -65
  317. package/hono/src/resources/src/pages/auth/forgetPassword.vue +23 -29
  318. package/hono/src/resources/src/pages/auth/login.vue +26 -29
  319. package/hono/src/resources/src/pages/auth/register.vue +36 -40
  320. package/hono/src/resources/src/pages/auth/resetPassword.vue +29 -37
  321. package/hono/src/resources/src/pages/auth/verifyEmail.vue +15 -19
  322. package/hono/src/resources/src/plugins/gum.ts +519 -203
  323. package/hono/src/resources/src/stores/auth.ts +9 -6
  324. package/hono/src/storage/database/nexwire.sqlite +0 -0
  325. package/package.json +3 -2
  326. package/src/index.js +11 -8
@@ -0,0 +1,98 @@
1
+ <template>
2
+ <div class="skeleton card border">
3
+ <div class="card-header border-bottom-0 pb-0 px-2 px-sm-3">
4
+ <div class="row align-items-center">
5
+ <div class="col-12 col-sm-6 col-lg-3 col-xl-3 mb-2 mb-lg-0 d-flex">
6
+ <div class="py-2 rounded-1 border bg-custom ps-3 me-2"></div>
7
+ <div class="form-control py-2 bg-custom"></div>
8
+ </div>
9
+ <div class="col-12 col-sm-6 col-lg-4 col-xl-5 mb-2 mb-lg-0">
10
+ <slot name="extra-option"></slot>
11
+ </div>
12
+ <div class="col-12 col-lg-5 col-xl-4">
13
+ <div class="row gx-1">
14
+ <div class="col-2 col-sm-4 col-md-6 col-lg-2 text-start text-lg-end">
15
+ <span class="form-control py-2 bg-custom"></span>
16
+ </div>
17
+ <div class="mb-2 mb-sm-0 text-start col-6 col-sm-6 col-md-4 col-lg-7">
18
+ <span class="form-control py-2 bg-custom"></span>
19
+ </div>
20
+ <div class="col-4 col-sm-2 col-md-2 col-lg-3 text-end">
21
+ <span class="bg-custom form-control py-2"></span>
22
+ </div>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ <div class="card-body py-3 px-2 px-sm-3">
28
+ <div class="table-responsive rounded-1">
29
+ <table class="table table-bordered table-striped table-sm align-middle m-0">
30
+ <thead>
31
+ <tr>
32
+ <th v-for="dt in colCount" :key="`h-${dt}`" class="bg-custom py-2"></th>
33
+ </tr>
34
+ </thead>
35
+ <tbody>
36
+ <tr v-for="r in rowCount" :key="`r-${r}`">
37
+ <td v-for="c in colCount" :key="`c-${r}-${c}`" class="bg-custom py-2"></td>
38
+ </tr>
39
+ </tbody>
40
+ </table>
41
+ </div>
42
+ </div>
43
+ <div class="card-footer border-top-0 pt-0 px-2 px-sm-3">
44
+ <div class="row align-items-center">
45
+ <div class="col-12 col-md-5 mb-2 mb-md-0"></div>
46
+ <div class="col-12 col-md-7 text-center text-md-end">
47
+ <span class="form-control bg-custom py-2"></span>
48
+ </div>
49
+ </div>
50
+ </div>
51
+ </div>
52
+ </template>
53
+
54
+ <script setup lang="ts">
55
+ import { computed, useAttrs } from "vue";
56
+
57
+ defineOptions({ inheritAttrs: false });
58
+
59
+ const $attrs = useAttrs();
60
+ const colCount = computed(() => Number($attrs.col ?? 1));
61
+ const rowCount = computed(() => Number($attrs.row ?? 1));
62
+ </script>
63
+
64
+ <style lang="scss" scoped>
65
+ table,
66
+ tr,
67
+ th,
68
+ td {
69
+ border-color: #cccccc;
70
+ animation: anim 3s infinite;
71
+ }
72
+
73
+ .bg-custom {
74
+ animation: anim 3s infinite;
75
+ }
76
+
77
+ @keyframes anim {
78
+ 0% {
79
+ background-color: #efefef;
80
+ }
81
+
82
+ 25% {
83
+ background-color: #f8f8f8;
84
+ }
85
+
86
+ 50% {
87
+ background-color: #efefef;
88
+ }
89
+
90
+ 75% {
91
+ background-color: #f8f8f8;
92
+ }
93
+
94
+ 100% {
95
+ background-color: #efefef;
96
+ }
97
+ }
98
+ </style>
@@ -0,0 +1,147 @@
1
+ <template>
2
+ <div class="row">
3
+ <div class="col-12 col-md-6 mb-3 mb-md-0">
4
+ <div class="py-2 text-black-50 text-center text-md-start">
5
+ Showing {{ page.from }} to {{ page.to }} of {{ nFormatter(page.total) }} entries
6
+ </div>
7
+ </div>
8
+ <div class="col-12 col-md-6">
9
+ <nav :class="['datatable-pagination', `pagination-${variant}`]" aria-label="Page navigation">
10
+ <ul class="pagination justify-content-center justify-content-md-end">
11
+ <!-- First -->
12
+ <li :class="['page-item', { disabled: noPreviousPage }]">
13
+ <button type="button" class="page-link" :aria-disabled="noPreviousPage ? 'true' : 'false'"
14
+ :tabindex="noPreviousPage ? -1 : 0" @click.prevent="!noPreviousPage && loadPage(1)">
15
+ <i class="bi bi-chevron-double-left"></i>
16
+ </button>
17
+ </li>
18
+
19
+ <!-- Prev -->
20
+ <li :class="['page-item', { disabled: noPreviousPage }]">
21
+ <button type="button" class="page-link" :aria-disabled="noPreviousPage ? 'true' : 'false'"
22
+ :tabindex="noPreviousPage ? -1 : 0"
23
+ @click.prevent="!noPreviousPage && loadPage(props.data.current_page - 1)">
24
+ <i class="bi bi-chevron-left"></i>
25
+ </button>
26
+ </li>
27
+
28
+ <li class="page-item">
29
+ <div class="input-group input-group-sm">
30
+ <Input v-model="page.page" type="text" category="number" topclass="m-0" class="text-center"
31
+ style="width: 100px" @keyup.enter="loadPage(page.page)" />
32
+ </div>
33
+ </li>
34
+
35
+ <li class="page-item">
36
+ <span class="page-link text-nowrap"> of {{ nFormatter(props.data.last_page) }} </span>
37
+ </li>
38
+
39
+ <!-- Next -->
40
+ <li :class="['page-item', { disabled: noNextPage }]">
41
+ <button type="button" class="page-link" :aria-disabled="noNextPage ? 'true' : 'false'"
42
+ :tabindex="noNextPage ? -1 : 0" @click.prevent="!noNextPage && loadPage(props.data.current_page + 1)">
43
+ <i class="bi bi-chevron-right"></i>
44
+ </button>
45
+ </li>
46
+
47
+ <!-- Last -->
48
+ <li :class="['page-item', { disabled: noNextPage }]">
49
+ <button type="button" class="page-link" :aria-disabled="noNextPage ? 'true' : 'false'"
50
+ :tabindex="noNextPage ? -1 : 0" @click.prevent="!noNextPage && loadPage(props.data.last_page)">
51
+ <i class="bi bi-chevron-double-right"></i>
52
+ </button>
53
+ </li>
54
+ </ul>
55
+ </nav>
56
+ </div>
57
+ </div>
58
+ </template>
59
+
60
+ <script setup lang="ts">
61
+ import { computed, reactive, watchEffect } from "vue";
62
+ import { useRoute } from "vue-router";
63
+ import Input from "@/components/Input.vue";
64
+ import { formatCompactNumber } from "@/helpers/nformatter";
65
+ import { useGum } from "@/plugins/gum";
66
+
67
+ interface PaginationData {
68
+ current_page: number;
69
+ last_page: number;
70
+ per_page: number;
71
+ total: number;
72
+ path: string;
73
+ }
74
+
75
+ interface PaginationProps {
76
+ data: PaginationData;
77
+ selectedoption?: string | number;
78
+ search?: string;
79
+ variant?: string;
80
+ }
81
+
82
+ const props = withDefaults(defineProps<PaginationProps>(), {
83
+ search: "",
84
+ variant: "dark"
85
+ });
86
+
87
+ const gum = useGum();
88
+ const route = useRoute();
89
+
90
+ const page = reactive({ page: 1, from: 0, to: 0, total: 0 });
91
+
92
+ const noPreviousPage = computed(() => props.data.current_page - 1 <= 0);
93
+ const noNextPage = computed(() => props.data.current_page + 1 > props.data.last_page);
94
+
95
+ const loadPage = (pageNo: string | number) => {
96
+ let p = parseInt(String(pageNo), 10);
97
+
98
+ // fallback if NaN
99
+ if (Number.isNaN(p)) p = props.data.current_page;
100
+
101
+ const last = Number(props.data.last_page) || 1;
102
+
103
+ // clamp between 1 and last
104
+ if (p < 1) p = 1;
105
+ if (p > last) p = last;
106
+
107
+ return gum.get(props.data.path, {
108
+ query: { page: p, size: props.selectedoption, search: props.search },
109
+ routePath: route.path,
110
+ preserveState: true,
111
+ preserveScroll: true,
112
+ skipFetch: true
113
+ });
114
+ };
115
+
116
+ const nFormatter = formatCompactNumber;
117
+
118
+ watchEffect(() => {
119
+ // "Showing {$from} to {$to} of {$total} entries"
120
+ page.page = props.data.current_page;
121
+ page.from = (props.data.current_page - 1) * props.data.per_page + 1;
122
+ page.to = Math.min(props.data.current_page * props.data.per_page, props.data.total);
123
+ page.total = props.data.total;
124
+ });
125
+ </script>
126
+
127
+ <style lang="scss" scoped>
128
+ ul.pagination {
129
+ margin: 0;
130
+
131
+ :deep(.page-item.disabled .page-link),
132
+ :deep(.page-link:disabled),
133
+ :deep(.page-link[aria-disabled="true"]) {
134
+ pointer-events: none;
135
+ cursor: not-allowed;
136
+ opacity: 0.5;
137
+ }
138
+
139
+ .page-link {
140
+ border-radius: 5px !important;
141
+ margin-left: 0;
142
+ border-color: #cdcdcd !important;
143
+ color: inherit;
144
+ box-shadow: none;
145
+ }
146
+ }
147
+ </style>
@@ -0,0 +1,64 @@
1
+ <template>
2
+ <div class="d-flex align-items-center justify-content-center justify-content-md-start mb-2 mb-md-0" :class="{ 'd-none': !props.isOptions }">
3
+ Show
4
+ <select
5
+ v-model="selectedoption"
6
+ class="form-select shadow-none w-auto mx-2"
7
+ @change="selectOption">
8
+ <option v-for="(val, i) in props.option" :key="i" :value="val">{{ val }}</option>
9
+ </select>
10
+ entries
11
+ </div>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { ref, watch } from "vue";
16
+ import { useRoute } from "vue-router";
17
+ import { useGum } from "@/plugins/gum";
18
+
19
+ interface DataPage {
20
+ path: string;
21
+ current_page: number;
22
+ }
23
+
24
+ interface SelectOptionProps {
25
+ data: DataPage;
26
+ search?: string;
27
+ isOptions?: boolean;
28
+ option?: Array<string | number>;
29
+ selectedoption?: string | number;
30
+ }
31
+
32
+ const props = withDefaults(defineProps<SelectOptionProps>(), {
33
+ search: "",
34
+ isOptions: true,
35
+ option: () => []
36
+ });
37
+ const gum = useGum();
38
+ const route = useRoute();
39
+
40
+ // select option and pass SelectOption component
41
+ const selectedoption = ref<string | number | undefined>(props.selectedoption);
42
+
43
+ watch(
44
+ () => props.selectedoption,
45
+ (value) => {
46
+ selectedoption.value = value;
47
+ }
48
+ );
49
+
50
+ const selectOption = (e: Event) => {
51
+ const target = e.target as HTMLSelectElement;
52
+ selectedoption.value = target.value;
53
+
54
+ return gum.get(props.data.path, {
55
+ query: { page: props.data.current_page, size: selectedoption.value, search: props.search },
56
+ routePath: route.path,
57
+ preserveState: true,
58
+ preserveScroll: true,
59
+ skipFetch: true
60
+ });
61
+ };
62
+ </script>
63
+
64
+ <style lang="scss" scoped></style>
@@ -0,0 +1,199 @@
1
+ <template>
2
+ <div class="card border">
3
+ <div class="card-header" :class="{ 'd-none': !(props.removable || props.searchable || props.optionable) }">
4
+ <div class="row align-items-center gx-1">
5
+ <div class="col-12 col-md-3">
6
+ <SelectOption :is-options="props.optionable" :option="props.option" :data="dataForOption"
7
+ :selectedoption="selectedoption" :search="searchdata" />
8
+ </div>
9
+ <div class="col-12 col-md-9">
10
+ <slot name="extra-tools"></slot>
11
+ <div class="d-flex align-items-center justify-content-center justify-content-md-end">
12
+ <div v-if="checked.checkcolumn.length > 0" class="me-1" :class="{ 'd-none': !props.removable }">
13
+ <Button type="button" class="btn btn-outline-danger" @click.prevent="remove">
14
+ <i class="bi bi-trash"></i>
15
+ </Button>
16
+ </div>
17
+ <div class="d-flex align-items-center" :class="{ 'd-none': !props.searchable }">
18
+ <Button class="btn btn-outline-secondary rounded-0 rounded-start" type="button" @click="searchMe">
19
+ <i class="bi bi-search"></i>
20
+ </Button>
21
+ <Input v-model="searchdata" type="text" class="w-auto rounded-0 rounded-end" topclass="mb-0"
22
+ placeholder="Search..." @keyup.enter="searchMe" @keyup.delete="searchMe" />
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ <div class="card-body">
29
+ <slot name="extra"></slot>
30
+ <div class="table-responsive">
31
+ <table
32
+ class="table table-bordered table-striped border-custom table-sm align-middle m-0 datatable no-shrink-table">
33
+ <slot name="customhead"></slot>
34
+ <thead :class="{ 'd-none': slots.customhead }">
35
+ <tr>
36
+ <th class="align-middle" :class="{ 'd-none': !props.removable || !props.data.current_page }">
37
+ <Checkbox v-model="checked.check" topclass="ms-2" :value="checked.check" :disabled="props.disabled"
38
+ @click="checkAll" />
39
+ </th>
40
+ <th class="text-center align-middle" :class="{ 'd-none': !props.countable }">#</th>
41
+ <slot name="thead"></slot>
42
+ </tr>
43
+ </thead>
44
+
45
+ <slot name="custombody"></slot>
46
+ <tbody :class="{ 'd-none': slots.custombody }">
47
+ <tr v-for="(dt, i) in tableRows" :key="`${dt.id}-${i}`">
48
+ <td class="align-middle" :class="{ 'd-none': !props.removable || !props.data.current_page }">
49
+ <Checkbox v-model="checked.checkcolumn" topclass="ms-2" :value="dt.id" :disabled="props.disabled"
50
+ @change="updateChecked" />
51
+ </td>
52
+ <td class="text-center align-middle" :class="{ 'd-none': !props.countable }">
53
+ {{
54
+ props.data.current_page
55
+ ? props.data.per_page * (props.data.current_page - 1) + (i + 1)
56
+ : i + 1
57
+ }}
58
+ </td>
59
+ <slot name="tbody" :td="dt"></slot>
60
+ </tr>
61
+ </tbody>
62
+ </table>
63
+ </div>
64
+ </div>
65
+ <div class="card-footer" :class="{ 'd-none': props.data.total <= props.data.data?.length }">
66
+ <Pagination :data="props.data" :selectedoption="selectedoption" :search="searchdata" />
67
+ </div>
68
+ </div>
69
+ </template>
70
+
71
+ <script setup lang="ts">
72
+ import { debounce } from "lodash-es";
73
+ import { computed, reactive, ref, useSlots, watchEffect } from "vue";
74
+ import { useRoute } from "vue-router";
75
+ import Button from "@/components/Button.vue";
76
+ import Checkbox from "@/components/Checkbox.vue";
77
+ import Input from "@/components/Input.vue";
78
+ import { useGum } from "@/plugins/gum";
79
+ import Pagination from "./Pagination.vue";
80
+ import SelectOption from "./SelectOpption.vue";
81
+
82
+ interface DataRow {
83
+ id: string | number;
84
+ [key: string]: any;
85
+ }
86
+
87
+ interface DataPage {
88
+ path: string;
89
+ current_page: number;
90
+ }
91
+
92
+ interface DataTableProps {
93
+ data: any;
94
+ search?: string;
95
+ loop?: DataRow[] | false;
96
+ option?: Array<string | number>;
97
+ removable?: boolean;
98
+ countable?: boolean;
99
+ searchable?: boolean;
100
+ optionable?: boolean;
101
+ disabled?: boolean;
102
+ }
103
+
104
+ const props = withDefaults(defineProps<DataTableProps>(), {
105
+ search: "",
106
+ option: () => [],
107
+ removable: true,
108
+ countable: true,
109
+ searchable: true,
110
+ optionable: true,
111
+ disabled: false
112
+ });
113
+ const gum = useGum();
114
+ const route = useRoute();
115
+
116
+ const slots = useSlots();
117
+
118
+ const emit = defineEmits<(event: "remove", value: Array<string | number>) => void>();
119
+
120
+ // checkbox select
121
+ let checked = reactive<{ check: boolean; checkcolumn: Array<string | number> }>({
122
+ check: false,
123
+ checkcolumn: []
124
+ });
125
+ const checkAll = () => {
126
+ if (!checked.check) {
127
+ props.data.data.forEach((dt: DataRow) => {
128
+ if (!checked.checkcolumn.includes(dt.id)) {
129
+ checked.checkcolumn.push(dt.id);
130
+ }
131
+ });
132
+ } else {
133
+ checked.checkcolumn = [];
134
+ }
135
+ };
136
+ const updateChecked = () => (checked.checkcolumn.length === props.data.data.length ? (checked.check = true) : (checked.check = false));
137
+
138
+ // remove from parent
139
+ const remove = () => {
140
+ emit("remove", checked.checkcolumn);
141
+ checked.check = false;
142
+ };
143
+
144
+ // for change data size show
145
+ const selectedoption = ref<string | number | undefined>(undefined);
146
+ const dataForOption = computed<DataPage>(() => ({
147
+ path: props.data.path,
148
+ current_page: props.data.current_page
149
+ }));
150
+ const tableRows = computed<DataRow[]>(() => (props.loop ? props.loop : props.data.data));
151
+
152
+ // search data
153
+ const searchdata = ref(props.search || "");
154
+ const searchMe = debounce(() => {
155
+ const isSearching = !!searchdata.value && searchdata.value.trim() !== "";
156
+ gum.get(props.data.path, {
157
+ query: {
158
+ page: isSearching ? 1 : props.data.current_page,
159
+ size: selectedoption.value,
160
+ search: searchdata.value
161
+ },
162
+ routePath: route.path,
163
+ preserveState: true,
164
+ preserveScroll: true,
165
+ skipFetch: true
166
+ });
167
+ }, 500);
168
+
169
+ // watch instantce
170
+ watchEffect(() => {
171
+ selectedoption.value = props.option.find((x) => Number(x) === Number(props.data.per_page));
172
+ searchdata.value = props.search || "";
173
+ });
174
+ </script>
175
+
176
+ <style lang="scss" scoped>
177
+ .border-custom {
178
+ border-color: #cccccc !important;
179
+ }
180
+
181
+ .no-shrink-table th,
182
+ .no-shrink-table td {
183
+ white-space: nowrap;
184
+ }
185
+
186
+ /* By default (large screens and up) do not force a min-width:
187
+ allow table to size normally so no horizontal scrollbar on large screens */
188
+ @media (min-width: 992px) {
189
+ .no-shrink-table {
190
+ min-width: 0;
191
+ }
192
+ }
193
+
194
+ @media (max-width: 991.98px) {
195
+ .no-shrink-table {
196
+ min-width: 1000px;
197
+ }
198
+ }
199
+ </style>
@@ -0,0 +1,52 @@
1
+ import { computed, type Ref, readonly, ref } from "vue";
2
+
3
+ type UnknownRecord = Record<string, unknown>;
4
+
5
+ export type RoleLike = {
6
+ id?: string | number;
7
+ name?: string;
8
+ title?: string;
9
+ slug?: string;
10
+ } & UnknownRecord;
11
+
12
+ export type AuthUser = UnknownRecord & {
13
+ id?: string | number;
14
+ name?: string;
15
+ role?: RoleLike | null;
16
+ roles?: RoleLike[] | null;
17
+ };
18
+
19
+ const userRef: Ref<AuthUser | null> = ref(null);
20
+
21
+ export function setUser(user: AuthUser | null) {
22
+ userRef.value = user;
23
+ }
24
+
25
+ export function clearUser() {
26
+ userRef.value = null;
27
+ }
28
+
29
+ export function useAuth() {
30
+ return {
31
+ user: readonly(userRef),
32
+ isAuthenticated: computed(() => !!userRef.value),
33
+ setUser,
34
+ clearUser
35
+ };
36
+ }
37
+
38
+ export const authUser = computed<AuthUser>(() => userRef.value ?? {});
39
+
40
+ export function hasRole(...wanted: string[]): boolean {
41
+ const subject = userRef.value;
42
+ if (!subject) return false;
43
+
44
+ const current = (subject.roles ?? (subject.role ? [subject.role] : []))
45
+ .map((item) => (item.name || item.title || item.slug || "").toLowerCase().trim())
46
+ .filter(Boolean);
47
+
48
+ if (!wanted.length) return current.length > 0;
49
+
50
+ const expected = wanted.map((item) => item.toLowerCase().trim()).filter(Boolean);
51
+ return current.some((item) => expected.includes(item));
52
+ }
@@ -0,0 +1,51 @@
1
+ // src/helpers/assets.ts
2
+
3
+ // 1. Eagerly load ALL images in the entire src folder.
4
+ // This tells Vite: "Find every image, hash it, and give me the final URL."
5
+ const allImages = import.meta.glob("/src/**/*.{png,jpg,jpeg,svg,webp,gif}", {
6
+ eager: true,
7
+ import: "default"
8
+ });
9
+
10
+ /**
11
+ * Resolves ANY image path (using @, relative, or absolute) for both dev and prod.
12
+ */
13
+ export default function asset(path: string): string {
14
+ // 1. If it's already a full URL or data URI, return it as is.
15
+ if (path.startsWith("http") || path.startsWith("data:")) {
16
+ return path;
17
+ }
18
+
19
+ // 2. Normalize the path.
20
+ // Vite's glob keys always start from the root, like "/src/assets/..."
21
+ let cleanPath = path;
22
+
23
+ // Convert alias `@/` to `/src/`
24
+ if (cleanPath.startsWith("@/")) {
25
+ cleanPath = cleanPath.replace("@/", "/src/");
26
+ }
27
+ // Convert absolute `/` to `/src/` (assuming you mean inside src)
28
+ else if (cleanPath.startsWith("/") && !cleanPath.startsWith("/src/")) {
29
+ cleanPath = `/src${cleanPath}`;
30
+ }
31
+ // Convert relative `../../` (This is the tricky part)
32
+ else if (cleanPath.startsWith("../")) {
33
+ // We can't easily resolve `../../` from a utility file, so we just
34
+ // try to find a matching suffix in the glob keys.
35
+ // (e.g., if you pass "../../assets/foo.png", we look for "assets/foo.png" inside /src)
36
+ const match = Object.keys(allImages).find((key) => key.endsWith(cleanPath.replace(/^(\.\.\/)+/, "")));
37
+ if (match) {
38
+ return allImages[match] as string;
39
+ }
40
+ }
41
+
42
+ // 3. Look up the normalized path in the glob object
43
+ const resolved = allImages[cleanPath] as string | undefined;
44
+
45
+ if (!resolved) {
46
+ console.warn(`[getAssetUrl] Image not found: ${path}. Returning original path.`);
47
+ return path;
48
+ }
49
+
50
+ return resolved;
51
+ }
@@ -0,0 +1,10 @@
1
+ const compactFormatter = new Intl.NumberFormat("en", {
2
+ notation: "compact",
3
+ maximumFractionDigits: 1
4
+ });
5
+
6
+ export function formatCompactNumber(value: number): string | number {
7
+ if (!Number.isFinite(value)) return String(value);
8
+ if (Math.abs(value) < 1000) return value;
9
+ return compactFormatter.format(value).replace(/\s/g, "");
10
+ }