@frigear-nu/shifts 0.0.0-stage → 0.0.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 (341) hide show
  1. package/README.md +53 -2
  2. package/dist/module.d.mts +709 -0
  3. package/dist/module.json +9 -0
  4. package/dist/module.mjs +253 -0
  5. package/dist/runtime/access.d.ts +2 -0
  6. package/dist/runtime/access.js +84 -0
  7. package/dist/runtime/app/components/ShiftBroadcastSlideover.d.vue.ts +19 -0
  8. package/dist/runtime/app/components/ShiftBroadcastSlideover.vue +142 -0
  9. package/dist/runtime/app/components/ShiftBroadcastSlideover.vue.d.ts +19 -0
  10. package/dist/runtime/app/components/ShiftBroadcastsCard.d.vue.ts +9 -0
  11. package/dist/runtime/app/components/ShiftBroadcastsCard.vue +74 -0
  12. package/dist/runtime/app/components/ShiftBroadcastsCard.vue.d.ts +9 -0
  13. package/dist/runtime/app/components/ShiftBulkSlideover.d.vue.ts +15 -0
  14. package/dist/runtime/app/components/ShiftBulkSlideover.vue +185 -0
  15. package/dist/runtime/app/components/ShiftBulkSlideover.vue.d.ts +15 -0
  16. package/dist/runtime/app/components/ShiftCheckInCard.d.vue.ts +13 -0
  17. package/dist/runtime/app/components/ShiftCheckInCard.vue +238 -0
  18. package/dist/runtime/app/components/ShiftCheckInCard.vue.d.ts +13 -0
  19. package/dist/runtime/app/components/ShiftCopySlideover.d.vue.ts +11 -0
  20. package/dist/runtime/app/components/ShiftCopySlideover.vue +71 -0
  21. package/dist/runtime/app/components/ShiftCopySlideover.vue.d.ts +11 -0
  22. package/dist/runtime/app/components/ShiftDayView.d.vue.ts +16 -0
  23. package/dist/runtime/app/components/ShiftDayView.vue +124 -0
  24. package/dist/runtime/app/components/ShiftDayView.vue.d.ts +16 -0
  25. package/dist/runtime/app/components/ShiftFeedSlideover.d.vue.ts +7 -0
  26. package/dist/runtime/app/components/ShiftFeedSlideover.vue +172 -0
  27. package/dist/runtime/app/components/ShiftFeedSlideover.vue.d.ts +7 -0
  28. package/dist/runtime/app/components/ShiftNowCard.d.vue.ts +6 -0
  29. package/dist/runtime/app/components/ShiftNowCard.vue +83 -0
  30. package/dist/runtime/app/components/ShiftNowCard.vue.d.ts +6 -0
  31. package/dist/runtime/app/components/ShiftPassFullscreen.d.vue.ts +13 -0
  32. package/dist/runtime/app/components/ShiftPassFullscreen.vue +79 -0
  33. package/dist/runtime/app/components/ShiftPassFullscreen.vue.d.ts +13 -0
  34. package/dist/runtime/app/components/ShiftPerkSlideover.d.vue.ts +14 -0
  35. package/dist/runtime/app/components/ShiftPerkSlideover.vue +103 -0
  36. package/dist/runtime/app/components/ShiftPerkSlideover.vue.d.ts +14 -0
  37. package/dist/runtime/app/components/ShiftPerksCard.d.vue.ts +8 -0
  38. package/dist/runtime/app/components/ShiftPerksCard.vue +66 -0
  39. package/dist/runtime/app/components/ShiftPerksCard.vue.d.ts +8 -0
  40. package/dist/runtime/app/components/ShiftQrScanner.d.vue.ts +10 -0
  41. package/dist/runtime/app/components/ShiftQrScanner.vue +44 -0
  42. package/dist/runtime/app/components/ShiftQrScanner.vue.d.ts +10 -0
  43. package/dist/runtime/app/components/ShiftRoleSlideover.d.vue.ts +15 -0
  44. package/dist/runtime/app/components/ShiftRoleSlideover.vue +88 -0
  45. package/dist/runtime/app/components/ShiftRoleSlideover.vue.d.ts +15 -0
  46. package/dist/runtime/app/components/ShiftScheduleSettingsFields.d.vue.ts +11 -0
  47. package/dist/runtime/app/components/ShiftScheduleSettingsFields.vue +61 -0
  48. package/dist/runtime/app/components/ShiftScheduleSettingsFields.vue.d.ts +11 -0
  49. package/dist/runtime/app/components/ShiftScheduleSlideover.d.vue.ts +12 -0
  50. package/dist/runtime/app/components/ShiftScheduleSlideover.vue +129 -0
  51. package/dist/runtime/app/components/ShiftScheduleSlideover.vue.d.ts +12 -0
  52. package/dist/runtime/app/components/ShiftSlideover.d.vue.ts +13 -0
  53. package/dist/runtime/app/components/ShiftSlideover.vue +353 -0
  54. package/dist/runtime/app/components/ShiftSlideover.vue.d.ts +13 -0
  55. package/dist/runtime/app/components/ShiftStationSlideover.d.vue.ts +15 -0
  56. package/dist/runtime/app/components/ShiftStationSlideover.vue +92 -0
  57. package/dist/runtime/app/components/ShiftStationSlideover.vue.d.ts +15 -0
  58. package/dist/runtime/app/composables/index.d.ts +6 -0
  59. package/dist/runtime/app/composables/index.js +5 -0
  60. package/dist/runtime/app/composables/useShiftsActions.d.ts +61 -0
  61. package/dist/runtime/app/composables/useShiftsActions.js +224 -0
  62. package/dist/runtime/app/composables/useShiftsFormat.d.ts +12 -0
  63. package/dist/runtime/app/composables/useShiftsFormat.js +14 -0
  64. package/dist/runtime/app/composables/useShiftsLinks.d.ts +12 -0
  65. package/dist/runtime/app/composables/useShiftsLinks.js +6 -0
  66. package/dist/runtime/app/composables/useShiftsTranslate.d.ts +5 -0
  67. package/dist/runtime/app/composables/useShiftsTranslate.js +12 -0
  68. package/dist/runtime/app/composables/useShiftsVenueFeatures.d.ts +17 -0
  69. package/dist/runtime/app/composables/useShiftsVenueFeatures.js +18 -0
  70. package/dist/runtime/app/dashboard/NextShift.d.vue.ts +3 -0
  71. package/dist/runtime/app/dashboard/NextShift.vue +69 -0
  72. package/dist/runtime/app/dashboard/NextShift.vue.d.ts +3 -0
  73. package/dist/runtime/app/dashboard/OpenSwaps.d.vue.ts +3 -0
  74. package/dist/runtime/app/dashboard/OpenSwaps.vue +69 -0
  75. package/dist/runtime/app/dashboard/OpenSwaps.vue.d.ts +3 -0
  76. package/dist/runtime/app/dashboard/TeamOnNow.d.vue.ts +3 -0
  77. package/dist/runtime/app/dashboard/TeamOnNow.vue +72 -0
  78. package/dist/runtime/app/dashboard/TeamOnNow.vue.d.ts +3 -0
  79. package/dist/runtime/app/pages/check-in.d.vue.ts +3 -0
  80. package/dist/runtime/app/pages/check-in.vue +93 -0
  81. package/dist/runtime/app/pages/check-in.vue.d.ts +3 -0
  82. package/dist/runtime/app/pages/lead.d.vue.ts +3 -0
  83. package/dist/runtime/app/pages/lead.vue +300 -0
  84. package/dist/runtime/app/pages/lead.vue.d.ts +3 -0
  85. package/dist/runtime/app/pages/shift.d.vue.ts +3 -0
  86. package/dist/runtime/app/pages/shift.vue +482 -0
  87. package/dist/runtime/app/pages/shift.vue.d.ts +3 -0
  88. package/dist/runtime/app/pages/shifts.d.vue.ts +3 -0
  89. package/dist/runtime/app/pages/shifts.vue +169 -0
  90. package/dist/runtime/app/pages/shifts.vue.d.ts +3 -0
  91. package/dist/runtime/app/pages/station.d.vue.ts +3 -0
  92. package/dist/runtime/app/pages/station.vue +104 -0
  93. package/dist/runtime/app/pages/station.vue.d.ts +3 -0
  94. package/dist/runtime/app/pages/swaps.d.vue.ts +3 -0
  95. package/dist/runtime/app/pages/swaps.vue +192 -0
  96. package/dist/runtime/app/pages/swaps.vue.d.ts +3 -0
  97. package/dist/runtime/app/tabs/Shifts.d.vue.ts +9 -0
  98. package/dist/runtime/app/tabs/Shifts.vue +487 -0
  99. package/dist/runtime/app/tabs/Shifts.vue.d.ts +9 -0
  100. package/dist/runtime/app/utils/admin-shifts.d.ts +42 -0
  101. package/dist/runtime/app/utils/admin-shifts.js +36 -0
  102. package/dist/runtime/dashboard.d.ts +8 -0
  103. package/dist/runtime/dashboard.js +30 -0
  104. package/dist/runtime/emails/shifts-broadcast.d.vue.ts +8 -0
  105. package/dist/runtime/emails/shifts-broadcast.vue +24 -0
  106. package/dist/runtime/emails/shifts-broadcast.vue.d.ts +8 -0
  107. package/dist/runtime/emails/shifts-reminder.d.vue.ts +12 -0
  108. package/dist/runtime/emails/shifts-reminder.vue +34 -0
  109. package/dist/runtime/emails/shifts-reminder.vue.d.ts +12 -0
  110. package/dist/runtime/emails/shifts-swap-accepted.d.vue.ts +11 -0
  111. package/dist/runtime/emails/shifts-swap-accepted.vue +32 -0
  112. package/dist/runtime/emails/shifts-swap-accepted.vue.d.ts +11 -0
  113. package/dist/runtime/emails/shifts-swap-completed.d.vue.ts +11 -0
  114. package/dist/runtime/emails/shifts-swap-completed.vue +32 -0
  115. package/dist/runtime/emails/shifts-swap-completed.vue.d.ts +11 -0
  116. package/dist/runtime/emails/shifts-swap-offered.d.vue.ts +11 -0
  117. package/dist/runtime/emails/shifts-swap-offered.vue +32 -0
  118. package/dist/runtime/emails/shifts-swap-offered.vue.d.ts +11 -0
  119. package/dist/runtime/emails/shifts-swap-pending.d.vue.ts +11 -0
  120. package/dist/runtime/emails/shifts-swap-pending.vue +32 -0
  121. package/dist/runtime/emails/shifts-swap-pending.vue.d.ts +11 -0
  122. package/dist/runtime/emails/shifts-swap-proposed.d.vue.ts +11 -0
  123. package/dist/runtime/emails/shifts-swap-proposed.vue +32 -0
  124. package/dist/runtime/emails/shifts-swap-proposed.vue.d.ts +11 -0
  125. package/dist/runtime/emails/shifts-swap-rejected.d.vue.ts +11 -0
  126. package/dist/runtime/emails/shifts-swap-rejected.vue +32 -0
  127. package/dist/runtime/emails/shifts-swap-rejected.vue.d.ts +11 -0
  128. package/dist/runtime/i18n/lang/da.json +626 -0
  129. package/dist/runtime/i18n/lang/en.json +626 -0
  130. package/dist/runtime/menus.d.ts +2 -0
  131. package/dist/runtime/menus.js +17 -0
  132. package/dist/runtime/notifications.d.ts +9 -0
  133. package/dist/runtime/notifications.js +36 -0
  134. package/dist/runtime/server/db/schema.postgresql.d.ts +2151 -0
  135. package/dist/runtime/server/db/schema.postgresql.js +228 -0
  136. package/dist/runtime/server/db/schema.sqlite.d.ts +2263 -0
  137. package/dist/runtime/server/db/schema.sqlite.js +228 -0
  138. package/dist/runtime/server/digest-email.d.ts +17 -0
  139. package/dist/runtime/server/digest-email.js +42 -0
  140. package/dist/runtime/server/plugins/station-key.d.ts +2 -0
  141. package/dist/runtime/server/plugins/station-key.js +5 -0
  142. package/dist/runtime/server/plugins/teams.d.ts +2 -0
  143. package/dist/runtime/server/plugins/teams.js +19 -0
  144. package/dist/runtime/server/policies.d.ts +2 -0
  145. package/dist/runtime/server/policies.js +41 -0
  146. package/dist/runtime/server/reminder-email.d.ts +67 -0
  147. package/dist/runtime/server/reminder-email.js +109 -0
  148. package/dist/runtime/server/routes/admin/assignment.delete.d.ts +2 -0
  149. package/dist/runtime/server/routes/admin/assignment.delete.js +10 -0
  150. package/dist/runtime/server/routes/admin/assignments.post.d.ts +2 -0
  151. package/dist/runtime/server/routes/admin/assignments.post.js +11 -0
  152. package/dist/runtime/server/routes/admin/broadcasts.get.d.ts +2 -0
  153. package/dist/runtime/server/routes/admin/broadcasts.get.js +8 -0
  154. package/dist/runtime/server/routes/admin/broadcasts.post.d.ts +2 -0
  155. package/dist/runtime/server/routes/admin/broadcasts.post.js +9 -0
  156. package/dist/runtime/server/routes/admin/candidates.get.d.ts +2 -0
  157. package/dist/runtime/server/routes/admin/candidates.get.js +10 -0
  158. package/dist/runtime/server/routes/admin/operation-teams.get.d.ts +2 -0
  159. package/dist/runtime/server/routes/admin/operation-teams.get.js +9 -0
  160. package/dist/runtime/server/routes/admin/perk.delete.d.ts +2 -0
  161. package/dist/runtime/server/routes/admin/perk.delete.js +10 -0
  162. package/dist/runtime/server/routes/admin/perk.patch.d.ts +2 -0
  163. package/dist/runtime/server/routes/admin/perk.patch.js +10 -0
  164. package/dist/runtime/server/routes/admin/perks.get.d.ts +2 -0
  165. package/dist/runtime/server/routes/admin/perks.get.js +9 -0
  166. package/dist/runtime/server/routes/admin/perks.post.d.ts +2 -0
  167. package/dist/runtime/server/routes/admin/perks.post.js +10 -0
  168. package/dist/runtime/server/routes/admin/role.delete.d.ts +2 -0
  169. package/dist/runtime/server/routes/admin/role.delete.js +11 -0
  170. package/dist/runtime/server/routes/admin/role.patch.d.ts +2 -0
  171. package/dist/runtime/server/routes/admin/role.patch.js +11 -0
  172. package/dist/runtime/server/routes/admin/roles.get.d.ts +2 -0
  173. package/dist/runtime/server/routes/admin/roles.get.js +9 -0
  174. package/dist/runtime/server/routes/admin/roles.post.d.ts +2 -0
  175. package/dist/runtime/server/routes/admin/roles.post.js +10 -0
  176. package/dist/runtime/server/routes/admin/schedule-copy.post.d.ts +2 -0
  177. package/dist/runtime/server/routes/admin/schedule-copy.post.js +12 -0
  178. package/dist/runtime/server/routes/admin/schedule-publish.post.d.ts +2 -0
  179. package/dist/runtime/server/routes/admin/schedule-publish.post.js +9 -0
  180. package/dist/runtime/server/routes/admin/schedule.delete.d.ts +2 -0
  181. package/dist/runtime/server/routes/admin/schedule.delete.js +10 -0
  182. package/dist/runtime/server/routes/admin/schedule.get.d.ts +2 -0
  183. package/dist/runtime/server/routes/admin/schedule.get.js +9 -0
  184. package/dist/runtime/server/routes/admin/schedule.patch.d.ts +2 -0
  185. package/dist/runtime/server/routes/admin/schedule.patch.js +10 -0
  186. package/dist/runtime/server/routes/admin/schedules.get.d.ts +2 -0
  187. package/dist/runtime/server/routes/admin/schedules.get.js +10 -0
  188. package/dist/runtime/server/routes/admin/schedules.post.d.ts +2 -0
  189. package/dist/runtime/server/routes/admin/schedules.post.js +9 -0
  190. package/dist/runtime/server/routes/admin/shift.delete.d.ts +2 -0
  191. package/dist/runtime/server/routes/admin/shift.delete.js +10 -0
  192. package/dist/runtime/server/routes/admin/shift.patch.d.ts +2 -0
  193. package/dist/runtime/server/routes/admin/shift.patch.js +10 -0
  194. package/dist/runtime/server/routes/admin/shifts-bulk.post.d.ts +2 -0
  195. package/dist/runtime/server/routes/admin/shifts-bulk.post.js +10 -0
  196. package/dist/runtime/server/routes/admin/shifts.get.d.ts +2 -0
  197. package/dist/runtime/server/routes/admin/shifts.get.js +10 -0
  198. package/dist/runtime/server/routes/admin/station.delete.d.ts +2 -0
  199. package/dist/runtime/server/routes/admin/station.delete.js +11 -0
  200. package/dist/runtime/server/routes/admin/station.patch.d.ts +2 -0
  201. package/dist/runtime/server/routes/admin/station.patch.js +11 -0
  202. package/dist/runtime/server/routes/admin/stations.get.d.ts +2 -0
  203. package/dist/runtime/server/routes/admin/stations.get.js +9 -0
  204. package/dist/runtime/server/routes/admin/stations.post.d.ts +2 -0
  205. package/dist/runtime/server/routes/admin/stations.post.js +10 -0
  206. package/dist/runtime/server/routes/admin/swap-cancel.post.d.ts +2 -0
  207. package/dist/runtime/server/routes/admin/swap-cancel.post.js +10 -0
  208. package/dist/runtime/server/routes/admin/swaps.get.d.ts +2 -0
  209. package/dist/runtime/server/routes/admin/swaps.get.js +10 -0
  210. package/dist/runtime/server/routes/feed/feed.get.d.ts +2 -0
  211. package/dist/runtime/server/routes/feed/feed.get.js +9 -0
  212. package/dist/runtime/server/routes/lead/attended.post.d.ts +2 -0
  213. package/dist/runtime/server/routes/lead/attended.post.js +11 -0
  214. package/dist/runtime/server/routes/lead/broadcast.post.d.ts +2 -0
  215. package/dist/runtime/server/routes/lead/broadcast.post.js +12 -0
  216. package/dist/runtime/server/routes/lead/check-in.post.d.ts +2 -0
  217. package/dist/runtime/server/routes/lead/check-in.post.js +9 -0
  218. package/dist/runtime/server/routes/lead/exceptions.get.d.ts +2 -0
  219. package/dist/runtime/server/routes/lead/exceptions.get.js +8 -0
  220. package/dist/runtime/server/routes/lead/no-show.post.d.ts +2 -0
  221. package/dist/runtime/server/routes/lead/no-show.post.js +11 -0
  222. package/dist/runtime/server/routes/lead/now.get.d.ts +2 -0
  223. package/dist/runtime/server/routes/lead/now.get.js +9 -0
  224. package/dist/runtime/server/routes/lead/on-duty.get.d.ts +2 -0
  225. package/dist/runtime/server/routes/lead/on-duty.get.js +10 -0
  226. package/dist/runtime/server/routes/lead/stations.get.d.ts +2 -0
  227. package/dist/runtime/server/routes/lead/stations.get.js +8 -0
  228. package/dist/runtime/server/routes/lead/team-shifts.get.d.ts +2 -0
  229. package/dist/runtime/server/routes/lead/team-shifts.get.js +9 -0
  230. package/dist/runtime/server/routes/lead/team-swaps.get.d.ts +2 -0
  231. package/dist/runtime/server/routes/lead/team-swaps.get.js +9 -0
  232. package/dist/runtime/server/routes/me/check-in.post.d.ts +2 -0
  233. package/dist/runtime/server/routes/me/check-in.post.js +11 -0
  234. package/dist/runtime/server/routes/me/earned-perk-claim.post.d.ts +2 -0
  235. package/dist/runtime/server/routes/me/earned-perk-claim.post.js +10 -0
  236. package/dist/runtime/server/routes/me/earned-perks.get.d.ts +2 -0
  237. package/dist/runtime/server/routes/me/earned-perks.get.js +9 -0
  238. package/dist/runtime/server/routes/me/feed-token.delete.d.ts +2 -0
  239. package/dist/runtime/server/routes/me/feed-token.delete.js +7 -0
  240. package/dist/runtime/server/routes/me/feed-token.get.d.ts +2 -0
  241. package/dist/runtime/server/routes/me/feed-token.get.js +6 -0
  242. package/dist/runtime/server/routes/me/feed-token.post.d.ts +2 -0
  243. package/dist/runtime/server/routes/me/feed-token.post.js +7 -0
  244. package/dist/runtime/server/routes/me/leads.get.d.ts +2 -0
  245. package/dist/runtime/server/routes/me/leads.get.js +5 -0
  246. package/dist/runtime/server/routes/me/now.get.d.ts +2 -0
  247. package/dist/runtime/server/routes/me/now.get.js +5 -0
  248. package/dist/runtime/server/routes/me/pass.get.d.ts +2 -0
  249. package/dist/runtime/server/routes/me/pass.get.js +11 -0
  250. package/dist/runtime/server/routes/me/settle.post.d.ts +2 -0
  251. package/dist/runtime/server/routes/me/settle.post.js +14 -0
  252. package/dist/runtime/server/routes/me/shift.get.d.ts +2 -0
  253. package/dist/runtime/server/routes/me/shift.get.js +10 -0
  254. package/dist/runtime/server/routes/me/shifts.get.d.ts +2 -0
  255. package/dist/runtime/server/routes/me/shifts.get.js +6 -0
  256. package/dist/runtime/server/routes/me/swap.delete.d.ts +2 -0
  257. package/dist/runtime/server/routes/me/swap.delete.js +11 -0
  258. package/dist/runtime/server/routes/me/swap.post.d.ts +2 -0
  259. package/dist/runtime/server/routes/me/swap.post.js +11 -0
  260. package/dist/runtime/server/routes/stations/token.get.d.ts +2 -0
  261. package/dist/runtime/server/routes/stations/token.get.js +12 -0
  262. package/dist/runtime/server/routes/swaps/approve.post.d.ts +2 -0
  263. package/dist/runtime/server/routes/swaps/approve.post.js +9 -0
  264. package/dist/runtime/server/routes/swaps/list.get.d.ts +2 -0
  265. package/dist/runtime/server/routes/swaps/list.get.js +5 -0
  266. package/dist/runtime/server/routes/swaps/offer-accept.post.d.ts +2 -0
  267. package/dist/runtime/server/routes/swaps/offer-accept.post.js +9 -0
  268. package/dist/runtime/server/routes/swaps/offer-reject.post.d.ts +2 -0
  269. package/dist/runtime/server/routes/swaps/offer-reject.post.js +9 -0
  270. package/dist/runtime/server/routes/swaps/offer.delete.d.ts +2 -0
  271. package/dist/runtime/server/routes/swaps/offer.delete.js +11 -0
  272. package/dist/runtime/server/routes/swaps/offer.post.d.ts +2 -0
  273. package/dist/runtime/server/routes/swaps/offer.post.js +11 -0
  274. package/dist/runtime/server/routes/swaps/reject.post.d.ts +2 -0
  275. package/dist/runtime/server/routes/swaps/reject.post.js +9 -0
  276. package/dist/runtime/server/swap-email.d.ts +28 -0
  277. package/dist/runtime/server/swap-email.js +49 -0
  278. package/dist/runtime/server/tasks/close-shifts.d.ts +2 -0
  279. package/dist/runtime/server/tasks/close-shifts.js +9 -0
  280. package/dist/runtime/server/tasks/send-reminders.d.ts +2 -0
  281. package/dist/runtime/server/tasks/send-reminders.js +9 -0
  282. package/dist/runtime/server/utils/shifts-admin.d.ts +67 -0
  283. package/dist/runtime/server/utils/shifts-admin.js +312 -0
  284. package/dist/runtime/server/utils/shifts-assign.d.ts +89 -0
  285. package/dist/runtime/server/utils/shifts-assign.js +264 -0
  286. package/dist/runtime/server/utils/shifts-automation.d.ts +37 -0
  287. package/dist/runtime/server/utils/shifts-automation.js +171 -0
  288. package/dist/runtime/server/utils/shifts-broadcasts.d.ts +38 -0
  289. package/dist/runtime/server/utils/shifts-broadcasts.js +113 -0
  290. package/dist/runtime/server/utils/shifts-core.d.ts +78 -0
  291. package/dist/runtime/server/utils/shifts-core.js +142 -0
  292. package/dist/runtime/server/utils/shifts-dto.d.ts +32 -0
  293. package/dist/runtime/server/utils/shifts-dto.js +127 -0
  294. package/dist/runtime/server/utils/shifts-emails.d.ts +16 -0
  295. package/dist/runtime/server/utils/shifts-emails.js +44 -0
  296. package/dist/runtime/server/utils/shifts-exceptions.d.ts +7 -0
  297. package/dist/runtime/server/utils/shifts-exceptions.js +32 -0
  298. package/dist/runtime/server/utils/shifts-feed.d.ts +16 -0
  299. package/dist/runtime/server/utils/shifts-feed.js +73 -0
  300. package/dist/runtime/server/utils/shifts-notify.d.ts +40 -0
  301. package/dist/runtime/server/utils/shifts-notify.js +22 -0
  302. package/dist/runtime/server/utils/shifts-on-duty.d.ts +12 -0
  303. package/dist/runtime/server/utils/shifts-on-duty.js +37 -0
  304. package/dist/runtime/server/utils/shifts-perks.d.ts +46 -0
  305. package/dist/runtime/server/utils/shifts-perks.js +183 -0
  306. package/dist/runtime/server/utils/shifts-reminders.d.ts +30 -0
  307. package/dist/runtime/server/utils/shifts-reminders.js +102 -0
  308. package/dist/runtime/server/utils/shifts-schemas.d.ts +318 -0
  309. package/dist/runtime/server/utils/shifts-schemas.js +177 -0
  310. package/dist/runtime/server/utils/shifts-station-key.d.ts +7 -0
  311. package/dist/runtime/server/utils/shifts-station-key.js +22 -0
  312. package/dist/runtime/server/utils/shifts-stations.d.ts +28 -0
  313. package/dist/runtime/server/utils/shifts-stations.js +109 -0
  314. package/dist/runtime/server/utils/shifts-swaps.d.ts +114 -0
  315. package/dist/runtime/server/utils/shifts-swaps.js +559 -0
  316. package/dist/runtime/server/utils/shifts-views.d.ts +62 -0
  317. package/dist/runtime/server/utils/shifts-views.js +212 -0
  318. package/dist/runtime/utils/api.d.ts +108 -0
  319. package/dist/runtime/utils/api.js +111 -0
  320. package/dist/runtime/utils/checkin.d.ts +59 -0
  321. package/dist/runtime/utils/checkin.js +57 -0
  322. package/dist/runtime/utils/guards.d.ts +21 -0
  323. package/dist/runtime/utils/guards.js +36 -0
  324. package/dist/runtime/utils/ics.d.ts +32 -0
  325. package/dist/runtime/utils/ics.js +56 -0
  326. package/dist/runtime/utils/index.d.ts +16 -0
  327. package/dist/runtime/utils/index.js +15 -0
  328. package/dist/runtime/utils/links.d.ts +30 -0
  329. package/dist/runtime/utils/links.js +18 -0
  330. package/dist/runtime/utils/reminders.d.ts +27 -0
  331. package/dist/runtime/utils/reminders.js +28 -0
  332. package/dist/runtime/utils/settings.d.ts +28 -0
  333. package/dist/runtime/utils/settings.js +18 -0
  334. package/dist/runtime/utils/station-key.d.ts +9 -0
  335. package/dist/runtime/utils/station-key.js +12 -0
  336. package/dist/runtime/utils/status.d.ts +23 -0
  337. package/dist/runtime/utils/status.js +46 -0
  338. package/dist/runtime/utils/time.d.ts +22 -0
  339. package/dist/runtime/utils/time.js +14 -0
  340. package/dist/types.d.mts +5 -0
  341. package/package.json +131 -3
@@ -0,0 +1,56 @@
1
+ const encoder = new TextEncoder();
2
+ export function icsEscape(text) {
3
+ return text.replace(/\\/g, "\\\\").replace(/;/g, "\\;").replace(/,/g, "\\,").replace(/\r\n|\r|\n/g, "\\n").replace(/[\u0000-\u0008\u000B-\u001F\u007F]/g, "");
4
+ }
5
+ export function icsDate(date) {
6
+ return date.toISOString().replace(/[-:]/g, "").replace(/\.\d{3}Z$/, "Z");
7
+ }
8
+ export function icsFold(line) {
9
+ if (encoder.encode(line).length <= 75) return line;
10
+ const lines = [];
11
+ let current = "";
12
+ let size = 0;
13
+ for (const char of line) {
14
+ const bytes = encoder.encode(char).length;
15
+ const limit = lines.length === 0 ? 75 : 74;
16
+ if (size + bytes > limit) {
17
+ lines.push(current);
18
+ current = "";
19
+ size = 0;
20
+ }
21
+ current += char;
22
+ size += bytes;
23
+ }
24
+ lines.push(current);
25
+ return lines.map((part, index) => index === 0 ? part : ` ${part}`).join("\r\n");
26
+ }
27
+ export function buildIcs(input) {
28
+ const generatedAt = input.generatedAt ?? /* @__PURE__ */ new Date();
29
+ const lines = [
30
+ "BEGIN:VCALENDAR",
31
+ "VERSION:2.0",
32
+ `PRODID:${input.prodId ?? "-//frigear-nu//shifts//EN"}`,
33
+ "CALSCALE:GREGORIAN",
34
+ "METHOD:PUBLISH",
35
+ `X-WR-CALNAME:${icsEscape(input.name)}`,
36
+ "REFRESH-INTERVAL;VALUE=DURATION:PT1H",
37
+ "X-PUBLISHED-TTL:PT1H"
38
+ ];
39
+ for (const event of input.events) {
40
+ lines.push(
41
+ "BEGIN:VEVENT",
42
+ `UID:${event.uid}`,
43
+ `DTSTAMP:${icsDate(event.stamp ?? generatedAt)}`,
44
+ `DTSTART:${icsDate(event.start)}`,
45
+ `DTEND:${icsDate(event.end)}`,
46
+ `SUMMARY:${icsEscape(event.summary)}`
47
+ );
48
+ if (event.location) lines.push(`LOCATION:${icsEscape(event.location)}`);
49
+ if (event.description) lines.push(`DESCRIPTION:${icsEscape(event.description)}`);
50
+ if (event.url) lines.push(`URL:${event.url}`);
51
+ lines.push(`STATUS:${event.status ?? "CONFIRMED"}`, "END:VEVENT");
52
+ }
53
+ lines.push("END:VCALENDAR");
54
+ return `${lines.map(icsFold).join("\r\n")}\r
55
+ `;
56
+ }
@@ -0,0 +1,16 @@
1
+ import { translate } from '@frigear-nu/ui/translated';
2
+ export { translate };
3
+ export * from './api.js';
4
+ export * from './checkin.js';
5
+ export * from './guards.js';
6
+ export * from './ics.js';
7
+ export * from './reminders.js';
8
+ export * from './links.js';
9
+ export * from './settings.js';
10
+ export * from './status.js';
11
+ export * from './time.js';
12
+ export type { ModuleOptions, MyShiftDetailDto, MyShiftDto, ShiftApproval, ShiftAssigneeDto, ShiftAssignmentChangedContext, ShiftAssignmentDto, ShiftAssignmentStatus, ShiftAssignResultDto, ShiftAttendanceContext, ShiftBroadcastAudience, ShiftBroadcastContext, ShiftBroadcastDto, ShiftBroadcastResultDto, ShiftCandidateDto, ShiftChannel, ShiftCheckInMethod, ShiftCheckInMode, ShiftCheckInRule, ShiftCheckInSettings, ShiftCheckInTeamSettings, ShiftCheckInDto, ShiftCopyResultDto, ShiftCoverage, ShiftCreatedContext, ShiftDigestContext, ShiftDto, ShiftExceptionDto, ShiftExceptionKind, ShiftFeedStatusDto, ShiftFeedTokenDto, ShiftGuards, ShiftHandover, ShiftLocation, ShiftPassDto, ShiftPassPerkDto, ShiftPerkDto, ShiftEarnedPerkContext, ShiftEarnedPerkDto, ShiftEarnedPerkListDto, ShiftPersonDto, ShiftReminderContext, ShiftRoleDto, ShiftScheduleContext, ShiftScheduleDto, ShiftScheduleSettings, ShiftScheduleStatus, ShiftSelfCheckInDto, ShiftSelfCheckInInput, ShiftsAutomationOptions, ShiftStationDto, ShiftStationTokenDto, ShiftsLedTeamDto, ShiftsMyNowDto, ShiftsNowDto, ShiftsOperationTeamDto, ShiftsRemindersOptions, ShiftSwapContext, ShiftSwapDto, ShiftSwapGuardCode, ShiftSwapKind, ShiftSwapOfferDto, ShiftSwapOfferStatus, ShiftSwapStatus, ShiftUpdatedContext, ShiftWarning, ShiftWithAssigneesDto, Translated, } from '../../types.js';
13
+ /** Random, prefixed id (`<prefix>_<32 hex>`): the one of `@frigear-nu/module-kit/id`. */
14
+ export { newId } from '@frigear-nu/module-kit/id';
15
+ /** An unguessable check-in code: 64 hex characters (two UUIDs without dashes), like an events ticket code. */
16
+ export declare function newCheckInCode(): string;
@@ -0,0 +1,15 @@
1
+ import { translate } from "@frigear-nu/ui/translated";
2
+ export { translate };
3
+ export * from "./api.js";
4
+ export * from "./checkin.js";
5
+ export * from "./guards.js";
6
+ export * from "./ics.js";
7
+ export * from "./reminders.js";
8
+ export * from "./links.js";
9
+ export * from "./settings.js";
10
+ export * from "./status.js";
11
+ export * from "./time.js";
12
+ export { newId } from "@frigear-nu/module-kit/id";
13
+ export function newCheckInCode() {
14
+ return `${crypto.randomUUID().replaceAll("-", "")}${crypto.randomUUID().replaceAll("-", "")}`;
15
+ }
@@ -0,0 +1,30 @@
1
+ /** The configured page paths (`public.shifts.pages`). */
2
+ export type ShiftsPages = {
3
+ shifts?: string;
4
+ shift?: string;
5
+ swaps?: string;
6
+ checkIn?: string;
7
+ lead?: string;
8
+ station?: string;
9
+ };
10
+ /** The default page paths, as `true` resolves them. */
11
+ export declare const SHIFTS_DEFAULT_PAGES: {
12
+ readonly shifts: "/shifts";
13
+ readonly shift: "/shifts/:assignmentId";
14
+ readonly swaps: "/shifts/swaps";
15
+ readonly checkIn: "/shifts/check-in/:teamId";
16
+ readonly lead: "/shifts/lead/:teamId";
17
+ readonly station: "/shifts/station/:stationId";
18
+ };
19
+ /**
20
+ * Builds every link to a shifts page through `localize` (the active locale's prefix, see `useLocaleLink` of
21
+ * `@frigear-nu/ui`). A page that is turned off still gets a link on its default path; callers decide from `pages`.
22
+ */
23
+ export declare function createShiftsLinks(pages: ShiftsPages | undefined, localize: (path: string) => string): {
24
+ shifts: () => string;
25
+ shift: (assignmentId: string) => string;
26
+ swaps: () => string;
27
+ checkIn: (teamId: string) => string;
28
+ lead: (teamId: string) => string;
29
+ station: (stationId: string) => string;
30
+ };
@@ -0,0 +1,18 @@
1
+ export const SHIFTS_DEFAULT_PAGES = {
2
+ shifts: "/shifts",
3
+ shift: "/shifts/:assignmentId",
4
+ swaps: "/shifts/swaps",
5
+ checkIn: "/shifts/check-in/:teamId",
6
+ lead: "/shifts/lead/:teamId",
7
+ station: "/shifts/station/:stationId"
8
+ };
9
+ export function createShiftsLinks(pages, localize) {
10
+ return {
11
+ shifts: () => localize(pages?.shifts || SHIFTS_DEFAULT_PAGES.shifts),
12
+ shift: (assignmentId) => localize((pages?.shift || SHIFTS_DEFAULT_PAGES.shift).replace(":assignmentId", encodeURIComponent(assignmentId))),
13
+ swaps: () => localize(pages?.swaps || SHIFTS_DEFAULT_PAGES.swaps),
14
+ checkIn: (teamId) => localize((pages?.checkIn || SHIFTS_DEFAULT_PAGES.checkIn).replace(":teamId", encodeURIComponent(teamId))),
15
+ lead: (teamId) => localize((pages?.lead || SHIFTS_DEFAULT_PAGES.lead).replace(":teamId", encodeURIComponent(teamId))),
16
+ station: (stationId) => localize((pages?.station || SHIFTS_DEFAULT_PAGES.station).replace(":stationId", encodeURIComponent(stationId)))
17
+ };
18
+ }
@@ -0,0 +1,27 @@
1
+ /** The offsets reminders use unless the module sets its own: a day and two hours before a shift starts. */
2
+ export declare const DEFAULT_REMINDER_OFFSETS: readonly number[];
3
+ /** The longest offset: a week. */
4
+ export declare const MAX_REMINDER_OFFSET: number;
5
+ /** Cleans the `reminders.offsets` option: positive whole minutes up to a week, without duplicates, largest first. */
6
+ export declare function normalizeReminderOffsets(value: unknown): number[];
7
+ /** The offsets (minutes) whose moment, `startsAt` minus the offset, has passed while the shift still lies ahead. */
8
+ export declare function dueReminderOffsets(startsAt: Date, offsets: readonly number[], now: Date): number[];
9
+ /**
10
+ * The one offset to send when several are due at once (a late run, or a person assigned inside the window): the
11
+ * smallest, which is the closest to the shift. The larger ones are then spent without a message of their own.
12
+ */
13
+ export declare function reminderOffsetToSend(due: readonly number[]): number | undefined;
14
+ /** How many due assignments one reminder run handles unless `reminders.batchSize` says otherwise. */
15
+ export declare const DEFAULT_REMINDER_BATCH = 100;
16
+ /** The most one run may handle: a Workers invocation has a budget of subrequests, so a run stays small. */
17
+ export declare const MAX_REMINDER_BATCH = 1000;
18
+ /** Cleans the `reminders.batchSize` option: a whole number from 1 to 1000, else the default. */
19
+ export declare function normalizeReminderBatch(value: unknown): number;
20
+ /**
21
+ * The real time left, as the reminder words it: minutes below an hour, whole hours (rounded) below a day, whole days
22
+ * (rounded down) from there. The configured offset is when a reminder falls due, not how long is left when it is sent.
23
+ */
24
+ export declare function timeLeftBucket(startsAt: Date, now: Date): {
25
+ unit: 'minutes' | 'hours' | 'days';
26
+ count: number;
27
+ };
@@ -0,0 +1,28 @@
1
+ const MINUTE = 6e4;
2
+ export const DEFAULT_REMINDER_OFFSETS = [1440, 120];
3
+ export const MAX_REMINDER_OFFSET = 7 * 24 * 60;
4
+ export function normalizeReminderOffsets(value) {
5
+ if (!Array.isArray(value)) return [...DEFAULT_REMINDER_OFFSETS];
6
+ const offsets = value.map((item) => Math.round(Number(item))).filter((item) => Number.isFinite(item) && item > 0 && item <= MAX_REMINDER_OFFSET);
7
+ return [...new Set(offsets)].sort((a, b) => b - a);
8
+ }
9
+ export function dueReminderOffsets(startsAt, offsets, now) {
10
+ if (startsAt.getTime() <= now.getTime()) return [];
11
+ return offsets.filter((offset) => startsAt.getTime() - offset * MINUTE <= now.getTime());
12
+ }
13
+ export function reminderOffsetToSend(due) {
14
+ return due.length ? Math.min(...due) : void 0;
15
+ }
16
+ export const DEFAULT_REMINDER_BATCH = 100;
17
+ export const MAX_REMINDER_BATCH = 1e3;
18
+ export function normalizeReminderBatch(value) {
19
+ const size = Math.floor(Number(value));
20
+ return Number.isFinite(size) && size >= 1 ? Math.min(size, MAX_REMINDER_BATCH) : DEFAULT_REMINDER_BATCH;
21
+ }
22
+ export function timeLeftBucket(startsAt, now) {
23
+ const minutes = Math.max(1, Math.round((startsAt.getTime() - now.getTime()) / MINUTE));
24
+ if (minutes < 60) return { unit: "minutes", count: minutes };
25
+ const hours = Math.round(minutes / 60);
26
+ if (hours < 24) return { unit: "hours", count: hours };
27
+ return { unit: "days", count: Math.max(1, Math.floor(minutes / 1440)) };
28
+ }
@@ -0,0 +1,28 @@
1
+ import type { ShiftScheduleSettings, ShiftSwapKind } from '../../types.js';
2
+ export declare const SHIFT_COVERAGES: readonly ["all", "flexible"];
3
+ export declare const SHIFT_HANDOVERS: readonly ["trade", "release", "both"];
4
+ export declare const SHIFT_APPROVALS: readonly ["peer", "lead"];
5
+ export declare const SHIFT_SWAP_KINDS: readonly ["trade", "release"];
6
+ /** The settings of a new schedule: volunteers may give shifts away and trade them, and their agreement is enough. */
7
+ export declare const DEFAULT_SCHEDULE_SETTINGS: ShiftScheduleSettings;
8
+ /** Whether the settings fit together: with `coverage: 'all'` only `handover: 'trade'` is valid. */
9
+ export declare const validScheduleSettings: (settings: Pick<ShiftScheduleSettings, "coverage" | "handover">) => boolean;
10
+ /**
11
+ * Whether a schedule allows a kind of swap now. A `trade` keeps everybody's count, so it only needs `handover` `trade`
12
+ * or `both`. A `release` lowers the owner's count: it needs `coverage: 'flexible'` and `handover` `release` or `both`.
13
+ */
14
+ export declare function allowsSwapKind(settings: Pick<ShiftScheduleSettings, 'coverage' | 'handover'>, kind: ShiftSwapKind): boolean;
15
+ /** The kinds of swap a schedule allows now, `trade` first. */
16
+ export declare const allowedSwapKinds: (settings: Pick<ShiftScheduleSettings, "coverage" | "handover">) => ShiftSwapKind[];
17
+ /** The kind a swap opened without one gets: `release` when the schedule allows it, else `trade`. */
18
+ export declare const defaultSwapKind: (settings: Pick<ShiftScheduleSettings, "coverage" | "handover">) => ShiftSwapKind;
19
+ /** The kind of an offer: a shift in return makes it a trade, none takes a released shift over. */
20
+ export declare const offerKind: (offer: {
21
+ offeredAssignmentId?: string | null;
22
+ }) => ShiftSwapKind;
23
+ /** A schedule row's settings, typed. */
24
+ export declare const scheduleSettingsOf: (row: {
25
+ coverage: string;
26
+ handover: string;
27
+ approval: string;
28
+ }) => ShiftScheduleSettings;
@@ -0,0 +1,18 @@
1
+ export const SHIFT_COVERAGES = ["all", "flexible"];
2
+ export const SHIFT_HANDOVERS = ["trade", "release", "both"];
3
+ export const SHIFT_APPROVALS = ["peer", "lead"];
4
+ export const SHIFT_SWAP_KINDS = ["trade", "release"];
5
+ export const DEFAULT_SCHEDULE_SETTINGS = { coverage: "flexible", handover: "both", approval: "peer" };
6
+ export const validScheduleSettings = (settings) => settings.coverage !== "all" || settings.handover === "trade";
7
+ export function allowsSwapKind(settings, kind) {
8
+ if (kind === "trade") return settings.handover === "trade" || settings.handover === "both";
9
+ return settings.coverage === "flexible" && (settings.handover === "release" || settings.handover === "both");
10
+ }
11
+ export const allowedSwapKinds = (settings) => SHIFT_SWAP_KINDS.filter((kind) => allowsSwapKind(settings, kind));
12
+ export const defaultSwapKind = (settings) => allowsSwapKind(settings, "release") ? "release" : "trade";
13
+ export const offerKind = (offer) => offer.offeredAssignmentId ? "trade" : "release";
14
+ export const scheduleSettingsOf = (row) => ({
15
+ coverage: row.coverage,
16
+ handover: row.handover,
17
+ approval: row.approval
18
+ });
@@ -0,0 +1,9 @@
1
+ /** The shortest station key shifts accepts: station codes are signed with a key derived from it. */
2
+ export declare const SHIFTS_STATION_KEY_MIN_LENGTH = 32;
3
+ /**
4
+ * Why `value` cannot be the station key, or `undefined` when it can. An empty key is allowed (station check-in is then
5
+ * off); a set key must be at least {@link SHIFTS_STATION_KEY_MIN_LENGTH} characters once trimmed.
6
+ */
7
+ export declare function shiftsStationKeyIssue(value: unknown): string | undefined;
8
+ /** Throws the {@link shiftsStationKeyIssue} of `value`, if any. */
9
+ export declare function assertShiftsStationKey(value: unknown): void;
@@ -0,0 +1,12 @@
1
+ export const SHIFTS_STATION_KEY_MIN_LENGTH = 32;
2
+ export function shiftsStationKeyIssue(value) {
3
+ if (value === void 0 || value === null) return void 0;
4
+ if (typeof value !== "string") return "[shifts] NUXT_SHIFTS_STATION_KEY (`shifts.stationKey`) must be a string.";
5
+ const length = value.trim().length;
6
+ if (length === 0 || length >= SHIFTS_STATION_KEY_MIN_LENGTH) return void 0;
7
+ return `[shifts] NUXT_SHIFTS_STATION_KEY (\`shifts.stationKey\`) is ${length} characters long; it must be at least ${SHIFTS_STATION_KEY_MIN_LENGTH}. Use a long random value of its own, such as the output of \`openssl rand -base64 32\`, or leave it empty to turn station check-in off.`;
8
+ }
9
+ export function assertShiftsStationKey(value) {
10
+ const issue = shiftsStationKeyIssue(value);
11
+ if (issue) throw new Error(issue);
12
+ }
@@ -0,0 +1,23 @@
1
+ import type { ShiftAssignmentStatus, ShiftSwapOfferStatus, ShiftSwapStatus } from '../../types.js';
2
+ export declare const SHIFT_ASSIGNMENT_STATUSES: readonly ["assigned", "attended", "no_show", "cancelled"];
3
+ export declare const SHIFT_SWAP_STATUSES: readonly ["open", "offered", "accepted", "pending_approval", "completed", "rejected", "cancelled"];
4
+ export declare const SHIFT_SWAP_OFFER_STATUSES: readonly ["offered", "accepted", "rejected", "withdrawn", "superseded"];
5
+ export declare const SHIFT_ASSIGNMENT_STATUS_LABELS: Record<ShiftAssignmentStatus, string>;
6
+ export declare const SHIFT_SWAP_STATUS_LABELS: Record<ShiftSwapStatus, string>;
7
+ export declare const SHIFT_SWAP_OFFER_STATUS_LABELS: Record<ShiftSwapOfferStatus, string>;
8
+ /** The statuses that hold a place on the shift: they count towards the capacity and the guards. */
9
+ export declare const ACTIVE_ASSIGNMENT_STATUSES: readonly ["assigned", "attended"];
10
+ export declare const isActiveAssignment: (status: string) => boolean;
11
+ /** The moves of an assignment. A cancelled assignment stays cancelled (assign the person again instead). */
12
+ export declare const ASSIGNMENT_TRANSITIONS: Record<ShiftAssignmentStatus, readonly ShiftAssignmentStatus[]>;
13
+ export declare const canMoveAssignment: (from: ShiftAssignmentStatus, to: ShiftAssignmentStatus) => boolean;
14
+ /**
15
+ * The moves of a swap. `offered` goes back to `open` when the last offer is withdrawn or rejected. Accepting claims the
16
+ * swap (`accepted` in peer mode, `pending_approval` in approval mode); an approval claims it again (`accepted`) and the
17
+ * exchange completes it. An approver's rejection puts it back to `open`.
18
+ */
19
+ export declare const SWAP_TRANSITIONS: Record<ShiftSwapStatus, readonly ShiftSwapStatus[]>;
20
+ export declare const canMoveSwap: (from: ShiftSwapStatus, to: ShiftSwapStatus) => boolean;
21
+ /** The swaps still in play: one per assignment at a time. */
22
+ export declare const LIVE_SWAP_STATUSES: readonly ["open", "offered", "accepted", "pending_approval"];
23
+ export declare const isLiveSwap: (status: string) => boolean;
@@ -0,0 +1,46 @@
1
+ export const SHIFT_ASSIGNMENT_STATUSES = ["assigned", "attended", "no_show", "cancelled"];
2
+ export const SHIFT_SWAP_STATUSES = ["open", "offered", "accepted", "pending_approval", "completed", "rejected", "cancelled"];
3
+ export const SHIFT_SWAP_OFFER_STATUSES = ["offered", "accepted", "rejected", "withdrawn", "superseded"];
4
+ export const SHIFT_ASSIGNMENT_STATUS_LABELS = {
5
+ assigned: "Assigned",
6
+ attended: "Attended",
7
+ no_show: "No-show",
8
+ cancelled: "Cancelled"
9
+ };
10
+ export const SHIFT_SWAP_STATUS_LABELS = {
11
+ open: "Open",
12
+ offered: "Offers waiting",
13
+ accepted: "Accepted",
14
+ pending_approval: "Waiting for approval",
15
+ completed: "Completed",
16
+ rejected: "Rejected",
17
+ cancelled: "Cancelled"
18
+ };
19
+ export const SHIFT_SWAP_OFFER_STATUS_LABELS = {
20
+ offered: "Offered",
21
+ accepted: "Accepted",
22
+ rejected: "Rejected",
23
+ withdrawn: "Withdrawn",
24
+ superseded: "Not chosen"
25
+ };
26
+ export const ACTIVE_ASSIGNMENT_STATUSES = ["assigned", "attended"];
27
+ export const isActiveAssignment = (status) => ACTIVE_ASSIGNMENT_STATUSES.includes(status);
28
+ export const ASSIGNMENT_TRANSITIONS = {
29
+ assigned: ["attended", "no_show", "cancelled"],
30
+ attended: ["no_show"],
31
+ no_show: ["attended", "cancelled"],
32
+ cancelled: []
33
+ };
34
+ export const canMoveAssignment = (from, to) => ASSIGNMENT_TRANSITIONS[from].includes(to);
35
+ export const SWAP_TRANSITIONS = {
36
+ open: ["offered", "cancelled"],
37
+ offered: ["open", "accepted", "pending_approval", "cancelled"],
38
+ accepted: ["completed", "offered", "open", "pending_approval"],
39
+ pending_approval: ["accepted", "open", "cancelled"],
40
+ completed: [],
41
+ rejected: [],
42
+ cancelled: []
43
+ };
44
+ export const canMoveSwap = (from, to) => SWAP_TRANSITIONS[from].includes(to);
45
+ export const LIVE_SWAP_STATUSES = ["open", "offered", "accepted", "pending_approval"];
46
+ export const isLiveSwap = (status) => LIVE_SWAP_STATUSES.includes(status);
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The time zone shift times are entered and shown in: the `shifts.timeZone` override when set, else the app's
3
+ * (`appConfig.frigearUi.timeZone`), else `UTC`. Pass `useAppConfig()` (Vue) or `useAppConfig(event)` (Nitro).
4
+ */
5
+ export declare function resolveShiftsTimeZone(override: string | undefined | null, appConfig: unknown): string;
6
+ /**
7
+ * The start and end of one bulk slot on a day: an end at or before the start is on the next day (a night shift,
8
+ * `22:00`–`04:00`).
9
+ */
10
+ export declare function slotInstants(day: string, slot: {
11
+ start: string;
12
+ end: string;
13
+ }, timeZone: string): {
14
+ startsAt: Date;
15
+ endsAt: Date;
16
+ };
17
+ /** The whole days, hours and minutes left in a span, rounded up to the next minute (a countdown shows "1 min" until it is over). */
18
+ export declare function countdownParts(ms: number): {
19
+ days: number;
20
+ hours: number;
21
+ minutes: number;
22
+ };
@@ -0,0 +1,14 @@
1
+ import { addDays, zonedTimeToUtc } from "@frigear-nu/module-kit/time";
2
+ import { appTimeZoneOf } from "@frigear-nu/ui/utils";
3
+ export function resolveShiftsTimeZone(override, appConfig) {
4
+ return override || appTimeZoneOf(appConfig) || "UTC";
5
+ }
6
+ export function slotInstants(day, slot, timeZone) {
7
+ const startsAt = zonedTimeToUtc(day, slot.start, timeZone);
8
+ const endDay = slot.end <= slot.start ? addDays(day, 1) : day;
9
+ return { startsAt, endsAt: zonedTimeToUtc(endDay, slot.end, timeZone) };
10
+ }
11
+ export function countdownParts(ms) {
12
+ const total = Math.max(0, Math.ceil(ms / 6e4));
13
+ return { days: Math.floor(total / 1440), hours: Math.floor(total % 1440 / 60), minutes: total % 60 };
14
+ }
@@ -0,0 +1,5 @@
1
+ export { type Translated } from '@frigear-nu/ui/translated'
2
+
3
+ export { default } from './module.mjs'
4
+
5
+ export { type ModuleOptions, type MyShiftDetailDto, type MyShiftDto, type PublicModuleOptions, type ShiftApproval, type ShiftAssignResultDto, type ShiftAssigneeDto, type ShiftAssignmentChangedContext, type ShiftAssignmentDto, type ShiftAssignmentStatus, type ShiftAttendanceContext, type ShiftBroadcastAudience, type ShiftBroadcastContext, type ShiftBroadcastDto, type ShiftBroadcastResultDto, type ShiftCandidateDto, type ShiftChannel, type ShiftCheckInDto, type ShiftCheckInMethod, type ShiftCheckInMode, type ShiftCheckInRule, type ShiftCheckInSettings, type ShiftCheckInTeamSettings, type ShiftCopyResultDto, type ShiftCoverage, type ShiftCreatedContext, type ShiftDigestContext, type ShiftDto, type ShiftEarnedPerkContext, type ShiftEarnedPerkDto, type ShiftEarnedPerkListDto, type ShiftExceptionDto, type ShiftExceptionKind, type ShiftFeedStatusDto, type ShiftFeedTokenDto, type ShiftGuards, type ShiftHandover, type ShiftLocation, type ShiftPassDto, type ShiftPassPerkDto, type ShiftPerkDto, type ShiftPersonDto, type ShiftReminderContext, type ShiftRoleDto, type ShiftScheduleContext, type ShiftScheduleDto, type ShiftScheduleSettings, type ShiftScheduleStatus, type ShiftSelfCheckInDto, type ShiftSelfCheckInInput, type ShiftStationDto, type ShiftStationTokenDto, type ShiftSwapContext, type ShiftSwapDto, type ShiftSwapGuardCode, type ShiftSwapKind, type ShiftSwapOfferDto, type ShiftSwapOfferStatus, type ShiftSwapStatus, type ShiftUpdatedContext, type ShiftWarning, type ShiftWithAssigneesDto, type ShiftsAutomationOptions, type ShiftsLedTeamDto, type ShiftsMyNowDto, type ShiftsNowDto, type ShiftsOperationTeamDto, type ShiftsRemindersOptions, type ShiftsRuntimeConfig } from './module.mjs'
package/package.json CHANGED
@@ -1,6 +1,134 @@
1
1
  {
2
2
  "name": "@frigear-nu/shifts",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.0.0",
4
+ "description": "Shifts for the frigear ecosystem: schedules, shift roles, assignment, swaps, QR check-in and who is on shift now, per operation, built on crew and teams.",
5
+ "homepage": "https://docs.frigear.dev/modules/volunteering/shifts",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Frigear-nu/frigear-nu.git",
9
+ "directory": "packages/shifts"
10
+ },
11
+ "license": "MIT",
12
+ "type": "module",
13
+ "main": "./dist/module.mjs",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/types.d.mts",
17
+ "import": "./dist/module.mjs",
18
+ "default": "./dist/module.mjs"
19
+ },
20
+ "./utils": {
21
+ "types": "./dist/runtime/utils/index.d.ts",
22
+ "import": "./dist/runtime/utils/index.js",
23
+ "default": "./dist/runtime/utils/index.js"
24
+ },
25
+ "./api": {
26
+ "types": "./dist/runtime/utils/api.d.ts",
27
+ "import": "./dist/runtime/utils/api.js",
28
+ "default": "./dist/runtime/utils/api.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "workspaces": [
35
+ "playground"
36
+ ],
37
+ "dependencies": {
38
+ "@frigear-nu/auth": "^0.6.4",
39
+ "@frigear-nu/crew": "^0.0.0",
40
+ "@frigear-nu/maps": "^0.0.0",
41
+ "@frigear-nu/module-kit": "^1.3.7",
42
+ "@frigear-nu/notify": "^0.2.6",
43
+ "@frigear-nu/operations": "^0.0.0",
44
+ "@frigear-nu/teams": "^0.0.0",
45
+ "@frigear-nu/ui": "^0.2.7",
46
+ "@frigear-nu/users": "^3.1.2",
47
+ "@libsql/client": "^0.18.0",
48
+ "@nuxt/kit": "^4.6.4",
49
+ "@vueuse/core": "^15.0.0",
50
+ "drizzle-kit": "^0.31.11",
51
+ "drizzle-orm": "^0.45.4",
52
+ "h3": "^1.15.11",
53
+ "uqr": "^0.1.3",
54
+ "vue-qrcode-reader": "^5.7.3",
55
+ "zod": "^4.6.7"
56
+ },
57
+ "peerDependencies": {
58
+ "@frigear-nu/admin": "^0.5.0",
59
+ "@frigear-nu/dashboard": "^0.0.0",
60
+ "@frigear-nu/email-templates": "^0.1.1",
61
+ "@frigear-nu/menu": "^0.4.0",
62
+ "@frigear-nu/mobile": "^0.6.2",
63
+ "@frigear-nu/widget": "^0.4.0",
64
+ "@nuxt/ui": "^4.12.0",
65
+ "@nuxthub/core": "^0.10.12"
66
+ },
67
+ "peerDependenciesMeta": {
68
+ "@frigear-nu/admin": {
69
+ "optional": true
70
+ },
71
+ "@frigear-nu/dashboard": {
72
+ "optional": true
73
+ },
74
+ "@frigear-nu/email-templates": {
75
+ "optional": true
76
+ },
77
+ "@frigear-nu/menu": {
78
+ "optional": true
79
+ },
80
+ "@frigear-nu/mobile": {
81
+ "optional": true
82
+ },
83
+ "@frigear-nu/widget": {
84
+ "optional": true
85
+ },
86
+ "@nuxt/ui": {
87
+ "optional": true
88
+ }
89
+ },
90
+ "devDependencies": {
91
+ "@frigear-nu/admin": "^0.5.0",
92
+ "@frigear-nu/dashboard": "^0.0.0",
93
+ "@frigear-nu/email-templates": "^0.1.1",
94
+ "@frigear-nu/forms": "^0.5.0",
95
+ "@frigear-nu/menu": "^0.4.0",
96
+ "@frigear-nu/mobile": "^0.6.2",
97
+ "@frigear-nu/preferences": "^0.3.1",
98
+ "@frigear-nu/push": "^0.1.0",
99
+ "@frigear-nu/widget": "^0.4.0",
100
+ "@nuxt/devtools": "^4.2.0",
101
+ "@nuxt/eslint-config": "^1.17.0",
102
+ "@nuxt/module-builder": "^1.0.4",
103
+ "@nuxt/schema": "^4.6.4",
104
+ "@nuxt/test-utils": "^4.4.0",
105
+ "@nuxt/ui": "^4.12.0",
106
+ "@nuxthub/core": "^0.10.12",
107
+ "@types/node": "^26.6.6",
108
+ "eslint": "^10.15.0",
109
+ "nuxt": "^4.6.4",
110
+ "typescript": "^6.0.3",
111
+ "unstorage": "^1.17.5",
112
+ "vitest": "^5.1.0",
113
+ "vue-tsc": "^3.3.14"
114
+ },
115
+ "scripts": {
116
+ "dev:stub": "nuxt-module-build build --stub && nuxt prepare",
117
+ "build": "nuxt-module-build build",
118
+ "dev": "npm run dev:prepare && nuxt dev playground",
119
+ "dev:build": "nuxt build playground",
120
+ "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxt prepare playground",
121
+ "lint": "eslint .",
122
+ "lint:fix": "eslint . --fix",
123
+ "test": "vitest run",
124
+ "test:watch": "vitest watch",
125
+ "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit"
126
+ },
127
+ "typesVersions": {
128
+ "*": {
129
+ ".": [
130
+ "./dist/types.d.mts"
131
+ ]
132
+ }
133
+ }
6
134
  }