@royalschedule/maps 4.0.30 → 4.0.32

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 +0 -2
  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 +4 -4
  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 +181 -1
  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 +0 -1
  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 +10 -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
@@ -32,19 +32,23 @@ const parseConfig = {
32
32
  skipEmptyLines: false
33
33
  };
34
34
  function extractTables(input, warnings) {
35
- const tables = input.split("[Tables]").at(1);
35
+ const split = input.split("[Tables]");
36
+ const tables = split.at(1);
36
37
  if (!tables) throw new Error("Unable to extract tables from input");
37
- return [...tables.trim().matchAll(/([^\r\n]+)(?:\r\n|\r|\n)\[Rows\](?:\r\n|\r|\n)((?:[^\r\n].+(?:(?:\r\n|\r|\n)|$))*)/gm)].map((x) => {
38
+ const regex = /([^\r\n]+)(?:\r\n|\r|\n)\[Rows\](?:\r\n|\r|\n)((?:[^\r\n].+(?:(?:\r\n|\r|\n)|$))*)/gm;
39
+ const matches = [...tables.trim().matchAll(regex)];
40
+ return matches.map((x) => {
38
41
  const tableName = x.at(1)?.trim().match(/(.*?)(?:\s*\(\d+\))$/m)?.at(1);
39
42
  if (!tableName) return;
40
43
  const tableContent = x.at(2)?.trim();
41
44
  if (!tableContent) return;
45
+ const parsed = Papa.parse(tableContent, {
46
+ ...parseConfig,
47
+ transformHeader
48
+ });
42
49
  return {
43
50
  tableName,
44
- parsed: Papa.parse(tableContent, {
45
- ...parseConfig,
46
- transformHeader
47
- }).data
51
+ parsed: parsed.data
48
52
  };
49
53
  }).filter((x) => x != null).reduce((acc, { tableName, parsed }) => {
50
54
  acc[tableName] = parsed;
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["warnings: Warning[]","settings: OutTypes.settings","x","uuidv4","teachers","groups","getDate","newCourse: OutTypes.course"],"sources":["../../../../src/Skola24/txt/from/schedules.ts"],"sourcesContent":["import Papa from 'papaparse';\nimport { v4 as uuidv4 } from 'uuid'; // as we cannot use crypto's randomUUID in browser\nimport moment from 'moment';\nimport getDate from '../../../common/get-date';\nimport type { CoreTypes } from '../../../core';\nimport type { Data, Options, Types as Skola24Types, Warning } from '../types';\nimport { extractId } from './util';\nimport { fromWeekNumberRange, parsePeriod } from './period';\nimport { parseCalendarExceptions } from './calendar-exceptions';\nimport { extractStartAndEnd } from './division';\n\n\nconst daysToIndex = {\n 'Måndag': 0,\n 'Tisdag': 1,\n 'Onsdag': 2,\n 'Torsdag': 3,\n 'Fredag': 4,\n 'Lördag': 5,\n 'Söndag': 6,\n\n // and if ÅÄÖ is loaded correctly\n 'M�ndag': 0,\n 'L�rdag': 5,\n 'S�ndag': 6,\n} as Record<string, number | undefined>;\n\n\nfunction transformHeader (header: string) {\n return header.split(/[^a-zA-Z]+/g)[0];\n}\nconst parseConfig = {\n quotes: false, //or array of booleans\n quoteChar: '\"',\n escapeChar: '\"',\n delimiter: '\\t',\n header: true,\n // newline: \"\\r\\n\",\n skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.\n} as Papa.ParseConfig;\n\n\nfunction extractTables (input: string, warnings: Warning[]) {\n // split at [Tables] to get meta section and table section\n const split = input.split('[Tables]');\n const tables = split.at(1);\n if (!tables) throw new Error('Unable to extract tables from input');\n\n ////\n //// Capture the TABLE NAME and the TABLE CONTENT using regex\n ////\n //// TABLE NAME\n //// [Rows]\n //// TABLE CONTENT\n ////\n const regex = /([^\\r\\n]+)(?:\\r\\n|\\r|\\n)\\[Rows\\](?:\\r\\n|\\r|\\n)((?:[^\\r\\n].+(?:(?:\\r\\n|\\r|\\n)|$))*)/gm;\n const matches = [...tables.trim().matchAll(regex)];\n\n return matches\n .map(x => {\n // extract only the true table name \"<table name> (<number>)\", i.e., ignore the brackets and the preceding space\n const tableName = x.at(1)\n ?.trim()\n .match(/(.*?)(?:\\s*\\(\\d+\\))$/m)\n ?.at(1);\n if (!tableName) return;\n\n const tableContent = x.at(2)?.trim();\n if (!tableContent) return;\n const parsed = Papa.parse(tableContent, { ...parseConfig, transformHeader });\n return {\n tableName: tableName as keyof Data,\n parsed: parsed.data\n };\n })\n .filter((x): x is NonNullable<typeof x> => x != null)\n .reduce<Data>((acc, { tableName, parsed }) => {\n acc[tableName] = parsed;\n return acc;\n }, {} as Data);\n}\n\n\nfunction parseColor (colorValue: string | undefined) {\n if (colorValue == null) return;\n\n const integerValue = parseInt(colorValue);\n if (isNaN(integerValue)) return;\n\n // convert to decimal string\n const hex = integerValue.toString(16);\n\n // ensure its a valid color\n if (!/^(?:[0-9a-fA-F]{3}){1,2}$/.test(hex)) return;\n return `#${ hex }`;\n}\n\n\nexport namespace OutTypes {\n export type settings = CoreTypes.SerializedWithOptionalId.Settings;\n export type teacher = CoreTypes.SerializedWithOptionalId.Teacher;\n export type person = CoreTypes.SerializedWithOptionalId.Person;\n export type group = CoreTypes.SerializedWithOptionalId.Group;\n export type course = CoreTypes.SerializedWithOptionalId.Course;\n export type location = CoreTypes.SerializedWithOptionalId.Location;\n export type event = CoreTypes.SerializedWithOptionalId.Event;\n export type period = CoreTypes.SerializedWithOptionalId.Period;\n}\n\ntype Out = {\n settings: OutTypes.settings;\n periods: OutTypes.period [];\n teachers: OutTypes.teacher [];\n persons: OutTypes.person [];\n groups: OutTypes.group [];\n locations: OutTypes.location[];\n courses: OutTypes.course [];\n events: OutTypes.event [];\n meta?: {\n warnings: Warning[]\n };\n};\n\n\nexport const schedules = (\n input: string,\n options: Options = {}\n): Out => {\n const warnings: Warning[] = [];\n\n const tables = extractTables(input, warnings);\n\n const _scheduleRange = extractStartAndEnd(input); // need whole input file\n if (!_scheduleRange) throw new Error('Unable to extract schedule range');\n\n const scheduleStart = moment.utc(_scheduleRange.start);\n const startYear = scheduleStart.year();\n\n const settings: OutTypes.settings = {\n discretization: 5,\n numDays: 5,\n dayStart: '8:00',\n potentialCenter: '12:00',\n dayEnd: '17:00',\n calendarExceptions: parseCalendarExceptions(tables.PeriodGeneral?.at(0), startYear, warnings)\n };\n\n\n // Map to core structure\n const teachers = tables.Teacher\n ?.map((x): OutTypes.teacher => ({\n ids: extractId(x.GUID),\n signature: x.Teacher,\n displayName: `${x.FirstName} ${x.LastName}`,\n ...x.Category && {\n tags: [\n {\n type: 'category',\n value: x.Category\n }\n ]\n },\n person: `teacher.${ extractId(x.GUID) }`\n }));\n const teacherPersons = tables.Teacher\n // Filter out where either of firstname, lastname i missing, else it gives invalid persons\n ?.filter(x => x.FirstName && x.LastName)\n ?.map((x): OutTypes.person => ({\n ids: `teacher.${ extractId(x.GUID) }`,\n firstName: x.FirstName,\n lastName: x.LastName,\n ...x.PersonalCode && {\n SSN: {\n value: x.PersonalCode,\n }\n },\n ...x.EMail && {\n emails: [{\n value: x.EMail,\n type: 'organization'\n }]\n },\n ...x.Phone && {\n phoneNumbers: [\n {\n value: x.Phone,\n type: 'organization'\n }\n ]\n }\n }));\n\n const studentMap = new Map<string, string>();\n // create map of student SSN to student GUID\n tables.Student?.forEach(x => {\n const id = extractId(x.GUID);\n if (id) studentMap.set(x.Student, id);\n });\n\n const students = tables.Student?.map((x): OutTypes.person => ({\n ids: extractId(x.GUID),\n firstName: x.FirstName,\n lastName: x.LastName,\n type: 'Student',\n ...x.Student && {\n SSN: {\n value: x.Student,\n }\n },\n ...x.EMail && {\n emails: [{\n value: x.EMail,\n type: 'organization'\n }]\n }\n }));\n\n const groups = tables.Group?.map((x): OutTypes.group => ({\n ids: extractId(x.GUID),\n displayName: x.Group,\n ...(x.Class == '1') && { species: 'class' },\n members: x.Student?.split(',').map(x => studentMap.get(x)).filter(x => x != null) ?? []\n }));\n\n const periodMap = new Map<string, string>();\n const periodsFromWeekRanges = new Set<string>();\n if (tables.Period) {\n tables.Period.forEach(period => {\n const id = extractId(period.GUID);\n if (id) periodMap.set(period.Period, id);\n });\n\n // create additional periods corresponding to the lessons' week/actual weeks\n const _createPeriodsFrom = options.createPeriodsFrom;\n if (_createPeriodsFrom) {\n tables.Lesson?.forEach(x => {\n const key = x[_createPeriodsFrom];\n if (key) periodsFromWeekRanges.add(key);\n });\n periodsFromWeekRanges.forEach(x => periodMap.set(x, uuidv4()));\n }\n }\n\n const teacherMap = new Map<string, string>();\n if (tables.Teacher) {\n tables.Teacher.forEach(teacher => {\n const id = extractId(teacher.GUID);\n if (id) teacherMap.set(teacher.Teacher, id);\n });\n }\n\n const groupMap = new Map<string, string>();\n if (tables.Group) {\n tables.Group.forEach(group => {\n const id = extractId(group.GUID);\n if (id) groupMap.set(group.Group, id);\n });\n }\n\n const locationMap = new Map<string, string>();\n if (tables.Room) {\n tables.Room.forEach(room => {\n const id = extractId(room.GUID);\n if (id) locationMap.set(room.Room, id);\n });\n }\n\n // subject contains BackgroundColor(decimal) and FullText\n const subjectMap = new Map<string, Skola24Types.subject>();\n if (tables.Subject) {\n tables.Subject.forEach(subject => {\n subjectMap.set(subject.Subject, subject);\n });\n }\n\n // Course can contain FullText and Subject\n const parentCourseMap = new Map<string, Skola24Types.course>();\n if (tables.Course) {\n tables.Course.forEach(course => {\n parentCourseMap.set(course.Course, course);\n });\n }\n\n const courseMap = new Map<string, string | undefined>();\n const courses = tables.TA?.map((x): OutTypes.course => {\n const color = parseColor(subjectMap.get(x.Subject)?.BackgroundColor);\n\n // Course name is most specific (eg Administration 1), then subject name (Administration), then course code (eg ADMADM01), then subject code (eg ADM)\n const displayName = parentCourseMap.get(x.Course)?.FullText || subjectMap.get(x.Subject)?.FullText || x.Course || x.Subject;\n\n const teachers = (x.Teacher ?? [])\n .split(',')\n .map(x => teacherMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x)\n .map(to => ({ to }));\n const groups = (x.Group ?? [])\n .split(',')\n .map(x => groupMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x)\n .map(to => ({ to }));\n\n return {\n ids: x.GUID ? extractId(x.GUID) : uuidv4(),\n displayName: displayName,\n color: color,\n subject: x.Subject || parentCourseMap.get(x.Course)?.Subject,\n teachers: teachers,\n groups: groups,\n plannedDuration: x.TotalHours ? `${x.TotalHours} hrs` : (x.Weektime ? `${x.Weektime} min/week` : undefined),\n ...x.Period && { period: periodMap.get(x.Period) },\n } satisfies OutTypes.course;\n }) ?? [];\n\n tables.TA?.forEach(x => {\n courseMap.set(`${x.Subject}.${x.Teacher}.${x.Group}`, x.GUID ? extractId(x.GUID) : undefined);\n });\n\n const locations = tables.Room?.map((x): OutTypes.location => ({\n ids: extractId(x.GUID),\n displayName: x.Room,\n maximumCapacity: x.SeatingCapacity ? parseInt(x.SeatingCapacity) : undefined,\n ...x.Category?.length && {\n tags: [\n {\n type: 'category',\n value: x.Category\n }\n ]\n }\n }));\n\n let lessonMissingCourseWarningsCount = 0;\n\n const events = tables.Lesson\n ?.filter(x => !isNaN(parseInt(x.Length)))\n .map(x => {\n\n const position = (() => {\n const dayIndex = daysToIndex[x.DayOfWeek];\n\n if (dayIndex == null) {\n warnings.push({ code: 'lesson.invalid_day', context: x } satisfies Warning);\n return;\n }\n\n return {\n start: getDate(dayIndex, x.Starttime),\n end: getDate(dayIndex, x.Starttime).add(x.Length, 'minutes'),\n };\n })();\n\n const periodName = options.createPeriodsFrom ? x[options.createPeriodsFrom] : x.Period;\n const periodId = periodMap.get(periodName);\n\n const courseKey = `${x.Subject}.${x.Teacher}.${x.Group}`;\n let courseId = courseMap.get(courseKey);\n\n const inLocations = (x.Room ?? [])\n .split(',')\n .map(x => locationMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x);\n\n // if there is a connected course use its display name\n let displayName = courseId\n ? undefined\n : parentCourseMap.get(x.Course)?.FullText || subjectMap.get(x.Subject)?.FullText || x.Course || x.Subject;\n\n // if there is a connected course use its teachers\n const teachers = courseId\n ? undefined\n : x.Teacher\n ?.split(',')\n .map(x => teacherMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x)\n .map(to => ({ to }));\n\n // if there is a connected course use its groups\n const groups = courseId\n ? undefined\n : x.Group\n ?.split(',')\n .map(x => groupMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x)\n .map(to => ({ to }));\n\n const duration = x.Length ? parseInt(x.Length) : undefined;\n\n // If no courseId found, we handle it according to options.includeEventsMissingCourse\n if (!courseId && options.includeEventsMissingCourse) {\n // Create a new course for this event\n courseId = uuidv4();\n const subject = subjectMap.get(x.Subject);\n const subjectName = subject?.FullText || x.Subject;\n displayName = displayName || subject?.FullText || x.Subject;\n const newCourse: OutTypes.course = {\n ids: courseId,\n displayName: displayName,\n subject: subjectName,\n teachers: teachers,\n groups: groups,\n };\n courses?.push(newCourse);\n } else if (!courseId) {\n lessonMissingCourseWarningsCount += 1;\n return null; // will be filtered out later\n }\n\n return {\n ids: extractId(x.GUID),\n displayName: displayName,\n ...position,\n duration: duration,\n preferredDuration: duration ?? 0,\n course: courseId,\n period: periodId,\n inLocations,\n ...(!options.includeEventsMissingCourse ? { teachers, groups } : undefined),\n } satisfies OutTypes.event;\n }).filter((x): x is NonNullable<typeof x> => x != null);\n\n const periods = tables.Period\n ?.map(x => parsePeriod(x, scheduleStart, warnings))\n .filter(x => x.ranges.length > 0);\n\n periodsFromWeekRanges.forEach(x => {\n const ids = periodMap.get(x);\n if (!ids) {\n throw new Error(`Unable to find period for ${x}`);\n return;\n }\n periods?.push(fromWeekNumberRange(ids, x, scheduleStart));\n });\n\n if (lessonMissingCourseWarningsCount > 0 && !options.includeEventsMissingCourse) {\n warnings.unshift({\n code: 'ignoring_lessons_missing_course',\n context: { count: lessonMissingCourseWarningsCount }\n } satisfies Warning);\n }\n\n return {\n settings,\n periods: periods ?? [],\n teachers: teachers ?? [],\n persons: (students ?? []).concat(teacherPersons ?? []),\n groups: groups ?? [],\n locations: locations ?? [],\n courses: courses ?? [],\n events: events ?? [],\n\n meta: { warnings }\n } satisfies Out;\n};"],"mappings":";;;;;;;;;;AAYA,MAAM,cAAc;CAClB,UAAW;CACX,UAAW;CACX,UAAW;CACX,WAAW;CACX,UAAW;CACX,UAAW;CACX,UAAW;CAGX,UAAU;CACV,UAAU;CACV,UAAU;CACX;AAGD,SAAS,gBAAiB,QAAgB;AACxC,QAAO,OAAO,MAAM,cAAc,CAAC;;AAErC,MAAM,cAAc;CAClB,QAAgB;CAChB,WAAgB;CAChB,YAAgB;CAChB,WAAgB;CAChB,QAAgB;CAEhB,gBAAgB;CACjB;AAGD,SAAS,cAAe,OAAe,UAAqB;CAG1D,MAAM,SADQ,MAAM,MAAM,WAAW,CAChB,GAAG,EAAE;AAC1B,KAAI,CAAC,OAAQ,OAAM,IAAI,MAAM,sCAAsC;AAYnE,QAFgB,CAAC,GAAG,OAAO,MA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1B,UAAY,YAAa,EAAE,EAAE,OAAO,kBAAkB,EAAE,CAAC;EACzD,QAAW,UAAa,EAAE;EAC1B,WAAW,aAAa,EAAE;EAC1B,SAAW,WAAa,EAAE;EAC1B,QAAW,UAAa,EAAE;EAE1B,MAAM,EAAE,UAAU;EACnB"}
1
+ {"version":3,"file":"schedules.js","names":["warnings: Warning[]","settings: OutTypes.settings","x","uuidv4","teachers","groups","getDate","newCourse: OutTypes.course"],"sources":["../../../../src/Skola24/txt/from/schedules.ts"],"sourcesContent":["import Papa from 'papaparse';\nimport { v4 as uuidv4 } from 'uuid'; // as we cannot use crypto's randomUUID in browser\nimport moment from 'moment';\nimport getDate from '../../../common/get-date';\nimport type { CoreTypes } from '../../../core';\nimport type { Data, Options, Types as Skola24Types, Warning } from '../types';\nimport { extractId } from './util';\nimport { fromWeekNumberRange, parsePeriod } from './period';\nimport { parseCalendarExceptions } from './calendar-exceptions';\nimport { extractStartAndEnd } from './division';\n\n\nconst daysToIndex = {\n 'Måndag': 0,\n 'Tisdag': 1,\n 'Onsdag': 2,\n 'Torsdag': 3,\n 'Fredag': 4,\n 'Lördag': 5,\n 'Söndag': 6,\n\n // and if ÅÄÖ is loaded correctly\n 'M�ndag': 0,\n 'L�rdag': 5,\n 'S�ndag': 6,\n} as Record<string, number | undefined>;\n\n\nfunction transformHeader (header: string) {\n return header.split(/[^a-zA-Z]+/g)[0];\n}\nconst parseConfig = {\n quotes: false, //or array of booleans\n quoteChar: '\"',\n escapeChar: '\"',\n delimiter: '\\t',\n header: true,\n // newline: \"\\r\\n\",\n skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.\n} as Papa.ParseConfig;\n\n\nfunction extractTables (input: string, warnings: Warning[]) {\n // split at [Tables] to get meta section and table section\n const split = input.split('[Tables]');\n const tables = split.at(1);\n if (!tables) throw new Error('Unable to extract tables from input');\n\n ////\n //// Capture the TABLE NAME and the TABLE CONTENT using regex\n ////\n //// TABLE NAME\n //// [Rows]\n //// TABLE CONTENT\n ////\n const regex = /([^\\r\\n]+)(?:\\r\\n|\\r|\\n)\\[Rows\\](?:\\r\\n|\\r|\\n)((?:[^\\r\\n].+(?:(?:\\r\\n|\\r|\\n)|$))*)/gm;\n const matches = [...tables.trim().matchAll(regex)];\n\n return matches\n .map(x => {\n // extract only the true table name \"<table name> (<number>)\", i.e., ignore the brackets and the preceding space\n const tableName = x.at(1)\n ?.trim()\n .match(/(.*?)(?:\\s*\\(\\d+\\))$/m)\n ?.at(1);\n if (!tableName) return;\n\n const tableContent = x.at(2)?.trim();\n if (!tableContent) return;\n const parsed = Papa.parse(tableContent, { ...parseConfig, transformHeader });\n return {\n tableName: tableName as keyof Data,\n parsed: parsed.data\n };\n })\n .filter((x): x is NonNullable<typeof x> => x != null)\n .reduce<Data>((acc, { tableName, parsed }) => {\n acc[tableName] = parsed;\n return acc;\n }, {} as Data);\n}\n\n\nfunction parseColor (colorValue: string | undefined) {\n if (colorValue == null) return;\n\n const integerValue = parseInt(colorValue);\n if (isNaN(integerValue)) return;\n\n // convert to decimal string\n const hex = integerValue.toString(16);\n\n // ensure its a valid color\n if (!/^(?:[0-9a-fA-F]{3}){1,2}$/.test(hex)) return;\n return `#${ hex }`;\n}\n\n\nexport namespace OutTypes {\n export type settings = CoreTypes.SerializedWithOptionalId.Settings;\n export type teacher = CoreTypes.SerializedWithOptionalId.Teacher;\n export type person = CoreTypes.SerializedWithOptionalId.Person;\n export type group = CoreTypes.SerializedWithOptionalId.Group;\n export type course = CoreTypes.SerializedWithOptionalId.Course;\n export type location = CoreTypes.SerializedWithOptionalId.Location;\n export type event = CoreTypes.SerializedWithOptionalId.Event;\n export type period = CoreTypes.SerializedWithOptionalId.Period;\n}\n\ntype Out = {\n settings: OutTypes.settings;\n periods: OutTypes.period [];\n teachers: OutTypes.teacher [];\n persons: OutTypes.person [];\n groups: OutTypes.group [];\n locations: OutTypes.location[];\n courses: OutTypes.course [];\n events: OutTypes.event [];\n meta?: {\n warnings: Warning[]\n };\n};\n\n\nexport const schedules = (\n input: string,\n options: Options = {}\n): Out => {\n const warnings: Warning[] = [];\n\n const tables = extractTables(input, warnings);\n\n const _scheduleRange = extractStartAndEnd(input); // need whole input file\n if (!_scheduleRange) throw new Error('Unable to extract schedule range');\n\n const scheduleStart = moment.utc(_scheduleRange.start);\n const startYear = scheduleStart.year();\n\n const settings: OutTypes.settings = {\n discretization: 5,\n numDays: 5,\n dayStart: '8:00',\n potentialCenter: '12:00',\n dayEnd: '17:00',\n calendarExceptions: parseCalendarExceptions(tables.PeriodGeneral?.at(0), startYear, warnings)\n };\n\n\n // Map to core structure\n const teachers = tables.Teacher\n ?.map((x): OutTypes.teacher => ({\n ids: extractId(x.GUID),\n signature: x.Teacher,\n displayName: `${x.FirstName} ${x.LastName}`,\n ...x.Category && {\n tags: [\n {\n type: 'category',\n value: x.Category\n }\n ]\n },\n person: `teacher.${ extractId(x.GUID) }`\n }));\n const teacherPersons = tables.Teacher\n // Filter out where either of firstname, lastname i missing, else it gives invalid persons\n ?.filter(x => x.FirstName && x.LastName)\n ?.map((x): OutTypes.person => ({\n ids: `teacher.${ extractId(x.GUID) }`,\n firstName: x.FirstName,\n lastName: x.LastName,\n ...x.PersonalCode && {\n SSN: {\n value: x.PersonalCode,\n }\n },\n ...x.EMail && {\n emails: [{\n value: x.EMail,\n type: 'organization'\n }]\n },\n ...x.Phone && {\n phoneNumbers: [\n {\n value: x.Phone,\n type: 'organization'\n }\n ]\n }\n }));\n\n const studentMap = new Map<string, string>();\n // create map of student SSN to student GUID\n tables.Student?.forEach(x => {\n const id = extractId(x.GUID);\n if (id) studentMap.set(x.Student, id);\n });\n\n const students = tables.Student?.map((x): OutTypes.person => ({\n ids: extractId(x.GUID),\n firstName: x.FirstName,\n lastName: x.LastName,\n type: 'Student',\n ...x.Student && {\n SSN: {\n value: x.Student,\n }\n },\n ...x.EMail && {\n emails: [{\n value: x.EMail,\n type: 'organization'\n }]\n }\n }));\n\n const groups = tables.Group?.map((x): OutTypes.group => ({\n ids: extractId(x.GUID),\n displayName: x.Group,\n ...(x.Class == '1') && { species: 'class' },\n members: x.Student?.split(',').map(x => studentMap.get(x)).filter(x => x != null) ?? []\n }));\n\n const periodMap = new Map<string, string>();\n const periodsFromWeekRanges = new Set<string>();\n if (tables.Period) {\n tables.Period.forEach(period => {\n const id = extractId(period.GUID);\n if (id) periodMap.set(period.Period, id);\n });\n\n // create additional periods corresponding to the lessons' week/actual weeks\n const _createPeriodsFrom = options.createPeriodsFrom;\n if (_createPeriodsFrom) {\n tables.Lesson?.forEach(x => {\n const key = x[_createPeriodsFrom];\n if (key) periodsFromWeekRanges.add(key);\n });\n periodsFromWeekRanges.forEach(x => periodMap.set(x, uuidv4()));\n }\n }\n\n const teacherMap = new Map<string, string>();\n if (tables.Teacher) {\n tables.Teacher.forEach(teacher => {\n const id = extractId(teacher.GUID);\n if (id) teacherMap.set(teacher.Teacher, id);\n });\n }\n\n const groupMap = new Map<string, string>();\n if (tables.Group) {\n tables.Group.forEach(group => {\n const id = extractId(group.GUID);\n if (id) groupMap.set(group.Group, id);\n });\n }\n\n const locationMap = new Map<string, string>();\n if (tables.Room) {\n tables.Room.forEach(room => {\n const id = extractId(room.GUID);\n if (id) locationMap.set(room.Room, id);\n });\n }\n\n // subject contains BackgroundColor(decimal) and FullText\n const subjectMap = new Map<string, Skola24Types.subject>();\n if (tables.Subject) {\n tables.Subject.forEach(subject => {\n subjectMap.set(subject.Subject, subject);\n });\n }\n\n // Course can contain FullText and Subject\n const parentCourseMap = new Map<string, Skola24Types.course>();\n if (tables.Course) {\n tables.Course.forEach(course => {\n parentCourseMap.set(course.Course, course);\n });\n }\n\n const courseMap = new Map<string, string | undefined>();\n const courses = tables.TA?.map((x): OutTypes.course => {\n const color = parseColor(subjectMap.get(x.Subject)?.BackgroundColor);\n\n // Course name is most specific (eg Administration 1), then subject name (Administration), then course code (eg ADMADM01), then subject code (eg ADM)\n const displayName = parentCourseMap.get(x.Course)?.FullText || subjectMap.get(x.Subject)?.FullText || x.Course || x.Subject;\n\n const teachers = (x.Teacher ?? [])\n .split(',')\n .map(x => teacherMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x)\n .map(to => ({ to }));\n const groups = (x.Group ?? [])\n .split(',')\n .map(x => groupMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x)\n .map(to => ({ to }));\n\n return {\n ids: x.GUID ? extractId(x.GUID) : uuidv4(),\n displayName: displayName,\n color: color,\n subject: x.Subject || parentCourseMap.get(x.Course)?.Subject,\n teachers: teachers,\n groups: groups,\n plannedDuration: x.TotalHours ? `${x.TotalHours} hrs` : (x.Weektime ? `${x.Weektime} min/week` : undefined),\n ...x.Period && { period: periodMap.get(x.Period) },\n } satisfies OutTypes.course;\n }) ?? [];\n\n tables.TA?.forEach(x => {\n courseMap.set(`${x.Subject}.${x.Teacher}.${x.Group}`, x.GUID ? extractId(x.GUID) : undefined);\n });\n\n const locations = tables.Room?.map((x): OutTypes.location => ({\n ids: extractId(x.GUID),\n displayName: x.Room,\n maximumCapacity: x.SeatingCapacity ? parseInt(x.SeatingCapacity) : undefined,\n ...x.Category?.length && {\n tags: [\n {\n type: 'category',\n value: x.Category\n }\n ]\n }\n }));\n\n let lessonMissingCourseWarningsCount = 0;\n\n const events = tables.Lesson\n ?.filter(x => !isNaN(parseInt(x.Length)))\n .map(x => {\n\n const position = (() => {\n const dayIndex = daysToIndex[x.DayOfWeek];\n\n if (dayIndex == null) {\n warnings.push({ code: 'lesson.invalid_day', context: x } satisfies Warning);\n return;\n }\n\n return {\n start: getDate(dayIndex, x.Starttime),\n end: getDate(dayIndex, x.Starttime).add(x.Length, 'minutes'),\n };\n })();\n\n const periodName = options.createPeriodsFrom ? x[options.createPeriodsFrom] : x.Period;\n const periodId = periodMap.get(periodName);\n\n const courseKey = `${x.Subject}.${x.Teacher}.${x.Group}`;\n let courseId = courseMap.get(courseKey);\n\n const inLocations = (x.Room ?? [])\n .split(',')\n .map(x => locationMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x);\n\n // if there is a connected course use its display name\n let displayName = courseId\n ? undefined\n : parentCourseMap.get(x.Course)?.FullText || subjectMap.get(x.Subject)?.FullText || x.Course || x.Subject;\n\n // if there is a connected course use its teachers\n const teachers = courseId\n ? undefined\n : x.Teacher\n ?.split(',')\n .map(x => teacherMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x)\n .map(to => ({ to }));\n\n // if there is a connected course use its groups\n const groups = courseId\n ? undefined\n : x.Group\n ?.split(',')\n .map(x => groupMap.get(x.trim()))\n .filter((x): x is NonNullable<typeof x> => !!x)\n .map(to => ({ to }));\n\n const duration = x.Length ? parseInt(x.Length) : undefined;\n\n // If no courseId found, we handle it according to options.includeEventsMissingCourse\n if (!courseId && options.includeEventsMissingCourse) {\n // Create a new course for this event\n courseId = uuidv4();\n const subject = subjectMap.get(x.Subject);\n const subjectName = subject?.FullText || x.Subject;\n displayName = displayName || subject?.FullText || x.Subject;\n const newCourse: OutTypes.course = {\n ids: courseId,\n displayName: displayName,\n subject: subjectName,\n teachers: teachers,\n groups: groups,\n };\n courses?.push(newCourse);\n } else if (!courseId) {\n lessonMissingCourseWarningsCount += 1;\n return null; // will be filtered out later\n }\n\n return {\n ids: extractId(x.GUID),\n displayName: displayName,\n ...position,\n duration: duration,\n preferredDuration: duration ?? 0,\n course: courseId,\n period: periodId,\n inLocations,\n ...(!options.includeEventsMissingCourse ? { teachers, groups } : undefined),\n } satisfies OutTypes.event;\n }).filter((x): x is NonNullable<typeof x> => x != null);\n\n const periods = tables.Period\n ?.map(x => parsePeriod(x, scheduleStart, warnings))\n .filter(x => x.ranges.length > 0);\n\n periodsFromWeekRanges.forEach(x => {\n const ids = periodMap.get(x);\n if (!ids) {\n throw new Error(`Unable to find period for ${x}`);\n return;\n }\n periods?.push(fromWeekNumberRange(ids, x, scheduleStart));\n });\n\n if (lessonMissingCourseWarningsCount > 0 && !options.includeEventsMissingCourse) {\n warnings.unshift({\n code: 'ignoring_lessons_missing_course',\n context: { count: lessonMissingCourseWarningsCount }\n } satisfies Warning);\n }\n\n return {\n settings,\n periods: periods ?? [],\n teachers: teachers ?? [],\n persons: (students ?? []).concat(teacherPersons ?? []),\n groups: groups ?? [],\n locations: locations ?? [],\n courses: courses ?? [],\n events: events ?? [],\n\n meta: { warnings }\n } satisfies Out;\n};"],"mappings":";;;;;;;;;;AAYA,MAAM,cAAc;CAClB,UAAW;CACX,UAAW;CACX,UAAW;CACX,WAAW;CACX,UAAW;CACX,UAAW;CACX,UAAW;CAGX,UAAU;CACV,UAAU;CACV,UAAU;;AAIZ,SAAS,gBAAiB,QAAgB;AACxC,QAAO,OAAO,MAAM,eAAe;;AAErC,MAAM,cAAc;CAClB,QAAgB;CAChB,WAAgB;CAChB,YAAgB;CAChB,WAAgB;CAChB,QAAgB;CAEhB,gBAAgB;;AAIlB,SAAS,cAAe,OAAe,UAAqB;CAE1D,MAAM,QAAQ,MAAM,MAAM;CAC1B,MAAM,SAAS,MAAM,GAAG;AACxB,KAAI,CAAC,OAAQ,OAAM,IAAI,MAAM;CAS7B,MAAM,QAAQ;CACd,MAAM,UAAU,CAAC,GAAG,OAAO,OAAO,SAAS;AAE3C,QAAO,QACJ,KAAI,MAAK;EAER,MAAM,YAAY,EAAE,GAAG,IACnB,OACD,MAAM,0BACL,GAAG;AACP,MAAI,CAAC,UAAW;EAEhB,MAAM,eAAe,EAAE,GAAG,IAAI;AAC9B,MAAI,CAAC,aAAc;EACnB,MAAM,SAAS,KAAK,MAAM,cAAc;GAAE,GAAG;GAAa;;AAC1D,SAAO;GACM;GACX,QAAW,OAAO;;IAGrB,QAAQ,MAAkC,KAAK,MAC/C,QAAc,KAAK,EAAE,WAAW,aAAa;AAC5C,MAAI,aAAa;AACjB,SAAO;IACN;;AAIP,SAAS,WAAY,YAAgC;AACnD,KAAI,cAAc,KAAM;CAExB,MAAM,eAAe,SAAS;AAC9B,KAAI,MAAM,cAAe;CAGzB,MAAM,MA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,CAAC,YAAY,QAAQ,4BAA4B;AAEnD,cAAWC;GACX,MAAM,UAAU,WAAW,IAAI,EAAE;GACjC,MAAM,cAAc,SAAS,YAAY,EAAE;AAC3C,iBAAc,eAAe,SAAS,YAAY,EAAE;GACpD,MAAMI,YAA6B;IACjC,KAAa;IACA;IACb,SAAa;IACb,UAAaH;IACb,QAAaC;;AAEf,YAAS,KAAK;aACL,CAAC,UAAU;AACpB,uCAAoC;AACpC,UAAO;;AAGT,SAAO;GACL,KAAmB,UAAU,EAAE;GACZ;GACnB,GAAG;GACgB;GACnB,mBAAmB,YAAY;GAC/B,QAAmB;GACnB,QAAmB;GACnB;GACA,GAAI,CAAC,QAAQ,6BAA6B;IAAE;IAAU;OAAW;;IAElE,QAAQ,MAAkC,KAAK;CAEpD,MAAM,UAAU,OAAO,QACnB,KAAI,MAAK,YAAY,GAAG,eAAe,WACxC,QAAO,MAAK,EAAE,OAAO,SAAS;AAEjC,uBAAsB,SAAQ,MAAK;EACjC,MAAM,MAAM,UAAU,IAAI;AAC1B,MAAI,CAAC,IACH,OAAM,IAAI,MAAM,6BAA6B;AAG/C,WAAS,KAAK,oBAAoB,KAAK,GAAG;;AAG5C,KAAI,mCAAmC,KAAK,CAAC,QAAQ,2BACnD,UAAS,QAAQ;EACf,MAAS;EACT,SAAS,EAAE,OAAO;;AAItB,QAAO;EACL;EACA,SAAW,WAAa;EACxB,UAAW,YAAa;EACxB,UAAY,YAAa,IAAI,OAAO,kBAAkB;EACtD,QAAW,UAAa;EACxB,WAAW,aAAa;EACxB,SAAW,WAAa;EACxB,QAAW,UAAa;EAExB,MAAM,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":[],"sources":["../../../../src/Skola24/txt/from/util.ts"],"sourcesContent":["\nexport function extractId (id: string) {\n // ensure the id is on the form \"{...}\" where ... is the value to be extracted\n if (id.startsWith('{') && id.endsWith('}')) {\n return id.slice(1, -1);\n }\n throw new Error(`Invalid ID format: ${id}`);\n}\n\n\nexport function getStartYear (input: string): undefined | number {\n // extract base and offset year\n const _baseYear = input.match(/^BaseYear=(\\d{4})$/m) ?.at(1);\n const _offsetYear = input.match(/^OffsetYear=(\\d{1,2})$/m)?.at(1);\n if (_baseYear == null || _offsetYear == null) return;\n\n // the year of the start date\n const startYear = parseInt(_baseYear, 10) + parseInt(_offsetYear, 10);\n if (isNaN(startYear)) return;\n\n return startYear;\n}"],"mappings":";AACA,SAAgB,UAAW,IAAY;AAErC,KAAI,GAAG,WAAW,IAAI,IAAI,GAAG,SAAS,IAAI,CACxC,QAAO,GAAG,MAAM,GAAG,GAAG;AAExB,OAAM,IAAI,MAAM,sBAAsB,KAAK;;AAI7C,SAAgB,aAAc,OAAmC;CAE/D,MAAM,YAAc,MAAM,MAAM,sBAAsB,EAAM,GAAG,EAAE;CACjE,MAAM,cAAc,MAAM,MAAM,0BAA0B,EAAE,GAAG,EAAE;AACjE,KAAI,aAAa,QAAQ,eAAe,KAAM;CAG9C,MAAM,YAAY,SAAS,WAAW,GAAG,GAAG,SAAS,aAAa,GAAG;AACrE,KAAI,MAAM,UAAU,CAAE;AAEtB,QAAO"}
1
+ {"version":3,"file":"util.js","names":[],"sources":["../../../../src/Skola24/txt/from/util.ts"],"sourcesContent":["\nexport function extractId (id: string) {\n // ensure the id is on the form \"{...}\" where ... is the value to be extracted\n if (id.startsWith('{') && id.endsWith('}')) {\n return id.slice(1, -1);\n }\n throw new Error(`Invalid ID format: ${id}`);\n}\n\n\nexport function getStartYear (input: string): undefined | number {\n // extract base and offset year\n const _baseYear = input.match(/^BaseYear=(\\d{4})$/m) ?.at(1);\n const _offsetYear = input.match(/^OffsetYear=(\\d{1,2})$/m)?.at(1);\n if (_baseYear == null || _offsetYear == null) return;\n\n // the year of the start date\n const startYear = parseInt(_baseYear, 10) + parseInt(_offsetYear, 10);\n if (isNaN(startYear)) return;\n\n return startYear;\n}"],"mappings":";AACA,SAAgB,UAAW,IAAY;AAErC,KAAI,GAAG,WAAW,QAAQ,GAAG,SAAS,KACpC,QAAO,GAAG,MAAM,GAAG;AAErB,OAAM,IAAI,MAAM,sBAAsB;;AAIxC,SAAgB,aAAc,OAAmC;CAE/D,MAAM,YAAc,MAAM,MAAM,wBAA4B,GAAG;CAC/D,MAAM,cAAc,MAAM,MAAM,4BAA4B,GAAG;AAC/D,KAAI,aAAa,QAAQ,eAAe,KAAM;CAG9C,MAAM,YAAY,SAAS,WAAW,MAAM,SAAS,aAAa;AAClE,KAAI,MAAM,WAAY;AAEtB,QAAO"}
@@ -2,7 +2,6 @@ import { Options, Types, Warning } from "./types/index.js";
2
2
  import { Types as Types$1 } from "../../core/types/index.js";
3
3
  import { OutTypes } from "./from/schedules.js";
4
4
  import { export_default } from "./to/index.js";
5
- import "../../index.js";
6
5
 
7
6
  //#region src/Skola24/txt/index.d.ts
8
7
  declare class Map {
@@ -1,6 +1,5 @@
1
1
  import { BaseOptions } from "../../../common/types.js";
2
2
  import { Types } from "../../../core/types/index.js";
3
- import "../../../index.js";
4
3
 
5
4
  //#region src/Skola24/txt/to/index.d.ts
6
5
  declare class export_default {
@@ -151,9 +151,14 @@ var schedules_default = (data, options = {}) => {
151
151
  let period = event.period == null ? course?.period : event.period;
152
152
  if (isString(period)) period = periodMap.get(period);
153
153
  if (period && !("ranges" in period)) period = void 0;
154
- const teachers$1 = ((event.teachers == null ? course?.teachers : event.teachers)?.map((x) => getVertexId(x.to, options)))?.map((id) => teacherMap.get(id)).filter(Boolean) ?? [];
155
- const groups$1 = ((event.groups == null ? course?.groups : event.groups)?.map((x) => getVertexId(x.to, options)))?.map((id) => groupMap.get(id)).filter(Boolean) ?? [];
156
- const locations$1 = (event.inLocations?.map((x) => x ? getVertexId(x, options) : null).filter((x) => x != null))?.map((id) => locationMap.get(id)).filter(Boolean) ?? [];
154
+ const t$1 = event.teachers == null ? course?.teachers : event.teachers;
155
+ const teacherIds = t$1?.map((x) => getVertexId(x.to, options));
156
+ const teachers$1 = teacherIds?.map((id) => teacherMap.get(id)).filter(Boolean) ?? [];
157
+ const g$1 = event.groups == null ? course?.groups : event.groups;
158
+ const groupIds = g$1?.map((x) => getVertexId(x.to, options));
159
+ const groups$1 = groupIds?.map((id) => groupMap.get(id)).filter(Boolean) ?? [];
160
+ const locationIds = event.inLocations?.map((x) => x ? getVertexId(x, options) : null).filter((x) => x != null);
161
+ const locations$1 = locationIds?.map((id) => locationMap.get(id)).filter(Boolean) ?? [];
157
162
  const dayOfWeek = moment.utc(event.start).toDate().toLocaleDateString("sv-SE", {
158
163
  weekday: "long",
159
164
  timeZone: "UTC"
@@ -244,8 +249,10 @@ var schedules_default = (data, options = {}) => {
244
249
  const totalHoursRegex = /(\d+) hrs/;
245
250
  const weekTimeRegex = /(\d+) min\/week/;
246
251
  const c = courses?.map((course) => {
247
- const teachers$1 = (course.teachers?.map((x) => getVertexId(x.to, options)).filter(Boolean))?.map((id) => teacherMap.get(id)).filter(Boolean) ?? [];
248
- const groups$1 = (course.groups?.map((x) => getVertexId(x.to, options)).filter(Boolean))?.map((id) => groupMap.get(id)).filter(Boolean) ?? [];
252
+ const teacherIds = course.teachers?.map((x) => getVertexId(x.to, options)).filter(Boolean);
253
+ const teachers$1 = teacherIds?.map((id) => teacherMap.get(id)).filter(Boolean) ?? [];
254
+ const groupIds = course.groups?.map((x) => getVertexId(x.to, options)).filter(Boolean);
255
+ const groups$1 = groupIds?.map((id) => groupMap.get(id)).filter(Boolean) ?? [];
249
256
  const syllabusId = isString(course?.syllabus) ? course.syllabus : course?.syllabus && isObjectIdOrHexString(course?.syllabus) ? (course?.syllabus).toString() : void 0;
250
257
  const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus;
251
258
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["teachers","groups","locations"],"sources":["../../../../src/Skola24/txt/to/schedules.ts"],"sourcesContent":["import Papa from 'papaparse';\nimport moment from 'moment';\nimport { isString } from 'lodash-es';\nimport type { Types as MongooseTypes } from 'mongoose';\nimport { isObjectIdOrHexString } from 'mongoose';\nimport type { CoreTypes } from '../../../core';\nimport type { BaseOptions } from '../../../common/types';\nimport { getVertexId } from '../../../core/util';\n\nconst papaOptions = {\n quotes: false, //or array of booleans\n quoteChar: '\"',\n escapeChar: '\"',\n delimiter: '\\t',\n header: true,\n newline: '\\r\\n',\n skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.\n // columns: null //or array of strings\n} as Papa.UnparseConfig;\n\nconst uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\nexport default (\n data: CoreTypes.Mixed.Schedule,\n options: BaseOptions = {}\n): string => {\n const { locations, teachers, groups, persons, events, courses, periods, syllabuses, divisions } = data;\n const { start, /* end, */ displayName } = divisions ?? data as unknown as CoreTypes.Mixed.Division;\n\n const startYear = moment.utc(start).year();\n const startMonth = moment.utc(start).month();\n\n // Set cvs to the source section\n let csv = `[Source]${papaOptions.newline}ApplicationVerMajor=4${papaOptions.newline}ApplicationVerMinor=0${papaOptions.newline}DatabaseRevNo=527${papaOptions.newline}CurrentNovaschemDatabase=${papaOptions.newline}User=${papaOptions.newline}`;\n csv += `SchoolID=RS${papaOptions.newline}School=${displayName}${papaOptions.newline}County=RS${papaOptions.newline}`;\n csv += `BaseYear=${startYear}${papaOptions.newline}OffsetYear=0${papaOptions.newline}OffsetMonth=${startMonth}${papaOptions.newline}CreationDate=${moment().format('YYYY-MM-DD')}${papaOptions.newline}${papaOptions.newline}`;\n // add destination section to csv\n csv += `[Destination]${papaOptions.newline}Application=${papaOptions.newline}ApplicationID=${papaOptions.newline}${papaOptions.newline}`;\n\n // add database options to csv\n csv += `[DatabaseOptions]${papaOptions.newline}Update=TRUE${papaOptions.newline}AddNew=TRUE${papaOptions.newline}${papaOptions.newline}`;\n\n // start tables section\n csv += `[Tables]${papaOptions.newline}${papaOptions.newline}`;\n\n // append teachers to csv\n const t = teachers?.map(teacher => {\n return {\n 'Teacher (6001)': teacher.signature,\n 'GUID (5800)': (teacher.ids && uuid.test(teacher.ids)) ? `{${teacher.ids}}` : '',\n 'Category (6002)': '',\n 'Title (6006)': '',\n 'Phone (6033)': '',\n 'EvaluationNumber (6014)': '',\n ... 'person' in teacher && typeof teacher.person == 'object'\n ? {\n 'PersonalCode (6028)': 'SSN' in teacher.person ? (teacher.person?.SSN?.value ?? '') : '',\n 'LastName (6003)': 'lastName' in teacher.person ? (teacher.person?.lastName ?? '') : '',\n 'FirstName (6004)': 'firstName' in teacher.person ? (teacher.person?.firstName ?? '') : '',\n 'EMail (6034)': 'emails' in teacher.person ? (teacher.person?.emails?.[0]?.value ?? '') : '',\n }\n : null\n };\n }) ?? [];\n csv += `${papaOptions.newline}Teacher (6000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (t.length) {\n csv += Papa.unparse(t, papaOptions);\n } else {\n csv += ['Teacher (6001)', 'GUID (5800)', 'Category (6002)', 'PersonalCode (6028)', 'LastName (6003)', 'Title (6006)', 'FirstName (6004)', 'Phone (6033)', 'EMail (6034)', 'EvaluationNumber (6014)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append students to csv\n const s = persons?.filter(person => {\n return person.type != 'Teacher';\n }).map(person => {\n return {\n 'Student (7201)': person.SSN?.value,\n 'GUID (5800)': (person.ids && uuid.test(person.ids)) ? `{${person.ids}}` : '',\n 'Category (7305)': '',\n 'LastName (7202)': person.lastName ?? '',\n 'FirstName (7211)': person.firstName ?? '',\n 'EMail (7215)': person.emails?.[0]?.value ?? ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}Student (7200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (s.length) {\n csv += Papa.unparse(s, papaOptions);\n } else {\n csv += ['Student (7201)', 'GUID (5800)', 'Category (7305)', 'LastName (7202)', 'FirstName (7211)', 'EMail (7215)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // create a map of students.id to students.SSN\n const studentMap = new Map(persons?.filter(x => x.type != 'Teacher').map(x => [getVertexId(x, options), x.SSN?.value ?? '']));\n\n // append groups to csv\n const g = groups?.map(group => {\n return {\n 'Group (6201)': group.displayName!,\n 'GUID (5800)': (group.ids && uuid.test(group.ids)) ? `{${group.ids}}` : '',\n 'Class (6210)': group.species == 'class' ? 1 : 0,\n 'Teacher (6204)': '',\n 'IClass (6206)': '',\n 'Student (6205)': group.members?.map(x => getVertexId(x, options)).map(x => studentMap.get(x)).filter(Boolean).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Group (6200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (g.length) {\n csv += Papa.unparse(g, papaOptions);\n } else {\n csv += ['Group (6201)', 'GUID (5800)', 'Class (6210)', 'Teacher (6204)', 'IClass (6206)', 'Student (6205)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append locations to csv\n const l = locations?.map(location => {\n return {\n 'Room (6601)': location.displayName!,\n 'GUID (5800)': (location.ids && uuid.test(location.ids)) ? `{${location.ids}}` : '',\n 'Category (6602)': location.tags?.find(tag => tag.type == 'category')?.value ?? '',\n 'SeatingCapacity (6607)': location.maximumCapacity,\n };\n }) ?? [];\n csv += `${papaOptions.newline}Room (6600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (l.length) {\n csv += Papa.unparse(l, papaOptions);\n } else {\n csv += ['Room (6601)', 'GUID (5800)', 'Category (6602)', 'SeatingCapacity (6607)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append periods to csv\n const p = periods?.map(period => {\n return {\n 'Period (8001)': period.displayName!,\n 'GUID (5800)': (period.ids && uuid.test(period.ids)) ? `{${period.ids}}` : '',\n 'TextBelowSchedule (8002)': period.displayName!,\n 'Category (8006)': '',\n 'Calendar (8005)': period.ranges?.map(range => `${moment.utc(range.start).format('D/M')}-${moment.utc(range.end).format('D/M')}`).join(', ')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Period (8000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (p.length) {\n csv += Papa.unparse(p, papaOptions);\n } else {\n csv += ['Period (8001)', 'GUID (5800)', 'TextBelowSchedule (8002)', 'Category (8006)', 'Calendar (8005)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const courseMap = new Map(data.courses ?.map(x => [getVertexId(x, options), x]));\n const periodMap = new Map(data.periods ?.map(x => [getVertexId(x, options), x]));\n const teacherMap = new Map(data.teachers ?.map(x => [getVertexId(x, options), x]));\n const groupMap = new Map(data.groups ?.map(x => [getVertexId(x, options), x]));\n const locationMap = new Map(data.locations ?.map(x => [getVertexId(x, options), x]));\n const syllabusMap = new Map(data.syllabuses?.map(x => [getVertexId(x, options), x]));\n\n // append lessons to csv\n const e = events\n // ?.filter(x => !isNaN(Date.parse(x.start?.toString() ?? '')))\n .map((event, index) => {\n if (!event.start || !event.end) return;\n\n const courseId = event.course ? getVertexId(event.course, options) : undefined;\n const course = courseId ? courseMap.get(courseId) : undefined;\n\n // Only use deserialize period\n let period = event.period == null ? course?.period : event.period;\n if (isString(period))\n period = periodMap.get(period);\n if ((period && !('ranges' in period)))\n period = undefined;\n\n // Only use deserialize teachers\n const t = event.teachers == null ? course?.teachers : event.teachers;\n const teacherIds = t?.map(x => getVertexId(x.to, options));\n const teachers = teacherIds?.map(id => teacherMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const g = event.groups == null ? course?.groups : event.groups;\n const groupIds = g?.map(x => getVertexId(x.to, options));\n const groups = groupIds?.map(id => groupMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize locations\n const locationIds = event.inLocations?.map(x => x ? getVertexId(x, options) : null).filter(x => x != null);\n const locations = locationIds?.map(id => locationMap.get(id)).filter(Boolean) ?? [];\n const dayOfWeek = moment.utc(event.start).toDate().toLocaleDateString('sv-SE', { weekday: 'long', timeZone: 'UTC' });\n\n // Syllabus of the course\n const syllabusId = isString(course?.syllabus) ? course.syllabus : (course?.syllabus && isObjectIdOrHexString(course?.syllabus)) ? (course?.syllabus as MongooseTypes.ObjectId | string).toString() : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n // capitalize first letter of dayOfWeek\n const dayOfWeekCapitalized = dayOfWeek.charAt(0).toUpperCase() + dayOfWeek.slice(1);\n return {\n 'PK (7100)': index + 1,\n 'GUID (5800)': (event.ids && uuid.test(event.ids)) ? `{${event.ids}}` : '',\n 'DayOfWeek (7101)': dayOfWeekCapitalized,\n 'Starttime (7102)': moment.utc(event.start).format('HH:mm'),\n 'Length (7115)': event.duration,\n 'Course (7106)': syllabus?.courseCode,\n 'Subject (7103)': syllabus?.subjectCode ?? course?.subject ?? '',\n 'Teacher (7104)': teachers ?.map(x => x?.signature ).filter(Boolean).join(','),\n 'Group (7105)': groups ?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Room (7107)': locations?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Period (7108)': '',\n 'Week (7109)': '',\n 'ActualWeeks (7167)': period?.ranges?.map(range => `${moment.utc(range.start).week()}-${moment.utc(range.end).week()}`).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Lesson (7100)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (e.length) {\n csv += Papa.unparse(e, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append subjects to csv, is empty for now\n // csv += `Subject (6400)${options.newline}[Rows]${options.newline}`;\n // csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(options.delimiter);\n // csv += options.newline;\n\n // append syllabus to csv\n const courseSyllabuses = syllabuses?.filter(syllabus => !!syllabus.courseName).map(syllabus => {\n return {\n 'Course (7601)': syllabus.courseCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (7602)': syllabus.courseName,\n 'Subject (7603)': syllabus.subjectCode ?? '',\n 'Points (7604)': syllabus.points\n };\n }) ?? [];\n csv += `${papaOptions.newline}Course (7600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (courseSyllabuses.length) {\n csv += Papa.unparse(courseSyllabuses, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const subjectSyllabuses = syllabuses?.reduce((unique, syllabus) => {\n if (syllabus.subjectCode && !unique.seen.has(syllabus.subjectCode)) {\n unique.seen.add(syllabus.subjectCode);\n unique.result.push({\n 'Subject (6401)': syllabus.subjectCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (6403)': syllabus.subjectName,\n });\n }\n return unique;\n }, {\n seen: new Set<string>(),\n result: [] as Array<{\n 'Subject (6401)': string;\n 'GUID (5800)': string | undefined;\n 'FullText (6403)': string;\n }>\n })?.result ?? [];\n csv += `Subject (6400)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (subjectSyllabuses.length) {\n csv += Papa.unparse(subjectSyllabuses, papaOptions);\n } else {\n csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(papaOptions.delimiter);\n }\n\n const totalHoursRegex = /(\\d+) hrs/;\n const weekTimeRegex = /(\\d+) min\\/week/;\n const c = courses?.map(course => {\n // Only use deserialize teachers\n const teacherIds = course.teachers?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const teachers = teacherIds?.map(id => teacherMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const groupIds = course.groups?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const groups = groupIds?.map(id => groupMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize syllabus\n const syllabusId = isString(course?.syllabus) ? course.syllabus : (course?.syllabus && isObjectIdOrHexString(course?.syllabus)) ? (course?.syllabus as MongooseTypes.ObjectId | string).toString() : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n return {\n 'PK (8200)': '',\n 'GUID (5800)': course.ids,\n 'OriginalRecord (8224)': '1',\n 'CreateLesson (8227)': '1',\n 'Course (8202)': syllabus?.courseCode,\n 'Subject (8209)': syllabus?.subjectCode ?? course.subject, // Nikos ansvarig för framtida buggar\n 'Teacher (8210)': teachers?.map(teacher => teacher.signature).filter(Boolean).join(','),\n 'Group (8203)': groups?.map(group => group.displayName).filter(Boolean).join(','),\n 'TotalHours (8204)': (course.plannedDuration && totalHoursRegex.test(course.plannedDuration)) ? totalHoursRegex.exec(course.plannedDuration)![1] : '',\n 'Weektime (8208)': (course.plannedDuration && weekTimeRegex.test(course.plannedDuration)) ? weekTimeRegex.exec(course.plannedDuration)![1] : '',\n 'Blockname (8215)': '',\n 'Period (8206)': '',\n 'Week (8207)': '',\n 'NotPeriod (8212)': '',\n 'NotWeek (8213)': ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}TA (8200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (c.length) {\n csv += Papa.unparse(c, papaOptions);\n } else {\n csv += ['Course (8202)', 'GUID (5800)', 'Subject (8209)', 'Teacher (8210)', 'Group (8203)', 'TotalHours (8204)', 'Weektime (8208)', 'Blockname (8215)', 'Period (8206)', 'Week (8207)', 'NotPeriod (8212)', 'NotWeek (8213)'].join(papaOptions.delimiter);\n }\n\n return csv;\n};"],"mappings":";;;;;;;AASA,MAAM,cAAc;CAClB,QAAgB;CAChB,WAAgB;CAChB,YAAgB;CAChB,WAAgB;CAChB,QAAg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AAU,eAAe,OAAO;GACzD,kBAAyBD,YAAU,KAAI,YAAW,QAAQ,UAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;GAC9F,gBAAyBC,UAAQ,KAAI,UAAS,MAAM,YAAY,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;GAC1F,qBAA0B,OAAO,mBAAmB,gBAAgB,KAAK,OAAO,gBAAgB,GAAI,gBAAgB,KAAK,OAAO,gBAAgB,CAAE,KAAK;GACvJ,mBAA0B,OAAO,mBAAmB,cAAc,KAAK,OAAO,gBAAgB,GAAI,cAAc,KAAK,OAAO,gBAAgB,CAAE,KAAK;GACnJ,oBAAyB;GACzB,iBAAyB;GACzB,eAAyB;GACzB,oBAAyB;GACzB,kBAAyB;GAC1B;GACD,IAAI,EAAE;AACR,QAAO,GAAG,YAAY,QAAQ,WAAW,YAAY,QAAQ,QAAQ,YAAY;AACjF,KAAI,EAAE,OACJ,QAAO,KAAK,QAAQ,GAAG,YAAY;KAEnC,QAAO;EAAC;EAAiB;EAAe;EAAkB;EAAkB;EAAgB;EAAqB;EAAmB;EAAoB;EAAiB;EAAe;EAAoB;EAAiB,CAAC,KAAK,YAAY,UAAU;AAG3P,QAAO"}
1
+ {"version":3,"file":"schedules.js","names":["t","teachers","g","groups","locations"],"sources":["../../../../src/Skola24/txt/to/schedules.ts"],"sourcesContent":["import Papa from 'papaparse';\nimport moment from 'moment';\nimport { isString } from 'lodash-es';\nimport type { Types as MongooseTypes } from 'mongoose';\nimport { isObjectIdOrHexString } from 'mongoose';\nimport type { CoreTypes } from '../../../core';\nimport type { BaseOptions } from '../../../common/types';\nimport { getVertexId } from '../../../core/util';\n\nconst papaOptions = {\n quotes: false, //or array of booleans\n quoteChar: '\"',\n escapeChar: '\"',\n delimiter: '\\t',\n header: true,\n newline: '\\r\\n',\n skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.\n // columns: null //or array of strings\n} as Papa.UnparseConfig;\n\nconst uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\nexport default (\n data: CoreTypes.Mixed.Schedule,\n options: BaseOptions = {}\n): string => {\n const { locations, teachers, groups, persons, events, courses, periods, syllabuses, divisions } = data;\n const { start, /* end, */ displayName } = divisions ?? data as unknown as CoreTypes.Mixed.Division;\n\n const startYear = moment.utc(start).year();\n const startMonth = moment.utc(start).month();\n\n // Set cvs to the source section\n let csv = `[Source]${papaOptions.newline}ApplicationVerMajor=4${papaOptions.newline}ApplicationVerMinor=0${papaOptions.newline}DatabaseRevNo=527${papaOptions.newline}CurrentNovaschemDatabase=${papaOptions.newline}User=${papaOptions.newline}`;\n csv += `SchoolID=RS${papaOptions.newline}School=${displayName}${papaOptions.newline}County=RS${papaOptions.newline}`;\n csv += `BaseYear=${startYear}${papaOptions.newline}OffsetYear=0${papaOptions.newline}OffsetMonth=${startMonth}${papaOptions.newline}CreationDate=${moment().format('YYYY-MM-DD')}${papaOptions.newline}${papaOptions.newline}`;\n // add destination section to csv\n csv += `[Destination]${papaOptions.newline}Application=${papaOptions.newline}ApplicationID=${papaOptions.newline}${papaOptions.newline}`;\n\n // add database options to csv\n csv += `[DatabaseOptions]${papaOptions.newline}Update=TRUE${papaOptions.newline}AddNew=TRUE${papaOptions.newline}${papaOptions.newline}`;\n\n // start tables section\n csv += `[Tables]${papaOptions.newline}${papaOptions.newline}`;\n\n // append teachers to csv\n const t = teachers?.map(teacher => {\n return {\n 'Teacher (6001)': teacher.signature,\n 'GUID (5800)': (teacher.ids && uuid.test(teacher.ids)) ? `{${teacher.ids}}` : '',\n 'Category (6002)': '',\n 'Title (6006)': '',\n 'Phone (6033)': '',\n 'EvaluationNumber (6014)': '',\n ... 'person' in teacher && typeof teacher.person == 'object'\n ? {\n 'PersonalCode (6028)': 'SSN' in teacher.person ? (teacher.person?.SSN?.value ?? '') : '',\n 'LastName (6003)': 'lastName' in teacher.person ? (teacher.person?.lastName ?? '') : '',\n 'FirstName (6004)': 'firstName' in teacher.person ? (teacher.person?.firstName ?? '') : '',\n 'EMail (6034)': 'emails' in teacher.person ? (teacher.person?.emails?.[0]?.value ?? '') : '',\n }\n : null\n };\n }) ?? [];\n csv += `${papaOptions.newline}Teacher (6000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (t.length) {\n csv += Papa.unparse(t, papaOptions);\n } else {\n csv += ['Teacher (6001)', 'GUID (5800)', 'Category (6002)', 'PersonalCode (6028)', 'LastName (6003)', 'Title (6006)', 'FirstName (6004)', 'Phone (6033)', 'EMail (6034)', 'EvaluationNumber (6014)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append students to csv\n const s = persons?.filter(person => {\n return person.type != 'Teacher';\n }).map(person => {\n return {\n 'Student (7201)': person.SSN?.value,\n 'GUID (5800)': (person.ids && uuid.test(person.ids)) ? `{${person.ids}}` : '',\n 'Category (7305)': '',\n 'LastName (7202)': person.lastName ?? '',\n 'FirstName (7211)': person.firstName ?? '',\n 'EMail (7215)': person.emails?.[0]?.value ?? ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}Student (7200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (s.length) {\n csv += Papa.unparse(s, papaOptions);\n } else {\n csv += ['Student (7201)', 'GUID (5800)', 'Category (7305)', 'LastName (7202)', 'FirstName (7211)', 'EMail (7215)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // create a map of students.id to students.SSN\n const studentMap = new Map(persons?.filter(x => x.type != 'Teacher').map(x => [getVertexId(x, options), x.SSN?.value ?? '']));\n\n // append groups to csv\n const g = groups?.map(group => {\n return {\n 'Group (6201)': group.displayName!,\n 'GUID (5800)': (group.ids && uuid.test(group.ids)) ? `{${group.ids}}` : '',\n 'Class (6210)': group.species == 'class' ? 1 : 0,\n 'Teacher (6204)': '',\n 'IClass (6206)': '',\n 'Student (6205)': group.members?.map(x => getVertexId(x, options)).map(x => studentMap.get(x)).filter(Boolean).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Group (6200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (g.length) {\n csv += Papa.unparse(g, papaOptions);\n } else {\n csv += ['Group (6201)', 'GUID (5800)', 'Class (6210)', 'Teacher (6204)', 'IClass (6206)', 'Student (6205)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append locations to csv\n const l = locations?.map(location => {\n return {\n 'Room (6601)': location.displayName!,\n 'GUID (5800)': (location.ids && uuid.test(location.ids)) ? `{${location.ids}}` : '',\n 'Category (6602)': location.tags?.find(tag => tag.type == 'category')?.value ?? '',\n 'SeatingCapacity (6607)': location.maximumCapacity,\n };\n }) ?? [];\n csv += `${papaOptions.newline}Room (6600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (l.length) {\n csv += Papa.unparse(l, papaOptions);\n } else {\n csv += ['Room (6601)', 'GUID (5800)', 'Category (6602)', 'SeatingCapacity (6607)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append periods to csv\n const p = periods?.map(period => {\n return {\n 'Period (8001)': period.displayName!,\n 'GUID (5800)': (period.ids && uuid.test(period.ids)) ? `{${period.ids}}` : '',\n 'TextBelowSchedule (8002)': period.displayName!,\n 'Category (8006)': '',\n 'Calendar (8005)': period.ranges?.map(range => `${moment.utc(range.start).format('D/M')}-${moment.utc(range.end).format('D/M')}`).join(', ')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Period (8000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (p.length) {\n csv += Papa.unparse(p, papaOptions);\n } else {\n csv += ['Period (8001)', 'GUID (5800)', 'TextBelowSchedule (8002)', 'Category (8006)', 'Calendar (8005)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const courseMap = new Map(data.courses ?.map(x => [getVertexId(x, options), x]));\n const periodMap = new Map(data.periods ?.map(x => [getVertexId(x, options), x]));\n const teacherMap = new Map(data.teachers ?.map(x => [getVertexId(x, options), x]));\n const groupMap = new Map(data.groups ?.map(x => [getVertexId(x, options), x]));\n const locationMap = new Map(data.locations ?.map(x => [getVertexId(x, options), x]));\n const syllabusMap = new Map(data.syllabuses?.map(x => [getVertexId(x, options), x]));\n\n // append lessons to csv\n const e = events\n // ?.filter(x => !isNaN(Date.parse(x.start?.toString() ?? '')))\n .map((event, index) => {\n if (!event.start || !event.end) return;\n\n const courseId = event.course ? getVertexId(event.course, options) : undefined;\n const course = courseId ? courseMap.get(courseId) : undefined;\n\n // Only use deserialize period\n let period = event.period == null ? course?.period : event.period;\n if (isString(period))\n period = periodMap.get(period);\n if ((period && !('ranges' in period)))\n period = undefined;\n\n // Only use deserialize teachers\n const t = event.teachers == null ? course?.teachers : event.teachers;\n const teacherIds = t?.map(x => getVertexId(x.to, options));\n const teachers = teacherIds?.map(id => teacherMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const g = event.groups == null ? course?.groups : event.groups;\n const groupIds = g?.map(x => getVertexId(x.to, options));\n const groups = groupIds?.map(id => groupMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize locations\n const locationIds = event.inLocations?.map(x => x ? getVertexId(x, options) : null).filter(x => x != null);\n const locations = locationIds?.map(id => locationMap.get(id)).filter(Boolean) ?? [];\n const dayOfWeek = moment.utc(event.start).toDate().toLocaleDateString('sv-SE', { weekday: 'long', timeZone: 'UTC' });\n\n // Syllabus of the course\n const syllabusId = isString(course?.syllabus) ? course.syllabus : (course?.syllabus && isObjectIdOrHexString(course?.syllabus)) ? (course?.syllabus as MongooseTypes.ObjectId | string).toString() : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n // capitalize first letter of dayOfWeek\n const dayOfWeekCapitalized = dayOfWeek.charAt(0).toUpperCase() + dayOfWeek.slice(1);\n return {\n 'PK (7100)': index + 1,\n 'GUID (5800)': (event.ids && uuid.test(event.ids)) ? `{${event.ids}}` : '',\n 'DayOfWeek (7101)': dayOfWeekCapitalized,\n 'Starttime (7102)': moment.utc(event.start).format('HH:mm'),\n 'Length (7115)': event.duration,\n 'Course (7106)': syllabus?.courseCode,\n 'Subject (7103)': syllabus?.subjectCode ?? course?.subject ?? '',\n 'Teacher (7104)': teachers ?.map(x => x?.signature ).filter(Boolean).join(','),\n 'Group (7105)': groups ?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Room (7107)': locations?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Period (7108)': '',\n 'Week (7109)': '',\n 'ActualWeeks (7167)': period?.ranges?.map(range => `${moment.utc(range.start).week()}-${moment.utc(range.end).week()}`).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Lesson (7100)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (e.length) {\n csv += Papa.unparse(e, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append subjects to csv, is empty for now\n // csv += `Subject (6400)${options.newline}[Rows]${options.newline}`;\n // csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(options.delimiter);\n // csv += options.newline;\n\n // append syllabus to csv\n const courseSyllabuses = syllabuses?.filter(syllabus => !!syllabus.courseName).map(syllabus => {\n return {\n 'Course (7601)': syllabus.courseCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (7602)': syllabus.courseName,\n 'Subject (7603)': syllabus.subjectCode ?? '',\n 'Points (7604)': syllabus.points\n };\n }) ?? [];\n csv += `${papaOptions.newline}Course (7600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (courseSyllabuses.length) {\n csv += Papa.unparse(courseSyllabuses, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const subjectSyllabuses = syllabuses?.reduce((unique, syllabus) => {\n if (syllabus.subjectCode && !unique.seen.has(syllabus.subjectCode)) {\n unique.seen.add(syllabus.subjectCode);\n unique.result.push({\n 'Subject (6401)': syllabus.subjectCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (6403)': syllabus.subjectName,\n });\n }\n return unique;\n }, {\n seen: new Set<string>(),\n result: [] as Array<{\n 'Subject (6401)': string;\n 'GUID (5800)': string | undefined;\n 'FullText (6403)': string;\n }>\n })?.result ?? [];\n csv += `Subject (6400)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (subjectSyllabuses.length) {\n csv += Papa.unparse(subjectSyllabuses, papaOptions);\n } else {\n csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(papaOptions.delimiter);\n }\n\n const totalHoursRegex = /(\\d+) hrs/;\n const weekTimeRegex = /(\\d+) min\\/week/;\n const c = courses?.map(course => {\n // Only use deserialize teachers\n const teacherIds = course.teachers?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const teachers = teacherIds?.map(id => teacherMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const groupIds = course.groups?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const groups = groupIds?.map(id => groupMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize syllabus\n const syllabusId = isString(course?.syllabus) ? course.syllabus : (course?.syllabus && isObjectIdOrHexString(course?.syllabus)) ? (course?.syllabus as MongooseTypes.ObjectId | string).toString() : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n return {\n 'PK (8200)': '',\n 'GUID (5800)': course.ids,\n 'OriginalRecord (8224)': '1',\n 'CreateLesson (8227)': '1',\n 'Course (8202)': syllabus?.courseCode,\n 'Subject (8209)': syllabus?.subjectCode ?? course.subject, // Nikos ansvarig för framtida buggar\n 'Teacher (8210)': teachers?.map(teacher => teacher.signature).filter(Boolean).join(','),\n 'Group (8203)': groups?.map(group => group.displayName).filter(Boolean).join(','),\n 'TotalHours (8204)': (course.plannedDuration && totalHoursRegex.test(course.plannedDuration)) ? totalHoursRegex.exec(course.plannedDuration)![1] : '',\n 'Weektime (8208)': (course.plannedDuration && weekTimeRegex.test(course.plannedDuration)) ? weekTimeRegex.exec(course.plannedDuration)![1] : '',\n 'Blockname (8215)': '',\n 'Period (8206)': '',\n 'Week (8207)': '',\n 'NotPeriod (8212)': '',\n 'NotWeek (8213)': ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}TA (8200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (c.length) {\n csv += Papa.unparse(c, papaOptions);\n } else {\n csv += ['Course (8202)', 'GUID (5800)', 'Subject (8209)', 'Teacher (8210)', 'Group (8203)', 'TotalHours (8204)', 'Weektime (8208)', 'Blockname (8215)', 'Period (8206)', 'Week (8207)', 'NotPeriod (8212)', 'NotWeek (8213)'].join(papaOptions.delimiter);\n }\n\n return csv;\n};"],"mappings":";;;;;;;AASA,MAAM,cAAc;CAClB,QAAgB;CAChB,WAAgB;CAChB,YAAgB;CAChB,WAAgB;CAChB,QAAgB;CAChB,SAAgB;CAChB,gBAAgB;;AAIlB,MAAM,OAAO;AAEb,yBACE,MACA,UAAuB,OACZ;CACX,MAAM,EAAE,WAAW,UAAU,QAAQ,SAAS,QAAQ,SAAS,SAAS,YAAY,cAAc;CAClG,MAAM,EAAE,OAAkB,gBAAgB,aAAa;CAEvD,MAAM,YAAa,OAAO,IAAI,OAAO;CACrC,MAAM,aAAa,OAAO,IAAI,OAAO;CAGrC,IAAI,MAAM,WAAW,YA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zD,kBAAyBF,YAAU,KAAI,YAAW,QAAQ,WAAW,OAAO,SAAS,KAAK;GAC1F,gBAAyBE,UAAQ,KAAI,UAAS,MAAM,aAAa,OAAO,SAAS,KAAK;GACtF,qBAA0B,OAAO,mBAAmB,gBAAgB,KAAK,OAAO,mBAAoB,gBAAgB,KAAK,OAAO,iBAAkB,KAAK;GACvJ,mBAA0B,OAAO,mBAAmB,cAAc,KAAK,OAAO,mBAAoB,cAAc,KAAK,OAAO,iBAAkB,KAAK;GACnJ,oBAAyB;GACzB,iBAAyB;GACzB,eAAyB;GACzB,oBAAyB;GACzB,kBAAyB;;OAEvB;AACN,QAAO,GAAG,YAAY,QAAQ,WAAW,YAAY,QAAQ,QAAQ,YAAY;AACjF,KAAI,EAAE,OACJ,QAAO,KAAK,QAAQ,GAAG;KAEvB,QAAO;EAAC;EAAiB;EAAe;EAAkB;EAAkB;EAAgB;EAAqB;EAAmB;EAAoB;EAAiB;EAAe;EAAoB;GAAkB,KAAK,YAAY;AAGjP,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":[],"sources":["../../src/common/constants.ts"],"sourcesContent":["import moment from 'moment';\n\nexport const Constants = {\n FIRST_DAY: moment.utc('1970-01-05')\n};"],"mappings":";;;AAEA,MAAa,YAAY,EACvB,WAAW,OAAO,IAAI,aAAa,EACpC"}
1
+ {"version":3,"file":"constants.js","names":[],"sources":["../../src/common/constants.ts"],"sourcesContent":["import moment from 'moment';\n\nexport const Constants = {\n FIRST_DAY: moment.utc('1970-01-05')\n};"],"mappings":";;;AAEA,MAAa,YAAY,EACvB,WAAW,OAAO,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"functions.js","names":["MongooseTypes","range"],"sources":["../../src/common/functions.ts"],"sourcesContent":["import moment from 'moment';\nimport type { DateType } from './types';\nimport { Types as MongooseTypes } from 'mongoose';\n\nexport function toISOString (\n date: DateType | null | undefined\n): string | null {\n if (typeof date === 'string') return date;\n if (date instanceof Date ) return date.toISOString();\n if (moment.isMoment(date) ) return date.toISOString();\n return null;\n}\n\n\n/**\n * Check if value is a Mongoose ObjectId.\n */\nexport function isMongooseObjectId (value: unknown): value is MongooseTypes.ObjectId {\n return value instanceof MongooseTypes.ObjectId;\n}\n\nexport type Range = {\n start: moment.Moment;\n end: moment.Moment;\n};\n\nexport namespace range {\n export type Type = Range;\n\n /**\n * Create a date range.\n */\n export function create (start: DateType, end: DateType): Range {\n return {\n start: moment(start),\n end: moment(end ),\n };\n }\n\n /**\n * Clone a date range.\n */\n export function clone (range: Range): Range {\n return {\n start: range.start.clone(),\n end: range.end .clone(),\n };\n }\n\n /**\n * Check if a date is contained within a date range.\n */\n export function contains (range: Range, date: moment.Moment) {\n return !date.isBefore(range.start) && !date.isAfter(range.end);\n }\n\n /**\n * Check if two date ranges overlap.\n */\n export function overlaps (a: Range, b: Range): boolean;\n /**\n * Checks if there is any overlap between two arrays of date ranges.\n */\n export function overlaps (a: Range[], b: Range[]): boolean;\n export function overlaps (a: Range | Range[], b: Range | Range[]) {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.some(x => b.some(y => overlaps(x, y)));\n }\n if (!Array.isArray(a) && !Array.isArray(b)) {\n return !(a.end.isBefore(b.start) || a.start.isAfter(b.end));\n }\n throw new Error('Invalid arguments for range.overlaps');\n }\n\n\n\n /**\n * Check if two date ranges are equal.\n */\n export function isEqual (a: Range, b: Range) {\n return a.start.isSame(b.start) && a.end.isSame(b.end);\n }\n\n /**\n * Get intersection of two ranges, or null if they do not overlap.\n */\n export function intersect (a: Range, b: Range): Range | null {\n const start = moment.max(a.start, b.start);\n const end = moment.min(a.end, b.end );\n if (start.isAfter(end)) return null;\n return { start, end };\n }\n}"],"mappings":";;;;AAIA,SAAgB,YACd,MACe;AACf,KAAI,OAAO,SAAS,SAAU,QAAO;AACrC,KAAI,gBAAgB,KAAU,QAAO,KAAK,aAAa;AACvD,KAAI,OAAO,SAAS,KAAK,CAAK,QAAO,KAAK,aAAa;AACvD,QAAO;;;;;AAOT,SAAgB,mBAAoB,OAAiD;AACnF,QAAO,iBAAiBA,MAAc;;;;CAc/B,SAAS,OAAQ,OAAiB,KAAsB;AAC7D,SAAO;GACL,OAAO,OAAO,MAAM;GACpB,KAAO,OAAO,IAAM;GACrB;;;CAMI,SAAS,MAAO,SAAqB;AAC1C,SAAO;GACL,OAAOC,QAAM,MAAM,OAAO;GAC1B,KAAOA,QAAM,IAAM,OAAO;GAC3B;;;CAMI,SAAS,SAAU,SAAc,MAAqB;AAC3D,SAAO,CAAC,KAAK,SAASA,QAAM,MAAM,IAAI,CAAC,KAAK,QAAQA,QAAM,IAAI;;;CAWzD,SAAS,SAAU,GAAoB,GAAoB;AAChE,MAAI,MAAM,QAAQ,EAAE,IAAI,MAAM,QAAQ,EAAE,CACtC,QAAO,EAAE,MAAK,MAAK,EAAE,MAAK,MAAK,SAAS,GAAG,EAAE,CAAC,CAAC;AAEjD,MAAI,CAAC,MAAM,QAAQ,EAAE,IAAI,CAAC,MAAM,QAAQ,EAAE,CACxC,QAAO,EAAE,EAAE,IAAI,SAAS,EAAE,MAAM,IAAI,EAAE,MAAM,QAAQ,EAAE,IAAI;AAE5D,QAAM,IAAI,MAAM,uCAAuC;;;CAQlD,SAAS,QAAS,GAAU,GAAU;AAC3C,SAAO,EAAE,MAAM,OAAO,EAAE,MAAM,IAAI,EAAE,IAAI,OAAO,EAAE,IAAI;;;CAMhD,SAAS,UAAW,GAAU,GAAwB;EAC3D,MAAM,QAAQ,OAAO,IAAI,EAAE,OAAO,EAAE,MAAM;EAC1C,MAAM,MAAQ,OAAO,IAAI,EAAE,KAAO,EAAE,IAAM;AAC1C,MAAI,MAAM,QAAQ,IAAI,CAAE,QAAO;AAC/B,SAAO;GAAE;GAAO;GAAK"}
1
+ {"version":3,"file":"functions.js","names":["MongooseTypes","range"],"sources":["../../src/common/functions.ts"],"sourcesContent":["import moment from 'moment';\nimport type { DateType } from './types';\nimport { Types as MongooseTypes } from 'mongoose';\n\nexport function toISOString (\n date: DateType | null | undefined\n): string | null {\n if (typeof date === 'string') return date;\n if (date instanceof Date ) return date.toISOString();\n if (moment.isMoment(date) ) return date.toISOString();\n return null;\n}\n\n\n/**\n * Check if value is a Mongoose ObjectId.\n */\nexport function isMongooseObjectId (value: unknown): value is MongooseTypes.ObjectId {\n return value instanceof MongooseTypes.ObjectId;\n}\n\nexport type Range = {\n start: moment.Moment;\n end: moment.Moment;\n};\n\nexport namespace range {\n export type Type = Range;\n\n /**\n * Create a date range.\n */\n export function create (start: DateType, end: DateType): Range {\n return {\n start: moment(start),\n end: moment(end ),\n };\n }\n\n /**\n * Clone a date range.\n */\n export function clone (range: Range): Range {\n return {\n start: range.start.clone(),\n end: range.end .clone(),\n };\n }\n\n /**\n * Check if a date is contained within a date range.\n */\n export function contains (range: Range, date: moment.Moment) {\n return !date.isBefore(range.start) && !date.isAfter(range.end);\n }\n\n /**\n * Check if two date ranges overlap.\n */\n export function overlaps (a: Range, b: Range): boolean;\n /**\n * Checks if there is any overlap between two arrays of date ranges.\n */\n export function overlaps (a: Range[], b: Range[]): boolean;\n export function overlaps (a: Range | Range[], b: Range | Range[]) {\n if (Array.isArray(a) && Array.isArray(b)) {\n return a.some(x => b.some(y => overlaps(x, y)));\n }\n if (!Array.isArray(a) && !Array.isArray(b)) {\n return !(a.end.isBefore(b.start) || a.start.isAfter(b.end));\n }\n throw new Error('Invalid arguments for range.overlaps');\n }\n\n\n\n /**\n * Check if two date ranges are equal.\n */\n export function isEqual (a: Range, b: Range) {\n return a.start.isSame(b.start) && a.end.isSame(b.end);\n }\n\n /**\n * Get intersection of two ranges, or null if they do not overlap.\n */\n export function intersect (a: Range, b: Range): Range | null {\n const start = moment.max(a.start, b.start);\n const end = moment.min(a.end, b.end );\n if (start.isAfter(end)) return null;\n return { start, end };\n }\n}"],"mappings":";;;;AAIA,SAAgB,YACd,MACe;AACf,KAAI,OAAO,SAAS,SAAU,QAAO;AACrC,KAAI,gBAAgB,KAAU,QAAO,KAAK;AAC1C,KAAI,OAAO,SAAS,MAAU,QAAO,KAAK;AAC1C,QAAO;;;;;AAOT,SAAgB,mBAAoB,OAAiD;AACnF,QAAO,iBAAiBA,MAAc;;;;CAc/B,SAAS,OAAQ,OAAiB,KAAsB;AAC7D,SAAO;GACL,OAAO,OAAO;GACd,KAAO,OAAO;;;;CAOX,SAAS,MAAO,SAAqB;AAC1C,SAAO;GACL,OAAOC,QAAM,MAAM;GACnB,KAAOA,QAAM,IAAM;;;;CAOhB,SAAS,SAAU,SAAc,MAAqB;AAC3D,SAAO,CAAC,KAAK,SAASA,QAAM,UAAU,CAAC,KAAK,QAAQA,QAAM;;;CAWrD,SAAS,SAAU,GAAoB,GAAoB;AAChE,MAAI,MAAM,QAAQ,MAAM,MAAM,QAAQ,GACpC,QAAO,EAAE,MAAK,MAAK,EAAE,MAAK,MAAK,SAAS,GAAG;AAE7C,MAAI,CAAC,MAAM,QAAQ,MAAM,CAAC,MAAM,QAAQ,GACtC,QAAO,EAAE,EAAE,IAAI,SAAS,EAAE,UAAU,EAAE,MAAM,QAAQ,EAAE;AAExD,QAAM,IAAI,MAAM;;;CAQX,SAAS,QAAS,GAAU,GAAU;AAC3C,SAAO,EAAE,MAAM,OAAO,EAAE,UAAU,EAAE,IAAI,OAAO,EAAE;;;CAM5C,SAAS,UAAW,GAAU,GAAwB;EAC3D,MAAM,QAAQ,OAAO,IAAI,EAAE,OAAO,EAAE;EACpC,MAAM,MAAQ,OAAO,IAAI,EAAE,KAAO,EAAE;AACpC,MAAI,MAAM,QAAQ,KAAM,QAAO;AAC/B,SAAO;GAAE;GAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-date.js","names":[],"sources":["../../src/common/get-date.ts"],"sourcesContent":["import type { Moment } from 'moment';\nimport type { CoreTypes } from '../core';\nimport { Constants } from './constants';\n\nexport default (day: number | CoreTypes.day, time: string): Moment => {\n if (day == null) throw new Error('Day is null or undefined');\n\n const _day = typeof day == 'number' ? day : day.day;\n const [hours, minutes] = time.split(':').map(x => parseInt(x));\n\n const date = Constants.FIRST_DAY.clone()\n .add(_day, 'day')\n .set('hour', hours)\n .set('minute', minutes);\n\n if (!date.isValid()) throw new Error(`Day ${ _day } and time ${ time } is not a valid date`);\n\n return date;\n};"],"mappings":";;;AAIA,wBAAgB,KAA6B,SAAyB;AACpE,KAAI,OAAO,KAAM,OAAM,IAAI,MAAM,2BAA2B;CAE5D,MAAM,OAAO,OAAO,OAAO,WAAW,MAAM,IAAI;CAChD,MAAM,CAAC,OAAO,WAAW,KAAK,MAAM,IAAI,CAAC,KAAI,MAAK,SAAS,EAAE,CAAC;CAE9D,MAAM,OAAO,UAAU,UAAU,OAAO,CACrC,IAAI,MAAM,MAAM,CAChB,IAAI,QAAQ,MAAM,CAClB,IAAI,UAAU,QAAQ;AAEzB,KAAI,CAAC,KAAK,SAAS,CAAE,OAAM,IAAI,MAAM,OAAQ,KAAM,YAAa,KAAM,sBAAsB;AAE5F,QAAO"}
1
+ {"version":3,"file":"get-date.js","names":[],"sources":["../../src/common/get-date.ts"],"sourcesContent":["import type { Moment } from 'moment';\nimport type { CoreTypes } from '../core';\nimport { Constants } from './constants';\n\nexport default (day: number | CoreTypes.day, time: string): Moment => {\n if (day == null) throw new Error('Day is null or undefined');\n\n const _day = typeof day == 'number' ? day : day.day;\n const [hours, minutes] = time.split(':').map(x => parseInt(x));\n\n const date = Constants.FIRST_DAY.clone()\n .add(_day, 'day')\n .set('hour', hours)\n .set('minute', minutes);\n\n if (!date.isValid()) throw new Error(`Day ${ _day } and time ${ time } is not a valid date`);\n\n return date;\n};"],"mappings":";;;AAIA,wBAAgB,KAA6B,SAAyB;AACpE,KAAI,OAAO,KAAM,OAAM,IAAI,MAAM;CAEjC,MAAM,OAAO,OAAO,OAAO,WAAW,MAAM,IAAI;CAChD,MAAM,CAAC,OAAO,WAAW,KAAK,MAAM,KAAK,KAAI,MAAK,SAAS;CAE3D,MAAM,OAAO,UAAU,UAAU,QAC9B,IAAI,MAAM,OACV,IAAI,QAAQ,OACZ,IAAI,UAAU;AAEjB,KAAI,CAAC,KAAK,UAAW,OAAM,IAAI,MAAM,OAAQ,KAAM,YAAa,KAAM;AAEtE,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_value: T"],"sources":["../../../src/common/make-chainable/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype Fn<In, Out> = (x: In) => Out;\n\nclass Chainable<T> {\n constructor (private _value: T) {}\n\n get value () { return this._value }\n\n chain (): Chainable<T>;\n chain<A1>(fn1: Fn<T, A1>): Chainable<A1>;\n chain<A1, A2>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>): Chainable<A2>;\n chain<A1, A2, A3>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>): Chainable<A3>;\n chain<A1, A2, A3, A4>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>): Chainable<A4>;\n chain<A1, A2, A3, A4, A5>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>): Chainable<A5>;\n chain<A1, A2, A3, A4, A5, A6>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>): Chainable<A6>;\n chain<A1, A2, A3, A4, A5, A6, A7>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>, fn7: Fn<A6, A7>): Chainable<A7>;\n chain<A1, A2, A3, A4, A5, A6, A7, A8>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>, fn7: Fn<A6, A7>, fn8: Fn<A7, A8>): Chainable<A8>;\n chain<A1, A2, A3, A4, A5, A6, A7, A8, A9>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>, fn7: Fn<A6, A7>, fn8: Fn<A7, A8>, fn9: Fn<A8, A9>): Chainable<A9>;\n chain<A1, A2, A3, A4, A5, A6, A7, A8, A9>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>, fn7: Fn<A6, A7>, fn8: Fn<A7, A8>, fn9: Fn<A8, A9>, ...fns: Fn<any, any>[]): Chainable<unknown>;\n chain (...fns: Fn<any, any>[]): Chainable<any> {\n if (fns.length === 0) return this;\n return new Chainable(fns.reduce((prev, fn) => fn(prev), this.value));\n }\n}\n\n/**\n * Wraps a value in a Chainable to build a strongly-typed function pipeline with .chain().\n * Each chained function is applied in order, and the final result is available via .value.\n *\n * @param x - The value to wrap.\n * @returns A Chainable<T> around the given value.\n *\n * @example\n * const result = makeChainable([1, 2, 3])\n * .chain(\n * xs => xs.map(x => x * 2)), // [2, 4, 6]\n * xs => xs.reduce((acc, x) => acc + x, 0) // 12\n * );\n *\n * console.log(result.value); // 12\n */\nexport function makeChainable<T> (x: T) { return new Chainable(x) }\n"],"mappings":";AAIA,IAAM,YAAN,MAAM,UAAa;CACjB,YAAa,AAAQA,QAAW;EAAX;;CAErB,IAAI,QAAS;AAAE,SAAO,KAAK;;CAa3B,MAAO,GAAG,KAAqC;AAC7C,MAAI,IAAI,WAAW,EAAG,QAAO;AAC7B,SAAO,IAAI,UAAU,IAAI,QAAQ,MAAM,OAAO,GAAG,KAAK,EAAE,KAAK,MAAM,CAAC;;;;;;;;;;;;;;;;;;;AAoBxE,SAAgB,cAAkB,GAAM;AAAE,QAAO,IAAI,UAAU,EAAE"}
1
+ {"version":3,"file":"index.js","names":["_value: T"],"sources":["../../../src/common/make-chainable/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-return */\n/* eslint-disable @typescript-eslint/no-explicit-any */\ntype Fn<In, Out> = (x: In) => Out;\n\nclass Chainable<T> {\n constructor (private _value: T) {}\n\n get value () { return this._value }\n\n chain (): Chainable<T>;\n chain<A1>(fn1: Fn<T, A1>): Chainable<A1>;\n chain<A1, A2>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>): Chainable<A2>;\n chain<A1, A2, A3>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>): Chainable<A3>;\n chain<A1, A2, A3, A4>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>): Chainable<A4>;\n chain<A1, A2, A3, A4, A5>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>): Chainable<A5>;\n chain<A1, A2, A3, A4, A5, A6>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>): Chainable<A6>;\n chain<A1, A2, A3, A4, A5, A6, A7>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>, fn7: Fn<A6, A7>): Chainable<A7>;\n chain<A1, A2, A3, A4, A5, A6, A7, A8>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>, fn7: Fn<A6, A7>, fn8: Fn<A7, A8>): Chainable<A8>;\n chain<A1, A2, A3, A4, A5, A6, A7, A8, A9>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>, fn7: Fn<A6, A7>, fn8: Fn<A7, A8>, fn9: Fn<A8, A9>): Chainable<A9>;\n chain<A1, A2, A3, A4, A5, A6, A7, A8, A9>(fn1: Fn<T, A1>, fn2: Fn<A1, A2>, fn3: Fn<A2, A3>, fn4: Fn<A3, A4>, fn5: Fn<A4, A5>, fn6: Fn<A5, A6>, fn7: Fn<A6, A7>, fn8: Fn<A7, A8>, fn9: Fn<A8, A9>, ...fns: Fn<any, any>[]): Chainable<unknown>;\n chain (...fns: Fn<any, any>[]): Chainable<any> {\n if (fns.length === 0) return this;\n return new Chainable(fns.reduce((prev, fn) => fn(prev), this.value));\n }\n}\n\n/**\n * Wraps a value in a Chainable to build a strongly-typed function pipeline with .chain().\n * Each chained function is applied in order, and the final result is available via .value.\n *\n * @param x - The value to wrap.\n * @returns A Chainable<T> around the given value.\n *\n * @example\n * const result = makeChainable([1, 2, 3])\n * .chain(\n * xs => xs.map(x => x * 2)), // [2, 4, 6]\n * xs => xs.reduce((acc, x) => acc + x, 0) // 12\n * );\n *\n * console.log(result.value); // 12\n */\nexport function makeChainable<T> (x: T) { return new Chainable(x) }\n"],"mappings":";AAIA,IAAM,YAAN,MAAM,UAAa;CACjB,YAAa,AAAQA,QAAW;EAAX;;CAErB,IAAI,QAAS;AAAE,SAAO,KAAK;;CAa3B,MAAO,GAAG,KAAqC;AAC7C,MAAI,IAAI,WAAW,EAAG,QAAO;AAC7B,SAAO,IAAI,UAAU,IAAI,QAAQ,MAAM,OAAO,GAAG,OAAO,KAAK;;;;;;;;;;;;;;;;;;;AAoBjE,SAAgB,cAAkB,GAAM;AAAE,QAAO,IAAI,UAAU"}
@@ -1,5 +1,4 @@
1
1
  import { IdKey } from "../core/types/common/index.js";
2
- import "../core/index.js";
3
2
  import { Moment } from "moment";
4
3
 
5
4
  //#region src/common/types.d.ts
@@ -11,6 +10,9 @@ type Intersect<T> = (T extends any ? ((x: T) => 0) : never) extends ((x: infer R
11
10
  type BaseOptions = {
12
11
  idKey?: IdKey;
13
12
  };
13
+ /**
14
+ * The interface required for the "from" mapping functions.
15
+ */
14
16
  //#endregion
15
17
  export { BaseOptions, Intersect };
16
18
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"configurations.js","names":[],"sources":["../../../src/core/from/configurations.ts"],"sourcesContent":["import type transform from '../to/configurations';\n\nexport default (configurations: ReturnType<typeof transform>) => {\n if (configurations.length != new Set(configurations.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Configurations) Configuration array have two or more configurations with the same ID');\n\n return configurations\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Configurations) Configuration id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,8BAAgB,mBAAiD;AAC/D,KAAI,eAAe,UAAU,IAAI,IAAI,eAAe,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KAClE,OAAM,IAAI,MAAM,wGAAwG;AAE1H,QAAO,eACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,iEAAiE;AAEnF,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"configurations.js","names":[],"sources":["../../../src/core/from/configurations.ts"],"sourcesContent":["import type transform from '../to/configurations';\n\nexport default (configurations: ReturnType<typeof transform>) => {\n if (configurations.length != new Set(configurations.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Configurations) Configuration array have two or more configurations with the same ID');\n\n return configurations\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Configurations) Configuration id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,8BAAgB,mBAAiD;AAC/D,KAAI,eAAe,UAAU,IAAI,IAAI,eAAe,KAAI,MAAK,EAAE,KAAK,KAClE,OAAM,IAAI,MAAM;AAElB,QAAO,eACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"courses.js","names":[],"sources":["../../../src/core/from/courses.ts"],"sourcesContent":["import type transform from '../to/courses';\n\nexport default (courses: ReturnType<typeof transform>) => {\n if (courses.length != new Set(courses.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Courses) Course array have two or more courses with the same ID');\n\n return courses\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Courses) Course id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,uBAAgB,YAA0C;AACxD,KAAI,QAAQ,UAAU,IAAI,IAAI,QAAQ,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KACpD,OAAM,IAAI,MAAM,mFAAmF;AAErG,QAAO,QACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,mDAAmD;AAErE,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"courses.js","names":[],"sources":["../../../src/core/from/courses.ts"],"sourcesContent":["import type transform from '../to/courses';\n\nexport default (courses: ReturnType<typeof transform>) => {\n if (courses.length != new Set(courses.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Courses) Course array have two or more courses with the same ID');\n\n return courses\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Courses) Course id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,uBAAgB,YAA0C;AACxD,KAAI,QAAQ,UAAU,IAAI,IAAI,QAAQ,KAAI,MAAK,EAAE,KAAK,KACpD,OAAM,IAAI,MAAM;AAElB,QAAO,QACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"events.js","names":[],"sources":["../../../src/core/from/events.ts"],"sourcesContent":["import type transform from '../to/events';\n\nexport default (events: ReturnType<typeof transform>) => {\n if (events.length != new Set(events.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Events) Events array have two or more events with the same ID');\n\n return events\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Events) Event id is undefined');\n\n // backwards compatibility for file upload: use duration if preferredDuration does not exist\n if (x.duration) x.preferredDuration ??= x.duration;\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,sBAAgB,WAAyC;AACvD,KAAI,OAAO,UAAU,IAAI,IAAI,OAAO,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KAClD,OAAM,IAAI,MAAM,iFAAiF;AAEnG,QAAO,OACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,iDAAiD;AAGnE,MAAI,EAAE,SAAU,GAAE,sBAAsB,EAAE;AAE1C,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"events.js","names":[],"sources":["../../../src/core/from/events.ts"],"sourcesContent":["import type transform from '../to/events';\n\nexport default (events: ReturnType<typeof transform>) => {\n if (events.length != new Set(events.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Events) Events array have two or more events with the same ID');\n\n return events\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Events) Event id is undefined');\n\n // backwards compatibility for file upload: use duration if preferredDuration does not exist\n if (x.duration) x.preferredDuration ??= x.duration;\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,sBAAgB,WAAyC;AACvD,KAAI,OAAO,UAAU,IAAI,IAAI,OAAO,KAAI,MAAK,EAAE,KAAK,KAClD,OAAM,IAAI,MAAM;AAElB,QAAO,OACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAGlB,MAAI,EAAE,SAAU,GAAE,sBAAsB,EAAE;AAE1C,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"exceptions.js","names":[],"sources":["../../../src/core/from/exceptions.ts"],"sourcesContent":["import type transform from '../to/exceptions';\n\nexport default (exceptions: ReturnType<typeof transform>) => {\n if (exceptions.length != new Set(exceptions.map(x => x.id)).size)\n throw new Error('(Core::From::V2::exceptions) exceptions array have two or more exceptions with the same ID');\n\n return exceptions\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::exceptions) Calendar exceptions id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,0BAAgB,eAA6C;AAC3D,KAAI,WAAW,UAAU,IAAI,IAAI,WAAW,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KAC1D,OAAM,IAAI,MAAM,6FAA6F;AAE/G,QAAO,WACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,mEAAmE;AAErF,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"exceptions.js","names":[],"sources":["../../../src/core/from/exceptions.ts"],"sourcesContent":["import type transform from '../to/exceptions';\n\nexport default (exceptions: ReturnType<typeof transform>) => {\n if (exceptions.length != new Set(exceptions.map(x => x.id)).size)\n throw new Error('(Core::From::V2::exceptions) exceptions array have two or more exceptions with the same ID');\n\n return exceptions\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::exceptions) Calendar exceptions id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,0BAAgB,eAA6C;AAC3D,KAAI,WAAW,UAAU,IAAI,IAAI,WAAW,KAAI,MAAK,EAAE,KAAK,KAC1D,OAAM,IAAI,MAAM;AAElB,QAAO,WACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"groups.js","names":[],"sources":["../../../src/core/from/groups.ts"],"sourcesContent":["import type transform from '../to/groups';\n\nexport default (groups: ReturnType<typeof transform>) => {\n if (groups.length != new Set(groups.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Groups) Groups array have two or more groups with the same ID');\n\n return groups\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Groups) Group id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,sBAAgB,WAAyC;AACvD,KAAI,OAAO,UAAU,IAAI,IAAI,OAAO,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KAClD,OAAM,IAAI,MAAM,iFAAiF;AAEnG,QAAO,OACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,iDAAiD;AAEnE,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"groups.js","names":[],"sources":["../../../src/core/from/groups.ts"],"sourcesContent":["import type transform from '../to/groups';\n\nexport default (groups: ReturnType<typeof transform>) => {\n if (groups.length != new Set(groups.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Groups) Groups array have two or more groups with the same ID');\n\n return groups\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Groups) Group id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,sBAAgB,WAAyC;AACvD,KAAI,OAAO,UAAU,IAAI,IAAI,OAAO,KAAI,MAAK,EAAE,KAAK,KAClD,OAAM,IAAI,MAAM;AAElB,QAAO,OACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_schedules"],"sources":["../../../src/core/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport type { Types } from '../types';\nimport _schedules from './schedules';\n\n\nfunction division (data: unknown): Pick<Types.Serialized.Division, 'displayName' | 'start' | 'end'> | undefined {\n\n if ( !data || typeof data !== 'object'\n || !('division' in data) || !data.division || typeof data.division !== 'object'\n ) return;\n\n const d = data.division;\n if (!('displayName' in d && typeof d.displayName == 'string')) return;\n if (!('start' in d && typeof d.start == 'string')) return;\n if (!('end' in d && typeof d.end == 'string')) return;\n\n return {\n displayName: d.displayName,\n start: d.start,\n end: d.end\n };\n}\n\nexport default {\n division: division,\n schedules: _schedules\n} satisfies FromInterface;"],"mappings":";;;AAKA,SAAS,SAAU,MAA6F;AAE9G,KAA8B,CAAC,QAAiB,OAAO,SAAkB,YACpE,EAAE,cAAc,SAAS,CAAC,KAAK,YAAY,OAAO,KAAK,aAAa,SACvE;CAEF,MAAM,IAAI,KAAK;AACf,KAAI,EAAE,iBAAiB,KAAK,OAAO,EAAE,eAAe,UAAW;AAC/D,KAAI,EAAE,WAAiB,KAAK,OAAO,EAAE,SAAe,UAAW;AAC/D,KAAI,EAAE,SAAiB,KAAK,OAAO,EAAE,OAAe,UAAW;AAE/D,QAAO;EACL,aAAa,EAAE;EACf,OAAa,EAAE;EACf,KAAa,EAAE;EAChB;;AAGH,mBAAe;CACF;CACX,WAAWA;CACZ"}
1
+ {"version":3,"file":"index.js","names":["_schedules"],"sources":["../../../src/core/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport type { Types } from '../types';\nimport _schedules from './schedules';\n\n\nfunction division (data: unknown): Pick<Types.Serialized.Division, 'displayName' | 'start' | 'end'> | undefined {\n\n if ( !data || typeof data !== 'object'\n || !('division' in data) || !data.division || typeof data.division !== 'object'\n ) return;\n\n const d = data.division;\n if (!('displayName' in d && typeof d.displayName == 'string')) return;\n if (!('start' in d && typeof d.start == 'string')) return;\n if (!('end' in d && typeof d.end == 'string')) return;\n\n return {\n displayName: d.displayName,\n start: d.start,\n end: d.end\n };\n}\n\nexport default {\n division: division,\n schedules: _schedules\n} satisfies FromInterface;"],"mappings":";;;AAKA,SAAS,SAAU,MAA6F;AAE9G,KAA8B,CAAC,QAAiB,OAAO,SAAkB,YACpE,EAAE,cAAc,SAAS,CAAC,KAAK,YAAY,OAAO,KAAK,aAAa,SACvE;CAEF,MAAM,IAAI,KAAK;AACf,KAAI,EAAE,iBAAiB,KAAK,OAAO,EAAE,eAAe,UAAW;AAC/D,KAAI,EAAE,WAAiB,KAAK,OAAO,EAAE,SAAe,UAAW;AAC/D,KAAI,EAAE,SAAiB,KAAK,OAAO,EAAE,OAAe,UAAW;AAE/D,QAAO;EACL,aAAa,EAAE;EACf,OAAa,EAAE;EACf,KAAa,EAAE;;;AAInB,mBAAe;CACF;CACX,WAAWA"}
@@ -1 +1 @@
1
- {"version":3,"file":"locations.js","names":[],"sources":["../../../src/core/from/locations.ts"],"sourcesContent":["import type transform from '../to/locations';\n\nexport default (locations: ReturnType<typeof transform>) => {\n if (locations.length != new Set(locations.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Locations) Location array have two or more locations with the same ID');\n\n return locations\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Locations) Location id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,yBAAgB,cAA4C;AAC1D,KAAI,UAAU,UAAU,IAAI,IAAI,UAAU,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KACxD,OAAM,IAAI,MAAM,yFAAyF;AAE3G,QAAO,UACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,uDAAuD;AAEzE,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"locations.js","names":[],"sources":["../../../src/core/from/locations.ts"],"sourcesContent":["import type transform from '../to/locations';\n\nexport default (locations: ReturnType<typeof transform>) => {\n if (locations.length != new Set(locations.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Locations) Location array have two or more locations with the same ID');\n\n return locations\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Locations) Location id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,yBAAgB,cAA4C;AAC1D,KAAI,UAAU,UAAU,IAAI,IAAI,UAAU,KAAI,MAAK,EAAE,KAAK,KACxD,OAAM,IAAI,MAAM;AAElB,QAAO,UACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"locked-times.js","names":[],"sources":["../../../src/core/from/locked-times.ts"],"sourcesContent":["import type transform from '../to/locked-times';\n\nexport default (LockedTimes: ReturnType<typeof transform>) => {\n if (LockedTimes.length != new Set(LockedTimes.map(x => x.id)).size)\n throw new Error('(Core::From::V2::LockedTimes) LockedTimes array have two or more LockedTimes with the same ID');\n\n return LockedTimes\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::LockedTimes) Locked time id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,4BAAgB,gBAA8C;AAC5D,KAAI,YAAY,UAAU,IAAI,IAAI,YAAY,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KAC5D,OAAM,IAAI,MAAM,gGAAgG;AAElH,QAAO,YACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,4DAA4D;AAE9E,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"locked-times.js","names":[],"sources":["../../../src/core/from/locked-times.ts"],"sourcesContent":["import type transform from '../to/locked-times';\n\nexport default (LockedTimes: ReturnType<typeof transform>) => {\n if (LockedTimes.length != new Set(LockedTimes.map(x => x.id)).size)\n throw new Error('(Core::From::V2::LockedTimes) LockedTimes array have two or more LockedTimes with the same ID');\n\n return LockedTimes\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::LockedTimes) Locked time id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,4BAAgB,gBAA8C;AAC5D,KAAI,YAAY,UAAU,IAAI,IAAI,YAAY,KAAI,MAAK,EAAE,KAAK,KAC5D,OAAM,IAAI,MAAM;AAElB,QAAO,YACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"overlap-groups.js","names":[],"sources":["../../../src/core/from/overlap-groups.ts"],"sourcesContent":["import type transform from '../to/overlap-groups';\n\nexport default (overlapGroups: ReturnType<typeof transform>) => {\n if (overlapGroups.length != new Set(overlapGroups.map(x => x.id)).size)\n throw new Error('(Core::From::V2::OverlapGroup) overlapGroups array have two or more overlapGroups with the same ID');\n\n return overlapGroups\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::OverlapGroup) Overlap group id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,8BAAgB,kBAAgD;AAC9D,KAAI,cAAc,UAAU,IAAI,IAAI,cAAc,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KAChE,OAAM,IAAI,MAAM,qGAAqG;AAEvH,QAAO,cACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,+DAA+D;AAEjF,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"overlap-groups.js","names":[],"sources":["../../../src/core/from/overlap-groups.ts"],"sourcesContent":["import type transform from '../to/overlap-groups';\n\nexport default (overlapGroups: ReturnType<typeof transform>) => {\n if (overlapGroups.length != new Set(overlapGroups.map(x => x.id)).size)\n throw new Error('(Core::From::V2::OverlapGroup) overlapGroups array have two or more overlapGroups with the same ID');\n\n return overlapGroups\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::OverlapGroup) Overlap group id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,8BAAgB,kBAAgD;AAC9D,KAAI,cAAc,UAAU,IAAI,IAAI,cAAc,KAAI,MAAK,EAAE,KAAK,KAChE,OAAM,IAAI,MAAM;AAElB,QAAO,cACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"periods.js","names":[],"sources":["../../../src/core/from/periods.ts"],"sourcesContent":["import type transform from '../to/periods';\n\nexport default (periods: ReturnType<typeof transform>) => {\n if (periods.length != new Set(periods.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Periods) Periods array have two or more periods with the same ID');\n\n return periods\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Periods) Period id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,uBAAgB,YAA0C;AACxD,KAAI,QAAQ,UAAU,IAAI,IAAI,QAAQ,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KACpD,OAAM,IAAI,MAAM,oFAAoF;AAEtG,QAAO,QACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,mDAAmD;AAErE,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"periods.js","names":[],"sources":["../../../src/core/from/periods.ts"],"sourcesContent":["import type transform from '../to/periods';\n\nexport default (periods: ReturnType<typeof transform>) => {\n if (periods.length != new Set(periods.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Periods) Periods array have two or more periods with the same ID');\n\n return periods\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Periods) Period id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,uBAAgB,YAA0C;AACxD,KAAI,QAAQ,UAAU,IAAI,IAAI,QAAQ,KAAI,MAAK,EAAE,KAAK,KACpD,OAAM,IAAI,MAAM;AAElB,QAAO,QACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"persons.js","names":[],"sources":["../../../src/core/from/persons.ts"],"sourcesContent":["import type transform from '../to/persons';\n\nexport default (persons: ReturnType<typeof transform>) => {\n if (persons.length != new Set(persons.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Persons) Persons array have two or more persons with the same ID');\n\n return persons\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Persons) Person id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,uBAAgB,YAA0C;AACxD,KAAI,QAAQ,UAAU,IAAI,IAAI,QAAQ,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KACpD,OAAM,IAAI,MAAM,oFAAoF;AAEtG,QAAO,QACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,mDAAmD;AAErE,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"persons.js","names":[],"sources":["../../../src/core/from/persons.ts"],"sourcesContent":["import type transform from '../to/persons';\n\nexport default (persons: ReturnType<typeof transform>) => {\n if (persons.length != new Set(persons.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Persons) Persons array have two or more persons with the same ID');\n\n return persons\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Persons) Person id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,uBAAgB,YAA0C;AACxD,KAAI,QAAQ,UAAU,IAAI,IAAI,QAAQ,KAAI,MAAK,EAAE,KAAK,KACpD,OAAM,IAAI,MAAM;AAElB,QAAO,QACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"root-intervals.js","names":[],"sources":["../../../src/core/from/root-intervals.ts"],"sourcesContent":["import type transform from '../to/root-intervals';\n\nexport default (rootIntervals: ReturnType<typeof transform>) => {\n if (rootIntervals.length != new Set(rootIntervals.map(x => x.id)).size)\n throw new Error('(Core::From::V2::RootIntervals) RootInterval array have two or more root intervals with the same ID');\n\n return rootIntervals\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::RootIntervals) RootInterval id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,8BAAgB,kBAAgD;AAC9D,KAAI,cAAc,UAAU,IAAI,IAAI,cAAc,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KAChE,OAAM,IAAI,MAAM,sGAAsG;AAExH,QAAO,cACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,+DAA+D;AAEjF,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"root-intervals.js","names":[],"sources":["../../../src/core/from/root-intervals.ts"],"sourcesContent":["import type transform from '../to/root-intervals';\n\nexport default (rootIntervals: ReturnType<typeof transform>) => {\n if (rootIntervals.length != new Set(rootIntervals.map(x => x.id)).size)\n throw new Error('(Core::From::V2::RootIntervals) RootInterval array have two or more root intervals with the same ID');\n\n return rootIntervals\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::RootIntervals) RootInterval id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,8BAAgB,kBAAgD;AAC9D,KAAI,cAAc,UAAU,IAAI,IAAI,cAAc,KAAI,MAAK,EAAE,KAAK,KAChE,OAAM,IAAI,MAAM;AAElB,QAAO,cACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["_settings","_periods","_groups","_teachers","_persons","_locations","_courses","_events","_overlapGroups","_lockedTimes","_rootIntervals","_exceptions","_syllabuses","_configurations"],"sources":["../../../src/core/from/schedules.ts"],"sourcesContent":["import _exceptions from './exceptions';\nimport _periods from './periods';\nimport _locations from './locations';\nimport _teachers from './teachers';\nimport _groups from './groups';\nimport _persons from './persons';\nimport _courses from './courses';\nimport _overlapGroups from './overlap-groups';\nimport _lockedTimes from './locked-times';\nimport _rootIntervals from './root-intervals';\nimport _events from './events';\nimport _syllabuses from './syllabuses';\nimport _configurations from './configurations';\nimport _settings from './settings';\nimport type transform from '../to/schedules';\n\nexport default function (schedule: ReturnType<typeof transform>): Omit<ReturnType<typeof transform>, 'meta'> {\n return {\n ...schedule.settings && { settings: _settings (schedule.settings ) },\n ...schedule.periods && { periods: _periods (schedule.periods ) },\n ...schedule.groups && { groups: _groups (schedule.groups ) },\n ...schedule.teachers && { teachers: _teachers (schedule.teachers ) },\n ...schedule.persons && { persons: _persons (schedule.persons ) },\n ...schedule.locations && { locations: _locations (schedule.locations ) },\n ...schedule.courses && { courses: _courses (schedule.courses ) },\n ...schedule.events && { events: _events (schedule.events ) },\n ...schedule.overlapGroups && { overlapGroups: _overlapGroups (schedule.overlapGroups ) },\n ...schedule.lockedTimes && { lockedTimes: _lockedTimes (schedule.lockedTimes ) },\n ...schedule.rootIntervals && { rootIntervals: _rootIntervals (schedule.rootIntervals ) },\n ...schedule.exceptions && { exceptions: _exceptions (schedule.exceptions ) },\n ...schedule.syllabuses && { syllabuses: _syllabuses (schedule.syllabuses ) },\n ...schedule.configurations && { configurations: _configurations(schedule.configurations) }\n };\n}"],"mappings":";;;;;;;;;;;;;;;;AAgBA,2BAAyB,UAAoF;AAC3G,QAAO;EACL,GAAG,SAAS,YAAkB,EAAE,UAAgBA,iBAAgB,SAAS,SAAe,EAAE;EAC1F,GAAG,SAAS,WAAkB,EAAE,SAAgBC,gBAAgB,SAAS,QAAe,EAAE;EAC1F,GAAG,SAAS,UAAkB,EAAE,QAAgBC,eAAgB,SAAS,OAAe,EAAE;EAC1F,GAAG,SAAS,YAAkB,EAAE,UAAgBC,iBAAgB,SAAS,SAAe,EAAE;EAC1F,GAAG,SAAS,WAAkB,EAAE,SAAgBC,gBAAgB,SAAS,QAAe,EAAE;EAC1F,GAAG,SAAS,aAAkB,EAAE,WAAgBC,kBAAgB,SAAS,UAAe,EAAE;EAC1F,GAAG,SAAS,WAAkB,EAAE,SAAgBC,gBAAgB,SAAS,QAAe,EAAE;EAC1F,GAAG,SAAS,UAAkB,EAAE,QAAgBC,eAAgB,SAAS,OAAe,EAAE;EAC1F,GAAG,SAAS,iBAAkB,EAAE,eAAgBC,uBAAgB,SAAS,cAAe,EAAE;EAC1F,GAAG,SAAS,eAAkB,EAAE,aAAgBC,qBAAgB,SAAS,YAAe,EAAE;EAC1F,GAAG,SAAS,iBAAkB,EAAE,eAAgBC,uBAAgB,SAAS,cAAe,EAAE;EAC1F,GAAG,SAAS,cAAkB,EAAE,YAAgBC,mBAAgB,SAAS,WAAe,EAAE;EAC1F,GAAG,SAAS,cAAkB,EAAE,YAAgBC,mBAAgB,SAAS,WAAe,EAAE;EAC1F,GAAG,SAAS,kBAAkB,EAAE,gBAAgBC,uBAAgB,SAAS,eAAe,EAAE;EAC3F"}
1
+ {"version":3,"file":"schedules.js","names":["_settings","_periods","_groups","_teachers","_persons","_locations","_courses","_events","_overlapGroups","_lockedTimes","_rootIntervals","_exceptions","_syllabuses","_configurations"],"sources":["../../../src/core/from/schedules.ts"],"sourcesContent":["import _exceptions from './exceptions';\nimport _periods from './periods';\nimport _locations from './locations';\nimport _teachers from './teachers';\nimport _groups from './groups';\nimport _persons from './persons';\nimport _courses from './courses';\nimport _overlapGroups from './overlap-groups';\nimport _lockedTimes from './locked-times';\nimport _rootIntervals from './root-intervals';\nimport _events from './events';\nimport _syllabuses from './syllabuses';\nimport _configurations from './configurations';\nimport _settings from './settings';\nimport type transform from '../to/schedules';\n\nexport default function (schedule: ReturnType<typeof transform>): Omit<ReturnType<typeof transform>, 'meta'> {\n return {\n ...schedule.settings && { settings: _settings (schedule.settings ) },\n ...schedule.periods && { periods: _periods (schedule.periods ) },\n ...schedule.groups && { groups: _groups (schedule.groups ) },\n ...schedule.teachers && { teachers: _teachers (schedule.teachers ) },\n ...schedule.persons && { persons: _persons (schedule.persons ) },\n ...schedule.locations && { locations: _locations (schedule.locations ) },\n ...schedule.courses && { courses: _courses (schedule.courses ) },\n ...schedule.events && { events: _events (schedule.events ) },\n ...schedule.overlapGroups && { overlapGroups: _overlapGroups (schedule.overlapGroups ) },\n ...schedule.lockedTimes && { lockedTimes: _lockedTimes (schedule.lockedTimes ) },\n ...schedule.rootIntervals && { rootIntervals: _rootIntervals (schedule.rootIntervals ) },\n ...schedule.exceptions && { exceptions: _exceptions (schedule.exceptions ) },\n ...schedule.syllabuses && { syllabuses: _syllabuses (schedule.syllabuses ) },\n ...schedule.configurations && { configurations: _configurations(schedule.configurations) }\n };\n}"],"mappings":";;;;;;;;;;;;;;;;AAgBA,2BAAyB,UAAoF;AAC3G,QAAO;EACL,GAAG,SAAS,YAAkB,EAAE,UAAgBA,iBAAgB,SAAS;EACzE,GAAG,SAAS,WAAkB,EAAE,SAAgBC,gBAAgB,SAAS;EACzE,GAAG,SAAS,UAAkB,EAAE,QAAgBC,eAAgB,SAAS;EACzE,GAAG,SAAS,YAAkB,EAAE,UAAgBC,iBAAgB,SAAS;EACzE,GAAG,SAAS,WAAkB,EAAE,SAAgBC,gBAAgB,SAAS;EACzE,GAAG,SAAS,aAAkB,EAAE,WAAgBC,kBAAgB,SAAS;EACzE,GAAG,SAAS,WAAkB,EAAE,SAAgBC,gBAAgB,SAAS;EACzE,GAAG,SAAS,UAAkB,EAAE,QAAgBC,eAAgB,SAAS;EACzE,GAAG,SAAS,iBAAkB,EAAE,eAAgBC,uBAAgB,SAAS;EACzE,GAAG,SAAS,eAAkB,EAAE,aAAgBC,qBAAgB,SAAS;EACzE,GAAG,SAAS,iBAAkB,EAAE,eAAgBC,uBAAgB,SAAS;EACzE,GAAG,SAAS,cAAkB,EAAE,YAAgBC,mBAAgB,SAAS;EACzE,GAAG,SAAS,cAAkB,EAAE,YAAgBC,mBAAgB,SAAS;EACzE,GAAG,SAAS,kBAAkB,EAAE,gBAAgBC,uBAAgB,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"settings.js","names":[],"sources":["../../../src/core/from/settings.ts"],"sourcesContent":["import moment from 'moment';\nimport type transform from '../to/settings';\n\nexport default (settings: ReturnType<typeof transform>) => {\n\n settings.calendarExceptions = settings.calendarExceptions?.map(exception => {\n // the start time should not be later than 23:55 of the specified date\n let start = moment.utc(exception.start);\n if (start.hour() === 23 && start.minute() > 55) start = start.minute(55);\n\n // the end time should not be before 00:05 of the specified date, in such a case set it to the end of day\n // (this has to do with backwards compatibility with older versions)\n let end = moment.utc(exception.end);\n if (end.hour() === 0 && end.minute() < 5) end = end.endOf('day');\n\n return { ...exception, start, end };\n });\n\n return settings;\n};\n"],"mappings":";;;AAGA,wBAAgB,aAA2C;AAEzD,UAAS,qBAAqB,SAAS,oBAAoB,KAAI,cAAa;EAE1E,IAAI,QAAQ,OAAO,IAAI,UAAU,MAAM;AACvC,MAAI,MAAM,MAAM,KAAK,MAAM,MAAM,QAAQ,GAAG,GAAI,SAAQ,MAAM,OAAO,GAAG;EAIxE,IAAI,MAAM,OAAO,IAAI,UAAU,IAAI;AACnC,MAAI,IAAI,MAAM,KAAK,KAAK,IAAI,QAAQ,GAAG,EAAG,OAAM,IAAI,MAAM,MAAM;AAEhE,SAAO;GAAE,GAAG;GAAW;GAAO;GAAK;GACnC;AAEF,QAAO"}
1
+ {"version":3,"file":"settings.js","names":[],"sources":["../../../src/core/from/settings.ts"],"sourcesContent":["import moment from 'moment';\nimport type transform from '../to/settings';\n\nexport default (settings: ReturnType<typeof transform>) => {\n\n settings.calendarExceptions = settings.calendarExceptions?.map(exception => {\n // the start time should not be later than 23:55 of the specified date\n let start = moment.utc(exception.start);\n if (start.hour() === 23 && start.minute() > 55) start = start.minute(55);\n\n // the end time should not be before 00:05 of the specified date, in such a case set it to the end of day\n // (this has to do with backwards compatibility with older versions)\n let end = moment.utc(exception.end);\n if (end.hour() === 0 && end.minute() < 5) end = end.endOf('day');\n\n return { ...exception, start, end };\n });\n\n return settings;\n};\n"],"mappings":";;;AAGA,wBAAgB,aAA2C;AAEzD,UAAS,qBAAqB,SAAS,oBAAoB,KAAI,cAAa;EAE1E,IAAI,QAAQ,OAAO,IAAI,UAAU;AACjC,MAAI,MAAM,WAAW,MAAM,MAAM,WAAW,GAAI,SAAQ,MAAM,OAAO;EAIrE,IAAI,MAAM,OAAO,IAAI,UAAU;AAC/B,MAAI,IAAI,WAAW,KAAK,IAAI,WAAW,EAAG,OAAM,IAAI,MAAM;AAE1D,SAAO;GAAE,GAAG;GAAW;GAAO;;;AAGhC,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"syllabuses.js","names":[],"sources":["../../../src/core/from/syllabuses.ts"],"sourcesContent":["import type transform from '../to/syllabuses';\n\nexport default (syllabuses: ReturnType<typeof transform>) => {\n syllabuses = syllabuses.filter(({ id }) => id != undefined);\n\n if (syllabuses.length != Array.from(new Set(syllabuses.map(({ id }) => id))).length)\n throw new Error('(Core::From::V2::Syllabuses) Syllabuses array have two or more syllabuses with the same ID');\n\n return syllabuses.map(syllabus => {\n if (!syllabus.id)\n throw new Error('(Core::From::V2::Syllabuses) Syllabus id is undefined');\n\n return { ...syllabus };\n }, []) satisfies ReturnType<typeof transform>;\n};"],"mappings":";AAEA,0BAAgB,eAA6C;AAC3D,cAAa,WAAW,QAAQ,EAAE,SAAS,MAAM,OAAU;AAE3D,KAAI,WAAW,UAAU,MAAM,KAAK,IAAI,IAAI,WAAW,KAAK,EAAE,SAAS,GAAG,CAAC,CAAC,CAAC,OAC3E,OAAM,IAAI,MAAM,6FAA6F;AAE/G,QAAO,WAAW,KAAI,aAAY;AAChC,MAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM,wDAAwD;AAE1E,SAAO,EAAE,GAAG,UAAU;IACrB,EAAE,CAAC"}
1
+ {"version":3,"file":"syllabuses.js","names":[],"sources":["../../../src/core/from/syllabuses.ts"],"sourcesContent":["import type transform from '../to/syllabuses';\n\nexport default (syllabuses: ReturnType<typeof transform>) => {\n syllabuses = syllabuses.filter(({ id }) => id != undefined);\n\n if (syllabuses.length != Array.from(new Set(syllabuses.map(({ id }) => id))).length)\n throw new Error('(Core::From::V2::Syllabuses) Syllabuses array have two or more syllabuses with the same ID');\n\n return syllabuses.map(syllabus => {\n if (!syllabus.id)\n throw new Error('(Core::From::V2::Syllabuses) Syllabus id is undefined');\n\n return { ...syllabus };\n }, []) satisfies ReturnType<typeof transform>;\n};"],"mappings":";AAEA,0BAAgB,eAA6C;AAC3D,cAAa,WAAW,QAAQ,EAAE,SAAS,MAAM;AAEjD,KAAI,WAAW,UAAU,MAAM,KAAK,IAAI,IAAI,WAAW,KAAK,EAAE,SAAS,MAAM,OAC3E,OAAM,IAAI,MAAM;AAElB,QAAO,WAAW,KAAI,aAAY;AAChC,MAAI,CAAC,SAAS,GACZ,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG;IACX"}
@@ -1 +1 @@
1
- {"version":3,"file":"teachers.js","names":[],"sources":["../../../src/core/from/teachers.ts"],"sourcesContent":["import type transform from '../to/teachers';\n\nexport default (teachers: ReturnType<typeof transform>) => {\n if (teachers.length != new Set(teachers.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Teachers) Teachers array have two or more teachers with the same ID');\n\n return teachers\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Teachers) Teacher id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,wBAAgB,aAA2C;AACzD,KAAI,SAAS,UAAU,IAAI,IAAI,SAAS,KAAI,MAAK,EAAE,GAAG,CAAC,CAAC,KACtD,OAAM,IAAI,MAAM,uFAAuF;AAEzG,QAAO,SACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM,qDAAqD;AAEvE,SAAO,EAAE,GAAG,GAAG;GACf"}
1
+ {"version":3,"file":"teachers.js","names":[],"sources":["../../../src/core/from/teachers.ts"],"sourcesContent":["import type transform from '../to/teachers';\n\nexport default (teachers: ReturnType<typeof transform>) => {\n if (teachers.length != new Set(teachers.map(x => x.id)).size)\n throw new Error('(Core::From::V2::Teachers) Teachers array have two or more teachers with the same ID');\n\n return teachers\n .map(x => {\n if (!x.id)\n throw new Error('(Core::From::V2::Teachers) Teacher id is undefined');\n\n return { ...x };\n });\n};\n"],"mappings":";AAEA,wBAAgB,aAA2C;AACzD,KAAI,SAAS,UAAU,IAAI,IAAI,SAAS,KAAI,MAAK,EAAE,KAAK,KACtD,OAAM,IAAI,MAAM;AAElB,QAAO,SACJ,KAAI,MAAK;AACR,MAAI,CAAC,EAAE,GACL,OAAM,IAAI,MAAM;AAElB,SAAO,EAAE,GAAG"}
@@ -22,7 +22,6 @@ import { CalendarExceptionAction, ExceptionStatus } from "./interfaces/vertices/
22
22
  import { LockedTimeType } from "./interfaces/vertices/locked-times.js";
23
23
  import { Infer, VertexQuery, createVertexQuery } from "./interfaces/vertices/vertex-query.js";
24
24
  import { Deep, DeepWithoutPrivateId, Mixed, MixedWithOptionalId, Serialized, SerializedWithOptionalId } from "./interfaces/vertices/index.js";
25
- import "./interfaces/index.js";
26
25
  import { Types } from "./types/index.js";
27
26
 
28
27
  //#region src/core/index.d.ts