@paralect/hive 0.1.50-alpha.2 → 0.1.50

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 (291) hide show
  1. package/.claude/settings.local.json +13 -0
  2. package/cli/helpers/execCommand.js +10 -10
  3. package/cli/helpers/isProjectInit.js +3 -3
  4. package/cli/helpers/mergeDirs.js +1 -1
  5. package/cli/hive.js +105 -105
  6. package/{test-app → framework}/.cursor/commands/add-service.md +6 -6
  7. package/{test-app → framework}/.cursor/skills/hive-overview/SKILL.md +1 -1
  8. package/{test-app → framework}/.cursor/skills/hive-service/SKILL.md +2 -2
  9. package/framework/bin/start.sh +2 -0
  10. package/{.hive/bootstrap-hive.js → framework/bootstrap-hive.ts} +4 -4
  11. package/{.hive → framework}/package-lock.json +212 -156
  12. package/framework/package.json +42 -0
  13. package/{.hive/src/app.js → framework/src/app.ts} +1 -1
  14. package/{.hive/src/bullMqBus.js → framework/src/bullMqBus.ts} +1 -1
  15. package/{.hive/src/bullMqWrapper.js → framework/src/bullMqWrapper.ts} +1 -1
  16. package/{.hive/src/app-config/index.js → framework/src/config/index.ts} +7 -7
  17. package/{.hive/src/db.js → framework/src/db.ts} +21 -6
  18. package/framework/src/endpoint.ts +132 -0
  19. package/framework/src/helpers/generateDbTypes.ts +47 -0
  20. package/{.hive/src/helpers/getMiddlewares.js → framework/src/helpers/getMiddlewares.ts} +1 -1
  21. package/{.hive/src/helpers/getResourceEndpoints.js → framework/src/helpers/getResourceEndpoints.ts} +8 -8
  22. package/{.hive/src/helpers/getResources.js → framework/src/helpers/getResources.ts} +1 -1
  23. package/{.hive/src/helpers/getSchemas.js → framework/src/helpers/getSchemas.ts} +13 -13
  24. package/framework/src/index.ts +3 -0
  25. package/{.hive/src/ioEmitter.js → framework/src/ioEmitter.ts} +1 -1
  26. package/{.hive/src/lib/node-mongo/src/mongo-query-service.js → framework/src/lib/node-mongo/src/mongo-query-service.ts} +18 -7
  27. package/{.hive/src/lib/node-mongo/src/mongo-service.js → framework/src/lib/node-mongo/src/mongo-service.ts} +17 -9
  28. package/{starter/src/logger.js → framework/src/logger.ts} +4 -3
  29. package/{.hive/src/migrations/migrations-log/migration-log.schema.js → framework/src/migrations/migrations-log/migration-log.schema.ts} +1 -1
  30. package/{.hive/src/migrations/migrations-log/migration-log.service.js → framework/src/migrations/migrations-log/migration-log.service.ts} +1 -1
  31. package/{.hive/src/migrations/migrations.schema.js → framework/src/migrations/migrations.schema.ts} +1 -1
  32. package/{.hive/src/resources/_dev/endpoints/triggerSchedulerHandler.js → framework/src/resources/_dev/endpoints/triggerSchedulerHandler.ts} +2 -1
  33. package/framework/src/resources/health/endpoints/get.ts +14 -0
  34. package/{.hive/src/resources/schemaMappings/schemaMappings.schema.js → framework/src/resources/schemaMappings/schemaMappings.schema.ts} +1 -1
  35. package/{.hive/src/routes/index.js → framework/src/routes/index.ts} +23 -27
  36. package/framework/src/schema.ts +3 -0
  37. package/{.hive/src/services/emailService.js → framework/src/services/emailService.ts} +1 -1
  38. package/{.hive/src/socketIo.js → framework/src/socketIo.ts} +1 -1
  39. package/{.hive → framework}/tsconfig.json +17 -13
  40. package/package.json +43 -51
  41. package/starter/hive/autoMap/schemaMappings.json +1 -0
  42. package/starter/hive/config/.env.example +11 -0
  43. package/starter/hive/config/app.ts +19 -0
  44. package/{.hive/src/services/setCookie.js → starter/hive/helpers/setCookie.ts} +1 -2
  45. package/starter/hive/middlewares/_global.ts +9 -0
  46. package/{.hive/src/middlewares/attachUser.js → starter/hive/middlewares/attachUser.ts} +2 -2
  47. package/{.hive/src/middlewares/shouldExist.js → starter/hive/middlewares/shouldExist.ts} +1 -1
  48. package/{.hive/src/middlewares/shouldNotExist.js → starter/hive/middlewares/shouldNotExist.ts} +1 -1
  49. package/starter/hive/resources/files/endpoints/upload.ts +25 -0
  50. package/starter/hive/resources/files/files.schema.ts +20 -0
  51. package/{.hive/src/resources/tokens/methods/storeToken.js → starter/hive/resources/tokens/methods/storeToken.ts} +3 -3
  52. package/{.hive/src/resources/tokens/tokens.schema.js → starter/hive/resources/tokens/tokens.schema.ts} +1 -2
  53. package/starter/hive/resources/users/endpoints/getCurrentUser.ts +12 -0
  54. package/starter/hive/resources/users/endpoints/getUserProfile.ts +17 -0
  55. package/{.hive/src/resources/users/users.schema.js → starter/hive/resources/users/users.schema.ts} +1 -2
  56. package/starter/hive/services/cloudStorage.ts +102 -0
  57. package/starter/package.json +9 -97
  58. package/starter/tsconfig.json +16 -20
  59. package/.cursor/commands/deslop.md +0 -12
  60. package/.hive/.cursor/commands/add-service.md +0 -188
  61. package/.hive/.cursor/skills/hive-overview/SKILL.md +0 -50
  62. package/.hive/.cursor/skills/hive-service/SKILL.md +0 -90
  63. package/.hive/bin/start.sh +0 -2
  64. package/.hive/package.json +0 -98
  65. package/.hive/src/logger.js +0 -43
  66. package/.hive/src/middlewares/global/tryToAttachUser.js +0 -33
  67. package/.hive/src/resources/health/endpoints/get.js +0 -19
  68. package/.hive/src/resources/tokens/methods/setToken.js +0 -8
  69. package/.hive/src/resources/users/endpoints/getCurrentUser.js +0 -14
  70. package/.hive/src/resources/users/endpoints/getUserProfile.js +0 -19
  71. package/.hive/src/resources/users/methods/ensureUserCreated.js +0 -68
  72. package/.hive/src/security.util.js +0 -38
  73. package/.hive/src/services/globalTest.js +0 -0
  74. package/cli/helpers/docker.js +0 -59
  75. package/cli/helpers/envCheck.js +0 -127
  76. package/cli/helpers/findPort.js +0 -32
  77. package/starter/.babelrc +0 -3
  78. package/starter/.cursor/commands/add-endpoint.md +0 -262
  79. package/starter/.cursor/commands/add-handler.md +0 -137
  80. package/starter/.cursor/commands/add-middleware.md +0 -95
  81. package/starter/.cursor/commands/add-resource.md +0 -71
  82. package/starter/.cursor/commands/add-scheduler.md +0 -138
  83. package/starter/.cursor/commands/add-service.md +0 -188
  84. package/starter/.cursor/skills/hive-auth/SKILL.md +0 -134
  85. package/starter/.cursor/skills/hive-database/SKILL.md +0 -103
  86. package/starter/.cursor/skills/hive-endpoint/SKILL.md +0 -103
  87. package/starter/.cursor/skills/hive-handler/SKILL.md +0 -88
  88. package/starter/.cursor/skills/hive-mapping/SKILL.md +0 -85
  89. package/starter/.cursor/skills/hive-middleware/SKILL.md +0 -104
  90. package/starter/.cursor/skills/hive-overview/SKILL.md +0 -50
  91. package/starter/.cursor/skills/hive-scheduler/SKILL.md +0 -94
  92. package/starter/.cursor/skills/hive-schema/SKILL.md +0 -73
  93. package/starter/.cursor/skills/hive-service/SKILL.md +0 -90
  94. package/starter/.dockerignore +0 -1
  95. package/starter/Dockerfile +0 -22
  96. package/starter/Dockerfile.dev +0 -33
  97. package/starter/Dockerfile.prod +0 -29
  98. package/starter/README.md +0 -11
  99. package/starter/bin/deploy.sh +0 -5
  100. package/starter/bin/start.sh +0 -2
  101. package/starter/bootstrap-hive.js +0 -118
  102. package/starter/deploy/api/Chart.yaml +0 -6
  103. package/starter/deploy/api/staging.yaml +0 -3
  104. package/starter/deploy/api/templates/deployment.yaml +0 -44
  105. package/starter/deploy/api/templates/ingress.yaml +0 -26
  106. package/starter/deploy/api/templates/service.yaml +0 -14
  107. package/starter/deploy/script/Dockerfile +0 -39
  108. package/starter/deploy/script/package-lock.json +0 -1499
  109. package/starter/deploy/script/package.json +0 -12
  110. package/starter/deploy/script/src/config.js +0 -48
  111. package/starter/deploy/script/src/index.js +0 -108
  112. package/starter/deploy/script/src/util.js +0 -19
  113. package/starter/initial-data.json +0 -176
  114. package/starter/loader.mjs +0 -40
  115. package/starter/package-lock.json +0 -13492
  116. package/starter/register.mjs +0 -6
  117. package/starter/ship_logo.png +0 -0
  118. package/starter/src/app-config/app.js +0 -3
  119. package/starter/src/app-config/assertEnv.js +0 -15
  120. package/starter/src/app-config/index.js +0 -65
  121. package/starter/src/app.js +0 -65
  122. package/starter/src/assets/emails/components/header.mjml +0 -13
  123. package/starter/src/assets/emails/dist/.gitkeep +0 -0
  124. package/starter/src/assets/emails/signup-welcome.mjml +0 -34
  125. package/starter/src/assets/emails/styles/index.mjml +0 -77
  126. package/starter/src/autoMap/addHandlers.js +0 -142
  127. package/starter/src/autoMap/getDependentFields.js +0 -37
  128. package/starter/src/autoMap/mapSchema.js +0 -99
  129. package/starter/src/autoMap/schemaMappings.js +0 -13
  130. package/starter/src/autoMap/schemaMappings.json +0 -3
  131. package/starter/src/bullMqBus.js +0 -21
  132. package/starter/src/bullMqWrapper.js +0 -23
  133. package/starter/src/db.js +0 -53
  134. package/starter/src/emails/MyEmailComponent.jsx +0 -14
  135. package/starter/src/emails/compiled/MyEmailComponent.js +0 -18
  136. package/starter/src/emails/compiled/compiled/MyEmailComponent.js +0 -18
  137. package/starter/src/helpers/db/ifUpdated.js +0 -22
  138. package/starter/src/helpers/esm.js +0 -56
  139. package/starter/src/helpers/getMiddlewares.js +0 -41
  140. package/starter/src/helpers/getResourceEndpoints.js +0 -31
  141. package/starter/src/helpers/getResources.js +0 -35
  142. package/starter/src/helpers/getSchemas.js +0 -53
  143. package/starter/src/helpers/importHandlers.js +0 -20
  144. package/starter/src/helpers/isZodArray.js +0 -13
  145. package/starter/src/helpers/prettierFormat.js +0 -8
  146. package/starter/src/helpers/schema/db.schema.js +0 -9
  147. package/starter/src/helpers/schema/pagination.schema.js +0 -14
  148. package/starter/src/ioEmitter.js +0 -9
  149. package/starter/src/jsconfig.json +0 -5
  150. package/starter/src/lib/node-mongo/.github/workflows/npm-publish.yml +0 -32
  151. package/starter/src/lib/node-mongo/API.md +0 -654
  152. package/starter/src/lib/node-mongo/CHANGELOG.md +0 -98
  153. package/starter/src/lib/node-mongo/README.md +0 -97
  154. package/starter/src/lib/node-mongo/package-lock.json +0 -3682
  155. package/starter/src/lib/node-mongo/package.json +0 -74
  156. package/starter/src/lib/node-mongo/src/index.js +0 -64
  157. package/starter/src/lib/node-mongo/src/mongo-query-service.js +0 -78
  158. package/starter/src/lib/node-mongo/src/mongo-service-error.js +0 -15
  159. package/starter/src/lib/node-mongo/src/mongo-service.js +0 -303
  160. package/starter/src/middlewares/attachUser.js +0 -41
  161. package/starter/src/middlewares/global/extractUserTokens.js +0 -15
  162. package/starter/src/middlewares/global/tryToAttachUser.js +0 -33
  163. package/starter/src/middlewares/isAuthorized.js +0 -18
  164. package/starter/src/middlewares/shouldExist.js +0 -37
  165. package/starter/src/middlewares/shouldNotExist.js +0 -19
  166. package/starter/src/middlewares/uploadFile.js +0 -5
  167. package/starter/src/middlewares/validate.js +0 -32
  168. package/starter/src/migrations/migration.js +0 -8
  169. package/starter/src/migrations/migration.service.js +0 -76
  170. package/starter/src/migrations/migrations/1.js +0 -22
  171. package/starter/src/migrations/migrations-log/migration-log.schema.js +0 -13
  172. package/starter/src/migrations/migrations-log/migration-log.service.js +0 -50
  173. package/starter/src/migrations/migrations.schema.js +0 -6
  174. package/starter/src/migrations/migrator.js +0 -75
  175. package/starter/src/migrator.js +0 -3
  176. package/starter/src/resources/_dev/endpoints/triggerSchedulerHandler.js +0 -32
  177. package/starter/src/resources/health/endpoints/get.js +0 -19
  178. package/starter/src/resources/schemaMappings/schemaMappings.schema.js +0 -6
  179. package/starter/src/resources/tokens/methods/generateSecureToken.js +0 -9
  180. package/starter/src/resources/tokens/methods/setToken.js +0 -8
  181. package/starter/src/resources/tokens/methods/storeToken.js +0 -35
  182. package/starter/src/resources/tokens/tokens.schema.js +0 -11
  183. package/starter/src/resources/users/endpoints/getCurrentUser.js +0 -14
  184. package/starter/src/resources/users/endpoints/getUserProfile.js +0 -19
  185. package/starter/src/resources/users/handlers/test.js +0 -1
  186. package/starter/src/resources/users/methods/ensureUserCreated.js +0 -68
  187. package/starter/src/resources/users/users.schema.js +0 -16
  188. package/starter/src/routes/index.js +0 -172
  189. package/starter/src/routes/middlewares/attachCustomErrors.js +0 -28
  190. package/starter/src/routes/middlewares/routeErrorHandler.js +0 -27
  191. package/starter/src/scheduler.js +0 -35
  192. package/starter/src/security.util.js +0 -38
  193. package/starter/src/services/emailService.js +0 -15
  194. package/starter/src/services/globalTest.js +0 -0
  195. package/starter/src/services/setCookie.js +0 -21
  196. package/starter/src/socketIo.js +0 -99
  197. package/test-app/.cursor/commands/add-endpoint.md +0 -262
  198. package/test-app/.cursor/commands/add-handler.md +0 -137
  199. package/test-app/.cursor/commands/add-middleware.md +0 -95
  200. package/test-app/.cursor/commands/add-resource.md +0 -71
  201. package/test-app/.cursor/commands/add-scheduler.md +0 -138
  202. package/test-app/.cursor/skills/hive-auth/SKILL.md +0 -134
  203. package/test-app/.cursor/skills/hive-database/SKILL.md +0 -103
  204. package/test-app/.cursor/skills/hive-endpoint/SKILL.md +0 -103
  205. package/test-app/.cursor/skills/hive-handler/SKILL.md +0 -88
  206. package/test-app/.cursor/skills/hive-mapping/SKILL.md +0 -85
  207. package/test-app/.cursor/skills/hive-middleware/SKILL.md +0 -104
  208. package/test-app/.cursor/skills/hive-scheduler/SKILL.md +0 -94
  209. package/test-app/.cursor/skills/hive-schema/SKILL.md +0 -73
  210. package/test-app/package-lock.json +0 -462
  211. package/test-app/package.json +0 -21
  212. /package/{.hive → framework}/.babelrc +0 -0
  213. /package/{.hive → framework}/.cursor/commands/add-endpoint.md +0 -0
  214. /package/{.hive → framework}/.cursor/commands/add-handler.md +0 -0
  215. /package/{.hive → framework}/.cursor/commands/add-middleware.md +0 -0
  216. /package/{.hive → framework}/.cursor/commands/add-resource.md +0 -0
  217. /package/{.hive → framework}/.cursor/commands/add-scheduler.md +0 -0
  218. /package/{.hive → framework}/.cursor/skills/hive-auth/SKILL.md +0 -0
  219. /package/{.hive → framework}/.cursor/skills/hive-database/SKILL.md +0 -0
  220. /package/{.hive → framework}/.cursor/skills/hive-endpoint/SKILL.md +0 -0
  221. /package/{.hive → framework}/.cursor/skills/hive-handler/SKILL.md +0 -0
  222. /package/{.hive → framework}/.cursor/skills/hive-mapping/SKILL.md +0 -0
  223. /package/{.hive → framework}/.cursor/skills/hive-middleware/SKILL.md +0 -0
  224. /package/{.hive → framework}/.cursor/skills/hive-scheduler/SKILL.md +0 -0
  225. /package/{.hive → framework}/.cursor/skills/hive-schema/SKILL.md +0 -0
  226. /package/{.hive → framework}/.dockerignore +0 -0
  227. /package/{.hive → framework}/Dockerfile +0 -0
  228. /package/{.hive → framework}/Dockerfile.dev +0 -0
  229. /package/{.hive → framework}/Dockerfile.prod +0 -0
  230. /package/{.hive → framework}/README.md +0 -0
  231. /package/{.hive → framework}/bin/deploy.sh +0 -0
  232. /package/{.hive → framework}/deploy/api/Chart.yaml +0 -0
  233. /package/{.hive → framework}/deploy/api/staging.yaml +0 -0
  234. /package/{.hive → framework}/deploy/api/templates/deployment.yaml +0 -0
  235. /package/{.hive → framework}/deploy/api/templates/ingress.yaml +0 -0
  236. /package/{.hive → framework}/deploy/api/templates/service.yaml +0 -0
  237. /package/{.hive → framework}/deploy/script/Dockerfile +0 -0
  238. /package/{.hive → framework}/deploy/script/package-lock.json +0 -0
  239. /package/{.hive → framework}/deploy/script/package.json +0 -0
  240. /package/{.hive/deploy/script/src/config.js → framework/deploy/script/src/config.ts} +0 -0
  241. /package/{.hive/deploy/script/src/index.js → framework/deploy/script/src/index.ts} +0 -0
  242. /package/{.hive/deploy/script/src/util.js → framework/deploy/script/src/util.ts} +0 -0
  243. /package/{.hive → framework}/initial-data.json +0 -0
  244. /package/{.hive → framework}/ship_logo.png +0 -0
  245. /package/{.hive → framework}/src/assets/emails/components/header.mjml +0 -0
  246. /package/{.hive → framework}/src/assets/emails/dist/.gitkeep +0 -0
  247. /package/{.hive → framework}/src/assets/emails/signup-welcome.mjml +0 -0
  248. /package/{.hive → framework}/src/assets/emails/styles/index.mjml +0 -0
  249. /package/{.hive/src/autoMap/addHandlers.js → framework/src/autoMap/addHandlers.ts} +0 -0
  250. /package/{.hive/src/autoMap/getDependentFields.js → framework/src/autoMap/getDependentFields.ts} +0 -0
  251. /package/{.hive/src/autoMap/mapSchema.js → framework/src/autoMap/mapSchema.ts} +0 -0
  252. /package/{.hive → framework}/src/autoMap/schemaMappings.json +0 -0
  253. /package/{.hive/src/autoMap/schemaMappings.js → framework/src/autoMap/schemaMappings.ts} +0 -0
  254. /package/{.hive/src/helpers/schema/db.schema.js → framework/src/common/schema/db.schema.ts} +0 -0
  255. /package/{.hive/src/helpers/schema/pagination.schema.js → framework/src/common/schema/pagination.schema.ts} +0 -0
  256. /package/{.hive/src/app-config/app.js → framework/src/config/app.ts} +0 -0
  257. /package/{.hive/src/app-config/assertEnv.js → framework/src/config/assertEnv.ts} +0 -0
  258. /package/{.hive/src/emails/MyEmailComponent.jsx → framework/src/emails/MyEmailComponent.tsx} +0 -0
  259. /package/{.hive/src/emails/compiled/MyEmailComponent.js → framework/src/emails/compiled/MyEmailComponent.ts} +0 -0
  260. /package/{.hive/src/emails/compiled/compiled/MyEmailComponent.js → framework/src/emails/compiled/compiled/MyEmailComponent.ts} +0 -0
  261. /package/{.hive/src/helpers/db/ifUpdated.js → framework/src/helpers/db/ifUpdated.ts} +0 -0
  262. /package/{.hive/src/helpers/importHandlers.js → framework/src/helpers/importHandlers.ts} +0 -0
  263. /package/{.hive/src/helpers/isZodArray.js → framework/src/helpers/isZodArray.ts} +0 -0
  264. /package/{.hive/src/helpers/prettierFormat.js → framework/src/helpers/prettierFormat.ts} +0 -0
  265. /package/{.hive → framework}/src/jsconfig.json +0 -0
  266. /package/{.hive → framework}/src/lib/node-mongo/.github/workflows/npm-publish.yml +0 -0
  267. /package/{.hive → framework}/src/lib/node-mongo/API.md +0 -0
  268. /package/{.hive → framework}/src/lib/node-mongo/CHANGELOG.md +0 -0
  269. /package/{.hive → framework}/src/lib/node-mongo/README.md +0 -0
  270. /package/{.hive → framework}/src/lib/node-mongo/package-lock.json +0 -0
  271. /package/{.hive → framework}/src/lib/node-mongo/package.json +0 -0
  272. /package/{.hive/src/lib/node-mongo/src/index.js → framework/src/lib/node-mongo/src/index.ts} +0 -0
  273. /package/{.hive/src/lib/node-mongo/src/mongo-service-error.js → framework/src/lib/node-mongo/src/mongo-service-error.ts} +0 -0
  274. /package/{.hive/src/middlewares/allowNoAuth.js → framework/src/middlewares/allowNoAuth.ts} +0 -0
  275. /package/{.hive/src/middlewares/global/extractUserTokens.js → framework/src/middlewares/global/extractUserTokens.ts} +0 -0
  276. /package/{.hive/src/middlewares/validate.js → framework/src/middlewares/validate.ts} +0 -0
  277. /package/{.hive/src/migrations/migration.service.js → framework/src/migrations/migration.service.ts} +0 -0
  278. /package/{.hive/src/migrations/migration.js → framework/src/migrations/migration.ts} +0 -0
  279. /package/{.hive/src/migrations/migrations/1.js → framework/src/migrations/migrations/1.ts} +0 -0
  280. /package/{.hive/src/migrations/migrator.js → framework/src/migrations/migrator.ts} +0 -0
  281. /package/{.hive/src/migrator.js → framework/src/migrator.ts} +0 -0
  282. /package/{.hive/src/routes/middlewares/attachCustomErrors.js → framework/src/routes/middlewares/attachCustomErrors.ts} +0 -0
  283. /package/{.hive/src/routes/middlewares/routeErrorHandler.js → framework/src/routes/middlewares/routeErrorHandler.ts} +0 -0
  284. /package/{.hive/src/scheduler/handlers/sendDailyReport.example.js → framework/src/scheduler/handlers/sendDailyReport.example.ts} +0 -0
  285. /package/{.hive/src/scheduler.js → framework/src/scheduler.ts} +0 -0
  286. /package/starter/{src/middlewares/allowNoAuth.js → hive/middlewares/allowNoAuth.ts} +0 -0
  287. /package/{.hive/src/middlewares/isAuthorized.js → starter/hive/middlewares/isAuthorized.ts} +0 -0
  288. /package/{.hive/src/middlewares/uploadFile.js → starter/hive/middlewares/uploadFile.ts} +0 -0
  289. /package/{.hive/src/resources/tokens/methods/generateSecureToken.js → starter/hive/resources/tokens/methods/generateSecureToken.ts} +0 -0
  290. /package/{.hive/src/resources/users/handlers/test.js → starter/hive/resources/users/handlers/test.ts} +0 -0
  291. /package/starter/{src/scheduler/handlers/sendDailyReport.example.js → hive/scheduler/handlers/dailyExample.ts} +0 -0
@@ -1,14 +0,0 @@
1
- const React = require('react');
2
- const { Html, Head, Body, Container, Heading, Text } = require('@react-email/components');
3
-
4
- export const MyEmailComponent = ({ name }) => (
5
- <Html>
6
- <Head />
7
- <Body>
8
- <Container>
9
- <Heading>Hello, {name}!</Heading>
10
- <Text>This is a test email using @react-email and Express.</Text>
11
- </Container>
12
- </Body>
13
- </Html>
14
- );
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MyEmailComponent = void 0;
7
- var React = require('react');
8
- var _require = require('@react-email/components'),
9
- Html = _require.Html,
10
- Head = _require.Head,
11
- Body = _require.Body,
12
- Container = _require.Container,
13
- Heading = _require.Heading,
14
- Text = _require.Text;
15
- var MyEmailComponent = exports.MyEmailComponent = function MyEmailComponent(_ref) {
16
- var name = _ref.name;
17
- return /*#__PURE__*/React.createElement(Html, null, /*#__PURE__*/React.createElement(Head, null), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Heading, null, "Hello, ", name, "!"), /*#__PURE__*/React.createElement(Text, null, "This is a test email using @react-email and Express."))));
18
- };
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.MyEmailComponent = void 0;
7
- var React = require('react');
8
- var _require = require('@react-email/components'),
9
- Html = _require.Html,
10
- Head = _require.Head,
11
- Body = _require.Body,
12
- Container = _require.Container,
13
- Heading = _require.Heading,
14
- Text = _require.Text;
15
- var MyEmailComponent = exports.MyEmailComponent = function MyEmailComponent(_ref) {
16
- var name = _ref.name;
17
- return /*#__PURE__*/React.createElement(Html, null, /*#__PURE__*/React.createElement(Head, null), /*#__PURE__*/React.createElement(Body, null, /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Heading, null, "Hello, ", name, "!"), /*#__PURE__*/React.createElement(Text, null, "This is a test email using @react-email and Express."))));
18
- };
@@ -1,22 +0,0 @@
1
- import _ from 'lodash';
2
-
3
- export default (fieldNames, callback) => {
4
- return async ({ doc, prevDoc }) => {
5
- let isFieldChanged = false;
6
-
7
- _.forEach(fieldNames, (fieldName) => {
8
- if (!_.isEqual(doc[fieldName], prevDoc[fieldName])) {
9
- isFieldChanged = true;
10
- return false; // break loop
11
- }
12
-
13
- return true;
14
- });
15
-
16
- if (isFieldChanged) {
17
- return callback({ doc, prevDoc });
18
- }
19
-
20
- return () => {};
21
- };
22
- };
@@ -1,56 +0,0 @@
1
- import { fileURLToPath } from 'url';
2
- import { dirname, join } from 'path';
3
- import { readdirSync } from 'fs';
4
-
5
- /**
6
- * Get __dirname equivalent for ESM modules
7
- * Usage: const __dirname = getDirname(import.meta.url);
8
- */
9
- export const getDirname = (importMetaUrl) => {
10
- return dirname(fileURLToPath(importMetaUrl));
11
- };
12
-
13
- /**
14
- * Get __filename equivalent for ESM modules
15
- * Usage: const __filename = getFilename(import.meta.url);
16
- */
17
- export const getFilename = (importMetaUrl) => {
18
- return fileURLToPath(importMetaUrl);
19
- };
20
-
21
- /**
22
- * ESM replacement for require-dir
23
- * Imports all JS files from a directory
24
- *
25
- * @param {string} dirPath - Directory path to import from
26
- * @param {object} options - Options
27
- * @param {function} options.mapValue - Function to call for each imported module (module, name) => any
28
- * @param {function} options.filter - Function to filter files (filename) => boolean
29
- * @returns {Promise<object>} - Object with filename (without ext) as key and module as value
30
- */
31
- export const importDir = async (dirPath, options = {}) => {
32
- const { mapValue, filter = (f) => f.endsWith('.js') } = options;
33
-
34
- const files = readdirSync(dirPath).filter(filter);
35
- const modules = {};
36
-
37
- for (const file of files) {
38
- const filePath = join(dirPath, file);
39
- const moduleName = file.replace(/\.[^.]+$/, ''); // Remove extension
40
-
41
- try {
42
- const module = await import(filePath);
43
- const value = module.default || module;
44
-
45
- if (mapValue) {
46
- modules[moduleName] = mapValue(value, moduleName);
47
- } else {
48
- modules[moduleName] = value;
49
- }
50
- } catch (err) {
51
- console.error(`[importDir] Failed to import ${filePath}:`, err.message);
52
- }
53
- }
54
-
55
- return modules;
56
- };
@@ -1,41 +0,0 @@
1
- import _ from 'lodash';
2
- import path from 'path';
3
- import fs from 'fs';
4
- import { getDirname } from '#hive/helpers/esm';
5
-
6
- const __dirname = getDirname(import.meta.url);
7
-
8
- const {
9
- promises: { readdir },
10
- } = fs;
11
-
12
-
13
- const getFiles = async (source) => {
14
- return (await readdir(source, { withFileTypes: true }))
15
- .filter((file) => !file.isDirectory())
16
- .map((file) => ({ fileName: file.name }));
17
- };
18
-
19
- export default async () => {
20
- let middlewaresDirs = await getFiles(`${__dirname}/../middlewares`);
21
-
22
- if (process.env.HIVE_SRC) {
23
- let hiveMiddlewaresDirPath = `${process.env.HIVE_SRC}/middlewares`;
24
-
25
- if (fs.existsSync(hiveMiddlewaresDirPath)) {
26
- middlewaresDirs = _.uniqBy([...middlewaresDirs, ...((await getFiles(hiveMiddlewaresDirPath)).map(r => ({ fileName: r.fileName, isHive: true })))], r => r.fileName);
27
- }
28
- }
29
-
30
- return Promise.all(middlewaresDirs
31
- .map(({ fileName, isHive }) => ({
32
- filePath: isHive ? path.resolve(`${process.env.HIVE_SRC}/middlewares/${fileName}`) : path.resolve(`${__dirname}/../middlewares/${fileName}`),
33
- name: fileName.replace('.js', ''),
34
- })).map(async ({ filePath, name }) => {
35
- return {
36
- name,
37
- filePath,
38
- fn: (await import(filePath)).default,
39
- }
40
- }));
41
- };
@@ -1,31 +0,0 @@
1
- import fs from 'fs';
2
- import _ from 'lodash';
3
- import { getDirname } from '#hive/helpers/esm';
4
-
5
- const __dirname = getDirname(import.meta.url);
6
-
7
- const {
8
- promises: { readdir },
9
- } = fs;
10
-
11
- export default async (resourceName) => {
12
- let endpointFiles = [];
13
-
14
- if (fs.existsSync(`${process.env.HIVE_SRC}/resources/${resourceName}/endpoints`)) {
15
- endpointFiles = [...endpointFiles, ...(await readdir(
16
- `${process.env.HIVE_SRC}/resources/${resourceName}/endpoints`
17
- )).map( f => ({ name: f, isHiveEndpoint: true}))];
18
- }
19
-
20
- if (fs.existsSync(`${__dirname}/../resources/${resourceName}/endpoints`)) {
21
- endpointFiles = [...endpointFiles, ...(await readdir(
22
- `${__dirname}/../resources/${resourceName}/endpoints`
23
- )).map( f => ({ name: f }))];
24
- }
25
-
26
- return endpointFiles.map(({ name, isHiveEndpoint }) => ({
27
- file: isHiveEndpoint ? `${process.env.HIVE_SRC}/resources/${resourceName}/endpoints/${name}`: `${__dirname}/../resources/${resourceName}/endpoints/${name}`,
28
- name: _.last(name.split("/")).replace(".js", ""),
29
- }));
30
-
31
- };
@@ -1,35 +0,0 @@
1
- import _ from 'lodash';
2
- import path from 'path';
3
- import fs from 'fs';
4
- import { getDirname } from '#hive/helpers/esm';
5
-
6
- const __dirname = getDirname(import.meta.url);
7
-
8
- const {
9
- promises: { readdir },
10
- } = fs;
11
-
12
-
13
- const getDirectories = async (source) => {
14
- return (await readdir(source, { withFileTypes: true }))
15
- .filter((dir) => dir.isDirectory())
16
- .map((dir) => ({ dirName: dir.name }));
17
- };
18
-
19
- export default async () => {
20
- let resourceDirs = await getDirectories(`${__dirname}/../resources`);
21
-
22
- if (process.env.HIVE_SRC) {
23
- let hiveResourcesDirPath = `${process.env.HIVE_SRC}/resources`;
24
-
25
- if (fs.existsSync(hiveResourcesDirPath)) {
26
- resourceDirs = _.uniqBy([...resourceDirs, ...((await getDirectories(hiveResourcesDirPath)).map(r => ({ dirName: r.dirName, isHive: true })))], r => r.dirName);
27
- }
28
- }
29
-
30
- return resourceDirs
31
- .filter(({ dirName }) => dirName !== "health")
32
- .map(({ dirName }) => ({
33
- name: dirName,
34
- }));
35
- };
@@ -1,53 +0,0 @@
1
- import _ from 'lodash';
2
- import fs, { promises } from "fs";
3
- import getResources from "./getResources.js";
4
- import { getDirname } from '#hive/helpers/esm';
5
-
6
- const __dirname = getDirname(import.meta.url);
7
-
8
- const {
9
- promises: { readdir },
10
- } = { promises };
11
-
12
-
13
- const getSchemas = async (resourceDir) => {
14
- return (await readdir(resourceDir))
15
- .filter((f) => f.includes("schema.js"))
16
- .filter((f) => !f.includes("extends.schema"))
17
- .map((f) => ({
18
- name: f.replace(".schema.js", ""),
19
- file: `${resourceDir}/${f}`,
20
- resourceName: _.last(resourceDir.split('/')),
21
- isHive: process.env.HIVE_SRC && resourceDir.includes(process.env.HIVE_SRC),
22
- }));
23
- }
24
-
25
- const getResourceSchemas = async (resourceName) => {
26
- let schemaFiles = [];
27
-
28
- if (fs.existsSync(`${process.env.HIVE_SRC}/resources/${resourceName}`)) {
29
- schemaFiles = (await getSchemas(`${process.env.HIVE_SRC}/resources/${resourceName}`));
30
- }
31
-
32
- if (fs.existsSync(`${__dirname}/../resources/${resourceName}`)) {
33
- schemaFiles = [...schemaFiles, ...(await getSchemas(`${__dirname}/../resources/${resourceName}`)).filter(schema => !schemaFiles.find(s => s.name === schema.name))];
34
- }
35
-
36
- return schemaFiles;
37
- };
38
-
39
- export default async () => {
40
- const resources = await getResources();
41
- let schemas = [];
42
-
43
- await Promise.all(
44
- resources.map(async ({ name: resourceName }) => {
45
- const resourceSchemas = await getResourceSchemas(resourceName);
46
- schemas.push(...resourceSchemas);
47
- })
48
- );
49
-
50
- console.log('schemas', schemas);
51
-
52
- return schemas;
53
- };
@@ -1,20 +0,0 @@
1
- import fs from 'fs';
2
- import _ from 'lodash';
3
- import { getDirname, importDir } from '#hive/helpers/esm';
4
-
5
- const __dirname = getDirname(import.meta.url);
6
-
7
- export default async (resourceName) => {
8
- const mapValue = (handler, handlerName) => {
9
- console.log(`[handlers] Registering handler ${handlerName}`);
10
- return handler;
11
- };
12
-
13
- if (fs.existsSync(`${process.env.HIVE_SRC}/resources/${resourceName}/handlers`)) {
14
- await importDir(`${process.env.HIVE_SRC}/resources/${resourceName}/handlers`, { mapValue });
15
- }
16
-
17
- if (fs.existsSync(`${__dirname}/../resources/${resourceName}/handlers`)) {
18
- await importDir(`${__dirname}/../resources/${resourceName}/handlers`, { mapValue });
19
- }
20
- };
@@ -1,13 +0,0 @@
1
- import { ZodArray } from 'zod';
2
-
3
- const isZodArray = (schema) => {
4
- if (schema instanceof ZodArray) return true;
5
-
6
- if (schema._def?.innerType) {
7
- return isZodArray(schema._def.innerType);
8
- }
9
-
10
- return false;
11
- };
12
-
13
- export default isZodArray;
@@ -1,8 +0,0 @@
1
- import prettier from 'prettier';
2
-
3
- export default (...params) => {
4
- return prettier.format(...params, {
5
- parser: "babel",
6
- singleQuote: true,
7
- });
8
- };
@@ -1,9 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export default z
4
- .object({
5
- _id: z.string(),
6
-
7
- createdOn: z.coerce.date().default(() => new Date()),
8
- updatedOn: z.coerce.date().default(() => new Date()),
9
- });
@@ -1,14 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export const paginationSchema = z.object({
4
- page: z.coerce.number().default(1),
5
- perPage: z.coerce.number().default(10),
6
-
7
- searchValue: z.string().optional(),
8
-
9
- sort: z
10
- .object({
11
- createdOn: z.enum(['asc', 'desc']).default('asc'),
12
- })
13
- .default({}),
14
- });
@@ -1,9 +0,0 @@
1
- import config from '#hive/app-config';
2
- import { Emitter } from '@socket.io/redis-emitter';
3
- import { createClient } from 'redis';
4
-
5
- const redisClient = createClient({ url: config.redis.url });
6
-
7
- const emitter = new Emitter(redisClient);
8
-
9
- export default emitter;
@@ -1,5 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "baseUrl": "."
4
- }
5
- }
@@ -1,32 +0,0 @@
1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3
-
4
- name: Node.js Package
5
-
6
- on:
7
- release:
8
- types: [created]
9
-
10
- jobs:
11
- build:
12
- runs-on: ubuntu-latest
13
- steps:
14
- - uses: actions/checkout@v2
15
- - uses: actions/setup-node@v1
16
- with:
17
- node-version: 12
18
- - run: npm ci
19
-
20
- publish-npm:
21
- needs: build
22
- runs-on: ubuntu-latest
23
- steps:
24
- - uses: actions/checkout@v2
25
- - uses: actions/setup-node@v1
26
- with:
27
- node-version: 12
28
- registry-url: https://registry.npmjs.org/
29
- - run: npm ci
30
- - run: npm publish
31
- env:
32
- NODE_AUTH_TOKEN: ${{secrets.npm_token}}