@royalschedule/maps 4.0.33 → 4.1.1-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (325) hide show
  1. package/dist/Additio/from/courses.js.map +1 -1
  2. package/dist/Additio/from/events.js.map +1 -1
  3. package/dist/Additio/from/groups.js.map +1 -1
  4. package/dist/Additio/from/index.js.map +1 -1
  5. package/dist/Additio/from/locations.js.map +1 -1
  6. package/dist/Additio/from/persons.js.map +1 -1
  7. package/dist/Additio/from/schedules.d.ts +0 -1
  8. package/dist/Additio/from/schedules.js +4 -2
  9. package/dist/Additio/from/schedules.js.map +1 -1
  10. package/dist/Additio/from/teachers.js.map +1 -1
  11. package/dist/Additio/to/index.d.ts +2 -4
  12. package/dist/Additio/to/schedules.js +4 -2
  13. package/dist/Additio/to/schedules.js.map +1 -1
  14. package/dist/Admentum/from/courses.js.map +1 -1
  15. package/dist/Admentum/from/events.js.map +1 -1
  16. package/dist/Admentum/from/groups.js.map +1 -1
  17. package/dist/Admentum/from/index.js.map +1 -1
  18. package/dist/Admentum/from/locations.js.map +1 -1
  19. package/dist/Admentum/from/persons.js.map +1 -1
  20. package/dist/Admentum/from/schedules.d.ts +0 -1
  21. package/dist/Admentum/from/schedules.js +6 -3
  22. package/dist/Admentum/from/schedules.js.map +1 -1
  23. package/dist/Admentum/from/teachers.js.map +1 -1
  24. package/dist/Admentum/to/index.d.ts +0 -1
  25. package/dist/Admentum/to/schedules.js +7 -4
  26. package/dist/Admentum/to/schedules.js.map +1 -1
  27. package/dist/Excel/index.d.ts +1 -1
  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 +7 -4
  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 +3 -2
  48. package/dist/InfoMentor/to/schedules.js.map +1 -1
  49. package/dist/PlanDigital/from/index.js.map +1 -1
  50. package/dist/PlanDigital/from/schedules.js +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 +2 -4
  63. package/dist/RS/make-connected.js +46 -54
  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 +7 -5
  67. package/dist/RS/to/initial-configuration.js.map +1 -1
  68. package/dist/RS/to/input/default.js +16 -21
  69. package/dist/RS/to/input/default.js.map +1 -1
  70. package/dist/RS/to/input/dependencies.js +12 -10
  71. package/dist/RS/to/input/dependencies.js.map +1 -1
  72. package/dist/RS/to/input/events.js +53 -41
  73. package/dist/RS/to/input/events.js.map +1 -1
  74. package/dist/RS/to/input/groups.js +7 -15
  75. package/dist/RS/to/input/groups.js.map +1 -1
  76. package/dist/RS/to/input/individuals.js +4 -6
  77. package/dist/RS/to/input/individuals.js.map +1 -1
  78. package/dist/RS/to/input/input.js +21 -13
  79. package/dist/RS/to/input/input.js.map +1 -1
  80. package/dist/RS/to/input/intervals.js +10 -8
  81. package/dist/RS/to/input/intervals.js.map +1 -1
  82. package/dist/RS/to/input/linked-events-sets.js +96 -0
  83. package/dist/RS/to/input/linked-events-sets.js.map +1 -0
  84. package/dist/RS/to/input/locked-times.js +91 -0
  85. package/dist/RS/to/input/locked-times.js.map +1 -0
  86. package/dist/RS/to/input/periods.js +5 -36
  87. package/dist/RS/to/input/periods.js.map +1 -1
  88. package/dist/RS/to/input/settings.js +1 -8
  89. package/dist/RS/to/input/settings.js.map +1 -1
  90. package/dist/RS/to/input/teachers.js +8 -16
  91. package/dist/RS/to/input/teachers.js.map +1 -1
  92. package/dist/RS/to/input/util/parse-days.js +2 -2
  93. package/dist/RS/to/input/util/parse-days.js.map +1 -1
  94. package/dist/RS/to/input/util/parse-group-references.js +2 -10
  95. package/dist/RS/to/input/util/parse-group-references.js.map +1 -1
  96. package/dist/RS/to/input/util/parse-location-references.js +1 -7
  97. package/dist/RS/to/input/util/parse-location-references.js.map +1 -1
  98. package/dist/RS/to/input/util/parse-max-working-hours.js +4 -7
  99. package/dist/RS/to/input/util/parse-max-working-hours.js.map +1 -1
  100. package/dist/RS/to/input/util/parse-minimum-break-length.js +2 -2
  101. package/dist/RS/to/input/util/parse-minimum-break-length.js.map +1 -1
  102. package/dist/RS/to/input/util/util.js +5 -11
  103. package/dist/RS/to/input/util/util.js.map +1 -1
  104. package/dist/RS/to/schedules.js.map +1 -1
  105. package/dist/RS/types/algorithm-parameters.d.ts +1 -2
  106. package/dist/RS/types/index.d.ts +2 -31
  107. package/dist/RS/types/schedule-data.d.ts +12 -15
  108. package/dist/RS/types/to.d.ts +10 -18
  109. package/dist/RS/types/to.js +1 -1
  110. package/dist/RS/types/to.js.map +1 -1
  111. package/dist/SS12000/from/activities.js +2 -1
  112. package/dist/SS12000/from/activities.js.map +1 -1
  113. package/dist/SS12000/from/calendar-events.js.map +1 -1
  114. package/dist/SS12000/from/duties.js.map +1 -1
  115. package/dist/SS12000/from/groups.js.map +1 -1
  116. package/dist/SS12000/from/index.js.map +1 -1
  117. package/dist/SS12000/from/persons.js.map +1 -1
  118. package/dist/SS12000/from/resources.js.map +1 -1
  119. package/dist/SS12000/from/rooms.js.map +1 -1
  120. package/dist/SS12000/from/syllabuses.js.map +1 -1
  121. package/dist/SS12000/index.d.ts +9 -12782
  122. package/dist/SS12000/to/activities.js.map +1 -1
  123. package/dist/SS12000/to/calendar-events.js.map +1 -1
  124. package/dist/SS12000/to/common.js.map +1 -1
  125. package/dist/SS12000/to/duties.js.map +1 -1
  126. package/dist/SS12000/to/groups.js.map +1 -1
  127. package/dist/SS12000/to/index.d.ts +0 -1
  128. package/dist/SS12000/to/persons.js.map +1 -1
  129. package/dist/SS12000/to/resources.js.map +1 -1
  130. package/dist/SS12000/to/rooms.js.map +1 -1
  131. package/dist/SS12000/to/syllabuses.js.map +1 -1
  132. package/dist/SchoolSoft/api/from/index.js.map +1 -1
  133. package/dist/SchoolSoft/api/from/schedules.js +12 -8
  134. package/dist/SchoolSoft/api/from/schedules.js.map +1 -1
  135. package/dist/SchoolSoft/api/index.d.ts +7 -6
  136. package/dist/SchoolSoft/file/from/index.js.map +1 -1
  137. package/dist/SchoolSoft/file/from/schedules.js +87 -83
  138. package/dist/SchoolSoft/file/from/schedules.js.map +1 -1
  139. package/dist/SchoolSoft/file/index.d.ts +0 -1
  140. package/dist/SchoolSoft/file/to/index.d.ts +2 -3
  141. package/dist/SchoolSoft/file/to/schedules.js +2 -1
  142. package/dist/SchoolSoft/file/to/schedules.js.map +1 -1
  143. package/dist/SchoolSoft/index.d.ts +0 -1
  144. package/dist/Schoolity/txt/to/index.d.ts +0 -1
  145. package/dist/Schoolity/txt/to/schedules.js +14 -7
  146. package/dist/Schoolity/txt/to/schedules.js.map +1 -1
  147. package/dist/Skola24/mdb/from/course-and-events.js +5 -3
  148. package/dist/Skola24/mdb/from/course-and-events.js.map +1 -1
  149. package/dist/Skola24/mdb/from/groups.js.map +1 -1
  150. package/dist/Skola24/mdb/from/index.js.map +1 -1
  151. package/dist/Skola24/mdb/from/locations.js.map +1 -1
  152. package/dist/Skola24/mdb/from/schedule.d.ts +0 -1
  153. package/dist/Skola24/mdb/from/schedule.js.map +1 -1
  154. package/dist/Skola24/mdb/from/teachers.js.map +1 -1
  155. package/dist/Skola24/txt/from/calendar-exceptions.js +2 -1
  156. package/dist/Skola24/txt/from/calendar-exceptions.js.map +1 -1
  157. package/dist/Skola24/txt/from/division.js.map +1 -1
  158. package/dist/Skola24/txt/from/index.js.map +1 -1
  159. package/dist/Skola24/txt/from/period.js +34 -31
  160. package/dist/Skola24/txt/from/period.js.map +1 -1
  161. package/dist/Skola24/txt/from/schedules.d.ts +0 -1
  162. package/dist/Skola24/txt/from/schedules.js +10 -6
  163. package/dist/Skola24/txt/from/schedules.js.map +1 -1
  164. package/dist/Skola24/txt/from/util.js.map +1 -1
  165. package/dist/Skola24/txt/index.d.ts +0 -1
  166. package/dist/Skola24/txt/to/index.d.ts +0 -1
  167. package/dist/Skola24/txt/to/schedules.js +15 -8
  168. package/dist/Skola24/txt/to/schedules.js.map +1 -1
  169. package/dist/common/constants.js.map +1 -1
  170. package/dist/common/functions.js +2 -2
  171. package/dist/common/functions.js.map +1 -1
  172. package/dist/common/get-date.js.map +1 -1
  173. package/dist/common/make-chainable/index.js.map +1 -1
  174. package/dist/common/types.d.ts +28 -2
  175. package/dist/core/from/configurations.js.map +1 -1
  176. package/dist/core/from/courses.js.map +1 -1
  177. package/dist/core/from/events.js.map +1 -1
  178. package/dist/core/from/exceptions.js.map +1 -1
  179. package/dist/core/from/groups.js.map +1 -1
  180. package/dist/core/from/index.js.map +1 -1
  181. package/dist/core/from/locations.js.map +1 -1
  182. package/dist/core/from/locked-times.js.map +1 -1
  183. package/dist/core/from/overlap-groups.js.map +1 -1
  184. package/dist/core/from/periods.js.map +1 -1
  185. package/dist/core/from/persons.js.map +1 -1
  186. package/dist/core/from/root-intervals.js.map +1 -1
  187. package/dist/core/from/schedules.js.map +1 -1
  188. package/dist/core/from/settings.js.map +1 -1
  189. package/dist/core/from/syllabuses.js.map +1 -1
  190. package/dist/core/from/teachers.js.map +1 -1
  191. package/dist/core/index.d.ts +0 -1
  192. package/dist/core/interfaces/other/companies.d.ts +0 -1
  193. package/dist/core/interfaces/other/companies.js.map +1 -1
  194. package/dist/core/interfaces/other/operations.d.ts +0 -1
  195. package/dist/core/interfaces/vertices/companies.d.ts +0 -1
  196. package/dist/core/interfaces/vertices/configurations.d.ts +0 -1
  197. package/dist/core/interfaces/vertices/courses.d.ts +0 -1
  198. package/dist/core/interfaces/vertices/division-settings.d.ts +2 -3
  199. package/dist/core/interfaces/vertices/divisions.d.ts +0 -1
  200. package/dist/core/interfaces/vertices/events.d.ts +3 -1
  201. package/dist/core/interfaces/vertices/exceptions.d.ts +0 -1
  202. package/dist/core/interfaces/vertices/generations.d.ts +1 -3
  203. package/dist/core/interfaces/vertices/groups.d.ts +0 -1
  204. package/dist/core/interfaces/vertices/index.d.ts +15 -8
  205. package/dist/core/interfaces/vertices/linked-events-sets.d.ts +18 -0
  206. package/dist/core/interfaces/vertices/locations.d.ts +0 -1
  207. package/dist/core/interfaces/vertices/locked-times.d.ts +0 -2
  208. package/dist/core/interfaces/vertices/overlap-groups.d.ts +0 -1
  209. package/dist/core/interfaces/vertices/periods.d.ts +0 -3
  210. package/dist/core/interfaces/vertices/persons.d.ts +0 -1
  211. package/dist/core/interfaces/vertices/properties/belongs-to.d.ts +0 -1
  212. package/dist/core/interfaces/vertices/properties/coalesced.d.ts +0 -1
  213. package/dist/core/interfaces/vertices/root-intervals.d.ts +0 -2
  214. package/dist/core/interfaces/vertices/syllabuses.d.ts +0 -1
  215. package/dist/core/interfaces/vertices/teachers.d.ts +0 -1
  216. package/dist/core/interfaces/vertices/threads.d.ts +0 -1
  217. package/dist/core/interfaces/vertices/users.d.ts +0 -1
  218. package/dist/core/interfaces/vertices/util/custom-vertex-export/index.d.ts +6 -6
  219. package/dist/core/interfaces/vertices/util/custom-vertex-export/util.d.ts +4 -4
  220. package/dist/core/interfaces/vertices/util/deep-vertex-export/index.d.ts +10 -10
  221. package/dist/core/interfaces/vertices/util/edges.d.ts +7 -7
  222. package/dist/core/interfaces/vertices/util/util.d.ts +24 -20
  223. package/dist/core/interfaces/vertices/util/vertex-query/index.d.ts +11 -11
  224. package/dist/core/interfaces/vertices/util/vertex.d.ts +5 -4
  225. package/dist/core/interfaces/vertices/vertex-query.d.ts +29 -27
  226. package/dist/core/interfaces/vertices/vertex-query.js +4 -0
  227. package/dist/core/interfaces/vertices/vertex-query.js.map +1 -1
  228. package/dist/core/to/configurations.js +2 -1
  229. package/dist/core/to/configurations.js.map +1 -1
  230. package/dist/core/to/courses.js +2 -1
  231. package/dist/core/to/courses.js.map +1 -1
  232. package/dist/core/to/division.js.map +1 -1
  233. package/dist/core/to/events.js +3 -1
  234. package/dist/core/to/events.js.map +1 -1
  235. package/dist/core/to/exceptions.js +2 -1
  236. package/dist/core/to/exceptions.js.map +1 -1
  237. package/dist/core/to/groups.js +2 -1
  238. package/dist/core/to/groups.js.map +1 -1
  239. package/dist/core/to/linked-events-sets.js +18 -0
  240. package/dist/core/to/linked-events-sets.js.map +1 -0
  241. package/dist/core/to/locations.js +2 -1
  242. package/dist/core/to/locations.js.map +1 -1
  243. package/dist/core/to/locked-times.js +2 -1
  244. package/dist/core/to/locked-times.js.map +1 -1
  245. package/dist/core/to/overlap-groups.js +2 -1
  246. package/dist/core/to/overlap-groups.js.map +1 -1
  247. package/dist/core/to/periods.js +2 -1
  248. package/dist/core/to/periods.js.map +1 -1
  249. package/dist/core/to/persons.js +2 -1
  250. package/dist/core/to/persons.js.map +1 -1
  251. package/dist/core/to/root-intervals.js +2 -1
  252. package/dist/core/to/root-intervals.js.map +1 -1
  253. package/dist/core/to/schedules.d.ts +2 -1
  254. package/dist/core/to/schedules.js +3 -1
  255. package/dist/core/to/schedules.js.map +1 -1
  256. package/dist/core/to/settings.js +2 -1
  257. package/dist/core/to/settings.js.map +1 -1
  258. package/dist/core/to/syllabuses.js +2 -1
  259. package/dist/core/to/syllabuses.js.map +1 -1
  260. package/dist/core/to/teachers.js +2 -1
  261. package/dist/core/to/teachers.js.map +1 -1
  262. package/dist/core/to/util.d.ts +0 -2
  263. package/dist/core/to/util.js +2 -1
  264. package/dist/core/to/util.js.map +1 -1
  265. package/dist/core/types/index.d.ts +5 -1
  266. package/dist/core/util.js +5 -3
  267. package/dist/core/util.js.map +1 -1
  268. package/dist/identify/constants/index.d.ts +1 -1
  269. package/dist/identify/constants/index.js.map +1 -1
  270. package/dist/identify/index.js +2 -1
  271. package/dist/identify/index.js.map +1 -1
  272. package/dist/sdui/from/classes.js.map +1 -1
  273. package/dist/sdui/from/courses.js.map +1 -1
  274. package/dist/sdui/from/holidays.js.map +1 -1
  275. package/dist/sdui/from/index.js.map +1 -1
  276. package/dist/sdui/from/lessons.js.map +1 -1
  277. package/dist/sdui/from/rooms.js.map +1 -1
  278. package/dist/sdui/from/schedules.d.ts +0 -2
  279. package/dist/sdui/from/schedules.js.map +1 -1
  280. package/dist/sdui/from/school-years.js.map +1 -1
  281. package/dist/sdui/from/substitution-plans.js.map +1 -1
  282. package/dist/sdui/from/teachers.js.map +1 -1
  283. package/dist/sdui/to/classes.js.map +1 -1
  284. package/dist/sdui/to/courses.js.map +1 -1
  285. package/dist/sdui/to/holidays.js +1 -1
  286. package/dist/sdui/to/holidays.js.map +1 -1
  287. package/dist/sdui/to/hours.js.map +1 -1
  288. package/dist/sdui/to/index.d.ts +0 -2
  289. package/dist/sdui/to/lessons.js +1 -1
  290. package/dist/sdui/to/lessons.js.map +1 -1
  291. package/dist/sdui/to/rooms.js.map +1 -1
  292. package/dist/sdui/to/schedules.js.map +1 -1
  293. package/dist/sdui/to/school-years.js +1 -1
  294. package/dist/sdui/to/school-years.js.map +1 -1
  295. package/dist/sdui/to/substitution-plans.js +7 -4
  296. package/dist/sdui/to/substitution-plans.js.map +1 -1
  297. package/dist/sdui/to/teachers.js.map +1 -1
  298. package/dist/vKlass/from/index.js.map +1 -1
  299. package/dist/vKlass/from/schedule.d.ts +0 -1
  300. package/dist/vKlass/from/schedule.js.map +1 -1
  301. package/dist/vKlass/to/schedules.js +17 -6
  302. package/dist/vKlass/to/schedules.js.map +1 -1
  303. package/package.json +29 -24
  304. package/dist/RS/to/input/collections.js +0 -58
  305. package/dist/RS/to/input/collections.js.map +0 -1
  306. package/dist/RS/to/input/dynamic-locked-times.js +0 -69
  307. package/dist/RS/to/input/dynamic-locked-times.js.map +0 -1
  308. package/dist/RS/to/input/util/attach-locked-times.js +0 -27
  309. package/dist/RS/to/input/util/attach-locked-times.js.map +0 -1
  310. package/dist/RS/to/input/util/parse-intervals.js +0 -56
  311. package/dist/RS/to/input/util/parse-intervals.js.map +0 -1
  312. package/dist/RS/types/collections.d.ts +0 -33
  313. package/dist/RS/types/default.d.ts +0 -31
  314. package/dist/RS/types/dependencies.d.ts +0 -16
  315. package/dist/RS/types/events.d.ts +0 -34
  316. package/dist/RS/types/groups.d.ts +0 -27
  317. package/dist/RS/types/individuals.d.ts +0 -16
  318. package/dist/RS/types/locked-times.d.ts +0 -12
  319. package/dist/RS/types/period.d.ts +0 -27
  320. package/dist/RS/types/root-intervals.d.ts +0 -10
  321. package/dist/RS/types/settings.d.ts +0 -15
  322. package/dist/RS/types/shared.d.ts +0 -27
  323. package/dist/core/interfaces/index.d.ts +0 -23
  324. package/dist/core/interfaces/other/index.d.ts +0 -6
  325. package/dist/core/interfaces/vertices/util/index.d.ts +0 -6
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[]","RSstructure"],"sources":["../../../src/identify/constants/index.ts"],"sourcesContent":["import { CoreMap } from '../../core';\nimport type { SchoolSoftFileTypes } from '../../SchoolSoft';\nimport { SchoolSoftMap } from '../../SchoolSoft';\nimport { PlanDigitalMap } from '../../PlanDigital';\nimport { AdmentumMap } from '../../Admentum';\nimport { IdunSoftMap } from '../../IdunSoft';\nimport { Skola24Map } from '../../Skola24';\nimport { RSMap } from '../../RS';\nimport { ExcelMap } from '../../Excel';\nimport { structure as RSstructure } from '../../RS/types/to';\n\n\nconst core_structure = {\n groups: ['id'],\n locations: ['id'],\n teachers: ['id'],\n courses: ['id', 'events', 'groups', 'subject', 'teachers'],\n};\n\nconst excel_structure = {\n meta: [['structure']],\n courses: [],\n groups: [],\n locations: [],\n};\n\nconst RS_structure = {\n events: ['output', 'coreData'],\n};\n\nconst Admentum_structure = {\n schools: ['url', 'id', 'unit_code', 'school_code', 'school_type', 'name'],\n schedule: ['url', 'id', 'school_id', 'school_year', 'start_date', 'end_date', 'start_time', 'end_time', 'is_active', 'archived_at'],\n rooms: ['url', 'id', 'school_id', 'name', 'category', 'capacity'],\n teachers: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n principals: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n courses: ['url', 'id', 'school_id', 'schedule_id', 'name', 'subject_code', 'start_date', 'end_date', 'teachers', 'gymnasium_course'],\n schedule_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'name', 'guid', 'teachers', 'users_primary_groups', 'subjects', 'courses'],\n primary_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'grade', 'name', 'guid', 'teachers', 'start_date', 'end_date', 'start_date_display', 'end_date_display'],\n schedule_events: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start_time', 'end_time', 'rooms', 'teachers', 'schedule_groups', 'primary_groups', 'weekly_interval'],\n schedule_event_instances: ['url', 'id', 'school_id', 'start_date', 'end_date', 'schedule_event'],\n lessons: ['url', 'id', 'school_id', 'date', 'info', 'teachers', 'room', 'weekday'],\n lesson_infos: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start', 'end', 'duration', 'room', 'subject', 'teachers', 'groups', 'weekly_interval'],\n};\n\nconst IdunSoft_structure = {\n Grupp: ['ID', 'Klassnamn'],\n Lärare: ['ID', 'Namn'],\n Rum: ['ID', 'Namn'],\n Ämne: ['Ämne', 'Betygskod'],\n Lektion: ['LektionID', 'Ämne', 'Starttid', 'Sluttid', 'Lektionslängd', 'LärareID', 'GruppID', 'RumID', 'VeckodagID']\n};\n\nconst Skola24_txt_structure = null;\n\nconst Skola24_mdb_structure = {\n unit_tblroom: [ 'PK', 'ID' ],\n school_tblsubject: [ 'PK', 'ID' ],\n school_tblteacher: [ 'PK', 'ID' ],\n school_tblgroup: [ 'PK', 'ID', 'bClass' ],\n school_tblplan: [ 'PK', 'FKSubject' ],\n school_tblcourse: [ ],\n school_tblschedule: [ 'PK', 'Length', 'StartTime', 'DayOfWeek', 'FKSubject', 'CalcActualWeeks' ],\n school_tblgroup_group: [ 'FKGroup', 'FKGroupCon' ],\n school_tblplan_period: [ 'FKPlan', 'FKPeriod' ],\n school_tblplan_teacher: [ 'FKPlan', 'FKTeacher' ],\n school_tblplan_group: [ 'FKPlan', 'FKGroup' ],\n unit_tblperiod_date: [ 'FKPeriod', 'StartDate', 'EndDate' ],\n school_tblschedule_period: [ 'FKSchedule', 'FKPeriod' ],\n school_tblschedule_teacher: [ 'FKSchedule', 'FKTeacher' ],\n school_tblschedule_group: [ 'FKSchedule', 'FKGroup' ],\n school_tblschedule_room: [ 'FKSchedule', 'FKRoom' ]\n};\n\n// this is only temporary\nconst PlanDigital_structure = {\n 'Perioder': [ 'Namn', 'Tidsenhet' ],\n 'Tabell Tjänstefördelning': [ 'Gruppnamn', 'Klass', 'Kurskod', 'Sign', 'Poäng', 'Anteckningar', 'Antal', 'Ämne', 'Kursnamn' ]\n};\n\nconst SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[] = [\n 'id',\n 'group',\n 'dayid',\n 'day',\n 'starttime',\n 'length',\n 'teacher',\n 'subject',\n 'room',\n 'period',\n 'inweek',\n 'exweek',\n 'exclass',\n 'realweeks'\n];\n\nexport const maps = [\n {\n structure: Skola24_txt_structure,\n matchType: 'string',\n name: 'Skola24 (txt)',\n map: Skola24Map.TXT,\n meta: { structure: '' }\n }, {\n structure: Admentum_structure,\n name: 'Admentum',\n map: AdmentumMap,\n meta: { structure: '' }\n }, {\n structure: SchoolSoft_structure,\n name: 'SchoolSoft',\n map: SchoolSoftMap,\n meta: { structure: '' }\n }, {\n structure: PlanDigital_structure,\n name: 'Plan Digital',\n map: PlanDigitalMap,\n meta: { structure: '' }\n }, {\n structure: IdunSoft_structure,\n name: 'IdunSoft',\n map: IdunSoftMap,\n meta: { structure: '' }\n }, {\n structure: Skola24_mdb_structure,\n name: 'Skola24 (mdb)',\n map: Skola24Map.MDB,\n meta: { structure: '' }\n }, {\n structure: RS_structure,\n name: 'Royal Schedule Algorithm',\n map: RSMap,\n meta: { structure: RSstructure }\n }, {\n // structure: core_structure,\n // name: 'Royal Schedule',\n // map: CoreMap.V1,\n // meta: { structure: 'RS/core-1.0.0' }\n // }, {\n structure: core_structure,\n name: 'Royal Schedule',\n map: CoreMap,\n meta: { structure: 'RS/core-2.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V1,\n meta: { structure: 'RS/Excel-1.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V2,\n meta: { structure: 'RS/Excel-2.0.0' }\n }\n] as const;"],"mappings":";;;;;;;;;;;AAYA,MAAM,iBAAiB;CACrB,QAAW,CAAC,KAAK;CACjB,WAAW,CAAC,KAAK;CACjB,UAAW,CAAC,KAAK;CACjB,SAAW;EAAC;EAAM;EAAU;EAAU;EAAW;EAAW;CAC7D;AAED,MAAM,kB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MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW,IAAI;EAC7B;CAAE;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW,IAAI;EAC7B;CAAE;EACD,WAAW;EACX,MAAW;EACX,KAAW,WAAW;EACtB,MAAW,EAAE,WAAW,IAAI;EAC7B;CAAE;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAaC,WAAa;EACtC;CAAE;EAMD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW,iBAAiB;EAC1C;CAAE;EACD,WAAW;EACX,MAAW;EACX,KAAW,SAAS;EACpB,MAAW,EAAE,WAAW,kBAAkB;EAC3C;CAAE;EACD,WAAW;EACX,MAAW;EACX,KAAW,SAAS;EACpB,MAAW,EAAE,WAAW,kBAAkB;EAC3C;CACF"}
1
+ {"version":3,"file":"index.js","names":["SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[]","RSstructure"],"sources":["../../../src/identify/constants/index.ts"],"sourcesContent":["import { CoreMap } from '../../core';\nimport type { SchoolSoftFileTypes } from '../../SchoolSoft';\nimport { SchoolSoftMap } from '../../SchoolSoft';\nimport { PlanDigitalMap } from '../../PlanDigital';\nimport { AdmentumMap } from '../../Admentum';\nimport { IdunSoftMap } from '../../IdunSoft';\nimport { Skola24Map } from '../../Skola24';\nimport { RSMap } from '../../RS';\nimport { ExcelMap } from '../../Excel';\nimport { structure as RSstructure } from '../../RS/types/to';\n\n\nconst core_structure = {\n groups: ['id'],\n locations: ['id'],\n teachers: ['id'],\n courses: ['id', 'events', 'groups', 'subject', 'teachers'],\n};\n\nconst excel_structure = {\n meta: [['structure']],\n courses: [],\n groups: [],\n locations: [],\n};\n\nconst RS_structure = {\n events: ['output', 'coreData'],\n};\n\nconst Admentum_structure = {\n schools: ['url', 'id', 'unit_code', 'school_code', 'school_type', 'name'],\n schedule: ['url', 'id', 'school_id', 'school_year', 'start_date', 'end_date', 'start_time', 'end_time', 'is_active', 'archived_at'],\n rooms: ['url', 'id', 'school_id', 'name', 'category', 'capacity'],\n teachers: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n principals: ['url', 'id', 'school_id', 'email', 'first_name', 'last_name', 'role', 'current_primary_group', 'account_id'],\n courses: ['url', 'id', 'school_id', 'schedule_id', 'name', 'subject_code', 'start_date', 'end_date', 'teachers', 'gymnasium_course'],\n schedule_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'name', 'guid', 'teachers', 'users_primary_groups', 'subjects', 'courses'],\n primary_groups: ['url', 'id', 'eid', 'school_id', 'schedule', 'grade', 'name', 'guid', 'teachers', 'start_date', 'end_date', 'start_date_display', 'end_date_display'],\n schedule_events: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start_time', 'end_time', 'rooms', 'teachers', 'schedule_groups', 'primary_groups', 'weekly_interval'],\n schedule_event_instances: ['url', 'id', 'school_id', 'start_date', 'end_date', 'schedule_event'],\n lessons: ['url', 'id', 'school_id', 'date', 'info', 'teachers', 'room', 'weekday'],\n lesson_infos: ['url', 'id', 'eid', 'school_id', 'schedule_id', 'start', 'end', 'duration', 'room', 'subject', 'teachers', 'groups', 'weekly_interval'],\n};\n\nconst IdunSoft_structure = {\n Grupp: ['ID', 'Klassnamn'],\n Lärare: ['ID', 'Namn'],\n Rum: ['ID', 'Namn'],\n Ämne: ['Ämne', 'Betygskod'],\n Lektion: ['LektionID', 'Ämne', 'Starttid', 'Sluttid', 'Lektionslängd', 'LärareID', 'GruppID', 'RumID', 'VeckodagID']\n};\n\nconst Skola24_txt_structure = null;\n\nconst Skola24_mdb_structure = {\n unit_tblroom: [ 'PK', 'ID' ],\n school_tblsubject: [ 'PK', 'ID' ],\n school_tblteacher: [ 'PK', 'ID' ],\n school_tblgroup: [ 'PK', 'ID', 'bClass' ],\n school_tblplan: [ 'PK', 'FKSubject' ],\n school_tblcourse: [ ],\n school_tblschedule: [ 'PK', 'Length', 'StartTime', 'DayOfWeek', 'FKSubject', 'CalcActualWeeks' ],\n school_tblgroup_group: [ 'FKGroup', 'FKGroupCon' ],\n school_tblplan_period: [ 'FKPlan', 'FKPeriod' ],\n school_tblplan_teacher: [ 'FKPlan', 'FKTeacher' ],\n school_tblplan_group: [ 'FKPlan', 'FKGroup' ],\n unit_tblperiod_date: [ 'FKPeriod', 'StartDate', 'EndDate' ],\n school_tblschedule_period: [ 'FKSchedule', 'FKPeriod' ],\n school_tblschedule_teacher: [ 'FKSchedule', 'FKTeacher' ],\n school_tblschedule_group: [ 'FKSchedule', 'FKGroup' ],\n school_tblschedule_room: [ 'FKSchedule', 'FKRoom' ]\n};\n\n// this is only temporary\nconst PlanDigital_structure = {\n 'Perioder': [ 'Namn', 'Tidsenhet' ],\n 'Tabell Tjänstefördelning': [ 'Gruppnamn', 'Klass', 'Kurskod', 'Sign', 'Poäng', 'Anteckningar', 'Antal', 'Ämne', 'Kursnamn' ]\n};\n\nconst SchoolSoft_structure: (keyof SchoolSoftFileTypes.event)[] = [\n 'id',\n 'group',\n 'dayid',\n 'day',\n 'starttime',\n 'length',\n 'teacher',\n 'subject',\n 'room',\n 'period',\n 'inweek',\n 'exweek',\n 'exclass',\n 'realweeks'\n];\n\nexport const maps = [\n {\n structure: Skola24_txt_structure,\n matchType: 'string',\n name: 'Skola24 (txt)',\n map: Skola24Map.TXT,\n meta: { structure: '' }\n }, {\n structure: Admentum_structure,\n name: 'Admentum',\n map: AdmentumMap,\n meta: { structure: '' }\n }, {\n structure: SchoolSoft_structure,\n name: 'SchoolSoft',\n map: SchoolSoftMap,\n meta: { structure: '' }\n }, {\n structure: PlanDigital_structure,\n name: 'Plan Digital',\n map: PlanDigitalMap,\n meta: { structure: '' }\n }, {\n structure: IdunSoft_structure,\n name: 'IdunSoft',\n map: IdunSoftMap,\n meta: { structure: '' }\n }, {\n structure: Skola24_mdb_structure,\n name: 'Skola24 (mdb)',\n map: Skola24Map.MDB,\n meta: { structure: '' }\n }, {\n structure: RS_structure,\n name: 'Royal Schedule Algorithm',\n map: RSMap,\n meta: { structure: RSstructure }\n }, {\n // structure: core_structure,\n // name: 'Royal Schedule',\n // map: CoreMap.V1,\n // meta: { structure: 'RS/core-1.0.0' }\n // }, {\n structure: core_structure,\n name: 'Royal Schedule',\n map: CoreMap,\n meta: { structure: 'RS/core-2.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V1,\n meta: { structure: 'RS/Excel-1.0.0' }\n }, {\n structure: excel_structure,\n name: 'Royal Schedule Excel',\n map: ExcelMap.V2,\n meta: { structure: 'RS/Excel-2.0.0' }\n }\n] as const;"],"mappings":";;;;;;;;;;;AAYA,MAAM,iBAAiB;CACrB,QAAW,CAAC;CACZ,WAAW,CAAC;CACZ,UAAW,CAAC;CACZ,SAAW;EAAC;EAAM;EAAU;EAAU;EAAW;;;AAGnD,MAAM,kBAAkB;CACtB,MAAW,CAAC,CAAC;CACb,SAAW;CACX,QAAW;CACX,WAAW;;AAGb,MAAM,eAAe,EACnB,QAAQ,CAAC,UAAU;AAGrB,MAAM,qBAAqB;CACzB,SAA0B;EAAC;EAAO;EAAM;EAAa;EAAe;EAAe;;CACnF,UAA0B;EAAC;EAAO;EAAM;EAAa;EAAe;EAAc;EAAY;EAAc;EAAY;EAAa;;CACrI,OAA0B;EAAC;EAAO;EAAM;EAAa;EAAQ;EAAY;;CACzE,UAA0B;EAAC;EAAO;EAAM;EAAa;EAAS;EAAc;EAAa;EAAQ;EAAyB;;CAC1H,YAA0B;EAAC;EAAO;EAAM;EAAa;EAAS;EAAc;EAAa;EAAQ;EAAyB;;CAC1H,SAA0B;EAAC;EAAO;EAAM;EAAa;EAAe;EAAQ;EAAgB;EAAc;EAAY;EAAY;;CAClI,iBAA0B;EAAC;EAAO;EAAM;EAAO;EAAa;EAAY;EAAQ;EAAQ;EAAY;EAAwB;EAAY;;CACxI,gBAA0B;EAAC;EAAO;EAAM;EAAO;EAAa;EAAY;EAAS;EAAQ;E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;CACA;CACA;CACA;;AAGF,MAAa,OAAO;CAClB;EACE,WAAW;EACX,WAAW;EACX,MAAW;EACX,KAAW,WAAW;EACtB,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW,WAAW;EACtB,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAaC;;CACvB;EAMD,WAAW;EACX,MAAW;EACX,KAAW;EACX,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW,SAAS;EACpB,MAAW,EAAE,WAAW;;CACvB;EACD,WAAW;EACX,MAAW;EACX,KAAW,SAAS;EACpB,MAAW,EAAE,WAAW"}
@@ -22,7 +22,8 @@ function identify(schedule) {
22
22
  error: []
23
23
  };
24
24
  if (!schedule) return similarities;
25
- const res = z.object({ meta: z.union([z.object({ structure: z.string() }), z.array(z.unknown()).transform((arr) => arr.at(0)).pipe(z.object({ structure: z.string() }))]) }).safeParse(schedule);
25
+ const MetaStructure = z.object({ meta: z.union([z.object({ structure: z.string() }), z.array(z.unknown()).transform((arr) => arr.at(0)).pipe(z.object({ structure: z.string() }))]) });
26
+ const res = MetaStructure.safeParse(schedule);
26
27
  if (res.data) {
27
28
  const determined = maps.find((x) => sameMajorStructure(x.meta.structure, res.data.meta.structure));
28
29
  if (determined) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["x","similarities: IdentifiedMaps","collections: string[]","structureKeys: string[]"],"sources":["../../src/identify/index.ts"],"sourcesContent":["import { difference, isEqual, sortBy, uniq } from 'lodash-es';\nimport type { IdentifiedMaps } from './types';\nimport { maps } from './constants';\nimport * as z from 'zod';\nimport { makeChainable } from '../common/make-chainable';\nexport type { MapInstance, MapName, IdentifiedMaps } from './types';\nexport { maps } from './constants';\n\n\nfunction keysOf (docs: unknown): string[] {\n return makeChainable(docs)\n .chain(\n x => Array.isArray(x) ? x as unknown[] : [x],\n x => x.flatMap(x => x && typeof x === 'object' ? Object.keys(x) : []),\n x => uniq(x)\n )\n .value;\n}\n\nfunction sameMajorStructure (a: string, b: string): boolean {\n const normalize = (s: string) => {\n // Matches: \"<prefix>-<major>[.<minor>[.<patch>]]\", optional leading 'v'\n const m = s.match(/^(.*?)-v?(\\d+)(?:\\.\\d+){0,2}$/i);\n return m ? `${m[1]}-${m[2]}` : s;\n };\n return normalize(a) === normalize(b);\n}\n\nexport function identify (schedule: unknown): IdentifiedMaps {\n const similarities: IdentifiedMaps = {\n none: [],\n weak: [],\n strong: [],\n error: [],\n };\n\n if (!schedule) return similarities;\n\n ////\n //// check if the schedule is a meta tagged file and thus identifiable by its structure.\n ////\n const MetaStructure = z.object({\n meta: z.union([\n z.object({\n structure: z.string()\n }),\n z.array(z.unknown())\n .transform(arr => arr.at(0))\n .pipe(z.object({\n structure: z.string()\n }))\n ])\n });\n const res = MetaStructure.safeParse(schedule);\n if (res.data) {\n // structure on the type \"RS/mapName-X.Y.Z\"\n const determined = maps.find(x => sameMajorStructure(x.meta.structure, res.data.meta.structure));\n if (determined) {\n similarities.determined = determined;\n return similarities;\n }\n }\n\n\n ////\n //// not a meta tagged file, so we check the structure.\n ////\n const collections: string[] = Array.isArray(schedule) ? keysOf(schedule) : Object.keys(schedule);\n if (!collections.length) return similarities;\n\n maps.forEach(mapping => {\n const { structure } = mapping;\n\n try {\n if ('matchType' in mapping && typeof schedule === mapping.matchType) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (!structure) {\n similarities.none.push(mapping);\n return;\n }\n\n const _collections = Array.isArray(structure) ? structure : Object.keys(structure);\n\n /*\n is shallow structure .\n */\n if (Array.isArray(schedule)) {\n\n if (!Array.isArray(structure)) {\n similarities.none.push(mapping);\n return;\n }\n\n if (isEqual(sortBy(_collections), sortBy(collections))) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (difference(sortBy(_collections), sortBy(collections)).length < _collections.length) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n return;\n }\n\n /*\n is deep structure .\n */\n\n\n /*\n every key is present in file.\n */\n if (_collections.every(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.every(key => structureKeys.includes(key));\n })) {\n similarities.strong.push(mapping);\n return;\n }\n\n /*\n some keys is present in file.\n */\n if (_collections.some(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.some(key => structureKeys.includes(key));\n })) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n } catch {\n similarities.error.push(mapping);\n }\n });\n\n return similarities;\n}\n"],"mappings":";;;;;;AASA,SAAS,OAAQ,MAAyB;AACxC,QAAO,cAAc,KAAK,CACvB,OACC,MAAK,MAAM,QAAQ,EAAE,GAAG,IAAiB,CAAC,EAAE,GAC5C,MAAK,EAAE,SAAQ,QAAKA,OAAK,OAAOA,QAAM,WAAW,OAAO,KAAKA,IAAE,GAAG,EAAE,CAAC,GACrE,MAAK,KAAK,EAAE,CACb,CACA;;AAGL,SAAS,mBAAoB,GAAW,GAAoB;CAC1D,MAAM,aAAa,MAAc;EAE/B,MAAM,IAAI,EAAE,MAAM,iCAAiC;AACnD,SAAO,IAAI,GAAG,EAAE,GAAG,GAAG,EAAE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Aa,EAAE,OAAO,YAAY,CAAC,EAAE;AACtD,kBAAa,OAAO,KAAK,QAAQ;AACjC;;AAGF,QAAI,WAAW,OAAO,aAAa,EAAE,OAAO,YAAY,CAAC,CAAC,SAAS,aAAa,QAAQ;AACtF,kBAAa,KAAK,KAAK,QAAQ;AAC/B;;AAGF,iBAAa,KAAK,KAAK,QAAQ;AAC/B;;AAWF,OAAI,aAAa,OAAM,eAAc;AACnC,QAAI,EAAE,YAAY,OAAO,YAAY,YAAY,cAAc,UAAW,QAAO;IACjF,MAAM,eAAe,OAAO,SAAS,YAAqC;AAE1E,QAAI,EAAE,cAAc,WAAY,QAAO;IACvC,MAAMC,gBAA0B,UAAU;AAE1C,WAAO,aAAa,OAAM,QAAO,cAAc,SAAS,IAAI,CAAC;KAC7D,EAAE;AACF,iBAAa,OAAO,KAAK,QAAQ;AACjC;;AAMF,OAAI,aAAa,MAAK,eAAc;AAClC,QAAI,EAAE,YAAY,OAAO,YAAY,YAAY,cAAc,UAAW,QAAO;IACjF,MAAM,eAAe,OAAO,SAAS,YAAqC;AAE1E,QAAI,EAAE,cAAc,WAAY,QAAO;IACvC,MAAMA,gBAA0B,UAAU;AAE1C,WAAO,aAAa,MAAK,QAAO,cAAc,SAAS,IAAI,CAAC;KAC5D,EAAE;AACF,iBAAa,KAAK,KAAK,QAAQ;AAC/B;;AAGF,gBAAa,KAAK,KAAK,QAAQ;UACxB;AACP,gBAAa,MAAM,KAAK,QAAQ;;GAElC;AAEF,QAAO"}
1
+ {"version":3,"file":"index.js","names":["x","similarities: IdentifiedMaps","collections: string[]","structureKeys: string[]"],"sources":["../../src/identify/index.ts"],"sourcesContent":["import { difference, isEqual, sortBy, uniq } from 'lodash-es';\nimport type { IdentifiedMaps } from './types';\nimport { maps } from './constants';\nimport * as z from 'zod';\nimport { makeChainable } from '../common/make-chainable';\nexport type { MapInstance, MapName, IdentifiedMaps } from './types';\nexport { maps } from './constants';\n\n\nfunction keysOf (docs: unknown): string[] {\n return makeChainable(docs)\n .chain(\n x => Array.isArray(x) ? x as unknown[] : [x],\n x => x.flatMap(x => x && typeof x === 'object' ? Object.keys(x) : []),\n x => uniq(x)\n )\n .value;\n}\n\nfunction sameMajorStructure (a: string, b: string): boolean {\n const normalize = (s: string) => {\n // Matches: \"<prefix>-<major>[.<minor>[.<patch>]]\", optional leading 'v'\n const m = s.match(/^(.*?)-v?(\\d+)(?:\\.\\d+){0,2}$/i);\n return m ? `${m[1]}-${m[2]}` : s;\n };\n return normalize(a) === normalize(b);\n}\n\nexport function identify (schedule: unknown): IdentifiedMaps {\n const similarities: IdentifiedMaps = {\n none: [],\n weak: [],\n strong: [],\n error: [],\n };\n\n if (!schedule) return similarities;\n\n ////\n //// check if the schedule is a meta tagged file and thus identifiable by its structure.\n ////\n const MetaStructure = z.object({\n meta: z.union([\n z.object({\n structure: z.string()\n }),\n z.array(z.unknown())\n .transform(arr => arr.at(0))\n .pipe(z.object({\n structure: z.string()\n }))\n ])\n });\n const res = MetaStructure.safeParse(schedule);\n if (res.data) {\n // structure on the type \"RS/mapName-X.Y.Z\"\n const determined = maps.find(x => sameMajorStructure(x.meta.structure, res.data.meta.structure));\n if (determined) {\n similarities.determined = determined;\n return similarities;\n }\n }\n\n\n ////\n //// not a meta tagged file, so we check the structure.\n ////\n const collections: string[] = Array.isArray(schedule) ? keysOf(schedule) : Object.keys(schedule);\n if (!collections.length) return similarities;\n\n maps.forEach(mapping => {\n const { structure } = mapping;\n\n try {\n if ('matchType' in mapping && typeof schedule === mapping.matchType) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (!structure) {\n similarities.none.push(mapping);\n return;\n }\n\n const _collections = Array.isArray(structure) ? structure : Object.keys(structure);\n\n /*\n is shallow structure .\n */\n if (Array.isArray(schedule)) {\n\n if (!Array.isArray(structure)) {\n similarities.none.push(mapping);\n return;\n }\n\n if (isEqual(sortBy(_collections), sortBy(collections))) {\n similarities.strong.push(mapping);\n return;\n }\n\n if (difference(sortBy(_collections), sortBy(collections)).length < _collections.length) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n return;\n }\n\n /*\n is deep structure .\n */\n\n\n /*\n every key is present in file.\n */\n if (_collections.every(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.every(key => structureKeys.includes(key));\n })) {\n similarities.strong.push(mapping);\n return;\n }\n\n /*\n some keys is present in file.\n */\n if (_collections.some(collection => {\n if (!(schedule && typeof schedule == 'object' && collection in schedule)) return false;\n const scheduleKeys = keysOf(schedule[collection as keyof typeof schedule]);\n\n if (!(collection in structure)) return false;\n const structureKeys: string[] = structure[collection as keyof typeof structure] as string[];\n\n return scheduleKeys.some(key => structureKeys.includes(key));\n })) {\n similarities.weak.push(mapping);\n return;\n }\n\n similarities.none.push(mapping);\n } catch {\n similarities.error.push(mapping);\n }\n });\n\n return similarities;\n}\n"],"mappings":";;;;;;AASA,SAAS,OAAQ,MAAyB;AACxC,QAAO,cAAc,MAClB,OACC,MAAK,MAAM,QAAQ,KAAK,IAAiB,CAAC,KAC1C,MAAK,EAAE,SAAQ,QAAKA,OAAK,OAAOA,QAAM,WAAW,OAAO,KAAKA,OAAK,MAClE,MAAK,KAAK,IAEX;;AAGL,SAAS,mBAAoB,GAAW,GAAoB;CAC1D,MAAM,aAAa,MAAc;EAE/B,MAAM,IAAI,EAAE,MAAM;AAClB,SAAO,IAAI,GAAG,EAAE,GAAG,GAAG,EAAE,OAAO;;AAEjC,QAAO,UAAU,OAAO,UAAU;;AAGpC,SAAgB,SAAU,UAAmC;CAC3D,MAAMC,eAA+B;EACnC,MAAQ;EACR,MAAQ;EACR,QAAQ;EACR,OAAQ;;AAGV,KAAI,CAAC,SAAU,QAAO;CAKtB,MAAM,gBAAgB,EAAE,OAAO,EAC7B,MAAM,EAAE,MAAM,CACZ,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AACzB;;AAMF,OAAI,aAAa,MAAK,eAAc;AAClC,QAAI,EAAE,YAAY,OAAO,YAAY,YAAY,cAAc,UAAW,QAAO;IACjF,MAAM,eAAe,OAAO,SAAS;AAErC,QAAI,EAAE,cAAc,WAAY,QAAO;IACvC,MAAMA,gBAA0B,UAAU;AAE1C,WAAO,aAAa,MAAK,QAAO,cAAc,SAAS;OACrD;AACF,iBAAa,KAAK,KAAK;AACvB;;AAGF,gBAAa,KAAK,KAAK;UAChB;AACP,gBAAa,MAAM,KAAK;;;AAI5B,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"classes.js","names":[],"sources":["../../../src/sdui/from/classes.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n group: SduiTypes.classes\n): OutTypes.group => {\n return {\n ids: group.id\n };\n};\n"],"mappings":";AAGA,uBACE,UACmB;AACnB,QAAO,EACL,KAAK,MAAM,IACZ"}
1
+ {"version":3,"file":"classes.js","names":[],"sources":["../../../src/sdui/from/classes.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n group: SduiTypes.classes\n): OutTypes.group => {\n return {\n ids: group.id\n };\n};\n"],"mappings":";AAGA,uBACE,UACmB;AACnB,QAAO,EACL,KAAK,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"courses.js","names":[],"sources":["../../../src/sdui/from/courses.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n course: SduiTypes.course\n): OutTypes.course => {\n return {\n ids: course.id,\n displayName: course.name,\n color: course.color,\n teachers: course.teachers.map(to => ({ to })),\n groups: course.classes .map(to => ({ to })),\n };\n};\n"],"mappings":";AAGA,uBACE,WACoB;AACpB,QAAO;EACL,KAAa,OAAO;EACpB,aAAa,OAAO;EACpB,OAAa,OAAO;EACpB,UAAa,OAAO,SAAS,KAAI,QAAO,EAAE,IAAI,EAAE;EAChD,QAAa,OAAO,QAAS,KAAI,QAAO,EAAE,IAAI,EAAE;EACjD"}
1
+ {"version":3,"file":"courses.js","names":[],"sources":["../../../src/sdui/from/courses.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n course: SduiTypes.course\n): OutTypes.course => {\n return {\n ids: course.id,\n displayName: course.name,\n color: course.color,\n teachers: course.teachers.map(to => ({ to })),\n groups: course.classes .map(to => ({ to })),\n };\n};\n"],"mappings":";AAGA,uBACE,WACoB;AACpB,QAAO;EACL,KAAa,OAAO;EACpB,aAAa,OAAO;EACpB,OAAa,OAAO;EACpB,UAAa,OAAO,SAAS,KAAI,QAAO,EAAE;EAC1C,QAAa,OAAO,QAAS,KAAI,QAAO,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"holidays.js","names":[],"sources":["../../../src/sdui/from/holidays.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n holiday: SduiTypes.holiday\n): OutTypes.exception => {\n return {\n // ids: holiday.id\n };\n};\n"],"mappings":";AAGA,wBACE,YACuB;AACvB,QAAO,EAEN"}
1
+ {"version":3,"file":"holidays.js","names":[],"sources":["../../../src/sdui/from/holidays.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n holiday: SduiTypes.holiday\n): OutTypes.exception => {\n return {\n // ids: holiday.id\n };\n};\n"],"mappings":";AAGA,wBACE,YACuB;AACvB,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_schedules","_hours","_substitutionPlans","_classes","_teachers","_subjects","_rooms","_courses","_lessons","_holidays","_schoolYears"],"sources":["../../../src/sdui/from/index.ts"],"sourcesContent":["import _schedules from './schedules';\nimport _hours from './hours';\nimport _substitutionPlans from './substitution-plans';\nimport _classes from './classes';\nimport _teachers from './teachers';\nimport _subjects from './subjects';\nimport _rooms from './rooms';\nimport _courses from './courses';\nimport _lessons from './lessons';\nimport _holidays from './holidays';\nimport _schoolYears from './school-years';\n\nexport default {\n schedules: _schedules,\n hours: _hours,\n substitutionPlans: _substitutionPlans,\n classes: _classes,\n teachers: _teachers,\n subjects: _subjects,\n rooms: _rooms,\n courses: _courses,\n lessons: _lessons,\n holidays: _holidays,\n schoolYears: _schoolYears\n};"],"mappings":";;;;;;;;;;;;;AAYA,mBAAe;CACb,WAAmBA;CACnB,OAAmBC;CACnB,mBAAmBC;CACnB,SAAmBC;CACnB,UAAmBC;CACnB,UAAmBC;CACnB,OAAmBC;CACnB,SAAmBC;CACnB,SAAmBC;CACnB,UAAmBC;CACnB,aAAmBC;CACpB"}
1
+ {"version":3,"file":"index.js","names":["_schedules","_hours","_substitutionPlans","_classes","_teachers","_subjects","_rooms","_courses","_lessons","_holidays","_schoolYears"],"sources":["../../../src/sdui/from/index.ts"],"sourcesContent":["import _schedules from './schedules';\nimport _hours from './hours';\nimport _substitutionPlans from './substitution-plans';\nimport _classes from './classes';\nimport _teachers from './teachers';\nimport _subjects from './subjects';\nimport _rooms from './rooms';\nimport _courses from './courses';\nimport _lessons from './lessons';\nimport _holidays from './holidays';\nimport _schoolYears from './school-years';\n\nexport default {\n schedules: _schedules,\n hours: _hours,\n substitutionPlans: _substitutionPlans,\n classes: _classes,\n teachers: _teachers,\n subjects: _subjects,\n rooms: _rooms,\n courses: _courses,\n lessons: _lessons,\n holidays: _holidays,\n schoolYears: _schoolYears\n};"],"mappings":";;;;;;;;;;;;;AAYA,mBAAe;CACb,WAAmBA;CACnB,OAAmBC;CACnB,mBAAmBC;CACnB,SAAmBC;CACnB,UAAmBC;CACnB,UAAmBC;CACnB,OAAmBC;CACnB,SAAmBC;CACnB,SAAmBC;CACnB,UAAmBC;CACnB,aAAmBC"}
@@ -1 +1 @@
1
- {"version":3,"file":"lessons.js","names":[],"sources":["../../../src/sdui/from/lessons.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n lesson: SduiTypes.lesson\n): OutTypes.event => {\n const start = lesson.begins_at;\n const end = lesson.ends_at;\n const duration = Math.floor((new Date(end).getTime() - new Date(start).getTime()) / 60000); // in minutes\n\n return {\n ids: lesson.id,\n course: lesson.course_id,\n start: lesson.begins_at,\n end: lesson.ends_at,\n preferredDuration: duration,\n locations: lesson.rooms?.map((to, i) => ({ locations: [to], groupIndex: i })),\n teachers: lesson.teachers?.map(to => ({ to })),\n groups: lesson.classes.map(to => ({ to })),\n };\n};"],"mappings":";AAGA,uBACE,WACmB;CACnB,MAAM,QAAW,OAAO;CACxB,MAAM,MAAW,OAAO;CACxB,MAAM,WAAW,KAAK,OAAO,IAAI,KAAK,IAAI,CAAC,SAAS,GAAG,IAAI,KAAK,MAAM,CAAC,SAAS,IAAI,IAAM;AAE1F,QAAO;EACL,KAAmB,OAAO;EAC1B,QAAmB,OAAO;EAC1B,OAAmB,OAAO;EAC1B,KAAmB,OAAO;EAC1B,mBAAmB;EACnB,WAAmB,OAAO,OAAO,KAAK,IAAI,OAAO;GAAE,WAAW,CAAC,GAAG;GAAE,YAAY;GAAG,EAAE;EACrF,UAAmB,OAAO,UAAU,KAAI,QAAO,EAAE,IAAI,EAAE;EACvD,QAAmB,OAAO,QAAQ,KAAI,QAAO,EAAE,IAAI,EAAE;EACtD"}
1
+ {"version":3,"file":"lessons.js","names":[],"sources":["../../../src/sdui/from/lessons.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n lesson: SduiTypes.lesson\n): OutTypes.event => {\n const start = lesson.begins_at;\n const end = lesson.ends_at;\n const duration = Math.floor((new Date(end).getTime() - new Date(start).getTime()) / 60000); // in minutes\n\n return {\n ids: lesson.id,\n course: lesson.course_id,\n start: lesson.begins_at,\n end: lesson.ends_at,\n preferredDuration: duration,\n locations: lesson.rooms?.map((to, i) => ({ locations: [to], groupIndex: i })),\n teachers: lesson.teachers?.map(to => ({ to })),\n groups: lesson.classes.map(to => ({ to })),\n };\n};"],"mappings":";AAGA,uBACE,WACmB;CACnB,MAAM,QAAW,OAAO;CACxB,MAAM,MAAW,OAAO;CACxB,MAAM,WAAW,KAAK,OAAO,IAAI,KAAK,KAAK,YAAY,IAAI,KAAK,OAAO,aAAa;AAEpF,QAAO;EACL,KAAmB,OAAO;EAC1B,QAAmB,OAAO;EAC1B,OAAmB,OAAO;EAC1B,KAAmB,OAAO;EAC1B,mBAAmB;EACnB,WAAmB,OAAO,OAAO,KAAK,IAAI,OAAO;GAAE,WAAW,CAAC;GAAK,YAAY;;EAChF,UAAmB,OAAO,UAAU,KAAI,QAAO,EAAE;EACjD,QAAmB,OAAO,QAAQ,KAAI,QAAO,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"rooms.js","names":[],"sources":["../../../src/sdui/from/rooms.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n room: SduiTypes.room\n): OutTypes.location => {\n return {\n ids: room.id,\n displayName: room.name,\n };\n};\n"],"mappings":";AAGA,qBACE,SACsB;AACtB,QAAO;EACL,KAAa,KAAK;EAClB,aAAa,KAAK;EACnB"}
1
+ {"version":3,"file":"rooms.js","names":[],"sources":["../../../src/sdui/from/rooms.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n room: SduiTypes.room\n): OutTypes.location => {\n return {\n ids: room.id,\n displayName: room.name,\n };\n};\n"],"mappings":";AAGA,qBACE,SACsB;AACtB,QAAO;EACL,KAAa,KAAK;EAClB,aAAa,KAAK"}
@@ -1,7 +1,5 @@
1
1
  import { InternalIdKey } from "../../core/types/common/index.js";
2
2
  import { Types } from "../../core/types/index.js";
3
- import "../../core/index.js";
4
- import "../types/index.js";
5
3
 
6
4
  //#region src/sdui/from/schedules.d.ts
7
5
  declare namespace OutTypes {
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["_schoolYears","_classes","_teachers","_rooms","_courses","_lessons","_substitutionPlans"],"sources":["../../../src/sdui/from/schedules.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { CoreTypes } from '../../core';\nimport _classes from './classes';\nimport _courses from './courses';\nimport _lessons from './lessons';\nimport _rooms from './rooms';\nimport _schoolYears from './school-years';\nimport _substitutionPlans from './substitution-plans';\nimport _teachers from './teachers';\nimport type { InternalIdKey } from '../../core/types/common';\n\nexport namespace OutTypes {\n export type division = Pick<CoreTypes.Serialized.Division, 'start' | 'end'>;\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type person = Omit<CoreTypes.Serialized.Person, InternalIdKey>;\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey | 'person'> & { person: OutTypes.person };\n export type location = Omit<CoreTypes.Serialized.Location, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n export type event = Omit<CoreTypes.Serialized.Event, InternalIdKey>;\n export type exception = Omit<CoreTypes.Serialized.Exception, InternalIdKey>;\n}\n\ntype Out = {\n divisions: OutTypes.division;\n groups: OutTypes.group[];\n teachers: OutTypes.teacher[];\n locations: OutTypes.location[];\n courses: OutTypes.course[];\n events: OutTypes.event[];\n exceptions: OutTypes.exception[];\n};\n\nexport default (schedule: SduiTypes.schedule): Out => {\n return {\n divisions: _schoolYears(schedule.schoolYear),\n groups: schedule.classes ?.map(_classes) ?? [],\n teachers: schedule.teachers?.map(_teachers) ?? [],\n locations: schedule.rooms ?.map(_rooms) ?? [],\n courses: schedule.courses ?.map(_courses) ?? [],\n events: schedule.lessons ?.map(_lessons) ?? [],\n exceptions: _substitutionPlans(schedule.substitution_plan),\n // settings: schedule.hours?.map(_hours)[0] ?? {},\n // holidays: schedule.holidays?.map(_holidays),\n // subjects: schedule.subjects?.map(_subjects),\n };\n};"],"mappings":";;;;;;;;;AAgCA,yBAAgB,aAAsC;AACpD,QAAO;EACL,WAAYA,qBAAa,SAAS,WAAW;EAC7C,QAAY,SAAS,SAAU,IAAIC,gBAAS,IAAK,EAAE;EACnD,UAAY,SAAS,UAAU,IAAIC,iBAAU,IAAI,EAAE;EACnD,WAAY,SAAS,OAAU,IAAIC,cAAO,IAAO,EAAE;EACnD,SAAY,SAAS,SAAU,IAAIC,gBAAS,IAAK,EAAE;EACnD,QAAY,SAAS,SAAU,IAAIC,gBAAS,IAAK,EAAE;EACnD,YAAYC,2BAAmB,SAAS,kBAAkB;EAI3D"}
1
+ {"version":3,"file":"schedules.js","names":["_schoolYears","_classes","_teachers","_rooms","_courses","_lessons","_substitutionPlans"],"sources":["../../../src/sdui/from/schedules.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { CoreTypes } from '../../core';\nimport _classes from './classes';\nimport _courses from './courses';\nimport _lessons from './lessons';\nimport _rooms from './rooms';\nimport _schoolYears from './school-years';\nimport _substitutionPlans from './substitution-plans';\nimport _teachers from './teachers';\nimport type { InternalIdKey } from '../../core/types/common';\n\nexport namespace OutTypes {\n export type division = Pick<CoreTypes.Serialized.Division, 'start' | 'end'>;\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type person = Omit<CoreTypes.Serialized.Person, InternalIdKey>;\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey | 'person'> & { person: OutTypes.person };\n export type location = Omit<CoreTypes.Serialized.Location, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n export type event = Omit<CoreTypes.Serialized.Event, InternalIdKey>;\n export type exception = Omit<CoreTypes.Serialized.Exception, InternalIdKey>;\n}\n\ntype Out = {\n divisions: OutTypes.division;\n groups: OutTypes.group[];\n teachers: OutTypes.teacher[];\n locations: OutTypes.location[];\n courses: OutTypes.course[];\n events: OutTypes.event[];\n exceptions: OutTypes.exception[];\n};\n\nexport default (schedule: SduiTypes.schedule): Out => {\n return {\n divisions: _schoolYears(schedule.schoolYear),\n groups: schedule.classes ?.map(_classes) ?? [],\n teachers: schedule.teachers?.map(_teachers) ?? [],\n locations: schedule.rooms ?.map(_rooms) ?? [],\n courses: schedule.courses ?.map(_courses) ?? [],\n events: schedule.lessons ?.map(_lessons) ?? [],\n exceptions: _substitutionPlans(schedule.substitution_plan),\n // settings: schedule.hours?.map(_hours)[0] ?? {},\n // holidays: schedule.holidays?.map(_holidays),\n // subjects: schedule.subjects?.map(_subjects),\n };\n};"],"mappings":";;;;;;;;;AAgCA,yBAAgB,aAAsC;AACpD,QAAO;EACL,WAAYA,qBAAa,SAAS;EAClC,QAAY,SAAS,SAAU,IAAIC,oBAAc;EACjD,UAAY,SAAS,UAAU,IAAIC,qBAAc;EACjD,WAAY,SAAS,OAAU,IAAIC,kBAAc;EACjD,SAAY,SAAS,SAAU,IAAIC,oBAAc;EACjD,QAAY,SAAS,SAAU,IAAIC,oBAAc;EACjD,YAAYC,2BAAmB,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"school-years.js","names":[],"sources":["../../../src/sdui/from/school-years.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n schoolYear: SduiTypes.schoolYear\n): OutTypes.division => {\n return {\n start: schoolYear.begins_at,\n end: schoolYear.ends_at\n };\n};\n"],"mappings":";AAGA,4BACE,eACsB;AACtB,QAAO;EACL,OAAO,WAAW;EAClB,KAAO,WAAW;EACnB"}
1
+ {"version":3,"file":"school-years.js","names":[],"sources":["../../../src/sdui/from/school-years.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n schoolYear: SduiTypes.schoolYear\n): OutTypes.division => {\n return {\n start: schoolYear.begins_at,\n end: schoolYear.ends_at\n };\n};\n"],"mappings":";AAGA,4BACE,eACsB;AACtB,QAAO;EACL,OAAO,WAAW;EAClB,KAAO,WAAW"}
@@ -1 +1 @@
1
- {"version":3,"file":"substitution-plans.js","names":[],"sources":["../../../src/sdui/from/substitution-plans.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n substitutionPlan?: SduiTypes.substitutionPlan\n): OutTypes.exception[] => {\n if (!substitutionPlan) return [];\n\n const {\n cancellations,\n lesson_changes,\n additionals\n } = substitutionPlan;\n\n return [\n // ...cancellations.map(\n // cancellation => ({\n // ids: cancellation.id\n // })\n // ),\n // ...lesson_changes.map(\n // lesson_change => ({\n // ids: lesson_change.id\n // })\n // ),\n // ...additionals.map(\n // additional => ({\n // ids: additional.id\n // })\n // )\n ];\n};"],"mappings":";AAGA,kCACE,qBACyB;AACzB,KAAI,CAAC,iBAAkB,QAAO,EAAE;CAEhC,MAAM,EACJ,eACA,gBACA,gBACE;AAEJ,QAAO,EAgBN"}
1
+ {"version":3,"file":"substitution-plans.js","names":[],"sources":["../../../src/sdui/from/substitution-plans.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n substitutionPlan?: SduiTypes.substitutionPlan\n): OutTypes.exception[] => {\n if (!substitutionPlan) return [];\n\n const {\n cancellations,\n lesson_changes,\n additionals\n } = substitutionPlan;\n\n return [\n // ...cancellations.map(\n // cancellation => ({\n // ids: cancellation.id\n // })\n // ),\n // ...lesson_changes.map(\n // lesson_change => ({\n // ids: lesson_change.id\n // })\n // ),\n // ...additionals.map(\n // additional => ({\n // ids: additional.id\n // })\n // )\n ];\n};"],"mappings":";AAGA,kCACE,qBACyB;AACzB,KAAI,CAAC,iBAAkB,QAAO;CAE9B,MAAM,EACJ,eACA,gBACA,gBACE;AAEJ,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"teachers.js","names":[],"sources":["../../../src/sdui/from/teachers.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n teacher: SduiTypes.teacher\n): OutTypes.teacher => {\n return {\n ids: teacher.id,\n displayName: teacher.shortcut,\n person: {\n lastName: teacher.firstname,\n firstName: teacher.lastname\n }\n };\n};\n"],"mappings":";AAGA,wBACE,YACqB;AACrB,QAAO;EACL,KAAa,QAAQ;EACrB,aAAa,QAAQ;EACrB,QAAa;GACX,UAAW,QAAQ;GACnB,WAAW,QAAQ;GACpB;EACF"}
1
+ {"version":3,"file":"teachers.js","names":[],"sources":["../../../src/sdui/from/teachers.ts"],"sourcesContent":["import type { Types as SduiTypes } from '../types';\nimport type { OutTypes } from './schedules';\n\nexport default (\n teacher: SduiTypes.teacher\n): OutTypes.teacher => {\n return {\n ids: teacher.id,\n displayName: teacher.shortcut,\n person: {\n lastName: teacher.firstname,\n firstName: teacher.lastname\n }\n };\n};\n"],"mappings":";AAGA,wBACE,YACqB;AACrB,QAAO;EACL,KAAa,QAAQ;EACrB,aAAa,QAAQ;EACrB,QAAa;GACX,UAAW,QAAQ;GACnB,WAAW,QAAQ"}
@@ -1 +1 @@
1
- {"version":3,"file":"classes.js","names":[],"sources":["../../../src/sdui/to/classes.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n group: CoreTypes.Mixed.Group,\n options: SduiTypes.options\n): SduiTypes.classes => {\n return {\n id: getVertexId(group, options),\n };\n};\n"],"mappings":";;;AAIA,uBACE,OACA,YACsB;AACtB,QAAO,EACL,IAAI,YAAY,OAAO,QAAQ,EAChC"}
1
+ {"version":3,"file":"classes.js","names":[],"sources":["../../../src/sdui/to/classes.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n group: CoreTypes.Mixed.Group,\n options: SduiTypes.options\n): SduiTypes.classes => {\n return {\n id: getVertexId(group, options),\n };\n};\n"],"mappings":";;;AAIA,uBACE,OACA,YACsB;AACtB,QAAO,EACL,IAAI,YAAY,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"courses.js","names":[],"sources":["../../../src/sdui/to/courses.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n course: CoreTypes.Mixed.Course,\n options: SduiTypes.options\n): SduiTypes.course => {\n return {\n id: getVertexId(course, options),\n name: course.displayName,\n color: course.color,\n teachers: (course.teachers ?? []).map(x => getVertexId(x.to, options)),\n classes: (course.groups ?? []).map(x => getVertexId(x.to, options)),\n };\n};"],"mappings":";;;AAIA,uBACE,QACA,YACqB;AACrB,QAAO;EACL,IAAU,YAAY,QAAQ,QAAQ;EACtC,MAAU,OAAO;EACjB,OAAU,OAAO;EACjB,WAAW,OAAO,YAAY,EAAE,EAAE,KAAI,MAAK,YAAY,EAAE,IAAI,QAAQ,CAAC;EACtE,UAAW,OAAO,UAAY,EAAE,EAAE,KAAI,MAAK,YAAY,EAAE,IAAI,QAAQ,CAAC;EACvE"}
1
+ {"version":3,"file":"courses.js","names":[],"sources":["../../../src/sdui/to/courses.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n course: CoreTypes.Mixed.Course,\n options: SduiTypes.options\n): SduiTypes.course => {\n return {\n id: getVertexId(course, options),\n name: course.displayName,\n color: course.color,\n teachers: (course.teachers ?? []).map(x => getVertexId(x.to, options)),\n classes: (course.groups ?? []).map(x => getVertexId(x.to, options)),\n };\n};"],"mappings":";;;AAIA,uBACE,QACA,YACqB;AACrB,QAAO;EACL,IAAU,YAAY,QAAQ;EAC9B,MAAU,OAAO;EACjB,OAAU,OAAO;EACjB,WAAW,OAAO,YAAY,IAAI,KAAI,MAAK,YAAY,EAAE,IAAI;EAC7D,UAAW,OAAO,UAAY,IAAI,KAAI,MAAK,YAAY,EAAE,IAAI"}
@@ -1,5 +1,5 @@
1
- import { getVertexId } from "../../core/util.js";
2
1
  import { toISOString } from "../../common/functions.js";
2
+ import { getVertexId } from "../../core/util.js";
3
3
 
4
4
  //#region src/sdui/to/holidays.ts
5
5
  var holidays_default = (exception, options) => {
@@ -1 +1 @@
1
- {"version":3,"file":"holidays.js","names":[],"sources":["../../../src/sdui/to/holidays.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\n\nexport default (\n exception: CoreTypes.Mixed.Exception,\n options: SduiTypes.options\n): SduiTypes.holiday => {\n return {\n id: getVertexId(exception, options),\n name: exception.description ?? '',\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n };\n};\n"],"mappings":";;;;AAKA,wBACE,WACA,YACsB;AACtB,QAAO;EACL,IAAW,YAAY,WAAW,QAAQ;EAC1C,MAAW,UAAU,eAAe;EACpC,WAAW,YAAY,UAAU,MAAM;EACvC,SAAW,YAAY,UAAU,IAAI;EACtC"}
1
+ {"version":3,"file":"holidays.js","names":[],"sources":["../../../src/sdui/to/holidays.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\n\nexport default (\n exception: CoreTypes.Mixed.Exception,\n options: SduiTypes.options\n): SduiTypes.holiday => {\n return {\n id: getVertexId(exception, options),\n name: exception.description ?? '',\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n };\n};\n"],"mappings":";;;;AAKA,wBACE,WACA,YACsB;AACtB,QAAO;EACL,IAAW,YAAY,WAAW;EAClC,MAAW,UAAU,eAAe;EACpC,WAAW,YAAY,UAAU;EACjC,SAAW,YAAY,UAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"hours.js","names":[],"sources":["../../../src/sdui/to/hours.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n settings: CoreTypes.Mixed.Settings,\n options: SduiTypes.options\n): SduiTypes.hour => {\n return {\n id: getVertexId(settings, options),\n name: '',\n time_begins_at: settings.dayStart,\n time_ends_at: settings.dayEnd,\n };\n};\n"],"mappings":";;;AAIA,qBACE,UACA,YACmB;AACnB,QAAO;EACL,IAAgB,YAAY,UAAU,QAAQ;EAC9C,MAAgB;EAChB,gBAAgB,SAAS;EACzB,cAAgB,SAAS;EAC1B"}
1
+ {"version":3,"file":"hours.js","names":[],"sources":["../../../src/sdui/to/hours.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n settings: CoreTypes.Mixed.Settings,\n options: SduiTypes.options\n): SduiTypes.hour => {\n return {\n id: getVertexId(settings, options),\n name: '',\n time_begins_at: settings.dayStart,\n time_ends_at: settings.dayEnd,\n };\n};\n"],"mappings":";;;AAIA,qBACE,UACA,YACmB;AACnB,QAAO;EACL,IAAgB,YAAY,UAAU;EACtC,MAAgB;EAChB,gBAAgB,SAAS;EACzB,cAAgB,SAAS"}
@@ -1,7 +1,5 @@
1
1
  import { Types } from "../../core/types/index.js";
2
2
  import { Types as Types$1 } from "../types/index.js";
3
- import "../index.js";
4
- import "../../index.js";
5
3
 
6
4
  //#region src/sdui/to/index.d.ts
7
5
  declare class export_default {
@@ -1,5 +1,5 @@
1
- import { getVertexId } from "../../core/util.js";
2
1
  import { toISOString } from "../../common/functions.js";
2
+ import { getVertexId } from "../../core/util.js";
3
3
 
4
4
  //#region src/sdui/to/lessons.ts
5
5
  var lessons_default = (event, options) => {
@@ -1 +1 @@
1
- {"version":3,"file":"lessons.js","names":[],"sources":["../../../src/sdui/to/lessons.ts"],"sourcesContent":["import { toISOString } from '../../common/functions';\nimport { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n event: CoreTypes.Mixed.Event,\n options: SduiTypes.options\n): SduiTypes.lesson => {\n const course_id = event.course ? getVertexId(event.course, options) : undefined;\n if (!course_id)\n throw new Error(`(Sdui::to::Lessons) Course is not missing for event ${ getVertexId(event, options) }`);\n\n const begins_at = toISOString(event.start);\n if (!begins_at)\n throw new Error(`(Sdui::to::Lessons) Start is not missing for event ${ getVertexId(event, options) }`);\n\n const ends_at = toISOString(event.end);\n if (!ends_at)\n throw new Error(`(Sdui::to::Lessons) End is not missing for event ${ getVertexId(event, options) }`);\n\n return {\n id: getVertexId(event, options),\n course_id,\n begins_at,\n ends_at,\n teachers: (event.teachers ?? []).map(x => getVertexId(x.to, options)),\n classes: (event.groups ?? []).map(x => getVertexId(x.to, options)),\n };\n};"],"mappings":";;;;AAKA,uBACE,OACA,YACqB;CACrB,MAAM,YAAY,MAAM,SAAS,YAAY,MAAM,QAAQ,QAAQ,GAAG;AACtE,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,uDAAwD,YAAY,OAAO,QAAQ,GAAI;CAEzG,MAAM,YAAY,YAAY,MAAM,MAAM;AAC1C,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,sDAAuD,YAAY,OAAO,QAAQ,GAAI;CAExG,MAAM,UAAU,YAAY,MAAM,IAAI;AACtC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,oDAAqD,YAAY,OAAO,QAAQ,GAAI;AAEtG,QAAO;EACL,IAAU,YAAY,OAAO,QAAQ;EACrC;EACA;EACA;EACA,WAAW,MAAM,YAAY,EAAE,EAAE,KAAI,MAAK,YAAY,EAAE,IAAI,QAAQ,CAAC;EACrE,UAAW,MAAM,UAAY,EAAE,EAAE,KAAI,MAAK,YAAY,EAAE,IAAI,QAAQ,CAAC;EACtE"}
1
+ {"version":3,"file":"lessons.js","names":[],"sources":["../../../src/sdui/to/lessons.ts"],"sourcesContent":["import { toISOString } from '../../common/functions';\nimport { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n event: CoreTypes.Mixed.Event,\n options: SduiTypes.options\n): SduiTypes.lesson => {\n const course_id = event.course ? getVertexId(event.course, options) : undefined;\n if (!course_id)\n throw new Error(`(Sdui::to::Lessons) Course is not missing for event ${ getVertexId(event, options) }`);\n\n const begins_at = toISOString(event.start);\n if (!begins_at)\n throw new Error(`(Sdui::to::Lessons) Start is not missing for event ${ getVertexId(event, options) }`);\n\n const ends_at = toISOString(event.end);\n if (!ends_at)\n throw new Error(`(Sdui::to::Lessons) End is not missing for event ${ getVertexId(event, options) }`);\n\n return {\n id: getVertexId(event, options),\n course_id,\n begins_at,\n ends_at,\n teachers: (event.teachers ?? []).map(x => getVertexId(x.to, options)),\n classes: (event.groups ?? []).map(x => getVertexId(x.to, options)),\n };\n};"],"mappings":";;;;AAKA,uBACE,OACA,YACqB;CACrB,MAAM,YAAY,MAAM,SAAS,YAAY,MAAM,QAAQ,WAAW;AACtE,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,uDAAwD,YAAY,OAAO;CAE7F,MAAM,YAAY,YAAY,MAAM;AACpC,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,sDAAuD,YAAY,OAAO;CAE5F,MAAM,UAAU,YAAY,MAAM;AAClC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,oDAAqD,YAAY,OAAO;AAE1F,QAAO;EACL,IAAU,YAAY,OAAO;EAC7B;EACA;EACA;EACA,WAAW,MAAM,YAAY,IAAI,KAAI,MAAK,YAAY,EAAE,IAAI;EAC5D,UAAW,MAAM,UAAY,IAAI,KAAI,MAAK,YAAY,EAAE,IAAI"}
@@ -1 +1 @@
1
- {"version":3,"file":"rooms.js","names":[],"sources":["../../../src/sdui/to/rooms.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n location: CoreTypes.Mixed.Location,\n options: SduiTypes.options\n): SduiTypes.room => {\n return {\n id: getVertexId(location, options),\n name: location.displayName,\n };\n};"],"mappings":";;;AAIA,qBACE,UACA,YACmB;AACnB,QAAO;EACL,IAAM,YAAY,UAAU,QAAQ;EACpC,MAAM,SAAS;EAChB"}
1
+ {"version":3,"file":"rooms.js","names":[],"sources":["../../../src/sdui/to/rooms.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n location: CoreTypes.Mixed.Location,\n options: SduiTypes.options\n): SduiTypes.room => {\n return {\n id: getVertexId(location, options),\n name: location.displayName,\n };\n};"],"mappings":";;;AAIA,qBACE,UACA,YACmB;AACnB,QAAO;EACL,IAAM,YAAY,UAAU;EAC5B,MAAM,SAAS"}
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["_schoolYears","_classes","_courses","_hours","_lessons","_rooms","_substitutionPlans","_teachers"],"sources":["../../../src/sdui/to/schedules.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport _classes from './classes';\nimport _courses from './courses';\nimport _hours from './hours';\nimport _lessons from './lessons';\nimport _rooms from './rooms';\nimport _schoolYears from './school-years';\nimport _substitutionPlans from './substitution-plans';\nimport _teachers from './teachers';\n\nexport default (\n schedule: CoreTypes.Mixed.Schedule,\n options: SduiTypes.options = {}\n): SduiTypes.schedule => {\n return {\n schoolYear: _schoolYears(schedule.divisions, options),\n classes: schedule.groups?.map(x => _classes(x, options)),\n courses: schedule.courses?.map(x => _courses(x, options)),\n // holidays: schedule.holidays?.map(_holidays),\n hours: [_hours(schedule.settings, options)],\n lessons: schedule.events?.map(x => _lessons(x, options)),\n rooms: schedule.locations?.map(x => _rooms(x, options)),\n // subjects: schedule.subjects?.map(_subjects),\n substitution_plan: _substitutionPlans(schedule.exceptions, options),\n teachers: schedule.teachers?.map(x => _teachers(x, options)),\n };\n};\n"],"mappings":";;;;;;;;;;AAWA,yBACE,UACA,UAA8B,EAAE,KACT;AACvB,QAAO;EACL,YAAmBA,qBAAa,SAAS,WAAW,QAAQ;EAC5D,SAAmB,SAAS,QAAQ,KAAI,MAAKC,gBAAS,GAAG,QAAQ,CAAC;EAClE,SAAmB,SAAS,SAAS,KAAI,MAAKC,gBAAS,GAAG,QAAQ,CAAC;EAEnE,OAAmB,CAACC,cAAO,SAAS,UAAU,QAAQ,CAAC;EACvD,SAAmB,SAAS,QAAQ,KAAI,MAAKC,gBAAS,GAAG,QAAQ,CAAC;EAClE,OAAmB,SAAS,WAAW,KAAI,MAAKC,cAAO,GAAG,QAAQ,CAAC;EAEnE,mBAAmBC,2BAAmB,SAAS,YAAY,QAAQ;EACnE,UAAmB,SAAS,UAAU,KAAI,MAAKC,iBAAU,GAAG,QAAQ,CAAC;EACtE"}
1
+ {"version":3,"file":"schedules.js","names":["_schoolYears","_classes","_courses","_hours","_lessons","_rooms","_substitutionPlans","_teachers"],"sources":["../../../src/sdui/to/schedules.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport _classes from './classes';\nimport _courses from './courses';\nimport _hours from './hours';\nimport _lessons from './lessons';\nimport _rooms from './rooms';\nimport _schoolYears from './school-years';\nimport _substitutionPlans from './substitution-plans';\nimport _teachers from './teachers';\n\nexport default (\n schedule: CoreTypes.Mixed.Schedule,\n options: SduiTypes.options = {}\n): SduiTypes.schedule => {\n return {\n schoolYear: _schoolYears(schedule.divisions, options),\n classes: schedule.groups?.map(x => _classes(x, options)),\n courses: schedule.courses?.map(x => _courses(x, options)),\n // holidays: schedule.holidays?.map(_holidays),\n hours: [_hours(schedule.settings, options)],\n lessons: schedule.events?.map(x => _lessons(x, options)),\n rooms: schedule.locations?.map(x => _rooms(x, options)),\n // subjects: schedule.subjects?.map(_subjects),\n substitution_plan: _substitutionPlans(schedule.exceptions, options),\n teachers: schedule.teachers?.map(x => _teachers(x, options)),\n };\n};\n"],"mappings":";;;;;;;;;;AAWA,yBACE,UACA,UAA8B,OACP;AACvB,QAAO;EACL,YAAmBA,qBAAa,SAAS,WAAW;EACpD,SAAmB,SAAS,QAAQ,KAAI,MAAKC,gBAAS,GAAG;EACzD,SAAmB,SAAS,SAAS,KAAI,MAAKC,gBAAS,GAAG;EAE1D,OAAmB,CAACC,cAAO,SAAS,UAAU;EAC9C,SAAmB,SAAS,QAAQ,KAAI,MAAKC,gBAAS,GAAG;EACzD,OAAmB,SAAS,WAAW,KAAI,MAAKC,cAAO,GAAG;EAE1D,mBAAmBC,2BAAmB,SAAS,YAAY;EAC3D,UAAmB,SAAS,UAAU,KAAI,MAAKC,iBAAU,GAAG"}
@@ -1,5 +1,5 @@
1
- import { getVertexId } from "../../core/util.js";
2
1
  import { toISOString } from "../../common/functions.js";
2
+ import { getVertexId } from "../../core/util.js";
3
3
 
4
4
  //#region src/sdui/to/school-years.ts
5
5
  var school_years_default = (division, options) => {
@@ -1 +1 @@
1
- {"version":3,"file":"school-years.js","names":[],"sources":["../../../src/sdui/to/school-years.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\nimport { getVertexId } from '../../core/util';\n\nexport default (\n division: CoreTypes.Mixed.Division,\n options: SduiTypes.options\n): SduiTypes.schoolYear => {\n const begins_at = toISOString(division.start);\n if (!begins_at)\n throw new Error(`(Sdui::to::SchoolYear) Start is not missing for division ${ getVertexId(division, options) }`);\n\n const ends_at = toISOString(division.end);\n if (!ends_at)\n throw new Error(`(Sdui::to::SchoolYear) End is not missing for division ${ getVertexId(division, options) }`);\n\n return {\n begins_at,\n ends_at\n };\n};\n"],"mappings":";;;;AAKA,4BACE,UACA,YACyB;CACzB,MAAM,YAAY,YAAY,SAAS,MAAM;AAC7C,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,4DAA6D,YAAY,UAAU,QAAQ,GAAI;CAEjH,MAAM,UAAU,YAAY,SAAS,IAAI;AACzC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,0DAA2D,YAAY,UAAU,QAAQ,GAAI;AAE/G,QAAO;EACL;EACA;EACD"}
1
+ {"version":3,"file":"school-years.js","names":[],"sources":["../../../src/sdui/to/school-years.ts"],"sourcesContent":["import type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\nimport { getVertexId } from '../../core/util';\n\nexport default (\n division: CoreTypes.Mixed.Division,\n options: SduiTypes.options\n): SduiTypes.schoolYear => {\n const begins_at = toISOString(division.start);\n if (!begins_at)\n throw new Error(`(Sdui::to::SchoolYear) Start is not missing for division ${ getVertexId(division, options) }`);\n\n const ends_at = toISOString(division.end);\n if (!ends_at)\n throw new Error(`(Sdui::to::SchoolYear) End is not missing for division ${ getVertexId(division, options) }`);\n\n return {\n begins_at,\n ends_at\n };\n};\n"],"mappings":";;;;AAKA,4BACE,UACA,YACyB;CACzB,MAAM,YAAY,YAAY,SAAS;AACvC,KAAI,CAAC,UACH,OAAM,IAAI,MAAM,4DAA6D,YAAY,UAAU;CAErG,MAAM,UAAU,YAAY,SAAS;AACrC,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,0DAA2D,YAAY,UAAU;AAEnG,QAAO;EACL;EACA"}
@@ -1,5 +1,5 @@
1
- import { getVertexId } from "../../core/util.js";
2
1
  import { toISOString } from "../../common/functions.js";
2
+ import { getVertexId } from "../../core/util.js";
3
3
 
4
4
  //#region src/sdui/to/substitution-plans.ts
5
5
  function _mapCancellation(exceptions, options) {
@@ -34,10 +34,13 @@ function _mapAdditionals(exceptions, options) {
34
34
  }));
35
35
  }
36
36
  var substitution_plans_default = (exceptions, options) => {
37
+ const cancellations = _mapCancellation(exceptions.filter((exception) => exception.action === "cancel"), options);
38
+ const lesson_changes = _mapLessonChanges(exceptions.filter((exception) => exception.action && ["substitute", "reschedule"].includes(exception.action)), options);
39
+ const additionals = _mapAdditionals(exceptions.filter((exception) => exception.action === "add"), options);
37
40
  return {
38
- cancellations: _mapCancellation(exceptions.filter((exception) => exception.action === "cancel"), options),
39
- lesson_changes: _mapLessonChanges(exceptions.filter((exception) => exception.action && ["substitute", "reschedule"].includes(exception.action)), options),
40
- additionals: _mapAdditionals(exceptions.filter((exception) => exception.action === "add"), options)
41
+ cancellations,
42
+ lesson_changes,
43
+ additionals
41
44
  };
42
45
  };
43
46
 
@@ -1 +1 @@
1
- {"version":3,"file":"substitution-plans.js","names":[],"sources":["../../../src/sdui/to/substitution-plans.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\n\nfunction _mapCancellation (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['cancellations'] {\n return exceptions.map(exception => ({\n action: 'cancel',\n lesson_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n }));\n}\n\nfunction _mapLessonChanges (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['lesson_changes'] {\n return exceptions.map(exception => ({\n action: exception.reason ?? '',\n lesson_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n classes: [],\n teachers: [],\n rooms: [],\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n }));\n}\n\nfunction _mapAdditionals (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['additionals'] {\n return exceptions.map(exception => ({\n action: exception.reason ?? '',\n course_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n classes: [],\n teachers: [],\n rooms: [],\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n }));\n}\n\nexport default (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan => {\n const cancellations = _mapCancellation(exceptions.filter(\n exception => exception.action === 'cancel'\n ), options);\n\n const lesson_changes = _mapLessonChanges(exceptions.filter(\n exception => exception.action && ['substitute', 'reschedule'].includes(exception.action)\n ), options);\n\n const additionals = _mapAdditionals(exceptions.filter(\n exception => exception.action === 'add'\n ), options);\n\n return {\n cancellations,\n lesson_changes,\n additionals,\n };\n};\n"],"mappings":";;;;AAKA,SAAS,iBACP,YACA,SAC6C;AAC7C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW;EACX,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,QAAQ,GAAG;EACvF,SAAW,UAAU,eAAe;EACrC,EAAE;;AAGL,SAAS,kBACP,YACA,SAC8C;AAC9C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW,UAAU,UAAU;EAC/B,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,QAAQ,GAAG;EACvF,SAAW,UAAU,eAAe;EACpC,SAAW,EAAE;EACb,UAAW,EAAE;EACb,OAAW,EAAE;EACb,WAAW,YAAY,UAAU,MAAM;EACvC,SAAW,YAAY,UAAU,IAAI;EACtC,EAAE;;AAGL,SAAS,gBACP,YACA,SAC2C;AAC3C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW,UAAU,UAAU;EAC/B,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,QAAQ,GAAG;EACvF,SAAW,UAAU,eAAe;EACpC,SAAW,EAAE;EACb,UAAW,EAAE;EACb,OAAW,EAAE;EACb,WAAW,YAAY,UAAU,MAAM;EACvC,SAAW,YAAY,UAAU,IAAI;EACtC,EAAE;;AAGL,kCACE,YACA,YAC+B;AAa/B,QAAO;EACL,eAboB,iBAAiB,WAAW,QAChD,cAAa,UAAU,WAAW,SACnC,EAAE,QAAQ;EAYT,gBAVqB,kBAAkB,WAAW,QAClD,cAAa,UAAU,UAAU,CAAC,cAAc,aAAa,CAAC,SAAS,UAAU,OAAO,CACzF,EAAE,QAAQ;EAST,aAPkB,gBAAgB,WAAW,QAC7C,cAAa,UAAU,WAAW,MACnC,EAAE,QAAQ;EAMV"}
1
+ {"version":3,"file":"substitution-plans.js","names":[],"sources":["../../../src/sdui/to/substitution-plans.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\nimport { toISOString } from '../../common/functions';\n\nfunction _mapCancellation (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['cancellations'] {\n return exceptions.map(exception => ({\n action: 'cancel',\n lesson_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n }));\n}\n\nfunction _mapLessonChanges (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['lesson_changes'] {\n return exceptions.map(exception => ({\n action: exception.reason ?? '',\n lesson_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n classes: [],\n teachers: [],\n rooms: [],\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n }));\n}\n\nfunction _mapAdditionals (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan['additionals'] {\n return exceptions.map(exception => ({\n action: exception.reason ?? '',\n course_id: exception.sources?.[0].to ? getVertexId(exception.sources[0].to, options) : undefined!,\n comment: exception.description ?? '',\n classes: [],\n teachers: [],\n rooms: [],\n begins_at: toISOString(exception.start)!,\n ends_at: toISOString(exception.end)!,\n }));\n}\n\nexport default (\n exceptions: CoreTypes.Mixed.Exception[],\n options: SduiTypes.options\n): SduiTypes.substitutionPlan => {\n const cancellations = _mapCancellation(exceptions.filter(\n exception => exception.action === 'cancel'\n ), options);\n\n const lesson_changes = _mapLessonChanges(exceptions.filter(\n exception => exception.action && ['substitute', 'reschedule'].includes(exception.action)\n ), options);\n\n const additionals = _mapAdditionals(exceptions.filter(\n exception => exception.action === 'add'\n ), options);\n\n return {\n cancellations,\n lesson_changes,\n additionals,\n };\n};\n"],"mappings":";;;;AAKA,SAAS,iBACP,YACA,SAC6C;AAC7C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW;EACX,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,WAAW;EACvF,SAAW,UAAU,eAAe;;;AAIxC,SAAS,kBACP,YACA,SAC8C;AAC9C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW,UAAU,UAAU;EAC/B,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,WAAW;EACvF,SAAW,UAAU,eAAe;EACpC,SAAW;EACX,UAAW;EACX,OAAW;EACX,WAAW,YAAY,UAAU;EACjC,SAAW,YAAY,UAAU;;;AAIrC,SAAS,gBACP,YACA,SAC2C;AAC3C,QAAO,WAAW,KAAI,eAAc;EAClC,QAAW,UAAU,UAAU;EAC/B,WAAW,UAAU,UAAU,GAAG,KAAK,YAAY,UAAU,QAAQ,GAAG,IAAI,WAAW;EACvF,SAAW,UAAU,eAAe;EACpC,SAAW;EACX,UAAW;EACX,OAAW;EACX,WAAW,YAAY,UAAU;EACjC,SAAW,YAAY,UAAU;;;AAIrC,kCACE,YACA,YAC+B;CAC/B,MAAM,gBAAgB,iBAAiB,WAAW,QAChD,cAAa,UAAU,WAAW,WACjC;CAEH,MAAM,iBAAiB,kBAAkB,WAAW,QAClD,cAAa,UAAU,UAAU,CAAC,cAAc,cAAc,SAAS,UAAU,UAChF;CAEH,MAAM,cAAc,gBAAgB,WAAW,QAC7C,cAAa,UAAU,WAAW,QACjC;AAEH,QAAO;EACL;EACA;EACA"}
@@ -1 +1 @@
1
- {"version":3,"file":"teachers.js","names":["firstname: string | undefined","lastname: string | undefined"],"sources":["../../../src/sdui/to/teachers.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n teacher: CoreTypes.Mixed.Teacher,\n options: SduiTypes.options\n): SduiTypes.teacher => {\n let firstname: string | undefined;\n let lastname: string | undefined;\n\n if (teacher.person && !(typeof teacher.person == 'string')) {\n if ('firstName' in teacher.person) firstname = teacher.person.firstName;\n if ('lastName' in teacher.person) lastname = teacher.person.lastName;\n }\n return {\n id: getVertexId(teacher, options),\n // shortcut: teacher.displayName,\n ...firstname && { firstname },\n ...lastname && { lastname }\n };\n};\n"],"mappings":";;;AAIA,wBACE,SACA,YACsB;CACtB,IAAIA;CACJ,IAAIC;AAEJ,KAAI,QAAQ,UAAU,EAAE,OAAO,QAAQ,UAAU,WAAW;AAC1D,MAAI,eAAe,QAAQ,OAAQ,aAAY,QAAQ,OAAO;AAC9D,MAAI,cAAe,QAAQ,OAAQ,YAAY,QAAQ,OAAO;;AAEhE,QAAO;EACL,IAAI,YAAY,SAAS,QAAQ;EAEjC,GAAG,aAAa,EAAE,WAAW;EAC7B,GAAG,YAAa,EAAE,UAAW;EAC9B"}
1
+ {"version":3,"file":"teachers.js","names":["firstname: string | undefined","lastname: string | undefined"],"sources":["../../../src/sdui/to/teachers.ts"],"sourcesContent":["import { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\nimport type { Types as SduiTypes } from '../types';\n\nexport default (\n teacher: CoreTypes.Mixed.Teacher,\n options: SduiTypes.options\n): SduiTypes.teacher => {\n let firstname: string | undefined;\n let lastname: string | undefined;\n\n if (teacher.person && !(typeof teacher.person == 'string')) {\n if ('firstName' in teacher.person) firstname = teacher.person.firstName;\n if ('lastName' in teacher.person) lastname = teacher.person.lastName;\n }\n return {\n id: getVertexId(teacher, options),\n // shortcut: teacher.displayName,\n ...firstname && { firstname },\n ...lastname && { lastname }\n };\n};\n"],"mappings":";;;AAIA,wBACE,SACA,YACsB;CACtB,IAAIA;CACJ,IAAIC;AAEJ,KAAI,QAAQ,UAAU,EAAE,OAAO,QAAQ,UAAU,WAAW;AAC1D,MAAI,eAAe,QAAQ,OAAQ,aAAY,QAAQ,OAAO;AAC9D,MAAI,cAAe,QAAQ,OAAQ,YAAY,QAAQ,OAAO;;AAEhE,QAAO;EACL,IAAI,YAAY,SAAS;EAEzB,GAAG,aAAa,EAAE;EAClB,GAAG,YAAa,EAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_schedule"],"sources":["../../../src/vKlass/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport _schedule from './schedule';\n\nexport default {\n schedules: _schedule\n} satisfies FromInterface;\n"],"mappings":";;;AAGA,mBAAe,EACb,WAAWA,kBACZ"}
1
+ {"version":3,"file":"index.js","names":["_schedule"],"sources":["../../../src/vKlass/from/index.ts"],"sourcesContent":["import type { FromInterface } from '../../common/types';\nimport _schedule from './schedule';\n\nexport default {\n schedules: _schedule\n} satisfies FromInterface;\n"],"mappings":";;;AAGA,mBAAe,EACb,WAAWA"}
@@ -1,6 +1,5 @@
1
1
  import { InternalIdKey } from "../../core/types/common/index.js";
2
2
  import { Types } from "../../core/types/index.js";
3
- import "../../core/index.js";
4
3
  import { Types as Types$1 } from "../types/index.js";
5
4
 
6
5
  //#region src/vKlass/from/schedule.d.ts
@@ -1 +1 @@
1
- {"version":3,"file":"schedule.js","names":["warnings: string[]","errors: string[]","teachers: OutTypes.teacher[]","groups: OutTypes.group[]","courses: OutTypes.course[]","teachers","x","groups"],"sources":["../../../src/vKlass/from/schedule.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { Types as VKlassTypes } from '../types';\nimport type { InternalIdKey } from '../../core/types/common';\nimport { range } from '../../common/functions';\n\nexport namespace OutTypes {\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey>;\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n}\n\ntype Out = {\n teachers: OutTypes.teacher[];\n courses: OutTypes.course [];\n groups: OutTypes.group [];\n meta: {\n errors?: string[];\n warnings?: string[];\n };\n};\n\n\nexport default function (\n src: VKlassTypes.schedule,\n options: VKlassTypes.Options\n): Out {\n\n // gather all import related warnings/errors\n const warnings: string[] = [];\n const errors: string[] = [];\n\n // the schedule period range\n const scheduleRange = {\n start: moment.utc(options.beg),\n end: moment.utc(options.end)\n };\n\n ////\n //// teachers\n ////\n const teachers: OutTypes.teacher[] = [];\n src.staff.forEach(x => {\n teachers.push({\n ids: x.ID.toString(),\n displayName: x.Firstname + ' ' + x.Lastname\n });\n });\n\n\n ////\n //// groups\n ////\n const groups: OutTypes.group[] = [];\n src.classes.forEach(x => {\n groups.push({\n ids: x.ID.toString(),\n displayName: x.Name,\n species: 'class',\n });\n });\n\n\n // build group to staff map\n const groupStaffMap = new Map<number, Set<number> >();\n src.groups_staff.forEach(x => {\n if(!groupStaffMap.has(x.groupId)) groupStaffMap.set(x.groupId, new Set());\n groupStaffMap.get(x.groupId)?.add(x.userId);\n });\n\n // build student to class map\n const studentClassMap = new Map<number, Set<number> >();\n src.classes_students.forEach(x => {\n if(!studentClassMap.has(x.userId)) studentClassMap.set(x.userId, new Set());\n studentClassMap.get(x.userId)?.add(x.classId);\n });\n\n // build group to classes map\n const groupClassesMap = new Map<number, Set<number> >();\n src.groups_students.forEach(x => {\n if (!groupClassesMap.has(x.groupId)) groupClassesMap.set(x.groupId, new Set());\n studentClassMap.get(x.userId)?.forEach(y => groupClassesMap.get(x.groupId)?.add(y));\n });\n\n\n ////\n //// courses\n ////\n const courses: OutTypes.course[] = [];\n src.groups.forEach(x => {\n // ignore courses who's period range does not overlap with the schedule period range\n const courseRange = {\n start: moment.utc(x.StartDate),\n end: moment.utc(x.EndDate)\n };\n if (!range.overlaps(scheduleRange, courseRange)) return;\n\n const teachers = [...groupStaffMap.get(x.ID) ?? []].map(x => ({ to: x.toString() }));\n const groups = [...groupClassesMap.get(x.ID) ?? []].map(x => ({ to: x.toString() }));\n\n courses.push({\n ids: x.ID.toString(),\n displayName: x.Name || x.FriendlyName,\n ...(teachers && { teachers }),\n ...(groups && { groups }),\n });\n });\n\n\n\n return { teachers, groups, courses,\n meta: {\n ...( errors.length ? { errors: errors } : { } ),\n ...( warnings.length ? { warnings: warnings } : { } )\n }\n };\n}\n"],"mappings":";;;;AAuBA,0BACE,KACA,SACK;CAGL,MAAMA,WAAqB,EAAE;CAC7B,MAAMC,SAAqB,EAAE;CAG7B,MAAM,gBAAgB;EACpB,OAAO,OAAO,IAAI,QAAQ,IAAI;EAC9B,KAAO,OAAO,IAAI,QAAQ,IAAI;EAC/B;CAKD,MAAMC,WAA+B,EAAE;AACvC,KAAI,MAAM,SAAQ,MAAK;AACrB,WAAS,KAAK;GACZ,KAAa,EAAE,GAAG,UAAU;GAC5B,aAAa,EAAE,YAAY,MAAM,EAAE;GACpC,CAAC;GACF;CAMF,MAAMC,SAA2B,EAAE;AACnC,KAAI,QAAQ,SAAQ,MAAK;AACvB,SAAO,KAAK;GACV,KAAa,EAAE,GAAG,UAAU;GAC5B,aAAa,EAAE;GACf,SAAa;GACd,CAAC;GACF;CAIF,MAAM,gCAAgB,IAAI,KAA2B;AACrD,KAAI,aAAa,SAAQ,MAAK;AAC5B,MAAG,CAAC,cAAc,IAAI,EAAE,QAAQ,CAAE,eAAc,IAAI,EAAE,yBAAS,IAAI,KAAK,CAAC;AACzE,gBAAc,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO;GAC3C;CAGF,MAAM,kCAAkB,IAAI,KAA2B;AACvD,KAAI,iBAAiB,SAAQ,MAAK;AAChC,MAAG,CAAC,gBAAgB,IAAI,EAAE,OAAO,CAAE,iBAAgB,IAAI,EAAE,wBAAQ,IAAI,KAAK,CAAC;AAC3E,kBAAgB,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ;GAC7C;CAGF,MAAM,kCAAkB,IAAI,KAA2B;AACvD,KAAI,gBAAgB,SAAQ,MAAK;AAC/B,MAAI,CAAC,gBAAgB,IAAI,EAAE,QAAQ,CAAE,iBAAgB,IAAI,EAAE,yBAAS,IAAI,KAAK,CAAC;AAC9E,kBAAgB,IAAI,EAAE,OAAO,EAAE,SAAQ,MAAK,gBAAgB,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;GACnF;CAMF,MAAMC,UAA6B,EAAE;AACrC,KAAI,OAAO,SAAQ,MAAK;EAEtB,MAAM,cAAc;GAClB,OAAO,OAAO,IAAI,EAAE,UAAU;GAC9B,KAAO,OAAO,IAAI,EAAE,QAAQ;GAC7B;AACD,MAAI,CAAC,MAAM,SAAS,eAAe,YAAY,CAAE;EAEjD,MAAMC,aAAW,CAAC,GAAG,cAAc,IAAI,EAAE,GAAG,IAAM,EAAE,CAAC,CAAC,KAAI,SAAM,EAAE,IAAIC,IAAE,UAAU,EAAE,EAAE;EACtF,MAAMC,WAAW,CAAC,GAAG,gBAAgB,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,KAAI,SAAM,EAAE,IAAID,IAAE,UAAU,EAAE,EAAE;AAEtF,UAAQ,KAAK;GACX,KAAa,EAAE,GAAG,UAAU;GAC5B,aAAa,EAAE,QAAQ,EAAE;GACzB,GAAID,cAAY,EAAE,sBAAU;GAC5B,GAAIE,YAAY,EAAE,kBAAQ;GAC3B,CAAC;GACF;AAIF,QAAO;EAAE;EAAU;EAAQ;EACzB,MAAM;GACJ,GAAK,OAAO,SAAW,EAAY,QAAU,GAAG,EAAG;GACnD,GAAK,SAAS,SAAS,EAAY,UAAU,GAAG,EAAG;GACpD;EACF"}
1
+ {"version":3,"file":"schedule.js","names":["warnings: string[]","errors: string[]","teachers: OutTypes.teacher[]","groups: OutTypes.group[]","courses: OutTypes.course[]","teachers","x","groups"],"sources":["../../../src/vKlass/from/schedule.ts"],"sourcesContent":["import moment from 'moment';\nimport type { CoreTypes } from '../../core';\nimport type { Types as VKlassTypes } from '../types';\nimport type { InternalIdKey } from '../../core/types/common';\nimport { range } from '../../common/functions';\n\nexport namespace OutTypes {\n export type teacher = Omit<CoreTypes.Serialized.Teacher, InternalIdKey>;\n export type group = Omit<CoreTypes.Serialized.Group, InternalIdKey>;\n export type course = Omit<CoreTypes.Serialized.Course, InternalIdKey>;\n}\n\ntype Out = {\n teachers: OutTypes.teacher[];\n courses: OutTypes.course [];\n groups: OutTypes.group [];\n meta: {\n errors?: string[];\n warnings?: string[];\n };\n};\n\n\nexport default function (\n src: VKlassTypes.schedule,\n options: VKlassTypes.Options\n): Out {\n\n // gather all import related warnings/errors\n const warnings: string[] = [];\n const errors: string[] = [];\n\n // the schedule period range\n const scheduleRange = {\n start: moment.utc(options.beg),\n end: moment.utc(options.end)\n };\n\n ////\n //// teachers\n ////\n const teachers: OutTypes.teacher[] = [];\n src.staff.forEach(x => {\n teachers.push({\n ids: x.ID.toString(),\n displayName: x.Firstname + ' ' + x.Lastname\n });\n });\n\n\n ////\n //// groups\n ////\n const groups: OutTypes.group[] = [];\n src.classes.forEach(x => {\n groups.push({\n ids: x.ID.toString(),\n displayName: x.Name,\n species: 'class',\n });\n });\n\n\n // build group to staff map\n const groupStaffMap = new Map<number, Set<number> >();\n src.groups_staff.forEach(x => {\n if(!groupStaffMap.has(x.groupId)) groupStaffMap.set(x.groupId, new Set());\n groupStaffMap.get(x.groupId)?.add(x.userId);\n });\n\n // build student to class map\n const studentClassMap = new Map<number, Set<number> >();\n src.classes_students.forEach(x => {\n if(!studentClassMap.has(x.userId)) studentClassMap.set(x.userId, new Set());\n studentClassMap.get(x.userId)?.add(x.classId);\n });\n\n // build group to classes map\n const groupClassesMap = new Map<number, Set<number> >();\n src.groups_students.forEach(x => {\n if (!groupClassesMap.has(x.groupId)) groupClassesMap.set(x.groupId, new Set());\n studentClassMap.get(x.userId)?.forEach(y => groupClassesMap.get(x.groupId)?.add(y));\n });\n\n\n ////\n //// courses\n ////\n const courses: OutTypes.course[] = [];\n src.groups.forEach(x => {\n // ignore courses who's period range does not overlap with the schedule period range\n const courseRange = {\n start: moment.utc(x.StartDate),\n end: moment.utc(x.EndDate)\n };\n if (!range.overlaps(scheduleRange, courseRange)) return;\n\n const teachers = [...groupStaffMap.get(x.ID) ?? []].map(x => ({ to: x.toString() }));\n const groups = [...groupClassesMap.get(x.ID) ?? []].map(x => ({ to: x.toString() }));\n\n courses.push({\n ids: x.ID.toString(),\n displayName: x.Name || x.FriendlyName,\n ...(teachers && { teachers }),\n ...(groups && { groups }),\n });\n });\n\n\n\n return { teachers, groups, courses,\n meta: {\n ...( errors.length ? { errors: errors } : { } ),\n ...( warnings.length ? { warnings: warnings } : { } )\n }\n };\n}\n"],"mappings":";;;;AAuBA,0BACE,KACA,SACK;CAGL,MAAMA,WAAqB;CAC3B,MAAMC,SAAqB;CAG3B,MAAM,gBAAgB;EACpB,OAAO,OAAO,IAAI,QAAQ;EAC1B,KAAO,OAAO,IAAI,QAAQ;;CAM5B,MAAMC,WAA+B;AACrC,KAAI,MAAM,SAAQ,MAAK;AACrB,WAAS,KAAK;GACZ,KAAa,EAAE,GAAG;GAClB,aAAa,EAAE,YAAY,MAAM,EAAE;;;CAQvC,MAAMC,SAA2B;AACjC,KAAI,QAAQ,SAAQ,MAAK;AACvB,SAAO,KAAK;GACV,KAAa,EAAE,GAAG;GAClB,aAAa,EAAE;GACf,SAAa;;;CAMjB,MAAM,gCAAgB,IAAI;AAC1B,KAAI,aAAa,SAAQ,MAAK;AAC5B,MAAG,CAAC,cAAc,IAAI,EAAE,SAAU,eAAc,IAAI,EAAE,yBAAS,IAAI;AACnE,gBAAc,IAAI,EAAE,UAAU,IAAI,EAAE;;CAItC,MAAM,kCAAkB,IAAI;AAC5B,KAAI,iBAAiB,SAAQ,MAAK;AAChC,MAAG,CAAC,gBAAgB,IAAI,EAAE,QAAS,iBAAgB,IAAI,EAAE,wBAAQ,IAAI;AACrE,kBAAgB,IAAI,EAAE,SAAS,IAAI,EAAE;;CAIvC,MAAM,kCAAkB,IAAI;AAC5B,KAAI,gBAAgB,SAAQ,MAAK;AAC/B,MAAI,CAAC,gBAAgB,IAAI,EAAE,SAAU,iBAAgB,IAAI,EAAE,yBAAS,IAAI;AACxE,kBAAgB,IAAI,EAAE,SAAS,SAAQ,MAAK,gBAAgB,IAAI,EAAE,UAAU,IAAI;;CAOlF,MAAMC,UAA6B;AACnC,KAAI,OAAO,SAAQ,MAAK;EAEtB,MAAM,cAAc;GAClB,OAAO,OAAO,IAAI,EAAE;GACpB,KAAO,OAAO,IAAI,EAAE;;AAEtB,MAAI,CAAC,MAAM,SAAS,eAAe,aAAc;EAEjD,MAAMC,aAAW,CAAC,GAAG,cAAc,IAAI,EAAE,OAAS,IAAI,KAAI,SAAM,EAAE,IAAIC,IAAE;EACxE,MAAMC,WAAW,CAAC,GAAG,gBAAgB,IAAI,EAAE,OAAO,IAAI,KAAI,SAAM,EAAE,IAAID,IAAE;AAExE,UAAQ,KAAK;GACX,KAAa,EAAE,GAAG;GAClB,aAAa,EAAE,QAAQ,EAAE;GACzB,GAAID,cAAY,EAAE;GAClB,GAAIE,YAAY,EAAE;;;AAMtB,QAAO;EAAE;EAAU;EAAQ;EACzB,MAAM;GACJ,GAAK,OAAO,SAAW,EAAY,WAAa;GAChD,GAAK,SAAS,SAAS,EAAY,aAAa"}
@@ -4,7 +4,8 @@ import XLSX from "xlsx";
4
4
 
5
5
  //#region src/vKlass/to/schedules.ts
6
6
  function schedules_default(schedule) {
7
- if (!getVertexId(schedule.division, { idKey: "id" })) throw new Error("division id is undefined");
7
+ const did = getVertexId(schedule.division, { idKey: "id" });
8
+ if (!did) throw new Error("division id is undefined");
8
9
  const startDate = moment.utc(schedule.division.start).format("YYYY-MM-DD HH:mm:ss");
9
10
  const endDate = moment.utc(schedule.division.end).format("YYYY-MM-DD HH:mm:ss");
10
11
  const personMap = /* @__PURE__ */ new Map();
@@ -22,7 +23,8 @@ function schedules_default(schedule) {
22
23
  const courses = schedule.courses.map((course) => {
23
24
  const group = validateGroup(course.groups);
24
25
  if (!group) return null;
25
- const teacherSignatures = (course.teachers?.map((t) => getVertexId(t.to, { idKey: "id" })).filter((id) => id != null) ?? []).map((id) => teacherMap.get(id)).filter((sig) => sig != null);
26
+ const teacherIds = course.teachers?.map((t) => getVertexId(t.to, { idKey: "id" })).filter((id) => id != null) ?? [];
27
+ const teacherSignatures = teacherIds.map((id) => teacherMap.get(id)).filter((sig) => sig != null);
26
28
  const courseName = course.displayName || "";
27
29
  const subject = course.subject || "";
28
30
  const membersSSNs = group.members.map((id) => {
@@ -70,11 +72,20 @@ function validateGroup(groups) {
70
72
  function formatSSN(ssn) {
71
73
  if (typeof ssn === "number") ssn = ssn.toString();
72
74
  if (typeof ssn !== "string") return "";
73
- if (/^\d{6}-\d{4}$/.test(ssn)) return ssn;
75
+ const regex10 = /^\d{6}-\d{4}$/;
76
+ if (regex10.test(ssn)) return ssn;
74
77
  ssn = ssn.replace(/\D/g, "");
75
- if (ssn.length === 12) return `${ssn.slice(2, 4)}${ssn.slice(4, 6)}${ssn.slice(6, 8)}-${ssn.slice(8)}`;
76
- else if (ssn.length === 10) return `${ssn.slice(0, 6)}-${ssn.slice(6)}`;
77
- else return "";
78
+ if (ssn.length === 12) {
79
+ const year = ssn.slice(2, 4);
80
+ const month = ssn.slice(4, 6);
81
+ const day = ssn.slice(6, 8);
82
+ const lastFour = ssn.slice(8);
83
+ return `${year}${month}${day}-${lastFour}`;
84
+ } else if (ssn.length === 10) {
85
+ const datePart = ssn.slice(0, 6);
86
+ const lastFour = ssn.slice(6);
87
+ return `${datePart}-${lastFour}`;
88
+ } else return "";
78
89
  }
79
90
 
80
91
  //#endregion
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["memberIds: string[]"],"sources":["../../../src/vKlass/to/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport type { Types } from 'mongoose';\nimport XLSX from 'xlsx';\nimport type { Types as CoreTypes } from '../../core/types';\nimport { getVertexId } from '../../core/util';\n\ntype Schedule = {\n division: CoreTypes.Deep.Division;\n teachers: CoreTypes.Deep.Teacher[];\n courses: CoreTypes.Deep.Course[];\n persons: CoreTypes.Deep.Person[];\n};\n\nexport default function (\n schedule: Schedule,\n): XLSX.WorkBook {\n const did = getVertexId(schedule.division, { idKey: 'id' });\n if (!did) throw new Error('division id is undefined');\n\n // get start and end dates from division in format date + time format: 2024-08-15 00:00:00\n const startDate = moment.utc(schedule.division.start).format('YYYY-MM-DD HH:mm:ss');\n const endDate = moment.utc(schedule.division.end).format('YYYY-MM-DD HH:mm:ss');\n\n // Map persons by id to SSN\n const personMap = new Map<string, string>();\n schedule.persons.forEach((p) => {\n const ssn = p.SSN?.value;\n const id = getVertexId(p, { idKey: '_id' });\n if (ssn && id)\n personMap.set(id, ssn);\n });\n\n const teacherMap = new Map<string, string>();\n schedule.teachers.forEach((t) => {\n const signature = t.signature;\n const id = getVertexId(t, { idKey: 'id' });\n if (signature && id)\n teacherMap.set(id, signature);\n });\n\n\n\n const courses = schedule.courses.map((course) => {\n const group = validateGroup(course.groups);\n if (!group) return null;\n\n const teacherIds = course.teachers?.map((t) => getVertexId(t.to, { idKey: 'id' })).filter((id) => id != null) ?? [];\n const teacherSignatures = teacherIds.map((id) => teacherMap.get(id)).filter((sig) => sig != null);\n\n const courseName = course.displayName || '';\n const subject = course.subject || '';\n\n const membersSSNs = group.members.map((id) => {\n return personMap.get(id);\n }).filter((ssn) => !!ssn);\n\n if (membersSSNs.length === 0) return null;\n\n return membersSSNs.map((ssn) => ({\n Personnummer: ssn ? formatSSN(ssn) : '',\n Kurskod: subject,\n Benämning: courseName,\n Undervisningsgrupp: group.displayName || '',\n Lärarsignatur: teacherSignatures ? teacherSignatures.join(',') : '',\n Poäng: 0,\n Startdatum: startDate,\n Slutdatum: endDate\n }));\n\n }).flat().filter(x => x !== null);\n\n const wb = XLSX.utils.book_new();\n XLSX.utils.book_append_sheet(wb, XLSX.utils.json_to_sheet(courses), 'Kurser');\n\n return wb;\n}\n\n// Validate that the group is valid and has at least one member\nfunction validateGroup (groups: CoreTypes.Deep.Course['groups']): {\n members: string[], // Array of member IDs\n displayName?: string\n} | null {\n const group = groups?.at(0)?.to;\n\n if (!(typeof group === 'object') || !('members' in group)) return null;\n\n if (!group?.members || group.members.length === 0) return null;\n\n const memberIds: string[] = [];\n for (const member of group.members) {\n const id = (typeof member === 'object' && 'id' in member) ? member.id : member;\n memberIds.push((id as unknown as (Types.ObjectId | string)).toString());\n }\n if (memberIds.length === 0) return null;\n\n return { members: memberIds, displayName: group.displayName };\n}\n\n/**\n * Formats a Swedish SSN (personnummer) from the standard 12-digit format (YYYYMMDDXXXX) to the common 10-digit format (YYMMDD-XXXX).\n * If the input is already in the 10-digit format, it is returned as is.\n * If the input is invalid, null is returned.\n *\n * @param ssn - The SSN to format, either as a string or number.\n * @returns The formatted SSN in 10-digit format, or null if invalid.\n */\nfunction formatSSN (ssn: string | number): string {\n if (typeof ssn === 'number') {\n ssn = ssn.toString();\n }\n if (typeof ssn !== 'string') {\n return '';\n }\n\n // Check if already in YYMMDD-XXXX format\n const regex10 = /^\\d{6}-\\d{4}$/;\n if (regex10.test(ssn)) {\n return ssn;\n }\n\n // Remove any non-digit characters\n ssn = ssn.replace(/\\D/g, '');\n\n if (ssn.length === 12) {\n // Convert from YYYYMMDDXXXX to YYMMDD-XXXX\n const year = ssn.slice(2, 4);\n const month = ssn.slice(4, 6);\n const day = ssn.slice(6, 8);\n const lastFour = ssn.slice(8);\n return `${year}${month}${day}-${lastFour}`;\n } else if (ssn.length === 10) {\n // Already in YYMMDDXXXX format, just add the hyphen\n const datePart = ssn.slice(0, 6);\n const lastFour = ssn.slice(6);\n return `${datePart}-${lastFour}`;\n } else {\n // Invalid SSN format\n return '';\n }\n}"],"mappings":";;;;;AAaA,2BACE,UACe;AAEf,KAAI,CADQ,YAAY,SAAS,UAAU,EAAE,OAAO,MAAM,CAAC,CACjD,OAAM,IAAI,MAAM,2BAA2B;CAGrD,MAAM,YAAY,OAAO,IAAI,SAAS,SAAS,MAAM,CAAC,OAAO,sBAAsB;CACnF,MAAM,UAAU,OAAO,IAAI,SAAS,SAAS,IAAI,CAAC,OAAO,sBAAsB;CAG/E,MAAM,4BAAY,IAA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ChC,MAAK,MAAM,kBAAkB,IAAI,KAAK,MAAM,cAAc,QAAQ,EAAE,SAAS;AAE7E,QAAO;;AAIT,SAAS,cAAe,QAGf;CACP,MAAM,QAAQ,QAAQ,GAAG,EAAE,EAAE;AAE7B,KAAI,EAAE,OAAO,UAAU,aAAa,EAAE,aAAa,OAAQ,QAAO;AAElE,KAAI,CAAC,OAAO,WAAW,MAAM,QAAQ,WAAW,EAAG,QAAO;CAE1D,MAAMA,YAAsB,EAAE;AAC9B,MAAK,MAAM,UAAU,MAAM,SAAS;EAClC,MAAM,KAAM,OAAO,WAAW,YAAY,QAAQ,SAAU,OAAO,KAAK;AACxE,YAAU,KAAM,GAA4C,UAAU,CAAC;;AAEzE,KAAI,UAAU,WAAW,EAAG,QAAO;AAEnC,QAAO;EAAE,SAAS;EAAW,aAAa,MAAM;EAAa;;;;;;;;;;AAW/D,SAAS,UAAW,KAA8B;AAChD,KAAI,OAAO,QAAQ,SACjB,OAAM,IAAI,UAAU;AAEtB,KAAI,OAAO,QAAQ,SACjB,QAAO;AAKT,KADgB,gBACJ,KAAK,IAAI,CACnB,QAAO;AAIT,OAAM,IAAI,QAAQ,OAAO,GAAG;AAE5B,KAAI,IAAI,WAAW,GAMjB,QAAO,GAJM,IAAI,MAAM,GAAG,EAAE,GACd,IAAI,MAAM,GAAG,EAAE,GACjB,IAAI,MAAM,GAAG,EAAE,CAEE,GADZ,IAAI,MAAM,EAAE;UAEpB,IAAI,WAAW,GAIxB,QAAO,GAFU,IAAI,MAAM,GAAG,EAAE,CAEb,GADF,IAAI,MAAM,EAAE;KAI7B,QAAO"}
1
+ {"version":3,"file":"schedules.js","names":["memberIds: string[]"],"sources":["../../../src/vKlass/to/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport XLSX from 'xlsx';\nimport type { Types as CoreTypes } from '../../core/types';\nimport { getVertexId } from '../../core/util';\nimport type { ObjectId } from '../../common/types';\n\ntype Schedule = {\n division: CoreTypes.Deep.Division;\n teachers: CoreTypes.Deep.Teacher[];\n courses: CoreTypes.Deep.Course[];\n persons: CoreTypes.Deep.Person[];\n};\n\nexport default function (\n schedule: Schedule,\n): XLSX.WorkBook {\n const did = getVertexId(schedule.division, { idKey: 'id' });\n if (!did) throw new Error('division id is undefined');\n\n // get start and end dates from division in format date + time format: 2024-08-15 00:00:00\n const startDate = moment.utc(schedule.division.start).format('YYYY-MM-DD HH:mm:ss');\n const endDate = moment.utc(schedule.division.end).format('YYYY-MM-DD HH:mm:ss');\n\n // Map persons by id to SSN\n const personMap = new Map<string, string>();\n schedule.persons.forEach((p) => {\n const ssn = p.SSN?.value;\n const id = getVertexId(p, { idKey: '_id' });\n if (ssn && id)\n personMap.set(id, ssn);\n });\n\n const teacherMap = new Map<string, string>();\n schedule.teachers.forEach((t) => {\n const signature = t.signature;\n const id = getVertexId(t, { idKey: 'id' });\n if (signature && id)\n teacherMap.set(id, signature);\n });\n\n\n\n const courses = schedule.courses.map((course) => {\n const group = validateGroup(course.groups);\n if (!group) return null;\n\n const teacherIds = course.teachers?.map((t) => getVertexId(t.to, { idKey: 'id' })).filter((id) => id != null) ?? [];\n const teacherSignatures = teacherIds.map((id) => teacherMap.get(id)).filter((sig) => sig != null);\n\n const courseName = course.displayName || '';\n const subject = course.subject || '';\n\n const membersSSNs = group.members.map((id) => {\n return personMap.get(id);\n }).filter((ssn) => !!ssn);\n\n if (membersSSNs.length === 0) return null;\n\n return membersSSNs.map((ssn) => ({\n Personnummer: ssn ? formatSSN(ssn) : '',\n Kurskod: subject,\n Benämning: courseName,\n Undervisningsgrupp: group.displayName || '',\n Lärarsignatur: teacherSignatures ? teacherSignatures.join(',') : '',\n Poäng: 0,\n Startdatum: startDate,\n Slutdatum: endDate\n }));\n\n }).flat().filter(x => x !== null);\n\n const wb = XLSX.utils.book_new();\n XLSX.utils.book_append_sheet(wb, XLSX.utils.json_to_sheet(courses), 'Kurser');\n\n return wb;\n}\n\n// Validate that the group is valid and has at least one member\nfunction validateGroup (groups: CoreTypes.Deep.Course['groups']): {\n members: string[], // Array of member IDs\n displayName?: string\n} | null {\n const group = groups?.at(0)?.to;\n\n if (!(typeof group === 'object') || !('members' in group)) return null;\n\n if (!group?.members || group.members.length === 0) return null;\n\n const memberIds: string[] = [];\n for (const member of group.members) {\n const id = (typeof member === 'object' && 'id' in member) ? member.id : member;\n memberIds.push((id as unknown as (ObjectId | string)).toString());\n }\n if (memberIds.length === 0) return null;\n\n return { members: memberIds, displayName: group.displayName };\n}\n\n/**\n * Formats a Swedish SSN (personnummer) from the standard 12-digit format (YYYYMMDDXXXX) to the common 10-digit format (YYMMDD-XXXX).\n * If the input is already in the 10-digit format, it is returned as is.\n * If the input is invalid, null is returned.\n *\n * @param ssn - The SSN to format, either as a string or number.\n * @returns The formatted SSN in 10-digit format, or null if invalid.\n */\nfunction formatSSN (ssn: string | number): string {\n if (typeof ssn === 'number') {\n ssn = ssn.toString();\n }\n if (typeof ssn !== 'string') {\n return '';\n }\n\n // Check if already in YYMMDD-XXXX format\n const regex10 = /^\\d{6}-\\d{4}$/;\n if (regex10.test(ssn)) {\n return ssn;\n }\n\n // Remove any non-digit characters\n ssn = ssn.replace(/\\D/g, '');\n\n if (ssn.length === 12) {\n // Convert from YYYYMMDDXXXX to YYMMDD-XXXX\n const year = ssn.slice(2, 4);\n const month = ssn.slice(4, 6);\n const day = ssn.slice(6, 8);\n const lastFour = ssn.slice(8);\n return `${year}${month}${day}-${lastFour}`;\n } else if (ssn.length === 10) {\n // Already in YYMMDDXXXX format, just add the hyphen\n const datePart = ssn.slice(0, 6);\n const lastFour = ssn.slice(6);\n return `${datePart}-${lastFour}`;\n } else {\n // Invalid SSN format\n return '';\n }\n}"],"mappings":";;;;;AAaA,2BACE,UACe;CACf,MAAM,MAAM,YAAY,SAAS,UAAU,EAAE,OAAO;AACpD,KAAI,CAAC,IAAK,OAAM,IAAI,MAAM;CAG1B,MAAM,YAAY,OAAO,IAAI,SAAS,SAAS,OAAO,OAAO;CAC7D,MAAM,UAAU,OA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