@royalschedule/maps 4.0.32 → 4.0.33

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 (286) 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 +1 -0
  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 +2 -0
  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 +1 -0
  21. package/dist/Admentum/from/schedules.js +3 -6
  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 +1 -0
  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 +4 -3
  28. package/dist/Excel/v1/from/index.js +1 -1
  29. package/dist/Excel/v1/from/index.js.map +1 -1
  30. package/dist/Excel/v1/index.d.ts +1 -0
  31. package/dist/Excel/v2/from/index.js +45 -54
  32. package/dist/Excel/v2/from/index.js.map +1 -1
  33. package/dist/Excel/v2/index.d.ts +1 -0
  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 +1 -0
  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 +1 -0
  44. package/dist/IdunSoft/to/schedules.js +3 -6
  45. package/dist/IdunSoft/to/schedules.js.map +1 -1
  46. package/dist/InfoMentor/to/index.d.ts +1 -0
  47. package/dist/InfoMentor/to/schedules.js +1 -2
  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 +1 -0
  53. package/dist/Quiculum/file/to/index.d.ts +1 -0
  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 +1 -0
  57. package/dist/RS/from/division.js +1 -2
  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 +1 -0
  61. package/dist/RS/from/schedules.js.map +1 -1
  62. package/dist/RS/make-connected.d.ts +3 -1
  63. package/dist/RS/make-connected.js +34 -42
  64. package/dist/RS/make-connected.js.map +1 -1
  65. package/dist/RS/to/index.js.map +1 -1
  66. package/dist/RS/to/initial-configuration.js +4 -6
  67. package/dist/RS/to/initial-configuration.js.map +1 -1
  68. package/dist/RS/to/input/collections.js.map +1 -1
  69. package/dist/RS/to/input/default.js +1 -2
  70. package/dist/RS/to/input/default.js.map +1 -1
  71. package/dist/RS/to/input/dependencies.js +1 -2
  72. package/dist/RS/to/input/dependencies.js.map +1 -1
  73. package/dist/RS/to/input/dynamic-locked-times.js +1 -2
  74. package/dist/RS/to/input/dynamic-locked-times.js.map +1 -1
  75. package/dist/RS/to/input/events.js.map +1 -1
  76. package/dist/RS/to/input/groups.js.map +1 -1
  77. package/dist/RS/to/input/individuals.js +1 -2
  78. package/dist/RS/to/input/individuals.js.map +1 -1
  79. package/dist/RS/to/input/input.js +1 -2
  80. package/dist/RS/to/input/input.js.map +1 -1
  81. package/dist/RS/to/input/intervals.js +2 -4
  82. package/dist/RS/to/input/intervals.js.map +1 -1
  83. package/dist/RS/to/input/periods.js +2 -4
  84. package/dist/RS/to/input/periods.js.map +1 -1
  85. package/dist/RS/to/input/settings.js.map +1 -1
  86. package/dist/RS/to/input/teachers.js +1 -1
  87. package/dist/RS/to/input/teachers.js.map +1 -1
  88. package/dist/RS/to/input/util/attach-locked-times.js.map +1 -1
  89. package/dist/RS/to/input/util/parse-days.js.map +1 -1
  90. package/dist/RS/to/input/util/parse-group-references.js.map +1 -1
  91. package/dist/RS/to/input/util/parse-intervals.js +2 -4
  92. package/dist/RS/to/input/util/parse-intervals.js.map +1 -1
  93. package/dist/RS/to/input/util/parse-location-references.js +1 -2
  94. package/dist/RS/to/input/util/parse-location-references.js.map +1 -1
  95. package/dist/RS/to/input/util/parse-max-working-hours.js.map +1 -1
  96. package/dist/RS/to/input/util/parse-minimum-break-length.js.map +1 -1
  97. package/dist/RS/to/input/util/util.js +1 -2
  98. package/dist/RS/to/input/util/util.js.map +1 -1
  99. package/dist/RS/to/schedules.js.map +1 -1
  100. package/dist/RS/types/to.d.ts +1 -0
  101. package/dist/SS12000/from/activities.js +1 -2
  102. package/dist/SS12000/from/activities.js.map +1 -1
  103. package/dist/SS12000/from/calendar-events.js.map +1 -1
  104. package/dist/SS12000/from/duties.js.map +1 -1
  105. package/dist/SS12000/from/groups.js.map +1 -1
  106. package/dist/SS12000/from/index.js.map +1 -1
  107. package/dist/SS12000/from/persons.js.map +1 -1
  108. package/dist/SS12000/from/resources.js.map +1 -1
  109. package/dist/SS12000/from/rooms.js.map +1 -1
  110. package/dist/SS12000/from/syllabuses.js.map +1 -1
  111. package/dist/SS12000/index.d.ts +236 -201
  112. package/dist/SS12000/to/activities.js.map +1 -1
  113. package/dist/SS12000/to/calendar-events.js.map +1 -1
  114. package/dist/SS12000/to/common.js.map +1 -1
  115. package/dist/SS12000/to/duties.js.map +1 -1
  116. package/dist/SS12000/to/groups.js.map +1 -1
  117. package/dist/SS12000/to/index.d.ts +1 -0
  118. package/dist/SS12000/to/persons.js.map +1 -1
  119. package/dist/SS12000/to/resources.js.map +1 -1
  120. package/dist/SS12000/to/rooms.js.map +1 -1
  121. package/dist/SS12000/to/syllabuses.js.map +1 -1
  122. package/dist/SchoolSoft/api/from/index.js.map +1 -1
  123. package/dist/SchoolSoft/api/from/schedules.js +8 -12
  124. package/dist/SchoolSoft/api/from/schedules.js.map +1 -1
  125. package/dist/SchoolSoft/api/index.d.ts +1 -0
  126. package/dist/SchoolSoft/file/from/index.js.map +1 -1
  127. package/dist/SchoolSoft/file/from/schedules.js +83 -87
  128. package/dist/SchoolSoft/file/from/schedules.js.map +1 -1
  129. package/dist/SchoolSoft/file/index.d.ts +1 -0
  130. package/dist/SchoolSoft/file/to/index.d.ts +1 -0
  131. package/dist/SchoolSoft/file/to/schedules.js +1 -2
  132. package/dist/SchoolSoft/file/to/schedules.js.map +1 -1
  133. package/dist/SchoolSoft/index.d.ts +1 -0
  134. package/dist/Schoolity/txt/to/index.d.ts +1 -0
  135. package/dist/Schoolity/txt/to/schedules.js +5 -12
  136. package/dist/Schoolity/txt/to/schedules.js.map +1 -1
  137. package/dist/Skola24/mdb/from/course-and-events.js +3 -5
  138. package/dist/Skola24/mdb/from/course-and-events.js.map +1 -1
  139. package/dist/Skola24/mdb/from/groups.js.map +1 -1
  140. package/dist/Skola24/mdb/from/index.js.map +1 -1
  141. package/dist/Skola24/mdb/from/locations.js.map +1 -1
  142. package/dist/Skola24/mdb/from/schedule.d.ts +1 -0
  143. package/dist/Skola24/mdb/from/schedule.js.map +1 -1
  144. package/dist/Skola24/mdb/from/teachers.js.map +1 -1
  145. package/dist/Skola24/txt/from/calendar-exceptions.js +1 -2
  146. package/dist/Skola24/txt/from/calendar-exceptions.js.map +1 -1
  147. package/dist/Skola24/txt/from/division.js.map +1 -1
  148. package/dist/Skola24/txt/from/index.js.map +1 -1
  149. package/dist/Skola24/txt/from/period.js +31 -34
  150. package/dist/Skola24/txt/from/period.js.map +1 -1
  151. package/dist/Skola24/txt/from/schedules.d.ts +1 -0
  152. package/dist/Skola24/txt/from/schedules.js +6 -10
  153. package/dist/Skola24/txt/from/schedules.js.map +1 -1
  154. package/dist/Skola24/txt/from/util.js.map +1 -1
  155. package/dist/Skola24/txt/index.d.ts +1 -0
  156. package/dist/Skola24/txt/to/index.d.ts +1 -0
  157. package/dist/Skola24/txt/to/schedules.js +5 -12
  158. package/dist/Skola24/txt/to/schedules.js.map +1 -1
  159. package/dist/common/constants.js.map +1 -1
  160. package/dist/common/functions.js.map +1 -1
  161. package/dist/common/get-date.js.map +1 -1
  162. package/dist/common/make-chainable/index.js.map +1 -1
  163. package/dist/common/types.d.ts +1 -3
  164. package/dist/core/from/configurations.js.map +1 -1
  165. package/dist/core/from/courses.js.map +1 -1
  166. package/dist/core/from/events.js.map +1 -1
  167. package/dist/core/from/exceptions.js.map +1 -1
  168. package/dist/core/from/groups.js.map +1 -1
  169. package/dist/core/from/index.js.map +1 -1
  170. package/dist/core/from/locations.js.map +1 -1
  171. package/dist/core/from/locked-times.js.map +1 -1
  172. package/dist/core/from/overlap-groups.js.map +1 -1
  173. package/dist/core/from/periods.js.map +1 -1
  174. package/dist/core/from/persons.js.map +1 -1
  175. package/dist/core/from/root-intervals.js.map +1 -1
  176. package/dist/core/from/schedules.js.map +1 -1
  177. package/dist/core/from/settings.js.map +1 -1
  178. package/dist/core/from/syllabuses.js.map +1 -1
  179. package/dist/core/from/teachers.js.map +1 -1
  180. package/dist/core/index.d.ts +1 -0
  181. package/dist/core/interfaces/index.d.ts +23 -0
  182. package/dist/core/interfaces/other/companies.d.ts +1 -0
  183. package/dist/core/interfaces/other/companies.js.map +1 -1
  184. package/dist/core/interfaces/other/index.d.ts +6 -0
  185. package/dist/core/interfaces/other/operations.d.ts +1 -0
  186. package/dist/core/interfaces/vertices/companies.d.ts +1 -0
  187. package/dist/core/interfaces/vertices/configurations.d.ts +1 -0
  188. package/dist/core/interfaces/vertices/courses.d.ts +1 -0
  189. package/dist/core/interfaces/vertices/division-settings.d.ts +2 -0
  190. package/dist/core/interfaces/vertices/divisions.d.ts +1 -0
  191. package/dist/core/interfaces/vertices/events.d.ts +1 -0
  192. package/dist/core/interfaces/vertices/exceptions.d.ts +1 -0
  193. package/dist/core/interfaces/vertices/generations.d.ts +2 -0
  194. package/dist/core/interfaces/vertices/groups.d.ts +1 -0
  195. package/dist/core/interfaces/vertices/index.d.ts +1 -0
  196. package/dist/core/interfaces/vertices/locations.d.ts +1 -0
  197. package/dist/core/interfaces/vertices/locked-times.d.ts +2 -0
  198. package/dist/core/interfaces/vertices/overlap-groups.d.ts +1 -0
  199. package/dist/core/interfaces/vertices/periods.d.ts +3 -0
  200. package/dist/core/interfaces/vertices/persons.d.ts +1 -0
  201. package/dist/core/interfaces/vertices/properties/belongs-to.d.ts +1 -0
  202. package/dist/core/interfaces/vertices/properties/coalesced.d.ts +1 -0
  203. package/dist/core/interfaces/vertices/root-intervals.d.ts +2 -0
  204. package/dist/core/interfaces/vertices/syllabuses.d.ts +1 -0
  205. package/dist/core/interfaces/vertices/teachers.d.ts +1 -0
  206. package/dist/core/interfaces/vertices/threads.d.ts +6 -4
  207. package/dist/core/interfaces/vertices/users.d.ts +1 -0
  208. package/dist/core/interfaces/vertices/util/custom-vertex-export/index.d.ts +6 -6
  209. package/dist/core/interfaces/vertices/util/custom-vertex-export/util.d.ts +4 -4
  210. package/dist/core/interfaces/vertices/util/deep-vertex-export/index.d.ts +9 -9
  211. package/dist/core/interfaces/vertices/util/edges.d.ts +7 -7
  212. package/dist/core/interfaces/vertices/util/index.d.ts +6 -0
  213. package/dist/core/interfaces/vertices/util/util.d.ts +20 -24
  214. package/dist/core/interfaces/vertices/util/vertex-query/index.d.ts +11 -11
  215. package/dist/core/interfaces/vertices/util/vertex.d.ts +1 -1
  216. package/dist/core/interfaces/vertices/vertex-query.d.ts +27 -26
  217. package/dist/core/interfaces/vertices/vertex-query.js.map +1 -1
  218. package/dist/core/to/configurations.js +1 -2
  219. package/dist/core/to/configurations.js.map +1 -1
  220. package/dist/core/to/courses.js +1 -2
  221. package/dist/core/to/courses.js.map +1 -1
  222. package/dist/core/to/division.js.map +1 -1
  223. package/dist/core/to/events.js +1 -2
  224. package/dist/core/to/events.js.map +1 -1
  225. package/dist/core/to/exceptions.js +1 -2
  226. package/dist/core/to/exceptions.js.map +1 -1
  227. package/dist/core/to/groups.js +1 -2
  228. package/dist/core/to/groups.js.map +1 -1
  229. package/dist/core/to/locations.js +1 -2
  230. package/dist/core/to/locations.js.map +1 -1
  231. package/dist/core/to/locked-times.js +1 -2
  232. package/dist/core/to/locked-times.js.map +1 -1
  233. package/dist/core/to/overlap-groups.js +1 -2
  234. package/dist/core/to/overlap-groups.js.map +1 -1
  235. package/dist/core/to/periods.js +1 -2
  236. package/dist/core/to/periods.js.map +1 -1
  237. package/dist/core/to/persons.js +1 -2
  238. package/dist/core/to/persons.js.map +1 -1
  239. package/dist/core/to/root-intervals.js +1 -2
  240. package/dist/core/to/root-intervals.js.map +1 -1
  241. package/dist/core/to/schedules.d.ts +1 -0
  242. package/dist/core/to/schedules.js.map +1 -1
  243. package/dist/core/to/settings.js +1 -2
  244. package/dist/core/to/settings.js.map +1 -1
  245. package/dist/core/to/syllabuses.js +1 -2
  246. package/dist/core/to/syllabuses.js.map +1 -1
  247. package/dist/core/to/teachers.js +1 -2
  248. package/dist/core/to/teachers.js.map +1 -1
  249. package/dist/core/to/util.d.ts +2 -0
  250. package/dist/core/to/util.js +1 -2
  251. package/dist/core/to/util.js.map +1 -1
  252. package/dist/core/types/index.d.ts +1 -0
  253. package/dist/core/util.js +1 -2
  254. package/dist/core/util.js.map +1 -1
  255. package/dist/identify/constants/index.js.map +1 -1
  256. package/dist/identify/index.js +1 -2
  257. package/dist/identify/index.js.map +1 -1
  258. package/dist/sdui/from/classes.js.map +1 -1
  259. package/dist/sdui/from/courses.js.map +1 -1
  260. package/dist/sdui/from/holidays.js.map +1 -1
  261. package/dist/sdui/from/index.js.map +1 -1
  262. package/dist/sdui/from/lessons.js.map +1 -1
  263. package/dist/sdui/from/rooms.js.map +1 -1
  264. package/dist/sdui/from/schedules.d.ts +2 -0
  265. package/dist/sdui/from/schedules.js.map +1 -1
  266. package/dist/sdui/from/school-years.js.map +1 -1
  267. package/dist/sdui/from/substitution-plans.js.map +1 -1
  268. package/dist/sdui/from/teachers.js.map +1 -1
  269. package/dist/sdui/to/classes.js.map +1 -1
  270. package/dist/sdui/to/courses.js.map +1 -1
  271. package/dist/sdui/to/holidays.js.map +1 -1
  272. package/dist/sdui/to/hours.js.map +1 -1
  273. package/dist/sdui/to/index.d.ts +2 -0
  274. package/dist/sdui/to/lessons.js.map +1 -1
  275. package/dist/sdui/to/rooms.js.map +1 -1
  276. package/dist/sdui/to/schedules.js.map +1 -1
  277. package/dist/sdui/to/school-years.js.map +1 -1
  278. package/dist/sdui/to/substitution-plans.js +3 -6
  279. package/dist/sdui/to/substitution-plans.js.map +1 -1
  280. package/dist/sdui/to/teachers.js.map +1 -1
  281. package/dist/vKlass/from/index.js.map +1 -1
  282. package/dist/vKlass/from/schedule.d.ts +1 -0
  283. package/dist/vKlass/from/schedule.js.map +1 -1
  284. package/dist/vKlass/to/schedules.js +6 -17
  285. package/dist/vKlass/to/schedules.js.map +1 -1
  286. package/package.json +1 -1
@@ -34,7 +34,7 @@ var schedules_default = (courseEvents) => {
34
34
  const Personal = (event.teachers ?? course.teachers ?? []).map(({ to: x }) => typeof x == "object" && "displayName" in x ? x.displayName : null).filter((x) => x != null).join(",");
35
35
  const Klasser = (event.groups ?? course.groups ?? []).map(({ to: x }) => typeof x == "object" && "displayName" in x ? x.displayName : null).filter((x) => x != null).join(",");
36
36
  const Salar = (event.inLocations ?? []).map((x) => x && typeof x == "object" && "displayName" in x ? x.displayName : null).filter((x) => x != null).join(",");
37
- const doc = {
37
+ return {
38
38
  Ämne: course.displayName,
39
39
  Dag: day,
40
40
  Starttid: moment.utc(event.start).format("HH.mm"),
@@ -43,7 +43,6 @@ var schedules_default = (courseEvents) => {
43
43
  Klasser,
44
44
  Salar
45
45
  };
46
- return doc;
47
46
  });
48
47
  const opts = {
49
48
  columns,
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["doc: InfoMentorTypes.event"],"sources":["../../../src/InfoMentor/to/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport iconv from 'iconv-lite';\nimport Papa from 'papaparse';\nimport type { Types as InfoMentorTypes } from '../types';\nimport type { CoreTypes } from '../../core';\nimport { getDayIndex } from '../../core/util';\nimport { isMongooseObjectId } from '../../common/functions';\n\nconst days = ['MÅN', 'TIS', 'ONS', 'TOR', 'FRE'];\nconst columns = ['Ämne', 'Dag', 'Starttid', 'Längd', 'Personal', 'Klasser', 'Salar'];\nconst delimiter = '\\t';\nconst encoding = 'windows-1252';\n\nexport default (courseEvents: CoreTypes.Mixed.Event[]): Buffer => {\n const events = courseEvents\n .map(event => {\n if (event.parked || !event.start || !event.end) return;\n\n const course = event.course;\n if (!course) return;\n\n const day = days.at(getDayIndex(event.start));\n if (!day) throw new Error('Invalid event day');\n\n if (typeof course == 'string' || isMongooseObjectId(course))\n throw new Error('(InfoMentor::To::Schedules) Event course is not an deserialized object');\n\n const Personal = (event.teachers ?? course.teachers ?? []).map(({ to: x }) => typeof x == 'object' && 'displayName' in x ? x.displayName : null).filter(x => x != null).join(',');\n const Klasser = (event.groups ?? course.groups ?? []).map(({ to: x }) => typeof x == 'object' && 'displayName' in x ? x.displayName : null).filter(x => x != null).join(',');\n const Salar = (event.inLocations ?? []).map(x => x && typeof x == 'object' && 'displayName' in x ? x.displayName : null).filter(x => x != null).join(',');\n\n const doc: InfoMentorTypes.event ={\n Ämne: course.displayName,\n Dag: day,\n Starttid: moment.utc(event.start).format('HH.mm'),\n Längd: moment.utc(event.end).diff(moment.utc(event.start), 'minutes'),\n Personal,\n Klasser,\n Salar,\n };\n return doc;\n });\n\n const opts = { columns, delimiter };\n const csv = Papa.unparse(events, opts);\n return iconv.encode(csv, encoding);\n};\n"],"mappings":";;;;;;;AAQA,MAAM,OAAY;CAAC;CAAO;CAAO;CAAO;CAAO;;AAC/C,MAAM,UAAY;CAAC;CAAQ;CAAO;CAAY;CAAS;CAAY;CAAW;;AAC9E,MAAM,YAAY;AAClB,MAAM,WAAY;AAElB,yBAAgB,iBAAkD;CAChE,MAAM,SAAS,aACZ,KAAI,UAAS;AACZ,MAAI,MAAM,UAAU,CAAC,MAAM,SAAS,CAAC,MAAM,IAAK;EAEhD,MAAM,SAAS,MAAM;AACrB,MAAI,CAAC,OAAQ;EAEb,MAAM,MAAM,KAAK,GAAG,YAAY,MAAM;AACtC,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM;AAE1B,MAAI,OAAO,UAAU,YAAY,mBAAmB,QAClD,OAAM,IAAI,MAAM;EAElB,MAAM,YAAY,MAAM,YAAY,OAAO,YAAY,IAAI,KAAK,EAAE,IAAI,QAAa,OAAO,KAAK,YAAY,iBAAiB,IAAI,EAAE,cAAc,MAAM,QAAO,MAAK,KAAK,MAAM,KAAK;EAClL,MAAM,WAAY,MAAM,UAAY,OAAO,UAAY,IAAI,KAAK,EAAE,IAAI,QAAa,OAAO,KAAK,YAAY,iBAAiB,IAAI,EAAE,cAAc,MAAM,QAAO,MAAK,KAAK,MAAM,KAAK;EAClL,MAAM,SAAY,MAAM,eAA+B,IAAI,KAAI,MAAe,KAAK,OAAO,KAAK,YAAY,iBAAiB,IAAI,EAAE,cAAc,MAAM,QAAO,MAAK,KAAK,MAAM,KAAK;EAElL,MAAMA,MAA4B;GAChC,MAAU,OAAO;GACjB,KAAU;GACV,UAAU,OAAO,IAAI,MAAM,OAAO,OAAO;GACzC,OAAU,OAAO,IAAI,MAAM,KAAK,KAAK,OAAO,IAAI,MAAM,QAAQ;GAC9D;GACA;GACA;;AAEF,SAAO;;CAGX,MAAM,OAAO;EAAE;EAAS;;CACxB,MAAM,MAAM,KAAK,QAAQ,QAAQ;AACjC,QAAO,MAAM,OAAO,KAAK"}
1
+ {"version":3,"file":"schedules.js","names":[],"sources":["../../../src/InfoMentor/to/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport iconv from 'iconv-lite';\nimport Papa from 'papaparse';\nimport type { Types as InfoMentorTypes } from '../types';\nimport type { CoreTypes } from '../../core';\nimport { getDayIndex } from '../../core/util';\nimport { isMongooseObjectId } from '../../common/functions';\n\nconst days = ['MÅN', 'TIS', 'ONS', 'TOR', 'FRE'];\nconst columns = ['Ämne', 'Dag', 'Starttid', 'Längd', 'Personal', 'Klasser', 'Salar'];\nconst delimiter = '\\t';\nconst encoding = 'windows-1252';\n\nexport default (courseEvents: CoreTypes.Mixed.Event[]): Buffer => {\n const events = courseEvents\n .map(event => {\n if (event.parked || !event.start || !event.end) return;\n\n const course = event.course;\n if (!course) return;\n\n const day = days.at(getDayIndex(event.start));\n if (!day) throw new Error('Invalid event day');\n\n if (typeof course == 'string' || isMongooseObjectId(course))\n throw new Error('(InfoMentor::To::Schedules) Event course is not an deserialized object');\n\n const Personal = (event.teachers ?? course.teachers ?? []).map(({ to: x }) => typeof x == 'object' && 'displayName' in x ? x.displayName : null).filter(x => x != null).join(',');\n const Klasser = (event.groups ?? course.groups ?? []).map(({ to: x }) => typeof x == 'object' && 'displayName' in x ? x.displayName : null).filter(x => x != null).join(',');\n const Salar = (event.inLocations ?? []).map(x => x && typeof x == 'object' && 'displayName' in x ? x.displayName : null).filter(x => x != null).join(',');\n\n const doc: InfoMentorTypes.event ={\n Ämne: course.displayName,\n Dag: day,\n Starttid: moment.utc(event.start).format('HH.mm'),\n Längd: moment.utc(event.end).diff(moment.utc(event.start), 'minutes'),\n Personal,\n Klasser,\n Salar,\n };\n return doc;\n });\n\n const opts = { columns, delimiter };\n const csv = Papa.unparse(events, opts);\n return iconv.encode(csv, encoding);\n};\n"],"mappings":";;;;;;;AAQA,MAAM,OAAY;CAAC;CAAO;CAAO;CAAO;CAAO;CAAM;AACrD,MAAM,UAAY;CAAC;CAAQ;CAAO;CAAY;CAAS;CAAY;CAAW;CAAQ;AACtF,MAAM,YAAY;AAClB,MAAM,WAAY;AAElB,yBAAgB,iBAAkD;CAChE,MAAM,SAAS,aACZ,KAAI,UAAS;AACZ,MAAI,MAAM,UAAU,CAAC,MAAM,SAAS,CAAC,MAAM,IAAK;EAEhD,MAAM,SAAS,MAAM;AACrB,MAAI,CAAC,OAAQ;EAEb,MAAM,MAAM,KAAK,GAAG,YAAY,MAAM,MAAM,CAAC;AAC7C,MAAI,CAAC,IAAK,OAAM,IAAI,MAAM,oBAAoB;AAE9C,MAAI,OAAO,UAAU,YAAY,mBAAmB,OAAO,CACzD,OAAM,IAAI,MAAM,yEAAyE;EAE3F,MAAM,YAAY,MAAM,YAAY,OAAO,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,QAAa,OAAO,KAAK,YAAY,iBAAiB,IAAI,EAAE,cAAc,KAAK,CAAC,QAAO,MAAK,KAAK,KAAK,CAAC,KAAK,IAAI;EACtL,MAAM,WAAY,MAAM,UAAY,OAAO,UAAY,EAAE,EAAE,KAAK,EAAE,IAAI,QAAa,OAAO,KAAK,YAAY,iBAAiB,IAAI,EAAE,cAAc,KAAK,CAAC,QAAO,MAAK,KAAK,KAAK,CAAC,KAAK,IAAI;EACtL,MAAM,SAAY,MAAM,eAA+B,EAAE,EAAE,KAAI,MAAe,KAAK,OAAO,KAAK,YAAY,iBAAiB,IAAI,EAAE,cAAc,KAAK,CAAC,QAAO,MAAK,KAAK,KAAK,CAAC,KAAK,IAAI;AAWtL,SATkC;GAChC,MAAU,OAAO;GACjB,KAAU;GACV,UAAU,OAAO,IAAI,MAAM,MAAM,CAAC,OAAO,QAAQ;GACjD,OAAU,OAAO,IAAI,MAAM,IAAI,CAAC,KAAK,OAAO,IAAI,MAAM,MAAM,EAAE,UAAU;GACxE;GACA;GACA;GACD;GAED;CAEJ,MAAM,OAAO;EAAE;EAAS;EAAW;CACnC,MAAM,MAAM,KAAK,QAAQ,QAAQ,KAAK;AACtC,QAAO,MAAM,OAAO,KAAK,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_schedules"],"sources":["../../../src/PlanDigital/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport _schedules from './schedules';\n\nexport default {\n schedules: _schedules\n} satisfies FromInterface;"],"mappings":";;;AAGA,mBAAe,EACb,WAAWA"}
1
+ {"version":3,"file":"index.js","names":["_schedules"],"sources":["../../../src/PlanDigital/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport _schedules from './schedules';\n\nexport default {\n schedules: _schedules\n} satisfies FromInterface;"],"mappings":";;;AAGA,mBAAe,EACb,WAAWA,mBACZ"}
@@ -17,8 +17,7 @@ var schedules_default = (input, options) => {
17
17
  errors.push(`The selected period ${x} does not exist.`);
18
18
  return { meta: { errors } };
19
19
  }
20
- const numUnits = size(countBy(input["Perioder"].map((x) => x.Tidsenhet)));
21
- if (numUnits > 1) {
20
+ if (size(countBy(input["Perioder"].map((x) => x.Tidsenhet))) > 1) {
22
21
  errors.push("Different time periods used for different periods.");
23
22
  return { meta: { errors } };
24
23
  }
@@ -31,18 +30,18 @@ var schedules_default = (input, options) => {
31
30
  if (sum(periodTimes) == 0) return;
32
31
  const displayName = c[options.displayName ?? "Gruppnamn"];
33
32
  const subject = c["Kurskod"];
34
- const groups$1 = c["Klass"]?.split(",").map((x) => x.trim());
33
+ const groups = c["Klass"]?.split(",").map((x) => x.trim());
35
34
  const teachers$1 = c["Sign"]?.split(",").map((x) => x.trim());
36
35
  const periodTime = size(countBy(periodTimes)) == 1 ? periodTimes[0] : void 0;
37
36
  const minutesPerWeek = timeUnit == "Minuter/Vecka" ? periodTime : void 0;
38
37
  const expectedTotalHours = timeUnit == "Timmar/Period" ? periodTime : void 0;
39
38
  teachers$1.forEach((x) => teacherSet.add(x));
40
- groups$1.forEach((x) => groupSet.add(x));
39
+ groups.forEach((x) => groupSet.add(x));
41
40
  courses.push({
42
41
  displayName,
43
42
  subject,
44
43
  teachers: teachers$1.map((to) => ({ to })),
45
- groups: groups$1.map((to) => ({ to })),
44
+ groups: groups.map((to) => ({ to })),
46
45
  ...minutesPerWeek != void 0 && { minutesPerWeek },
47
46
  ...expectedTotalHours != void 0 && { expectedTotalHours }
48
47
  });
@@ -51,13 +50,12 @@ var schedules_default = (input, options) => {
51
50
  ids,
52
51
  displayName: ids
53
52
  }));
54
- const groups = [...groupSet].map((ids) => ({
55
- ids,
56
- displayName: ids,
57
- species: "class"
58
- }));
59
53
  return {
60
- groups,
54
+ groups: [...groupSet].map((ids) => ({
55
+ ids,
56
+ displayName: ids,
57
+ species: "class"
58
+ })),
61
59
  teachers,
62
60
  courses,
63
61
  meta: {
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["warnings: string[]","errors: string[]","groups","teachers"],"sources":["../../../src/PlanDigital/from/schedules.ts"],"sourcesContent":["import { size, countBy, sum } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Types as PlanDigitalTypes } from '../types';\nimport type { InternalIdKey } from '../../core/types/common';\n\nnamespace OutTypes {\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n}\n\ntype Out = {\n groups?: OutTypes.group[];\n teachers?: OutTypes.teacher[];\n courses?: OutTypes.course[];\n meta?: {\n errors?: string[];\n warnings?: string[];\n };\n};\n\nexport default (\n input: PlanDigitalTypes.schedule,\n options: PlanDigitalTypes.options\n): Out => {\n // gather all import related warnings/errors\n const warnings: string[] = [];\n const errors: string[] = [];\n\n // there must be at least a single period\n if (!input['Perioder'].length) {\n errors.push('The schedule data does not contain any periods.');\n return { meta: { errors } };\n }\n\n // ensure that at least one period is selected\n const selectedPeriods = options.selectedPeriods;\n if (!selectedPeriods?.length) {\n errors.push('No periods were selected.');\n return { meta: { errors } };\n }\n\n // ensure that the selected periods exist\n for (const x of options.selectedPeriods ?? []) {\n if (!input['Perioder'].some(p => p.Namn == x)) {\n errors.push(`The selected period ${x} does not exist.`);\n return { meta: { errors } };\n }\n }\n\n // ensure that all periods use the same time unit\n const numUnits = size(countBy(input['Perioder'].map(x => x.Tidsenhet)));\n if (numUnits > 1) {\n errors.push('Different time periods used for different periods.');\n return { meta: { errors } };\n }\n const timeUnit = input['Perioder'][0].Tidsenhet;\n\n\n ////\n //// fetch courses, groups, and teachers\n ////\n const courses = new Array<OutTypes.course>();\n const teacherSet = new Set<string>();\n const groupSet = new Set<string>();\n input['Tabell Tjänstefördelning'].forEach(c => {\n // check if the course should be taken into account\n // (the course must then have some scheduled time during the selected periods)\n const periodTimes = selectedPeriods.map(x => c[`Tid ${x}`] ?? 0);\n if (sum(periodTimes) == 0) return;\n\n const displayName = c[options.displayName ?? 'Gruppnamn'];\n const subject = c['Kurskod'];\n const groups = c['Klass']?.split(',').map(x => x.trim());\n const teachers = c['Sign'] ?.split(',').map(x => x.trim());\n\n // fetch the expected schedule time in whatever units\n const periodTime = size(countBy(periodTimes)) == 1 ? periodTimes[0] : undefined;\n const minutesPerWeek = timeUnit == 'Minuter/Vecka' ? periodTime : undefined;\n const expectedTotalHours = timeUnit == 'Timmar/Period' ? periodTime : undefined;\n\n // add groups and teachers\n teachers.forEach(x => teacherSet.add(x));\n groups.forEach(x => groupSet.add(x));\n\n // add course\n courses.push({\n displayName,\n subject,\n teachers: teachers.map(to => ({ to })),\n groups: groups .map(to => ({ to })),\n\n ...(minutesPerWeek != undefined && { minutesPerWeek }),\n ...(expectedTotalHours != undefined && { expectedTotalHours })\n });\n\n });\n\n\n const teachers = [...teacherSet].map(ids => ({ ids, displayName: ids }));\n const groups = [...groupSet ].map(ids => ({ ids, displayName: ids, species: 'class' as const }));\n return { groups, teachers, courses,\n meta: {\n ...( errors.length && { errors: errors } ),\n ...( warnings.length && { warnings: warnings } )\n }\n };\n};"],"mappings":";;;AAqBA,yBACE,OACA,YACQ;CAER,MAAMA,WAAqB;CAC3B,MAAMC,SAAqB;AAG3B,KAAI,CAAC,MAAM,YAAY,QAAQ;AAC7B,SAAO,KAAK;AACZ,SAAO,EAAE,MAAM,EAAE;;CAInB,MAAM,kBAAkB,QAAQ;AAChC,KAAI,CAAC,iBAAiB,QAAQ;AAC5B,SAAO,KAAK;AACZ,SAAO,EAAE,MAAM,EAAE;;AAInB,MAAK,MAAM,KAAK,QAAQ,mBAAmB,GACzC,KAAI,CAAC,MAAM,YAAY,MAAK,MAAK,EAAE,QAAQ,IAAI;AAC7C,SAAO,KAAK,uBAAuB,EAAE;AACrC,SAAO,EAAE,MAAM,EAAE;;CAKrB,MAAM,WAAW,KAAK,QAAQ,MAAM,YAAY,KAAI,MAAK,EAAE;AAC3D,KAAI,WAAW,GAAG;AAChB,SAAO,KAAK;AACZ,SAAO,EAAE,MAAM,EAAE;;CAEnB,MAAM,WAAW,MAAM,YAAY,GAAG;CAMtC,MAAM,UAAa,IAAI;CACvB,MAAM,6BAAa,IAAI;CACvB,MAAM,2BAAa,IAAI;AACvB,OAAM,4BAA4B,SAAQ,MAAK;EAG7C,MAAM,cAAc,gBAAgB,KAAI,MAAK,EAAE,OAAO,QAAQ;AAC9D,MAAI,IAAI,gBAAgB,EAAG;EAE3B,MAAM,cAAc,EAAE,QAAQ,eAAe;EAC7C,MAAM,UAAc,EAAE;EACtB,MAAMC,WAAc,EAAE,UAAU,MAAM,KAAK,KAAI,MAAK,EAAE;EACtD,MAAMC,aAAc,EAAE,SAAU,MAAM,KAAK,KAAI,MAAK,EAAE;EAGtD,MAAM,aAAqB,KAAK,QAAQ,iBAAiB,IAAI,YAAY,KAAK;EAC9E,MAAM,iBAAqB,YAAY,kBAA0B,aAAiB;EAClF,MAAM,qBAAqB,YAAY,kBAA0B,aAAiB;AAGlF,aAAS,SAAQ,MAAK,WAAW,IAAI;AACrC,WAAO,SAAQ,MAAO,SAAS,IAAI;AAGnC,UAAQ,KAAK;GACX;GACA;GACA,UAAUA,WAAS,KAAI,QAAO,EAAE;GAChC,QAAUD,SAAS,KAAI,QAAO,EAAE;GAEhC,GAAI,kBAAsB,UAAa,EAAE;GACzC,GAAI,sBAAsB,UAAa,EAAE;;;CAM7C,MAAM,WAAW,CAAC,GAAG,YAAY,KAAI,SAAQ;EAAE;EAAK,aAAa;;CACjE,MAAM,SAAW,CAAC,GAAG,UAAY,KAAI,SAAQ;EAAE;EAAK,aAAa;EAAK,SAAS;;AAC/E,QAAO;EAAE;EAAQ;EAAU;EACzB,MAAM;GACJ,GAAK,OAAO,UAAY,EAAY;GACpC,GAAK,SAAS,UAAU,EAAY"}
1
+ {"version":3,"file":"schedules.js","names":["warnings: string[]","errors: string[]","teachers"],"sources":["../../../src/PlanDigital/from/schedules.ts"],"sourcesContent":["import { size, countBy, sum } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Types as PlanDigitalTypes } from '../types';\nimport type { InternalIdKey } from '../../core/types/common';\n\nnamespace OutTypes {\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n}\n\ntype Out = {\n groups?: OutTypes.group[];\n teachers?: OutTypes.teacher[];\n courses?: OutTypes.course[];\n meta?: {\n errors?: string[];\n warnings?: string[];\n };\n};\n\nexport default (\n input: PlanDigitalTypes.schedule,\n options: PlanDigitalTypes.options\n): Out => {\n // gather all import related warnings/errors\n const warnings: string[] = [];\n const errors: string[] = [];\n\n // there must be at least a single period\n if (!input['Perioder'].length) {\n errors.push('The schedule data does not contain any periods.');\n return { meta: { errors } };\n }\n\n // ensure that at least one period is selected\n const selectedPeriods = options.selectedPeriods;\n if (!selectedPeriods?.length) {\n errors.push('No periods were selected.');\n return { meta: { errors } };\n }\n\n // ensure that the selected periods exist\n for (const x of options.selectedPeriods ?? []) {\n if (!input['Perioder'].some(p => p.Namn == x)) {\n errors.push(`The selected period ${x} does not exist.`);\n return { meta: { errors } };\n }\n }\n\n // ensure that all periods use the same time unit\n const numUnits = size(countBy(input['Perioder'].map(x => x.Tidsenhet)));\n if (numUnits > 1) {\n errors.push('Different time periods used for different periods.');\n return { meta: { errors } };\n }\n const timeUnit = input['Perioder'][0].Tidsenhet;\n\n\n ////\n //// fetch courses, groups, and teachers\n ////\n const courses = new Array<OutTypes.course>();\n const teacherSet = new Set<string>();\n const groupSet = new Set<string>();\n input['Tabell Tjänstefördelning'].forEach(c => {\n // check if the course should be taken into account\n // (the course must then have some scheduled time during the selected periods)\n const periodTimes = selectedPeriods.map(x => c[`Tid ${x}`] ?? 0);\n if (sum(periodTimes) == 0) return;\n\n const displayName = c[options.displayName ?? 'Gruppnamn'];\n const subject = c['Kurskod'];\n const groups = c['Klass']?.split(',').map(x => x.trim());\n const teachers = c['Sign'] ?.split(',').map(x => x.trim());\n\n // fetch the expected schedule time in whatever units\n const periodTime = size(countBy(periodTimes)) == 1 ? periodTimes[0] : undefined;\n const minutesPerWeek = timeUnit == 'Minuter/Vecka' ? periodTime : undefined;\n const expectedTotalHours = timeUnit == 'Timmar/Period' ? periodTime : undefined;\n\n // add groups and teachers\n teachers.forEach(x => teacherSet.add(x));\n groups.forEach(x => groupSet.add(x));\n\n // add course\n courses.push({\n displayName,\n subject,\n teachers: teachers.map(to => ({ to })),\n groups: groups .map(to => ({ to })),\n\n ...(minutesPerWeek != undefined && { minutesPerWeek }),\n ...(expectedTotalHours != undefined && { expectedTotalHours })\n });\n\n });\n\n\n const teachers = [...teacherSet].map(ids => ({ ids, displayName: ids }));\n const groups = [...groupSet ].map(ids => ({ ids, displayName: ids, species: 'class' as const }));\n return { groups, teachers, courses,\n meta: {\n ...( errors.length && { errors: errors } ),\n ...( warnings.length && { warnings: warnings } )\n }\n };\n};"],"mappings":";;;AAqBA,yBACE,OACA,YACQ;CAER,MAAMA,WAAqB,EAAE;CAC7B,MAAMC,SAAqB,EAAE;AAG7B,KAAI,CAAC,MAAM,YAAY,QAAQ;AAC7B,SAAO,KAAK,kDAAkD;AAC9D,SAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;;CAI7B,MAAM,kBAAkB,QAAQ;AAChC,KAAI,CAAC,iBAAiB,QAAQ;AAC5B,SAAO,KAAK,4BAA4B;AACxC,SAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;;AAI7B,MAAK,MAAM,KAAK,QAAQ,mBAAmB,EAAE,CAC3C,KAAI,CAAC,MAAM,YAAY,MAAK,MAAK,EAAE,QAAQ,EAAE,EAAE;AAC7C,SAAO,KAAK,uBAAuB,EAAE,kBAAkB;AACvD,SAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;;AAM/B,KADiB,KAAK,QAAQ,MAAM,YAAY,KAAI,MAAK,EAAE,UAAU,CAAC,CAAC,GACxD,GAAG;AAChB,SAAO,KAAK,qDAAqD;AACjE,SAAO,EAAE,MAAM,EAAE,QAAQ,EAAE;;CAE7B,MAAM,WAAW,MAAM,YAAY,GAAG;CAMtC,MAAM,UAAa,IAAI,OAAwB;CAC/C,MAAM,6BAAa,IAAI,KAAa;CACpC,MAAM,2BAAa,IAAI,KAAa;AACpC,OAAM,4BAA4B,SAAQ,MAAK;EAG7C,MAAM,cAAc,gBAAgB,KAAI,MAAK,EAAE,OAAO,QAAQ,EAAE;AAChE,MAAI,IAAI,YAAY,IAAI,EAAG;EAE3B,MAAM,cAAc,EAAE,QAAQ,eAAe;EAC7C,MAAM,UAAc,EAAE;EACtB,MAAM,SAAc,EAAE,UAAU,MAAM,IAAI,CAAC,KAAI,MAAK,EAAE,MAAM,CAAC;EAC7D,MAAMC,aAAc,EAAE,SAAU,MAAM,IAAI,CAAC,KAAI,MAAK,EAAE,MAAM,CAAC;EAG7D,MAAM,aAAqB,KAAK,QAAQ,YAAY,CAAC,IAAI,IAAI,YAAY,KAAK;EAC9E,MAAM,iBAAqB,YAAY,kBAA0B,aAAiB;EAClF,MAAM,qBAAqB,YAAY,kBAA0B,aAAiB;AAGlF,aAAS,SAAQ,MAAK,WAAW,IAAI,EAAE,CAAC;AACxC,SAAO,SAAQ,MAAO,SAAS,IAAI,EAAE,CAAC;AAGtC,UAAQ,KAAK;GACX;GACA;GACA,UAAUA,WAAS,KAAI,QAAO,EAAE,IAAI,EAAE;GACtC,QAAU,OAAS,KAAI,QAAO,EAAE,IAAI,EAAE;GAEtC,GAAI,kBAAsB,UAAa,EAAE,gBAAoB;GAC7D,GAAI,sBAAsB,UAAa,EAAE,oBAAoB;GAC9D,CAAC;GAEF;CAGF,MAAM,WAAW,CAAC,GAAG,WAAW,CAAC,KAAI,SAAQ;EAAE;EAAK,aAAa;EAAK,EAAE;AAExE,QAAO;EAAE,QADQ,CAAC,GAAG,SAAW,CAAC,KAAI,SAAQ;GAAE;GAAK,aAAa;GAAK,SAAS;GAAkB,EAAE;EAClF;EAAU;EACzB,MAAM;GACJ,GAAK,OAAO,UAAY,EAAY,QAAU;GAC9C,GAAK,SAAS,UAAU,EAAY,UAAU;GAC/C;EACF"}
@@ -5,6 +5,7 @@ import { MaximumScheduleSpan } from "../core/interfaces/vertices/properties/maxi
5
5
  import { PlannedScheduledDuration } from "../core/interfaces/vertices/properties/planned-scheduled-duration.js";
6
6
  import { MinBreakLength } from "../core/interfaces/vertices/properties/min-break-length.js";
7
7
  import { Types } from "./types/index.js";
8
+ import "../index.js";
8
9
 
9
10
  //#region src/PlanDigital/index.d.ts
10
11
  declare class PlanDigitalMap {
@@ -1,4 +1,5 @@
1
1
  import { Types } from "../../../core/types/index.js";
2
+ import "../../../index.js";
2
3
  import * as xlsx0 from "xlsx";
3
4
 
4
5
  //#region src/Quiculum/file/to/index.d.ts
@@ -5,8 +5,7 @@ import XLSX from "xlsx";
5
5
  //#region src/Quiculum/file/to/schedules.ts
6
6
  var schedules_default = (schedule) => {
7
7
  const options = { idKey: "id" };
8
- const did = getVertexId(schedule.division, options);
9
- if (!did) throw new Error("division id is undefined");
8
+ if (!getVertexId(schedule.division, options)) throw new Error("division id is undefined");
10
9
  const periodsMap = new Map(schedule.periods?.map((p) => [getVertexId(p, options), p]));
11
10
  const defaultPeriod = { ranges: [{
12
11
  start: schedule.division.start,
@@ -36,11 +35,9 @@ var schedules_default = (schedule) => {
36
35
  if (!course) return null;
37
36
  const courseName = course.displayName ?? "";
38
37
  const inLocation = e.inLocations?.at(0);
39
- const location = inLocation ? locationsMap.get(getVertexId(inLocation, options)) : void 0;
40
- const locationName = location?.displayName;
38
+ const locationName = (inLocation ? locationsMap.get(getVertexId(inLocation, options)) : void 0)?.displayName;
41
39
  const _period = e.period ?? course.period ?? schedule.settings.period;
42
- const period = periodsMap.get(_period ? getVertexId(_period, options) : void 0);
43
- const weeksInPeriod = period?.ranges.map((x) => {
40
+ const weeksInPeriod = periodsMap.get(_period ? getVertexId(_period, options) : void 0)?.ranges.map((x) => {
44
41
  const start$1 = moment.utc(x.start);
45
42
  const end$1 = moment.utc(x.end);
46
43
  const weeks = new Array();
@@ -50,7 +47,7 @@ var schedules_default = (schedule) => {
50
47
  }
51
48
  return weeks;
52
49
  }).flat();
53
- const allWeeks = defaultPeriod?.ranges.map((x) => {
50
+ const excludedWeeks = (defaultPeriod?.ranges.map((x) => {
54
51
  const start$1 = moment.utc(x.start);
55
52
  const end$1 = moment.utc(x.end);
56
53
  const weeks = new Array();
@@ -59,8 +56,7 @@ var schedules_default = (schedule) => {
59
56
  start$1.add(1, "week");
60
57
  }
61
58
  return weeks;
62
- }).flat();
63
- const excludedWeeks = allWeeks.filter((x) => !weeksInPeriod?.includes(x)).join(", ");
59
+ }).flat()).filter((x) => !weeksInPeriod?.includes(x)).join(", ");
64
60
  const holidaysInPeriod = holidaysInDays.filter((x) => {
65
61
  return weeksInPeriod?.includes(x.week());
66
62
  }).map((x) => x.format("YYYY-MM-DD")).join(", ");
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["options: BaseOptions","defaultPeriod: Pick<CoreTypes.Deep.Period, 'ranges'>","holidaysInDays: moment.Moment[]","start","end"],"sources":["../../../../src/Quiculum/file/to/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport XLSX from 'xlsx';\nimport type { Types as CoreTypes } from '../../../core/types';\nimport type { BaseOptions } from '../../../common/types';\nimport { getVertexId } from '../../../core/util';\n\ntype Schedule = {\n division: CoreTypes.Deep.Division;\n settings: CoreTypes.Deep.Settings;\n groups: CoreTypes.Deep.Group[];\n teachers: CoreTypes.Deep.Teacher[];\n locations: CoreTypes.Deep.Location[];\n courses: CoreTypes.Deep.Course[];\n events: CoreTypes.Deep.Event[];\n periods: CoreTypes.Deep.Period[];\n persons: CoreTypes.Deep.Person[];\n};\n\n\n\nexport default (\n schedule: Schedule,\n): XLSX.WorkBook => {\n const options: BaseOptions = { idKey: 'id' };\n // must have a division id\n const did = getVertexId(schedule.division, options);\n if (!did) throw new Error('division id is undefined');\n\n // a map of period id -> period\n const periodsMap = new Map(schedule.periods?.map((p) => [getVertexId(p, options) as string | undefined, p as Pick<CoreTypes.Deep.Period, 'ranges'>]));\n const defaultPeriod: Pick<CoreTypes.Deep.Period, 'ranges'> = {\n ranges: [{ start: schedule.division.start, end: schedule.division.end }]\n };\n periodsMap.set(undefined, defaultPeriod);\n\n // a map of course id -> course\n const coursesMap = new Map(schedule.courses?.map((c) => [getVertexId(c, options), c]));\n\n // a map of location id -> location\n const locationsMap = new Map(schedule.locations?.map((l) => [getVertexId(l, options), l]));\n\n // get start and end dates from division in YYYY-MM-DD format\n const startDate = moment.utc(schedule.division.start).format('YYYY-MM-DD');\n const endDate = moment.utc(schedule.division.end).format('YYYY-MM-DD');\n // get schoolyear from division start date in format YY/YY (only considers the start year, for example 2023-01-01 becomes 23/24)\n const schoolYear = moment.utc(schedule.division.start).format('YY') + '/' +\n moment.utc(schedule.division.start).add(1, 'year').format('YY');\n\n const holidays = schedule.settings?.calendarExceptions\n ?.filter((x) => x.start && x.end);\n\n\n const holidaysInDays: moment.Moment[] = [];\n\n if (holidays) {\n for (const holiday of holidays) {\n const start = moment.utc(holiday.start);\n const end = moment.utc(holiday.end);\n while (start.isBefore(end)) {\n // Only push weekdays (Monday to Friday)\n if (start.isoWeekday() < 6) {\n holidaysInDays.push(start.clone());\n }\n start.add(1, 'day');\n }\n }\n }\n\n ////\n //// Activities (events)\n ////\n const activities = schedule.events\n ?.map((e) => {\n // must have start and end\n if (!e.start || !e.end) return null;\n const start = moment.utc(e.start);\n const end = moment.utc(e.end);\n\n // must have course\n const course = e.course ? coursesMap.get(getVertexId(e.course, options)) : undefined;\n if (!course) return null;\n const courseName = course.displayName ?? '';\n\n // Location\n const inLocation = e.inLocations?.at(0);\n const location = inLocation ? locationsMap.get(getVertexId(inLocation, options)) : undefined;\n const locationName = location?.displayName;\n\n const _period = e.period ?? course.period ?? schedule.settings.period;\n const period = periodsMap.get(_period ? getVertexId(_period, options) : undefined);\n\n const weeksInPeriod = period?.ranges\n .map((x) => {\n // fetch all weeks between start and end\n const start = moment.utc(x.start);\n const end = moment.utc(x.end);\n const weeks = new Array<number>();\n while (start.isBefore(end)) {\n weeks.push(start.week());\n start.add(1, 'week');\n }\n return weeks;\n })\n .flat();\n\n const allWeeks = defaultPeriod?.ranges\n .map((x) => {\n // fetch all weeks between start and end\n const start = moment.utc(x.start);\n const end = moment.utc(x.end);\n const weeks = new Array<number>();\n while (start.isBefore(end)) {\n weeks.push(start.week());\n start.add(1, 'week');\n }\n return weeks;\n })\n .flat();\n\n const excludedWeeks = allWeeks\n .filter((x) => !weeksInPeriod?.includes(x))\n .join(', ');\n\n // Get the holidays in the period (don't include holidays that are not in the period)\n const holidaysInPeriod = holidaysInDays\n .filter((x) => {\n return weeksInPeriod?.includes(x.week());\n })\n .map((x) => x.format('YYYY-MM-DD'))\n .join(', ');\n\n return {\n DayOfWeek: (start.day() + 6) % 7,\n Duration: end.diff(start, 'minutes'),\n EndDate: endDate,\n Name: courseName,\n StartDate: startDate,\n StartTime: start.format('HH:mm'),\n ExcludeDates: holidaysInPeriod,\n ExcludeWeeks: excludedWeeks,\n ExternalActivityID: e.ids,\n ExternalLocationID: '',\n ExternalTeachingGroupID: '',\n Location: locationName,\n SchoolYear: schoolYear,\n Teachers: ''\n };\n })\n .filter((x): x is NonNullable<typeof x> => !!x);\n\n ////\n //// store in workbook\n ////\n const wb = XLSX.utils.book_new();\n XLSX.utils.book_append_sheet(wb, XLSX.utils.json_to_sheet(activities), 'Activities');\n\n return wb;\n};\n"],"mappings":";;;;;AAoBA,yBACE,aACkB;CAClB,MAAMA,UAAuB,EAAE,OAAO;CAEtC,MAAM,MAAM,YAAY,SAAS,UAAU;AAC3C,KAAI,CAAC,IAAK,OAAM,IAAI,MAAM;CAG1B,MAAM,aAAa,IAAI,IAAI,SAAS,SAAS,KAAK,MAAM,CAAC,YAAY,GAAG,UAAgC;CACxG,MAAMC,gBAAuD,EAC3D,QAAQ,CAAC;EAAE,OAAO,SAAS,SAAS;EAAO,KAAK,SAAS,SAAS;;AAEpE,YAAW,IAAI,QAAW;CAG1B,MAAM,aAAa,IAAI,IAAI,SAAS,SAAS,KAAK,MAAM,CAAC,YAAY,GAAG,UAAU;CAGlF,MAAM,eAAe,IAAI,IAAI,SAAS,WAAW,KAAK,MAAM,CAAC,YAAY,GAAG,UAAU;CAGtF,MAAM,YAAY,OAAO,IAAI,SAAS,SAAS,OAAO,OAAO;CAC7D,MAAM,UAAU,OAAO,IAAI,SAAS,SAAS,KAAK,OAAO;CAEzD,MAAM,aAAa,OAAO,IAAI,SAAS,SAAS,OAAO,OAAO,QAAQ,MACpE,OAAO,IAAI,SAAS,SAAS,OAAO,IAAI,GAAG,QAAQ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,MAAM,QAAQ,IAAI;AAClB,UAAOD,QAAM,SAASC,QAAM;AAC1B,UAAM,KAAKD,QAAM;AACjB,YAAM,IAAI,GAAG;;AAEf,UAAO;KAER;EAEH,MAAM,gBAAgB,SACnB,QAAQ,MAAM,CAAC,eAAe,SAAS,IACvC,KAAK;EAGR,MAAM,mBAAmB,eACtB,QAAQ,MAAM;AACb,UAAO,eAAe,SAAS,EAAE;KAElC,KAAK,MAAM,EAAE,OAAO,eACpB,KAAK;AAER,SAAO;GACL,YAA0B,MAAM,QAAQ,KAAK;GAC7C,UAAyB,IAAI,KAAK,OAAO;GACzC,SAAyB;GACzB,MAAyB;GACzB,WAAyB;GACzB,WAAyB,MAAM,OAAO;GACtC,cAAyB;GACzB,cAAyB;GACzB,oBAAyB,EAAE;GAC3B,oBAAyB;GACzB,yBAAyB;GACzB,UAAyB;GACzB,YAAyB;GACzB,UAAyB;;IAG5B,QAAQ,MAAkC,CAAC,CAAC;CAK/C,MAAM,KAAK,KAAK,MAAM;AACtB,MAAK,MAAM,kBAAkB,IAAI,KAAK,MAAM,cAAc,aAAa;AAEvE,QAAO"}
1
+ {"version":3,"file":"schedules.js","names":["options: BaseOptions","defaultPeriod: Pick<CoreTypes.Deep.Period, 'ranges'>","holidaysInDays: moment.Moment[]","start","end"],"sources":["../../../../src/Quiculum/file/to/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport XLSX from 'xlsx';\nimport type { Types as CoreTypes } from '../../../core/types';\nimport type { BaseOptions } from '../../../common/types';\nimport { getVertexId } from '../../../core/util';\n\ntype Schedule = {\n division: CoreTypes.Deep.Division;\n settings: CoreTypes.Deep.Settings;\n groups: CoreTypes.Deep.Group[];\n teachers: CoreTypes.Deep.Teacher[];\n locations: CoreTypes.Deep.Location[];\n courses: CoreTypes.Deep.Course[];\n events: CoreTypes.Deep.Event[];\n periods: CoreTypes.Deep.Period[];\n persons: CoreTypes.Deep.Person[];\n};\n\n\n\nexport default (\n schedule: Schedule,\n): XLSX.WorkBook => {\n const options: BaseOptions = { idKey: 'id' };\n // must have a division id\n const did = getVertexId(schedule.division, options);\n if (!did) throw new Error('division id is undefined');\n\n // a map of period id -> period\n const periodsMap = new Map(schedule.periods?.map((p) => [getVertexId(p, options) as string | undefined, p as Pick<CoreTypes.Deep.Period, 'ranges'>]));\n const defaultPeriod: Pick<CoreTypes.Deep.Period, 'ranges'> = {\n ranges: [{ start: schedule.division.start, end: schedule.division.end }]\n };\n periodsMap.set(undefined, defaultPeriod);\n\n // a map of course id -> course\n const coursesMap = new Map(schedule.courses?.map((c) => [getVertexId(c, options), c]));\n\n // a map of location id -> location\n const locationsMap = new Map(schedule.locations?.map((l) => [getVertexId(l, options), l]));\n\n // get start and end dates from division in YYYY-MM-DD format\n const startDate = moment.utc(schedule.division.start).format('YYYY-MM-DD');\n const endDate = moment.utc(schedule.division.end).format('YYYY-MM-DD');\n // get schoolyear from division start date in format YY/YY (only considers the start year, for example 2023-01-01 becomes 23/24)\n const schoolYear = moment.utc(schedule.division.start).format('YY') + '/' +\n moment.utc(schedule.division.start).add(1, 'year').format('YY');\n\n const holidays = schedule.settings?.calendarExceptions\n ?.filter((x) => x.start && x.end);\n\n\n const holidaysInDays: moment.Moment[] = [];\n\n if (holidays) {\n for (const holiday of holidays) {\n const start = moment.utc(holiday.start);\n const end = moment.utc(holiday.end);\n while (start.isBefore(end)) {\n // Only push weekdays (Monday to Friday)\n if (start.isoWeekday() < 6) {\n holidaysInDays.push(start.clone());\n }\n start.add(1, 'day');\n }\n }\n }\n\n ////\n //// Activities (events)\n ////\n const activities = schedule.events\n ?.map((e) => {\n // must have start and end\n if (!e.start || !e.end) return null;\n const start = moment.utc(e.start);\n const end = moment.utc(e.end);\n\n // must have course\n const course = e.course ? coursesMap.get(getVertexId(e.course, options)) : undefined;\n if (!course) return null;\n const courseName = course.displayName ?? '';\n\n // Location\n const inLocation = e.inLocations?.at(0);\n const location = inLocation ? locationsMap.get(getVertexId(inLocation, options)) : undefined;\n const locationName = location?.displayName;\n\n const _period = e.period ?? course.period ?? schedule.settings.period;\n const period = periodsMap.get(_period ? getVertexId(_period, options) : undefined);\n\n const weeksInPeriod = period?.ranges\n .map((x) => {\n // fetch all weeks between start and end\n const start = moment.utc(x.start);\n const end = moment.utc(x.end);\n const weeks = new Array<number>();\n while (start.isBefore(end)) {\n weeks.push(start.week());\n start.add(1, 'week');\n }\n return weeks;\n })\n .flat();\n\n const allWeeks = defaultPeriod?.ranges\n .map((x) => {\n // fetch all weeks between start and end\n const start = moment.utc(x.start);\n const end = moment.utc(x.end);\n const weeks = new Array<number>();\n while (start.isBefore(end)) {\n weeks.push(start.week());\n start.add(1, 'week');\n }\n return weeks;\n })\n .flat();\n\n const excludedWeeks = allWeeks\n .filter((x) => !weeksInPeriod?.includes(x))\n .join(', ');\n\n // Get the holidays in the period (don't include holidays that are not in the period)\n const holidaysInPeriod = holidaysInDays\n .filter((x) => {\n return weeksInPeriod?.includes(x.week());\n })\n .map((x) => x.format('YYYY-MM-DD'))\n .join(', ');\n\n return {\n DayOfWeek: (start.day() + 6) % 7,\n Duration: end.diff(start, 'minutes'),\n EndDate: endDate,\n Name: courseName,\n StartDate: startDate,\n StartTime: start.format('HH:mm'),\n ExcludeDates: holidaysInPeriod,\n ExcludeWeeks: excludedWeeks,\n ExternalActivityID: e.ids,\n ExternalLocationID: '',\n ExternalTeachingGroupID: '',\n Location: locationName,\n SchoolYear: schoolYear,\n Teachers: ''\n };\n })\n .filter((x): x is NonNullable<typeof x> => !!x);\n\n ////\n //// store in workbook\n ////\n const wb = XLSX.utils.book_new();\n XLSX.utils.book_append_sheet(wb, XLSX.utils.json_to_sheet(activities), 'Activities');\n\n return wb;\n};\n"],"mappings":";;;;;AAoBA,yBACE,aACkB;CAClB,MAAMA,UAAuB,EAAE,OAAO,MAAM;AAG5C,KAAI,CADQ,YAAY,SAAS,UAAU,QAAQ,CACzC,OAAM,IAAI,MAAM,2BAA2B;CAGrD,MAAM,aAAa,IAAI,IAAI,SAAS,S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YAA0B,MAAM,KAAK,GAAG,KAAK;GAC7C,UAAyB,IAAI,KAAK,OAAO,UAAU;GACnD,SAAyB;GACzB,MAAyB;GACzB,WAAyB;GACzB,WAAyB,MAAM,OAAO,QAAQ;GAC9C,cAAyB;GACzB,cAAyB;GACzB,oBAAyB,EAAE;GAC3B,oBAAyB;GACzB,yBAAyB;GACzB,UAAyB;GACzB,YAAyB;GACzB,UAAyB;GAC1B;GACD,CACD,QAAQ,MAAkC,CAAC,CAAC,EAAE;CAKjD,MAAM,KAAK,KAAK,MAAM,UAAU;AAChC,MAAK,MAAM,kBAAkB,IAAI,KAAK,MAAM,cAAc,WAAW,EAAE,aAAa;AAEpF,QAAO"}
@@ -1,4 +1,5 @@
1
1
  import { Types } from "../../core/types/index.js";
2
+ import "../../core/index.js";
2
3
 
3
4
  //#region src/RS/from/division.d.ts
4
5
  declare function division(input: unknown): undefined | Pick<Types.Deep.Division, 'displayName' | 'start' | 'end'>;
@@ -5,12 +5,11 @@ function division(input) {
5
5
  if (!("displayName" in d && typeof d.displayName == "string")) return;
6
6
  if (!("start" in d && typeof d.start == "string")) return;
7
7
  if (!("end" in d && typeof d.end == "string")) return;
8
- const division$1 = {
8
+ return {
9
9
  displayName: d.displayName,
10
10
  start: d.start,
11
11
  end: d.end
12
12
  };
13
- return division$1;
14
13
  }
15
14
 
16
15
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"division.js","names":["division: Pick<CoreTypes.Deep.Division, 'displayName' | 'start' | 'end'>","division"],"sources":["../../../src/RS/from/division.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\n\nexport function division (input: unknown): undefined | Pick<CoreTypes.Deep.Division, 'displayName' | 'start' | 'end'> {\n\n if ( !input || typeof input != 'object'\n || !('meta' in input ) || !input.meta || typeof input.meta != 'object'\n || !('division' in input.meta) || !input.meta.division || typeof input.meta.division != 'object'\n ) return;\n\n const d = input.meta.division;\n\n if (!('displayName' in d && typeof d.displayName == 'string')) return;\n if (!('start' in d && typeof d.start == 'string')) return;\n if (!('end' in d && typeof d.end == 'string')) return;\n\n const division: Pick<CoreTypes.Deep.Division, 'displayName' | 'start' | 'end'> = {\n displayName: d.displayName,\n start: d.start,\n end: d.end,\n };\n return division;\n};"],"mappings":";AAEA,SAAgB,SAAU,OAA4F;AAEpH,KAAoC,CAAC,SAAuB,OAAO,SAAuB,YACrF,EAAE,UAAc,UAAe,CAAC,MAAM,QAAiB,OAAO,MAAM,QAAiB,YACrF,EAAE,cAAc,MAAM,SAAS,CAAC,MAAM,KAAK,YAAY,OAAO,MAAM,KAAK,YAAY,SACxF;CAEF,MAAM,IAAI,MAAM,KAAK;AAErB,KAAI,EAAE,iBAAiB,KAAK,OAAO,EAAE,eAAe,UAAW;AAC/D,KAAI,EAAE,WAAiB,KAAK,OAAO,EAAE,SAAe,UAAW;AAC/D,KAAI,EAAE,SAAiB,KAAK,OAAO,EAAE,OAAe,UAAW;CAE/D,MAAMA,aAA2E;EAC/E,aAAa,EAAE;EACf,OAAa,EAAE;EACf,KAAa,EAAE;;AAEjB,QAAOC"}
1
+ {"version":3,"file":"division.js","names":[],"sources":["../../../src/RS/from/division.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\n\nexport function division (input: unknown): undefined | Pick<CoreTypes.Deep.Division, 'displayName' | 'start' | 'end'> {\n\n if ( !input || typeof input != 'object'\n || !('meta' in input ) || !input.meta || typeof input.meta != 'object'\n || !('division' in input.meta) || !input.meta.division || typeof input.meta.division != 'object'\n ) return;\n\n const d = input.meta.division;\n\n if (!('displayName' in d && typeof d.displayName == 'string')) return;\n if (!('start' in d && typeof d.start == 'string')) return;\n if (!('end' in d && typeof d.end == 'string')) return;\n\n const division: Pick<CoreTypes.Deep.Division, 'displayName' | 'start' | 'end'> = {\n displayName: d.displayName,\n start: d.start,\n end: d.end,\n };\n return division;\n};"],"mappings":";AAEA,SAAgB,SAAU,OAA4F;AAEpH,KAAoC,CAAC,SAAuB,OAAO,SAAuB,YACrF,EAAE,UAAc,UAAe,CAAC,MAAM,QAAiB,OAAO,MAAM,QAAiB,YACrF,EAAE,cAAc,MAAM,SAAS,CAAC,MAAM,KAAK,YAAY,OAAO,MAAM,KAAK,YAAY,SACxF;CAEF,MAAM,IAAI,MAAM,KAAK;AAErB,KAAI,EAAE,iBAAiB,KAAK,OAAO,EAAE,eAAe,UAAW;AAC/D,KAAI,EAAE,WAAiB,KAAK,OAAO,EAAE,SAAe,UAAW;AAC/D,KAAI,EAAE,SAAiB,KAAK,OAAO,EAAE,OAAe,UAAW;AAO/D,QALiF;EAC/E,aAAa,EAAE;EACf,OAAa,EAAE;EACf,KAAa,EAAE;EAChB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../../src/RS/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport { division } from './division';\nimport { schedules } from './schedules';\n\nexport default {\n division: division,\n schedules: schedules,\n} satisfies FromInterface;"],"mappings":";;;;AAIA,mBAAe;CACF;CACA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/RS/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport { division } from './division';\nimport { schedules } from './schedules';\n\nexport default {\n division: division,\n schedules: schedules,\n} satisfies FromInterface;"],"mappings":";;;;AAIA,mBAAe;CACF;CACA;CACZ"}
@@ -1,4 +1,5 @@
1
1
  import { Types as Types$1 } from "../../core/types/index.js";
2
+ import "../../core/index.js";
2
3
  import { Types } from "../types/index.js";
3
4
 
4
5
  //#region src/RS/from/schedules.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["warnings: string[]"],"sources":["../../../src/RS/from/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport type { Types } from '../types';\nimport { COLLECTION_ID } from '../to/input/util/util';\nimport { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\n\nexport function schedules (\n input: Partial<Types.toOutput>,\n options: Pick<Types.toOptions, 'idKey'> = {}\n): Partial<CoreTypes.SerializedWithOptionalId.Schedule> {\n // set default idKey if not provided\n if (!options.idKey) options.idKey = 'id';\n\n const warnings: string[] = [];\n\n const schedule = input.coreData;\n const eventConfigurations = input.output?.at(0)?.events;\n\n if (!schedule ) throw new Error('Missing `coreData` in input.');\n if (!eventConfigurations) throw new Error('Missing `output.events` in input.');\n\n // check on later to ensure that all events are updated\n const eventsToUpdate = new Set(schedule.events?.map(x => getVertexId(x, options)));\n\n eventConfigurations.forEach(({ id: collectionAndId, ...placement }) => {\n // locate the corresponding event/locked time\n const collection = collectionAndId.split('.')[0] == COLLECTION_ID.events ? 'events' : 'lockedTimes';\n const id = collectionAndId.split('.')[1];\n const event = schedule[collection]?.find(x => getVertexId(x, options) == id);\n\n if (!event) {\n warnings.push(`Could not find ${id} (${collectionAndId}) in ${collection} collection.`);\n return;\n }\n\n event.parked = false;\n event.start = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.start, 'minutes').toISOString();\n event.end = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.end, 'minutes').toISOString();\n event.duration = placement.end - placement.start;\n\n if (collection == 'events') {\n (event as CoreTypes.Serialized.Event).inLocations = placement.dependencies?.filter(Boolean) ?? [];\n\n // remove from events to be updates\n eventsToUpdate.delete(id);\n }\n });\n\n // check if there are events that were not updated\n if (eventsToUpdate.size) {\n warnings.push(`The following events were not updated: ${[...eventsToUpdate].join(', ')}`);\n }\n\n\n return Object.assign(schedule, {\n meta: {\n ...warnings.length && { warnings: warnings }\n }\n });\n};"],"mappings":";;;;;AAMA,SAAgB,UACd,OACA,UAA0C,IACY;AAEtD,KAAI,CAAC,QAAQ,MAAO,SAAQ,QAAQ;CAEpC,MAAMA,WAAqB;CAE3B,MAAM,WAAsB,MAAM;CAClC,MAAM,sBAAsB,MAAM,QAAQ,GAAG,IAAI;AAEjD,KAAI,CAAC,SAAqB,OAAM,IAAI,MAAM;AAC1C,KAAI,CAAC,oBAAqB,OAAM,IAAI,MAAM;CAG1C,MAAM,iBAAiB,IAAI,IAAI,SAAS,QAAQ,KAAI,MAAK,YAAY,GAAG;AAExE,qBAAoB,SAAS,EAAE,IAAI,gBAAiB,GAAG,gBAAgB;EAErE,MAAM,aAAa,gBAAgB,MAAM,KAAK,MAAM,cAAc,SAAS,WAAW;EACtF,MAAM,KAAa,gBAAgB,MAAM,KAAK;EAC9C,MAAM,QAAQ,SAAS,aAAa,MAAK,MAAK,YAAY,GAAG,YAAY;AAEzE,MAAI,CAAC,OAAO;AACV,YAAS,KAAK,kBAAkB,GAAG,IAAI,gBAAgB,OAAO,WAAW;AACzE;;AAGF,QAAM,SAAW;AACjB,QAAM,QAAW,OAAO,IAAI,oBAAoB,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,OAAO,WAAW;AAC3G,QAAM,MAAW,OAAO,IAAI,oBAAoB,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAO,WAAW;AAC3G,QAAM,WAAW,UAAU,MAAM,UAAU;AAE3C,MAAI,cAAc,UAAU;AAC1B,GAAC,MAAqC,cAAc,UAAU,cAAc,OAAO,YAAY;AAG/F,kBAAe,OAAO;;;AAK1B,KAAI,eAAe,KACjB,UAAS,KAAK,0CAA0C,CAAC,GAAG,gBAAgB,KAAK;AAInF,QAAO,OAAO,OAAO,UAAU,EAC7B,MAAM,EACJ,GAAG,SAAS,UAAU,EAAY"}
1
+ {"version":3,"file":"schedules.js","names":["warnings: string[]"],"sources":["../../../src/RS/from/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport type { Types } from '../types';\nimport { COLLECTION_ID } from '../to/input/util/util';\nimport { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\n\nexport function schedules (\n input: Partial<Types.toOutput>,\n options: Pick<Types.toOptions, 'idKey'> = {}\n): Partial<CoreTypes.SerializedWithOptionalId.Schedule> {\n // set default idKey if not provided\n if (!options.idKey) options.idKey = 'id';\n\n const warnings: string[] = [];\n\n const schedule = input.coreData;\n const eventConfigurations = input.output?.at(0)?.events;\n\n if (!schedule ) throw new Error('Missing `coreData` in input.');\n if (!eventConfigurations) throw new Error('Missing `output.events` in input.');\n\n // check on later to ensure that all events are updated\n const eventsToUpdate = new Set(schedule.events?.map(x => getVertexId(x, options)));\n\n eventConfigurations.forEach(({ id: collectionAndId, ...placement }) => {\n // locate the corresponding event/locked time\n const collection = collectionAndId.split('.')[0] == COLLECTION_ID.events ? 'events' : 'lockedTimes';\n const id = collectionAndId.split('.')[1];\n const event = schedule[collection]?.find(x => getVertexId(x, options) == id);\n\n if (!event) {\n warnings.push(`Could not find ${id} (${collectionAndId}) in ${collection} collection.`);\n return;\n }\n\n event.parked = false;\n event.start = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.start, 'minutes').toISOString();\n event.end = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.end, 'minutes').toISOString();\n event.duration = placement.end - placement.start;\n\n if (collection == 'events') {\n (event as CoreTypes.Serialized.Event).inLocations = placement.dependencies?.filter(Boolean) ?? [];\n\n // remove from events to be updates\n eventsToUpdate.delete(id);\n }\n });\n\n // check if there are events that were not updated\n if (eventsToUpdate.size) {\n warnings.push(`The following events were not updated: ${[...eventsToUpdate].join(', ')}`);\n }\n\n\n return Object.assign(schedule, {\n meta: {\n ...warnings.length && { warnings: warnings }\n }\n });\n};"],"mappings":";;;;;AAMA,SAAgB,UACd,OACA,UAA0C,EAAE,EACU;AAEtD,KAAI,CAAC,QAAQ,MAAO,SAAQ,QAAQ;CAEpC,MAAMA,WAAqB,EAAE;CAE7B,MAAM,WAAsB,MAAM;CAClC,MAAM,sBAAsB,MAAM,QAAQ,GAAG,EAAE,EAAE;AAEjD,KAAI,CAAC,SAAqB,OAAM,IAAI,MAAM,+BAA+B;AACzE,KAAI,CAAC,oBAAqB,OAAM,IAAI,MAAM,oCAAoC;CAG9E,MAAM,iBAAiB,IAAI,IAAI,SAAS,QAAQ,KAAI,MAAK,YAAY,GAAG,QAAQ,CAAC,CAAC;AAElF,qBAAoB,SAAS,EAAE,IAAI,gBAAiB,GAAG,gBAAgB;EAErE,MAAM,aAAa,gBAAgB,MAAM,IAAI,CAAC,MAAM,cAAc,SAAS,WAAW;EACtF,MAAM,KAAa,gBAAgB,MAAM,IAAI,CAAC;EAC9C,MAAM,QAAQ,SAAS,aAAa,MAAK,MAAK,YAAY,GAAG,QAAQ,IAAI,GAAG;AAE5E,MAAI,CAAC,OAAO;AACV,YAAS,KAAK,kBAAkB,GAAG,IAAI,gBAAgB,OAAO,WAAW,cAAc;AACvF;;AAGF,QAAM,SAAW;AACjB,QAAM,QAAW,OAAO,IAAI,mBAAmB,CAAC,IAAI,UAAU,KAAK,OAAO,CAAC,IAAI,UAAU,OAAO,UAAU,CAAC,aAAa;AACxH,QAAM,MAAW,OAAO,IAAI,mBAAmB,CAAC,IAAI,UAAU,KAAK,OAAO,CAAC,IAAI,UAAU,KAAO,UAAU,CAAC,aAAa;AACxH,QAAM,WAAW,UAAU,MAAM,UAAU;AAE3C,MAAI,cAAc,UAAU;AAC1B,GAAC,MAAqC,cAAc,UAAU,cAAc,OAAO,QAAQ,IAAI,EAAE;AAGjG,kBAAe,OAAO,GAAG;;GAE3B;AAGF,KAAI,eAAe,KACjB,UAAS,KAAK,0CAA0C,CAAC,GAAG,eAAe,CAAC,KAAK,KAAK,GAAG;AAI3F,QAAO,OAAO,OAAO,UAAU,EAC7B,MAAM,EACJ,GAAG,SAAS,UAAU,EAAY,UAAU,EAC7C,EACF,CAAC"}
@@ -1,7 +1,9 @@
1
+ import "../core/types/common/index.js";
1
2
  import { Mixed } from "../core/interfaces/vertices/index.js";
3
+ import "../core/index.js";
4
+ import "./types/index.js";
2
5
 
3
6
  //#region src/RS/make-connected.d.ts
4
-
5
7
  type _Schedule = {
6
8
  division: Mixed.Division;
7
9
  divisions: Mixed.Division;
@@ -84,12 +84,10 @@ function makeConnected(schedule, options = {}) {
84
84
  return Object.assign(x, edges);
85
85
  });
86
86
  const periods = (schedule.periods ?? []).map((x) => {
87
- const edges = {};
88
- return Object.assign(x, edges);
87
+ return Object.assign(x, {});
89
88
  });
90
89
  const rootIntervals = (schedule.rootIntervals ?? []).map((x) => {
91
- const edges = {};
92
- return Object.assign(x, edges);
90
+ return Object.assign(x, {});
93
91
  });
94
92
  const makeCoalesced = (map$1, id, toModel, extra) => {
95
93
  const to = map$1.get(id);
@@ -138,11 +136,10 @@ function makeConnected(schedule, options = {}) {
138
136
  return x.map((x$1) => {
139
137
  const to = personsMap.get(getVertexId(x$1.to, idKey));
140
138
  if (!to) return;
141
- const participant = {
139
+ return {
142
140
  ...x$1,
143
141
  to
144
142
  };
145
- return participant;
146
143
  }).filter(nonNullable);
147
144
  };
148
145
  const getTeachers = (x) => {
@@ -150,11 +147,10 @@ function makeConnected(schedule, options = {}) {
150
147
  return x.map((x$1) => {
151
148
  const to = teachersMap.get(getVertexId(x$1.to, idKey));
152
149
  if (!to) return;
153
- const participant = {
150
+ return {
154
151
  ...x$1,
155
152
  to
156
153
  };
157
- return participant;
158
154
  }).filter(nonNullable);
159
155
  };
160
156
  const getLocations = (x) => {
@@ -162,11 +158,10 @@ function makeConnected(schedule, options = {}) {
162
158
  return x.map((x$1) => {
163
159
  const locations$1 = x$1.locations.map((x$2) => locationsMap.get(getVertexId(x$2, idKey))).filter(nonNullable);
164
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(", ")}`);
165
- const availableLocation = {
161
+ return {
166
162
  ...x$1,
167
163
  locations: locations$1
168
164
  };
169
- return availableLocation;
170
165
  }).filter(nonNullable);
171
166
  };
172
167
  const getGroups = (x) => {
@@ -175,42 +170,13 @@ function makeConnected(schedule, options = {}) {
175
170
  const to = groupsMap.get(getVertexId(x$1.to, idKey));
176
171
  if (!to) return;
177
172
  const exclude = x$1.exclude ? x$1.exclude.map((x$2) => personsMap.get(getVertexId(x$2, idKey))).filter(nonNullable) : void 0;
178
- const group = {
173
+ return {
179
174
  ...x$1,
180
175
  to,
181
176
  exclude
182
177
  };
183
- return group;
184
178
  }).filter(nonNullable);
185
179
  };
186
- const courses = (schedule.courses ?? []).map((x) => {
187
- const edges = {
188
- groups: getGroups(x.groups),
189
- teachers: getTeachers(x.teachers),
190
- locations: getLocations(x.locations),
191
- participants: getParticipants(x.participants),
192
- lockedTimes: getLockedTimes(x.lockedTimes),
193
- events: x.events ? x.events.map((x$1) => eventsMap.get(getVertexId(x$1, idKey))).filter(nonNullable) : x.events,
194
- period: x.period != null ? periodsMap.get(getVertexId(x.period, idKey)) : x.period,
195
- overlapGroup: x.overlapGroup != null ? overlapGroupsMap.get(getVertexId(x.overlapGroup, idKey)) : x.overlapGroup
196
- };
197
- return Object.assign(x, edges);
198
- });
199
- const events = (schedule.events ?? []).map((x) => {
200
- const edges = {
201
- groups: getGroups(x.groups),
202
- teachers: getTeachers(x.teachers),
203
- locations: getLocations(x.locations),
204
- participants: getParticipants(x.participants),
205
- lockedTimes: getLockedTimes(x.lockedTimes),
206
- 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,
207
- course: x.course != null ? coursesMap.get(getVertexId(x.course, idKey)) : x.course,
208
- period: x.period != null ? periodsMap.get(getVertexId(x.period, idKey)) : x.period,
209
- overlapSpecies: x.overlapSpecies != null ? overlapGroupsMap.get(getVertexId(x.overlapSpecies, idKey)) : x.overlapSpecies,
210
- threads: void 0
211
- };
212
- return Object.assign(x, edges);
213
- });
214
180
  return {
215
181
  division,
216
182
  settings,
@@ -222,8 +188,34 @@ function makeConnected(schedule, options = {}) {
222
188
  rootIntervals,
223
189
  lockedTimes,
224
190
  overlapGroups,
225
- courses,
226
- 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
+ threads: void 0
216
+ };
217
+ return Object.assign(x, edges);
218
+ })
227
219
  };
228
220
  }
229
221
 
@@ -1 +1 @@
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>","edges: DeepVertexEdgesOnlyExport<PeriodVertex>","edges: DeepVertexEdgesOnlyExport<RootIntervalVertex>","map","edges: DeepVertexEdgesOnlyExport<LockedTimeVertex>","edges: DeepVertexEdgesOnlyExport<OverlapGroupVertex>","participant: NonNullable<CoreTypes.Deep.Course['participants']>[number]","participant: NonNullable<CoreTypes.Deep.Course['teachers']>[number]","locations","availableLocation: NonNullable<CoreTypes.Deep.Course['locations']>[number]","group: NonNullable<CoreTypes.Deep.Course['groups']>[number]","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 threads: undefined\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 courses,\n events\n };\n}"],"mappings":";;;;A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,QAAgD;GACpD,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,QAAKhB,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;GAC1G,SAAS;;AAEX,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 threads: undefined\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 courses,\n events\n };\n}"],"mappings":";;;;AAqGA,SAAS,gBAA+C,YAAoC,OAAgD;AAC1I,QAAO,IAAI,IAAI,WAAW,KAAI,MAAM,CAAC,YAAY,GAAG,MAAM,EAAE,EAAyB,CAAW,CAAC;;AAEnG,SAAS,YAAgB,OAAyC;AAChE,QAAO,SAAS;;;;;AAMlB,SAAgB,cACd,UACA,UAA2C,EAAE,EACtB;CACvB,MAAM,YAAY,SAAS,aAAa,SAAS;AACjD,KAAI,CAAC,UAAW,OAAM,IAAI,MAAM,gEAAgE,OAAO,KAAK,SAAS,CAAC,KAAK,KAAK,GAAG;CACnI,MAAM,YAAY,SAAS;AAC3B,KAAI,CAAC,UAAW,OAAM,IAAI,MAAM,i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C1G,SAAS;IACV;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"}