@royalschedule/maps 4.0.30 → 4.0.31

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 (285) 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 +0 -1
  8. package/dist/Additio/from/schedules.js +4 -2
  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 -4
  12. package/dist/Additio/to/schedules.js +4 -2
  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 +0 -1
  21. package/dist/Admentum/from/schedules.js +6 -3
  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 +0 -1
  25. package/dist/Admentum/to/schedules.js +7 -4
  26. package/dist/Admentum/to/schedules.js.map +1 -1
  27. package/dist/Excel/index.d.ts +4 -4
  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 -1
  31. package/dist/Excel/v2/from/index.js +54 -45
  32. package/dist/Excel/v2/from/index.js.map +1 -1
  33. package/dist/Excel/v2/index.d.ts +4 -4
  34. package/dist/IdunSoft/from/courses.js.map +1 -1
  35. package/dist/IdunSoft/from/events.js +2 -1
  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 +0 -1
  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 +0 -1
  44. package/dist/IdunSoft/to/schedules.js +6 -3
  45. package/dist/IdunSoft/to/schedules.js.map +1 -1
  46. package/dist/InfoMentor/to/index.d.ts +0 -1
  47. package/dist/InfoMentor/to/schedules.js +2 -1
  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 +11 -9
  51. package/dist/PlanDigital/from/schedules.js.map +1 -1
  52. package/dist/PlanDigital/index.d.ts +0 -1
  53. package/dist/Quiculum/file/to/index.d.ts +0 -1
  54. package/dist/Quiculum/file/to/schedules.js +9 -5
  55. package/dist/Quiculum/file/to/schedules.js.map +1 -1
  56. package/dist/RS/from/division.d.ts +0 -1
  57. package/dist/RS/from/division.js +2 -1
  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 +0 -1
  61. package/dist/RS/from/schedules.js.map +1 -1
  62. package/dist/RS/make-connected.d.ts +1 -3
  63. package/dist/RS/make-connected.js +42 -33
  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 +6 -4
  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 +2 -1
  70. package/dist/RS/to/input/default.js.map +1 -1
  71. package/dist/RS/to/input/dependencies.js +2 -1
  72. package/dist/RS/to/input/dependencies.js.map +1 -1
  73. package/dist/RS/to/input/dynamic-locked-times.js +2 -1
  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 +2 -1
  78. package/dist/RS/to/input/individuals.js.map +1 -1
  79. package/dist/RS/to/input/input.js +2 -1
  80. package/dist/RS/to/input/input.js.map +1 -1
  81. package/dist/RS/to/input/intervals.js +4 -2
  82. package/dist/RS/to/input/intervals.js.map +1 -1
  83. package/dist/RS/to/input/periods.js +4 -2
  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.map +1 -1
  87. package/dist/RS/to/input/util/attach-locked-times.js.map +1 -1
  88. package/dist/RS/to/input/util/parse-days.js.map +1 -1
  89. package/dist/RS/to/input/util/parse-group-references.js.map +1 -1
  90. package/dist/RS/to/input/util/parse-intervals.js +4 -2
  91. package/dist/RS/to/input/util/parse-intervals.js.map +1 -1
  92. package/dist/RS/to/input/util/parse-location-references.js +2 -1
  93. package/dist/RS/to/input/util/parse-location-references.js.map +1 -1
  94. package/dist/RS/to/input/util/parse-max-working-hours.js.map +1 -1
  95. package/dist/RS/to/input/util/parse-minimum-break-length.js.map +1 -1
  96. package/dist/RS/to/input/util/util.js +2 -1
  97. package/dist/RS/to/input/util/util.js.map +1 -1
  98. package/dist/RS/to/schedules.js.map +1 -1
  99. package/dist/RS/types/to.d.ts +0 -1
  100. package/dist/SS12000/from/activities.js +2 -1
  101. package/dist/SS12000/from/activities.js.map +1 -1
  102. package/dist/SS12000/from/calendar-events.js.map +1 -1
  103. package/dist/SS12000/from/duties.js.map +1 -1
  104. package/dist/SS12000/from/groups.js.map +1 -1
  105. package/dist/SS12000/from/index.js.map +1 -1
  106. package/dist/SS12000/from/persons.js.map +1 -1
  107. package/dist/SS12000/from/resources.js.map +1 -1
  108. package/dist/SS12000/from/rooms.js.map +1 -1
  109. package/dist/SS12000/from/syllabuses.js.map +1 -1
  110. package/dist/SS12000/index.d.ts +374 -194
  111. package/dist/SS12000/to/activities.js.map +1 -1
  112. package/dist/SS12000/to/calendar-events.js.map +1 -1
  113. package/dist/SS12000/to/common.js.map +1 -1
  114. package/dist/SS12000/to/duties.js.map +1 -1
  115. package/dist/SS12000/to/groups.js.map +1 -1
  116. package/dist/SS12000/to/index.d.ts +0 -1
  117. package/dist/SS12000/to/persons.js.map +1 -1
  118. package/dist/SS12000/to/resources.js.map +1 -1
  119. package/dist/SS12000/to/rooms.js.map +1 -1
  120. package/dist/SS12000/to/syllabuses.js.map +1 -1
  121. package/dist/SchoolSoft/api/from/index.js.map +1 -1
  122. package/dist/SchoolSoft/api/from/schedules.js +12 -8
  123. package/dist/SchoolSoft/api/from/schedules.js.map +1 -1
  124. package/dist/SchoolSoft/api/index.d.ts +7 -6
  125. package/dist/SchoolSoft/file/from/index.js.map +1 -1
  126. package/dist/SchoolSoft/file/from/schedules.js +87 -83
  127. package/dist/SchoolSoft/file/from/schedules.js.map +1 -1
  128. package/dist/SchoolSoft/file/index.d.ts +0 -1
  129. package/dist/SchoolSoft/file/to/index.d.ts +2 -3
  130. package/dist/SchoolSoft/file/to/schedules.js +2 -1
  131. package/dist/SchoolSoft/file/to/schedules.js.map +1 -1
  132. package/dist/SchoolSoft/index.d.ts +0 -1
  133. package/dist/Schoolity/txt/to/index.d.ts +0 -1
  134. package/dist/Schoolity/txt/to/schedules.js +12 -5
  135. package/dist/Schoolity/txt/to/schedules.js.map +1 -1
  136. package/dist/Skola24/mdb/from/course-and-events.js +5 -3
  137. package/dist/Skola24/mdb/from/course-and-events.js.map +1 -1
  138. package/dist/Skola24/mdb/from/groups.js.map +1 -1
  139. package/dist/Skola24/mdb/from/index.js.map +1 -1
  140. package/dist/Skola24/mdb/from/locations.js.map +1 -1
  141. package/dist/Skola24/mdb/from/schedule.d.ts +0 -1
  142. package/dist/Skola24/mdb/from/schedule.js.map +1 -1
  143. package/dist/Skola24/mdb/from/teachers.js.map +1 -1
  144. package/dist/Skola24/txt/from/calendar-exceptions.js +2 -1
  145. package/dist/Skola24/txt/from/calendar-exceptions.js.map +1 -1
  146. package/dist/Skola24/txt/from/division.js.map +1 -1
  147. package/dist/Skola24/txt/from/index.js.map +1 -1
  148. package/dist/Skola24/txt/from/period.js +34 -31
  149. package/dist/Skola24/txt/from/period.js.map +1 -1
  150. package/dist/Skola24/txt/from/schedules.d.ts +0 -1
  151. package/dist/Skola24/txt/from/schedules.js +10 -6
  152. package/dist/Skola24/txt/from/schedules.js.map +1 -1
  153. package/dist/Skola24/txt/from/util.js.map +1 -1
  154. package/dist/Skola24/txt/index.d.ts +0 -1
  155. package/dist/Skola24/txt/to/index.d.ts +0 -1
  156. package/dist/Skola24/txt/to/schedules.js +12 -5
  157. package/dist/Skola24/txt/to/schedules.js.map +1 -1
  158. package/dist/common/constants.js.map +1 -1
  159. package/dist/common/functions.js.map +1 -1
  160. package/dist/common/get-date.js.map +1 -1
  161. package/dist/common/make-chainable/index.js.map +1 -1
  162. package/dist/common/types.d.ts +3 -1
  163. package/dist/core/from/configurations.js.map +1 -1
  164. package/dist/core/from/courses.js.map +1 -1
  165. package/dist/core/from/events.js.map +1 -1
  166. package/dist/core/from/exceptions.js.map +1 -1
  167. package/dist/core/from/groups.js.map +1 -1
  168. package/dist/core/from/index.js.map +1 -1
  169. package/dist/core/from/locations.js.map +1 -1
  170. package/dist/core/from/locked-times.js.map +1 -1
  171. package/dist/core/from/overlap-groups.js.map +1 -1
  172. package/dist/core/from/periods.js.map +1 -1
  173. package/dist/core/from/persons.js.map +1 -1
  174. package/dist/core/from/root-intervals.js.map +1 -1
  175. package/dist/core/from/schedules.js.map +1 -1
  176. package/dist/core/from/settings.js.map +1 -1
  177. package/dist/core/from/syllabuses.js.map +1 -1
  178. package/dist/core/from/teachers.js.map +1 -1
  179. package/dist/core/index.d.ts +0 -1
  180. package/dist/core/interfaces/other/companies.js.map +1 -1
  181. package/dist/core/interfaces/other/operations.d.ts +0 -1
  182. package/dist/core/interfaces/vertices/companies.d.ts +0 -1
  183. package/dist/core/interfaces/vertices/configurations.d.ts +1 -2
  184. package/dist/core/interfaces/vertices/courses.d.ts +0 -1
  185. package/dist/core/interfaces/vertices/division-settings.d.ts +0 -1
  186. package/dist/core/interfaces/vertices/divisions.d.ts +0 -1
  187. package/dist/core/interfaces/vertices/events.d.ts +2 -1
  188. package/dist/core/interfaces/vertices/exceptions.d.ts +0 -1
  189. package/dist/core/interfaces/vertices/generations.d.ts +0 -2
  190. package/dist/core/interfaces/vertices/groups.d.ts +0 -1
  191. package/dist/core/interfaces/vertices/index.d.ts +14 -1
  192. package/dist/core/interfaces/vertices/locations.d.ts +0 -1
  193. package/dist/core/interfaces/vertices/locked-times.d.ts +0 -2
  194. package/dist/core/interfaces/vertices/overlap-groups.d.ts +0 -1
  195. package/dist/core/interfaces/vertices/periods.d.ts +0 -2
  196. package/dist/core/interfaces/vertices/persons.d.ts +0 -1
  197. package/dist/core/interfaces/vertices/properties/belongs-to.d.ts +0 -1
  198. package/dist/core/interfaces/vertices/properties/coalesced.d.ts +0 -1
  199. package/dist/core/interfaces/vertices/root-intervals.d.ts +0 -2
  200. package/dist/core/interfaces/vertices/syllabuses.d.ts +0 -1
  201. package/dist/core/interfaces/vertices/teachers.d.ts +0 -1
  202. package/dist/core/interfaces/vertices/threads.d.ts +31 -0
  203. package/dist/core/interfaces/vertices/users.d.ts +4 -2
  204. package/dist/core/interfaces/vertices/util/custom-vertex-export/index.d.ts +9 -8
  205. package/dist/core/interfaces/vertices/util/custom-vertex-export/util.d.ts +4 -4
  206. package/dist/core/interfaces/vertices/util/deep-vertex-export/index.d.ts +9 -8
  207. package/dist/core/interfaces/vertices/util/edges.d.ts +26 -8
  208. package/dist/core/interfaces/vertices/util/util.d.ts +24 -20
  209. package/dist/core/interfaces/vertices/util/vertex-query/index.d.ts +16 -11
  210. package/dist/core/interfaces/vertices/util/vertex.d.ts +2 -2
  211. package/dist/core/interfaces/vertices/vertex-query.d.ts +29 -26
  212. package/dist/core/interfaces/vertices/vertex-query.js +8 -0
  213. package/dist/core/interfaces/vertices/vertex-query.js.map +1 -1
  214. package/dist/core/to/configurations.js +2 -1
  215. package/dist/core/to/configurations.js.map +1 -1
  216. package/dist/core/to/courses.js +2 -1
  217. package/dist/core/to/courses.js.map +1 -1
  218. package/dist/core/to/division.js.map +1 -1
  219. package/dist/core/to/events.js +4 -2
  220. package/dist/core/to/events.js.map +1 -1
  221. package/dist/core/to/exceptions.js +2 -1
  222. package/dist/core/to/exceptions.js.map +1 -1
  223. package/dist/core/to/groups.js +2 -1
  224. package/dist/core/to/groups.js.map +1 -1
  225. package/dist/core/to/locations.js +2 -1
  226. package/dist/core/to/locations.js.map +1 -1
  227. package/dist/core/to/locked-times.js +2 -1
  228. package/dist/core/to/locked-times.js.map +1 -1
  229. package/dist/core/to/overlap-groups.js +2 -1
  230. package/dist/core/to/overlap-groups.js.map +1 -1
  231. package/dist/core/to/periods.js +2 -1
  232. package/dist/core/to/periods.js.map +1 -1
  233. package/dist/core/to/persons.js +2 -1
  234. package/dist/core/to/persons.js.map +1 -1
  235. package/dist/core/to/root-intervals.js +2 -1
  236. package/dist/core/to/root-intervals.js.map +1 -1
  237. package/dist/core/to/schedules.d.ts +0 -1
  238. package/dist/core/to/schedules.js.map +1 -1
  239. package/dist/core/to/settings.js +2 -1
  240. package/dist/core/to/settings.js.map +1 -1
  241. package/dist/core/to/syllabuses.js +2 -1
  242. package/dist/core/to/syllabuses.js.map +1 -1
  243. package/dist/core/to/teachers.js +2 -1
  244. package/dist/core/to/teachers.js.map +1 -1
  245. package/dist/core/to/util.d.ts +0 -2
  246. package/dist/core/to/util.js +2 -1
  247. package/dist/core/to/util.js.map +1 -1
  248. package/dist/core/types/index.d.ts +5 -1
  249. package/dist/core/util.js +2 -1
  250. package/dist/core/util.js.map +1 -1
  251. package/dist/identify/constants/index.js.map +1 -1
  252. package/dist/identify/index.js +2 -1
  253. package/dist/identify/index.js.map +1 -1
  254. package/dist/sdui/from/classes.js.map +1 -1
  255. package/dist/sdui/from/courses.js.map +1 -1
  256. package/dist/sdui/from/holidays.js.map +1 -1
  257. package/dist/sdui/from/index.js.map +1 -1
  258. package/dist/sdui/from/lessons.js.map +1 -1
  259. package/dist/sdui/from/rooms.js.map +1 -1
  260. package/dist/sdui/from/schedules.d.ts +0 -2
  261. package/dist/sdui/from/schedules.js.map +1 -1
  262. package/dist/sdui/from/school-years.js.map +1 -1
  263. package/dist/sdui/from/substitution-plans.js.map +1 -1
  264. package/dist/sdui/from/teachers.js.map +1 -1
  265. package/dist/sdui/to/classes.js.map +1 -1
  266. package/dist/sdui/to/courses.js.map +1 -1
  267. package/dist/sdui/to/holidays.js.map +1 -1
  268. package/dist/sdui/to/hours.js.map +1 -1
  269. package/dist/sdui/to/index.d.ts +0 -2
  270. package/dist/sdui/to/lessons.js.map +1 -1
  271. package/dist/sdui/to/rooms.js.map +1 -1
  272. package/dist/sdui/to/schedules.js.map +1 -1
  273. package/dist/sdui/to/school-years.js.map +1 -1
  274. package/dist/sdui/to/substitution-plans.js +6 -3
  275. package/dist/sdui/to/substitution-plans.js.map +1 -1
  276. package/dist/sdui/to/teachers.js.map +1 -1
  277. package/dist/vKlass/from/index.js.map +1 -1
  278. package/dist/vKlass/from/schedule.d.ts +0 -1
  279. package/dist/vKlass/from/schedule.js.map +1 -1
  280. package/dist/vKlass/to/schedules.js +17 -6
  281. package/dist/vKlass/to/schedules.js.map +1 -1
  282. package/package.json +1 -1
  283. package/dist/core/interfaces/index.d.ts +0 -23
  284. package/dist/core/interfaces/other/index.d.ts +0 -6
  285. package/dist/core/interfaces/vertices/util/index.d.ts +0 -6
@@ -1 +1 @@
1
- {"version":3,"file":"periods.js","names":["x"],"sources":["../../../../src/RS/to/input/periods.ts"],"sourcesContent":["import { groupBy } from 'lodash-es';\nimport moment from 'moment';\nimport { getIdKey, getVertexId } from '../../../core/util';\nimport type { ConnectedTypes } from '../../make-connected';\nimport type { Types } from '../../types';\nimport { range } from '../../../common/functions';\nimport { makeChainable } from '../../../common/make-chainable';\nimport type { Interval } from '../../../core/interfaces';\n\ntype Range = Partial<Interval<string | moment.Moment | Date>>;\ntype DateRange = Interval<moment.Moment>;\n\nfunction createRange ({ start, end }: Range): DateRange {\n return {\n start: moment.utc(start).clone().startOf('isoWeek'),\n end: moment.utc(end ).clone().endOf ('isoWeek')\n };\n}\n\ntype Out = {\n map: Map<string | undefined, number>,\n matrix?: string\n};\n\n/**\n * Used by the default values as the id if no period is specified.\n */\nexport const DEFAULT_PERIOD_ID = 'DEFAULT_PERIOD';\n\nexport function parsePeriods (\n periods: ConnectedTypes.period[] | undefined,\n division: ConnectedTypes.division,\n options: Types.parsedToOptions\n): Out {\n const idKey = getIdKey(options);\n\n // if empty periods are given, return empty map only\n if (!periods?.length) {\n return { map: new Map<string | undefined, number>() };\n }\n\n // convert the ranges to moment ranges\n const parsedPeriods = periods.map(x => ({ id: getVertexId(x, idKey) as string | undefined, ranges: x.ranges.map(r => createRange(r)) }));\n\n // add default period that includes all weeks\n parsedPeriods.push({ id: DEFAULT_PERIOD_ID, ranges: [createRange(division)] });\n\n // Compute a pairwise binary overlapping string for each periods and group those that have identical such string.\n // The latter so that the number of periods may be reduced by omitting periods that overlap identically\n const grouped = makeChainable(parsedPeriods)\n .chain(\n x => x\n .map(x => ({\n ...x,\n overlap: parsedPeriods.map(y => range.overlaps(x.ranges, y.ranges) ? '1' : '0').join('')\n })),\n x => groupBy(x, x => x.overlap),\n x => Object.values(x)\n .map((x, i) => ({ ids: x.map(x => x.id), index: i, ranges: x[0].ranges }))\n )\n .value;\n\n // Merge the pairwise binary overlapping string and store it as a matrix string.\n const matrix = grouped\n .map(x => grouped\n .map(y => range.overlaps(x.ranges, y.ranges) ? '1' : '0')\n .join('')\n )\n .join('');\n\n if (matrix == '' || matrix == '0') {\n throw new Error('(RS::To::parsePeriods) invalid matrix value: ' + matrix);\n }\n\n // Also store in a map what period id corresponds to which row in the matrix.\n const indexMap = new Map(\n grouped.flatMap(xs => xs.ids.map(id => ([id, xs.index]) as const))\n );\n\n return { map: indexMap, matrix };\n}\n\n\nexport function _parsePeriods (\n periods: ConnectedTypes.period[] | undefined,\n division: ConnectedTypes.division,\n options: Types.parsedToOptions\n): Types.period[] | undefined {\n const divisionRange = createRange(division);\n\n // build a mapping of week starts to boolean active flags\n const weeksMap = new Map<string, boolean>();\n for (const x = divisionRange.start.clone(); x.isSameOrBefore(divisionRange.end); x.add(1, 'week')) {\n weeksMap.set(x.toISOString(), false);\n }\n\n const out = periods?.map((p): Types.period => {\n const id = getVertexId(p, options);\n\n // preserve only the ranges that lay within the division range\n const clippedRanges = p.ranges\n .map(r => createRange(r))\n .filter(r => range.overlaps(r, divisionRange))\n .map(r => ({\n start: moment.max(r.start, divisionRange.start).clone(),\n end: moment.min(r.end, divisionRange.end ).clone()\n }));\n\n // get the active weeks by checking which weeks in the division are covered by the clipped ranges\n const activeWeeksMap = new Map(weeksMap);\n clippedRanges.forEach(r => {\n for (const x = r.start.clone(); x.isSameOrBefore(r.end); x.add(1, 'week')) {\n const key = x.toISOString();\n activeWeeksMap.set(key, true);\n }\n });\n\n // build the active weeks string\n const weeks = Array.from(activeWeeksMap.entries())\n .sort((a, b) => moment.utc(a[0]).diff(moment.utc(b[0])))\n .map(x => x[1] ? '1' : '0')\n .join('');\n\n const overlaps = weeks.length <= 64 ? weeks : '';\n\n return { id, weeks, overlaps };\n });\n\n // If there are more than 64 weeks but less than or equal to 64 periods, we compute the overlap between periods directly.\n if (weeksMap.size > 64 && out && out.length <= 64) {\n for (let i = 0; i < out.length; i++) {\n let overlaps = '';\n for (let j = 0; j < out.length; j++) {\n // self-overlap\n if (i == j) {\n overlaps += '1';\n continue;\n }\n\n // overlap with other periods\n let overlap = false;\n for (let k = 0; k < out[i].weeks.length; k++) {\n if (out[i].weeks[k] === '1' && out[j].weeks[k] === '1') {\n overlap = true;\n break;\n }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AI;GAAO,UAFH,MAAM,UAAU,KAAK,QAAQ;GAEhB;GAC9B;AAGF,KAAI,SAAS,OAAO,MAAM,OAAO,IAAI,UAAU,GAC7C,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;EACnC,IAAI,WAAW;AACf,OAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AAEnC,OAAI,KAAK,GAAG;AACV,gBAAY;AACZ;;GAIF,IAAI,UAAU;AACd,QAAK,IAAI,IAAI,GAAG,IAAI,IAAI,GAAG,MAAM,QAAQ,IACvC,KAAI,IAAI,GAAG,MAAM,OAAO,OAAO,IAAI,GAAG,MAAM,OAAO,KAAK;AACtD,cAAU;AACV;;AAGJ,eAAY,UAAU,MAAM;;AAE9B,MAAI,GAAG,WAAW;;AAItB,QAAO"}
1
+ {"version":3,"file":"periods.js","names":["x"],"sources":["../../../../src/RS/to/input/periods.ts"],"sourcesContent":["import { groupBy } from 'lodash-es';\nimport moment from 'moment';\nimport { getIdKey, getVertexId } from '../../../core/util';\nimport type { ConnectedTypes } from '../../make-connected';\nimport type { Types } from '../../types';\nimport { range } from '../../../common/functions';\nimport { makeChainable } from '../../../common/make-chainable';\nimport type { Interval } from '../../../core/interfaces';\n\ntype Range = Partial<Interval<string | moment.Moment | Date>>;\ntype DateRange = Interval<moment.Moment>;\n\nfunction createRange ({ start, end }: Range): DateRange {\n return {\n start: moment.utc(start).clone().startOf('isoWeek'),\n end: moment.utc(end ).clone().endOf ('isoWeek')\n };\n}\n\ntype Out = {\n map: Map<string | undefined, number>,\n matrix?: string\n};\n\n/**\n * Used by the default values as the id if no period is specified.\n */\nexport const DEFAULT_PERIOD_ID = 'DEFAULT_PERIOD';\n\nexport function parsePeriods (\n periods: ConnectedTypes.period[] | undefined,\n division: ConnectedTypes.division,\n options: Types.parsedToOptions\n): Out {\n const idKey = getIdKey(options);\n\n // if empty periods are given, return empty map only\n if (!periods?.length) {\n return { map: new Map<string | undefined, number>() };\n }\n\n // convert the ranges to moment ranges\n const parsedPeriods = periods.map(x => ({ id: getVertexId(x, idKey) as string | undefined, ranges: x.ranges.map(r => createRange(r)) }));\n\n // add default period that includes all weeks\n parsedPeriods.push({ id: DEFAULT_PERIOD_ID, ranges: [createRange(division)] });\n\n // Compute a pairwise binary overlapping string for each periods and group those that have identical such string.\n // The latter so that the number of periods may be reduced by omitting periods that overlap identically\n const grouped = makeChainable(parsedPeriods)\n .chain(\n x => x\n .map(x => ({\n ...x,\n overlap: parsedPeriods.map(y => range.overlaps(x.ranges, y.ranges) ? '1' : '0').join('')\n })),\n x => groupBy(x, x => x.overlap),\n x => Object.values(x)\n .map((x, i) => ({ ids: x.map(x => x.id), index: i, ranges: x[0].ranges }))\n )\n .value;\n\n // Merge the pairwise binary overlapping string and store it as a matrix string.\n const matrix = grouped\n .map(x => grouped\n .map(y => range.overlaps(x.ranges, y.ranges) ? '1' : '0')\n .join('')\n )\n .join('');\n\n if (matrix == '' || matrix == '0') {\n throw new Error('(RS::To::parsePeriods) invalid matrix value: ' + matrix);\n }\n\n // Also store in a map what period id corresponds to which row in the matrix.\n const indexMap = new Map(\n grouped.flatMap(xs => xs.ids.map(id => ([id, xs.index]) as const))\n );\n\n return { map: indexMap, matrix };\n}\n\n\nexport function _parsePeriods (\n periods: ConnectedTypes.period[] | undefined,\n division: ConnectedTypes.division,\n options: Types.parsedToOptions\n): Types.period[] | undefined {\n const divisionRange = createRange(division);\n\n // build a mapping of week starts to boolean active flags\n const weeksMap = new Map<string, boolean>();\n for (const x = divisionRange.start.clone(); x.isSameOrBefore(divisionRange.end); x.add(1, 'week')) {\n weeksMap.set(x.toISOString(), false);\n }\n\n const out = periods?.map((p): Types.period => {\n const id = getVertexId(p, options);\n\n // preserve only the ranges that lay within the division range\n const clippedRanges = p.ranges\n .map(r => createRange(r))\n .filter(r => range.overlaps(r, divisionRange))\n .map(r => ({\n start: moment.max(r.start, divisionRange.start).clone(),\n end: moment.min(r.end, divisionRange.end ).clone()\n }));\n\n // get the active weeks by checking which weeks in the division are covered by the clipped ranges\n const activeWeeksMap = new Map(weeksMap);\n clippedRanges.forEach(r => {\n for (const x = r.start.clone(); x.isSameOrBefore(r.end); x.add(1, 'week')) {\n const key = x.toISOString();\n activeWeeksMap.set(key, true);\n }\n });\n\n // build the active weeks string\n const weeks = Array.from(activeWeeksMap.entries())\n .sort((a, b) => moment.utc(a[0]).diff(moment.utc(b[0])))\n .map(x => x[1] ? '1' : '0')\n .join('');\n\n const overlaps = weeks.length <= 64 ? weeks : '';\n\n return { id, weeks, overlaps };\n });\n\n // If there are more than 64 weeks but less than or equal to 64 periods, we compute the overlap between periods directly.\n if (weeksMap.size > 64 && out && out.length <= 64) {\n for (let i = 0; i < out.length; i++) {\n let overlaps = '';\n for (let j = 0; j < out.length; j++) {\n // self-overlap\n if (i == j) {\n overlaps += '1';\n continue;\n }\n\n // overlap with other periods\n let overlap = false;\n for (let k = 0; k < out[i].weeks.length; k++) {\n if (out[i].weeks[k] === '1' && out[j].weeks[k] === '1') {\n overlap = true;\n break;\n }\n }\n overlaps += overlap ? '1' : '0';\n }\n out[i].overlaps = overlaps;\n }\n }\n\n return out;\n}"],"mappings":";;;;;;;AAYA,SAAS,YAAa,EAAE,OAAO,OAAyB;AACtD,QAAO;EACL,OAAO,OAAO,IAAI,OAAO,QAAQ,QAAQ;EACzC,KAAO,OAAO,IAAI,KAAO,QAAQ,MAAQ;;;;;;AAY7C,MAAa,oBAAoB;AAEjC,SAAgB,aACd,SACA,UACA,SACK;CACL,MAAM,QAAQ,SAAS;AAGvB,KAAI,CAAC,SAAS,OACZ,QAAO,EAAE,qBAAK,IAAI;CAIpB,MAAM,gBAAgB,QAAQ,KAAI,OAAM;EAAE,IAAI,YAAY,GAAG;EAA8B,QAAQ,EAAE,OAAO,KAAI,MAAK,YAAY;;AAGjI,eAAc,KAAK;EAAE,IAAI;EAAmB,QAAQ,CAAC,YAAY;;CAIjE,MAAM,UAAU,cAAc,eAC3B,OACC,MAAK,E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AM,MAAM,EAAE;AACd,mBAAe,IAAI,KAAK;;;EAK5B,MAAM,QAAQ,MAAM,KAAK,eAAe,WACrC,MAAM,GAAG,MAAM,OAAO,IAAI,EAAE,IAAI,KAAK,OAAO,IAAI,EAAE,MAClD,KAAI,MAAK,EAAE,KAAK,MAAM,KACtB,KAAK;EAER,MAAM,WAAW,MAAM,UAAU,KAAK,QAAQ;AAE9C,SAAO;GAAE;GAAI;GAAO;;;AAItB,KAAI,SAAS,OAAO,MAAM,OAAO,IAAI,UAAU,GAC7C,MAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;EACnC,IAAI,WAAW;AACf,OAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAAK;AAEnC,OAAI,KAAK,GAAG;AACV,gBAAY;AACZ;;GAIF,IAAI,UAAU;AACd,QAAK,IAAI,IAAI,GAAG,IAAI,IAAI,GAAG,MAAM,QAAQ,IACvC,KAAI,IAAI,GAAG,MAAM,OAAO,OAAO,IAAI,GAAG,MAAM,OAAO,KAAK;AACtD,cAAU;AACV;;AAGJ,eAAY,UAAU,MAAM;;AAE9B,MAAI,GAAG,WAAW;;AAItB,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","names":[],"sources":["../../../../src/RS/to/input/settings.ts"],"sourcesContent":["import type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\n\nexport function parseSettings (settings: ConnectedTypes.divisionSettings): Types.settings {\n\n if (!settings.numDays) throw new Error('(RS::To::parseSettings) numDays is falsy');\n if (!settings.discretization) throw new Error('(RS::To::parseSettings) discretization is falsy');\n\n return {\n numDays: settings.numDays,\n discretization: settings.discretization,\n\n periodIdKey: 'id',\n intervalIdKey: 'id',\n dependencyIdKey: 'id',\n groupIdKey: 'id',\n individualIdKey: 'id',\n collectionIdKey: 'id',\n eventIdKey: 'id',\n };\n};"],"mappings":";AAGA,SAAgB,cAAe,UAA2D;AAExF,KAAI,CAAC,SAAS,QAAgB,OAAM,IAAI,MAAM,2CAA2C;AACzF,KAAI,CAAC,SAAS,eAAgB,OAAM,IAAI,MAAM,kDAAkD;AAEhG,QAAO;EACL,SAAgB,SAAS;EACzB,gBAAgB,SAAS;EAEzB,aAAiB;EACjB,eAAiB;EACjB,iBAAiB;EACjB,YAAiB;EACjB,iBAAiB;EACjB,iBAAiB;EACjB,YAAiB;EAClB"}
1
+ {"version":3,"file":"settings.js","names":[],"sources":["../../../../src/RS/to/input/settings.ts"],"sourcesContent":["import type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\n\nexport function parseSettings (settings: ConnectedTypes.divisionSettings): Types.settings {\n\n if (!settings.numDays) throw new Error('(RS::To::parseSettings) numDays is falsy');\n if (!settings.discretization) throw new Error('(RS::To::parseSettings) discretization is falsy');\n\n return {\n numDays: settings.numDays,\n discretization: settings.discretization,\n\n periodIdKey: 'id',\n intervalIdKey: 'id',\n dependencyIdKey: 'id',\n groupIdKey: 'id',\n individualIdKey: 'id',\n collectionIdKey: 'id',\n eventIdKey: 'id',\n };\n};"],"mappings":";AAGA,SAAgB,cAAe,UAA2D;AAExF,KAAI,CAAC,SAAS,QAAgB,OAAM,IAAI,MAAM;AAC9C,KAAI,CAAC,SAAS,eAAgB,OAAM,IAAI,MAAM;AAE9C,QAAO;EACL,SAAgB,SAAS;EACzB,gBAAgB,SAAS;EAEzB,aAAiB;EACjB,eAAiB;EACjB,iBAAiB;EACjB,YAAiB;EACjB,iBAAiB;EACjB,iBAAiB;EACjB,YAAiB"}
@@ -1 +1 @@
1
- {"version":3,"file":"teachers.js","names":["doc: Types.group"],"sources":["../../../../src/RS/to/input/teachers.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { parseDays } from './util/parse-days';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { idOf } from './util/util';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromTeachers (\n teachers: ConnectedTypes.teacher[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return teachers\n .map(teacher => {\n const intervals = teacher.intervals ?? defaultInterval;\n const rootInterval = teacher.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.group = {\n id: idOf.teacher(teacher, options),\n group_type: 'personal',\n minimizeGaps: false,\n minimizeDependencyAlternation: true,\n forbidOverlappingEvents: options.oldFormat ? teacher.forbidOverlappingEvents : undefined, // Deprecated in v3\n disableDayLengthPunishment: options.oldFormat ? teacher.disableDayLengthPunishment : undefined, // Deprecated in v3\n weight: teacher.weight,\n intervals: options.oldFormat\n ? parseIntervals(intervals, rootInterval, settings)\n : idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDays (teacher.days, settings),\n lockedTimes: attachLockedTimes (teacher.lockedTimes, options),\n minBreakLength: parseMinimumBreakLength (teacher.minBreakLength),\n\n ...parseMaxWorkingHours(teacher, options),\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n ids: teacher.ids,\n name: teacher.displayName,\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.group;\n });\n};\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,aACd,UACA,UACA,SACe;CACf,MAAM,kBAAkB,mBAAmB,SAAS;AAEpD,QAAO,SACJ,KAAI,YAAW;EACd,MAAM,YAAe,QAAQ,aAAgB;EAC7C,MAAM,eAAe,QAAQ,gBAAgB,SAAS;EAEtD,MAAMA,MAAmB;GACvB,IAA+B,KAAK,QAAQ,SAAS,QAAQ;GAC7D,YAA+B;GAC/B,cAA+B;GAC/B,+BAA+B;GAC/B,yBAA+B,QAAQ,YAAY,QAAQ,0BAA0B;GACrF,4BAA+B,QAAQ,YAAY,QAAQ,6BAA6B;GACxF,QAA+B,QAAQ;GACvC,WAA+B,QAAQ,YACnC,eAAe,WAAW,cAAc,SAAS,GACjD,KAAK,sBAAsB,WAAW,cAAc,QAAQ;GAChE,MAAgB,UAA2B,QAAQ,MAAM,SAAS;GAClE,aAAgB,kBAA2B,QAAQ,aAAa,QAAQ;GACxE,gBAAgB,wBAA2B,QAAQ,eAAe;GAElE,GAAG,qBAAqB,SAAS,QAAQ;GAC1C;AAED,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,KAAM,QAAQ;GACd,MAAM,QAAQ;GACf,GAAE,MAAK,KAAK,KAAK;AAGpB,SAAO,OAAO,MAAK,MAAK,KAAK,KAAK;GAClC"}
1
+ {"version":3,"file":"teachers.js","names":["doc: Types.group"],"sources":["../../../../src/RS/to/input/teachers.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { parseDays } from './util/parse-days';\nimport { attachLockedTimes } from './util/attach-locked-times';\nimport { parseMinimumBreakLength } from './util/parse-minimum-break-length';\nimport { idOf } from './util/util';\nimport { parseIntervals } from './util/parse-intervals';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromTeachers (\n teachers: ConnectedTypes.teacher[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return teachers\n .map(teacher => {\n const intervals = teacher.intervals ?? defaultInterval;\n const rootInterval = teacher.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.group = {\n id: idOf.teacher(teacher, options),\n group_type: 'personal',\n minimizeGaps: false,\n minimizeDependencyAlternation: true,\n forbidOverlappingEvents: options.oldFormat ? teacher.forbidOverlappingEvents : undefined, // Deprecated in v3\n disableDayLengthPunishment: options.oldFormat ? teacher.disableDayLengthPunishment : undefined, // Deprecated in v3\n weight: teacher.weight,\n intervals: options.oldFormat\n ? parseIntervals(intervals, rootInterval, settings)\n : idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDays (teacher.days, settings),\n lockedTimes: attachLockedTimes (teacher.lockedTimes, options),\n minBreakLength: parseMinimumBreakLength (teacher.minBreakLength),\n\n ...parseMaxWorkingHours(teacher, options),\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n ids: teacher.ids,\n name: teacher.displayName,\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.group;\n });\n};\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,aACd,UACA,UACA,SACe;CACf,MAAM,kBAAkB,mBAAmB;AAE3C,QAAO,SACJ,KAAI,YAAW;EACd,MAAM,YAAe,QAAQ,aAAgB;EAC7C,MAAM,eAAe,QAAQ,gBAAgB,SAAS;EAEtD,MAAMA,MAAmB;GACvB,IAA+B,KAAK,QAAQ,SAAS;GACrD,YAA+B;GAC/B,cAA+B;GAC/B,+BAA+B;GAC/B,yBAA+B,QAAQ,YAAY,QAAQ,0BAA0B;GACrF,4BAA+B,QAAQ,YAAY,QAAQ,6BAA6B;GACxF,QAA+B,QAAQ;GACvC,WAA+B,QAAQ,YACnC,eAAe,WAAW,cAAc,YACxC,KAAK,sBAAsB,WAAW,cAAc;GACxD,MAAgB,UAA2B,QAAQ,MAAM;GACzD,aAAgB,kBAA2B,QAAQ,aAAa;GAChE,gBAAgB,wBAA2B,QAAQ;GAEnD,GAAG,qBAAqB,SAAS;;AAGnC,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,KAAM,QAAQ;GACd,MAAM,QAAQ;MACb,MAAK,KAAK;AAGf,SAAO,OAAO,MAAK,MAAK,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"attach-locked-times.js","names":["doc: Types.lockedTime"],"sources":["../../../../../src/RS/to/input/util/attach-locked-times.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../../types';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport { getDayIndex, getVertexId, parseDateInterval } from '../../../../core/util';\n\nexport function attachLockedTimes (\n lockedTimes: ConnectedTypes.lockedTime[] | null | undefined,\n options: Types.parsedToOptions\n): Types.lockedTime[] | undefined {\n\n return lockedTimes?.map(lockedTime => {\n const { start: startDate, end: endDate } = parseDateInterval(lockedTime, 'locked time');\n\n const length = endDate.diff(startDate, 'minutes');\n if (length < 5) throw new Error('(RS::To::LockedTimes) Length of a locked time is less than 5 min');\n\n const start = parseFloat(startDate.format('HH.mm'));\n\n const doc: Types.lockedTime = {\n day: getDayIndex(startDate),\n start: start,\n length: length,\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n id: getVertexId(lockedTime, options),\n visible: lockedTime.visible,\n name: lockedTime.displayName,\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.lockedTime;\n });\n};"],"mappings":";;;;AAKA,SAAgB,kBACd,aACA,SACgC;AAEhC,QAAO,aAAa,KAAI,eAAc;EACpC,MAAM,EAAE,OAAO,WAAW,KAAK,YAAY,kBAAkB,YAAY,cAAc;EAEvF,MAAM,SAAS,QAAQ,KAAK,WAAW,UAAU;AACjD,MAAI,SAAS,EAAG,OAAM,IAAI,MAAM,mEAAmE;EAEnG,MAAM,QAAQ,WAAW,UAAU,OAAO,QAAQ,CAAC;EAEnD,MAAMA,MAAwB;GAC5B,KAAQ,YAAY,UAAU;GACtB;GACA;GACT;AAED,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,IAAS,YAAY,YAAY,QAAQ;GACzC,SAAS,WAAW;GACpB,MAAS,WAAW;GACrB,GAAE,MAAK,KAAK,KAAK;AAGpB,SAAO,OAAO,MAAK,MAAK,KAAK,KAAK;GAClC"}
1
+ {"version":3,"file":"attach-locked-times.js","names":["doc: Types.lockedTime"],"sources":["../../../../../src/RS/to/input/util/attach-locked-times.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../../types';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport { getDayIndex, getVertexId, parseDateInterval } from '../../../../core/util';\n\nexport function attachLockedTimes (\n lockedTimes: ConnectedTypes.lockedTime[] | null | undefined,\n options: Types.parsedToOptions\n): Types.lockedTime[] | undefined {\n\n return lockedTimes?.map(lockedTime => {\n const { start: startDate, end: endDate } = parseDateInterval(lockedTime, 'locked time');\n\n const length = endDate.diff(startDate, 'minutes');\n if (length < 5) throw new Error('(RS::To::LockedTimes) Length of a locked time is less than 5 min');\n\n const start = parseFloat(startDate.format('HH.mm'));\n\n const doc: Types.lockedTime = {\n day: getDayIndex(startDate),\n start: start,\n length: length,\n };\n\n if (options.includeEntityMeta) {\n doc.meta = omitBy({\n id: getVertexId(lockedTime, options),\n visible: lockedTime.visible,\n name: lockedTime.displayName,\n }, x => x == null);\n }\n\n return omitBy(doc, x => x == null) as Types.lockedTime;\n });\n};"],"mappings":";;;;AAKA,SAAgB,kBACd,aACA,SACgC;AAEhC,QAAO,aAAa,KAAI,eAAc;EACpC,MAAM,EAAE,OAAO,WAAW,KAAK,YAAY,kBAAkB,YAAY;EAEzE,MAAM,SAAS,QAAQ,KAAK,WAAW;AACvC,MAAI,SAAS,EAAG,OAAM,IAAI,MAAM;EAEhC,MAAM,QAAQ,WAAW,UAAU,OAAO;EAE1C,MAAMA,MAAwB;GAC5B,KAAQ,YAAY;GACZ;GACA;;AAGV,MAAI,QAAQ,kBACV,KAAI,OAAO,OAAO;GAChB,IAAS,YAAY,YAAY;GACjC,SAAS,WAAW;GACpB,MAAS,WAAW;MACnB,MAAK,KAAK;AAGf,SAAO,OAAO,MAAK,MAAK,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse-days.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-days.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\n\nexport function parseDays (\n days: ConnectedTypes.event['days'] | ConnectedTypes.course['days'],\n settings: ConnectedTypes.divisionSettings\n) {\n if (!days) return;\n\n if (days.length) return days.map(x => x.day);\n\n // empty days means all days selected (since no days selected is prohibited)\n return [...Array.from({ length: settings.numDays })].map((_, i) => i);\n}"],"mappings":";AAEA,SAAgB,UACd,MACA,UACA;AACA,KAAI,CAAC,KAAM;AAEX,KAAI,KAAK,OAAQ,QAAO,KAAK,KAAI,MAAK,EAAE,IAAI;AAG5C,QAAO,CAAC,GAAG,MAAM,KAAK,EAAE,QAAQ,SAAS,SAAS,CAAC,CAAC,CAAC,KAAK,GAAG,MAAM,EAAE"}
1
+ {"version":3,"file":"parse-days.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-days.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\n\nexport function parseDays (\n days: ConnectedTypes.event['days'] | ConnectedTypes.course['days'],\n settings: ConnectedTypes.divisionSettings\n) {\n if (!days) return;\n\n if (days.length) return days.map(x => x.day);\n\n // empty days means all days selected (since no days selected is prohibited)\n return [...Array.from({ length: settings.numDays })].map((_, i) => i);\n}"],"mappings":";AAEA,SAAgB,UACd,MACA,UACA;AACA,KAAI,CAAC,KAAM;AAEX,KAAI,KAAK,OAAQ,QAAO,KAAK,KAAI,MAAK,EAAE;AAGxC,QAAO,CAAC,GAAG,MAAM,KAAK,EAAE,QAAQ,SAAS,YAAY,KAAK,GAAG,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse-group-references.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-group-references.ts"],"sourcesContent":["import { groupBy, uniq } from 'lodash-es';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport { idOf } from './util';\nimport { getVertexId } from '../../../../core/util';\nimport type { Types } from '../../../types';\nimport { makeChainable } from '../../../../common/make-chainable';\nimport type { GroupWithExclude, Wrapped } from '../../../../core/interfaces/vertices/util/edges';\n\n/**\n * Merges group references with their parent groups while ensuring that a group is present at\n * most once and that parent groups are prioritized as they carry no member exclusions.\n */\nfunction mergeWithParentGroups (\n references: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[],\n options: Types.parsedToOptions\n): GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[] {\n return makeChainable(references)\n .chain(\n x => x.flatMap((x): ((typeof x) & { isParentGroup?: boolean })[] => ([\n x, ...(x.to.parentGroups ?? []).map(y => ({ to: y, isParentGroup: true }))\n ])),\n x => groupBy(x, x => getVertexId(x.to, options)),\n x => Object.values(x)\n .map(xs => xs.find(x => x.isParentGroup) ?? xs.at(0))\n .filter(x => x != null)\n )\n .value;\n}\n\ntype ItemAndType =\n | { item: ConnectedTypes.course, type: 'course' }\n | { item: ConnectedTypes.event, type: 'event' }\n | { item: ConnectedTypes.lockedTime, type: 'lockedTime' };\n\ntype Source = {\n teachers?: Wrapped.Util.Value<'to', ConnectedTypes.teacher>[];\n groups?: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[];\n participants?: Wrapped.Util.Value<'to', ConnectedTypes.person>[];\n};\n\n/**\n * Returns the source of group, teacher, and participant references for a given item while taking into account event inheritance.\n */\nfunction getSources (itemAndType: ItemAndType): Source {\n if (itemAndType.type == 'lockedTime') return {\n teachers: itemAndType.item.coalesced?.filter(x => x.toModel == 'teachers'),\n groups: itemAndType.item.coalesced?.filter(x => x.toModel == 'groups' )\n };\n\n const item = itemAndType.item;\n const teachersSource = item.teachers\n ? item\n : ('course' in item && item.course ? item.course : item);\n const groupsAndParticipantsSource = (item.groups || item.participants)\n ? item\n : ('course' in item && item.course ? item.course : item);\n return {\n teachers: teachersSource.teachers ?? undefined,\n groups: groupsAndParticipantsSource.groups ?? undefined,\n participants: groupsAndParticipantsSource.participants ?? undefined\n };\n}\n\n/**\n * Parses group references from a course or event while carrying out event inheritance and taking into account parent groups.\n */\nexport function parseGroupReferences (\n itemAndType: ItemAndType,\n options: Types.parsedToOptions\n): Types.groupReference[][] {\n const sources = getSources(itemAndType);\n\n // if interested in the old format we care only about references to groups\n if (options.oldFormat) {\n return makeChainable([\n ...(sources.teachers ?? [])\n .map(x => idOf.teacher(x.to, options)),\n ...mergeWithParentGroups(sources.groups ?? [], options)\n .flatMap(ref => {\n if (ref.to.species == 'class') return idOf.group(ref.to, options);\n\n // if not a class fetch the remaining group member's parent group\n return (ref.to.members ?? [])\n .filter(x => !ref.exclude?.includes(x))\n .map(x => x.group ? idOf.group(x.group, options) : undefined)\n .filter(x => x != null);\n }),\n ...(sources.participants ?? [])\n .map(x => x.to.group ? idOf.group(x.to.group, options) : undefined)\n .filter(x => x != null)\n ])\n .chain(\n x => uniq(x).map(x => [x])\n )\n .value;\n }\n\n const teacherReferences = (sources.teachers ?? [])\n .map((x): Types.groupReference => ({ group: idOf.teacher(x.to, options) }));\n\n const groupReferences = mergeWithParentGroups(sources.groups ?? [], options)\n .map((x): Types.groupReference => {\n if (x.to.species != 'class' || x.exclude?.length) return { individuals: idOf.groupReference(x, options) }; // use individuals set if not a plain group reference\n return { group: idOf.group(x.to, options) };\n });\n\n const participantReferences = sources.participants?.length\n ? { individuals: sources.participants.map(x => idOf.person(x.to, options)) } as Types.groupReference\n : undefined;\n\n // combine all references\n return teacherReferences\n .concat(\n groupReferences,\n participantReferences ? [participantReferences] : []\n )\n .map(x => [x]);\n}"],"mappings":";;;;;;;;;;AAYA,SAAS,sBACP,YACA,SAC4E;AAC5E,QAAO,cAAc,WAAW,CAC7B,OACC,MAAK,EAAE,SAAS,QAAqD,CACnEA,KAAG,IAAIA,IAAE,GAAG,gBAAgB,EAAE,EAAE,KAAI,OAAM;EAAE,IAAI;EAAG,eAAe;EAAM,EAAE,CAC3E,CAAE,GACH,MAAK,QAAQ,IAAG,QAAK,YAAYA,IAAE,IAAI,QAAQ,CAAC,GAChD,MAAK,OAAO,OAAO,EAAE,CAClB,KAAI,OAAM,GAAG,MAAK,QAAKA,IAAE,cAAc,IAAI,GAAG,GAAG,EAAE,CAAC,CACpD,QAAO,QAAKA,OAAK,KAAK,CAC1B,CACA;;;;;AAiBL,SAAS,WAAY,aAAkC;AACrD,KAAI,YAAY,QAAQ,aAAc,QAAO;EAC3C,UAAU,YAAY,KA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A6B,EAAE,OAAO,KAAK,QAAQ,EAAE,IAAI,QAAQ,EAAE,EAAE;CAE7E,MAAM,kBAAkB,sBAAsB,QAAQ,UAAU,EAAE,EAAE,QAAQ,CACzE,KAAK,MAA4B;AAChC,MAAI,EAAE,GAAG,WAAW,WAAW,EAAE,SAAS,OAAQ,QAAO,EAAE,aAAa,KAAK,eAAe,GAAG,QAAQ,EAAE;AACzG,SAAO,EAAE,OAAO,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE;GAC3C;CAEJ,MAAM,wBAAwB,QAAQ,cAAc,SAChD,EAAE,aAAa,QAAQ,aAAa,KAAI,MAAK,KAAK,OAAO,EAAE,IAAI,QAAQ,CAAC,EAAE,GAC1E;AAGJ,QAAO,kBACJ,OACC,iBACA,wBAAwB,CAAC,sBAAsB,GAAG,EAAE,CACrD,CACA,KAAI,MAAK,CAAC,EAAE,CAAC"}
1
+ {"version":3,"file":"parse-group-references.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-group-references.ts"],"sourcesContent":["import { groupBy, uniq } from 'lodash-es';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport { idOf } from './util';\nimport { getVertexId } from '../../../../core/util';\nimport type { Types } from '../../../types';\nimport { makeChainable } from '../../../../common/make-chainable';\nimport type { GroupWithExclude, Wrapped } from '../../../../core/interfaces/vertices/util/edges';\n\n/**\n * Merges group references with their parent groups while ensuring that a group is present at\n * most once and that parent groups are prioritized as they carry no member exclusions.\n */\nfunction mergeWithParentGroups (\n references: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[],\n options: Types.parsedToOptions\n): GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[] {\n return makeChainable(references)\n .chain(\n x => x.flatMap((x): ((typeof x) & { isParentGroup?: boolean })[] => ([\n x, ...(x.to.parentGroups ?? []).map(y => ({ to: y, isParentGroup: true }))\n ])),\n x => groupBy(x, x => getVertexId(x.to, options)),\n x => Object.values(x)\n .map(xs => xs.find(x => x.isParentGroup) ?? xs.at(0))\n .filter(x => x != null)\n )\n .value;\n}\n\ntype ItemAndType =\n | { item: ConnectedTypes.course, type: 'course' }\n | { item: ConnectedTypes.event, type: 'event' }\n | { item: ConnectedTypes.lockedTime, type: 'lockedTime' };\n\ntype Source = {\n teachers?: Wrapped.Util.Value<'to', ConnectedTypes.teacher>[];\n groups?: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>[];\n participants?: Wrapped.Util.Value<'to', ConnectedTypes.person>[];\n};\n\n/**\n * Returns the source of group, teacher, and participant references for a given item while taking into account event inheritance.\n */\nfunction getSources (itemAndType: ItemAndType): Source {\n if (itemAndType.type == 'lockedTime') return {\n teachers: itemAndType.item.coalesced?.filter(x => x.toModel == 'teachers'),\n groups: itemAndType.item.coalesced?.filter(x => x.toModel == 'groups' )\n };\n\n const item = itemAndType.item;\n const teachersSource = item.teachers\n ? item\n : ('course' in item && item.course ? item.course : item);\n const groupsAndParticipantsSource = (item.groups || item.participants)\n ? item\n : ('course' in item && item.course ? item.course : item);\n return {\n teachers: teachersSource.teachers ?? undefined,\n groups: groupsAndParticipantsSource.groups ?? undefined,\n participants: groupsAndParticipantsSource.participants ?? undefined\n };\n}\n\n/**\n * Parses group references from a course or event while carrying out event inheritance and taking into account parent groups.\n */\nexport function parseGroupReferences (\n itemAndType: ItemAndType,\n options: Types.parsedToOptions\n): Types.groupReference[][] {\n const sources = getSources(itemAndType);\n\n // if interested in the old format we care only about references to groups\n if (options.oldFormat) {\n return makeChainable([\n ...(sources.teachers ?? [])\n .map(x => idOf.teacher(x.to, options)),\n ...mergeWithParentGroups(sources.groups ?? [], options)\n .flatMap(ref => {\n if (ref.to.species == 'class') return idOf.group(ref.to, options);\n\n // if not a class fetch the remaining group member's parent group\n return (ref.to.members ?? [])\n .filter(x => !ref.exclude?.includes(x))\n .map(x => x.group ? idOf.group(x.group, options) : undefined)\n .filter(x => x != null);\n }),\n ...(sources.participants ?? [])\n .map(x => x.to.group ? idOf.group(x.to.group, options) : undefined)\n .filter(x => x != null)\n ])\n .chain(\n x => uniq(x).map(x => [x])\n )\n .value;\n }\n\n const teacherReferences = (sources.teachers ?? [])\n .map((x): Types.groupReference => ({ group: idOf.teacher(x.to, options) }));\n\n const groupReferences = mergeWithParentGroups(sources.groups ?? [], options)\n .map((x): Types.groupReference => {\n if (x.to.species != 'class' || x.exclude?.length) return { individuals: idOf.groupReference(x, options) }; // use individuals set if not a plain group reference\n return { group: idOf.group(x.to, options) };\n });\n\n const participantReferences = sources.participants?.length\n ? { individuals: sources.participants.map(x => idOf.person(x.to, options)) } as Types.groupReference\n : undefined;\n\n // combine all references\n return teacherReferences\n .concat(\n groupReferences,\n participantReferences ? [participantReferences] : []\n )\n .map(x => [x]);\n}"],"mappings":";;;;;;;;;;AAYA,SAAS,sBACP,YACA,SAC4E;AAC5E,QAAO,cAAc,YAClB,OACC,MAAK,EAAE,SAAS,QAAqD,CACnEA,KAAG,IAAIA,IAAE,GAAG,gBAAgB,IAAI,KAAI,OAAM;EAAE,IAAI;EAAG,eAAe;SAEpE,MAAK,QAAQ,IAAG,QAAK,YAAYA,IAAE,IAAI,YACvC,MAAK,OAAO,OAAO,GAChB,KAAI,OAAM,GAAG,MAAK,QAAKA,IAAE,kBAAkB,GAAG,GAAG,IACjD,QAAO,QAAKA,OAAK,OAErB;;;;;AAiBL,SAAS,WAAY,aAAkC;AACrD,KAAI,YAAY,QAAQ,aAAc,QAAO;EAC3C,UAAU,YAAY,KAAK,WAAW,QAAO,MAAK,EAAE,WAAW;EAC/D,QAAU,YAAY,KAAK,WAAW,QAAO,MAAK,EAAE,WAAW;;CAGjE,MAAM,OAAO,YAAY;CACzB,MAAM,iBAAiB,KAAK,WACxB,OACC,YAAY,QAAQ,KAAK,SAAS,KAAK,SAAS;CACrD,MAAM,8BAA+B,KAAK,UAAU,KAAK,eACrD,OACC,YAAY,QAAQ,KAAK,SAAS,KAAK,SAAS;AACrD,QAAO;EACL,UAAc,eAAe,YAA6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
23
  } else if (intervals.length != settings.numDays) throw new Error(`(RS::To::Intervals) Intervals length ${intervals.length} does not match settings.numDays ${settings.numDays}`);
24
24
  return intervals.map((i, day) => {
25
25
  if (!i.start || !i.end) throw new Error(`(RS::To::Intervals) Interval missing start or end for day ${day}`);
26
+ const start = parseFloat(parseIntervalDate(i.start).format("HH.mm"));
27
+ const end = parseFloat(parseIntervalDate(i.end).format("HH.mm"));
26
28
  return {
27
- beg: parseFloat(parseIntervalDate(i.start).format("HH.mm")),
28
- end: parseFloat(parseIntervalDate(i.end).format("HH.mm"))
29
+ beg: start,
30
+ end
29
31
  };
30
32
  });
31
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"parse-intervals.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-intervals.ts"],"sourcesContent":["import { groupBy } from 'lodash-es';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport { getDayIndex } from '../../../../core/util';\nimport type { Types } from '../../../types';\nimport { makeChainable } from '../../../../common/make-chainable';\nimport { parseIntervalDate } from '../intervals';\nimport type { Interval } from '../../../../core/interfaces';\n\nfunction getDayLimits (\n intervals: Interval[] | undefined,\n settings: ConnectedTypes.divisionSettings\n): { beg: number, end: number }[] {\n // remove short-hand notation (a single interval for all days)\n if (!intervals) {\n const start = parseIntervalDate(settings.dayStart);\n const end = parseIntervalDate(settings.dayEnd);\n intervals = Array.from({ length: settings.numDays }, () => ({ start: start.clone(), end: end.clone() }));\n }\n else if (intervals.length == 1) {\n const i = intervals[0];\n const start = parseIntervalDate(i.start);\n const end = parseIntervalDate(i.end);\n intervals = Array.from({ length: settings.numDays }, () => ({ start: start.clone(), end: end.clone() }));\n } else if (intervals.length != settings.numDays) {\n throw new Error(`(RS::To::Intervals) Intervals length ${intervals.length} does not match settings.numDays ${settings.numDays}`);\n }\n\n // the day start and end times of each day\n return intervals.map((i, day: number) => {\n if (!i.start || !i.end) throw new Error(`(RS::To::Intervals) Interval missing start or end for day ${day}`);\n const start = parseFloat(parseIntervalDate(i.start).format('HH.mm'));\n const end = parseFloat(parseIntervalDate(i.end ).format('HH.mm'));\n return { beg: start, end: end };\n });\n}\n\n\n/**\n * @deprecated The old way of parsing intervals\n */\nexport function parseIntervals (\n intervals: Interval[] | undefined,\n rootInterval: ConnectedTypes.rootInterval | undefined,\n settings: ConnectedTypes.divisionSettings\n): Types.interval[][] | undefined {\n // if only intervals are provided\n if (intervals && !rootInterval) return getDayLimits(intervals, settings).map(i => [i]);\n\n // if root intervals are present\n if (rootInterval) {\n const dayLimits = getDayLimits(intervals, settings);\n return makeChainable(rootInterval.intervals)\n .chain(\n x => groupBy(x, x => getDayIndex(x.start)),\n x => Object.entries(x)\n .map(([day, xs]) => {\n const limit = dayLimits.at(parseInt(day));\n if (!limit) throw new Error(`(RS::To::Intervals) Day ${day} not found in dayStartAndEnds`);\n\n // remove all block intervals that lay outside the day start and end\n return xs\n .map(x => ({\n beg: parseFloat(parseIntervalDate(x.start).format('HH.mm')),\n end: parseFloat(parseIntervalDate(x.end ).format('HH.mm')),\n binary: true\n } satisfies Types.interval))\n .filter(x => x.beg >= limit.beg && x.end <= limit.end);\n })\n // ensure that all days are represented, even if empty\n .reduce<Types.interval[][]>((acc, curr, index) => {\n acc[index] = curr;\n return acc;\n }, Array.from({ length: settings.numDays }, () => []))\n )\n .value;\n }\n\n // only remaining case here is \"!intervals && !rootInterval\"\n return;\n};\n"],"mappings":";;;;;;AAQA,SAAS,aACP,WACA,UACgC;AAEhC,KAAI,CAAC,WAAW;EACd,MAAM,QAAQ,kBAAkB,SAAS,SAAS;EAClD,MAAM,MAAQ,kBAAkB,SAAS,OAAO;AAChD,cAAY,MAAM,KAAK,EAAE,QAAQ,SAAS,SAAS,SAAS;GAAE,OAAO,MAAM,OAAO;GAAE,KAAK,IAAI,OAAO;GAAE,EAAE;YAEjG,UAAU,UAAU,GAAG;EAC9B,MAAM,IAAI,UAAU;EACpB,MAAM,QAAQ,kBAAkB,EAAE,MAAM;EACxC,MAAM,MAAQ,k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KAAK,MAAM,UAAU;AAChD,OAAI,SAAS;AACb,UAAO;KACN,MAAM,KAAK,EAAE,QAAQ,SAAS,SAAS,QAAQ,EAAE,CAAC,CAAC,CACzD,CACA"}
1
+ {"version":3,"file":"parse-intervals.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-intervals.ts"],"sourcesContent":["import { groupBy } from 'lodash-es';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport { getDayIndex } from '../../../../core/util';\nimport type { Types } from '../../../types';\nimport { makeChainable } from '../../../../common/make-chainable';\nimport { parseIntervalDate } from '../intervals';\nimport type { Interval } from '../../../../core/interfaces';\n\nfunction getDayLimits (\n intervals: Interval[] | undefined,\n settings: ConnectedTypes.divisionSettings\n): { beg: number, end: number }[] {\n // remove short-hand notation (a single interval for all days)\n if (!intervals) {\n const start = parseIntervalDate(settings.dayStart);\n const end = parseIntervalDate(settings.dayEnd);\n intervals = Array.from({ length: settings.numDays }, () => ({ start: start.clone(), end: end.clone() }));\n }\n else if (intervals.length == 1) {\n const i = intervals[0];\n const start = parseIntervalDate(i.start);\n const end = parseIntervalDate(i.end);\n intervals = Array.from({ length: settings.numDays }, () => ({ start: start.clone(), end: end.clone() }));\n } else if (intervals.length != settings.numDays) {\n throw new Error(`(RS::To::Intervals) Intervals length ${intervals.length} does not match settings.numDays ${settings.numDays}`);\n }\n\n // the day start and end times of each day\n return intervals.map((i, day: number) => {\n if (!i.start || !i.end) throw new Error(`(RS::To::Intervals) Interval missing start or end for day ${day}`);\n const start = parseFloat(parseIntervalDate(i.start).format('HH.mm'));\n const end = parseFloat(parseIntervalDate(i.end ).format('HH.mm'));\n return { beg: start, end: end };\n });\n}\n\n\n/**\n * @deprecated The old way of parsing intervals\n */\nexport function parseIntervals (\n intervals: Interval[] | undefined,\n rootInterval: ConnectedTypes.rootInterval | undefined,\n settings: ConnectedTypes.divisionSettings\n): Types.interval[][] | undefined {\n // if only intervals are provided\n if (intervals && !rootInterval) return getDayLimits(intervals, settings).map(i => [i]);\n\n // if root intervals are present\n if (rootInterval) {\n const dayLimits = getDayLimits(intervals, settings);\n return makeChainable(rootInterval.intervals)\n .chain(\n x => groupBy(x, x => getDayIndex(x.start)),\n x => Object.entries(x)\n .map(([day, xs]) => {\n const limit = dayLimits.at(parseInt(day));\n if (!limit) throw new Error(`(RS::To::Intervals) Day ${day} not found in dayStartAndEnds`);\n\n // remove all block intervals that lay outside the day start and end\n return xs\n .map(x => ({\n beg: parseFloat(parseIntervalDate(x.start).format('HH.mm')),\n end: parseFloat(parseIntervalDate(x.end ).format('HH.mm')),\n binary: true\n } satisfies Types.interval))\n .filter(x => x.beg >= limit.beg && x.end <= limit.end);\n })\n // ensure that all days are represented, even if empty\n .reduce<Types.interval[][]>((acc, curr, index) => {\n acc[index] = curr;\n return acc;\n }, Array.from({ length: settings.numDays }, () => []))\n )\n .value;\n }\n\n // only remaining case here is \"!intervals && !rootInterval\"\n return;\n};\n"],"mappings":";;;;;;AAQA,SAAS,aACP,WACA,UACgC;AAEhC,KAAI,CAAC,WAAW;EACd,MAAM,QAAQ,kBAAkB,SAAS;EACzC,MAAM,MAAQ,kBAAkB,SAAS;AACzC,cAAY,MAAM,KAAK,EAAE,QAAQ,SAAS,kBAAkB;GAAE,OAAO,MAAM;GAAS,KAAK,IAAI;;YAEtF,UAAU,UAAU,GAAG;EAC9B,MAAM,IAAI,UAAU;EACpB,MAAM,QAAQ,kBAAkB,EAAE;EAClC,MAAM,MAAQ,kBAAkB,EAAE;AAClC,cAAY,MAAM,KAAK,EAAE,QAAQ,SAAS,kBAAkB;GAAE,OAAO,MAAM;GAAS,KAAK,IAAI;;YACpF,UAAU,UAAU,SAAS,QACtC,OAAM,IAAI,MAAM,wCAAwC,UAAU,OAAO,mCAAmC,SAAS;AAIvH,QAAO,UAAU,KAAK,GAAG,QAAgB;AACvC,MAAI,CAAC,EAAE,SAAS,CAAC,EAAE,IAAK,OAAM,IAAI,MAAM,6DAA6D;EACrG,MAAM,QAAQ,WAAW,kBAAkB,EAAE,OAAO,OAAO;EAC3D,MAAM,MAAQ,WAAW,kBAAkB,EAAE,KAAO,OAAO;AAC3D,SAAO;GAAE,KAAK;GAAY;;;;;;;AAQ9B,SAAgB,eACd,WACA,cACA,UACgC;AAEhC,KAAI,aAAa,CAAC,aAAc,QAAO,aAAa,WAAW,UAAU,KAAI,MAAK,CAAC;AAGnF,KAAI,cAAc;EAChB,MAAM,YAAY,aAAa,WAAW;AAC1C,SAAO,cAAc,aAAa,WAC/B,OACC,MAAK,QAAQ,IAAG,QAAK,YAAYA,IAAE,UACnC,MAAK,OAAO,QAAQ,GACjB,KAAK,CAAC,KAAK,QAAQ;GAClB,MAAM,QAAQ,UAAU,GAAG,SAAS;AACpC,OAAI,CAAC,MAAO,OAAM,IAAI,MAAM,2BAA2B,IAAI;AAG3D,UAAO,GACJ,KAAI,SAAM;IACT,KAAQ,WAAW,kBAAkBA,IAAE,OAAO,OAAO;IACrD,KAAQ,WAAW,kBAAkBA,IAAE,KAAO,OAAO;IACrD,QAAQ;OAET,QAAO,QAAKA,IAAE,OAAO,MAAM,OAAOA,IAAE,OAAO,MAAM;KAGrD,QAA4B,KAAK,MAAM,UAAU;AAChD,OAAI,SAAS;AACb,UAAO;KACN,MAAM,KAAK,EAAE,QAAQ,SAAS,iBAAiB,MAErD"}
@@ -19,7 +19,8 @@ function parseLocationReferences(references, options) {
19
19
  })))).value;
20
20
  }
21
21
  function parseSelectedLocations(event, options) {
22
- const dependencies = parseLocationReferences(event.locations ?? event.course?.locations, options);
22
+ const locationsRef = event.locations ?? event.course?.locations;
23
+ const dependencies = parseLocationReferences(locationsRef, options);
23
24
  const inLocations = event.inLocations ?? [];
24
25
  if (inLocations.length === dependencies?.length) return inLocations.map((x) => x ? getVertexId(x, options) : null);
25
26
  return inLocations.map((x) => x ? getVertexId(x, options) : null).concat(Array.from({ length: Math.max((dependencies?.length ?? 0) - inLocations.length, 0) }).map(() => null));
@@ -1 +1 @@
1
- {"version":3,"file":"parse-location-references.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-location-references.ts"],"sourcesContent":["import { groupBy } from 'lodash-es';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport { getVertexId } from '../../../../core/util';\nimport { makeChainable } from '../../../../common/make-chainable';\nimport type { AvailableLocation } from '../../../../core/interfaces/vertices/util/edges';\n\n\nexport function parseLocationReferences (\n references: AvailableLocation.Util.Value<ConnectedTypes.location, { groupIndex?: number; rank?: number; }>[] | null | undefined,\n options: Types.parsedToOptions\n) {\n if (!references) return;\n\n return makeChainable(references)\n .chain(\n x => x\n .map(({ locations, groupIndex, rank }) => ({\n dependency: getVertexId(locations[0], options),\n rank: rank,\n groupIndex: groupIndex\n }))\n .filter(x => {\n // filter location references based on partial schedule options\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (!includedLocations) return true;\n return includedLocations.has(x.dependency);\n }),\n x => groupBy(x, x => x.groupIndex),\n x => Object.values(x)\n .map(xs => xs.map(x => ({\n dependency: x.dependency,\n ...x.rank != null && { rank: x.rank },\n }) as Types.availableDependency))\n )\n .value;\n}\n\nexport function parseSelectedLocations (event: ConnectedTypes.event, options: Types.parsedToOptions) {\n\n const locationsRef = event.locations ?? event.course?.locations;\n const dependencies = parseLocationReferences(locationsRef, options);\n const inLocations = event.inLocations ?? [];\n\n // simply use inLocations if they match the number of dependencies\n if (inLocations.length === dependencies?.length) {\n return inLocations.map(x => x ? getVertexId(x, options) : null);\n }\n\n // otherwise, fill inLocations with nulls to match the number of dependencies\n return inLocations\n .map(x => x ? getVertexId(x, options) : null)\n .concat(Array\n .from({ length: Math.max((dependencies?.length ?? 0) - inLocations.length, 0) })\n .map(() => null as string | null)\n );\n}"],"mappings":";;;;;AAQA,SAAgB,wBACd,YACA,SACA;AACA,KAAI,CAAC,WAAY;AAEjB,QAAO,cAAc,WAAW,CAC7B,OACC,MAAK,EACF,KAAK,EAAE,WAAW,YAAY,YAAY;EACzC,YAAY,YAAY,UAAU,IAAI,QAAQ;EAClC;EACA;EACb,EAAE,CACF,QAAO,QAAK;EAEX,MAAM,oBAAoB,QAAQ,wBAAwB;AAC1D,MAAI,CAAC,kBAAmB,QAAO;AAC/B,SAAO,kBAAkB,IAAIA,IAAE,WAAW;GAC1C,GACJ,MAAK,QAAQ,IAAG,QAAKA,IAAE,WAAW,GAClC,MAAK,OAAO,OAAO,EAAE,CAClB,KAAI,OAAM,GAAG,KAAI,SAAM;EACtB,YAAYA,IAAE;EACd,GAAGA,IAAE,QAAQ,QAAQ,EAAE,MAAMA,IAAE,MAAM;EACtC,EAA+B,CAAC,CACpC,CACA;;AAGL,SAAgB,uBAAwB,OAA6B,SAAgC;CAGnG,MAAM,eAAe,wBADA,MAAM,aAAa,MAAM,QAAQ,WACK,QAAQ;CACnE,MAAM,cAAe,MAAM,eAAe,EAAE;AAG5C,KAAI,YAAY,WAAW,cAAc,OACvC,QAAO,YAAY,KAAI,MAAM,IAAI,YAAY,GAAG,QAAQ,GAAG,KAAK;AAIlE,QAAO,YACJ,KAAI,MAAM,IAAI,YAAY,GAAG,QAAQ,GAAG,KAAK,CAC7C,OAAO,MACL,KAAK,EAAE,QAAQ,KAAK,KAAK,cAAc,UAAU,KAAK,YAAY,QAAQ,EAAE,EAAE,CAAC,CAC/E,UAAU,KAAsB,CAClC"}
1
+ {"version":3,"file":"parse-location-references.js","names":["x"],"sources":["../../../../../src/RS/to/input/util/parse-location-references.ts"],"sourcesContent":["import { groupBy } from 'lodash-es';\nimport type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport { getVertexId } from '../../../../core/util';\nimport { makeChainable } from '../../../../common/make-chainable';\nimport type { AvailableLocation } from '../../../../core/interfaces/vertices/util/edges';\n\n\nexport function parseLocationReferences (\n references: AvailableLocation.Util.Value<ConnectedTypes.location, { groupIndex?: number; rank?: number; }>[] | null | undefined,\n options: Types.parsedToOptions\n) {\n if (!references) return;\n\n return makeChainable(references)\n .chain(\n x => x\n .map(({ locations, groupIndex, rank }) => ({\n dependency: getVertexId(locations[0], options),\n rank: rank,\n groupIndex: groupIndex\n }))\n .filter(x => {\n // filter location references based on partial schedule options\n const includedLocations = options.partialScheduleOptions?.includedLocations;\n if (!includedLocations) return true;\n return includedLocations.has(x.dependency);\n }),\n x => groupBy(x, x => x.groupIndex),\n x => Object.values(x)\n .map(xs => xs.map(x => ({\n dependency: x.dependency,\n ...x.rank != null && { rank: x.rank },\n }) as Types.availableDependency))\n )\n .value;\n}\n\nexport function parseSelectedLocations (event: ConnectedTypes.event, options: Types.parsedToOptions) {\n\n const locationsRef = event.locations ?? event.course?.locations;\n const dependencies = parseLocationReferences(locationsRef, options);\n const inLocations = event.inLocations ?? [];\n\n // simply use inLocations if they match the number of dependencies\n if (inLocations.length === dependencies?.length) {\n return inLocations.map(x => x ? getVertexId(x, options) : null);\n }\n\n // otherwise, fill inLocations with nulls to match the number of dependencies\n return inLocations\n .map(x => x ? getVertexId(x, options) : null)\n .concat(Array\n .from({ length: Math.max((dependencies?.length ?? 0) - inLocations.length, 0) })\n .map(() => null as string | null)\n );\n}"],"mappings":";;;;;AAQA,SAAgB,wBACd,YACA,SACA;AACA,KAAI,CAAC,WAAY;AAEjB,QAAO,cAAc,YAClB,OACC,MAAK,EACF,KAAK,EAAE,WAAW,YAAY,YAAY;EACzC,YAAY,YAAY,UAAU,IAAI;EAC1B;EACA;KAEb,QAAO,QAAK;EAEX,MAAM,oBAAoB,QAAQ,wBAAwB;AAC1D,MAAI,CAAC,kBAAmB,QAAO;AAC/B,SAAO,kBAAkB,IAAIA,IAAE;MAEnC,MAAK,QAAQ,IAAG,QAAKA,IAAE,cACvB,MAAK,OAAO,OAAO,GAChB,KAAI,OAAM,GAAG,KAAI,SAAM;EACtB,YAAYA,IAAE;EACd,GAAGA,IAAE,QAAQ,QAAQ,EAAE,MAAMA,IAAE;OAGpC;;AAGL,SAAgB,uBAAwB,OAA6B,SAAgC;CAEnG,MAAM,eAAe,MAAM,aAAa,MAAM,QAAQ;CACtD,MAAM,eAAe,wBAAwB,cAAc;CAC3D,MAAM,cAAe,MAAM,eAAe;AAG1C,KAAI,YAAY,WAAW,cAAc,OACvC,QAAO,YAAY,KAAI,MAAM,IAAI,YAAY,GAAG,WAAW;AAI7D,QAAO,YACJ,KAAI,MAAM,IAAI,YAAY,GAAG,WAAW,MACxC,OAAO,MACL,KAAK,EAAE,QAAQ,KAAK,KAAK,cAAc,UAAU,KAAK,YAAY,QAAQ,MAC1E,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse-max-working-hours.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-max-working-hours.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport { min2hrs } from './util';\n\nexport function parseMaxWorkingHours (\n group: ConnectedTypes.group | ConnectedTypes.teacher,\n options: Types.parsedToOptions\n): Pick<Types.group, 'maxNumWorkingHours' | 'maxNumDailyWorkingHours'> | undefined {\n // new format\n if (options.useMaximumScheduleSpan && group.maximumScheduleSpan) {\n return {\n maxNumWorkingHours: min2hrs(group.maximumScheduleSpan.daily) ?? false,\n maxNumDailyWorkingHours: min2hrs(group.maximumScheduleSpan.daily) ?? false,\n };\n }\n\n // old format, to become deprecated\n if (!options.useMaximumScheduleSpan) {\n return {\n ...'maxNumWorkingHours' in group && { maxNumWorkingHours: group.maxNumWorkingHours },\n ...'maxNumDailyWorkingHours' in group && { maxNumDailyWorkingHours: group.maxNumDailyWorkingHours },\n };\n }\n\n return;\n}\n"],"mappings":";;;AAIA,SAAgB,qBACd,OACA,SACiF;AAEjF,KAAI,QAAQ,0BAA0B,MAAM,oBAC1C,QAAO;EACL,oBAAyB,QAAQ,MAAM,oBAAoB,MAAM,IAAI;EACrE,yBAAyB,QAAQ,MAAM,oBAAoB,MAAM,IAAI;EACtE;AAIH,KAAI,CAAC,QAAQ,uBACX,QAAO;EACL,GAAG,wBAA6B,SAAS,EAAE,oBAAyB,MAAM,oBAAoB;EAC9F,GAAG,6BAA6B,SAAS,EAAE,yBAAyB,MAAM,yBAAyB;EACpG"}
1
+ {"version":3,"file":"parse-max-working-hours.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-max-working-hours.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport { min2hrs } from './util';\n\nexport function parseMaxWorkingHours (\n group: ConnectedTypes.group | ConnectedTypes.teacher,\n options: Types.parsedToOptions\n): Pick<Types.group, 'maxNumWorkingHours' | 'maxNumDailyWorkingHours'> | undefined {\n // new format\n if (options.useMaximumScheduleSpan && group.maximumScheduleSpan) {\n return {\n maxNumWorkingHours: min2hrs(group.maximumScheduleSpan.daily) ?? false,\n maxNumDailyWorkingHours: min2hrs(group.maximumScheduleSpan.daily) ?? false,\n };\n }\n\n // old format, to become deprecated\n if (!options.useMaximumScheduleSpan) {\n return {\n ...'maxNumWorkingHours' in group && { maxNumWorkingHours: group.maxNumWorkingHours },\n ...'maxNumDailyWorkingHours' in group && { maxNumDailyWorkingHours: group.maxNumDailyWorkingHours },\n };\n }\n\n return;\n}\n"],"mappings":";;;AAIA,SAAgB,qBACd,OACA,SACiF;AAEjF,KAAI,QAAQ,0BAA0B,MAAM,oBAC1C,QAAO;EACL,oBAAyB,QAAQ,MAAM,oBAAoB,UAAU;EACrE,yBAAyB,QAAQ,MAAM,oBAAoB,UAAU;;AAKzE,KAAI,CAAC,QAAQ,uBACX,QAAO;EACL,GAAG,wBAA6B,SAAS,EAAE,oBAAyB,MAAM;EAC1E,GAAG,6BAA6B,SAAS,EAAE,yBAAyB,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"parse-minimum-break-length.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-minimum-break-length.ts"],"sourcesContent":["import type { CoreTypes } from '../../../../core';\nimport type { Types } from '../../../types';\n\nexport function parseMinimumBreakLength (value: CoreTypes.breakLength | null | undefined): Types.breakLength | undefined {\n if (value == null) return;\n\n if (typeof value === 'boolean') return value;\n if (typeof value === 'number') return value;\n\n if (Array.isArray(value)) {\n if (value.length !== 2) throw new Error('(RS::To::BreakLengths) BreakLength array must have exactly two elements');\n const [bef, aft] = value;\n return { bef, aft };\n }\n\n throw new Error('(RS::To::BreakLengths) BreakLength is neither boolean, number or number array');\n};\n"],"mappings":";AAGA,SAAgB,wBAAyB,OAAgF;AACvH,KAAI,SAAS,KAAM;AAEnB,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,UAAU,SAAU,QAAO;AAEtC,KAAI,MAAM,QAAQ,MAAM,EAAE;AACxB,MAAI,MAAM,WAAW,EAAG,OAAM,IAAI,MAAM,0EAA0E;EAClH,MAAM,CAAC,KAAK,OAAO;AACnB,SAAO;GAAE;GAAK;GAAK;;AAGrB,OAAM,IAAI,MAAM,gFAAgF"}
1
+ {"version":3,"file":"parse-minimum-break-length.js","names":[],"sources":["../../../../../src/RS/to/input/util/parse-minimum-break-length.ts"],"sourcesContent":["import type { CoreTypes } from '../../../../core';\nimport type { Types } from '../../../types';\n\nexport function parseMinimumBreakLength (value: CoreTypes.breakLength | null | undefined): Types.breakLength | undefined {\n if (value == null) return;\n\n if (typeof value === 'boolean') return value;\n if (typeof value === 'number') return value;\n\n if (Array.isArray(value)) {\n if (value.length !== 2) throw new Error('(RS::To::BreakLengths) BreakLength array must have exactly two elements');\n const [bef, aft] = value;\n return { bef, aft };\n }\n\n throw new Error('(RS::To::BreakLengths) BreakLength is neither boolean, number or number array');\n};\n"],"mappings":";AAGA,SAAgB,wBAAyB,OAAgF;AACvH,KAAI,SAAS,KAAM;AAEnB,KAAI,OAAO,UAAU,UAAW,QAAO;AACvC,KAAI,OAAO,UAAU,SAAU,QAAO;AAEtC,KAAI,MAAM,QAAQ,QAAQ;AACxB,MAAI,MAAM,WAAW,EAAG,OAAM,IAAI,MAAM;EACxC,MAAM,CAAC,KAAK,OAAO;AACnB,SAAO;GAAE;GAAK;;;AAGhB,OAAM,IAAI,MAAM"}
@@ -55,7 +55,8 @@ let idOf;
55
55
  if (interval === null) interval = void 0;
56
56
  if (rootInterval === null) rootInterval = void 0;
57
57
  if (interval && interval.length == 0) interval = void 0;
58
- return (rootInterval ? getVertexId(rootInterval, options) + "&" : "") + JSON.stringify(interval);
58
+ const out = (rootInterval ? getVertexId(rootInterval, options) + "&" : "") + JSON.stringify(interval);
59
+ return out;
59
60
  }
60
61
  _idOf.intervalPairReference = intervalPairReference;
61
62
  })(idOf || (idOf = {}));
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":["person","group","teacher","event","lockedTime"],"sources":["../../../../../src/RS/to/input/util/util.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport type { Collection } from '../../../../core/types/common';\nimport { getVertexId } from '../../../../core/util';\nimport type { GroupWithExclude } from '../../../../core/interfaces/vertices/util/edges';\nimport type { Interval } from '../../../../core/interfaces';\n\nexport function min2hrs (min: number | undefined | null) {\n return min ? min / 60 : undefined;\n}\n\n/**\n * Converts a time string in the format \"HH:MM\" to a float representation, e.g., \"12:30\" becomes 12.3.\n */\nexport function toTimeFloat (str: string) {\n return parseFloat(str.replace(':', '.'));\n}\n\nexport function getPeriodIndex (\n period: ConnectedTypes.period | string | undefined | null,\n periodsMap: Map<string | undefined, number>,\n options: Types.parsedToOptions\n): number | undefined {\n // if no periods exist, return undefined\n if (periodsMap.size == 0) return;\n\n // if no period is given, return undefined\n if (!period) return;\n\n const id = getVertexId(period, options);\n const periodIndex = periodsMap.get(id);\n if (periodIndex === undefined) {\n throw new Error(`(RS::To::getPeriodIndex) Period \"${id}\" is not in periodsMap`);\n }\n return periodIndex;\n}\n\nexport const COLLECTION_ID = {\n persons: 'persons',\n groups: 'groups',\n teachers: 'teachers',\n events: 'events',\n lockedTimes: 'lockedtimes',\n} satisfies Partial<Record<Collection, string>>;\n\n/**\n * returns a combined id for the vertex or edge by combining the type(s) and id(s).\n */\nexport namespace idOf {\n /** `persons.id` */\n export function person (\n person: ConnectedTypes.person | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.persons}.${ getVertexId(person, options) }`;\n }\n\n /** `groups.id` */\n export function group (\n group: ConnectedTypes.group,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group, options) }`;\n }\n\n /** `teachers.id` */\n export function teacher (\n teacher: ConnectedTypes.teacher,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.teachers}.${ getVertexId(teacher, options) }`;\n }\n\n /** `events.id` */\n export function event (\n event: ConnectedTypes.event,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.events}.${ getVertexId(event, options) }`;\n }\n\n /** `lockedtimes.id` */\n export function lockedTime (\n lockedTime: ConnectedTypes.lockedTime,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.lockedTimes}.${ getVertexId(lockedTime, options) }`;\n }\n\n /** `groups.id<.exclude.id1.id2...>` */\n export function groupReference (\n group: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group.to, options) }`\n + (group.exclude?.length\n ? '.exclude.' + group.exclude\n .map(x => getVertexId(x, options))\n .sort()\n .join('.')\n : '');\n }\n\n /** `<rootIntervalsId&>JSON.stringify(intervals)>` */\n export function intervalPairReference (\n interval: Interval[] | undefined,\n rootInterval: ConnectedTypes.rootInterval | undefined,\n options: Types.parsedToOptions\n ): string {\n // replace null with undefined\n if (interval === null) interval = undefined;\n if (rootInterval === null) rootInterval = undefined;\n\n // replace empty intervals with undefined\n if (interval && interval.length == 0) interval = undefined;\n\n const out = (rootInterval ? getVertexId(rootInterval, options) + '&' : '') + JSON.stringify(interval);\n return out;\n }\n}\n"],"mappings":";;;AAOA,SAAgB,QAAS,KAAgC;AACvD,QAAO,MAAM,MAAM,KAAK;;;;;AAM1B,SAAgB,YAAa,KAAa;AACxC,QAAO,WAAW,IAA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3,"file":"util.js","names":["person","group","teacher","event","lockedTime"],"sources":["../../../../../src/RS/to/input/util/util.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport type { Collection } from '../../../../core/types/common';\nimport { getVertexId } from '../../../../core/util';\nimport type { GroupWithExclude } from '../../../../core/interfaces/vertices/util/edges';\nimport type { Interval } from '../../../../core/interfaces';\n\nexport function min2hrs (min: number | undefined | null) {\n return min ? min / 60 : undefined;\n}\n\n/**\n * Converts a time string in the format \"HH:MM\" to a float representation, e.g., \"12:30\" becomes 12.3.\n */\nexport function toTimeFloat (str: string) {\n return parseFloat(str.replace(':', '.'));\n}\n\nexport function getPeriodIndex (\n period: ConnectedTypes.period | string | undefined | null,\n periodsMap: Map<string | undefined, number>,\n options: Types.parsedToOptions\n): number | undefined {\n // if no periods exist, return undefined\n if (periodsMap.size == 0) return;\n\n // if no period is given, return undefined\n if (!period) return;\n\n const id = getVertexId(period, options);\n const periodIndex = periodsMap.get(id);\n if (periodIndex === undefined) {\n throw new Error(`(RS::To::getPeriodIndex) Period \"${id}\" is not in periodsMap`);\n }\n return periodIndex;\n}\n\nexport const COLLECTION_ID = {\n persons: 'persons',\n groups: 'groups',\n teachers: 'teachers',\n events: 'events',\n lockedTimes: 'lockedtimes',\n} satisfies Partial<Record<Collection, string>>;\n\n/**\n * returns a combined id for the vertex or edge by combining the type(s) and id(s).\n */\nexport namespace idOf {\n /** `persons.id` */\n export function person (\n person: ConnectedTypes.person | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.persons}.${ getVertexId(person, options) }`;\n }\n\n /** `groups.id` */\n export function group (\n group: ConnectedTypes.group,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group, options) }`;\n }\n\n /** `teachers.id` */\n export function teacher (\n teacher: ConnectedTypes.teacher,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.teachers}.${ getVertexId(teacher, options) }`;\n }\n\n /** `events.id` */\n export function event (\n event: ConnectedTypes.event,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.events}.${ getVertexId(event, options) }`;\n }\n\n /** `lockedtimes.id` */\n export function lockedTime (\n lockedTime: ConnectedTypes.lockedTime,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.lockedTimes}.${ getVertexId(lockedTime, options) }`;\n }\n\n /** `groups.id<.exclude.id1.id2...>` */\n export function groupReference (\n group: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group.to, options) }`\n + (group.exclude?.length\n ? '.exclude.' + group.exclude\n .map(x => getVertexId(x, options))\n .sort()\n .join('.')\n : '');\n }\n\n /** `<rootIntervalsId&>JSON.stringify(intervals)>` */\n export function intervalPairReference (\n interval: Interval[] | undefined,\n rootInterval: ConnectedTypes.rootInterval | undefined,\n options: Types.parsedToOptions\n ): string {\n // replace null with undefined\n if (interval === null) interval = undefined;\n if (rootInterval === null) rootInterval = undefined;\n\n // replace empty intervals with undefined\n if (interval && interval.length == 0) interval = undefined;\n\n const out = (rootInterval ? getVertexId(rootInterval, options) + '&' : '') + JSON.stringify(interval);\n return out;\n }\n}\n"],"mappings":";;;AAOA,SAAgB,QAAS,KAAgC;AACvD,QAAO,MAAM,MAAM,KAAK;;;;;AAM1B,SAAgB,YAAa,KAAa;AACxC,QAAO,WAAW,IAAI,QAAQ,KAAK;;AAGrC,SAAgB,eACd,QACA,YACA,SACoB;AAEpB,KAAI,WAAW,QAAQ,EAAG;AAG1B,KAAI,CAAC,OAAQ;CAEb,MAAM,KAAK,YAAY,QAAQ;CAC/B,MAAM,cAAc,WAAW,IAAI;AACnC,KAAI,gBAAgB,OAClB,OAAM,IAAI,MAAM,oCAAoC,GAAG;AAEzD,QAAO;;AAGT,MAAa,gBAAgB;CAC3B,SAAa;CACb,QAAa;CACb,UAAa;CACb,QAAa;CACb,aAAa;;;;CAQN,SAAS,OACd,UACA,SACQ;AACR,SAAO,GAAG,cAAc,QAAQ,GAAI,YAAYA,UAAQ;;;CAInD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,QACd,WACA,SACQ;AACR,SAAO,GAAG,cAAc,SAAS,GAAI,YAAYC,WAAS;;;CAIrD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,WACd,cACA,SACQ;AACR,SAAO,GAAG,cAAc,YAAY,GAAI,YAAYC,cAAY;;;CAI3D,SAAS,eACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYH,QAAM,IAAI,cACpDA,QAAM,SAAS,SACd,cAAcA,QAAM,QACnB,KAAI,MAAK,YAAY,GAAG,UACxB,OACA,KAAK,OACN;;;CAID,SAAS,sBACd,UACA,cACA,SACQ;AAER,MAAI,aAAiB,KAAM,YAAe;AAC1C,MAAI,iBAAiB,KAAM,gBAAe;AAG1C,MAAI,YAAY,SAAS,UAAU,EAAG,YAAW;EAEjD,MAAM,OAAO,eAAe,YAAY,cAAc,WAAW,MAAM,MAAM,KAAK,UAAU;AAC5F,SAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions']"],"sources":["../../../src/RS/to/schedules.ts"],"sourcesContent":["import { pick } from 'lodash-es';\nimport { parseInput } from './input/input';\nimport { makeConnected } from '../make-connected';\nimport { initialConfiguration } from './initial-configuration';\nimport type { Types } from '../types';\nimport { CoreMap } from '../../core';\nimport { structure } from '../types/to';\nimport { COLLECTION_ID } from './input/util/util';\n\nfunction transformId (id: string): string {\n // should be interpreted as event id\n const indexOfDot = id.indexOf('.');\n if (indexOfDot == -1) return COLLECTION_ID.events + '.' + id;\n\n // split on first dot only\n const prefix = id.substring(0, indexOfDot).toLowerCase();\n const suffix = id.substring(indexOfDot + 1);\n\n if (prefix == COLLECTION_ID.lockedTimes.toLowerCase()) return COLLECTION_ID.lockedTimes + '.' + suffix;\n if (prefix == COLLECTION_ID.events .toLowerCase()) return COLLECTION_ID.events + '.' + suffix;\n\n throw new Error(`(RS::To::transformId) Unknown id prefix \"${prefix}\" in id \"${id}\"`);\n}\n\nexport function schedules (\n data: Types.toInput,\n _options: Types.toOptions = {}\n): Types.toOutput {\n ////\n //// parse the options\n ////\n const options = ((): Types.parsedToOptions => {\n const x = _options.partialScheduleOptions;\n const partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions'] = x\n ? {\n includedEvents: x.includedEvents ? new Set(x.includedEvents) : undefined,\n includedLocations: x.includedLocations ? new Set(x.includedLocations) : undefined,\n omittedEventsHandling: x.omittedEventsHandling\n }\n : undefined;\n\n return { ..._options, partialScheduleOptions };\n })();\n\n ////\n //// for backward compatibility: add default collection to included events set\n ////\n if (options.partialScheduleOptions?.includedEvents?.size) {\n options.partialScheduleOptions.includedEvents = new Set(\n [...options.partialScheduleOptions.includedEvents].map(x => transformId(x))\n );\n }\n\n\n // we will work only with connected schedule data\n const connectedData = makeConnected(data);\n\n return {\n meta: {\n structure: structure,\n division: pick(connectedData.division, 'displayName', 'start', 'end'),\n },\n algorithmParameters: {\n weights: options.algorithmWeightParameters,\n computeTimeMultiplier: options.computeTimeMultiplier\n },\n input: parseInput(connectedData, options),\n ...options.appendCoreData && { coreData: CoreMap.to.schedules(data) },\n ...options.appendOutput && { output: initialConfiguration(connectedData.events, connectedData.lockedTimes, options) },\n };\n};"],"mappings":";;;;;;;;;AASA,SAAS,YAAa,IAAoB;CAExC,MAAM,aAAa,GAAG,QAAQ,IAAI;AAClC,KAAI,cAAc,GAAI,QAAO,cAAc,SAAS,MAAM;CAG1D,MAAM,SAAS,GAAG,UAAU,GAAG,WAAW,CAAC,aAAa;CACxD,MAAM,SAAS,GAAG,UAAU,aAAa,EAAE;AAE3C,KAAI,UAAU,cAAc,YAAY,aAAa,CAAE,QAAO,cAAc,cAAc,MAAM;AAChG,KAAI,UAAU,cAAc,OAAY,aAAa,CAAE,QAAO,cAAc,SAAc,MAAM;AAEhG,OAAM,IAAI,MAAM,4CAA4C,OAAO,WAAW,GAAG,GAAG;;AAGtF,SAAgB,UACd,MACA,WAA4B,EAAE,EACd;CAIhB,MAAM,iBAAwC;EAC5C,MAAM,IAAI,SAAS;EACnB,MAAMA,yBAA0E,IAC5E;GACA,gBAAuB,EAAE,iBAAoB,IAAI,IAAI,EAAE,eAAe,GAAM;GAC5E,mBAAuB,EAAE,oBAAoB,IAAI,IAAI,EAAE,kBAAkB,GAAG;GAC5E,uBAAuB,EAAE;GAC1B,GACC;AAEJ,SAAO;GAAE,GAAG;GAAU;GAAwB;KAC5C;AAKJ,KAAI,QAAQ,wBAAwB,gBAAgB,KAClD,SAAQ,uBAAuB,iBAAiB,IAAI,IAClD,CAAC,GAAG,QAAQ,uBAAuB,eAAe,CAAC,KAAI,MAAK,YAAY,EAAE,CAAC,CAC5E;CAKH,MAAM,gBAAgB,cAAc,KAAK;AAEzC,QAAO;EACL,MAAM;GACO;GACX,UAAW,KAAK,cAAc,UAAU,eAAe,SAAS,MAAM;GACvE;EACD,qBAAqB;GACnB,SAAuB,QAAQ;GAC/B,uBAAuB,QAAQ;GAChC;EACD,OAAO,WAAW,eAAe,QAAQ;EACzC,GAAG,QAAQ,kBAAkB,EAAE,UAAU,QAAQ,GAAG,UAAU,KAAK,EAAE;EACrE,GAAG,QAAQ,gBAAkB,EAAE,QAAQ,qBAAqB,cAAc,QAAQ,cAAc,aAAa,QAAQ,EAAE;EACxH"}
1
+ {"version":3,"file":"schedules.js","names":["partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions']"],"sources":["../../../src/RS/to/schedules.ts"],"sourcesContent":["import { pick } from 'lodash-es';\nimport { parseInput } from './input/input';\nimport { makeConnected } from '../make-connected';\nimport { initialConfiguration } from './initial-configuration';\nimport type { Types } from '../types';\nimport { CoreMap } from '../../core';\nimport { structure } from '../types/to';\nimport { COLLECTION_ID } from './input/util/util';\n\nfunction transformId (id: string): string {\n // should be interpreted as event id\n const indexOfDot = id.indexOf('.');\n if (indexOfDot == -1) return COLLECTION_ID.events + '.' + id;\n\n // split on first dot only\n const prefix = id.substring(0, indexOfDot).toLowerCase();\n const suffix = id.substring(indexOfDot + 1);\n\n if (prefix == COLLECTION_ID.lockedTimes.toLowerCase()) return COLLECTION_ID.lockedTimes + '.' + suffix;\n if (prefix == COLLECTION_ID.events .toLowerCase()) return COLLECTION_ID.events + '.' + suffix;\n\n throw new Error(`(RS::To::transformId) Unknown id prefix \"${prefix}\" in id \"${id}\"`);\n}\n\nexport function schedules (\n data: Types.toInput,\n _options: Types.toOptions = {}\n): Types.toOutput {\n ////\n //// parse the options\n ////\n const options = ((): Types.parsedToOptions => {\n const x = _options.partialScheduleOptions;\n const partialScheduleOptions: Types.parsedToOptions['partialScheduleOptions'] = x\n ? {\n includedEvents: x.includedEvents ? new Set(x.includedEvents) : undefined,\n includedLocations: x.includedLocations ? new Set(x.includedLocations) : undefined,\n omittedEventsHandling: x.omittedEventsHandling\n }\n : undefined;\n\n return { ..._options, partialScheduleOptions };\n })();\n\n ////\n //// for backward compatibility: add default collection to included events set\n ////\n if (options.partialScheduleOptions?.includedEvents?.size) {\n options.partialScheduleOptions.includedEvents = new Set(\n [...options.partialScheduleOptions.includedEvents].map(x => transformId(x))\n );\n }\n\n\n // we will work only with connected schedule data\n const connectedData = makeConnected(data);\n\n return {\n meta: {\n structure: structure,\n division: pick(connectedData.division, 'displayName', 'start', 'end'),\n },\n algorithmParameters: {\n weights: options.algorithmWeightParameters,\n computeTimeMultiplier: options.computeTimeMultiplier\n },\n input: parseInput(connectedData, options),\n ...options.appendCoreData && { coreData: CoreMap.to.schedules(data) },\n ...options.appendOutput && { output: initialConfiguration(connectedData.events, connectedData.lockedTimes, options) },\n };\n};"],"mappings":";;;;;;;;;AASA,SAAS,YAAa,IAAoB;CAExC,MAAM,aAAa,GAAG,QAAQ;AAC9B,KAAI,cAAc,GAAI,QAAO,cAAc,SAAS,MAAM;CAG1D,MAAM,SAAS,GAAG,UAAU,GAAG,YAAY;CAC3C,MAAM,SAAS,GAAG,UAAU,aAAa;AAEzC,KAAI,UAAU,cAAc,YAAY,cAAe,QAAO,cAAc,cAAc,MAAM;AAChG,KAAI,UAAU,cAAc,OAAY,cAAe,QAAO,cAAc,SAAc,MAAM;AAEhG,OAAM,IAAI,MAAM,4CAA4C,OAAO,WAAW,GAAG;;AAGnF,SAAgB,UACd,MACA,WAA4B,IACZ;CAIhB,MAAM,iBAAwC;EAC5C,MAAM,IAAI,SAAS;EACnB,MAAMA,yBAA0E,IAC5E;GACA,gBAAuB,EAAE,iBAAoB,IAAI,IAAI,EAAE,kBAAqB;GAC5E,mBAAuB,EAAE,oBAAoB,IAAI,IAAI,EAAE,qBAAqB;GAC5E,uBAAuB,EAAE;MAEzB;AAEJ,SAAO;GAAE,GAAG;GAAU;;;AAMxB,KAAI,QAAQ,wBAAwB,gBAAgB,KAClD,SAAQ,uBAAuB,iBAAiB,IAAI,IAClD,CAAC,GAAG,QAAQ,uBAAuB,gBAAgB,KAAI,MAAK,YAAY;CAM5E,MAAM,gBAAgB,cAAc;AAEpC,QAAO;EACL,MAAM;GACO;GACX,UAAW,KAAK,cAAc,UAAU,eAAe,SAAS;;EAElE,qBAAqB;GACnB,SAAuB,QAAQ;GAC/B,uBAAuB,QAAQ;;EAEjC,OAAO,WAAW,eAAe;EACjC,GAAG,QAAQ,kBAAkB,EAAE,UAAU,QAAQ,GAAG,UAAU;EAC9D,GAAG,QAAQ,gBAAkB,EAAE,QAAQ,qBAAqB,cAAc,QAAQ,cAAc,aAAa"}
@@ -1,6 +1,5 @@
1
1
  import { BaseOptions } from "../../common/types.js";
2
2
  import { Types } from "../../core/types/index.js";
3
- import "../../core/index.js";
4
3
  import { MixedScheduleData } from "../make-connected.js";
5
4
  import { AlgorithmParameters, AlgorithmWeightParameters } from "./algorithm-parameters.js";
6
5
  import { Types as Types$1 } from "./index.js";
@@ -7,7 +7,7 @@ var activities_default = (activities, options) => {
7
7
  return activities.map((activity) => {
8
8
  if (parentActivities.has(activity.id)) return;
9
9
  const groupIndexSet = [...new Set([void 0, ...activity.rooms?.map(({ index }) => index) ?? []])];
10
- return {
10
+ const doc = {
11
11
  ids: activity.id,
12
12
  startDate: activity.startDate,
13
13
  ...omitBy({
@@ -27,6 +27,7 @@ var activities_default = (activities, options) => {
27
27
  })) },
28
28
  ...activity._embedded?.syllabus && { subject: activity._embedded.syllabus.subjectCode }
29
29
  };
30
+ return doc;
30
31
  }).filter((x) => x != null);
31
32
  };
32
33
 
@@ -1 +1 @@
1
- {"version":3,"file":"activities.js","names":[],"sources":["../../../src/SS12000/from/activities.ts"],"sourcesContent":["import { isNil, omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Activity } from '../types/activities';\n\nexport default (\n activities: Activity[],\n options?: { interval?: { start: string, end: string } }\n) => {\n if (!Array.isArray(activities))\n throw new Error('(SS12000::From::Activities) Activities input is not of array type', { cause: 'invalid_input' });\n\n const parentActivities = new Set(activities.map(x => x.parentActivity?.id).filter(Boolean));\n\n return activities\n .map((activity): CoreTypes.MixedWithoutInternalId.Course | undefined => {\n // Skip activities that are above courses\n if (parentActivities.has(activity.id)) return;\n\n const groupIndexSet = [...new Set<number | undefined>([undefined, ...(activity.rooms?.map(({ index }) => index) ?? [])])];\n\n const doc = {\n ids: activity.id,\n startDate: activity.startDate,\n ...omitBy({\n displayName: activity.displayName,\n comment: activity.comment,\n subject: activity.subject,\n endDate: activity.endDate,\n syllabus: activity._embedded?.syllabus,\n }, isNil),\n ...activity.minutesPlanned && { plannedDuration: `${ Math.ceil(activity.minutesPlanned / 60) } hrs` },\n type: activity.activityType,\n groups: activity.groups?.map(({ id }) => ({ to: id })),\n teachers: activity.teachers?.map(({ duty: { id } }) => ({ to: id })),\n // not in the standard\n ...activity.rooms && {\n locations: activity.rooms?.map(({ room, index }) => ({ locations: [room.id!] as [string], groupIndex: groupIndexSet.indexOf(index) })),\n },\n ...activity._embedded?.syllabus && {\n subject: activity._embedded.syllabus.subjectCode,\n }\n };\n return doc;\n })\n .filter(x => x != null);\n};"],"mappings":";;;AAIA,0BACE,YACA,YACG;AACH,KAAI,CAAC,MAAM,QAAQ,WAAW,CAC5B,OAAM,IAAI,MAAM,qEAAqE,EAAE,OAAO,iBAAiB,CAAC;CAElH,MAAM,mBAAmB,IAAI,IAAI,WAAW,KAAI,MAAK,EAAE,gBAAgB,GAAG,CAAC,OAAO,QAAQ,CAAC;AAE3F,QAAO,WACJ,KAAK,aAAkE;AAEtE,MAAI,iBAAiB,IAAI,SAAS,GAAG,CAAE;EAEvC,MAAM,gBAAgB,CAAC,GAAG,IAAI,IAAwB,CAAC,QAAW,GAAI,SAAS,OAAO,KAAK,EAAE,YAAY,MAAM,IAAI,EAAE,CAAE,CAAC,CAAC;AAwBzH,SAtBY;GACV,KAAW,SAAS;GACpB,WAAW,SAAS;GACpB,GAAG,OAAO;IACR,aAAa,SAAS;IACtB,SAAa,SAAS;IACtB,SAAa,SAAS;IACtB,SAAa,SAAS;IACtB,UAAa,SAAS,WAAW;IAClC,EAAE,MAAM;GACT,GAAG,SAAS,kBAAkB,EAAE,iBAAiB,GAAI,KAAK,KAAK,SAAS,iBAAiB,GAAG,CAAE,OAAO;GACrG,MAAU,SAAS;GACnB,QAAU,SAAS,QAAQ,KAAK,EAAE,UAAU,EAAE,IAAI,IAAI,EAAE;GACxD,UAAU,SAAS,UAAU,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,IAAI,EAAE;GAEpE,GAAG,SAAS,SAAS,EACnB,WAAW,SAAS,OAAO,KAAK,EAAE,MAAM,aAAa;IAAE,WAAW,CAAC,KAAK,GAAI;IAAc,YAAY,cAAc,QAAQ,MAAM;IAAE,EAAE,EACvI;GACD,GAAG,SAAS,WAAW,YAAY,EACjC,SAAS,SAAS,UAAU,SAAS,aACtC;GACF;GAED,CACD,QAAO,MAAK,KAAK,KAAK"}
1
+ {"version":3,"file":"activities.js","names":[],"sources":["../../../src/SS12000/from/activities.ts"],"sourcesContent":["import { isNil, omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Activity } from '../types/activities';\n\nexport default (\n activities: Activity[],\n options?: { interval?: { start: string, end: string } }\n) => {\n if (!Array.isArray(activities))\n throw new Error('(SS12000::From::Activities) Activities input is not of array type', { cause: 'invalid_input' });\n\n const parentActivities = new Set(activities.map(x => x.parentActivity?.id).filter(Boolean));\n\n return activities\n .map((activity): CoreTypes.MixedWithoutInternalId.Course | undefined => {\n // Skip activities that are above courses\n if (parentActivities.has(activity.id)) return;\n\n const groupIndexSet = [...new Set<number | undefined>([undefined, ...(activity.rooms?.map(({ index }) => index) ?? [])])];\n\n const doc = {\n ids: activity.id,\n startDate: activity.startDate,\n ...omitBy({\n displayName: activity.displayName,\n comment: activity.comment,\n subject: activity.subject,\n endDate: activity.endDate,\n syllabus: activity._embedded?.syllabus,\n }, isNil),\n ...activity.minutesPlanned && { plannedDuration: `${ Math.ceil(activity.minutesPlanned / 60) } hrs` },\n type: activity.activityType,\n groups: activity.groups?.map(({ id }) => ({ to: id })),\n teachers: activity.teachers?.map(({ duty: { id } }) => ({ to: id })),\n // not in the standard\n ...activity.rooms && {\n locations: activity.rooms?.map(({ room, index }) => ({ locations: [room.id!] as [string], groupIndex: groupIndexSet.indexOf(index) })),\n },\n ...activity._embedded?.syllabus && {\n subject: activity._embedded.syllabus.subjectCode,\n }\n };\n return doc;\n })\n .filter(x => x != null);\n};"],"mappings":";;;AAIA,0BACE,YACA,YACG;AACH,KAAI,CAAC,MAAM,QAAQ,YACjB,OAAM,IAAI,MAAM,qEAAqE,EAAE,OAAO;CAEhG,MAAM,mBAAmB,IAAI,IAAI,WAAW,KAAI,MAAK,EAAE,gBAAgB,IAAI,OAAO;AAElF,QAAO,WACJ,KAAK,aAAkE;AAEtE,MAAI,iBAAiB,IAAI,SAAS,IAAK;EAEvC,MAAM,gBAAgB,CAAC,GAAG,IAAI,IAAwB,CAAC,QAAW,GAAI,SAAS,OAAO,KAAK,EAAE,YAAY,UAAU;EAEnH,MAAM,MAAM;GACV,KAAW,SAAS;GACpB,WAAW,SAAS;GACpB,GAAG,OAAO;IACR,aAAa,SAAS;IACtB,SAAa,SAAS;IACtB,SAAa,SAAS;IACtB,SAAa,SAAS;IACtB,UAAa,SAAS,WAAW;MAChC;GACH,GAAG,SAAS,kBAAkB,EAAE,iBAAiB,GAAI,KAAK,KAAK,SAAS,iBAAiB,IAAK;GAC9F,MAAU,SAAS;GACnB,QAAU,SAAS,QAAQ,KAAK,EAAE,UAAU,EAAE,IAAI;GAClD,UAAU,SAAS,UAAU,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI;GAE9D,GAAG,SAAS,SAAS,EACnB,WAAW,SAAS,OAAO,KAAK,EAAE,MAAM,aAAa;IAAE,WAAW,CAAC,KAAK;IAAkB,YAAY,cAAc,QAAQ;;GAE9H,GAAG,SAAS,WAAW,YAAY,EACjC,SAAS,SAAS,UAAU,SAAS;;AAGzC,SAAO;IAER,QAAO,MAAK,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"calendar-events.js","names":["toRoom"],"sources":["../../../src/SS12000/from/calendar-events.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { CalendarEvent } from '../types/calendar-events';\nimport toRoom from './rooms';\n\nexport default (events: CalendarEvent[]) => {\n if (!Array.isArray(events))\n throw new Error('(SS12000::From::CalendarEvents) CalendarEvent input is not of array type', { cause: 'invalid_input' });\n\n return events\n .map((event): CoreTypes.MixedWithoutInternalId.Event => ({\n ids: event.id,\n start: event.startTime.toString(),\n end: event.endTime.toString(),\n duration: moment(event.endTime).diff(event.endTime, 'm'),\n preferredDuration: moment(event.endTime).diff(event.endTime, 'm'),\n course: event.activity.id,\n inLocations: toRoom(event.rooms ?? []),\n // resources: toResource([])\n }));\n};\n"],"mappings":";;;;AAKA,+BAAgB,WAA4B;AAC1C,KAAI,CAAC,MAAM,QAAQ,OAAO,CACxB,OAAM,IAAI,MAAM,4EAA4E,EAAE,OAAO,iBAAiB,CAAC;AAEzH,QAAO,OACJ,KAAK,WAAmD;EACvD,KAAmB,MAAM;EACzB,OAAmB,MAAM,UAAU,UAAU;EAC7C,KAAmB,MAAM,QAAQ,UAAU;EAC3C,UAAmB,OAAO,MAAM,QAAQ,CAAC,KAAK,MAAM,SAAS,IAAI;EACjE,mBAAmB,OAAO,MAAM,QAAQ,CAAC,KAAK,MAAM,SAAS,IAAI;EACjE,QAAmB,MAAM,SAAS;EAClC,aAAmBA,cAAO,MAAM,SAAS,EAAE,CAAC;EAE7C,EAAE"}
1
+ {"version":3,"file":"calendar-events.js","names":["toRoom"],"sources":["../../../src/SS12000/from/calendar-events.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { CalendarEvent } from '../types/calendar-events';\nimport toRoom from './rooms';\n\nexport default (events: CalendarEvent[]) => {\n if (!Array.isArray(events))\n throw new Error('(SS12000::From::CalendarEvents) CalendarEvent input is not of array type', { cause: 'invalid_input' });\n\n return events\n .map((event): CoreTypes.MixedWithoutInternalId.Event => ({\n ids: event.id,\n start: event.startTime.toString(),\n end: event.endTime.toString(),\n duration: moment(event.endTime).diff(event.endTime, 'm'),\n preferredDuration: moment(event.endTime).diff(event.endTime, 'm'),\n course: event.activity.id,\n inLocations: toRoom(event.rooms ?? []),\n // resources: toResource([])\n }));\n};\n"],"mappings":";;;;AAKA,+BAAgB,WAA4B;AAC1C,KAAI,CAAC,MAAM,QAAQ,QACjB,OAAM,IAAI,MAAM,4EAA4E,EAAE,OAAO;AAEvG,QAAO,OACJ,KAAK,WAAmD;EACvD,KAAmB,MAAM;EACzB,OAAmB,MAAM,UAAU;EACnC,KAAmB,MAAM,QAAQ;EACjC,UAAmB,OAAO,MAAM,SAAS,KAAK,MAAM,SAAS;EAC7D,mBAAmB,OAAO,MAAM,SAAS,KAAK,MAAM,SAAS;EAC7D,QAAmB,MAAM,SAAS;EAClC,aAAmBA,cAAO,MAAM,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"duties.js","names":["toPerson"],"sources":["../../../src/SS12000/from/duties.ts"],"sourcesContent":["import { omit } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Duty } from '../types/duties';\nimport toPerson from './persons';\n\nexport default (duties: Duty[]) => {\n if (!Array.isArray(duties))\n throw new Error('(SS12000::From::Duties) Teacher input is not of array type', { cause: 'invalid_input' });\n\n const toDisplayName = (firstName?: string, lastName?: string) => {\n const first = firstName?.trim();\n const last = lastName?.trim();\n if (first && last) return `${ first } ${ last }`;\n return first || last || undefined;\n };\n\n return duties\n .map((duty): CoreTypes.MixedWithoutInternalId.Teacher => {\n const person = duty._embedded?.person ?? duty.person;\n const displayName = duty.displayName\n ?? toDisplayName(person?.givenName, person?.familyName)\n ?? person?.displayName;\n\n return ({\n ids: duty.id,\n displayName: displayName,\n signature: duty.signature,\n ...(duty.person || duty._embedded?.person) && {\n person: {\n type: 'Teacher',\n ...duty.person && { ids: duty.person.id },\n ...duty._embedded?.person && omit(toPerson([ duty._embedded.person ])[0], 'type')\n }\n }\n });\n });\n};\n"],"mappings":";;;;AAKA,sBAAgB,WAAmB;AACjC,KAAI,CAAC,MAAM,QAAQ,OAAO,CACxB,OAAM,IAAI,MAAM,8DAA8D,EAAE,OAAO,iBAAiB,CAAC;CAE3G,MAAM,iBAAiB,WAAoB,aAAsB;EAC/D,MAAM,QAAQ,WAAW,MAAM;EAC/B,MAAM,OAAO,UAAU,MAAM;AAC7B,MAAI,SAAS,KAAM,QAAO,GAAI,MAAO,GAAI;AACzC,SAAO,SAAS,QAAQ;;AAG1B,QAAO,OACJ,KAAK,SAAmD;EACvD,MAAM,SAAS,KAAK,WAAW,UAAU,KAAK;EAC9C,MAAM,cAAc,KAAK,eACpB,cAAc,QAAQ,WAAW,QAAQ,WAAW,IACpD,QAAQ;AAEb,SAAQ;GACN,KAAa,KAAK;GACL;GACb,WAAa,KAAK;GAClB,IAAI,KAAK,UAAU,KAAK,WAAW,WAAW,EAC5C,QAAQ;IACN,MAAM;IACN,GAAG,KAAK,UAAU,EAAE,KAAK,KAAK,OAAO,IAAI;IACzC,GAAG,KAAK,WAAW,UAAU,KAAKA,gBAAS,CAAE,KAAK,UAAU,OAAQ,CAAC,CAAC,IAAI,OAAO;IAClF,EACF;GACF;GACD"}
1
+ {"version":3,"file":"duties.js","names":["toPerson"],"sources":["../../../src/SS12000/from/duties.ts"],"sourcesContent":["import { omit } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Duty } from '../types/duties';\nimport toPerson from './persons';\n\nexport default (duties: Duty[]) => {\n if (!Array.isArray(duties))\n throw new Error('(SS12000::From::Duties) Teacher input is not of array type', { cause: 'invalid_input' });\n\n const toDisplayName = (firstName?: string, lastName?: string) => {\n const first = firstName?.trim();\n const last = lastName?.trim();\n if (first && last) return `${ first } ${ last }`;\n return first || last || undefined;\n };\n\n return duties\n .map((duty): CoreTypes.MixedWithoutInternalId.Teacher => {\n const person = duty._embedded?.person ?? duty.person;\n const displayName = duty.displayName\n ?? toDisplayName(person?.givenName, person?.familyName)\n ?? person?.displayName;\n\n return ({\n ids: duty.id,\n displayName: displayName,\n signature: duty.signature,\n ...(duty.person || duty._embedded?.person) && {\n person: {\n type: 'Teacher',\n ...duty.person && { ids: duty.person.id },\n ...duty._embedded?.person && omit(toPerson([ duty._embedded.person ])[0], 'type')\n }\n }\n });\n });\n};\n"],"mappings":";;;;AAKA,sBAAgB,WAAmB;AACjC,KAAI,CAAC,MAAM,QAAQ,QACjB,OAAM,IAAI,MAAM,8DAA8D,EAAE,OAAO;CAEzF,MAAM,iBAAiB,WAAoB,aAAsB;EAC/D,MAAM,QAAQ,WAAW;EACzB,MAAM,OAAO,UAAU;AACvB,MAAI,SAAS,KAAM,QAAO,GAAI,MAAO,GAAI;AACzC,SAAO,SAAS,QAAQ;;AAG1B,QAAO,OACJ,KAAK,SAAmD;EACvD,MAAM,SAAS,KAAK,WAAW,UAAU,KAAK;EAC9C,MAAM,cAAc,KAAK,eACpB,cAAc,QAAQ,WAAW,QAAQ,eACzC,QAAQ;AAEb,SAAQ;GACN,KAAa,KAAK;GACL;GACb,WAAa,KAAK;GAClB,IAAI,KAAK,UAAU,KAAK,WAAW,WAAW,EAC5C,QAAQ;IACN,MAAM;IACN,GAAG,KAAK,UAAU,EAAE,KAAK,KAAK,OAAO;IACrC,GAAG,KAAK,WAAW,UAAU,KAAKA,gBAAS,CAAE,KAAK,UAAU,SAAU,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"groups.js","names":[],"sources":["../../../src/SS12000/from/groups.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { Group } from '../types/groups';\n\nfunction _transformGroupMembers (\n members: Group['groupMemberships'],\n options?: Pick<CoreTypes.Deep.Division, 'start' | 'end'>\n) {\n return [\n ...new Set(\n members?.filter(member => {\n if (options?.end && member.startDate && !moment(member.startDate).isBefore(moment(options.end)))\n return false;\n if (options?.start && member.endDate && !moment(member.endDate).isAfter(moment(options.start)))\n return false;\n return true;\n })\n .map((member) => member.person.id)\n .filter(Boolean)\n )\n ];\n}\n\nexport default (\n groups: Group[],\n options?: Pick<CoreTypes.Deep.Division, 'start' | 'end'>\n) => {\n if (!Array.isArray(groups))\n throw new Error('(SS12000::From::Groups) Group input is not of array type', { cause: 'invalid_input' });\n\n return groups\n .map((group): CoreTypes.MixedWithoutInternalId.Group => ({\n ids: group.id,\n displayName: group.displayName,\n ...group.groupType == 'Klass' && { species: 'class' },\n ...group.groupMemberships && {\n members: _transformGroupMembers(group.groupMemberships, options)\n }\n }));\n};"],"mappings":";;;AAIA,SAAS,uBACP,SACA,SACA;AACA,QAAO,CACL,GAAG,IAAI,IACL,SAAS,QAAO,WAAU;AACxB,MAAI,SAAS,OAAO,OAAO,aAAa,CAAC,OAAO,OAAO,UAAU,CAAC,SAAS,OAAO,QAAQ,IAAI,CAAC,CAC7F,QAAO;AACT,MAAI,SAAS,SAAS,OAAO,WAAW,CAAC,OAAO,OAAO,QAAQ,CAAC,QAAQ,OAAO,QAAQ,MAAM,CAAC,CAC5F,QAAO;AACT,SAAO;GACP,CACC,KAAK,WAAW,OAAO,OAAO,GAAG,CACjC,OAAO,QAAQ,CACnB,CACF;;AAGH,sBACE,QACA,YACG;AACH,KAAI,CAAC,MAAM,QAAQ,OAAO,CACxB,OAAM,IAAI,MAAM,4DAA4D,EAAE,OAAO,iBAAiB,CAAC;AAEzG,QAAO,OACJ,KAAK,WAAmD;EACvD,KAAa,MAAM;EACnB,aAAa,MAAM;EACnB,GAAG,MAAM,aAAa,WAAW,EAAE,SAAS,SAAS;EACrD,GAAG,MAAM,oBAAoB,EAC3B,SAAS,uBAAuB,MAAM,kBAAkB,QAAQ,EACjE;EACF,EAAE"}
1
+ {"version":3,"file":"groups.js","names":[],"sources":["../../../src/SS12000/from/groups.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { Group } from '../types/groups';\n\nfunction _transformGroupMembers (\n members: Group['groupMemberships'],\n options?: Pick<CoreTypes.Deep.Division, 'start' | 'end'>\n) {\n return [\n ...new Set(\n members?.filter(member => {\n if (options?.end && member.startDate && !moment(member.startDate).isBefore(moment(options.end)))\n return false;\n if (options?.start && member.endDate && !moment(member.endDate).isAfter(moment(options.start)))\n return false;\n return true;\n })\n .map((member) => member.person.id)\n .filter(Boolean)\n )\n ];\n}\n\nexport default (\n groups: Group[],\n options?: Pick<CoreTypes.Deep.Division, 'start' | 'end'>\n) => {\n if (!Array.isArray(groups))\n throw new Error('(SS12000::From::Groups) Group input is not of array type', { cause: 'invalid_input' });\n\n return groups\n .map((group): CoreTypes.MixedWithoutInternalId.Group => ({\n ids: group.id,\n displayName: group.displayName,\n ...group.groupType == 'Klass' && { species: 'class' },\n ...group.groupMemberships && {\n members: _transformGroupMembers(group.groupMemberships, options)\n }\n }));\n};"],"mappings":";;;AAIA,SAAS,uBACP,SACA,SACA;AACA,QAAO,CACL,GAAG,IAAI,IACL,SAAS,QAAO,WAAU;AACxB,MAAI,SAAS,OAAO,OAAO,aAAa,CAAC,OAAO,OAAO,WAAW,SAAS,OAAO,QAAQ,MACxF,QAAO;AACT,MAAI,SAAS,SAAS,OAAO,WAAW,CAAC,OAAO,OAAO,SAAS,QAAQ,OAAO,QAAQ,QACrF,QAAO;AACT,SAAO;IAEN,KAAK,WAAW,OAAO,OAAO,IAC9B,OAAO;;AAKhB,sBACE,QACA,YACG;AACH,KAAI,CAAC,MAAM,QAAQ,QACjB,OAAM,IAAI,MAAM,4DAA4D,EAAE,OAAO;AAEvF,QAAO,OACJ,KAAK,WAAmD;EACvD,KAAa,MAAM;EACnB,aAAa,MAAM;EACnB,GAAG,MAAM,aAAa,WAAW,EAAE,SAAS;EAC5C,GAAG,MAAM,oBAAoB,EAC3B,SAAS,uBAAuB,MAAM,kBAAkB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_activities","_calendarEvents","_duties","_groups","_persons","_resources","_rooms","_syllabuses"],"sources":["../../../src/SS12000/from/index.ts"],"sourcesContent":["import _activities from './activities';\nimport _calendarEvents from './calendar-events';\nimport _duties from './duties';\nimport _groups from './groups';\nimport _persons from './persons';\nimport _resources from './resources';\nimport _rooms from './rooms';\nimport _syllabuses from './syllabuses';\n\nexport default {\n activities: _activities,\n calendarEvents: _calendarEvents,\n duties: _duties,\n groups: _groups,\n persons: _persons,\n resources: _resources,\n rooms: _rooms,\n syllabuses: _syllabuses,\n};"],"mappings":";;;;;;;;;;AASA,mBAAe;CACb,YAAgBA;CAChB,gBAAgBC;CAChB,QAAgBC;CAChB,QAAgBC;CAChB,SAAgBC;CAChB,WAAgBC;CAChB,OAAgBC;CAChB,YAAgBC;CACjB"}
1
+ {"version":3,"file":"index.js","names":["_activities","_calendarEvents","_duties","_groups","_persons","_resources","_rooms","_syllabuses"],"sources":["../../../src/SS12000/from/index.ts"],"sourcesContent":["import _activities from './activities';\nimport _calendarEvents from './calendar-events';\nimport _duties from './duties';\nimport _groups from './groups';\nimport _persons from './persons';\nimport _resources from './resources';\nimport _rooms from './rooms';\nimport _syllabuses from './syllabuses';\n\nexport default {\n activities: _activities,\n calendarEvents: _calendarEvents,\n duties: _duties,\n groups: _groups,\n persons: _persons,\n resources: _resources,\n rooms: _rooms,\n syllabuses: _syllabuses,\n};"],"mappings":";;;;;;;;;;AASA,mBAAe;CACb,YAAgBA;CAChB,gBAAgBC;CAChB,QAAgBC;CAChB,QAAgBC;CAChB,SAAgBC;CAChB,WAAgBC;CAChB,OAAgBC;CAChB,YAAgBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"persons.js","names":["SexMap: Record<NonNullable<Person['sex']>, CoreTypes.Deep.Person['sex']>","TypeMap: Record<\n NonNullable<\n Person['phoneNumbers']\n >[0]['type'],\n NonNullable<\n CoreTypes.Deep.Person['phoneNumbers']\n >[0]['type']\n>"],"sources":["../../../src/SS12000/from/persons.ts"],"sourcesContent":["import { get, omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Person } from '../types/persons';\n\nconst SexMap: Record<NonNullable<Person['sex']>, CoreTypes.Deep.Person['sex']> = { Man: 'Man', Kvinna: 'Woman', Okänt: undefined };\nconst TypeMap: Record<\n NonNullable<\n Person['phoneNumbers']\n >[0]['type'],\n NonNullable<\n CoreTypes.Deep.Person['phoneNumbers']\n >[0]['type']\n> = {\n 'Privat': 'private',\n 'Hem': 'private',\n 'Arbete övrigt': 'organization',\n 'Arbete': 'organization',\n 'Skola elev': 'organization',\n 'Skola personal': 'organization'\n};\n\nexport default (groups: Person[]) => {\n if (!Array.isArray(groups))\n throw new Error('(SS12000::From::Person) Person input is not of array type', { cause: 'invalid_input' });\n\n return groups\n .map((person): CoreTypes.MixedWithoutInternalId.Person => ({\n ids: person.id,\n displayName: person.displayName,\n type: 'Student',\n ...omitBy({\n sex: person.sex ? get(SexMap, person.sex, undefined) : undefined,\n displayName: person.displayName,\n firstName: person.givenName,\n lastName: person.familyName,\n SSN: person.civicNo,\n emails: person.emails?.map(({ type, ...arg }) => ({ type: get(TypeMap, type, undefined), ...arg })),\n phoneNumbers: person.phoneNumbers?.map(({ type, ...arg }) => ({ type: get(TypeMap, type, undefined), ...arg })),\n }, x => x == null)\n }));\n};"],"mappings":";;;AAIA,MAAMA,SAA2E;CAAE,KAAK;CAAO,QAAQ;CAAS,OAAO;CAAW;AAClI,MAAMC,UAOF;CACF,UAAkB;CAClB,OAAkB;CAClB,iBAAkB;CAClB,UAAkB;CAClB,cAAkB;CAClB,kBAAkB;CACnB;AAED,uBAAgB,WAAqB;AACnC,KAAI,CAAC,MAAM,QAAQ,OAAO,CACxB,OAAM,IAAI,MAAM,6DAA6D,EAAE,OAAO,iBAAiB,CAAC;AAE1G,QAAO,OACJ,KAAK,YAAqD;EACzD,KAAa,OAAO;EACpB,aAAa,OAAO;EACpB,MAAa;EACb,GAAG,OAAO;GACR,KAAc,OAAO,MAAM,IAAI,QAAQ,OAAO,KAAK,OAAU,GAAG;GAChE,aAAc,OAAO;GACrB,WAAc,OAAO;GACrB,UAAc,OAAO;GACrB,KAAc,OAAO;GACrB,QAAc,OAAO,QAAQ,KAAK,EAAE,KAAM,GAAG,WAAW;IAAE,MAAM,IAAI,SAAS,MAAM,OAAU;IAAE,GAAG;IAAK,EAAE;GACzG,cAAc,OAAO,cAAc,KAAK,EAAE,KAAM,GAAG,WAAW;IAAE,MAAM,IAAI,SAAS,MAAM,OAAU;IAAE,GAAG;IAAK,EAAE;GAChH,GAAE,MAAK,KAAK,KAAK;EACnB,EAAE"}
1
+ {"version":3,"file":"persons.js","names":["SexMap: Record<NonNullable<Person['sex']>, CoreTypes.Deep.Person['sex']>","TypeMap: Record<\n NonNullable<\n Person['phoneNumbers']\n >[0]['type'],\n NonNullable<\n CoreTypes.Deep.Person['phoneNumbers']\n >[0]['type']\n>"],"sources":["../../../src/SS12000/from/persons.ts"],"sourcesContent":["import { get, omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Person } from '../types/persons';\n\nconst SexMap: Record<NonNullable<Person['sex']>, CoreTypes.Deep.Person['sex']> = { Man: 'Man', Kvinna: 'Woman', Okänt: undefined };\nconst TypeMap: Record<\n NonNullable<\n Person['phoneNumbers']\n >[0]['type'],\n NonNullable<\n CoreTypes.Deep.Person['phoneNumbers']\n >[0]['type']\n> = {\n 'Privat': 'private',\n 'Hem': 'private',\n 'Arbete övrigt': 'organization',\n 'Arbete': 'organization',\n 'Skola elev': 'organization',\n 'Skola personal': 'organization'\n};\n\nexport default (groups: Person[]) => {\n if (!Array.isArray(groups))\n throw new Error('(SS12000::From::Person) Person input is not of array type', { cause: 'invalid_input' });\n\n return groups\n .map((person): CoreTypes.MixedWithoutInternalId.Person => ({\n ids: person.id,\n displayName: person.displayName,\n type: 'Student',\n ...omitBy({\n sex: person.sex ? get(SexMap, person.sex, undefined) : undefined,\n displayName: person.displayName,\n firstName: person.givenName,\n lastName: person.familyName,\n SSN: person.civicNo,\n emails: person.emails?.map(({ type, ...arg }) => ({ type: get(TypeMap, type, undefined), ...arg })),\n phoneNumbers: person.phoneNumbers?.map(({ type, ...arg }) => ({ type: get(TypeMap, type, undefined), ...arg })),\n }, x => x == null)\n }));\n};"],"mappings":";;;AAIA,MAAMA,SAA2E;CAAE,KAAK;CAAO,QAAQ;CAAS,OAAO;;AACvH,MAAMC,UAOF;CACF,UAAkB;CAClB,OAAkB;CAClB,iBAAkB;CAClB,UAAkB;CAClB,cAAkB;CAClB,kBAAkB;;AAGpB,uBAAgB,WAAqB;AACnC,KAAI,CAAC,MAAM,QAAQ,QACjB,OAAM,IAAI,MAAM,6DAA6D,EAAE,OAAO;AAExF,QAAO,OACJ,KAAK,YAAqD;EACzD,KAAa,OAAO;EACpB,aAAa,OAAO;EACpB,MAAa;EACb,GAAG,OAAO;GACR,KAAc,OAAO,MAAM,IAAI,QAAQ,OAAO,KAAK,UAAa;GAChE,aAAc,OAAO;GACrB,WAAc,OAAO;GACrB,UAAc,OAAO;GACrB,KAAc,OAAO;GACrB,QAAc,OAAO,QAAQ,KAAK,EAAE,KAAM,GAAG,WAAW;IAAE,MAAM,IAAI,SAAS,MAAM;IAAY,GAAG;;GAClG,cAAc,OAAO,cAAc,KAAK,EAAE,KAAM,GAAG,WAAW;IAAE,MAAM,IAAI,SAAS,MAAM;IAAY,GAAG;;MACvG,MAAK,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"resources.js","names":[],"sources":["../../../src/SS12000/from/resources.ts"],"sourcesContent":["\nimport type { Resource } from '../types/resources';\n\nexport default (resources: Resource[]) => {\n if (!Array.isArray(resources))\n throw new Error('(SS12000::From::Resources) Resources input is not of array type', { cause: 'invalid_input' });\n\n return resources.map((resource) => ({\n ids: resource.id,\n }));\n};\n"],"mappings":";AAGA,yBAAgB,cAA0B;AACxC,KAAI,CAAC,MAAM,QAAQ,UAAU,CAC3B,OAAM,IAAI,MAAM,mEAAmE,EAAE,OAAO,iBAAiB,CAAC;AAEhH,QAAO,UAAU,KAAK,cAAc,EAClC,KAAK,SAAS,IACf,EAAE"}
1
+ {"version":3,"file":"resources.js","names":[],"sources":["../../../src/SS12000/from/resources.ts"],"sourcesContent":["\nimport type { Resource } from '../types/resources';\n\nexport default (resources: Resource[]) => {\n if (!Array.isArray(resources))\n throw new Error('(SS12000::From::Resources) Resources input is not of array type', { cause: 'invalid_input' });\n\n return resources.map((resource) => ({\n ids: resource.id,\n }));\n};\n"],"mappings":";AAGA,yBAAgB,cAA0B;AACxC,KAAI,CAAC,MAAM,QAAQ,WACjB,OAAM,IAAI,MAAM,mEAAmE,EAAE,OAAO;AAE9F,QAAO,UAAU,KAAK,cAAc,EAClC,KAAK,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"rooms.js","names":[],"sources":["../../../src/SS12000/from/rooms.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Room } from '../types/rooms';\n\nexport default (locations: Room[]) => {\n if (!Array.isArray(locations))\n throw new Error('(SS12000::From::Room) Room input is not of array type', { cause: 'invalid_input' });\n\n return locations\n .map((location): CoreTypes.MixedWithoutInternalId.Location => ({\n ids: location.id,\n ...omitBy({\n displayName: location.displayName,\n seats: location.seats,\n tags: location.tags,\n }, x => x == null),\n }));\n};"],"mappings":";;;AAIA,qBAAgB,cAAsB;AACpC,KAAI,CAAC,MAAM,QAAQ,UAAU,CAC3B,OAAM,IAAI,MAAM,yDAAyD,EAAE,OAAO,iBAAiB,CAAC;AAEtG,QAAO,UACJ,KAAK,cAAyD;EAC7D,KAAK,SAAS;EACd,GAAG,OAAO;GACR,aAAa,SAAS;GACtB,OAAa,SAAS;GACtB,MAAa,SAAS;GACvB,GAAE,MAAK,KAAK,KAAK;EACnB,EAAE"}
1
+ {"version":3,"file":"rooms.js","names":[],"sources":["../../../src/SS12000/from/rooms.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Room } from '../types/rooms';\n\nexport default (locations: Room[]) => {\n if (!Array.isArray(locations))\n throw new Error('(SS12000::From::Room) Room input is not of array type', { cause: 'invalid_input' });\n\n return locations\n .map((location): CoreTypes.MixedWithoutInternalId.Location => ({\n ids: location.id,\n ...omitBy({\n displayName: location.displayName,\n seats: location.seats,\n tags: location.tags,\n }, x => x == null),\n }));\n};"],"mappings":";;;AAIA,qBAAgB,cAAsB;AACpC,KAAI,CAAC,MAAM,QAAQ,WACjB,OAAM,IAAI,MAAM,yDAAyD,EAAE,OAAO;AAEpF,QAAO,UACJ,KAAK,cAAyD;EAC7D,KAAK,SAAS;EACd,GAAG,OAAO;GACR,aAAa,SAAS;GACtB,OAAa,SAAS;GACtB,MAAa,SAAS;MACrB,MAAK,KAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"syllabuses.js","names":[],"sources":["../../../src/SS12000/from/syllabuses.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Syllabus } from '../types/syllabus';\n\nexport default (syllabuses: Syllabus[]) => {\n if (!Array.isArray(syllabuses))\n throw new Error('(SS12000::From::Syllabus) Syllabus input is not of array type', { cause: 'invalid_input' });\n\n return syllabuses\n .map((syllabus): CoreTypes.MixedWithoutInternalId.Syllabus => ({\n ids: syllabus.id,\n schoolType: syllabus.schoolType!,\n official: syllabus.official!,\n subjectName: syllabus.subjectName!,\n ...omitBy({\n subjectDesignation: syllabus.subjectDesignation,\n subjectCode: syllabus.subjectCode,\n curriculum: syllabus.curriculum,\n }, x => x == null),\n }));\n};"],"mappings":";;;AAIA,0BAAgB,eAA2B;AACzC,KAAI,CAAC,MAAM,QAAQ,WAAW,CAC5B,OAAM,IAAI,MAAM,iEAAiE,EAAE,OAAO,iBAAiB,CAAC;AAE9G,QAAO,WACJ,KAAK,cAAyD;EAC7D,KAAa,SAAS;EACtB,YAAa,SAAS;EACtB,UAAa,SAAS;EACtB,aAAa,SAAS;EACtB,GAAG,OAAO;GACR,oBAAoB,SAAS;GAC7B,aAAoB,SAAS;GAC7B,YAAoB,SAAS;GAC9B,GAAE,MAAK,KAAK,KAAK;EACnB,EAAE"}
1
+ {"version":3,"file":"syllabuses.js","names":[],"sources":["../../../src/SS12000/from/syllabuses.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { CoreTypes } from '../../core';\nimport type { Syllabus } from '../types/syllabus';\n\nexport default (syllabuses: Syllabus[]) => {\n if (!Array.isArray(syllabuses))\n throw new Error('(SS12000::From::Syllabus) Syllabus input is not of array type', { cause: 'invalid_input' });\n\n return syllabuses\n .map((syllabus): CoreTypes.MixedWithoutInternalId.Syllabus => ({\n ids: syllabus.id,\n schoolType: syllabus.schoolType!,\n official: syllabus.official!,\n subjectName: syllabus.subjectName!,\n ...omitBy({\n subjectDesignation: syllabus.subjectDesignation,\n subjectCode: syllabus.subjectCode,\n curriculum: syllabus.curriculum,\n }, x => x == null),\n }));\n};"],"mappings":";;;AAIA,0BAAgB,eAA2B;AACzC,KAAI,CAAC,MAAM,QAAQ,YACjB,OAAM,IAAI,MAAM,iEAAiE,EAAE,OAAO;AAE5F,QAAO,WACJ,KAAK,cAAyD;EAC7D,KAAa,SAAS;EACtB,YAAa,SAAS;EACtB,UAAa,SAAS;EACtB,aAAa,SAAS;EACtB,GAAG,OAAO;GACR,oBAAoB,SAAS;GAC7B,aAAoB,SAAS;GAC7B,YAAoB,SAAS;MAC5B,MAAK,KAAK"}