@royalschedule/maps 4.0.15 → 4.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (346) hide show
  1. package/dist/Additio/from/courses.js.map +1 -1
  2. package/dist/Additio/from/events.js.map +1 -1
  3. package/dist/Additio/from/groups.js.map +1 -1
  4. package/dist/Additio/from/index.js.map +1 -1
  5. package/dist/Additio/from/locations.js.map +1 -1
  6. package/dist/Additio/from/persons.js.map +1 -1
  7. package/dist/Additio/from/schedules.d.ts +7 -6
  8. package/dist/Additio/from/schedules.js +2 -4
  9. package/dist/Additio/from/schedules.js.map +1 -1
  10. package/dist/Additio/from/teachers.js.map +1 -1
  11. package/dist/Additio/to/index.d.ts +13 -11
  12. package/dist/Additio/to/schedules.js +2 -4
  13. package/dist/Additio/to/schedules.js.map +1 -1
  14. package/dist/Admentum/from/courses.js.map +1 -1
  15. package/dist/Admentum/from/events.js.map +1 -1
  16. package/dist/Admentum/from/groups.js.map +1 -1
  17. package/dist/Admentum/from/index.js.map +1 -1
  18. package/dist/Admentum/from/locations.js.map +1 -1
  19. package/dist/Admentum/from/persons.js.map +1 -1
  20. package/dist/Admentum/from/schedules.d.ts +7 -6
  21. package/dist/Admentum/from/schedules.js +2 -4
  22. package/dist/Admentum/from/schedules.js.map +1 -1
  23. package/dist/Admentum/from/teachers.js.map +1 -1
  24. package/dist/Admentum/to/index.d.ts +9 -8
  25. package/dist/Admentum/to/schedules.js +4 -7
  26. package/dist/Admentum/to/schedules.js.map +1 -1
  27. package/dist/Excel/index.d.ts +263 -26
  28. package/dist/Excel/v1/from/index.js +2 -1
  29. package/dist/Excel/v1/from/index.js.map +1 -1
  30. package/dist/Excel/v1/index.d.ts +218 -20
  31. package/dist/Excel/v2/from/index.js +49 -57
  32. package/dist/Excel/v2/from/index.js.map +1 -1
  33. package/dist/Excel/v2/index.d.ts +263 -26
  34. package/dist/IdunSoft/from/courses.js.map +1 -1
  35. package/dist/IdunSoft/from/events.js +1 -2
  36. package/dist/IdunSoft/from/events.js.map +1 -1
  37. package/dist/IdunSoft/from/groups.js.map +1 -1
  38. package/dist/IdunSoft/from/index.js.map +1 -1
  39. package/dist/IdunSoft/from/locations.js.map +1 -1
  40. package/dist/IdunSoft/from/schedules.d.ts +6 -5
  41. package/dist/IdunSoft/from/schedules.js.map +1 -1
  42. package/dist/IdunSoft/from/teachers.js.map +1 -1
  43. package/dist/IdunSoft/to/index.d.ts +2 -1
  44. package/dist/IdunSoft/to/schedules.js +5 -8
  45. package/dist/IdunSoft/to/schedules.js.map +1 -1
  46. package/dist/InfoMentor/to/index.d.ts +2 -1
  47. package/dist/InfoMentor/to/schedules.js +3 -4
  48. package/dist/InfoMentor/to/schedules.js.map +1 -1
  49. package/dist/PlanDigital/from/index.js.map +1 -1
  50. package/dist/PlanDigital/from/schedules.js +9 -11
  51. package/dist/PlanDigital/from/schedules.js.map +1 -1
  52. package/dist/PlanDigital/index.d.ts +73 -58
  53. package/dist/Quiculum/file/to/index.d.ts +10 -9
  54. package/dist/Quiculum/file/to/schedules.js +5 -9
  55. package/dist/Quiculum/file/to/schedules.js.map +1 -1
  56. package/dist/RS/from/division.d.ts +2 -1
  57. package/dist/RS/from/division.js +9 -6
  58. package/dist/RS/from/division.js.map +1 -1
  59. package/dist/RS/from/index.js.map +1 -1
  60. package/dist/RS/from/schedules.d.ts +2 -1
  61. package/dist/RS/from/schedules.js.map +1 -1
  62. package/dist/RS/make-connected.d.ts +17 -16
  63. package/dist/RS/make-connected.js +63 -96
  64. package/dist/RS/make-connected.js.map +1 -1
  65. package/dist/RS/to/index.js.map +1 -1
  66. package/dist/RS/to/initial-configuration.js +4 -6
  67. package/dist/RS/to/initial-configuration.js.map +1 -1
  68. package/dist/RS/to/input/collections.js.map +1 -1
  69. package/dist/RS/to/input/default.js +1 -2
  70. package/dist/RS/to/input/default.js.map +1 -1
  71. package/dist/RS/to/input/dependencies.js +1 -3
  72. package/dist/RS/to/input/dependencies.js.map +1 -1
  73. package/dist/RS/to/input/dynamic-locked-times.js +1 -2
  74. package/dist/RS/to/input/dynamic-locked-times.js.map +1 -1
  75. package/dist/RS/to/input/events.js +5 -3
  76. package/dist/RS/to/input/events.js.map +1 -1
  77. package/dist/RS/to/input/groups.js.map +1 -1
  78. package/dist/RS/to/input/individuals.js +2 -3
  79. package/dist/RS/to/input/individuals.js.map +1 -1
  80. package/dist/RS/to/input/input.js +1 -3
  81. package/dist/RS/to/input/input.js.map +1 -1
  82. package/dist/RS/to/input/intervals.js +2 -4
  83. package/dist/RS/to/input/intervals.js.map +1 -1
  84. package/dist/RS/to/input/periods.js +6 -8
  85. package/dist/RS/to/input/periods.js.map +1 -1
  86. package/dist/RS/to/input/settings.js.map +1 -1
  87. package/dist/RS/to/input/teachers.js.map +1 -1
  88. package/dist/RS/to/input/util/attach-locked-times.js.map +1 -1
  89. package/dist/RS/to/input/util/parse-days.js.map +1 -1
  90. package/dist/RS/to/input/util/parse-group-references.js.map +1 -1
  91. package/dist/RS/to/input/util/parse-intervals.js +2 -4
  92. package/dist/RS/to/input/util/parse-intervals.js.map +1 -1
  93. package/dist/RS/to/input/util/parse-location-references.js +1 -2
  94. package/dist/RS/to/input/util/parse-location-references.js.map +1 -1
  95. package/dist/RS/to/input/util/parse-max-working-hours.js.map +1 -1
  96. package/dist/RS/to/input/util/parse-minimum-break-length.js.map +1 -1
  97. package/dist/RS/to/input/util/util.js +1 -2
  98. package/dist/RS/to/input/util/util.js.map +1 -1
  99. package/dist/RS/to/schedules.js +1 -1
  100. package/dist/RS/to/schedules.js.map +1 -1
  101. package/dist/RS/types/to.d.ts +12 -3
  102. package/dist/RS/types/to.js +1 -1
  103. package/dist/RS/types/to.js.map +1 -1
  104. package/dist/SS12000/from/activities.js +1 -2
  105. package/dist/SS12000/from/activities.js.map +1 -1
  106. package/dist/SS12000/from/calendar-events.js.map +1 -1
  107. package/dist/SS12000/from/duties.js.map +1 -1
  108. package/dist/SS12000/from/groups.js.map +1 -1
  109. package/dist/SS12000/from/index.js.map +1 -1
  110. package/dist/SS12000/from/persons.js.map +1 -1
  111. package/dist/SS12000/from/resources.js.map +1 -1
  112. package/dist/SS12000/from/rooms.js.map +1 -1
  113. package/dist/SS12000/from/syllabuses.js.map +1 -1
  114. package/dist/SS12000/index.d.ts +12567 -9
  115. package/dist/SS12000/to/activities.js.map +1 -1
  116. package/dist/SS12000/to/calendar-events.js.map +1 -1
  117. package/dist/SS12000/to/common.js.map +1 -1
  118. package/dist/SS12000/to/duties.js.map +1 -1
  119. package/dist/SS12000/to/groups.js.map +1 -1
  120. package/dist/SS12000/to/index.d.ts +17 -16
  121. package/dist/SS12000/to/persons.js.map +1 -1
  122. package/dist/SS12000/to/resources.js.map +1 -1
  123. package/dist/SS12000/to/rooms.js.map +1 -1
  124. package/dist/SS12000/to/syllabuses.js.map +1 -1
  125. package/dist/SchoolSoft/api/from/index.js.map +1 -1
  126. package/dist/SchoolSoft/api/from/schedules.js +8 -12
  127. package/dist/SchoolSoft/api/from/schedules.js.map +1 -1
  128. package/dist/SchoolSoft/api/index.d.ts +444 -9
  129. package/dist/SchoolSoft/file/from/index.js.map +1 -1
  130. package/dist/SchoolSoft/file/from/schedules.js +83 -87
  131. package/dist/SchoolSoft/file/from/schedules.js.map +1 -1
  132. package/dist/SchoolSoft/file/index.d.ts +2 -1
  133. package/dist/SchoolSoft/file/to/index.d.ts +5 -4
  134. package/dist/SchoolSoft/file/to/schedules.js +1 -2
  135. package/dist/SchoolSoft/file/to/schedules.js.map +1 -1
  136. package/dist/SchoolSoft/index.d.ts +2 -1
  137. package/dist/Schoolity/txt/to/index.d.ts +2 -1
  138. package/dist/Schoolity/txt/to/schedules.js +5 -12
  139. package/dist/Schoolity/txt/to/schedules.js.map +1 -1
  140. package/dist/Skola24/mdb/from/course-and-events.js +3 -5
  141. package/dist/Skola24/mdb/from/course-and-events.js.map +1 -1
  142. package/dist/Skola24/mdb/from/groups.js.map +1 -1
  143. package/dist/Skola24/mdb/from/index.js.map +1 -1
  144. package/dist/Skola24/mdb/from/locations.js.map +1 -1
  145. package/dist/Skola24/mdb/from/schedule.d.ts +6 -5
  146. package/dist/Skola24/mdb/from/schedule.js.map +1 -1
  147. package/dist/Skola24/mdb/from/teachers.js.map +1 -1
  148. package/dist/Skola24/txt/from/calendar-exceptions.js +1 -2
  149. package/dist/Skola24/txt/from/calendar-exceptions.js.map +1 -1
  150. package/dist/Skola24/txt/from/division.js.map +1 -1
  151. package/dist/Skola24/txt/from/index.js.map +1 -1
  152. package/dist/Skola24/txt/from/period.js +31 -34
  153. package/dist/Skola24/txt/from/period.js.map +1 -1
  154. package/dist/Skola24/txt/from/schedules.d.ts +9 -8
  155. package/dist/Skola24/txt/from/schedules.js +10 -12
  156. package/dist/Skola24/txt/from/schedules.js.map +1 -1
  157. package/dist/Skola24/txt/from/util.js.map +1 -1
  158. package/dist/Skola24/txt/index.d.ts +2 -1
  159. package/dist/Skola24/txt/to/index.d.ts +2 -1
  160. package/dist/Skola24/txt/to/schedules.js +5 -12
  161. package/dist/Skola24/txt/to/schedules.js.map +1 -1
  162. package/dist/common/constants.js.map +1 -1
  163. package/dist/common/functions.js +46 -10
  164. package/dist/common/functions.js.map +1 -1
  165. package/dist/common/get-date.js.map +1 -1
  166. package/dist/common/make-chainable/index.js.map +1 -1
  167. package/dist/common/types.d.ts +3 -6
  168. package/dist/core/from/configurations.js.map +1 -1
  169. package/dist/core/from/courses.js.map +1 -1
  170. package/dist/core/from/events.js +1 -1
  171. package/dist/core/from/events.js.map +1 -1
  172. package/dist/core/from/exceptions.js.map +1 -1
  173. package/dist/core/from/groups.js.map +1 -1
  174. package/dist/core/from/index.js +9 -6
  175. package/dist/core/from/index.js.map +1 -1
  176. package/dist/core/from/locations.js.map +1 -1
  177. package/dist/core/from/locked-times.js.map +1 -1
  178. package/dist/core/from/overlap-groups.js.map +1 -1
  179. package/dist/core/from/periods.js.map +1 -1
  180. package/dist/core/from/persons.js.map +1 -1
  181. package/dist/core/from/root-intervals.js.map +1 -1
  182. package/dist/core/from/schedules.js.map +1 -1
  183. package/dist/core/from/syllabuses.js.map +1 -1
  184. package/dist/core/from/teachers.js.map +1 -1
  185. package/dist/core/index.d.ts +24 -1
  186. package/dist/core/index.js +4 -0
  187. package/dist/core/index.js.map +1 -1
  188. package/dist/core/interfaces/index.d.ts +23 -0
  189. package/dist/core/interfaces/index.js +6 -0
  190. package/dist/core/interfaces/other/companies.d.ts +132 -0
  191. package/dist/core/interfaces/other/companies.js +9 -0
  192. package/dist/core/interfaces/other/companies.js.map +1 -0
  193. package/dist/core/interfaces/other/etc.d.ts +19 -0
  194. package/dist/core/interfaces/other/index.d.ts +6 -0
  195. package/dist/core/interfaces/other/integrations.d.ts +17 -0
  196. package/dist/core/interfaces/other/operations.d.ts +36 -0
  197. package/dist/core/interfaces/other/policies.d.ts +31 -0
  198. package/dist/core/interfaces/other/sync-logs.d.ts +21 -0
  199. package/dist/core/interfaces/other/users.d.ts +35 -0
  200. package/dist/core/interfaces/vertices/companies.d.ts +8 -0
  201. package/dist/core/interfaces/vertices/configurations.d.ts +58 -0
  202. package/dist/core/interfaces/vertices/courses.d.ts +68 -0
  203. package/dist/core/{types → interfaces/vertices}/division-settings.d.ts +31 -29
  204. package/dist/core/interfaces/vertices/divisions.d.ts +31 -0
  205. package/dist/core/interfaces/vertices/events.d.ts +100 -0
  206. package/dist/core/interfaces/vertices/exceptions.d.ts +74 -0
  207. package/dist/core/interfaces/vertices/generations.d.ts +23 -0
  208. package/dist/core/interfaces/vertices/groups.d.ts +53 -0
  209. package/dist/core/interfaces/vertices/index.d.ts +209 -0
  210. package/dist/core/interfaces/vertices/index.js +3 -0
  211. package/dist/core/interfaces/vertices/locations.d.ts +22 -0
  212. package/dist/core/interfaces/vertices/locked-times.d.ts +37 -0
  213. package/dist/core/interfaces/vertices/overlap-groups.d.ts +17 -0
  214. package/dist/core/interfaces/vertices/periods.d.ts +15 -0
  215. package/dist/core/interfaces/vertices/persons.d.ts +32 -0
  216. package/dist/core/interfaces/vertices/properties/belongs-to.d.ts +11 -0
  217. package/dist/core/interfaces/vertices/properties/coalesced.d.ts +8 -0
  218. package/dist/core/interfaces/vertices/properties/days.d.ts +9 -0
  219. package/dist/core/interfaces/vertices/properties/index.d.ts +15 -0
  220. package/dist/core/interfaces/vertices/properties/intervals.d.ts +10 -0
  221. package/dist/core/{types/common → interfaces/vertices/properties}/maximum-schedule-span.d.ts +1 -1
  222. package/dist/core/interfaces/vertices/properties/min-break-length.d.ts +5 -0
  223. package/dist/core/{types/common/planned-schedule-duration.d.ts → interfaces/vertices/properties/planned-scheduled-duration.d.ts} +2 -2
  224. package/dist/core/interfaces/vertices/properties/species.d.ts +9 -0
  225. package/dist/core/interfaces/vertices/properties/tags.d.ts +9 -0
  226. package/dist/core/interfaces/vertices/properties/week.d.ts +22 -0
  227. package/dist/core/interfaces/vertices/properties/week.js +6 -0
  228. package/dist/core/interfaces/vertices/properties/week.js.map +1 -0
  229. package/dist/core/interfaces/vertices/root-intervals.d.ts +14 -0
  230. package/dist/core/interfaces/vertices/syllabuses.d.ts +18 -0
  231. package/dist/core/interfaces/vertices/teachers.d.ts +43 -0
  232. package/dist/core/interfaces/vertices/users.d.ts +8 -0
  233. package/dist/core/interfaces/vertices/util/common.d.ts +28 -0
  234. package/dist/core/interfaces/vertices/util/custom-vertex-export/index.d.ts +31 -0
  235. package/dist/core/interfaces/vertices/util/custom-vertex-export/util.d.ts +51 -0
  236. package/dist/core/interfaces/vertices/util/deep-vertex-export/index.d.ts +64 -0
  237. package/dist/core/interfaces/vertices/util/edges.d.ts +105 -0
  238. package/dist/core/interfaces/vertices/util/index.d.ts +5 -0
  239. package/dist/core/interfaces/vertices/util/keys-of.d.ts +27 -0
  240. package/dist/core/interfaces/vertices/util/serialized-vertex-export.d.ts +12 -0
  241. package/dist/core/interfaces/vertices/util/util.d.ts +76 -0
  242. package/dist/core/interfaces/vertices/util/vertex-query/index.d.ts +44 -0
  243. package/dist/core/interfaces/vertices/util/vertex-query/util.d.ts +13 -0
  244. package/dist/core/interfaces/vertices/util/vertex.d.ts +70 -0
  245. package/dist/core/interfaces/vertices/vertex-query.d.ts +102 -0
  246. package/dist/core/interfaces/vertices/vertex-query.js +94 -0
  247. package/dist/core/interfaces/vertices/vertex-query.js.map +1 -0
  248. package/dist/core/to/configurations.js +2 -3
  249. package/dist/core/to/configurations.js.map +1 -1
  250. package/dist/core/to/courses.js +2 -3
  251. package/dist/core/to/courses.js.map +1 -1
  252. package/dist/core/to/division.js.map +1 -1
  253. package/dist/core/to/events.js +2 -3
  254. package/dist/core/to/events.js.map +1 -1
  255. package/dist/core/to/exceptions.js +4 -4
  256. package/dist/core/to/exceptions.js.map +1 -1
  257. package/dist/core/to/groups.js +2 -3
  258. package/dist/core/to/groups.js.map +1 -1
  259. package/dist/core/to/locations.js +2 -3
  260. package/dist/core/to/locations.js.map +1 -1
  261. package/dist/core/to/locked-times.js +2 -3
  262. package/dist/core/to/locked-times.js.map +1 -1
  263. package/dist/core/to/overlap-groups.js +2 -3
  264. package/dist/core/to/overlap-groups.js.map +1 -1
  265. package/dist/core/to/periods.js +2 -3
  266. package/dist/core/to/periods.js.map +1 -1
  267. package/dist/core/to/persons.js +3 -9
  268. package/dist/core/to/persons.js.map +1 -1
  269. package/dist/core/to/root-intervals.js +2 -3
  270. package/dist/core/to/root-intervals.js.map +1 -1
  271. package/dist/core/to/schedules.d.ts +17 -18
  272. package/dist/core/to/schedules.js.map +1 -1
  273. package/dist/core/to/settings.js +2 -3
  274. package/dist/core/to/settings.js.map +1 -1
  275. package/dist/core/to/syllabuses.js +2 -3
  276. package/dist/core/to/syllabuses.js.map +1 -1
  277. package/dist/core/to/teachers.js +4 -4
  278. package/dist/core/to/teachers.js.map +1 -1
  279. package/dist/core/to/util.d.ts +4 -8
  280. package/dist/core/to/util.js +7 -5
  281. package/dist/core/to/util.js.map +1 -1
  282. package/dist/core/types/common/index.d.ts +4 -41
  283. package/dist/core/types/index.d.ts +108 -112
  284. package/dist/core/util.js +4 -5
  285. package/dist/core/util.js.map +1 -1
  286. package/dist/identify/constants/index.d.ts +1 -1
  287. package/dist/identify/constants/index.js.map +1 -1
  288. package/dist/identify/index.js +1 -2
  289. package/dist/identify/index.js.map +1 -1
  290. package/dist/index.d.ts +23 -1
  291. package/dist/index.js +4 -1
  292. package/dist/sdui/from/classes.js.map +1 -1
  293. package/dist/sdui/from/courses.js.map +1 -1
  294. package/dist/sdui/from/holidays.js.map +1 -1
  295. package/dist/sdui/from/index.js.map +1 -1
  296. package/dist/sdui/from/lessons.js +4 -0
  297. package/dist/sdui/from/lessons.js.map +1 -1
  298. package/dist/sdui/from/rooms.js.map +1 -1
  299. package/dist/sdui/from/schedules.d.ts +10 -8
  300. package/dist/sdui/from/schedules.js.map +1 -1
  301. package/dist/sdui/from/school-years.js +0 -1
  302. package/dist/sdui/from/school-years.js.map +1 -1
  303. package/dist/sdui/from/substitution-plans.js.map +1 -1
  304. package/dist/sdui/from/teachers.js.map +1 -1
  305. package/dist/sdui/index.d.ts +1 -1
  306. package/dist/sdui/to/classes.js.map +1 -1
  307. package/dist/sdui/to/courses.js.map +1 -1
  308. package/dist/sdui/to/holidays.js.map +1 -1
  309. package/dist/sdui/to/hours.js.map +1 -1
  310. package/dist/sdui/to/index.d.ts +12 -10
  311. package/dist/sdui/to/lessons.js.map +1 -1
  312. package/dist/sdui/to/rooms.js.map +1 -1
  313. package/dist/sdui/to/schedules.js.map +1 -1
  314. package/dist/sdui/to/school-years.js.map +1 -1
  315. package/dist/sdui/to/substitution-plans.js +3 -6
  316. package/dist/sdui/to/substitution-plans.js.map +1 -1
  317. package/dist/sdui/to/teachers.js.map +1 -1
  318. package/dist/vKlass/from/index.js.map +1 -1
  319. package/dist/vKlass/from/schedule.d.ts +4 -3
  320. package/dist/vKlass/from/schedule.js +2 -2
  321. package/dist/vKlass/from/schedule.js.map +1 -1
  322. package/dist/vKlass/to/schedules.d.ts +4 -4
  323. package/dist/vKlass/to/schedules.js +6 -17
  324. package/dist/vKlass/to/schedules.js.map +1 -1
  325. package/package.json +24 -22
  326. package/dist/core/types/areas.d.ts +0 -10
  327. package/dist/core/types/common/break-lengths.d.ts +0 -5
  328. package/dist/core/types/common/days.d.ts +0 -8
  329. package/dist/core/types/common/intervals.d.ts +0 -20
  330. package/dist/core/types/common/tag.d.ts +0 -9
  331. package/dist/core/types/configurations.d.ts +0 -31
  332. package/dist/core/types/courses.d.ts +0 -60
  333. package/dist/core/types/divisions.d.ts +0 -24
  334. package/dist/core/types/events.d.ts +0 -56
  335. package/dist/core/types/exceptions.d.ts +0 -35
  336. package/dist/core/types/groups.d.ts +0 -44
  337. package/dist/core/types/locations.d.ts +0 -27
  338. package/dist/core/types/locked-times.d.ts +0 -33
  339. package/dist/core/types/overlap-groups.d.ts +0 -14
  340. package/dist/core/types/periods.d.ts +0 -14
  341. package/dist/core/types/persons.d.ts +0 -38
  342. package/dist/core/types/root-intervals.d.ts +0 -13
  343. package/dist/core/types/schedules.d.ts +0 -44
  344. package/dist/core/types/syllabus.d.ts +0 -18
  345. package/dist/core/types/teachers.d.ts +0 -44
  346. package/dist/core/vertex-mapping.d.ts +0 -69
@@ -1 +1 @@
1
- {"version":3,"file":"syllabuses.js","names":["edges: SerializedEdges<Types.rootInterval>"],"sources":["../../../src/core/to/syllabuses.ts"],"sourcesContent":["import type { Types } from '../types';\nimport type { BaseOptions } from '../../common/types';\nimport type { SerializedEdges, SerializedEdgesShape } from './util';\nimport { internalKeysOmitted } from './util';\n\nexport default (\n syllabuses: Types.mixed.syllabus[],\n options: BaseOptions\n) => {\n return syllabuses\n .map(x => {\n const edges: SerializedEdges<Types.rootInterval> = {\n } satisfies SerializedEdgesShape<Types.rootInterval>;\n const nonEdges = internalKeysOmitted(x, edges);\n\n return { ...nonEdges, ...edges };\n });\n};\n"],"mappings":";;;AAKA,0BACE,YACA,YACG;AACH,QAAO,WACJ,KAAI,MAAK;EACR,MAAMA,QAA6C;EAEnD,MAAM,WAAW,oBAAoB,GAAG;AAExC,SAAO;GAAE,GAAG;GAAU,GAAG"}
1
+ {"version":3,"file":"syllabuses.js","names":["edges: SerializedEdgesOnlyVertexExport<SyllabusVertex>"],"sources":["../../../src/core/to/syllabuses.ts"],"sourcesContent":["import type { Types } from '../types';\nimport type { BaseOptions } from '../../common/types';\nimport { omitEdgesAndInternalProperties, type SerializedEdgesOnlyVertexExport, type SerializedEdgesShape } from './util';\nimport type { SyllabusVertex } from '../interfaces/vertices/syllabuses';\nimport type { OutTypes } from './schedules';\n\nexport default (\n syllabuses: Types.Mixed.Syllabus[],\n options: BaseOptions\n): OutTypes.syllabus[] => {\n return syllabuses\n .map(x => {\n const edges: SerializedEdgesOnlyVertexExport<SyllabusVertex> = {\n } satisfies SerializedEdgesShape<SerializedEdgesOnlyVertexExport<SyllabusVertex>>;\n const nonEdges = omitEdgesAndInternalProperties(x, edges);\n\n return { ...nonEdges, ...edges };\n });\n};\n"],"mappings":";;;AAMA,0BACE,YACA,YACwB;AACxB,QAAO,WACJ,KAAI,MAAK;EACR,MAAMA,QAAyD,EAC9D;AAGD,SAAO;GAAE,GAFQ,+BAA+B,GAAG,MAAM;GAEnC,GAAG;GAAO;GAChC"}
@@ -1,5 +1,5 @@
1
1
  import { getVertexId } from "../util.js";
2
- import { internalKeysOmitted } from "./util.js";
2
+ import { omitEdgesAndInternalProperties } from "./util.js";
3
3
 
4
4
  //#region src/core/to/teachers.ts
5
5
  var teachers_default = (teachers, options) => {
@@ -9,11 +9,11 @@ var teachers_default = (teachers, options) => {
9
9
  person: x.person ? getVertexId(x.person, options) : void 0,
10
10
  exceptions: x.exceptions?.map((x$1) => getVertexId(x$1, options)),
11
11
  lockedTimes: x.lockedTimes?.map((x$1) => getVertexId(x$1, options)),
12
- lunch: x.lunch?.map((x$1) => getVertexId(x$1, options))
12
+ lunch: x.lunch?.map((x$1) => getVertexId(x$1, options)),
13
+ complementaryTimes: x.complementaryTimes?.map((x$1) => getVertexId(x$1, options))
13
14
  };
14
- const nonEdges = internalKeysOmitted(x, edges);
15
15
  return {
16
- ...nonEdges,
16
+ ...omitEdgesAndInternalProperties(x, edges),
17
17
  ...edges
18
18
  };
19
19
  });
@@ -1 +1 @@
1
- {"version":3,"file":"teachers.js","names":["edges: SerializedEdges<Types.teacher>","x"],"sources":["../../../src/core/to/teachers.ts"],"sourcesContent":["import type { Types } from '../types';\nimport type { OutTypes } from './schedules';\nimport { getVertexId } from '../util';\nimport { internalKeysOmitted } from './util';\nimport type { SerializedEdges, SerializedEdgesShape } from './util';\nimport type { BaseOptions } from '../../common/types';\n\nexport default (\n teachers: Types.mixed.teacher[],\n options: BaseOptions\n): OutTypes.teacher[] => {\n return teachers\n .map(x => {\n const edges: SerializedEdges<Types.teacher> = {\n rootInterval: x.rootInterval ? getVertexId(x.rootInterval, options) : undefined,\n person: x.person ? getVertexId(x.person, options) : undefined,\n exceptions: x.exceptions ?.map(x => getVertexId(x, options)),\n lockedTimes: x.lockedTimes?.map(x => getVertexId(x, options)),\n lunch: x.lunch ?.map(x => getVertexId(x, options)),\n } satisfies SerializedEdgesShape<Types.teacher>;\n const nonEdges = internalKeysOmitted(x, edges);\n\n return { ...nonEdges, ...edges };\n });\n};\n"],"mappings":";;;;AAOA,wBACE,UACA,YACuB;AACvB,QAAO,SACJ,KAAI,MAAK;EACR,MAAMA,QAAwC;GAC5C,cAAc,EAAE,eAAe,YAAY,EAAE,cAAc,WAAW;GACtE,QAAc,EAAE,SAAe,YAAY,EAAE,QAAc,WAAW;GACtE,YAAc,EAAE,YAAa,KAAI,QAAK,YAAYC,KAAG;GACrD,aAAc,EAAE,aAAa,KAAI,QAAK,YAAYA,KAAG;GACrD,OAAc,EAAE,OAAa,KAAI,QAAK,YAAYA,KAAG;;EAEvD,MAAM,WAAW,oBAAoB,GAAG;AAExC,SAAO;GAAE,GAAG;GAAU,GAAG"}
1
+ {"version":3,"file":"teachers.js","names":["edges: SerializedEdgesOnlyVertexExport<TeacherVertex>","x"],"sources":["../../../src/core/to/teachers.ts"],"sourcesContent":["import type { Types } from '../types';\nimport type { OutTypes } from './schedules';\nimport { getVertexId } from '../util';\nimport { omitEdgesAndInternalProperties, type SerializedEdgesOnlyVertexExport, type SerializedEdgesShape } from './util';\nimport type { BaseOptions } from '../../common/types';\nimport type { TeacherVertex } from '../interfaces/vertices/teachers';\n\nexport default (\n teachers: Types.Mixed.Teacher[],\n options: BaseOptions\n): OutTypes.teacher[] => {\n return teachers\n .map(x => {\n const edges: SerializedEdgesOnlyVertexExport<TeacherVertex> = {\n rootInterval: x.rootInterval ? getVertexId(x.rootInterval, options) : undefined,\n person: x.person ? getVertexId(x.person, options) : undefined,\n exceptions: x.exceptions ?.map(x => getVertexId(x, options)),\n lockedTimes: x.lockedTimes ?.map(x => getVertexId(x, options)),\n lunch: x.lunch ?.map(x => getVertexId(x, options)),\n complementaryTimes: x.complementaryTimes?.map(x => getVertexId(x, options)),\n } satisfies SerializedEdgesShape<SerializedEdgesOnlyVertexExport<TeacherVertex>>;\n const nonEdges = omitEdgesAndInternalProperties(x, edges);\n\n return { ...nonEdges, ...edges };\n });\n};\n"],"mappings":";;;;AAOA,wBACE,UACA,YACuB;AACvB,QAAO,SACJ,KAAI,MAAK;EACR,MAAMA,QAAwD;GAC5D,cAAoB,EAAE,eAAe,YAAY,EAAE,cAAc,QAAQ,GAAG;GAC5E,QAAoB,EAAE,SAAe,YAAY,EAAE,QAAc,QAAQ,GAAG;GAC5E,YAAoB,EAAE,YAAoB,KAAI,QAAK,YAAYC,KAAG,QAAQ,CAAC;GAC3E,aAAoB,EAAE,aAAoB,KAAI,QAAK,YAAYA,KAAG,QAAQ,CAAC;GAC3E,OAAoB,EAAE,OAAoB,KAAI,QAAK,YAAYA,KAAG,QAAQ,CAAC;GAC3E,oBAAoB,EAAE,oBAAoB,KAAI,QAAK,YAAYA,KAAG,QAAQ,CAAC;GAC5E;AAGD,SAAO;GAAE,GAFQ,+BAA+B,GAAG,MAAM;GAEnC,GAAG;GAAO;GAChC"}
@@ -1,14 +1,10 @@
1
1
  import { Intersect } from "../../common/types.js";
2
- import { Vertex } from "../types/common/index.js";
2
+ import "../interfaces/vertices/util/common.js";
3
+ import "../interfaces/vertices/util/index.js";
3
4
 
4
5
  //#region src/core/to/util.d.ts
5
-
6
- declare const keys: readonly ["_id", "createdAt", "updatedAt", "belongsTo", "lastModifiedBy", "CONTEXT"];
7
- type InternalKeysOmitted<V extends Vertex> = Omit<Intersect<V>, typeof keys[number]>;
8
- /**
9
- * Returns a copy of the vertex with internal keys omitted, such as `_id`, `createdAt`, `updatedAt`, etc.
10
- * The output type also omits all edges for ease of use.
11
- */
6
+ declare const keys: readonly ["_id", "createdAt", "updatedAt", "lastModifiedBy", "CONTEXT", "belongsTo", "domain", "derivedParentGroups"];
7
+ type InternalKeysOmitted<V extends object> = Omit<Intersect<V>, typeof keys[number]>;
12
8
  //#endregion
13
9
  export { InternalKeysOmitted };
14
10
  //# sourceMappingURL=util.d.ts.map
@@ -5,18 +5,20 @@ const keys = [
5
5
  "_id",
6
6
  "createdAt",
7
7
  "updatedAt",
8
- "belongsTo",
9
8
  "lastModifiedBy",
10
- "CONTEXT"
9
+ "CONTEXT",
10
+ "belongsTo",
11
+ "domain",
12
+ "derivedParentGroups"
11
13
  ];
12
14
  /**
13
15
  * Returns a copy of the vertex with internal keys omitted, such as `_id`, `createdAt`, `updatedAt`, etc.
14
16
  * The output type also omits all edges for ease of use.
15
17
  */
16
- function internalKeysOmitted(v, additionalPropertiesToOmit) {
17
- return omit(v, keys);
18
+ function omitEdgesAndInternalProperties(v, edgesRecord) {
19
+ return omit(omit(v, Object.keys(edgesRecord)), keys);
18
20
  }
19
21
 
20
22
  //#endregion
21
- export { internalKeysOmitted };
23
+ export { omitEdgesAndInternalProperties };
22
24
  //# sourceMappingURL=util.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":[],"sources":["../../../src/core/to/util.ts"],"sourcesContent":["import type { Intersect } from '../../common/types';\nimport type { Vertex } from '../types/common';\nimport type { ExtractEdges, Serialized } from '../vertex-mapping';\nimport { omit } from 'lodash-es';\n\n\nexport type SerializedEdges<V extends Vertex> = {\n [K in keyof Omit<ExtractEdges<V>, 'belongsTo'>]: Serialized<V>[K];\n};\n\n/**\n * Used only as `satisfies` to ensure that no edge property is missing.\n */\nexport type SerializedEdgesShape<V extends Vertex> = Record<keyof Omit<ExtractEdges<V>, 'belongsTo'>, unknown>;\n\n\nconst keys = ['_id', 'createdAt', 'updatedAt', 'belongsTo', 'lastModifiedBy', 'CONTEXT'] as const;\nexport type InternalKeysOmitted<V extends Vertex> = Omit<Intersect<V>, typeof keys[number]>;\n\n/**\n * Returns a copy of the vertex with internal keys omitted, such as `_id`, `createdAt`, `updatedAt`, etc.\n * The output type also omits all edges for ease of use.\n */\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport function internalKeysOmitted <V extends Vertex, A extends keyof V> (v: V, additionalPropertiesToOmit?: Partial<Record<A, unknown>>) {\n return omit(v, keys) as unknown as Omit<InternalKeysOmitted<V>, keyof ExtractEdges<V> | A>;\n}"],"mappings":";;;AAgBA,MAAM,OAAQ;CAAC;CAAQ;CAAa;CAAa;CAAa;CAAkB;;;;;;AAQhF,SAAgB,oBAA2D,GAAM,4BAA0D;AACzI,QAAO,KAAK,GAAG"}
1
+ {"version":3,"file":"util.js","names":[],"sources":["../../../src/core/to/util.ts"],"sourcesContent":["import type { Intersect } from '../../common/types';\nimport type { Collection, SerializedVertexExport, Vertex } from '../interfaces/vertices/util';\nimport type { PickEdges } from '../interfaces/vertices/util/common';\nimport { omit } from 'lodash-es';\n\n\nconst keys = ['_id', 'createdAt', 'updatedAt', 'lastModifiedBy', 'CONTEXT', 'belongsTo', 'domain', 'derivedParentGroups'] as const;\nexport type InternalKeysOmitted<V extends object> = Omit<Intersect<V>, typeof keys[number]>;\n\nexport type SerializedEdgesOnlyVertexExport<\n V extends Vertex<Collection>\n> = {\n [K in keyof SerializedVertexExport<V> as K extends keyof InternalKeysOmitted<PickEdges<V>> ? K : never]: SerializedVertexExport<V>[K]\n};\n\n/**\n * Used only as `satisfies` to ensure that no edge property is missing.\n */\nexport type SerializedEdgesShape<V extends object> = Record<keyof Omit<V, 'belongsTo'>, unknown>;\n\n/**\n * Returns a copy of the vertex with internal keys omitted, such as `_id`, `createdAt`, `updatedAt`, etc.\n * The output type also omits all edges for ease of use.\n */\nexport function omitEdgesAndInternalProperties <\n V extends object,\n EdgesRecord extends object\n> (v: V, edgesRecord: EdgesRecord) {\n const a = omit(v, Object.keys(edgesRecord)) as unknown as Omit<V, keyof EdgesRecord>;\n return omit(a, keys) as unknown as InternalKeysOmitted<typeof a>;\n}\n"],"mappings":";;;AAMA,MAAM,OAAQ;CAAC;CAAQ;CAAa;CAAa;CAAkB;CAAW;CAAa;CAAU;CAAsB;;;;;AAkB3H,SAAgB,+BAGb,GAAM,aAA0B;AAEjC,QAAO,KADG,KAAK,GAAG,OAAO,KAAK,YAAY,CAAC,EAC5B,KAAK"}
@@ -1,45 +1,8 @@
1
- import { DateType } from "../../../common/types.js";
2
- import { Types } from "mongoose";
1
+ import { IDKey, PrivateIDKey, PublicIDKey } from "../../interfaces/vertices/util/vertex.js";
3
2
 
4
3
  //#region src/core/types/common/index.d.ts
5
- type Collection = 'exceptions' | 'groups' | 'teachers' | 'locations' | 'configurations' | 'courses' | 'events' | 'courseevents' | 'generations' | 'settings' | 'lockedTimes' | 'overlapGroups' | 'periods' | 'rootIntervals' | 'persons' | 'syllabuses' | 'divisions';
6
- type ID = string;
7
- type Vertex = ({
8
- _id: Types.ObjectId;
9
- } | {
10
- id: ID;
11
- }) & {
12
- createdAt?: DateType;
13
- updatedAt?: DateType;
14
- lastModifiedBy?: unknown;
15
- ids?: ID;
16
- };
17
- type IdKey = '_id' | 'id' | 'ids';
18
- type InternalIdKey = Exclude<IdKey, 'ids'>;
19
- type SerializedVertex = ID | Types.ObjectId;
20
- type Coalesced<T extends Vertex | SerializedVertex, M extends Collection = Collection> = {
21
- to: T;
22
- toModel: M;
23
- };
24
- type Species<T extends Vertex | SerializedVertex, M extends Collection = Collection> = {
25
- to: T;
26
- toModel: M;
27
- id: string;
28
- };
29
- type AvailableLocation<T extends Vertex | SerializedVertex> = {
30
- locations: [T];
31
- rank?: number;
32
- groupIndex?: number;
33
- };
34
- type GroupReference<G extends Vertex | SerializedVertex, P extends Vertex | SerializedVertex> = {
35
- to: G;
36
- exclude?: P[];
37
- groupIndex?: number;
38
- };
39
- type PersonReference<T extends Vertex | SerializedVertex> = {
40
- to: T;
41
- groupIndex?: number;
42
- };
4
+ type IdKey = IDKey | PrivateIDKey | PublicIDKey;
5
+ type InternalIdKey = Exclude<IdKey, PublicIDKey>;
43
6
  //#endregion
44
- export { AvailableLocation, Coalesced, GroupReference, ID, IdKey, InternalIdKey, PersonReference, SerializedVertex, Species, Vertex };
7
+ export { IdKey, InternalIdKey };
45
8
  //# sourceMappingURL=index.d.ts.map
@@ -1,124 +1,120 @@
1
- import { InternalIdKey } from "./common/index.js";
2
- import { Mixed, MixedWithoutInternalId, Serialized } from "../vertex-mapping.js";
3
- import { BreakLength } from "./common/break-lengths.js";
4
- import { AllowedInterval } from "./common/intervals.js";
5
- import { Day } from "./common/days.js";
6
- import { RootInterval } from "./root-intervals.js";
7
- import { Group } from "./groups.js";
8
- import { Person } from "./persons.js";
9
- import { Teacher } from "./teachers.js";
10
- import { Location } from "./locations.js";
11
- import { LockedTime } from "./locked-times.js";
12
- import { OverlapGroup } from "./overlap-groups.js";
13
- import { Period } from "./periods.js";
14
- import { Event } from "./events.js";
15
- import { Exception } from "./exceptions.js";
16
- import { Syllabus } from "./syllabus.js";
17
- import { Course } from "./courses.js";
18
- import { DivisionSettings } from "./division-settings.js";
19
1
  import { Meta } from "./common/meta.js";
20
- import { Division } from "./divisions.js";
21
- import { Area } from "./areas.js";
22
- import { Configuration } from "./configurations.js";
23
- import { MixedSchedule, MixedScheduleWithoutInternalId, Schedule, SerializedSchedule, SerializedScheduleWithoutInternalId } from "./schedules.js";
2
+ import { Day } from "../interfaces/vertices/properties/days.js";
3
+ import { Interval } from "../interfaces/vertices/properties/intervals.js";
4
+ import { MinBreakLength } from "../interfaces/vertices/properties/min-break-length.js";
5
+ import { Deep, Mixed, MixedWithOptionalId, Serialized, SerializedWithOptionalId } from "../interfaces/vertices/index.js";
6
+ import "../interfaces/index.js";
24
7
 
25
8
  //#region src/core/types/index.d.ts
26
9
  declare namespace Types {
27
- type area = Area;
28
- type configuration = Configuration;
29
- type event = Event;
30
- type exception = Exception;
31
- type course = Course;
32
- type location = Location;
33
- type group = Group;
34
- type lockedTime = LockedTime;
35
- type division = Division;
36
- type divisionSettings = DivisionSettings;
37
- type overlapGroup = OverlapGroup;
38
- type period = Period;
39
- type person = Person;
40
- type rootInterval = RootInterval;
41
- type teacher = Teacher;
42
- type syllabus = Syllabus;
43
- type schedule = Schedule;
44
- type breakLength = BreakLength;
10
+ type breakLength = MinBreakLength;
45
11
  type day = Day;
46
- type interval = AllowedInterval;
12
+ type interval = Interval;
47
13
  type meta = Meta;
48
- namespace serialized {
49
- type area = Serialized<Area>;
50
- type configuration = Serialized<Configuration>;
51
- type event = Serialized<Event>;
52
- type exception = Serialized<Exception>;
53
- type course = Serialized<Course>;
54
- type location = Serialized<Location>;
55
- type group = Serialized<Group>;
56
- type lockedTime = Serialized<LockedTime>;
57
- type division = Serialized<Division>;
58
- type divisionSettings = Serialized<DivisionSettings>;
59
- type overlapGroup = Serialized<OverlapGroup>;
60
- type period = Serialized<Period>;
61
- type person = Serialized<Person>;
62
- type rootInterval = Serialized<RootInterval>;
63
- type teacher = Serialized<Teacher>;
64
- type syllabus = Serialized<Syllabus>;
65
- type schedule = SerializedSchedule;
14
+ namespace Deep {
15
+ type Configuration = Deep.Configuration.Base;
16
+ type Teacher = Deep.Teacher;
17
+ type Exception = Deep.Exception;
18
+ type Event = Deep.Event;
19
+ type ScheduleEvent = Deep.ScheduleEvent;
20
+ type CalendarEvent = Deep.CalendarEvent;
21
+ type Course = Deep.Course;
22
+ type Settings = Deep.Settings;
23
+ type Division = Deep.Division;
24
+ type Generation = Deep.Generation;
25
+ type Group = Deep.Group;
26
+ type Location = Deep.Location;
27
+ type LockedTime = Deep.LockedTime;
28
+ type OverlapGroup = Deep.OverlapGroup;
29
+ type Period = Deep.Period;
30
+ type Person = Deep.Person;
31
+ type RootInterval = Deep.RootInterval;
32
+ type Syllabus = Deep.Syllabus;
33
+ type Schedule = Deep.Schedule;
66
34
  }
67
- namespace mixed {
68
- type area = Mixed<Area>;
69
- type configuration = Mixed<Configuration>;
70
- type event = Mixed<Event>;
71
- type exception = Mixed<Exception>;
72
- type course = Mixed<Course>;
73
- type location = Mixed<Location>;
74
- type group = Mixed<Group>;
75
- type lockedTime = Mixed<LockedTime>;
76
- type division = Mixed<Division>;
77
- type divisionSettings = Mixed<DivisionSettings>;
78
- type overlapGroup = Mixed<OverlapGroup>;
79
- type period = Mixed<Period>;
80
- type person = Mixed<Person>;
81
- type rootInterval = Mixed<RootInterval>;
82
- type teacher = Mixed<Teacher>;
83
- type syllabus = Mixed<Syllabus>;
84
- type schedule = MixedSchedule;
35
+ namespace Serialized {
36
+ type Configuration = Serialized.Configuration.Base;
37
+ type Teacher = Serialized.Teacher;
38
+ type Exception = Serialized.Exception;
39
+ type Event = Serialized.Event;
40
+ type ScheduleEvent = Serialized.ScheduleEvent;
41
+ type CalendarEvent = Serialized.CalendarEvent;
42
+ type Course = Serialized.Course;
43
+ type Settings = Serialized.Settings;
44
+ type Division = Serialized.Division;
45
+ type Generation = Serialized.Generation;
46
+ type Group = Serialized.Group;
47
+ type Location = Serialized.Location;
48
+ type LockedTime = Serialized.LockedTime;
49
+ type OverlapGroup = Serialized.OverlapGroup;
50
+ type Period = Serialized.Period;
51
+ type Person = Serialized.Person;
52
+ type RootInterval = Serialized.RootInterval;
53
+ type Syllabus = Serialized.Syllabus;
54
+ type Schedule = Serialized.Schedule;
85
55
  }
86
- namespace mixedWithoutInternalId {
87
- type area = MixedWithoutInternalId<Area>;
88
- type configuration = MixedWithoutInternalId<Configuration>;
89
- type event = MixedWithoutInternalId<Event>;
90
- type exception = MixedWithoutInternalId<Exception>;
91
- type course = MixedWithoutInternalId<Course>;
92
- type location = MixedWithoutInternalId<Location>;
93
- type group = MixedWithoutInternalId<Group>;
94
- type lockedTime = MixedWithoutInternalId<LockedTime>;
95
- type division = MixedWithoutInternalId<Division>;
96
- type divisionSettings = MixedWithoutInternalId<DivisionSettings>;
97
- type overlapGroup = MixedWithoutInternalId<OverlapGroup>;
98
- type period = MixedWithoutInternalId<Period>;
99
- type person = MixedWithoutInternalId<Person>;
100
- type rootInterval = MixedWithoutInternalId<RootInterval>;
101
- type teacher = MixedWithoutInternalId<Teacher>;
102
- type syllabus = MixedWithoutInternalId<Syllabus>;
103
- type schedule = MixedScheduleWithoutInternalId;
56
+ namespace Mixed {
57
+ type Configuration = Mixed.Configuration.Base;
58
+ type Teacher = Mixed.Teacher;
59
+ type Exception = Mixed.Exception;
60
+ type Event = Mixed.Event;
61
+ type ScheduleEvent = Mixed.ScheduleEvent;
62
+ type CalendarEvent = Mixed.CalendarEvent;
63
+ type Course = Mixed.Course;
64
+ type Settings = Mixed.Settings;
65
+ type Division = Mixed.Division;
66
+ type Generation = Mixed.Generation;
67
+ type Group = Mixed.Group;
68
+ type Location = Mixed.Location;
69
+ type LockedTime = Mixed.LockedTime;
70
+ type OverlapGroup = Mixed.OverlapGroup;
71
+ type Period = Mixed.Period;
72
+ type Person = Mixed.Person;
73
+ type RootInterval = Mixed.RootInterval;
74
+ type Syllabus = Mixed.Syllabus;
75
+ type Schedule = Mixed.Schedule;
104
76
  }
105
- namespace serializedWithoutInternalId {
106
- type area = Omit<Serialized<Area>, InternalIdKey>;
107
- type event = Omit<Serialized<Event>, InternalIdKey>;
108
- type exception = Omit<Serialized<Exception>, InternalIdKey>;
109
- type course = Omit<Serialized<Course>, InternalIdKey>;
110
- type location = Omit<Serialized<Location>, InternalIdKey>;
111
- type group = Omit<Serialized<Group>, InternalIdKey>;
112
- type lockedTime = Omit<Serialized<LockedTime>, InternalIdKey>;
113
- type division = Omit<Serialized<Division>, InternalIdKey>;
114
- type divisionSettings = Omit<Serialized<DivisionSettings>, InternalIdKey>;
115
- type overlapGroup = Omit<Serialized<OverlapGroup>, InternalIdKey>;
116
- type period = Omit<Serialized<Period>, InternalIdKey>;
117
- type person = Omit<Serialized<Person>, InternalIdKey>;
118
- type rootInterval = Omit<Serialized<RootInterval>, InternalIdKey>;
119
- type teacher = Omit<Serialized<Teacher>, InternalIdKey>;
120
- type syllabus = Omit<Serialized<Syllabus>, InternalIdKey>;
121
- type schedule = SerializedScheduleWithoutInternalId;
77
+ namespace MixedWithoutInternalId {
78
+ type Configuration = MixedWithOptionalId.Configuration.Base;
79
+ type Teacher = MixedWithOptionalId.Teacher;
80
+ type Exception = MixedWithOptionalId.Exception;
81
+ type Event = MixedWithOptionalId.Event;
82
+ type ScheduleEvent = MixedWithOptionalId.ScheduleEvent;
83
+ type CalendarEvent = MixedWithOptionalId.CalendarEvent;
84
+ type Course = MixedWithOptionalId.Course;
85
+ type Settings = MixedWithOptionalId.Settings;
86
+ type Division = MixedWithOptionalId.Division;
87
+ type Generation = MixedWithOptionalId.Generation;
88
+ type Group = MixedWithOptionalId.Group;
89
+ type Location = MixedWithOptionalId.Location;
90
+ type LockedTime = MixedWithOptionalId.LockedTime;
91
+ type OverlapGroup = MixedWithOptionalId.OverlapGroup;
92
+ type Period = MixedWithOptionalId.Period;
93
+ type Person = MixedWithOptionalId.Person;
94
+ type RootInterval = MixedWithOptionalId.RootInterval;
95
+ type Syllabus = MixedWithOptionalId.Syllabus;
96
+ type Schedule = MixedWithOptionalId.Schedule;
97
+ }
98
+ namespace SerializedWithOptionalId {
99
+ type Configuration = SerializedWithOptionalId.Configuration.Base;
100
+ type Teacher = SerializedWithOptionalId.Teacher;
101
+ type Exception = SerializedWithOptionalId.Exception;
102
+ type Event = SerializedWithOptionalId.Event;
103
+ type ScheduleEvent = SerializedWithOptionalId.ScheduleEvent;
104
+ type CalendarEvent = SerializedWithOptionalId.CalendarEvent;
105
+ type Course = SerializedWithOptionalId.Course;
106
+ type Settings = SerializedWithOptionalId.Settings;
107
+ type Division = SerializedWithOptionalId.Division;
108
+ type Generation = SerializedWithOptionalId.Generation;
109
+ type Group = SerializedWithOptionalId.Group;
110
+ type Location = SerializedWithOptionalId.Location;
111
+ type LockedTime = SerializedWithOptionalId.LockedTime;
112
+ type OverlapGroup = SerializedWithOptionalId.OverlapGroup;
113
+ type Period = SerializedWithOptionalId.Period;
114
+ type Person = SerializedWithOptionalId.Person;
115
+ type RootInterval = SerializedWithOptionalId.RootInterval;
116
+ type Syllabus = SerializedWithOptionalId.Syllabus;
117
+ type Schedule = SerializedWithOptionalId.Schedule;
122
118
  }
123
119
  }
124
120
  //#endregion
package/dist/core/util.js CHANGED
@@ -15,17 +15,16 @@ function getVertexId(edge, _idKey) {
15
15
  if (typeof edge === "string") return edge;
16
16
  if (edge instanceof Types.ObjectId) return edge.toString();
17
17
  const idKey = typeof _idKey === "string" ? _idKey : getIdKey(_idKey);
18
- if (idKey == "_id" && idKey in edge) return edge._id.toString();
19
- if (idKey == "id" && idKey in edge) return edge.id;
20
- if (idKey == "ids" && edge.ids) return edge.ids;
18
+ if (idKey == "_id" && idKey in edge && edge[idKey]) return edge[idKey].toString();
19
+ if (idKey == "id" && idKey in edge && edge[idKey]) return edge[idKey];
20
+ if (idKey == "ids" && idKey in edge && edge[idKey]) return edge[idKey];
21
21
  throw new Error(`Unable to get vertex ID "${idKey}" from edge: ${JSON.stringify(edge)}`);
22
22
  }
23
23
  /**
24
24
  * Returns the day index in the range 0-6, where 0 is Monday and 6 is Sunday.
25
25
  */
26
26
  function getDayIndex(value) {
27
- const day = typeof value === "number" ? value : moment.utc(value).day();
28
- return (day + 6) % 7;
27
+ return ((typeof value === "number" ? value : moment.utc(value).day()) + 6) % 7;
29
28
  }
30
29
  function parseDateInterval(interval, type) {
31
30
  if (!interval.start) throw new Error(`(RS::To::validateInterval) The interval ${type ? `"${type}"` : ""} is missing a start time`);
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","names":["MongooseTypes"],"sources":["../../src/core/util.ts"],"sourcesContent":["import moment from 'moment';\nimport { Types as MongooseTypes } from 'mongoose';\nimport type { IdKey, InternalIdKey, SerializedVertex, Vertex } from './types/common';\nimport type { Interval } from './types/common/intervals';\nimport type { DateType } from '../common/types';\n\n/**\n * Returns the ID key to use for vertices, which can be either `id`, `_id`, or `ids`.\n */\nexport function getIdKey ({ idKey }: { idKey?: IdKey }) {\n return idKey ?? 'id';\n}\n\n/**\n * Returns the ID of a vertex, which can be either `_id`, `id`, or `ids`.\n */\nexport function getVertexId (\n edge: Vertex | Omit<Vertex, InternalIdKey> | SerializedVertex,\n _idKey: IdKey | { idKey?: IdKey }\n): string {\n if (typeof edge === 'string') return edge;\n if (edge instanceof MongooseTypes.ObjectId) return edge.toString();\n\n const idKey = typeof _idKey === 'string' ? _idKey : getIdKey(_idKey);\n if (idKey == '_id' && idKey in edge) return edge._id.toString();\n if (idKey == 'id' && idKey in edge) return edge.id;\n if (idKey == 'ids' && edge.ids ) return edge.ids;\n\n throw new Error(`Unable to get vertex ID \"${idKey}\" from edge: ${JSON.stringify(edge)}`);\n}\n\n\n/**\n * Returns the day index in the range 0-6, where 0 is Monday and 6 is Sunday.\n */\nexport function getDayIndex (value: DateType | number): number {\n const day = typeof value === 'number' ? value : moment.utc(value).day();\n return (day + 6) % 7;\n}\n\nexport function parseDateInterval (interval: Partial<Interval<DateType>>, type?: string): Interval<moment.Moment> {\n if (!interval.start) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is missing a start time`);\n if (!interval.end ) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is missing an end time`);\n\n const start = moment.utc(interval.start);\n const end = moment.utc(interval.end);\n if (!start.isValid()) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} has an invalid start time`);\n if (!end .isValid()) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} has an invalid end time`);\n\n if (end.isSameOrBefore(start)) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is invalid: end time is before or equal to start time`);\n\n return { start, end };\n}"],"mappings":";;;;;;;AASA,SAAgB,SAAU,EAAE,SAA4B;AACtD,QAAO,SAAS;;;;;AAMlB,SAAgB,YACd,MACA,QACQ;AACR,KAAI,OAAO,SAAS,SAAU,QAAO;AACrC,KAAI,gBAAgBA,MAAc,SAAU,QAAO,KAAK;CAExD,MAAM,QAAQ,OAAO,WAAW,WAAW,SAAS,SAAS;AAC7D,KAAI,SAAS,SAAS,SAAS,KAAM,QAAO,KAAK,IAAI;AACrD,KAAI,SAAS,QAAS,SAAS,KAAM,QAAO,KAAK;AACjD,KAAI,SAAS,SAAS,KAAK,IAAU,QAAO,KAAK;AAEjD,OAAM,IAAI,MAAM,4BAA4B,MAAM,eAAe,KAAK,UAAU;;;;;AAOlF,SAAgB,YAAa,OAAkC;CAC7D,MAAM,MAAM,OAAO,UAAU,WAAW,QAAQ,OAAO,IAAI,OAAO;AAClE,SAAQ,MAAM,KAAK;;AAGrB,SAAgB,kBAAmB,UAAuC,MAAwC;AAChH,KAAI,CAAC,SAAS,MAAO,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG;AACxG,KAAI,CAAC,SAAS,IAAO,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG;CAExG,MAAM,QAAQ,OAAO,IAAI,SAAS;CAClC,MAAM,MAAQ,OAAO,IAAI,SAAS;AAClC,KAAI,CAAC,MAAM,UAAW,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG;AACzG,KAAI,CAAC,IAAM,UAAW,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG;AAEzG,KAAI,IAAI,eAAe,OAAQ,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG;AAElH,QAAO;EAAE;EAAO"}
1
+ {"version":3,"file":"util.js","names":["MongooseTypes"],"sources":["../../src/core/util.ts"],"sourcesContent":["import moment from 'moment';\nimport { Types as MongooseTypes } from 'mongoose';\nimport type { IdKey } from './types/common';\nimport type { Vertex, Collection } from './interfaces/vertices/util';\nimport type { DateType } from '../common/types';\nimport type { Interval } from './interfaces';\nimport type { IDType, OmitInternalVertexKeys, PrivateIDType } from './interfaces/vertices/util/vertex';\n\n/**\n * Returns the ID key to use for vertices, which can be either `id`, `_id`, or `ids`.\n */\nexport function getIdKey ({ idKey }: { idKey?: IdKey }) {\n return idKey ?? 'id';\n}\n\n/**\n * Returns the ID of a vertex, which can be either `_id`, `id`, or `ids`.\n */\nexport function getVertexId (\n edge: IDType | PrivateIDType | Partial<OmitInternalVertexKeys<Vertex<Collection>>>,\n _idKey: IdKey | { idKey?: IdKey }\n): string {\n if (typeof edge === 'string') return edge;\n if (edge instanceof MongooseTypes.ObjectId) return edge.toString();\n\n const idKey = typeof _idKey === 'string' ? _idKey : getIdKey(_idKey);\n if (idKey == '_id' && idKey in edge && edge[idKey]) return edge[idKey].toString();\n if (idKey == 'id' && idKey in edge && edge[idKey]) return edge[idKey];\n if (idKey == 'ids' && idKey in edge && edge[idKey]) return edge[idKey];\n\n throw new Error(`Unable to get vertex ID \"${idKey}\" from edge: ${JSON.stringify(edge)}`);\n}\n\n\n/**\n * Returns the day index in the range 0-6, where 0 is Monday and 6 is Sunday.\n */\nexport function getDayIndex (value: DateType | number): number {\n const day = typeof value === 'number' ? value : moment.utc(value).day();\n return (day + 6) % 7;\n}\n\nexport function parseDateInterval (interval: Partial<Interval<DateType>>, type?: string): Interval<moment.Moment> {\n if (!interval.start) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is missing a start time`);\n if (!interval.end ) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is missing an end time`);\n\n const start = moment.utc(interval.start);\n const end = moment.utc(interval.end);\n if (!start.isValid()) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} has an invalid start time`);\n if (!end .isValid()) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} has an invalid end time`);\n\n if (end.isSameOrBefore(start)) throw new Error(`(RS::To::validateInterval) The interval ${type ? `\"${type}\"` : ''} is invalid: end time is before or equal to start time`);\n\n return { start, end };\n}"],"mappings":";;;;;;;AAWA,SAAgB,SAAU,EAAE,SAA4B;AACtD,QAAO,SAAS;;;;;AAMlB,SAAgB,YACd,MACA,QACQ;AACR,KAAI,OAAO,SAAS,SAAU,QAAO;AACrC,KAAI,gBAAgBA,MAAc,SAAU,QAAO,KAAK,UAAU;CAElE,MAAM,QAAQ,OAAO,WAAW,WAAW,SAAS,SAAS,OAAO;AACpE,KAAI,SAAS,SAAS,SAAS,QAAQ,KAAK,OAAQ,QAAO,KAAK,OAAO,UAAU;AACjF,KAAI,SAAS,QAAS,SAAS,QAAQ,KAAK,OAAQ,QAAO,KAAK;AAChE,KAAI,SAAS,SAAS,SAAS,QAAQ,KAAK,OAAQ,QAAO,KAAK;AAEhE,OAAM,IAAI,MAAM,4BAA4B,MAAM,eAAe,KAAK,UAAU,KAAK,GAAG;;;;;AAO1F,SAAgB,YAAa,OAAkC;AAE7D,UADY,OAAO,UAAU,WAAW,QAAQ,OAAO,IAAI,MAAM,CAAC,KAAK,IACzD,KAAK;;AAGrB,SAAgB,kBAAmB,UAAuC,MAAwC;AAChH,KAAI,CAAC,SAAS,MAAO,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,0BAA0B;AAClI,KAAI,CAAC,SAAS,IAAO,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,yBAAyB;CAEjI,MAAM,QAAQ,OAAO,IAAI,SAAS,MAAM;CACxC,MAAM,MAAQ,OAAO,IAAI,SAAS,IAAI;AACtC,KAAI,CAAC,MAAM,SAAS,CAAE,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,4BAA4B;AACrI,KAAI,CAAC,IAAM,SAAS,CAAE,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,0BAA0B;AAEnI,KAAI,IAAI,eAAe,MAAM,CAAE,OAAM,IAAI,MAAM,2CAA2C,OAAO,IAAI,KAAK,KAAK,GAAG,wDAAwD;AAE1K,QAAO;EAAE;EAAO;EAAK"}
@@ -100,7 +100,7 @@ declare const maps: readonly [{
100
100
  readonly name: "Royal Schedule Algorithm";
101
101
  readonly map: typeof RSMap;
102
102
  readonly meta: {
103
- readonly structure: "RS/algorithm-5.0.1";
103
+ readonly structure: "RS/algorithm-5.0.2";
104
104
  };
105
105
  }, {
106
106
  readonly structure: {
@@ -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":"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"}
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":"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"}
@@ -22,8 +22,7 @@ function identify(schedule) {
22
22
  error: []
23
23
  };
24
24
  if (!schedule) return similarities;
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);
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);
27
26
  if (res.data) {
28
27
  const determined = maps.find((x) => sameMajorStructure(x.meta.structure, res.data.meta.structure));
29
28
  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,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,EAAE,OAAO,EACP,WAAW,EAAE,aAEf,EAAE,MAAM,EAAE,WACP,WAAU,QAAO,IAAI,GAAG,IACxB,KAAK,EAAE,OAAO,EACb,WAAW,EAAE;CAIrB,MAAM,MAAM,cAAc,UAAU;AACpC,KAAI,IAAI,MAAM;EAEZ,MAAM,aAAa,KAAK,MAAK,MAAK,mBAAmB,EAAE,KAAK,WAAW,IAAI,KAAK,KAAK;AACrF,MAAI,YAAY;AACd,gBAAa,aAAa;AAC1B,UAAO;;;CAQX,MAAMC,cAAwB,MAAM,QAAQ,YAAY,OAAO,YAAY,OAAO,KAAK;AACvF,KAAI,CAAC,YAAY,OAAQ,QAAO;AAEhC,MAAK,SAAQ,YAAW;EACtB,MAAM,EAAE,cAAc;AAEtB,MAAI;AACF,OAAI,eAAe,WAAW,OAAO,aAAa,QAAQ,WAAW;AACnE,iBAAa,OAAO,KAAK;AACzB;;AAGF,OAAI,CAAC,WAAW;AACd,iBAAa,KAAK,KAAK;AACvB;;GAGF,MAAM,eAAe,MAAM,QAAQ,aAAa,YAAY,OAAO,KAAK;AAKxE,OAAI,MAAM,QAAQ,WAAW;AAE3B,QAAI,CAAC,MAAM,QAAQ,YAAY;AAC7B,kBAAa,KAAK,KAAK;AACvB;;AAGF,QAAI,QAAQ,OAAO,eAAe,OAAO,eAAe;AACtD,kBAAa,OAAO,KAAK;AACzB;;AAGF,QAAI,WAAW,OAAO,eAAe,OAAO,cAAc,SAAS,aAAa,QAAQ;AACtF,kBAAa,KAAK,KAAK;AACvB;;AAGF,iBAAa,KAAK,KAAK;AACvB;;AAWF,OAAI,aAAa,OAAM,eAAc;AACnC,QAAI,EAAE,YAAY,OAAO,YAAY,YAAY,cAAc,UAAW,QAAO;IACjF,MAAM,eAAe,OAAO,SAAS;AAErC,QAAI,EAAE,cAAc,WAAY,QAAO;IACvC,MAAMC,gBAA0B,UAAU;AAE1C,WAAO,aAAa,OAAM,QAAO,cAAc,SAAS;OACtD;AACF,iBAAa,OAAO,KAAK;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
+ {"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":"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"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,26 @@
1
1
  import { Types as Types$15 } from "./Skola24/txt/types/index.js";
2
+ import { Coalesced } from "./core/interfaces/vertices/properties/coalesced.js";
3
+ import { Species } from "./core/interfaces/vertices/properties/species.js";
4
+ import { AllWeeks, Week, allWeeks } from "./core/interfaces/vertices/properties/week.js";
5
+ import { Day } from "./core/interfaces/vertices/properties/days.js";
6
+ import { Interval } from "./core/interfaces/vertices/properties/intervals.js";
7
+ import { Tag, TagType } from "./core/interfaces/vertices/properties/tags.js";
8
+ import { MaximumScheduleSpan } from "./core/interfaces/vertices/properties/maximum-schedule-span.js";
9
+ import { PlannedScheduledDuration } from "./core/interfaces/vertices/properties/planned-scheduled-duration.js";
10
+ import { MinBreakLength } from "./core/interfaces/vertices/properties/min-break-length.js";
11
+ import { PublicId } from "./core/interfaces/vertices/properties/index.js";
12
+ import { CalendarException } from "./core/interfaces/vertices/division-settings.js";
13
+ import { Address, AutoSyncConfig, Company, GlobalDefaultValues, INACTIVITY_ACTIONS, InactivityAction, InactivitySettings, PublicConfig, TimeRosterSection } from "./core/interfaces/other/companies.js";
14
+ import { Integration } from "./core/interfaces/other/integrations.js";
15
+ import { User } from "./core/interfaces/other/users.js";
16
+ import { Action, Policy, Statement } from "./core/interfaces/other/policies.js";
17
+ import { Operation, OperationType, operationType } from "./core/interfaces/other/operations.js";
18
+ import { ErrorCode, SyncLog } from "./core/interfaces/other/sync-logs.js";
19
+ import { StepGuideProgress } from "./core/interfaces/vertices/divisions.js";
20
+ import { CalendarExceptionAction, ExceptionStatus } from "./core/interfaces/vertices/exceptions.js";
21
+ import { LockedTimeType } from "./core/interfaces/vertices/locked-times.js";
22
+ import { Infer, VertexQuery, createVertexQuery } from "./core/interfaces/vertices/vertex-query.js";
23
+ import { Deep, DeepWithoutPrivateId, Mixed, MixedWithOptionalId, Serialized, SerializedWithOptionalId } from "./core/interfaces/vertices/index.js";
2
24
  import { Types as Types$2 } from "./core/types/index.js";
3
25
  import { CoreMap } from "./core/index.js";
4
26
  import { Types as Types$14 } from "./Skola24/mdb/types/index.js";
@@ -32,4 +54,4 @@ import { SchoolityMap } from "./Schoolity/index.js";
32
54
  import { QuiculumMap } from "./Quiculum/index.js";
33
55
  import { Types } from "./Additio/types/index.js";
34
56
  import { AdditioMap } from "./Additio/index.js";
35
- export { AdditioMap, Types as AdditioTypes, AdmentumMap, Types$1 as AdmentumTypes, CoreMap, Types$2 as CoreTypes, ExcelMap, Types$3 as ExcelV1Types, Types$4 as ExcelV2Types, IdentifiedMaps, IdunSoftMap, Types$5 as IdunSoftTypes, InfoMentorMap, Types$6 as InfoMentorTypes, MapInstance, MapName, PlanDigitalMap, Types$7 as PlanDigitalTypes, QuiculumMap, RSMap, Types$8 as RSTypes, SS12000Map, Types$9 as SS12000Types, Types$10 as SchoolSoftApiTypes, Types$11 as SchoolSoftFileTypes, SchoolSoftMap, SchoolityMap, Types$12 as SchoolityTXTTypes, SduiMap, Types$13 as SduiTypes, Types$14 as Skola24MDBTypes, Skola24Map, Types$15 as Skola24TXTTypes, identify, maps, vKlassMap };
57
+ export { Action, AdditioMap, Types as AdditioTypes, Address, AdmentumMap, Types$1 as AdmentumTypes, AllWeeks, AutoSyncConfig, CalendarException, CalendarExceptionAction, Coalesced, Company, CoreMap, Types$2 as CoreTypes, Day, Deep, DeepWithoutPrivateId, ErrorCode, ExcelMap, Types$3 as ExcelV1Types, Types$4 as ExcelV2Types, ExceptionStatus, GlobalDefaultValues, INACTIVITY_ACTIONS, IdentifiedMaps, IdunSoftMap, Types$5 as IdunSoftTypes, InactivityAction, InactivitySettings, Infer, InfoMentorMap, Types$6 as InfoMentorTypes, Integration, Interval, LockedTimeType, MapInstance, MapName, MaximumScheduleSpan, MinBreakLength, Mixed, MixedWithOptionalId, Operation, OperationType, PlanDigitalMap, Types$7 as PlanDigitalTypes, PlannedScheduledDuration, Policy, PublicConfig, PublicId, QuiculumMap, RSMap, Types$8 as RSTypes, SS12000Map, Types$9 as SS12000Types, Types$10 as SchoolSoftApiTypes, Types$11 as SchoolSoftFileTypes, SchoolSoftMap, SchoolityMap, Types$12 as SchoolityTXTTypes, SduiMap, Types$13 as SduiTypes, Serialized, SerializedWithOptionalId, Types$14 as Skola24MDBTypes, Skola24Map, Types$15 as Skola24TXTTypes, Species, Statement, StepGuideProgress, SyncLog, Tag, TagType, TimeRosterSection, User, VertexQuery, Week, allWeeks, createVertexQuery, identify, maps, operationType, vKlassMap };
package/dist/index.js CHANGED
@@ -1,3 +1,6 @@
1
+ import { createVertexQuery } from "./core/interfaces/vertices/vertex-query.js";
2
+ import { allWeeks } from "./core/interfaces/vertices/properties/week.js";
3
+ import { INACTIVITY_ACTIONS } from "./core/interfaces/other/companies.js";
1
4
  import { CoreMap } from "./core/index.js";
2
5
  import { SchoolSoftMap } from "./SchoolSoft/index.js";
3
6
  import { PlanDigitalMap } from "./PlanDigital/index.js";
@@ -16,4 +19,4 @@ import { SchoolityMap } from "./Schoolity/index.js";
16
19
  import { QuiculumMap } from "./Quiculum/index.js";
17
20
  import { AdditioMap } from "./Additio/index.js";
18
21
 
19
- export { AdditioMap, AdmentumMap, CoreMap, ExcelMap, IdunSoftMap, InfoMentorMap, PlanDigitalMap, QuiculumMap, RSMap, SS12000Map, SchoolSoftMap, SchoolityMap, SduiMap, Skola24Map, identify, maps, vKlassMap };
22
+ export { AdditioMap, AdmentumMap, CoreMap, ExcelMap, INACTIVITY_ACTIONS, IdunSoftMap, InfoMentorMap, PlanDigitalMap, QuiculumMap, RSMap, SS12000Map, SchoolSoftMap, SchoolityMap, SduiMap, Skola24Map, allWeeks, createVertexQuery, identify, maps, vKlassMap };
@@ -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"}
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"}