@royalschedule/maps 4.0.14 → 4.0.16

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 (348) hide show
  1. package/dist/Additio/from/courses.js.map +1 -1
  2. package/dist/Additio/from/events.js.map +1 -1
  3. package/dist/Additio/from/groups.js.map +1 -1
  4. package/dist/Additio/from/index.js.map +1 -1
  5. package/dist/Additio/from/locations.js.map +1 -1
  6. package/dist/Additio/from/persons.js.map +1 -1
  7. package/dist/Additio/from/schedules.d.ts +7 -6
  8. package/dist/Additio/from/schedules.js +2 -4
  9. package/dist/Additio/from/schedules.js.map +1 -1
  10. package/dist/Additio/from/teachers.js.map +1 -1
  11. package/dist/Additio/to/index.d.ts +11 -9
  12. package/dist/Additio/to/schedules.js +2 -4
  13. package/dist/Additio/to/schedules.js.map +1 -1
  14. package/dist/Admentum/from/courses.js.map +1 -1
  15. package/dist/Admentum/from/events.js.map +1 -1
  16. package/dist/Admentum/from/groups.js.map +1 -1
  17. package/dist/Admentum/from/index.js.map +1 -1
  18. package/dist/Admentum/from/locations.js.map +1 -1
  19. package/dist/Admentum/from/persons.js.map +1 -1
  20. package/dist/Admentum/from/schedules.d.ts +7 -6
  21. package/dist/Admentum/from/schedules.js +2 -4
  22. package/dist/Admentum/from/schedules.js.map +1 -1
  23. package/dist/Admentum/from/teachers.js.map +1 -1
  24. package/dist/Admentum/to/index.d.ts +9 -8
  25. package/dist/Admentum/to/schedules.js +4 -7
  26. package/dist/Admentum/to/schedules.js.map +1 -1
  27. package/dist/Excel/index.d.ts +263 -26
  28. package/dist/Excel/v1/from/index.js +2 -1
  29. package/dist/Excel/v1/from/index.js.map +1 -1
  30. package/dist/Excel/v1/index.d.ts +218 -20
  31. package/dist/Excel/v2/from/index.js +49 -57
  32. package/dist/Excel/v2/from/index.js.map +1 -1
  33. package/dist/Excel/v2/index.d.ts +263 -26
  34. package/dist/IdunSoft/from/courses.js.map +1 -1
  35. package/dist/IdunSoft/from/events.js +1 -2
  36. package/dist/IdunSoft/from/events.js.map +1 -1
  37. package/dist/IdunSoft/from/groups.js.map +1 -1
  38. package/dist/IdunSoft/from/index.js.map +1 -1
  39. package/dist/IdunSoft/from/locations.js.map +1 -1
  40. package/dist/IdunSoft/from/schedules.d.ts +6 -5
  41. package/dist/IdunSoft/from/schedules.js.map +1 -1
  42. package/dist/IdunSoft/from/teachers.js.map +1 -1
  43. package/dist/IdunSoft/to/index.d.ts +2 -1
  44. package/dist/IdunSoft/to/schedules.js +5 -8
  45. package/dist/IdunSoft/to/schedules.js.map +1 -1
  46. package/dist/InfoMentor/to/index.d.ts +2 -1
  47. package/dist/InfoMentor/to/schedules.js +3 -4
  48. package/dist/InfoMentor/to/schedules.js.map +1 -1
  49. package/dist/PlanDigital/from/index.js.map +1 -1
  50. package/dist/PlanDigital/from/schedules.js +9 -11
  51. package/dist/PlanDigital/from/schedules.js.map +1 -1
  52. package/dist/PlanDigital/index.d.ts +74 -59
  53. package/dist/Quiculum/file/to/index.d.ts +10 -9
  54. package/dist/Quiculum/file/to/schedules.js +5 -9
  55. package/dist/Quiculum/file/to/schedules.js.map +1 -1
  56. package/dist/RS/from/division.d.ts +2 -1
  57. package/dist/RS/from/division.js +9 -6
  58. package/dist/RS/from/division.js.map +1 -1
  59. package/dist/RS/from/index.js.map +1 -1
  60. package/dist/RS/from/schedules.d.ts +2 -1
  61. package/dist/RS/from/schedules.js +2 -1
  62. package/dist/RS/from/schedules.js.map +1 -1
  63. package/dist/RS/make-connected.d.ts +17 -16
  64. package/dist/RS/make-connected.js +63 -96
  65. package/dist/RS/make-connected.js.map +1 -1
  66. package/dist/RS/to/index.js.map +1 -1
  67. package/dist/RS/to/initial-configuration.js +4 -6
  68. package/dist/RS/to/initial-configuration.js.map +1 -1
  69. package/dist/RS/to/input/collections.js.map +1 -1
  70. package/dist/RS/to/input/default.js +1 -2
  71. package/dist/RS/to/input/default.js.map +1 -1
  72. package/dist/RS/to/input/dependencies.js +1 -3
  73. package/dist/RS/to/input/dependencies.js.map +1 -1
  74. package/dist/RS/to/input/dynamic-locked-times.js +1 -2
  75. package/dist/RS/to/input/dynamic-locked-times.js.map +1 -1
  76. package/dist/RS/to/input/events.js +5 -3
  77. package/dist/RS/to/input/events.js.map +1 -1
  78. package/dist/RS/to/input/groups.js.map +1 -1
  79. package/dist/RS/to/input/individuals.js +2 -3
  80. package/dist/RS/to/input/individuals.js.map +1 -1
  81. package/dist/RS/to/input/input.js +1 -3
  82. package/dist/RS/to/input/input.js.map +1 -1
  83. package/dist/RS/to/input/intervals.js +2 -4
  84. package/dist/RS/to/input/intervals.js.map +1 -1
  85. package/dist/RS/to/input/periods.js +6 -8
  86. package/dist/RS/to/input/periods.js.map +1 -1
  87. package/dist/RS/to/input/settings.js.map +1 -1
  88. package/dist/RS/to/input/teachers.js.map +1 -1
  89. package/dist/RS/to/input/util/attach-locked-times.js.map +1 -1
  90. package/dist/RS/to/input/util/parse-days.js.map +1 -1
  91. package/dist/RS/to/input/util/parse-group-references.js.map +1 -1
  92. package/dist/RS/to/input/util/parse-intervals.js +2 -4
  93. package/dist/RS/to/input/util/parse-intervals.js.map +1 -1
  94. package/dist/RS/to/input/util/parse-location-references.js +1 -2
  95. package/dist/RS/to/input/util/parse-location-references.js.map +1 -1
  96. package/dist/RS/to/input/util/parse-max-working-hours.js.map +1 -1
  97. package/dist/RS/to/input/util/parse-minimum-break-length.js.map +1 -1
  98. package/dist/RS/to/input/util/util.js +1 -2
  99. package/dist/RS/to/input/util/util.js.map +1 -1
  100. package/dist/RS/to/schedules.js +3 -2
  101. package/dist/RS/to/schedules.js.map +1 -1
  102. package/dist/RS/types/to.d.ts +13 -3
  103. package/dist/RS/types/to.js +6 -0
  104. package/dist/RS/types/to.js.map +1 -0
  105. package/dist/SS12000/from/activities.js +1 -2
  106. package/dist/SS12000/from/activities.js.map +1 -1
  107. package/dist/SS12000/from/calendar-events.js.map +1 -1
  108. package/dist/SS12000/from/duties.js.map +1 -1
  109. package/dist/SS12000/from/groups.js.map +1 -1
  110. package/dist/SS12000/from/index.js.map +1 -1
  111. package/dist/SS12000/from/persons.js.map +1 -1
  112. package/dist/SS12000/from/resources.js.map +1 -1
  113. package/dist/SS12000/from/rooms.js.map +1 -1
  114. package/dist/SS12000/from/syllabuses.js.map +1 -1
  115. package/dist/SS12000/index.d.ts +12567 -9
  116. package/dist/SS12000/to/activities.js.map +1 -1
  117. package/dist/SS12000/to/calendar-events.js.map +1 -1
  118. package/dist/SS12000/to/common.js.map +1 -1
  119. package/dist/SS12000/to/duties.js.map +1 -1
  120. package/dist/SS12000/to/groups.js.map +1 -1
  121. package/dist/SS12000/to/index.d.ts +17 -16
  122. package/dist/SS12000/to/persons.js.map +1 -1
  123. package/dist/SS12000/to/resources.js.map +1 -1
  124. package/dist/SS12000/to/rooms.js.map +1 -1
  125. package/dist/SS12000/to/syllabuses.js.map +1 -1
  126. package/dist/SchoolSoft/api/from/index.js.map +1 -1
  127. package/dist/SchoolSoft/api/from/schedules.js +8 -12
  128. package/dist/SchoolSoft/api/from/schedules.js.map +1 -1
  129. package/dist/SchoolSoft/api/index.d.ts +444 -9
  130. package/dist/SchoolSoft/file/from/index.js.map +1 -1
  131. package/dist/SchoolSoft/file/from/schedules.js +83 -87
  132. package/dist/SchoolSoft/file/from/schedules.js.map +1 -1
  133. package/dist/SchoolSoft/file/index.d.ts +2 -1
  134. package/dist/SchoolSoft/file/to/index.d.ts +3 -2
  135. package/dist/SchoolSoft/file/to/schedules.js +1 -2
  136. package/dist/SchoolSoft/file/to/schedules.js.map +1 -1
  137. package/dist/SchoolSoft/index.d.ts +2 -1
  138. package/dist/Schoolity/txt/to/index.d.ts +2 -1
  139. package/dist/Schoolity/txt/to/schedules.js +5 -12
  140. package/dist/Schoolity/txt/to/schedules.js.map +1 -1
  141. package/dist/Skola24/mdb/from/course-and-events.js +3 -5
  142. package/dist/Skola24/mdb/from/course-and-events.js.map +1 -1
  143. package/dist/Skola24/mdb/from/groups.js.map +1 -1
  144. package/dist/Skola24/mdb/from/index.js.map +1 -1
  145. package/dist/Skola24/mdb/from/locations.js.map +1 -1
  146. package/dist/Skola24/mdb/from/schedule.d.ts +6 -5
  147. package/dist/Skola24/mdb/from/schedule.js.map +1 -1
  148. package/dist/Skola24/mdb/from/teachers.js.map +1 -1
  149. package/dist/Skola24/txt/from/calendar-exceptions.js +1 -2
  150. package/dist/Skola24/txt/from/calendar-exceptions.js.map +1 -1
  151. package/dist/Skola24/txt/from/division.js.map +1 -1
  152. package/dist/Skola24/txt/from/index.js.map +1 -1
  153. package/dist/Skola24/txt/from/period.js +31 -34
  154. package/dist/Skola24/txt/from/period.js.map +1 -1
  155. package/dist/Skola24/txt/from/schedules.d.ts +9 -8
  156. package/dist/Skola24/txt/from/schedules.js +10 -12
  157. package/dist/Skola24/txt/from/schedules.js.map +1 -1
  158. package/dist/Skola24/txt/from/util.js.map +1 -1
  159. package/dist/Skola24/txt/index.d.ts +2 -1
  160. package/dist/Skola24/txt/to/index.d.ts +2 -1
  161. package/dist/Skola24/txt/to/schedules.js +5 -12
  162. package/dist/Skola24/txt/to/schedules.js.map +1 -1
  163. package/dist/common/constants.js.map +1 -1
  164. package/dist/common/functions.js +46 -10
  165. package/dist/common/functions.js.map +1 -1
  166. package/dist/common/get-date.js.map +1 -1
  167. package/dist/common/make-chainable/index.js.map +1 -1
  168. package/dist/common/types.d.ts +3 -6
  169. package/dist/core/from/configurations.js.map +1 -1
  170. package/dist/core/from/courses.js.map +1 -1
  171. package/dist/core/from/events.js +1 -1
  172. package/dist/core/from/events.js.map +1 -1
  173. package/dist/core/from/exceptions.js.map +1 -1
  174. package/dist/core/from/groups.js.map +1 -1
  175. package/dist/core/from/index.js +9 -6
  176. package/dist/core/from/index.js.map +1 -1
  177. package/dist/core/from/locations.js.map +1 -1
  178. package/dist/core/from/locked-times.js.map +1 -1
  179. package/dist/core/from/overlap-groups.js.map +1 -1
  180. package/dist/core/from/periods.js.map +1 -1
  181. package/dist/core/from/persons.js.map +1 -1
  182. package/dist/core/from/root-intervals.js.map +1 -1
  183. package/dist/core/from/schedules.js.map +1 -1
  184. package/dist/core/from/syllabuses.js.map +1 -1
  185. package/dist/core/from/teachers.js.map +1 -1
  186. package/dist/core/index.d.ts +24 -1
  187. package/dist/core/index.js +4 -0
  188. package/dist/core/index.js.map +1 -1
  189. package/dist/core/interfaces/index.d.ts +23 -0
  190. package/dist/core/interfaces/index.js +6 -0
  191. package/dist/core/interfaces/other/companies.d.ts +132 -0
  192. package/dist/core/interfaces/other/companies.js +9 -0
  193. package/dist/core/interfaces/other/companies.js.map +1 -0
  194. package/dist/core/interfaces/other/etc.d.ts +19 -0
  195. package/dist/core/interfaces/other/index.d.ts +6 -0
  196. package/dist/core/interfaces/other/integrations.d.ts +17 -0
  197. package/dist/core/interfaces/other/operations.d.ts +36 -0
  198. package/dist/core/interfaces/other/policies.d.ts +31 -0
  199. package/dist/core/interfaces/other/sync-logs.d.ts +21 -0
  200. package/dist/core/interfaces/other/users.d.ts +35 -0
  201. package/dist/core/interfaces/vertices/companies.d.ts +8 -0
  202. package/dist/core/interfaces/vertices/configurations.d.ts +58 -0
  203. package/dist/core/interfaces/vertices/courses.d.ts +68 -0
  204. package/dist/core/{types → interfaces/vertices}/division-settings.d.ts +31 -29
  205. package/dist/core/interfaces/vertices/divisions.d.ts +31 -0
  206. package/dist/core/interfaces/vertices/events.d.ts +100 -0
  207. package/dist/core/interfaces/vertices/exceptions.d.ts +74 -0
  208. package/dist/core/interfaces/vertices/generations.d.ts +23 -0
  209. package/dist/core/interfaces/vertices/groups.d.ts +53 -0
  210. package/dist/core/interfaces/vertices/index.d.ts +209 -0
  211. package/dist/core/interfaces/vertices/index.js +3 -0
  212. package/dist/core/interfaces/vertices/locations.d.ts +22 -0
  213. package/dist/core/interfaces/vertices/locked-times.d.ts +37 -0
  214. package/dist/core/interfaces/vertices/overlap-groups.d.ts +17 -0
  215. package/dist/core/interfaces/vertices/periods.d.ts +15 -0
  216. package/dist/core/interfaces/vertices/persons.d.ts +32 -0
  217. package/dist/core/interfaces/vertices/properties/belongs-to.d.ts +11 -0
  218. package/dist/core/interfaces/vertices/properties/coalesced.d.ts +8 -0
  219. package/dist/core/interfaces/vertices/properties/days.d.ts +9 -0
  220. package/dist/core/interfaces/vertices/properties/index.d.ts +15 -0
  221. package/dist/core/interfaces/vertices/properties/intervals.d.ts +10 -0
  222. package/dist/core/{types/common → interfaces/vertices/properties}/maximum-schedule-span.d.ts +1 -1
  223. package/dist/core/interfaces/vertices/properties/min-break-length.d.ts +5 -0
  224. package/dist/core/{types/common/planned-schedule-duration.d.ts → interfaces/vertices/properties/planned-scheduled-duration.d.ts} +2 -2
  225. package/dist/core/interfaces/vertices/properties/species.d.ts +9 -0
  226. package/dist/core/interfaces/vertices/properties/tags.d.ts +9 -0
  227. package/dist/core/interfaces/vertices/properties/week.d.ts +22 -0
  228. package/dist/core/interfaces/vertices/properties/week.js +6 -0
  229. package/dist/core/interfaces/vertices/properties/week.js.map +1 -0
  230. package/dist/core/interfaces/vertices/root-intervals.d.ts +14 -0
  231. package/dist/core/interfaces/vertices/syllabuses.d.ts +18 -0
  232. package/dist/core/interfaces/vertices/teachers.d.ts +43 -0
  233. package/dist/core/interfaces/vertices/users.d.ts +8 -0
  234. package/dist/core/interfaces/vertices/util/common.d.ts +28 -0
  235. package/dist/core/interfaces/vertices/util/custom-vertex-export/index.d.ts +31 -0
  236. package/dist/core/interfaces/vertices/util/custom-vertex-export/util.d.ts +51 -0
  237. package/dist/core/interfaces/vertices/util/deep-vertex-export/index.d.ts +64 -0
  238. package/dist/core/interfaces/vertices/util/edges.d.ts +105 -0
  239. package/dist/core/interfaces/vertices/util/index.d.ts +5 -0
  240. package/dist/core/interfaces/vertices/util/keys-of.d.ts +27 -0
  241. package/dist/core/interfaces/vertices/util/serialized-vertex-export.d.ts +12 -0
  242. package/dist/core/interfaces/vertices/util/util.d.ts +76 -0
  243. package/dist/core/interfaces/vertices/util/vertex-query/index.d.ts +44 -0
  244. package/dist/core/interfaces/vertices/util/vertex-query/util.d.ts +13 -0
  245. package/dist/core/interfaces/vertices/util/vertex.d.ts +70 -0
  246. package/dist/core/interfaces/vertices/vertex-query.d.ts +102 -0
  247. package/dist/core/interfaces/vertices/vertex-query.js +94 -0
  248. package/dist/core/interfaces/vertices/vertex-query.js.map +1 -0
  249. package/dist/core/to/configurations.js +2 -3
  250. package/dist/core/to/configurations.js.map +1 -1
  251. package/dist/core/to/courses.js +2 -3
  252. package/dist/core/to/courses.js.map +1 -1
  253. package/dist/core/to/division.js.map +1 -1
  254. package/dist/core/to/events.js +2 -3
  255. package/dist/core/to/events.js.map +1 -1
  256. package/dist/core/to/exceptions.js +4 -4
  257. package/dist/core/to/exceptions.js.map +1 -1
  258. package/dist/core/to/groups.js +2 -3
  259. package/dist/core/to/groups.js.map +1 -1
  260. package/dist/core/to/locations.js +2 -3
  261. package/dist/core/to/locations.js.map +1 -1
  262. package/dist/core/to/locked-times.js +2 -3
  263. package/dist/core/to/locked-times.js.map +1 -1
  264. package/dist/core/to/overlap-groups.js +2 -3
  265. package/dist/core/to/overlap-groups.js.map +1 -1
  266. package/dist/core/to/periods.js +2 -3
  267. package/dist/core/to/periods.js.map +1 -1
  268. package/dist/core/to/persons.js +3 -9
  269. package/dist/core/to/persons.js.map +1 -1
  270. package/dist/core/to/root-intervals.js +2 -3
  271. package/dist/core/to/root-intervals.js.map +1 -1
  272. package/dist/core/to/schedules.d.ts +17 -18
  273. package/dist/core/to/schedules.js.map +1 -1
  274. package/dist/core/to/settings.js +2 -3
  275. package/dist/core/to/settings.js.map +1 -1
  276. package/dist/core/to/syllabuses.js +2 -3
  277. package/dist/core/to/syllabuses.js.map +1 -1
  278. package/dist/core/to/teachers.js +4 -4
  279. package/dist/core/to/teachers.js.map +1 -1
  280. package/dist/core/to/util.d.ts +4 -8
  281. package/dist/core/to/util.js +7 -5
  282. package/dist/core/to/util.js.map +1 -1
  283. package/dist/core/types/common/index.d.ts +4 -41
  284. package/dist/core/types/index.d.ts +108 -112
  285. package/dist/core/util.js +4 -5
  286. package/dist/core/util.js.map +1 -1
  287. package/dist/identify/constants/index.d.ts +1 -1
  288. package/dist/identify/constants/index.js +2 -1
  289. package/dist/identify/constants/index.js.map +1 -1
  290. package/dist/identify/index.js +9 -3
  291. package/dist/identify/index.js.map +1 -1
  292. package/dist/index.d.ts +23 -1
  293. package/dist/index.js +4 -1
  294. package/dist/sdui/from/classes.js.map +1 -1
  295. package/dist/sdui/from/courses.js.map +1 -1
  296. package/dist/sdui/from/holidays.js.map +1 -1
  297. package/dist/sdui/from/index.js.map +1 -1
  298. package/dist/sdui/from/lessons.js +4 -0
  299. package/dist/sdui/from/lessons.js.map +1 -1
  300. package/dist/sdui/from/rooms.js.map +1 -1
  301. package/dist/sdui/from/schedules.d.ts +10 -8
  302. package/dist/sdui/from/schedules.js.map +1 -1
  303. package/dist/sdui/from/school-years.js +0 -1
  304. package/dist/sdui/from/school-years.js.map +1 -1
  305. package/dist/sdui/from/substitution-plans.js.map +1 -1
  306. package/dist/sdui/from/teachers.js.map +1 -1
  307. package/dist/sdui/index.d.ts +1 -1
  308. package/dist/sdui/to/classes.js.map +1 -1
  309. package/dist/sdui/to/courses.js.map +1 -1
  310. package/dist/sdui/to/holidays.js.map +1 -1
  311. package/dist/sdui/to/hours.js.map +1 -1
  312. package/dist/sdui/to/index.d.ts +12 -10
  313. package/dist/sdui/to/lessons.js.map +1 -1
  314. package/dist/sdui/to/rooms.js.map +1 -1
  315. package/dist/sdui/to/schedules.js.map +1 -1
  316. package/dist/sdui/to/school-years.js.map +1 -1
  317. package/dist/sdui/to/substitution-plans.js +3 -6
  318. package/dist/sdui/to/substitution-plans.js.map +1 -1
  319. package/dist/sdui/to/teachers.js.map +1 -1
  320. package/dist/vKlass/from/index.js.map +1 -1
  321. package/dist/vKlass/from/schedule.d.ts +4 -3
  322. package/dist/vKlass/from/schedule.js +2 -2
  323. package/dist/vKlass/from/schedule.js.map +1 -1
  324. package/dist/vKlass/to/schedules.d.ts +4 -4
  325. package/dist/vKlass/to/schedules.js +6 -17
  326. package/dist/vKlass/to/schedules.js.map +1 -1
  327. package/package.json +24 -22
  328. package/dist/core/types/areas.d.ts +0 -10
  329. package/dist/core/types/common/break-lengths.d.ts +0 -5
  330. package/dist/core/types/common/days.d.ts +0 -8
  331. package/dist/core/types/common/intervals.d.ts +0 -20
  332. package/dist/core/types/common/tag.d.ts +0 -9
  333. package/dist/core/types/configurations.d.ts +0 -31
  334. package/dist/core/types/courses.d.ts +0 -60
  335. package/dist/core/types/divisions.d.ts +0 -24
  336. package/dist/core/types/events.d.ts +0 -56
  337. package/dist/core/types/exceptions.d.ts +0 -35
  338. package/dist/core/types/groups.d.ts +0 -44
  339. package/dist/core/types/locations.d.ts +0 -27
  340. package/dist/core/types/locked-times.d.ts +0 -33
  341. package/dist/core/types/overlap-groups.d.ts +0 -14
  342. package/dist/core/types/periods.d.ts +0 -14
  343. package/dist/core/types/persons.d.ts +0 -38
  344. package/dist/core/types/root-intervals.d.ts +0 -13
  345. package/dist/core/types/schedules.d.ts +0 -44
  346. package/dist/core/types/syllabus.d.ts +0 -18
  347. package/dist/core/types/teachers.d.ts +0 -44
  348. package/dist/core/vertex-mapping.d.ts +0 -69
@@ -27,23 +27,11 @@ function makeConnected(schedule, options = {}) {
27
27
  const personsMap = indexCollection(schedule.persons ?? [], idKey);
28
28
  const lockedTimesMap = indexCollection(schedule.lockedTimes ?? [], idKey);
29
29
  const rootIntervalsMap = indexCollection(schedule.rootIntervals ?? [], idKey);
30
- const division = (() => {
31
- const vertex = {
32
- _id: true,
33
- id: true,
34
- ids: true,
35
- createdAt: true,
36
- updatedAt: true,
37
- lastModifiedBy: true
38
- };
39
- const vertexKeys = Object.keys(vertex);
40
- return pick(_division, [
41
- ...vertexKeys,
42
- "displayName",
43
- "start",
44
- "end"
45
- ]);
46
- })();
30
+ const division = pick(_division, [
31
+ "displayName",
32
+ "start",
33
+ "end"
34
+ ]);
47
35
  const settings = (() => {
48
36
  const edges = {
49
37
  period: _settings.period != null ? periodsMap.get(getVertexId(_settings.period, idKey)) : _settings.period,
@@ -59,6 +47,10 @@ function makeConnected(schedule, options = {}) {
59
47
  if (!x) return x;
60
48
  return x.map((x$1) => lockedTimesMap.get(getVertexId(x$1, idKey))).filter(nonNullable);
61
49
  };
50
+ const getComplementaryTimes = (x) => {
51
+ if (!x) return x;
52
+ return x.map((x$1) => lockedTimesMap.get(getVertexId(x$1, idKey))).filter(nonNullable);
53
+ };
62
54
  const locations = (schedule.locations ?? []).map((x) => {
63
55
  const edges = {
64
56
  lockedTimes: getLockedTimes(x.lockedTimes),
@@ -81,45 +73,42 @@ function makeConnected(schedule, options = {}) {
81
73
  const edges = {
82
74
  lockedTimes: getLockedTimes(x.lockedTimes),
83
75
  lunch: getLunch(x.lunch),
76
+ complementaryTimes: getComplementaryTimes(x.complementaryTimes),
84
77
  person: x.person != null ? personsMap.get(getVertexId(x.person, idKey)) : x.person,
85
78
  rootInterval: x.rootInterval != null ? rootIntervalsMap.get(getVertexId(x.rootInterval, idKey)) : x.rootInterval
86
79
  };
87
80
  return Object.assign(x, edges);
88
81
  });
89
82
  const persons = (schedule.persons ?? []).map((x) => {
90
- const edges = {
91
- lockedTimes: getLockedTimes(x.lockedTimes),
92
- lunch: getLunch(x.lunch),
93
- group: x.group != null ? groupsMap.get(getVertexId(x.group, idKey)) : x.group
94
- };
83
+ const edges = { group: x.group != null ? groupsMap.get(getVertexId(x.group, idKey)) : x.group };
95
84
  return Object.assign(x, edges);
96
85
  });
97
86
  const periods = (schedule.periods ?? []).map((x) => {
98
- const edges = {};
99
- return Object.assign(x, edges);
87
+ return Object.assign(x, {});
100
88
  });
101
89
  const rootIntervals = (schedule.rootIntervals ?? []).map((x) => {
102
- const edges = {};
103
- return Object.assign(x, edges);
90
+ return Object.assign(x, {});
104
91
  });
105
- const makeCoalesced = (map$1, id, toModel) => {
92
+ const makeCoalesced = (map$1, id, toModel, extra) => {
106
93
  const to = map$1.get(id);
107
94
  if (!to) return;
108
95
  return {
96
+ ...extra,
109
97
  to,
110
98
  toModel
111
99
  };
112
100
  };
113
101
  const lockedTimes = (schedule.lockedTimes ?? []).map((x) => {
114
102
  const edges = { coalesced: x.coalesced ? x.coalesced.map((x$1) => {
115
- switch (x$1.toModel) {
116
- case "groups": return makeCoalesced(groupsMap, getVertexId(x$1.to, idKey), x$1.toModel);
117
- case "teachers": return makeCoalesced(teachersMap, getVertexId(x$1.to, idKey), x$1.toModel);
118
- case "courses": return makeCoalesced(coursesMap, getVertexId(x$1.to, idKey), x$1.toModel);
119
- case "events": return makeCoalesced(eventsMap, getVertexId(x$1.to, idKey), x$1.toModel);
103
+ const toModel = x$1.toModel;
104
+ switch (toModel) {
105
+ case "groups": return makeCoalesced(groupsMap, getVertexId(x$1.to, idKey), toModel);
106
+ case "teachers": return makeCoalesced(teachersMap, getVertexId(x$1.to, idKey), toModel);
107
+ case "locations": return makeCoalesced(locationsMap, getVertexId(x$1.to, idKey), toModel);
108
+ case "courses": return makeCoalesced(coursesMap, getVertexId(x$1.to, idKey), toModel);
109
+ case "events": return makeCoalesced(eventsMap, getVertexId(x$1.to, idKey), toModel);
120
110
  case "courseevents": return makeCoalesced(eventsMap, getVertexId(x$1.to, idKey), "events");
121
- case "locations": return makeCoalesced(locationsMap, getVertexId(x$1.to, idKey), x$1.toModel);
122
- default: throw new Error(`Unknown coalesced model "${x$1.toModel}" in locked time ${JSON.stringify(x$1)}`);
111
+ default: throw new Error(`Unknown coalesced model "${toModel}" in locked time ${JSON.stringify(x$1)}`);
123
112
  }
124
113
  }).filter(nonNullable) : x.coalesced };
125
114
  return Object.assign(x, edges);
@@ -127,33 +116,17 @@ function makeConnected(schedule, options = {}) {
127
116
  const overlapGroups = (schedule.overlapGroups ?? []).map((x) => {
128
117
  const edges = {
129
118
  coalesced: x.coalesced ? x.coalesced.map((x$1) => {
130
- const to = (() => {
131
- switch (x$1.toModel) {
132
- case "courses": return coursesMap.get(getVertexId(x$1.to, idKey));
133
- default: throw new Error(`Unknown coalesced model "${x$1.toModel}" in overlap group ${JSON.stringify(x$1)}`);
134
- }
135
- })();
136
- if (!to) return;
137
- const coalesced = {
138
- ...x$1,
139
- to
140
- };
141
- return coalesced;
119
+ switch (x$1.toModel) {
120
+ case "courses": return makeCoalesced(coursesMap, getVertexId(x$1.to, idKey), x$1.toModel);
121
+ default: throw new Error(`Unknown coalesced model "${x$1.toModel}" in overlap group ${JSON.stringify(x$1)}`);
122
+ }
142
123
  }).filter(nonNullable) : x.coalesced,
143
124
  species: x.species ? x.species.map((x$1) => {
144
- const to = (() => {
145
- switch (x$1.toModel) {
146
- case "events": return eventsMap.get(getVertexId(x$1.to, idKey));
147
- case "courseevents": return eventsMap.get(getVertexId(x$1.to, idKey));
148
- default: throw new Error(`Unknown species model "${x$1.toModel}" in overlap group ${JSON.stringify(x$1)}`);
149
- }
150
- })();
151
- if (!to) return;
152
- const species = {
153
- ...x$1,
154
- to
155
- };
156
- return species;
125
+ switch (x$1.toModel) {
126
+ case "events": return makeCoalesced(eventsMap, getVertexId(x$1.to, idKey), x$1.toModel, x$1);
127
+ case "courseevents": return makeCoalesced(eventsMap, getVertexId(x$1.to, idKey), "events", x$1);
128
+ default: throw new Error(`Unknown species model "${x$1.toModel}" in overlap group ${JSON.stringify(x$1)}`);
129
+ }
157
130
  }).filter(nonNullable) : x.species
158
131
  };
159
132
  return Object.assign(x, edges);
@@ -163,11 +136,10 @@ function makeConnected(schedule, options = {}) {
163
136
  return x.map((x$1) => {
164
137
  const to = personsMap.get(getVertexId(x$1.to, idKey));
165
138
  if (!to) return;
166
- const participant = {
139
+ return {
167
140
  ...x$1,
168
141
  to
169
142
  };
170
- return participant;
171
143
  }).filter(nonNullable);
172
144
  };
173
145
  const getTeachers = (x) => {
@@ -175,11 +147,10 @@ function makeConnected(schedule, options = {}) {
175
147
  return x.map((x$1) => {
176
148
  const to = teachersMap.get(getVertexId(x$1.to, idKey));
177
149
  if (!to) return;
178
- const participant = {
150
+ return {
179
151
  ...x$1,
180
152
  to
181
153
  };
182
- return participant;
183
154
  }).filter(nonNullable);
184
155
  };
185
156
  const getLocations = (x) => {
@@ -187,11 +158,10 @@ function makeConnected(schedule, options = {}) {
187
158
  return x.map((x$1) => {
188
159
  const locations$1 = x$1.locations.map((x$2) => locationsMap.get(getVertexId(x$2, idKey))).filter(nonNullable);
189
160
  if (locations$1.length != 1) throw new Error(`(RS::MakeConnected) Expected exactly one location in available locations, got ${locations$1.length} and before filtering: ${x$1.locations.map((x$2) => getVertexId(x$2, idKey)).join(", ")}`);
190
- const availableLocation = {
161
+ return {
191
162
  ...x$1,
192
163
  locations: locations$1
193
164
  };
194
- return availableLocation;
195
165
  }).filter(nonNullable);
196
166
  };
197
167
  const getGroups = (x) => {
@@ -200,41 +170,13 @@ function makeConnected(schedule, options = {}) {
200
170
  const to = groupsMap.get(getVertexId(x$1.to, idKey));
201
171
  if (!to) return;
202
172
  const exclude = x$1.exclude ? x$1.exclude.map((x$2) => personsMap.get(getVertexId(x$2, idKey))).filter(nonNullable) : void 0;
203
- const group = {
173
+ return {
204
174
  ...x$1,
205
175
  to,
206
176
  exclude
207
177
  };
208
- return group;
209
178
  }).filter(nonNullable);
210
179
  };
211
- const courses = (schedule.courses ?? []).map((x) => {
212
- const edges = {
213
- groups: getGroups(x.groups),
214
- teachers: getTeachers(x.teachers),
215
- locations: getLocations(x.locations),
216
- participants: getParticipants(x.participants),
217
- lockedTimes: getLockedTimes(x.lockedTimes),
218
- events: x.events ? x.events.map((x$1) => eventsMap.get(getVertexId(x$1, idKey))).filter(nonNullable) : x.events,
219
- period: x.period != null ? periodsMap.get(getVertexId(x.period, idKey)) : x.period,
220
- overlapGroup: x.overlapGroup != null ? overlapGroupsMap.get(getVertexId(x.overlapGroup, idKey)) : x.overlapGroup
221
- };
222
- return Object.assign(x, edges);
223
- });
224
- const events = (schedule.events ?? []).map((x) => {
225
- const edges = {
226
- groups: getGroups(x.groups),
227
- teachers: getTeachers(x.teachers),
228
- locations: getLocations(x.locations),
229
- participants: getParticipants(x.participants),
230
- lockedTimes: getLockedTimes(x.lockedTimes),
231
- inLocations: x.inLocations ? x.inLocations.map((x$1) => x$1 === null ? null : locationsMap.get(getVertexId(x$1, idKey))).filter((x$1) => x$1 !== void 0) : x.inLocations,
232
- course: x.course != null ? coursesMap.get(getVertexId(x.course, idKey)) : x.course,
233
- period: x.period != null ? periodsMap.get(getVertexId(x.period, idKey)) : x.period,
234
- overlapSpecies: x.overlapSpecies != null ? overlapGroupsMap.get(getVertexId(x.overlapSpecies, idKey)) : x.overlapSpecies
235
- };
236
- return Object.assign(x, edges);
237
- });
238
180
  return {
239
181
  division,
240
182
  settings,
@@ -246,8 +188,33 @@ function makeConnected(schedule, options = {}) {
246
188
  rootIntervals,
247
189
  lockedTimes,
248
190
  overlapGroups,
249
- courses,
250
- events
191
+ courses: (schedule.courses ?? []).map((x) => {
192
+ const edges = {
193
+ groups: getGroups(x.groups),
194
+ teachers: getTeachers(x.teachers),
195
+ locations: getLocations(x.locations),
196
+ participants: getParticipants(x.participants),
197
+ lockedTimes: getLockedTimes(x.lockedTimes),
198
+ events: x.events ? x.events.map((x$1) => eventsMap.get(getVertexId(x$1, idKey))).filter(nonNullable) : x.events,
199
+ period: x.period != null ? periodsMap.get(getVertexId(x.period, idKey)) : x.period,
200
+ overlapGroup: x.overlapGroup != null ? overlapGroupsMap.get(getVertexId(x.overlapGroup, idKey)) : x.overlapGroup
201
+ };
202
+ return Object.assign(x, edges);
203
+ }),
204
+ events: (schedule.events ?? []).map((x) => {
205
+ const edges = {
206
+ groups: getGroups(x.groups),
207
+ teachers: getTeachers(x.teachers),
208
+ locations: getLocations(x.locations),
209
+ participants: getParticipants(x.participants),
210
+ lockedTimes: getLockedTimes(x.lockedTimes),
211
+ inLocations: x.inLocations ? x.inLocations.map((x$1) => x$1 === null ? null : locationsMap.get(getVertexId(x$1, idKey))).filter((x$1) => x$1 !== void 0) : x.inLocations,
212
+ course: x.course != null ? coursesMap.get(getVertexId(x.course, idKey)) : x.course,
213
+ period: x.period != null ? periodsMap.get(getVertexId(x.period, idKey)) : x.period,
214
+ overlapSpecies: x.overlapSpecies != null ? overlapGroupsMap.get(getVertexId(x.overlapSpecies, idKey)) : x.overlapSpecies
215
+ };
216
+ return Object.assign(x, edges);
217
+ })
251
218
  };
252
219
  }
253
220
 
@@ -1 +1 @@
1
- {"version":3,"file":"make-connected.js","names":["vertex: Record<keyof Required<Intersect<Vertex>>, unknown>","edges: ExtractEdges<DivisionSettings>","x","edges: ExtractEdges<Location>","edges: ExtractEdges<Group>","edges: ExtractEdges<Teacher>","edges: ExtractEdges<Person>","edges: ExtractEdges<Period>","edges: ExtractEdges<RootInterval>","map","edges: ExtractEdges<LockedTime>","edges: ExtractEdges<OverlapGroup>","coalesced: Coalesced<typeof to, (typeof x)['toModel']>","species: Species<typeof to, (typeof x)['toModel']>","participant: PersonReference<Person>","locations","availableLocation: AvailableLocation<Location>","group: GroupReference<Group, Person>","edges: ExtractEdges<Course>","edges: ExtractEdges<Event>"],"sources":["../../src/RS/make-connected.ts"],"sourcesContent":["import { pick } from 'lodash-es';\nimport { getIdKey, getVertexId } from '../core/util';\nimport type { ExtractEdges, Mixed } from '../core/vertex-mapping';\nimport type { CoreTypes } from '../core';\nimport type { AvailableLocation, Coalesced, Collection, GroupReference, IdKey, InternalIdKey, PersonReference, Species, Vertex } from '../core/types/common';\nimport type { Types } from './types';\nimport type { Intersect } from '../common/types';\n\ntype OmitProperties<T extends Vertex> = Omit<T, 'belongsTo' | 'exceptions' | 'defaultLunch' | 'syllabus' | InternalIdKey> & Vertex;\n\ntype _Schedule = {\n division: Mixed<CoreTypes.division>;\n divisions: Mixed<CoreTypes.division>;\n settings: Mixed<CoreTypes.divisionSettings>;\n groups: Mixed<CoreTypes.group>[];\n teachers: Mixed<CoreTypes.teacher>[];\n locations: Mixed<CoreTypes.location>[];\n periods: Mixed<CoreTypes.period>[];\n persons: Mixed<CoreTypes.person>[];\n rootIntervals: Mixed<CoreTypes.rootInterval>[];\n lockedTimes: Mixed<CoreTypes.lockedTime>[];\n overlapGroups: Mixed<CoreTypes.overlapGroup>[];\n courses: Mixed<CoreTypes.course>[];\n events: Mixed<CoreTypes.event>[];\n};\nexport type MixedScheduleData = Partial<_Schedule>;\n\ntype Division = Vertex & Pick<CoreTypes.division, 'displayName' | 'start' | 'end'>;\ntype DivisionSettings = OmitProperties<CoreTypes.divisionSettings>;\ntype Location = OmitProperties<CoreTypes.location>;\ntype Group = OmitProperties<CoreTypes.group>;\ntype Teacher = OmitProperties<CoreTypes.teacher>;\ntype Person = OmitProperties<CoreTypes.person>;\ntype Period = OmitProperties<CoreTypes.period>;\ntype RootInterval = OmitProperties<CoreTypes.rootInterval>;\ntype LockedTime = OmitProperties<CoreTypes.lockedTime>;\ntype OverlapGroup = OmitProperties<CoreTypes.overlapGroup>;\ntype Course = OmitProperties<CoreTypes.course>;\ntype Event = OmitProperties<CoreTypes.event>;\n\nexport namespace ConnectedTypes {\n export type division = Division;\n export type divisionSettings = DivisionSettings;\n export type location = Location;\n export type group = Group;\n export type teacher = Teacher;\n export type person = Person;\n export type period = Period;\n export type rootInterval = RootInterval;\n export type lockedTime = LockedTime;\n export type overlapGroup = OverlapGroup;\n export type course = Course;\n export type event = Event;\n}\n\nexport type ConnectedScheduleData = {\n division: Division;\n settings: DivisionSettings;\n groups: Group[];\n teachers: Teacher[];\n locations: Location[];\n periods: Period[];\n persons: Person[];\n rootIntervals: RootInterval[];\n lockedTimes: LockedTime[];\n overlapGroups: OverlapGroup[];\n courses: Course[];\n events: Event[];\n};\n\n\nfunction indexCollection<T extends Vertex> (collection: Mixed<T>[], idKey: IdKey): Map<string, T> {\n return new Map(collection.map(x => ([getVertexId(x, idKey), x as T] as const)));\n}\nfunction nonNullable<T> (value: T | null | undefined): value is T {\n return value != null;\n}\n\n/**\n * Connects the schedule data by replacing references with actual objects making it easier to work with.\n */\nexport function makeConnected (\n schedule: MixedScheduleData,\n options: Pick<Types.toOptions, 'idKey'> = {}\n): ConnectedScheduleData {\n const _division = schedule.divisions ?? schedule.division;\n if (!_division) throw new Error(`\"division\" or \"divisions\" missing in schedule, present keys: ${Object.keys(schedule).join(', ')}`);\n const _settings = schedule.settings;\n if (!_settings) throw new Error(`\"settings\" missing in schedule, present keys: ${Object.keys(schedule).join(', ')}`);\n\n const idKey = getIdKey(options);\n\n const groupsMap = indexCollection(schedule.groups ?? [], idKey);\n const teachersMap = indexCollection(schedule.teachers ?? [], idKey);\n const locationsMap = indexCollection(schedule.locations ?? [], idKey);\n const coursesMap = indexCollection(schedule.courses ?? [], idKey);\n const eventsMap = indexCollection(schedule.events ?? [], idKey);\n const overlapGroupsMap = indexCollection(schedule.overlapGroups ?? [], idKey);\n const periodsMap = indexCollection(schedule.periods ?? [], idKey);\n const personsMap = indexCollection(schedule.persons ?? [], idKey);\n const lockedTimesMap = indexCollection(schedule.lockedTimes ?? [], idKey);\n const rootIntervalsMap = indexCollection(schedule.rootIntervals ?? [], idKey);\n\n const division = ((): Division => {\n const vertex: Record<keyof Required<Intersect<Vertex>>, unknown> = {\n _id: true,\n id: true,\n ids: true,\n createdAt: true,\n updatedAt: true,\n lastModifiedBy: true\n };\n const vertexKeys = Object.keys(vertex) as (keyof typeof vertex)[];\n return pick(_division, [...vertexKeys, 'displayName', 'start', 'end']) as Division;\n })();\n\n const settings = ((): DivisionSettings => {\n const edges: ExtractEdges<DivisionSettings> = {\n period: _settings.period != null ? periodsMap .get(getVertexId(_settings.period, idKey)) : _settings.period,\n defaultRootInterval: _settings.defaultRootInterval != null ? rootIntervalsMap.get(getVertexId(_settings.defaultRootInterval, idKey)) : _settings.defaultRootInterval,\n } satisfies Record<keyof ExtractEdges<DivisionSettings>, unknown>;\n return Object.assign(_settings, edges);\n })();\n\n const getLockedTimes = <T extends Mixed<CoreTypes.group>['lockedTimes'] | undefined | null>(x: T): LockedTime[] | Extract<T, null | undefined> => {\n if (!x) return x as Extract<T, null | undefined>;\n return x.map(x => lockedTimesMap.get(getVertexId(x, idKey))).filter(nonNullable);\n };\n const getLunch = <T extends Mixed<CoreTypes.group>['lockedTimes'] | undefined | null>(x: T): LockedTime[] | Extract<T, null | undefined> => {\n if (!x) return x as Extract<T, null | undefined>;\n return x.map(x => lockedTimesMap.get(getVertexId(x, idKey))).filter(nonNullable);\n };\n\n const locations = (schedule.locations ?? [])\n .map((x): Location => {\n const edges: ExtractEdges<Location> = {\n lockedTimes: getLockedTimes(x.lockedTimes),\n lunch: getLunch(x.lunch),\n } satisfies Record<keyof ExtractEdges<Location>, unknown>;\n return Object.assign(x, edges);\n });\n\n const groups = (schedule.groups ?? [])\n .map((x): Group => {\n const edges: ExtractEdges<Group> = {\n lockedTimes: getLockedTimes(x.lockedTimes),\n lunch: getLunch (x.lunch),\n members: x.members ? x.members .map(x => personsMap.get(getVertexId(x, idKey))).filter(nonNullable) : x.members,\n parentGroups: x.parentGroups ? x.parentGroups.map(x => groupsMap .get(getVertexId(x, idKey))).filter(nonNullable) : x.parentGroups,\n subGroups: x.subGroups ? x.subGroups .map(x => groupsMap .get(getVertexId(x, idKey))).filter(nonNullable) : x.subGroups,\n\n rootInterval: x.rootInterval != null ? rootIntervalsMap.get(getVertexId(x.rootInterval, idKey)) : x.rootInterval,\n } satisfies Record<keyof ExtractEdges<Group>, unknown>;\n return Object.assign(x, edges);\n });\n\n const teachers = (schedule.teachers ?? [])\n .map((x): Teacher => {\n const edges: ExtractEdges<Teacher> = {\n lockedTimes: getLockedTimes(x.lockedTimes),\n lunch: getLunch(x.lunch),\n\n person: x.person != null ? personsMap .get(getVertexId(x.person, idKey)) : x.person,\n rootInterval: x.rootInterval != null ? rootIntervalsMap.get(getVertexId(x.rootInterval, idKey)) : x.rootInterval,\n } satisfies Record<keyof ExtractEdges<Teacher>, unknown>;\n return Object.assign(x, edges);\n });\n\n const persons = (schedule.persons ?? [])\n .map((x): Person => {\n const edges: ExtractEdges<Person> = {\n lockedTimes: getLockedTimes(x.lockedTimes),\n lunch: getLunch(x.lunch),\n\n group: x.group != null ? groupsMap.get(getVertexId(x.group, idKey)) : x.group,\n } satisfies Record<keyof ExtractEdges<Person>, unknown>;\n return Object.assign(x, edges);\n });\n\n const periods = (schedule.periods ?? [])\n .map((x): Period => {\n const edges: ExtractEdges<Period> = {\n } satisfies Record<keyof ExtractEdges<Period>, unknown>;\n return Object.assign(x, edges);\n });\n\n const rootIntervals = (schedule.rootIntervals ?? [])\n .map((x): RootInterval => {\n const edges: ExtractEdges<RootInterval> = {\n } satisfies Record<keyof ExtractEdges<RootInterval>, unknown>;\n return Object.assign(x, edges);\n });\n\n const makeCoalesced = <T extends Vertex, C extends Collection> (map: Map<string, T>, id: string, toModel: C) => {\n const to = map.get(id);\n if (!to) return;\n return { to, toModel } as Coalesced<T, C>;\n };\n\n const lockedTimes = (schedule.lockedTimes ?? [])\n .map((x): LockedTime => {\n const edges: ExtractEdges<LockedTime> = {\n coalesced: x.coalesced\n ? x.coalesced\n .map(x => {\n switch (x.toModel) {\n case 'groups': return makeCoalesced(groupsMap, getVertexId(x.to, idKey), x.toModel);\n case 'teachers': return makeCoalesced(teachersMap, getVertexId(x.to, idKey), x.toModel);\n case 'courses': return makeCoalesced(coursesMap, getVertexId(x.to, idKey), x.toModel);\n case 'events': return makeCoalesced(eventsMap, getVertexId(x.to, idKey), x.toModel);\n case 'courseevents': return makeCoalesced(eventsMap, getVertexId(x.to, idKey), 'events');\n case 'locations': return makeCoalesced(locationsMap, getVertexId(x.to, idKey), x.toModel);\n // case 'persons': return makeCoalesced(personsMap, getVertexId(x.to, idKey), x.toModel);\n default: throw new Error(`Unknown coalesced model \"${x.toModel satisfies never as string}\" in locked time ${JSON.stringify(x)}`);\n }\n })\n .filter(nonNullable)\n : x.coalesced,\n } satisfies Record<keyof ExtractEdges<LockedTime>, unknown>;\n return Object.assign(x, edges);\n });\n\n const overlapGroups = (schedule.overlapGroups ?? [])\n .map((x): OverlapGroup => {\n const edges: ExtractEdges<OverlapGroup> = {\n coalesced: x.coalesced\n ? x.coalesced\n .map(x => {\n const to = (() => {\n switch (x.toModel) {\n case 'courses': return coursesMap.get(getVertexId(x.to, idKey));\n default: throw new Error(`Unknown coalesced model \"${x.toModel satisfies never as string}\" in overlap group ${JSON.stringify(x)}`);\n }\n })();\n if (!to) return;\n const coalesced: Coalesced<typeof to, (typeof x)['toModel']> = { ...x, to };\n return coalesced;\n })\n .filter(nonNullable)\n : x.coalesced,\n species: x.species\n ? x.species\n .map(x => {\n const to = (() => {\n switch (x.toModel) {\n case 'events': return eventsMap.get(getVertexId(x.to, idKey));\n case 'courseevents': return eventsMap.get(getVertexId(x.to, idKey));\n default: throw new Error(`Unknown species model \"${x.toModel satisfies never as string}\" in overlap group ${JSON.stringify(x)}`);\n }\n })();\n if (!to) return;\n const species: Species<typeof to, (typeof x)['toModel']> = { ...x, to };\n return species;\n })\n .filter(nonNullable)\n : x.species,\n } satisfies Record<keyof ExtractEdges<OverlapGroup>, unknown>;\n return Object.assign(x, edges);\n });\n\n const getParticipants = (x: Mixed<CoreTypes.course>['participants'] | Mixed<CoreTypes.event>['participants']): PersonReference<Person>[] | undefined => {\n if (!x) return undefined;\n return x\n .map(x => {\n const to = personsMap.get(getVertexId(x.to, idKey));\n if (!to) return;\n const participant: PersonReference<Person> = { ...x, to };\n return participant;\n })\n .filter(nonNullable);\n };\n const getTeachers = (x: Mixed<CoreTypes.course>['teachers'] | Mixed<CoreTypes.event>['teachers']): PersonReference<Person>[] | undefined => {\n if (!x) return undefined;\n return x\n .map(x => {\n const to = teachersMap.get(getVertexId(x.to, idKey));\n if (!to) return;\n const participant: PersonReference<Person> = { ...x, to };\n return participant;\n })\n .filter(nonNullable);\n };\n const getLocations = (x: Mixed<CoreTypes.course>['locations'] | Mixed<CoreTypes.event>['locations']): AvailableLocation<Location>[] | undefined => {\n if (!x) return undefined;\n return x\n .map(x => {\n const locations = x.locations\n .map(x => locationsMap.get(getVertexId(x, idKey)))\n .filter(nonNullable);\n if (locations.length != 1) throw new Error(`(RS::MakeConnected) Expected exactly one location in available locations, got ${locations.length} and before filtering: ${x.locations.map(x => getVertexId(x, idKey)).join(', ')}`);\n const availableLocation: AvailableLocation<Location> = { ...x, locations: locations as [Location] };\n return availableLocation;\n })\n .filter(nonNullable);\n };\n const getGroups = (x: Mixed<CoreTypes.course>['groups'] | Mixed<CoreTypes.event>['groups']): GroupReference<Group, Person>[] | undefined => {\n if (!x) return undefined;\n return x\n .map(x => {\n const to = groupsMap.get(getVertexId(x.to, idKey));\n if (!to) return;\n const exclude = x.exclude\n ? x.exclude\n .map(x => personsMap.get(getVertexId(x, idKey)))\n .filter(nonNullable)\n : undefined;\n const group: GroupReference<Group, Person> = { ...x, to, exclude };\n return group;\n })\n .filter(nonNullable);\n };\n\n const courses = (schedule.courses ?? [])\n .map((x): Course => {\n const edges: ExtractEdges<Course> = {\n groups: getGroups (x.groups),\n teachers: getTeachers (x.teachers),\n locations: getLocations (x.locations),\n participants: getParticipants(x.participants),\n lockedTimes: getLockedTimes (x.lockedTimes),\n events: x.events ? x.events .map(x => eventsMap .get(getVertexId(x, idKey))).filter(nonNullable) : x.events,\n\n period: x.period != null ? periodsMap .get(getVertexId(x.period, idKey)) : x.period,\n overlapGroup: x.overlapGroup != null ? overlapGroupsMap.get(getVertexId(x.overlapGroup, idKey)) : x.overlapGroup,\n } satisfies Record<keyof ExtractEdges<Course>, unknown>;\n return Object.assign(x, edges);\n });\n\n const events = (schedule.events ?? [])\n .map((x): Event => {\n const edges: ExtractEdges<Event> = {\n groups: getGroups (x.groups),\n teachers: getTeachers (x.teachers),\n locations: getLocations (x.locations),\n participants: getParticipants(x.participants),\n lockedTimes: getLockedTimes (x.lockedTimes),\n inLocations: x.inLocations\n ? x.inLocations\n .map(x => x === null ? null : locationsMap.get(getVertexId(x, idKey)))\n .filter((x): x is Exclude<typeof x, undefined> => x !== undefined)\n : x.inLocations,\n\n course: x.course != null ? coursesMap .get(getVertexId(x.course, idKey)) : x.course,\n period: x.period != null ? periodsMap .get(getVertexId(x.period, idKey)) : x.period,\n overlapSpecies: x.overlapSpecies != null ? overlapGroupsMap.get(getVertexId(x.overlapSpecies, idKey)) : x.overlapSpecies,\n } satisfies Record<keyof ExtractEdges<Event>, unknown>;\n return Object.assign(x, edges);\n });\n\n\n return {\n division,\n settings,\n locations,\n groups,\n teachers,\n persons,\n periods,\n rootIntervals,\n lockedTimes,\n overlapGroups,\n courses,\n events\n };\n}"],"mappings":";;;;AAuEA,SAAS,gBAAmC,YAAwB,OAA8B;AAChG,QAAO,IAAI,IAAI,WAAW,KAAI,MAAM,CAAC,YAAY,GAAG,QAAQ;;AAE9D,SAAS,YAAgB,OAAyC;AAChE,QAAO,SAAS;;;;;AAMlB,SAAgB,cACd,UACA,UAA2C,IACpB;CACvB,MAAM,YAAY,SAAS,aAAa,SAAS;AACjD,KAAI,CAAC,UAAW,OAAM,IAAI,MAAM,gEAAgE,OAAO,KAAK,UAAU,KAAK;CAC3H,MAAM,YAAY,SAAS;AAC3B,KAAI,CAAC,UAAW,OAAM,IAAI,MAAM,iDAAiD,OAAO,KAAK,UAAU,KAAK;CAE5G,MAAM,QAAQ,SAAS;CAEvB,MAAM,YAAmB,gBAAgB,SAAS,UAAiB,IAAI;CACvE,MAAM,cAAmB,gBAAgB,SAAS,YAAiB,IAAI;CACvE,MAAM,eAAmB,gBAAgB,SAAS,aAAiB,IAAI;CACvE,MAAM,aAAmB,gBAAgB,SAAS,WAAiB,IAAI;CACvE,MAAM,YAAmB,gBAAgB,SAAS,UAAiB,IAAI;CACvE,MAAM,mBAAmB,gBAAgB,SAAS,iBAAiB,IAAI;CACvE,MAAM,aAAmB,gBAAgB,SAAS,WAAiB,IAAI;CACvE,MAAM,aAAmB,gBAAgB,SAAS,WAAiB,IAAI;CACvE,MAAM,iBAAmB,gBAAgB,SAAS,eAAiB,IAAI;CACvE,MAAM,mBAAmB,gBAAgB,SAAS,iBAAiB,IAAI;CAEvE,MAAM,kBAA4B;EAChC,MAAM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,QAAc,UAAgB,EAAE;GAChC,UAAc,YAAgB,EAAE;GAChC,WAAc,aAAgB,EAAE;GAChC,cAAc,gBAAgB,EAAE;GAChC,aAAc,eAAgB,EAAE;GAChC,QAAc,EAAE,SAAe,EAAE,OAAY,KAAI,QAAK,UAAe,IAAI,YAAYhB,KAAG,SAAS,OAAO,eAAe,EAAE;GAEzH,QAAc,EAAE,UAAgB,OAAO,WAAiB,IAAI,YAAY,EAAE,QAAc,UAAU,EAAE;GACpG,cAAc,EAAE,gBAAgB,OAAO,iBAAiB,IAAI,YAAY,EAAE,cAAc,UAAU,EAAE;;AAEtG,SAAO,OAAO,OAAO,GAAG;;CAG5B,MAAM,UAAU,SAAS,UAAU,IAChC,KAAK,MAAa;EACjB,MAAMiB,QAA6B;GACjC,QAAc,UAAgB,EAAE;GAChC,UAAc,YAAgB,EAAE;GAChC,WAAc,aAAgB,EAAE;GAChC,cAAc,gBAAgB,EAAE;GAChC,aAAc,eAAgB,EAAE;GAChC,aAAc,EAAE,cACZ,EAAE,YACD,KAAI,QAAKjB,QAAM,OAAO,OAAO,aAAa,IAAI,YAAYA,KAAG,SAC7D,QAAQ,QAAyCA,QAAM,UACxD,EAAE;GAEN,QAAgB,EAAE,UAAkB,OAAO,WAAiB,IAAI,YAAY,EAAE,QAAgB,UAAU,EAAE;GAC1G,QAAgB,EAAE,UAAkB,OAAO,WAAiB,IAAI,YAAY,EAAE,QAAgB,UAAU,EAAE;GAC1G,gBAAgB,EAAE,kBAAkB,OAAO,iBAAiB,IAAI,YAAY,EAAE,gBAAgB,UAAU,EAAE;;AAE5G,SAAO,OAAO,OAAO,GAAG;;AAI5B,QAAO;EACL;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA"}
1
+ {"version":3,"file":"make-connected.js","names":["division: Division","edges: DeepVertexEdgesOnlyExport<DivisionSettingsVertex>","x","edges: DeepVertexEdgesOnlyExport<LocationVertex>","edges: DeepVertexEdgesOnlyExport<GroupVertex>","edges: DeepVertexEdgesOnlyExport<TeacherVertex>","edges: DeepVertexEdgesOnlyExport<PersonVertex>","map","edges: DeepVertexEdgesOnlyExport<LockedTimeVertex>","edges: DeepVertexEdgesOnlyExport<OverlapGroupVertex>","locations","edges: DeepVertexEdgesOnlyExport<CourseVertex>","edges: DeepVertexEdgesOnlyExport<EventVertex>"],"sources":["../../src/RS/make-connected.ts"],"sourcesContent":["import { pick } from 'lodash-es';\nimport { getIdKey, getVertexId } from '../core/util';\nimport type { CoreTypes } from '../core';\nimport type { IdKey, InternalIdKey } from '../core/types/common';\nimport type { Types } from './types';\nimport type { PickEdges } from '../core/interfaces/vertices/util/common';\nimport type { Mixed } from '../core/interfaces/vertices/';\nimport type { Vertex, Collection } from '../core/interfaces/vertices/util/vertex';\nimport type { Coalesced } from '../core/interfaces/vertices/util/edges';\nimport type { DeepVertexExport } from '../core/interfaces/vertices/util';\nimport type { DivisionSettingsVertex } from '../core/interfaces/vertices/division-settings';\nimport type { LocationVertex } from '../core/interfaces/vertices/locations';\nimport type { GroupVertex } from '../core/interfaces/vertices/groups';\nimport type { TeacherVertex } from '../core/interfaces/vertices/teachers';\nimport type { PersonVertex } from '../core/interfaces/vertices/persons';\nimport type { PeriodVertex } from '../core/interfaces/vertices/periods';\nimport type { RootIntervalVertex } from '../core/interfaces/vertices/root-intervals';\nimport type { LockedTimeVertex } from '../core/interfaces/vertices/locked-times';\nimport type { OverlapGroupVertex } from '../core/interfaces/vertices/overlap-groups';\nimport type { CourseVertex } from '../core/interfaces/vertices/courses';\nimport type { EventVertex } from '../core/interfaces/vertices/events';\nimport type { MixedVertexExport } from '../core/interfaces/vertices/util/deep-vertex-export';\n\n\ntype IgnoredEdges =\n | 'belongsTo'\n | 'exceptions'\n | 'derivedParentGroups'\n | 'syllabus'\n | 'defaultLunch'\n | InternalIdKey;\n\ntype OmitProperties<T> = Omit<T, IgnoredEdges>;\n\ntype _Schedule = {\n division: Mixed.Division;\n divisions: Mixed.Division;\n settings: Mixed.Settings;\n groups: Mixed.Group[];\n teachers: Mixed.Teacher[];\n locations: Mixed.Location[];\n periods: Mixed.Period[];\n persons: Mixed.Person[];\n rootIntervals: Mixed.RootInterval[];\n lockedTimes: Mixed.LockedTime[];\n overlapGroups: Mixed.OverlapGroup[];\n courses: Mixed.Course[];\n events: Mixed.Event[];\n};\nexport type MixedScheduleData = Partial<_Schedule>;\n\ntype Division = Pick<CoreTypes.Deep.Division, 'displayName' | 'start' | 'end'>;\ntype DivisionSettings = CoreTypes.Deep.Settings;\ntype Location = CoreTypes.Deep.Location;\ntype Group = CoreTypes.Deep.Group;\ntype Teacher = CoreTypes.Deep.Teacher;\ntype Person = CoreTypes.Deep.Person;\ntype Period = CoreTypes.Deep.Period;\ntype RootInterval = CoreTypes.Deep.RootInterval;\ntype LockedTime = CoreTypes.Deep.LockedTime;\ntype OverlapGroup = CoreTypes.Deep.OverlapGroup;\ntype Course = CoreTypes.Deep.Course;\ntype Event = CoreTypes.Deep.Event;\n\nexport namespace ConnectedTypes {\n export type division = OmitProperties<Division>;\n export type divisionSettings = OmitProperties<DivisionSettings>;\n export type location = OmitProperties<Location>;\n export type group = OmitProperties<Group>;\n export type teacher = OmitProperties<Teacher>;\n export type person = OmitProperties<Person>;\n export type period = OmitProperties<Period>;\n export type rootInterval = OmitProperties<RootInterval>;\n export type lockedTime = OmitProperties<LockedTime>;\n export type overlapGroup = OmitProperties<OverlapGroup>;\n export type course = OmitProperties<Course>;\n export type event = OmitProperties<Event>;\n}\n\nexport type ConnectedScheduleData = {\n division: ConnectedTypes.division;\n settings: ConnectedTypes.divisionSettings;\n groups: ConnectedTypes.group[];\n teachers: ConnectedTypes.teacher[];\n locations: ConnectedTypes.location[];\n periods: ConnectedTypes.period[];\n persons: ConnectedTypes.person[];\n rootIntervals: ConnectedTypes.rootInterval[];\n lockedTimes: ConnectedTypes.lockedTime[];\n overlapGroups: ConnectedTypes.overlapGroup[];\n courses: ConnectedTypes.course[];\n events: ConnectedTypes.event[];\n};\n\ntype DeepVertexEdgesOnlyExport<\n V extends Vertex<Collection>\n> = {\n [K in keyof PickEdges<V> as K extends IgnoredEdges ? never : K]: DeepVertexExport<V>[K]\n};\n\n\nfunction indexCollection<T extends Vertex<Collection>> (collection: MixedVertexExport<T>[], idKey: IdKey): Map<string, DeepVertexExport<T>> {\n return new Map(collection.map(x => ([getVertexId(x, idKey), x as DeepVertexExport<T>] as const)));\n}\nfunction nonNullable<T> (value: T | null | undefined): value is T {\n return value != null;\n}\n\n/**\n * Connects the schedule data by replacing references with actual objects making it easier to work with.\n */\nexport function makeConnected (\n schedule: MixedScheduleData,\n options: Pick<Types.toOptions, 'idKey'> = {}\n): ConnectedScheduleData {\n const _division = schedule.divisions ?? schedule.division;\n if (!_division) throw new Error(`\"division\" or \"divisions\" missing in schedule, present keys: ${Object.keys(schedule).join(', ')}`);\n const _settings = schedule.settings;\n if (!_settings) throw new Error(`\"settings\" missing in schedule, present keys: ${Object.keys(schedule).join(', ')}`);\n\n const idKey = getIdKey(options);\n\n const groupsMap = indexCollection<GroupVertex >(schedule.groups ?? [], idKey);\n const teachersMap = indexCollection<TeacherVertex >(schedule.teachers ?? [], idKey);\n const locationsMap = indexCollection<LocationVertex >(schedule.locations ?? [], idKey);\n const coursesMap = indexCollection<CourseVertex >(schedule.courses ?? [], idKey);\n const eventsMap = indexCollection<EventVertex >(schedule.events ?? [], idKey);\n const overlapGroupsMap = indexCollection<OverlapGroupVertex>(schedule.overlapGroups ?? [], idKey);\n const periodsMap = indexCollection<PeriodVertex >(schedule.periods ?? [], idKey);\n const personsMap = indexCollection<PersonVertex >(schedule.persons ?? [], idKey);\n const lockedTimesMap = indexCollection<LockedTimeVertex >(schedule.lockedTimes ?? [], idKey);\n const rootIntervalsMap = indexCollection<RootIntervalVertex>(schedule.rootIntervals ?? [], idKey);\n\n const division: Division = pick(_division, [ 'displayName', 'start', 'end']);\n\n const settings = ((): OmitProperties<DivisionSettings> => {\n const edges: DeepVertexEdgesOnlyExport<DivisionSettingsVertex> = {\n period: _settings.period != null ? periodsMap .get(getVertexId(_settings.period, idKey)) : _settings.period,\n defaultRootInterval: _settings.defaultRootInterval != null ? rootIntervalsMap.get(getVertexId(_settings.defaultRootInterval, idKey)) : _settings.defaultRootInterval,\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<DivisionSettingsVertex>, unknown>;\n return Object.assign(_settings, edges);\n })();\n\n const getLockedTimes = <T extends Mixed.Group['lockedTimes'] | undefined | null>(x: T): LockedTime[] | Extract<T, null | undefined> => {\n if (!x) return x as Extract<T, null | undefined>;\n return x.map(x => lockedTimesMap.get(getVertexId(x, idKey))).filter(nonNullable);\n };\n const getLunch = <T extends Mixed.Group['lockedTimes'] | undefined | null>(x: T): LockedTime[] | Extract<T, null | undefined> => {\n if (!x) return x as Extract<T, null | undefined>;\n return x.map(x => lockedTimesMap.get(getVertexId(x, idKey))).filter(nonNullable);\n };\n const getComplementaryTimes = <T extends Mixed.Teacher['lockedTimes'] | undefined | null>(x: T): LockedTime[] | Extract<T, null | undefined> => {\n if (!x) return x as Extract<T, null | undefined>;\n return x.map(x => lockedTimesMap.get(getVertexId(x, idKey))).filter(nonNullable);\n };\n\n const locations = (schedule.locations ?? [])\n .map((x): OmitProperties<Location> => {\n\n const edges: DeepVertexEdgesOnlyExport<LocationVertex> = {\n lockedTimes: getLockedTimes(x.lockedTimes),\n lunch: getLunch(x.lunch),\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<LocationVertex>, unknown>;\n\n return Object.assign(x, edges);\n });\n\n const groups = (schedule.groups ?? [])\n .map((x): OmitProperties<Group> => {\n const edges: DeepVertexEdgesOnlyExport<GroupVertex> = {\n lockedTimes: getLockedTimes(x.lockedTimes),\n lunch: getLunch (x.lunch),\n members: x.members ? x.members .map(x => personsMap.get(getVertexId(x, idKey))).filter(nonNullable) : x.members,\n parentGroups: x.parentGroups ? x.parentGroups.map(x => groupsMap .get(getVertexId(x, idKey))).filter(nonNullable) : x.parentGroups,\n subGroups: x.subGroups ? x.subGroups .map(x => groupsMap .get(getVertexId(x, idKey))).filter(nonNullable) : x.subGroups,\n\n rootInterval: x.rootInterval != null ? rootIntervalsMap.get(getVertexId(x.rootInterval, idKey)) : x.rootInterval,\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<GroupVertex>, unknown>;\n return Object.assign(x, edges);\n });\n\n const teachers = (schedule.teachers ?? [])\n .map((x): OmitProperties<Teacher> => {\n const edges: DeepVertexEdgesOnlyExport<TeacherVertex> = {\n lockedTimes: getLockedTimes (x.lockedTimes),\n lunch: getLunch (x.lunch),\n complementaryTimes: getComplementaryTimes(x.complementaryTimes),\n\n person: x.person != null ? personsMap .get(getVertexId(x.person, idKey)) : x.person,\n rootInterval: x.rootInterval != null ? rootIntervalsMap.get(getVertexId(x.rootInterval, idKey)) : x.rootInterval,\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<TeacherVertex>, unknown>;\n return Object.assign(x, edges);\n });\n\n const persons = (schedule.persons ?? [])\n .map((x): OmitProperties<Person> => {\n const edges: DeepVertexEdgesOnlyExport<PersonVertex> = {\n group: x.group != null ? groupsMap.get(getVertexId(x.group, idKey)) : x.group,\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<PersonVertex>, unknown>;\n return Object.assign(x, edges);\n });\n\n const periods = (schedule.periods ?? [])\n .map((x): OmitProperties<Period> => {\n const edges: DeepVertexEdgesOnlyExport<PeriodVertex> = {\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<PeriodVertex>, unknown>;\n return Object.assign(x, edges);\n });\n\n const rootIntervals = (schedule.rootIntervals ?? [])\n .map((x): OmitProperties<RootInterval> => {\n const edges: DeepVertexEdgesOnlyExport<RootIntervalVertex> = {\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<RootIntervalVertex>, unknown>;\n return Object.assign(x, edges);\n });\n\n type InferCollection<V extends DeepVertexExport<Vertex<Collection>>> = V extends DeepVertexExport<Vertex<infer C>> ? C : never;\n const makeCoalesced = <T extends DeepVertexExport<Vertex<Collection>>, C extends InferCollection<T>, E extends object> (\n map: Map<string, T>,\n id: string, toModel: C,\n extra?: E\n ) => {\n const to = map.get(id);\n if (!to) return;\n return { ...extra, to, toModel } as Coalesced.Util.Value<T, C, object, E>;\n };\n\n const lockedTimes = (schedule.lockedTimes ?? [])\n .map((x): OmitProperties<LockedTime> => {\n const edges: DeepVertexEdgesOnlyExport<LockedTimeVertex> = {\n coalesced: x.coalesced\n ? x.coalesced\n .map((x) => {\n const toModel = x.toModel;\n switch (toModel) {\n case 'groups': return makeCoalesced(groupsMap, getVertexId(x.to, idKey), toModel);\n case 'teachers': return makeCoalesced(teachersMap, getVertexId(x.to, idKey), toModel);\n case 'locations': return makeCoalesced(locationsMap, getVertexId(x.to, idKey), toModel);\n case 'courses': return makeCoalesced(coursesMap, getVertexId(x.to, idKey), toModel);\n case 'events': return makeCoalesced(eventsMap, getVertexId(x.to, idKey), toModel);\n case 'courseevents': return makeCoalesced(eventsMap, getVertexId(x.to, idKey), 'events');\n // case 'persons': return makeCoalesced(personsMap, getVertexId(x.to, idKey), x.toModel);\n default: throw new Error(`Unknown coalesced model \"${toModel satisfies never as string}\" in locked time ${JSON.stringify(x)}`);\n }\n })\n .filter(nonNullable)\n : x.coalesced,\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<LockedTimeVertex>, unknown>;\n return Object.assign(x, edges);\n });\n\n const overlapGroups = (schedule.overlapGroups ?? [])\n .map((x): OmitProperties<OverlapGroup> => {\n const edges: DeepVertexEdgesOnlyExport<OverlapGroupVertex> = {\n coalesced: x.coalesced\n ? x.coalesced\n .map(x => {\n switch (x.toModel) {\n case 'courses': return makeCoalesced(coursesMap, getVertexId(x.to, idKey), x.toModel);\n default: throw new Error(`Unknown coalesced model \"${x.toModel satisfies never as string}\" in overlap group ${JSON.stringify(x)}`);\n }\n })\n .filter(nonNullable)\n : x.coalesced,\n species: x.species\n ? x.species\n .map(x => {\n switch (x.toModel) {\n case 'events': return makeCoalesced(eventsMap, getVertexId(x.to, idKey), x.toModel, x);\n case 'courseevents': return makeCoalesced(eventsMap, getVertexId(x.to, idKey), 'events', x);\n default: throw new Error(`Unknown species model \"${x.toModel satisfies never as string}\" in overlap group ${JSON.stringify(x)}`);\n }\n })\n .filter(nonNullable)\n : x.species,\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<OverlapGroupVertex>, unknown>;\n return Object.assign(x, edges);\n });\n\n const getParticipants = (x: Mixed.Course['participants'] | Mixed.Event['participants']): CoreTypes.Deep.Course['participants'] | undefined => {\n if (!x) return undefined;\n return x\n .map(x => {\n const to = personsMap.get(getVertexId(x.to, idKey));\n if (!to) return;\n const participant: NonNullable<CoreTypes.Deep.Course['participants']>[number] = { ...x, to };\n return participant;\n })\n .filter(nonNullable);\n };\n const getTeachers = (x: Mixed.Course['teachers'] | Mixed.Event['teachers']): CoreTypes.Deep.Course['teachers'] | undefined => {\n if (!x) return undefined;\n return x\n .map(x => {\n const to = teachersMap.get(getVertexId(x.to, idKey));\n if (!to) return;\n const participant: NonNullable<CoreTypes.Deep.Course['teachers']>[number] = { ...x, to };\n return participant;\n })\n .filter(nonNullable);\n };\n const getLocations = (x: Mixed.Course['locations'] | Mixed.Event['locations']): CoreTypes.Deep.Course['locations'] | undefined => {\n if (!x) return undefined;\n return x\n .map(x => {\n const locations = x.locations\n .map(x => locationsMap.get(getVertexId(x, idKey)))\n .filter(nonNullable);\n if (locations.length != 1) throw new Error(`(RS::MakeConnected) Expected exactly one location in available locations, got ${locations.length} and before filtering: ${x.locations.map(x => getVertexId(x, idKey)).join(', ')}`);\n const availableLocation: NonNullable<CoreTypes.Deep.Course['locations']>[number] = { ...x, locations: locations as [Location] };\n return availableLocation;\n })\n .filter(nonNullable);\n };\n const getGroups = (x: Mixed.Course['groups'] | Mixed.Event['groups']): CoreTypes.Deep.Course['groups'] | undefined => {\n if (!x) return undefined;\n return x\n .map(x => {\n const to = groupsMap.get(getVertexId(x.to, idKey));\n if (!to) return;\n const exclude = x.exclude\n ? x.exclude\n .map(x => personsMap.get(getVertexId(x, idKey)))\n .filter(nonNullable)\n : undefined;\n const group: NonNullable<CoreTypes.Deep.Course['groups']>[number] = { ...x, to, exclude };\n return group;\n })\n .filter(nonNullable);\n };\n\n const courses = (schedule.courses ?? [])\n .map((x): OmitProperties<Course> => {\n const edges: DeepVertexEdgesOnlyExport<CourseVertex> = {\n groups: getGroups (x.groups),\n teachers: getTeachers (x.teachers),\n locations: getLocations (x.locations),\n participants: getParticipants(x.participants),\n lockedTimes: getLockedTimes (x.lockedTimes),\n events: x.events ? x.events .map(x => eventsMap .get(getVertexId(x, idKey))).filter(nonNullable) : x.events,\n\n period: x.period != null ? periodsMap .get(getVertexId(x.period, idKey)) : x.period,\n overlapGroup: x.overlapGroup != null ? overlapGroupsMap.get(getVertexId(x.overlapGroup, idKey)) : x.overlapGroup,\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<CourseVertex>, unknown>;\n return Object.assign(x, edges);\n });\n\n const events = (schedule.events ?? [])\n .map((x): OmitProperties<Event> => {\n const edges: DeepVertexEdgesOnlyExport<EventVertex> = {\n groups: getGroups (x.groups),\n teachers: getTeachers (x.teachers),\n locations: getLocations (x.locations),\n participants: getParticipants(x.participants),\n lockedTimes: getLockedTimes (x.lockedTimes),\n inLocations: x.inLocations\n ? x.inLocations\n .map(x => x === null ? null : locationsMap.get(getVertexId(x, idKey)))\n .filter((x): x is Exclude<typeof x, undefined> => x !== undefined)\n : x.inLocations,\n\n course: x.course != null ? coursesMap .get(getVertexId(x.course, idKey)) : x.course,\n period: x.period != null ? periodsMap .get(getVertexId(x.period, idKey)) : x.period,\n overlapSpecies: x.overlapSpecies != null ? overlapGroupsMap.get(getVertexId(x.overlapSpecies, idKey)) : x.overlapSpecies,\n } satisfies Record<keyof DeepVertexEdgesOnlyExport<EventVertex>, unknown>;\n return Object.assign(x, edges);\n });\n\n\n return {\n division,\n settings,\n locations,\n groups,\n teachers,\n persons,\n periods,\n rootIntervals,\n lockedTimes,\n overlapGroups,\n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gB,EAAE,YAAY;IAC5C,aAAc,EAAE,cACZ,EAAE,YACD,KAAI,QAAKV,QAAM,OAAO,OAAO,aAAa,IAAI,YAAYA,KAAG,MAAM,CAAC,CAAC,CACrE,QAAQ,QAAyCA,QAAM,OAAU,GAClE,EAAE;IAEN,QAAgB,EAAE,UAAkB,OAAO,WAAiB,IAAI,YAAY,EAAE,QAAgB,MAAM,CAAC,GAAG,EAAE;IAC1G,QAAgB,EAAE,UAAkB,OAAO,WAAiB,IAAI,YAAY,EAAE,QAAgB,MAAM,CAAC,GAAG,EAAE;IAC1G,gBAAgB,EAAE,kBAAkB,OAAO,iBAAiB,IAAI,YAAY,EAAE,gBAAgB,MAAM,CAAC,GAAG,EAAE;IAC3G;AACD,UAAO,OAAO,OAAO,GAAG,MAAM;IAC9B;EAgBH"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/RS/to/index.ts"],"sourcesContent":["import { schedules } from './schedules';\n\nexport default {\n schedules: schedules\n};"],"mappings":";;;AAEA,iBAAe,EACF"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/RS/to/index.ts"],"sourcesContent":["import { schedules } from './schedules';\n\nexport default {\n schedules: schedules\n};"],"mappings":";;;AAEA,iBAAe,EACF,WACZ"}
@@ -17,23 +17,21 @@ function initialConfiguration(events, lockedTimes, options) {
17
17
  const fromEvents = events.map((x) => {
18
18
  if (x.parked) return;
19
19
  if (!x.start || !x.end) return;
20
- const doc = {
20
+ return omitBy({
21
21
  id: idOf.event(x, options),
22
22
  ...getPosition(x.start, x.end),
23
23
  collection: x.course ? getVertexId(x.course, options) : void 0,
24
24
  dependencies: x.inLocations?.map((x$1) => x$1 ? getVertexId(x$1, options) : null).filter((x$1) => x$1 != null)
25
- };
26
- return omitBy(doc, (x$1) => x$1 == null);
25
+ }, (x$1) => x$1 == null);
27
26
  }).filter((x) => x != null);
28
27
  const fromLockedTimes = lockedTimes.map((x) => {
29
28
  if (x.type != "LUNCH") return;
30
29
  if (!x.start || !x.end) return;
31
- const doc = {
30
+ return omitBy({
32
31
  id: idOf.lockedTime(x, options),
33
32
  ...getPosition(x.start, x.end),
34
33
  dependencies: makeChainable(x.coalesced ?? []).chain((x$1) => x$1.filter((x$2) => x$2.toModel == "locations").map((x$2) => getVertexId(x$2.to, options)), (x$1) => uniq(x$1)).value
35
- };
36
- return omitBy(doc, (x$1) => x$1 == null);
34
+ }, (x$1) => x$1 == null);
37
35
  }).filter((x) => x != null);
38
36
  return [{ events: fromEvents.concat(fromLockedTimes) }];
39
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"initial-configuration.js","names":["doc: Types.eventConfiguration","x"],"sources":["../../../src/RS/to/initial-configuration.ts"],"sourcesContent":["import moment from 'moment';\nimport { omitBy, uniq } from 'lodash-es';\nimport type { ConnectedTypes } from '../make-connected';\nimport { idOf } from './input/util/util';\nimport { getDayIndex, getVertexId } from '../../core/util';\nimport type { DateType } from '../../common/types';\nimport type { Types } from '../types';\nimport { makeChainable } from '../../common/make-chainable';\n\nfunction getPosition (\n start: DateType,\n end: DateType\n): Pick<Types.eventConfiguration, 'day' | 'start' | 'end'> {\n const mmtMidnight = moment.utc(start).clone().startOf('day');\n return {\n day: getDayIndex(start),\n start: moment.utc(start).diff(mmtMidnight, 'minutes'),\n end: moment.utc(end ).diff(mmtMidnight, 'minutes'),\n };\n}\n\nexport function initialConfiguration (\n events: ConnectedTypes.event[],\n lockedTimes: ConnectedTypes.lockedTime[],\n options: Types.parsedToOptions\n): Types.configuration[] {\n const fromEvents = events\n .map(x => {\n if (x.parked) return;\n if (!x.start || !x.end) return;\n\n const doc: Types.eventConfiguration = {\n id: idOf.event(x, options),\n ...getPosition(x.start, x.end),\n\n collection: x.course ? getVertexId(x.course, options) : undefined,\n dependencies: x.inLocations?.map(x => x ? getVertexId(x, options) : null).filter(x => x != null),\n };\n return omitBy(doc, x => x == null) as Types.eventConfiguration;\n })\n .filter(x => x != null);\n\n const fromLockedTimes = lockedTimes\n .map(x => {\n if (x.type != 'LUNCH') return;\n if (!x.start || !x.end) return;\n\n const doc: Types.eventConfiguration = {\n id: idOf.lockedTime(x, options),\n ...getPosition(x.start, x.end),\n\n dependencies: makeChainable(x.coalesced ?? [])\n .chain(\n x => x\n .filter(x => x.toModel == 'locations')\n .map(x => getVertexId(x.to, options)),\n x => uniq(x)\n )\n .value\n };\n return omitBy(doc, x => x == null) as Types.eventConfiguration;\n })\n .filter(x => x != null);\n\n return [{\n events: fromEvents.concat(fromLockedTimes)\n }];\n};"],"mappings":";;;;;;;AASA,SAAS,YACP,OACA,KACyD;CACzD,MAAM,cAAc,OAAO,IAAI,OAAO,QAAQ,QAAQ;AACtD,QAAO;EACL,KAAO,YAAY;EACnB,OAAO,OAAO,IAAI,OAAO,KAAK,aAAa;EAC3C,KAAO,OAAO,IAAI,KAAO,KAAK,aAAa;;;AAI/C,SAAgB,qBACd,QACA,aACA,SACuB;CACvB,MAAM,aAAa,OAChB,KAAI,MAAK;AACR,MAAI,EAAE,OAAQ;AACd,MAAI,CAAC,EAAE,SAAS,CAAC,EAAE,IAAK;EAExB,MAAMA,MAAgC;GACpC,IAAI,KAAK,MAAM,GAAG;GAClB,GAAG,YAAY,EAAE,OAAO,EAAE;GAE1B,YAAc,EAAE,SAAS,YAAY,EAAE,QAAQ,WAAW;GAC1D,cAAc,EAAE,aAAa,KAAI,QAAKC,MAAI,YAAYA,KAAG,WAAW,MAAM,QAAO,QAAKA,OAAK;;AAE7F,SAAO,OAAO,MAAK,QAAKA,OAAK;IAE9B,QAAO,MAAK,KAAK;CAEpB,MAAM,kBAAkB,YACrB,KAAI,MAAK;AACR,MAAI,EAAE,QAAQ,QAAS;AACvB,MAAI,CAAC,EAAE,SAAS,CAAC,EAAE,IAAK;EAExB,MAAMD,MAAgC;GACpC,IAAI,KAAK,WAAW,GAAG;GACvB,GAAG,YAAY,EAAE,OAAO,EAAE;GAE1B,cAAc,cAAc,EAAE,aAAa,IACxC,OACC,QAAKC,IACF,QAAO,QAAKA,IAAE,WAAW,aACzB,KAAI,QAAK,YAAYA,IAAE,IAAI,YAC9B,QAAK,KAAKA,MAEX;;AAEL,SAAO,OAAO,MAAK,QAAKA,OAAK;IAE9B,QAAO,MAAK,KAAK;AAEpB,QAAO,CAAC,EACN,QAAQ,WAAW,OAAO"}
1
+ {"version":3,"file":"initial-configuration.js","names":["x"],"sources":["../../../src/RS/to/initial-configuration.ts"],"sourcesContent":["import moment from 'moment';\nimport { omitBy, uniq } from 'lodash-es';\nimport type { ConnectedTypes } from '../make-connected';\nimport { idOf } from './input/util/util';\nimport { getDayIndex, getVertexId } from '../../core/util';\nimport type { DateType } from '../../common/types';\nimport type { Types } from '../types';\nimport { makeChainable } from '../../common/make-chainable';\n\nfunction getPosition (\n start: DateType,\n end: DateType\n): Pick<Types.eventConfiguration, 'day' | 'start' | 'end'> {\n const mmtMidnight = moment.utc(start).clone().startOf('day');\n return {\n day: getDayIndex(start),\n start: moment.utc(start).diff(mmtMidnight, 'minutes'),\n end: moment.utc(end ).diff(mmtMidnight, 'minutes'),\n };\n}\n\nexport function initialConfiguration (\n events: ConnectedTypes.event[],\n lockedTimes: ConnectedTypes.lockedTime[],\n options: Types.parsedToOptions\n): Types.configuration[] {\n const fromEvents = events\n .map(x => {\n if (x.parked) return;\n if (!x.start || !x.end) return;\n\n const doc: Types.eventConfiguration = {\n id: idOf.event(x, options),\n ...getPosition(x.start, x.end),\n\n collection: x.course ? getVertexId(x.course, options) : undefined,\n dependencies: x.inLocations?.map(x => x ? getVertexId(x, options) : null).filter(x => x != null),\n };\n return omitBy(doc, x => x == null) as Types.eventConfiguration;\n })\n .filter(x => x != null);\n\n const fromLockedTimes = lockedTimes\n .map(x => {\n if (x.type != 'LUNCH') return;\n if (!x.start || !x.end) return;\n\n const doc: Types.eventConfiguration = {\n id: idOf.lockedTime(x, options),\n ...getPosition(x.start, x.end),\n\n dependencies: makeChainable(x.coalesced ?? [])\n .chain(\n x => x\n .filter(x => x.toModel == 'locations')\n .map(x => getVertexId(x.to, options)),\n x => uniq(x)\n )\n .value\n };\n return omitBy(doc, x => x == null) as Types.eventConfiguration;\n })\n .filter(x => x != null);\n\n return [{\n events: fromEvents.concat(fromLockedTimes)\n }];\n};"],"mappings":";;;;;;;AASA,SAAS,YACP,OACA,KACyD;CACzD,MAAM,cAAc,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,MAAM;AAC5D,QAAO;EACL,KAAO,YAAY,MAAM;EACzB,OAAO,OAAO,IAAI,MAAM,CAAC,KAAK,aAAa,UAAU;EACrD,KAAO,OAAO,IAAI,IAAM,CAAC,KAAK,aAAa,UAAU;EACtD;;AAGH,SAAgB,qBACd,QACA,aACA,SACuB;CACvB,MAAM,aAAa,OAChB,KAAI,MAAK;AACR,MAAI,EAAE,OAAQ;AACd,MAAI,CAAC,EAAE,SAAS,CAAC,EAAE,IAAK;AASxB,SAAO,OAP+B;GACpC,IAAI,KAAK,MAAM,GAAG,QAAQ;GAC1B,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI;GAE9B,YAAc,EAAE,SAAS,YAAY,EAAE,QAAQ,QAAQ,GAAG;GAC1D,cAAc,EAAE,aAAa,KAAI,QAAKA,MAAI,YAAYA,KAAG,QAAQ,GAAG,KAAK,CAAC,QAAO,QAAKA,OAAK,KAAK;GACjG,GACkB,QAAKA,OAAK,KAAK;GAClC,CACD,QAAO,MAAK,KAAK,KAAK;CAEzB,MAAM,kBAAkB,YACrB,KAAI,MAAK;AACR,MAAI,EAAE,QAAQ,QAAS;AACvB,MAAI,CAAC,EAAE,SAAS,CAAC,EAAE,IAAK;AAexB,SAAO,OAb+B;GACpC,IAAI,KAAK,WAAW,GAAG,QAAQ;GAC/B,GAAG,YAAY,EAAE,OAAO,EAAE,IAAI;GAE9B,cAAc,cAAc,EAAE,aAAa,EAAE,CAAC,CAC3C,OACC,QAAKA,IACF,QAAO,QAAKA,IAAE,WAAW,YAAY,CACrC,KAAI,QAAK,YAAYA,IAAE,IAAI,QAAQ,CAAC,GACvC,QAAK,KAAKA,IAAE,CACb,CACA;GACJ,GACkB,QAAKA,OAAK,KAAK;GAClC,CACD,QAAO,MAAK,KAAK,KAAK;AAEzB,QAAO,CAAC,EACN,QAAQ,WAAW,OAAO,gBAAgB,EAC3C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"collections.js","names":["doc: Types.collection & { overlapGroupId?: string }","x"],"sources":["../../../../src/RS/to/input/collections.ts"],"sourcesContent":["import { groupBy, omit, omitBy, values } from 'lodash-es';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseEvents } from './events';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { parseGroupReferences } from './util/parse-group-references';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { getPeriodIndex, idOf } from './util/util';\nimport { parseLocationReferences } from './util/parse-location-references';\nimport { parseDays } from './util/parse-days';\nimport { parseIntervals } from './util/parse-intervals';\nimport type { Types } from '../../types';\nimport { makeChainable } from '../../../common/make-chainable';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromCollections (\n courses: ConnectedTypes.course[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n periodsMap: Map<string | undefined, number>,\n): (Types.collection[] | Types.collection)[] {\n const defaultInterval = getDefaultInterval(settings);\n\n const collections = courses\n .map(course => {\n const id = getVertexId(course, options);\n const intervals = course.intervals ?? defaultInterval;\n\n const doc: Types.collection & { overlapGroupId?: string } = {\n id,\n\n weight: course.weight,\n density: course.density,\n maxEventLengthVariance: course.eventDurationVariance,\n potentialCenter: course.centerOfAttraction ? parseFloat(course.centerOfAttraction.replace(':', '.')) : undefined,\n distributionKey: id,\n\n events: parseEvents (course.events, settings, options, periodsMap),\n dependencies: parseLocationReferences (course.locations, options),\n groups: parseGroupReferences ({ type: 'course', item: course }, options),\n intervals: options.oldFormat\n ? parseIntervals(intervals, undefined, settings)\n : idOf.intervalPairReference(intervals, undefined, options),\n days: parseDays (course.days, settings),\n minBreakLength: parseMinimumBreakLength (course.minBreakLength),\n lockedTimes: attachLockedTimes (course.lockedTimes, options),\n period: getPeriodIndex (course.period, periodsMap, options),\n _period: course.period ? getVertexId(course.period, options) : undefined,\n };\n\n if (options.meta) {\n doc.meta = omitBy({\n color: course.color,\n ids: course.ids,\n name: course.displayName,\n }, x => x == null);\n }\n\n // temporarily attach overlap group\n doc.overlapGroupId = course.overlapGroup\n ? getVertexId(course.overlapGroup, options)\n : undefined;\n\n return omitBy(doc, x => x == null) as Types.collection & { overlapGroupId?: string };\n });\n\n const overlapping = makeChainable(collections)\n .chain(\n x => x.filter(x => x.overlapGroupId != null),\n x => groupBy(x, x => x.overlapGroupId),\n x => values(x)\n .map(xs => xs.map(x => omit(x, 'overlapGroupId') as Types.collection))\n )\n .value;\n\n const plain = collections\n .filter(x => x.overlapGroupId == null)\n .map(x => {\n delete x.overlapGroupId; // remove overlapGroupId from individual collections\n return x as Types.collection;\n });\n\n return overlapping.concat(plain);\n};"],"mappings":";;;;;;;;;;;;;;AAeA,SAAgB,gBACd,SACA,UACA,SACA,YAC2C;CAC3C,MAAM,kBAAkB,mBAAmB;CAE3C,MAAM,cAAc,QACjB,KAAI,WAAU;EACb,MAAM,KAAY,YAAY,QAAQ;EACtC,MAAM,YAAY,OAAO,aAAa;EAEtC,MAAMA,MAAsD;GAC1D;GAEA,QAAwB,OAAO;GAC/B,SAAwB,OAAO;GAC/B,wBAAwB,OAAO;GAC/B,iBAAwB,OAAO,qBAAqB,WAAW,OAAO,mBAAmB,QAAQ,KAAK,QAAQ;GAC9G,iBAAwB;GAExB,QAAc,YAA2B,OAAO,QAAQ,UAAU,SAAS;GAC3E,cAAc,wBAA2B,OAAO,WAAW;GAC3D,QAAc,qBAA2B;IAAE,MAAM;IAAU,MAAM;MAAU;GAC3E,WAAc,QAAQ,YAClB,eAAe,WAAW,QAAW,YACrC,KAAK,sBAAsB,WAAW,QAAW;GACrD,MAAgB,UAA2B,OAAO,MAAM;GACxD,gBAAgB,wBAA2B,OAAO;GAClD,aAAgB,kBAA2B,OAAO,aAAa;GAC/D,QAAgB,eAA2B,OAAO,QAAQ,YAAY;GACtE,SAAgB,OAAO,SAAS,YAAY,OAAO,QAAQ,WAAW;;AAGxE,MAAI,QAAQ,KACV,KAAI,OAAO,OAAO;GAChB,OAAO,OAAO;GACd,KAAO,OAAO;GACd,MAAO,OAAO;MACb,MAAK,KAAK;AAIf,MAAI,iBAAiB,OAAO,eACxB,YAAY,OAAO,cAAc,WACjC;AAEJ,SAAO,OAAO,MAAK,MAAK,KAAK;;CAGjC,MAAM,cAAc,cAAc,aAC/B,OACC,MAAK,EAAE,QAAO,QAAKC,IAAE,kBAAkB,QACvC,MAAK,QAAQ,IAAG,QAAKA,IAAE,kBACvB,MAAK,OAAO,GACT,KAAI,OAAM,GAAG,KAAI,QAAK,KAAKA,KAAG,qBAElC;CAEH,MAAM,QAAQ,YACX,QAAO,MAAK,EAAE,kBAAkB,MAChC,KAAI,MAAK;AACR,SAAO,EAAE;AACT,SAAO;;AAGX,QAAO,YAAY,OAAO"}
1
+ {"version":3,"file":"collections.js","names":["doc: Types.collection & { overlapGroupId?: string }","x"],"sources":["../../../../src/RS/to/input/collections.ts"],"sourcesContent":["import { groupBy, omit, omitBy, values } from 'lodash-es';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseEvents } from './events';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { parseGroupReferences } from './util/parse-group-references';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { getPeriodIndex, idOf } from './util/util';\nimport { parseLocationReferences } from './util/parse-location-references';\nimport { parseDays } from './util/parse-days';\nimport { parseIntervals } from './util/parse-intervals';\nimport type { Types } from '../../types';\nimport { makeChainable } from '../../../common/make-chainable';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromCollections (\n courses: ConnectedTypes.course[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n periodsMap: Map<string | undefined, number>,\n): (Types.collection[] | Types.collection)[] {\n const defaultInterval = getDefaultInterval(settings);\n\n const collections = courses\n .map(course => {\n const id = getVertexId(course, options);\n const intervals = course.intervals ?? defaultInterval;\n\n const doc: Types.collection & { overlapGroupId?: string } = {\n id,\n\n weight: course.weight,\n density: course.density,\n maxEventLengthVariance: course.eventDurationVariance,\n potentialCenter: course.centerOfAttraction ? parseFloat(course.centerOfAttraction.replace(':', '.')) : undefined,\n distributionKey: id,\n\n events: parseEvents (course.events, settings, options, periodsMap),\n dependencies: parseLocationReferences (course.locations, options),\n groups: parseGroupReferences ({ type: 'course', item: course }, options),\n intervals: options.oldFormat\n ? parseIntervals(intervals, undefined, settings)\n : idOf.intervalPairReference(intervals, undefined, options),\n days: parseDays (course.days, settings),\n minBreakLength: parseMinimumBreakLength (course.minBreakLength),\n lockedTimes: attachLockedTimes (course.lockedTimes, options),\n period: getPeriodIndex (course.period, periodsMap, options),\n _period: course.period ? getVertexId(course.period, options) : undefined,\n };\n\n if (options.meta) {\n doc.meta = omitBy({\n color: course.color,\n ids: course.ids,\n name: course.displayName,\n }, x => x == null);\n }\n\n // temporarily attach overlap group\n doc.overlapGroupId = course.overlapGroup\n ? getVertexId(course.overlapGroup, options)\n : undefined;\n\n return omitBy(doc, x => x == null) as Types.collection & { overlapGroupId?: string };\n });\n\n const overlapping = makeChainable(collections)\n .chain(\n x => x.filter(x => x.overlapGroupId != null),\n x => groupBy(x, x => x.overlapGroupId),\n x => values(x)\n .map(xs => xs.map(x => omit(x, 'overlapGroupId') as Types.collection))\n )\n .value;\n\n const plain = collections\n .filter(x => x.overlapGroupId == null)\n .map(x => {\n delete x.overlapGroupId; // remove overlapGroupId from individual collections\n return x as Types.collection;\n });\n\n return overlapping.concat(plain);\n};"],"mappings":";;;;;;;;;;;;;;AAeA,SAAgB,gBACd,SACA,UACA,SACA,YAC2C;CAC3C,MAAM,kBAAkB,mBAAmB,SAAS;CAEpD,MAA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AEH,MAAM,QAAQ,YACX,QAAO,MAAK,EAAE,kBAAkB,KAAK,CACrC,KAAI,MAAK;AACR,SAAO,EAAE;AACT,SAAO;GACP;AAEJ,QAAO,YAAY,OAAO,MAAM"}
@@ -8,7 +8,7 @@ import { DEFAULT_PERIOD_ID } from "./periods.js";
8
8
  function parseDefault(settings, periodsMap, options) {
9
9
  const maxNumWorkingHours = options.useMaximumScheduleSpan ? min2hrs(settings.defaultMaximumScheduleSpan?.daily) ?? false : settings.defaultMaxNumWorkingHours ?? false;
10
10
  const maxNumDailyWorkingHours = options.useMaximumScheduleSpan ? min2hrs(settings.defaultMaximumScheduleSpan?.daily) ?? false : settings.defaultMaxNumDailyWorkingHours ?? false;
11
- const res = {
11
+ return {
12
12
  intervals: options.oldFormat ? parseIntervals(getDefaultInterval(settings), void 0, settings) : computesDefaultIntervalId(settings, options),
13
13
  groupMinBreakLength: settings.defaultGroupMinimumBreakLength ?? 0,
14
14
  dependencyMinBreakLength: settings.defaultDependencyMinimumBreakLength ?? 0,
@@ -27,7 +27,6 @@ function parseDefault(settings, periodsMap, options) {
27
27
  period: getPeriodIndex(settings.period ?? DEFAULT_PERIOD_ID, periodsMap, options),
28
28
  _period: settings.period ? getVertexId(settings.period, options) : void 0
29
29
  };
30
- return res;
31
30
  }
32
31
 
33
32
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"default.js","names":["res: Types.defaultValues"],"sources":["../../../../src/RS/to/input/default.ts"],"sourcesContent":["import type { Types } from '../../types';\nimport { computesDefaultIntervalId, getDefaultInterval } from './intervals';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getPeriodIndex, min2hrs, toTimeFloat } from './util/util';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { DEFAULT_PERIOD_ID } from './periods';\nimport { getVertexId } from '../../../core/util';\n\nexport function parseDefault (\n settings: ConnectedTypes.divisionSettings,\n periodsMap: Map<string | undefined, number>,\n options: Types.parsedToOptions\n): Types.defaultValues {\n const maxNumWorkingHours = options.useMaximumScheduleSpan\n ? min2hrs(settings.defaultMaximumScheduleSpan?.daily) ?? false\n : settings.defaultMaxNumWorkingHours ?? false;\n\n const maxNumDailyWorkingHours = options.useMaximumScheduleSpan\n ? min2hrs(settings.defaultMaximumScheduleSpan?.daily) ?? false\n : settings.defaultMaxNumDailyWorkingHours ?? false;\n\n const res: Types.defaultValues = {\n intervals: options.oldFormat\n ? parseIntervals(getDefaultInterval(settings), undefined, settings)!\n : computesDefaultIntervalId(settings, options),\n\n groupMinBreakLength: settings.defaultGroupMinimumBreakLength ?? 0,\n dependencyMinBreakLength: settings.defaultDependencyMinimumBreakLength ?? 0,\n eventMinBreakLength: settings.defaultEventMinimumBreakLength ?? 0,\n\n potentialCenter: toTimeFloat(settings.potentialCenter ?? '12:00'),\n eventDensity: settings.defaultEventDensity ?? 0,\n\n maxEventLengthVariance: settings.defaultEventDurationVariance ?? 0,\n\n maxNumWorkingHours: maxNumWorkingHours,\n maxNumDailyWorkingHours: maxNumDailyWorkingHours,\n\n dependencyRank: settings.defaultDependencyRank ?? 0,\n groupRank: settings.defaultGroupRank ?? 0,\n dayRank: settings.defaultDayRank ?? 0,\n\n groupWeight: settings.defaultGroupWeight ?? 0,\n collectionWeight: settings.defaultCourseWeight ?? 0,\n eventWeight: settings.defaultEventWeight ?? 0,\n\n period: getPeriodIndex(settings.period ?? DEFAULT_PERIOD_ID, periodsMap, options),\n _period: settings.period ? getVertexId(settings.period, options) : undefined,\n };\n\n return res;\n};"],"mappings":";;;;;;;AAQA,SAAgB,aACd,UACA,YACA,SACqB;CACrB,MAAM,qBAAqB,QAAQ,yBAC/B,QAAQ,SAAS,4BAA4B,UAAU,QACvD,SAAS,6BAA8C;CAE3D,MAAM,0BAA0B,QAAQ,yBACpC,QAAQ,SAAS,4BAA4B,UAAU,QACvD,SAAS,kCAA8C;CAE3D,MAAMA,MAA2B;EAC/B,WAAW,QAAQ,YACf,eAAe,mBAAmB,WAAW,QAAW,YACxD,0BAA0B,UAAU;EAExC,qBAA0B,SAAS,kCAAuC;EAC1E,0BAA0B,SAAS,uCAAuC;EAC1E,qBAA0B,SAAS,kCAAuC;EAE1E,iBAAiB,YAAY,SAAS,mBAAmB;EACzD,cAAiB,SAAS,uBAAuB;EAEjD,wBAAwB,SAAS,gCAAgC;EAExC;EACA;EAEzB,gBAAgB,SAAS,yBAAyB;EAClD,WAAgB,SAAS,oBAAyB;EAClD,SAAgB,SAAS,kBAAyB;EAElD,aAAkB,SAAS,sBAAuB;EAClD,kBAAkB,SAAS,uBAAuB;EAClD,aAAkB,SAAS,sBAAuB;EAElD,QAAS,eAAe,SAAS,UAAU,mBAAmB,YAAY;EAC1E,SAAS,SAAS,SAAS,YAAY,SAAS,QAAQ,WAAW;;AAGrE,QAAO"}
1
+ {"version":3,"file":"default.js","names":[],"sources":["../../../../src/RS/to/input/default.ts"],"sourcesContent":["import type { Types } from '../../types';\nimport { computesDefaultIntervalId, getDefaultInterval } from './intervals';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getPeriodIndex, min2hrs, toTimeFloat } from './util/util';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { DEFAULT_PERIOD_ID } from './periods';\nimport { getVertexId } from '../../../core/util';\n\nexport function parseDefault (\n settings: ConnectedTypes.divisionSettings,\n periodsMap: Map<string | undefined, number>,\n options: Types.parsedToOptions\n): Types.defaultValues {\n const maxNumWorkingHours = options.useMaximumScheduleSpan\n ? min2hrs(settings.defaultMaximumScheduleSpan?.daily) ?? false\n : settings.defaultMaxNumWorkingHours ?? false;\n\n const maxNumDailyWorkingHours = options.useMaximumScheduleSpan\n ? min2hrs(settings.defaultMaximumScheduleSpan?.daily) ?? false\n : settings.defaultMaxNumDailyWorkingHours ?? false;\n\n const res: Types.defaultValues = {\n intervals: options.oldFormat\n ? parseIntervals(getDefaultInterval(settings), undefined, settings)!\n : computesDefaultIntervalId(settings, options),\n\n groupMinBreakLength: settings.defaultGroupMinimumBreakLength ?? 0,\n dependencyMinBreakLength: settings.defaultDependencyMinimumBreakLength ?? 0,\n eventMinBreakLength: settings.defaultEventMinimumBreakLength ?? 0,\n\n potentialCenter: toTimeFloat(settings.potentialCenter ?? '12:00'),\n eventDensity: settings.defaultEventDensity ?? 0,\n\n maxEventLengthVariance: settings.defaultEventDurationVariance ?? 0,\n\n maxNumWorkingHours: maxNumWorkingHours,\n maxNumDailyWorkingHours: maxNumDailyWorkingHours,\n\n dependencyRank: settings.defaultDependencyRank ?? 0,\n groupRank: settings.defaultGroupRank ?? 0,\n dayRank: settings.defaultDayRank ?? 0,\n\n groupWeight: settings.defaultGroupWeight ?? 0,\n collectionWeight: settings.defaultCourseWeight ?? 0,\n eventWeight: settings.defaultEventWeight ?? 0,\n\n period: getPeriodIndex(settings.period ?? DEFAULT_PERIOD_ID, periodsMap, options),\n _period: settings.period ? getVertexId(settings.period, options) : undefined,\n };\n\n return res;\n};"],"mappings":";;;;;;;AAQA,SAAgB,aACd,UACA,YACA,SACqB;CACrB,MAAM,qBAAqB,QAAQ,yBAC/B,QAAQ,SAAS,4BAA4B,MAAM,IAAI,QACvD,SAAS,6BAA8C;CAE3D,MAAM,0BAA0B,QAAQ,yBACpC,QAAQ,SAAS,4BAA4B,MAAM,IAAI,QACvD,SAAS,kCAA8C;AA+B3D,QA7BiC;EAC/B,WAAW,QAAQ,YACf,eAAe,mBAAmB,SAAS,EAAE,QAAW,SAAS,GACjE,0BAA0B,UAAU,QAAQ;EAEhD,qBAA0B,SAAS,kCAAuC;EAC1E,0BAA0B,SAAS,uCAAuC;EAC1E,qBAA0B,SAAS,kCAAuC;EAE1E,iBAAiB,YAAY,SAAS,mBAAmB,QAAQ;EACjE,cAAiB,SAAS,uBAAuB;EAEjD,wBAAwB,SAAS,gCAAgC;EAExC;EACA;EAEzB,gBAAgB,SAAS,yBAAyB;EAClD,WAAgB,SAAS,oBAAyB;EAClD,SAAgB,SAAS,kBAAyB;EAElD,aAAkB,SAAS,sBAAuB;EAClD,kBAAkB,SAAS,uBAAuB;EAClD,aAAkB,SAAS,sBAAuB;EAElD,QAAS,eAAe,SAAS,UAAU,mBAAmB,YAAY,QAAQ;EAClF,SAAS,SAAS,SAAS,YAAY,SAAS,QAAQ,QAAQ,GAAG;EACpE"}
@@ -11,10 +11,8 @@ function fromLocations(locations, settings, options) {
11
11
  if (includedLocations && !includedLocations.has(id)) return false;
12
12
  return true;
13
13
  }).map((location) => {
14
- const id = getVertexId(location, options);
15
14
  const doc = {
16
- id,
17
- area: location.area,
15
+ id: getVertexId(location, options),
18
16
  minBreakLength: location.minBreakLength,
19
17
  days: parseDays(location.days, settings),
20
18
  lockedTimes: attachLockedTimes(location.lockedTimes, options)
@@ -1 +1 @@
1
- {"version":3,"file":"dependencies.js","names":["doc: Types.dependency"],"sources":["../../../../src/RS/to/input/dependencies.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { parseDays } from './util/parse-days';\nimport type { Types } from '../../types';\n\nexport function fromLocations (\n locations: ConnectedTypes.location[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n) {\n return locations\n .filter(x => {\n const id = getVertexId(x, options);\n\n // filter location references based on partial schedule options\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (includedLocations && !includedLocations.has(id)) return false;\n return true;\n })\n .map(location => {\n const id = getVertexId(location, options);\n\n const doc: Types.dependency = {\n id,\n area: location.area,\n minBreakLength: location.minBreakLength,\n days: parseDays (location.days, settings),\n lockedTimes: attachLockedTimes(location.lockedTimes, options)\n };\n\n if (options.meta) {\n doc.meta = omitBy({\n ids: location.ids,\n name: location.displayName\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.dependency;\n });\n}"],"mappings":";;;;;;AAOA,SAAgB,cACd,WACA,UACA,SACA;AACA,QAAO,UACJ,QAAO,MAAK;EACX,MAAM,KAAK,YAAY,GAAG;EAG1B,MAAM,oBAAoB,QAAQ,wBAAwB;AAC1D,MAAI,qBAAqB,CAAC,kBAAkB,IAAI,IAAK,QAAO;AAC5D,SAAO;IAER,KAAI,aAAY;EACf,MAAM,KAAK,YAAY,UAAU;EAEjC,MAAMA,MAAwB;GAC5B;GACA,MAAgB,SAAS;GACzB,gBAAgB,SAAS;GACzB,MAAgB,UAA0B,SAAS,MAAM;GACzD,aAAgB,kBAAkB,SAAS,aAAa;;AAG1D,MAAI,QAAQ,KACV,KAAI,OAAO,OAAO;GAChB,KAAM,SAAS;GACf,MAAM,SAAS;MACd,MAAK,KAAK;AAGf,SAAO,OAAO,MAAK,MAAK,KAAK"}
1
+ {"version":3,"file":"dependencies.js","names":["doc: Types.dependency"],"sources":["../../../../src/RS/to/input/dependencies.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getVertexId } from '../../../core/util';\nimport { parseDays } from './util/parse-days';\nimport type { Types } from '../../types';\n\nexport function fromLocations (\n locations: ConnectedTypes.location[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n) {\n return locations\n .filter(x => {\n const id = getVertexId(x, options);\n\n // filter location references based on partial schedule options\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (includedLocations && !includedLocations.has(id)) return false;\n return true;\n })\n .map(location => {\n const id = getVertexId(location, options);\n\n const doc: Types.dependency = {\n id,\n minBreakLength: location.minBreakLength,\n days: parseDays (location.days, settings),\n lockedTimes: attachLockedTimes(location.lockedTimes, options)\n };\n\n if (options.meta) {\n doc.meta = omitBy({\n ids: location.ids,\n name: location.displayName\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.dependency;\n });\n}"],"mappings":";;;;;;AAOA,SAAgB,cACd,WACA,UACA,SACA;AACA,QAAO,UACJ,QAAO,MAAK;EACX,MAAM,KAAK,YAAY,GAAG,QAAQ;EAGlC,MAAM,oBAAoB,QAAQ,wBAAwB;AAC1D,MAAI,qBAAqB,CAAC,kBAAkB,IAAI,GAAG,CAAE,QAAO;AAC5D,SAAO;GACP,CACD,KAAI,aAAY;EAGf,MAAMA,MAAwB;GAC5B,IAHS,YAAY,UAAU,QAAQ;GAIvC,gBAAgB,SAAS;GACzB,MAAgB,UAA0B,SAAS,MAAM,SAAS;GAClE,aAAgB,kBAAkB,SAAS,aAAa,QAAQ;GACjE;AAED,MAAI,QAAQ,KACV,KAAI,OAAO,OAAO;GAChB,KAAM,SAAS;GACf,MAAM,SAAS;GAChB,GAAE,MAAK,KAAK,KAAK;AAGpB,SAAO,OAAO,MAAK,MAAK,KAAK,KAAK;GAClC"}
@@ -15,8 +15,7 @@ function parse(lockedTime, settings, options, defaultInterval) {
15
15
  const days = lockedTime.intervals ? makeChainable(lockedTime.intervals).chain((x) => x.map((x$1) => getDayIndex(x$1.start)), (x) => uniq(x)).value : void 0;
16
16
  const day = days?.length == 1 ? days[0] : void 0;
17
17
  if (day != null && lockedTime.coalesced) {
18
- const allowedByEvery = lockedTime.coalesced.every((x) => !x.to.days?.length || x.to.days.some((x$1) => x$1.day == day));
19
- if (!allowedByEvery) return;
18
+ if (!lockedTime.coalesced.every((x) => !x.to.days?.length || x.to.days.some((x$1) => x$1.day == day))) return;
20
19
  }
21
20
  const distributionKey = lockedTime.type == "COMPLEMENTARY_TIME" ? "COMPLEMENTARY_TIME." + lockedTime.tags?.at(0)?.value : void 0;
22
21
  const intervals = lockedTime.intervals ?? defaultInterval;
@@ -1 +1 @@
1
- {"version":3,"file":"dynamic-locked-times.js","names":["x","doc: Types.event"],"sources":["../../../../src/RS/to/input/dynamic-locked-times.ts"],"sourcesContent":["import { groupBy, omitBy, uniq } from 'lodash-es';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getDayIndex, getVertexId } from '../../../core/util';\nimport { idOf } from './util/util';\nimport { parseGroupReferences } from './util/parse-group-references';\nimport { parseIntervals } from './util/parse-intervals';\nimport type { Types } from '../../types';\nimport { makeChainable } from '../../../common/make-chainable';\nimport { toDayAndStart } from './events';\nimport { getDefaultInterval } from './intervals';\nimport type { AllowedInterval } from '../../../core/types/common/intervals';\n\nfunction parse (\n lockedTime: ConnectedTypes.lockedTime,\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n defaultInterval: AllowedInterval[]\n) {\n const duration = lockedTime.duration;\n if (!duration || duration < 5) throw new Error('(RS::To::DynamicLockedTimes) Length of a locked time is less than 5 min');\n\n const dependencyReferences = makeChainable(lockedTime.coalesced ?? [])\n .chain(\n x => x\n .filter(x => x.toModel == 'locations')\n .map(x => getVertexId(x.to, options)),\n x => uniq(x),\n x => x.map(x => [x])\n )\n .value;\n\n const days = lockedTime.intervals\n ? makeChainable(lockedTime.intervals)\n .chain(\n x => x.map(x => getDayIndex(x.start)),\n x => uniq(x),\n )\n .value\n : undefined;\n const day = days?.length == 1 ? days[0] : undefined;\n\n // ignore locked times that reside on days that are not part of any coalesced's days\n if (day != null && lockedTime.coalesced) {\n const allowedByEvery = lockedTime.coalesced.every(x => !x.to.days?.length || x.to.days.some(x => x.day == day));\n if (!allowedByEvery) return;\n }\n\n // each type (tag) of complementary hours should distribute evenly\n const distributionKey = lockedTime.type == 'COMPLEMENTARY_TIME'\n ? 'COMPLEMENTARY_TIME.' + lockedTime.tags?.at(0)?.value\n : undefined;\n\n const intervals = lockedTime.intervals ?? defaultInterval;\n\n const doc: Types.event = {\n id: idOf.lockedTime(lockedTime, options),\n length: duration,\n minBreakLength: false,\n maxLengthVariance: lockedTime.durationVariance,\n groups: parseGroupReferences({ type: 'lockedTime', item: lockedTime }, options),\n dependencies: dependencyReferences,\n intervals: options.oldFormat\n ? parseIntervals(intervals, undefined, settings)\n : idOf.intervalPairReference(intervals, undefined, options),\n distributionKey,\n ...days && { days },\n ...day && { day },\n };\n\n\n ////\n //// filter based on partialScheduleOptions\n ////\n if (options.partialScheduleOptions) {\n const { includedEvents, omittedEventsHandling } = options.partialScheduleOptions;\n if (includedEvents && !includedEvents.has(doc.id)) {\n\n if (omittedEventsHandling == 'ignore') return;\n\n if (omittedEventsHandling == 'freeze') {\n // must not be parked and have a start and duration to be frozen, otherwise it's ignored\n if (lockedTime.parked || !lockedTime.start || !lockedTime.duration) return;\n\n // fix day, start and end\n Object.assign(doc, toDayAndStart(lockedTime.start));\n doc.length = lockedTime.duration;\n doc.maxLengthVariance = 0;\n\n // override intervals and days to not cause conflicts\n const numDays = settings.numDays ?? 5;\n doc.days = Array.from({ length: numDays }, (_, i) => i);\n doc.intervals = Array.from({ length: numDays }, () => [{ beg: 0, end: 23.55 }]);\n\n // fix locations\n // > locations are always fixed for locked times\n }\n }\n }\n\n return omitBy(doc, x => x == null) as Types.event;\n}\n\nexport function fromDynamicLockedTimes (\n lockedTimes: ConnectedTypes.lockedTime[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n): (Types.collection | Types.event)[] {\n const defaultInterval = getDefaultInterval(settings);\n\n const complementaryHours = makeChainable(lockedTimes)\n .chain(\n x => x\n .filter(x => x.type == 'COMPLEMENTARY_TIME')\n .map(x => parse(x, settings, options, defaultInterval))\n .filter(x => !!x),\n x => groupBy(x, x => [x.distributionKey].flat().toSorted().join('|')),\n x => Object.entries(x)\n .map(([id, events]) => ({ id: `COMPLEMENTARY_TIME.${id}`, events }) as Types.collection),\n )\n .value;\n\n const lunches = lockedTimes\n .filter(x => x.type == 'LUNCH')\n .map(lockedTime => parse(lockedTime, settings, options, defaultInterval))\n .filter(x => !!x);\n\n return [...complementaryHours, ...lunches];\n};"],"mappings":";;;;;;;;;;AAYA,SAAS,MACP,YACA,UACA,SACA,iBACA;CACA,MAAM,WAAW,WAAW;AAC5B,KAAI,CAAC,YAAY,WAAW,EAAG,OAAM,IAAI,MAAM;CAE/C,MAAM,uBAAuB,cAAc,WAAW,aAAa,IAChE,OACC,MAAK,EACF,QAAO,QAAKA,IAAE,WAAW,aACzB,KAAI,QAAK,YAAYA,IAAE,IAAI,YAC9B,MAAK,KAA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,YAAY,MAAM,KAAK,EAAE,QAAQ,iBAAiB,CAAC;KAAE,KAAK;KAAG,KAAK;;;;;AAQ5E,QAAO,OAAO,MAAK,MAAK,KAAK;;AAG/B,SAAgB,uBACd,aACA,UACA,SACoC;CACpC,MAAM,kBAAkB,mBAAmB;CAE3C,MAAM,qBAAqB,cAAc,aACtC,OACC,MAAK,EACF,QAAO,QAAKD,IAAE,QAAQ,sBACtB,KAAI,QAAK,MAAMA,KAAG,UAAU,SAAS,kBACrC,QAAO,QAAK,CAAC,CAACA,OACjB,MAAK,QAAQ,IAAG,QAAK,CAACA,IAAE,iBAAiB,OAAO,WAAW,KAAK,QAChE,MAAK,OAAO,QAAQ,GACjB,KAAK,CAAC,IAAI,aAAa;EAAE,IAAI,sBAAsB;EAAM;MAE7D;CAEH,MAAM,UAAU,YACb,QAAO,MAAK,EAAE,QAAQ,SACtB,KAAI,eAAc,MAAM,YAAY,UAAU,SAAS,kBACvD,QAAO,MAAK,CAAC,CAAC;AAEjB,QAAO,CAAC,GAAG,oBAAoB,GAAG"}
1
+ {"version":3,"file":"dynamic-locked-times.js","names":["x","doc: Types.event"],"sources":["../../../../src/RS/to/input/dynamic-locked-times.ts"],"sourcesContent":["import { groupBy, omitBy, uniq } from 'lodash-es';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { getDayIndex, getVertexId } from '../../../core/util';\nimport { idOf } from './util/util';\nimport { parseGroupReferences } from './util/parse-group-references';\nimport { parseIntervals } from './util/parse-intervals';\nimport type { Types } from '../../types';\nimport { makeChainable } from '../../../common/make-chainable';\nimport { toDayAndStart } from './events';\nimport { getDefaultInterval } from './intervals';\nimport type { Interval } from '../../../core/interfaces';\n\nfunction parse (\n lockedTime: ConnectedTypes.lockedTime,\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n defaultInterval: Interval[]\n) {\n const duration = lockedTime.duration;\n if (!duration || duration < 5) throw new Error('(RS::To::DynamicLockedTimes) Length of a locked time is less than 5 min');\n\n const dependencyReferences = makeChainable(lockedTime.coalesced ?? [])\n .chain(\n x => x\n .filter(x => x.toModel == 'locations')\n .map(x => getVertexId(x.to, options)),\n x => uniq(x),\n x => x.map(x => [x])\n )\n .value;\n\n const days = lockedTime.intervals\n ? makeChainable(lockedTime.intervals)\n .chain(\n x => x.map(x => getDayIndex(x.start)),\n x => uniq(x),\n )\n .value\n : undefined;\n const day = days?.length == 1 ? days[0] : undefined;\n\n // ignore locked times that reside on days that are not part of any coalesced's days\n if (day != null && lockedTime.coalesced) {\n const allowedByEvery = lockedTime.coalesced.every(x => !x.to.days?.length || x.to.days.some(x => x.day == day));\n if (!allowedByEvery) return;\n }\n\n // each type (tag) of complementary hours should distribute evenly\n const distributionKey = lockedTime.type == 'COMPLEMENTARY_TIME'\n ? 'COMPLEMENTARY_TIME.' + lockedTime.tags?.at(0)?.value\n : undefined;\n\n const intervals = lockedTime.intervals ?? defaultInterval;\n\n const doc: Types.event = {\n id: idOf.lockedTime(lockedTime, options),\n length: duration,\n minBreakLength: false,\n maxLengthVariance: lockedTime.durationVariance,\n groups: parseGroupReferences({ type: 'lockedTime', item: lockedTime }, options),\n dependencies: dependencyReferences,\n intervals: options.oldFormat\n ? parseIntervals(intervals, undefined, settings)\n : idOf.intervalPairReference(intervals, undefined, options),\n distributionKey,\n ...days && { days },\n ...day && { day },\n };\n\n\n ////\n //// filter based on partialScheduleOptions\n ////\n if (options.partialScheduleOptions) {\n const { includedEvents, omittedEventsHandling } = options.partialScheduleOptions;\n if (includedEvents && !includedEvents.has(doc.id)) {\n\n if (omittedEventsHandling == 'ignore') return;\n\n if (omittedEventsHandling == 'freeze') {\n // must not be parked and have a start and duration to be frozen, otherwise it's ignored\n if (lockedTime.parked || !lockedTime.start || !lockedTime.duration) return;\n\n // fix day, start and end\n Object.assign(doc, toDayAndStart(lockedTime.start));\n doc.length = lockedTime.duration;\n doc.maxLengthVariance = 0;\n\n // override intervals and days to not cause conflicts\n const numDays = settings.numDays ?? 5;\n doc.days = Array.from({ length: numDays }, (_, i) => i);\n doc.intervals = Array.from({ length: numDays }, () => [{ beg: 0, end: 23.55 }]);\n\n // fix locations\n // > locations are always fixed for locked times\n }\n }\n }\n\n return omitBy(doc, x => x == null) as Types.event;\n}\n\nexport function fromDynamicLockedTimes (\n lockedTimes: ConnectedTypes.lockedTime[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions,\n): (Types.collection | Types.event)[] {\n const defaultInterval = getDefaultInterval(settings);\n\n const complementaryHours = makeChainable(lockedTimes)\n .chain(\n x => x\n .filter(x => x.type == 'COMPLEMENTARY_TIME')\n .map(x => parse(x, settings, options, defaultInterval))\n .filter(x => !!x),\n x => groupBy(x, x => [x.distributionKey].flat().toSorted().join('|')),\n x => Object.entries(x)\n .map(([id, events]) => ({ id: `COMPLEMENTARY_TIME.${id}`, events }) as Types.collection),\n )\n .value;\n\n const lunches = lockedTimes\n .filter(x => x.type == 'LUNCH')\n .map(lockedTime => parse(lockedTime, settings, options, defaultInterval))\n .filter(x => !!x);\n\n return [...complementaryHours, ...lunches];\n};"],"mappings":";;;;;;;;;;AAYA,SAAS,MACP,YACA,UACA,SACA,iBACA;CACA,MAAM,WAAW,WAAW;AAC5B,KAAI,CAAC,YAAY,WAAW,EAAG,OAAM,IAAI,MAAM,0EAA0E;CAEzH,MAAM,uBAAuB,cAAc,WAAW,aAAa,EAAE,CAAC,CACnE,OACC,MAAK,EACF,QAAO,QAAKA,IAAE,WAAW,YAAY,CACrC,KAAI,QAAK,YAAYA,IAAE,IAAI,QAAQ,CAAC,GACvC,MAAK,KAAK,EAAE,GACZ,MAAK,EAAE,KAAI,QAAK,CAACA,IAAE,CAAC,CACrB,CACA;CAEH,MAAM,OAAO,WAAW,YACpB,cAAc,WAAW,UAAU,CAClC,OACC,MAAK,EAAE,KAAI,QAAK,YAAYA,IAAE,MAAM,CAAC,GACrC,MAAK,KAAK,EAAE,CACb,CACA,QACD;CACJ,MAAM,MAAM,MAAM,UAAU,IAAI,KAAK,K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K,KAAK;;AAGpC,SAAgB,uBACd,aACA,UACA,SACoC;CACpC,MAAM,kBAAkB,mBAAmB,SAAS;CAEpD,MAAM,qBAAqB,cAAc,YAAY,CAClD,OACC,MAAK,EACF,QAAO,QAAKD,IAAE,QAAQ,qBAAqB,CAC3C,KAAI,QAAK,MAAMA,KAAG,UAAU,SAAS,gBAAgB,CAAC,CACtD,QAAO,QAAK,CAAC,CAACA,IAAE,GACnB,MAAK,QAAQ,IAAG,QAAK,CAACA,IAAE,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,GACrE,MAAK,OAAO,QAAQ,EAAE,CACnB,KAAK,CAAC,IAAI,aAAa;EAAE,IAAI,sBAAsB;EAAM;EAAQ,EAAsB,CAC3F,CACA;CAEH,MAAM,UAAU,YACb,QAAO,MAAK,EAAE,QAAQ,QAAQ,CAC9B,KAAI,eAAc,MAAM,YAAY,UAAU,SAAS,gBAAgB,CAAC,CACxE,QAAO,MAAK,CAAC,CAAC,EAAE;AAEnB,QAAO,CAAC,GAAG,oBAAoB,GAAG,QAAQ"}
@@ -22,16 +22,18 @@ function parseEvents(events, settings, options, periodsMap) {
22
22
  return (events ?? []).map((event) => {
23
23
  const id = getVertexId(event, options);
24
24
  const intervals = event.intervals ?? event.course?.intervals ?? defaultInterval;
25
- const duration = event.preferredDuration ?? event.duration;
25
+ const duration = event.preferredDuration;
26
26
  if (!duration) throw new Error(`(RS::To::Events) Event "${id}" has no duration`);
27
+ const forcedOverlapId = event.overlapSpecies?.species?.find(({ to }) => to == event)?.id;
28
+ const maxLengthVariance = forcedOverlapId != null ? event.durationVariance ?? 0 : 0;
27
29
  const doc = {
28
30
  id: idOf.event(event, options),
29
31
  length: duration,
30
- maxLengthVariance: event.durationVariance,
32
+ maxLengthVariance,
31
33
  weight: event.weight,
32
34
  density: event.density,
33
35
  potentialCenter: event.centerOfAttraction ? parseFloat(event.centerOfAttraction.replace(":", ".")) : void 0,
34
- forcedOverlapId: event.overlapSpecies?.species?.find(({ to }) => to == event)?.id,
36
+ forcedOverlapId,
35
37
  period: getPeriodIndex(event.period, periodsMap, options),
36
38
  _period: event.period ? getVertexId(event.period, options) : void 0,
37
39
  days: parseDays(event.days, settings),