@royalschedule/maps 4.0.5 → 4.0.7

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.
@@ -1,6 +1,6 @@
1
1
  import { Types } from "../../core/types/index.js";
2
2
  import { Types as Types$1 } from "../types/index.js";
3
- import * as xlsx0 from "xlsx";
3
+ import * as xlsx1 from "xlsx";
4
4
 
5
5
  //#region src/Additio/to/index.d.ts
6
6
  declare class export_default {
@@ -14,7 +14,7 @@ declare class export_default {
14
14
  courses: Types.mixed.course[];
15
15
  events: Types.mixed.event[];
16
16
  lockedTimes: Types.mixed.lockedTime[];
17
- }, _options?: Types$1.options) => xlsx0.WorkBook;
17
+ }, _options?: Types$1.options) => xlsx1.WorkBook;
18
18
  }
19
19
  //#endregion
20
20
  export { export_default };
@@ -3,6 +3,26 @@ import moment from "moment";
3
3
  import XLSX from "xlsx";
4
4
 
5
5
  //#region src/Additio/to/schedules.ts
6
+ /**
7
+ * Specifies the header and the order of the columns in the exported Excel file.
8
+ */
9
+ const header = [
10
+ "id",
11
+ "externalid",
12
+ "groupid",
13
+ "group",
14
+ "dayid",
15
+ "startTime",
16
+ "length",
17
+ "subject",
18
+ "inweek",
19
+ "roomid",
20
+ "room",
21
+ "teacherid",
22
+ "teacher",
23
+ "classid",
24
+ "class"
25
+ ];
6
26
  var schedules_default = (schedule, _options = {}) => {
7
27
  const options = _options;
8
28
  const periodsMap = new Map(schedule.periods.map((x) => [getVertexId(x, options), x]));
@@ -66,19 +86,23 @@ var schedules_default = (schedule, _options = {}) => {
66
86
  const start = moment.utc(lockedTime.start);
67
87
  const end = moment.utc(lockedTime.end);
68
88
  const teachers = (lockedTime.coalesced ?? []).filter((x) => x.toModel == "teachers").map((x) => teachersMap.get(getVertexId(x.to, options))).filter((x) => !!x);
89
+ const subject = lockedTime.tags?.find((x) => x.type == "COMPLEMENTARY_TIME")?.value;
90
+ const inweek = inWeeksMap.get(void 0);
69
91
  const out = {
70
92
  id: getVertexId(lockedTime, options),
71
93
  dayid: (start.day() + 6) % 7,
72
94
  startTime: start.format("HHmm"),
73
95
  length: end.diff(start, "minutes"),
96
+ subject,
97
+ inweek,
74
98
  teacherid: teachers.map((x) => x.ids).join(", "),
75
99
  teacher: teachers.map((x) => x.displayName).join(", ")
76
100
  };
77
101
  return out;
78
102
  }).filter((x) => !!x);
79
103
  const wb = XLSX.utils.book_new();
80
- const rows = [...events, ...complementaryTimes];
81
- XLSX.utils.book_append_sheet(wb, XLSX.utils.json_to_sheet(rows), "royal schedule export");
104
+ const sheet = XLSX.utils.json_to_sheet([...events, ...complementaryTimes], { header });
105
+ XLSX.utils.book_append_sheet(wb, sheet, "royal schedule export");
82
106
  return wb;
83
107
  };
84
108
 
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["weeks","out: OutEvent"],"sources":["../../../src/Additio/to/schedules.ts"],"sourcesContent":["import XLSX from 'xlsx';\nimport moment from 'moment';\nimport { getDayIndex, getVertexId } from '../../core/util';\nimport type { BaseOptions } from '../../common/types';\nimport type { Types as CoreTypes } from '../../core/types';\nimport type { Types } from '../types';\n\ntype OutEvent = {\n id?: string;\n externalid?: string;\n groupid?: string;\n group?: string;\n dayid?: number;\n startTime?: string;\n length?: number;\n subject?: string;\n roomid?: string;\n room?: string;\n teacherid?: string;\n teacher?: string;\n classid?: string;\n class?: string;\n inweek?: string;\n};\n\ntype Schedule = {\n division: CoreTypes.mixed.division;\n settings: CoreTypes.mixed.divisionSettings;\n periods: CoreTypes.mixed.period[];\n locations: CoreTypes.mixed.location[];\n groups: CoreTypes.mixed.group[];\n teachers: CoreTypes.mixed.teacher[];\n courses: CoreTypes.mixed.course[];\n events: CoreTypes.mixed.event[];\n lockedTimes: CoreTypes.mixed.lockedTime[];\n};\n\n\nexport default (\n schedule: Schedule,\n _options: Types.options = { }\n): XLSX.WorkBook => {\n const options = _options as BaseOptions & Types.options;\n\n // a map of period.id -> period\n const periodsMap = new Map(schedule.periods.map(x => [getVertexId(x, options) as string | undefined, x as Omit<typeof x, 'id'>] as const));\n periodsMap.set(undefined, { ranges: [{ start: schedule.division.start, end: schedule.division.end }] });\n\n // a map of period.id -> inWeeks\n const inWeeksMap = new Map<string | undefined, string>();\n periodsMap.forEach((period, id) => {\n const weeks = period.ranges\n .map(x => {\n // fetch all weeks between start and end\n const start = moment.utc(x.start);\n const end = moment.utc(x.end);\n const weeks = new Array<number>();\n while (start.isBefore(end)) {\n weeks.push(start.week());\n start.add(1, 'week');\n }\n return weeks;\n })\n .flat()\n .join(', ');\n\n inWeeksMap.set(id, weeks);\n });\n\n // a map of location.id -> location\n const locationsMap = new Map(schedule.locations.map(x => [getVertexId(x, options), x] as const));\n\n // a map of group.id -> group\n const groupsMap = new Map(schedule.groups.map(x => [getVertexId(x, options), x] as const));\n\n // a map of teacher.id -> teacher\n const teachersMap = new Map(schedule.teachers.map(x => [getVertexId(x, options), x] as const));\n\n // a map of course.id -> course\n const coursesMap = new Map(schedule.courses.map(x => [getVertexId(x, options), x] as const));\n\n\n const events = (options.includeEvents ?? true ? schedule.events : [])\n .map(event => {\n // ignore parked events\n if (event.parked) return;\n if (!event.start || !event.end) return;\n\n // must have a course\n const course = event.course ? coursesMap.get(getVertexId(event.course, options)) : undefined;\n if (!course) return;\n\n const start = moment.utc(event.start);\n const end = moment.utc(event.end);\n\n const period = event.period ?? course.period ?? schedule.settings.period;\n const periodId = period ? getVertexId(period, options) : undefined;\n const inWeeks = inWeeksMap.get(periodId);\n\n const locations = (event.inLocations ?? []).map(x => x ? locationsMap.get(getVertexId(x, options)) : null).filter(x => !!x);\n const teachers = (event.teachers ?? course.teachers ?? []).map(x => teachersMap .get(getVertexId(x.to, options)) ).filter(x => !!x);\n const groups = (event.groups ?? course.groups ?? []).map(x => groupsMap .get(getVertexId(x.to, options)) ).filter(x => !!x);\n\n const out: OutEvent = {\n id: getVertexId(event, options),\n externalid: event.ids?.toString(),\n groupid: course.ids,\n group: course.displayName,\n dayid: getDayIndex(start),\n startTime: start.format('HHmm'),\n length: end.diff(start, 'minutes'),\n subject: course.subject,\n inweek: inWeeks,\n roomid: locations.map(x => x.ids ).join(', '),\n room: locations.map(x => x.displayName).join(', '),\n teacherid: teachers .map(x => x.ids ).join(', '),\n teacher: teachers .map(x => x.displayName).join(', '),\n classid: groups .map(x => x.ids ).join(', '),\n class: groups .map(x => x.displayName).join(', ')\n };\n return out;\n })\n .filter(x => x != null);\n\n const complementaryTimes = (options.includeComplementaryTimes ?? true ? schedule.lockedTimes : [])\n .filter(x => x.type == 'COMPLEMENTARY_TIME')\n .map(lockedTime => {\n // ignore parked events\n if (lockedTime.parked) return;\n if (!lockedTime.start || !lockedTime.end) return;\n\n const start = moment.utc(lockedTime.start);\n const end = moment.utc(lockedTime.end);\n\n const teachers = (lockedTime.coalesced ?? [])\n .filter(x => x.toModel == 'teachers')\n .map(x => teachersMap.get(getVertexId(x.to, options)))\n .filter(x => !!x);\n\n const out: OutEvent = {\n id: getVertexId(lockedTime, options),\n dayid: (start.day() + 6) % 7,\n startTime: start.format('HHmm'),\n length: end.diff(start, 'minutes'),\n teacherid: teachers .map(x => x.ids ).join(', '),\n teacher: teachers .map(x => x.displayName).join(', '),\n };\n return out;\n })\n .filter(x => !!x);\n\n const wb = XLSX.utils.book_new();\n\n const rows = [...events, ...complementaryTimes];\n XLSX.utils.book_append_sheet(wb, XLSX.utils.json_to_sheet(rows), 'royal schedule export');\n\n return wb;\n};\n"],"mappings":";;;;;AAsCA,yBACE,UACA,WAA0B,OACR;CAClB,MAAM,UAAU;CAGhB,MAAM,aAAa,IAAI,IAAI,SAAS,QAAQ,KAAI,MAAK,CAAC,YAAY,GAAG,UAAgC;AACrG,YAAW,IAAI,QAAW,EAAE,QAAQ,CAAC;EAAE,OAAO,SAAS,SAAS;EAAO,KAAK,SAAS,SAAS;;CAG9F,MAAM,6BAAa,IAAI;AACvB,YAAW,SAAS,QAAQ,OAAO;EACjC,MAAM,QAAQ,OAAO,OAClB,KAAI,MAAK;GAER,MA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KAAK;GAClD,SAAW,SAAU,KAAI,MAAK,EAAE,aAAa,KAAK;;AAEpD,SAAO;IAER,QAAO,MAAK,CAAC,CAAC;CAEjB,MAAM,KAAK,KAAK,MAAM;CAEtB,MAAM,OAAO,CAAC,GAAG,QAAQ,GAAG;AAC5B,MAAK,MAAM,kBAAkB,IAAI,KAAK,MAAM,cAAc,OAAO;AAEjE,QAAO"}
1
+ {"version":3,"file":"schedules.js","names":["header: (keyof Required<OutEvent>)[]","weeks","out: OutEvent"],"sources":["../../../src/Additio/to/schedules.ts"],"sourcesContent":["import XLSX from 'xlsx';\nimport moment from 'moment';\nimport { getDayIndex, getVertexId } from '../../core/util';\nimport type { BaseOptions } from '../../common/types';\nimport type { Types as CoreTypes } from '../../core/types';\nimport type { Types } from '../types';\n\ntype OutEvent = {\n id?: string;\n externalid?: string;\n groupid?: string;\n group?: string;\n dayid?: number;\n startTime?: string;\n length?: number;\n subject?: string;\n roomid?: string;\n room?: string;\n teacherid?: string;\n teacher?: string;\n classid?: string;\n class?: string;\n inweek?: string;\n};\n\n/**\n * Specifies the header and the order of the columns in the exported Excel file.\n */\nconst header: (keyof Required<OutEvent>)[] = [\n 'id',\n 'externalid',\n 'groupid',\n 'group',\n 'dayid',\n 'startTime',\n 'length',\n 'subject',\n 'inweek',\n 'roomid',\n 'room',\n 'teacherid',\n 'teacher',\n 'classid',\n 'class'\n];\n\ntype Schedule = {\n division: CoreTypes.mixed.division;\n settings: CoreTypes.mixed.divisionSettings;\n periods: CoreTypes.mixed.period[];\n locations: CoreTypes.mixed.location[];\n groups: CoreTypes.mixed.group[];\n teachers: CoreTypes.mixed.teacher[];\n courses: CoreTypes.mixed.course[];\n events: CoreTypes.mixed.event[];\n lockedTimes: CoreTypes.mixed.lockedTime[];\n};\n\n\nexport default (\n schedule: Schedule,\n _options: Types.options = { }\n): XLSX.WorkBook => {\n const options = _options as BaseOptions & Types.options;\n\n // a map of period.id -> period\n const periodsMap = new Map(schedule.periods.map(x => [getVertexId(x, options) as string | undefined, x as Omit<typeof x, 'id'>] as const));\n periodsMap.set(undefined, { ranges: [{ start: schedule.division.start, end: schedule.division.end }] });\n\n // a map of period.id -> inWeeks\n const inWeeksMap = new Map<string | undefined, string>();\n periodsMap.forEach((period, id) => {\n const weeks = period.ranges\n .map(x => {\n // fetch all weeks between start and end\n const start = moment.utc(x.start);\n const end = moment.utc(x.end);\n const weeks = new Array<number>();\n while (start.isBefore(end)) {\n weeks.push(start.week());\n start.add(1, 'week');\n }\n return weeks;\n })\n .flat()\n .join(', ');\n\n inWeeksMap.set(id, weeks);\n });\n\n // a map of location.id -> location\n const locationsMap = new Map(schedule.locations.map(x => [getVertexId(x, options), x] as const));\n\n // a map of group.id -> group\n const groupsMap = new Map(schedule.groups.map(x => [getVertexId(x, options), x] as const));\n\n // a map of teacher.id -> teacher\n const teachersMap = new Map(schedule.teachers.map(x => [getVertexId(x, options), x] as const));\n\n // a map of course.id -> course\n const coursesMap = new Map(schedule.courses.map(x => [getVertexId(x, options), x] as const));\n\n\n const events = (options.includeEvents ?? true ? schedule.events : [])\n .map(event => {\n // ignore parked events\n if (event.parked) return;\n if (!event.start || !event.end) return;\n\n // must have a course\n const course = event.course ? coursesMap.get(getVertexId(event.course, options)) : undefined;\n if (!course) return;\n\n const start = moment.utc(event.start);\n const end = moment.utc(event.end);\n\n const period = event.period ?? course.period ?? schedule.settings.period;\n const periodId = period ? getVertexId(period, options) : undefined;\n const inWeeks = inWeeksMap.get(periodId);\n\n const locations = (event.inLocations ?? []).map(x => x ? locationsMap.get(getVertexId(x, options)) : null).filter(x => !!x);\n const teachers = (event.teachers ?? course.teachers ?? []).map(x => teachersMap .get(getVertexId(x.to, options)) ).filter(x => !!x);\n const groups = (event.groups ?? course.groups ?? []).map(x => groupsMap .get(getVertexId(x.to, options)) ).filter(x => !!x);\n\n const out: OutEvent = {\n id: getVertexId(event, options),\n externalid: event.ids?.toString(),\n groupid: course.ids,\n group: course.displayName,\n dayid: getDayIndex(start),\n startTime: start.format('HHmm'),\n length: end.diff(start, 'minutes'),\n subject: course.subject,\n inweek: inWeeks,\n roomid: locations.map(x => x.ids ).join(', '),\n room: locations.map(x => x.displayName).join(', '),\n teacherid: teachers .map(x => x.ids ).join(', '),\n teacher: teachers .map(x => x.displayName).join(', '),\n classid: groups .map(x => x.ids ).join(', '),\n class: groups .map(x => x.displayName).join(', ')\n };\n return out;\n })\n .filter(x => x != null);\n\n const complementaryTimes = (options.includeComplementaryTimes ?? true ? schedule.lockedTimes : [])\n .filter(x => x.type == 'COMPLEMENTARY_TIME')\n .map(lockedTime => {\n // ignore parked events\n if (lockedTime.parked) return;\n if (!lockedTime.start || !lockedTime.end) return;\n\n const start = moment.utc(lockedTime.start);\n const end = moment.utc(lockedTime.end);\n\n const teachers = (lockedTime.coalesced ?? [])\n .filter(x => x.toModel == 'teachers')\n .map(x => teachersMap.get(getVertexId(x.to, options)))\n .filter(x => !!x);\n\n const subject = lockedTime.tags?.find(x => x.type == 'COMPLEMENTARY_TIME')?.value;\n\n // the full schedule range\n const inweek = inWeeksMap.get(undefined);\n\n const out: OutEvent = {\n id: getVertexId(lockedTime, options),\n dayid: (start.day() + 6) % 7,\n startTime: start.format('HHmm'),\n length: end.diff(start, 'minutes'),\n subject: subject,\n inweek: inweek,\n teacherid: teachers .map(x => x.ids ).join(', '),\n teacher: teachers .map(x => x.displayName).join(', '),\n };\n return out;\n })\n .filter(x => !!x);\n\n const wb = XLSX.utils.book_new();\n\n const sheet = XLSX.utils.json_to_sheet([...events, ...complementaryTimes], { header });\n XLSX.utils.book_append_sheet(wb, sheet, 'royal schedule export');\n\n return wb;\n};\n"],"mappings":";;;;;;;;AA4BA,MAAMA,SAAuC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;AAgBF,yBACE,UACA,WAA0B,OACR;CAClB,MAAM,UAAU;CAGhB,MAAM,aAAa,IAAI,IAAI,SAAS,QAAQ,KAAI,MAAK,CA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AAY,EAAE,IAAI,WAC3C,QAAO,MAAK,CAAC,CAAC;EAEjB,MAAM,UAAU,WAAW,MAAM,MAAK,MAAK,EAAE,QAAQ,uBAAuB;EAG5E,MAAM,SAAS,WAAW,IAAI;EAE9B,MAAMA,MAAgB;GACpB,IAAW,YAAY,YAAY;GACnC,QAAY,MAAM,QAAQ,KAAK;GAC/B,WAAW,MAAM,OAAO;GACxB,QAAW,IAAI,KAAK,OAAO;GAChB;GACA;GACX,WAAW,SAAU,KAAI,MAAK,EAAE,KAAa,KAAK;GAClD,SAAW,SAAU,KAAI,MAAK,EAAE,aAAa,KAAK;;AAEpD,SAAO;IAER,QAAO,MAAK,CAAC,CAAC;CAEjB,MAAM,KAAK,KAAK,MAAM;CAEtB,MAAM,QAAQ,KAAK,MAAM,cAAc,CAAC,GAAG,QAAQ,GAAG,qBAAqB,EAAE;AAC7E,MAAK,MAAM,kBAAkB,IAAI,OAAO;AAExC,QAAO"}
@@ -15,55 +15,55 @@ declare class PlanDigitalMap {
15
15
  groups?: {
16
16
  exceptions?: string[] | undefined;
17
17
  lockedTimes?: string[] | undefined;
18
- ids?: ID | undefined;
19
18
  createdAt?: DateType | undefined;
20
19
  updatedAt?: DateType | undefined;
21
20
  lastModifiedBy?: unknown;
22
- belongsTo?: string | undefined;
23
- rank?: number | undefined;
21
+ ids?: ID | undefined;
24
22
  displayName?: string | undefined;
25
- lunch?: string[] | undefined;
26
- intervals?: AllowedInterval[] | undefined;
23
+ rank?: number | undefined;
27
24
  days?: Day[] | undefined;
25
+ belongsTo?: string | undefined;
26
+ intervals?: AllowedInterval[] | undefined;
28
27
  minBreakLength?: BreakLength | undefined;
29
- tags?: Tag[] | undefined;
30
28
  maximumScheduleSpan?: MaximumScheduleSpan | undefined;
31
29
  forbidOverlappingEvents?: boolean | undefined;
32
30
  disableDayLengthPunishment?: boolean | undefined;
33
31
  weight?: number | undefined;
34
- rootInterval?: string | undefined;
35
- maxNumWorkingHours?: number | boolean | undefined;
36
- maxNumDailyWorkingHours?: number | number[] | boolean | undefined;
37
32
  species?: "class" | undefined;
38
33
  parentGroups?: string[] | undefined;
39
34
  subGroups?: string[] | undefined;
35
+ lunch?: string[] | undefined;
40
36
  members?: string[] | undefined;
37
+ rootInterval?: string | undefined;
38
+ tags?: Tag[] | undefined;
39
+ maxNumWorkingHours?: number | boolean | undefined;
40
+ maxNumDailyWorkingHours?: number | number[] | boolean | undefined;
41
41
  }[];
42
42
  teachers?: {
43
43
  exceptions?: string[] | undefined;
44
44
  lockedTimes?: string[] | undefined;
45
- ids?: ID | undefined;
46
45
  createdAt?: DateType | undefined;
47
46
  updatedAt?: DateType | undefined;
48
47
  lastModifiedBy?: unknown;
49
- belongsTo?: string | undefined;
50
- rank?: number | undefined;
48
+ ids?: ID | undefined;
51
49
  displayName?: string | undefined;
52
- lunch?: string[] | undefined;
53
- intervals?: AllowedInterval[] | undefined;
50
+ rank?: number | undefined;
54
51
  days?: Day[] | undefined;
52
+ belongsTo?: string | undefined;
53
+ intervals?: AllowedInterval[] | undefined;
55
54
  minBreakLength?: BreakLength | undefined;
56
- tags?: Tag[] | undefined;
57
- plannedScheduledDuration?: PlannedScheduledDuration | undefined;
58
55
  maximumScheduleSpan?: MaximumScheduleSpan | undefined;
59
56
  forbidOverlappingEvents?: boolean | undefined;
60
57
  disableDayLengthPunishment?: boolean | undefined;
61
58
  weight?: number | undefined;
62
- person?: string | undefined;
59
+ lunch?: string[] | undefined;
63
60
  rootInterval?: string | undefined;
64
- signature?: string | undefined;
61
+ tags?: Tag[] | undefined;
65
62
  maxNumWorkingHours?: number | boolean | undefined;
66
63
  maxNumDailyWorkingHours?: number | number[] | boolean | undefined;
64
+ plannedScheduledDuration?: PlannedScheduledDuration | undefined;
65
+ person?: string | undefined;
66
+ signature?: string | undefined;
67
67
  }[];
68
68
  courses?: {
69
69
  exceptions?: string[] | undefined;
@@ -72,26 +72,26 @@ declare class PlanDigitalMap {
72
72
  locations?: AvailableLocation<string>[] | undefined;
73
73
  events?: string[] | undefined;
74
74
  lockedTimes?: string[] | undefined;
75
- ids?: ID | undefined;
76
75
  createdAt?: DateType | undefined;
77
76
  updatedAt?: DateType | undefined;
78
77
  lastModifiedBy?: unknown;
79
- belongsTo?: string | undefined;
78
+ ids?: ID | undefined;
80
79
  displayName?: string | undefined;
81
- intervals?: AllowedInterval[] | undefined;
82
80
  days?: Day[] | undefined;
83
- minBreakLength?: BreakLength | undefined;
84
- tags?: Tag[] | undefined;
85
81
  weeks?: number[] | undefined;
86
- weight?: number | undefined;
82
+ belongsTo?: string | undefined;
87
83
  period?: string | undefined;
84
+ type?: string | undefined;
85
+ intervals?: AllowedInterval[] | undefined;
86
+ minBreakLength?: BreakLength | undefined;
87
+ weight?: number | undefined;
88
+ tags?: Tag[] | undefined;
89
+ color?: string | undefined;
88
90
  participants?: PersonReference<string>[] | undefined;
89
91
  density?: number | undefined;
90
92
  subject?: string | undefined;
91
- color?: string | undefined;
92
93
  eventDurationVariance?: number | undefined;
93
94
  totalTime?: string | undefined;
94
- type?: string | undefined;
95
95
  comment?: string | undefined;
96
96
  startDate?: DateType | undefined;
97
97
  endDate?: DateType | undefined;
@@ -43,7 +43,7 @@ function parseInput(schedule, options = {}) {
43
43
  dependencies: fromLocations(locations, settings, options),
44
44
  groups: fromGroups(groups, settings, options).concat(fromTeachers(teachers, settings, options)),
45
45
  individuals: options.oldFormat ? void 0 : extractUniqueIndividuals(persons, courses, events, lockedTimes, options),
46
- events: new Array().concat(fromCollections(courses, settings, options, periodsMap)).concat(fromDynamicLockedTimes(lockedTimes, settings, options))
46
+ events: [...fromCollections(courses, settings, options, periodsMap), ...fromDynamicLockedTimes(lockedTimes, settings, options)]
47
47
  };
48
48
  return data;
49
49
  }
@@ -1 +1 @@
1
- {"version":3,"file":"input.js","names":["data: Types.scheduleData"],"sources":["../../../../src/RS/to/input/input.ts"],"sourcesContent":["import type { Types } from '../../types';\nimport { fromLocations } from './dependencies';\nimport { fromTeachers } from './teachers';\nimport { fromCollections } from './collections';\nimport { parseSettings } from './settings';\nimport { parseDefault } from './default';\nimport { fromDynamicLockedTimes } from './dynamic-locked-times';\nimport { parsePeriods } from './periods';\nimport type { ConnectedScheduleData } from '../../make-connected';\nimport { fromGroups } from './groups';\nimport { extractUniqueIntervals } from './intervals';\nimport { extractUniqueIndividuals } from './individuals';\n\nexport function parseInput (\n schedule: ConnectedScheduleData,\n options: Types.parsedToOptions = {}\n): Types.scheduleData {\n\n const settings = schedule.settings;\n const division = schedule.division;\n const groups = schedule.groups ?? [];\n const teachers = schedule.teachers ?? [];\n const locations = schedule.locations ?? [];\n const events = schedule.events ?? [];\n const lockedTimes = schedule.lockedTimes ?? [];\n const courses = schedule.courses ?? [];\n const periods = schedule.periods ?? [];\n const persons = schedule.persons ?? [];\n\n\n ////\n //// replace empty/null intervals with undefined\n ////\n [groups, teachers, locations, courses, events, lockedTimes].forEach(entities => {\n entities.forEach(entity => {\n if (entity.intervals && entity.intervals.length == 0) entity.intervals = undefined;\n else if (entity.intervals === null ) entity.intervals = undefined;\n });\n });\n\n\n const { map: periodsMap, matrix: periodsMatrix } = parsePeriods(periods, division, options);\n\n const data: Types.scheduleData = {\n settings: parseSettings(settings),\n default: parseDefault (settings, periodsMap, options),\n\n periods: periodsMatrix?.length ? periodsMatrix : undefined, // cannot be empty string\n\n intervals: options.oldFormat ? undefined : extractUniqueIntervals(settings, groups, teachers, courses, events, lockedTimes, options),\n\n dependencies: fromLocations(locations, settings, options),\n\n groups: fromGroups(groups, settings, options)\n .concat(fromTeachers(teachers, settings, options)),\n\n individuals: options.oldFormat ? undefined : extractUniqueIndividuals(persons, courses, events, lockedTimes, options),\n\n events: new Array<Types.collection | Types.collection[] | Types.event[]>()\n .concat(fromCollections(courses, settings, options, periodsMap))\n .concat(fromDynamicLockedTimes(lockedTimes, settings, options)),\n };\n\n return data;\n};"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,WACd,UACA,UAAkC,IACd;CAEpB,MAAM,WAAgB,SAAS;CAC/B,MAAM,WAAgB,SAAS;CAC/B,MAAM,SAAgB,SAAS,UAAiB;CAChD,MAAM,WAAgB,SAAS,YAAiB;CAChD,MAAM,YAAgB,SAAS,aAAiB;CAChD,MAAM,SAAgB,SAAS,UAAiB;CAChD,MAAM,cAAgB,SAAS,eAAiB;CAChD,MAAM,UAAgB,SAAS,WAAiB;CAChD,MAAM,UAAgB,SAAS,WAAiB;CAChD,MAAM,UAAgB,SAAS,WAAiB;AAMhD;EAAC;EAAQ;EAAU;EAAW;EAAS;EAAQ;GAAa,SAAQ,aAAY;AAC9E,WAAS,SAAQ,WAAU;AACzB,OAAS,OAAO,aAAa,OAAO,UAAU,UAAU,EAAG,QAAO,YAAY;YACrE,OAAO,cAAc,KAA6B,QAAO,YAAY;;;CAKlF,MAAM,EAAE,KAAK,YAAY,QAAQ,kBAAkB,aAAa,SAAS,UAAU;CAEnF,MAAMA,OAA2B;EAC/B,UAAU,cAAc;EACxB,SAAU,aAAc,UAAU,YAAY;EAE9C,SAAS,eAAe,SAAS,gBAAgB;EAEjD,WAAW,QAAQ,YAAY,SAAY,uBAAuB,UAAU,QAAQ,UAAU,SAAS,QAAQ,aAAa;EAE5H,cAAc,cAAc,WAAW,UAAU;EAEjD,QAAQ,WAAW,QAAQ,UAAU,SAClC,OAAO,aAAa,UAAU,UAAU;EAE3C,aAAa,QAAQ,YAAY,SAAY,yBAAyB,SAAS,SAAS,QAAQ,aAAa;EAE7G,QAAQ,IAAI,QACT,OAAO,gBAAgB,SAAS,UAAU,SAAS,aACnD,OAAO,uBAAuB,aAAa,UAAU;;AAG1D,QAAO"}
1
+ {"version":3,"file":"input.js","names":["data: Types.scheduleData"],"sources":["../../../../src/RS/to/input/input.ts"],"sourcesContent":["import type { Types } from '../../types';\nimport { fromLocations } from './dependencies';\nimport { fromTeachers } from './teachers';\nimport { fromCollections } from './collections';\nimport { parseSettings } from './settings';\nimport { parseDefault } from './default';\nimport { fromDynamicLockedTimes } from './dynamic-locked-times';\nimport { parsePeriods } from './periods';\nimport type { ConnectedScheduleData } from '../../make-connected';\nimport { fromGroups } from './groups';\nimport { extractUniqueIntervals } from './intervals';\nimport { extractUniqueIndividuals } from './individuals';\n\nexport function parseInput (\n schedule: ConnectedScheduleData,\n options: Types.parsedToOptions = {}\n): Types.scheduleData {\n\n const settings = schedule.settings;\n const division = schedule.division;\n const groups = schedule.groups ?? [];\n const teachers = schedule.teachers ?? [];\n const locations = schedule.locations ?? [];\n const events = schedule.events ?? [];\n const lockedTimes = schedule.lockedTimes ?? [];\n const courses = schedule.courses ?? [];\n const periods = schedule.periods ?? [];\n const persons = schedule.persons ?? [];\n\n\n ////\n //// replace empty/null intervals with undefined\n ////\n [groups, teachers, locations, courses, events, lockedTimes].forEach(entities => {\n entities.forEach(entity => {\n if (entity.intervals && entity.intervals.length == 0) entity.intervals = undefined;\n else if (entity.intervals === null ) entity.intervals = undefined;\n });\n });\n\n\n const { map: periodsMap, matrix: periodsMatrix } = parsePeriods(periods, division, options);\n\n const data: Types.scheduleData = {\n settings: parseSettings(settings),\n default: parseDefault (settings, periodsMap, options),\n\n periods: periodsMatrix?.length ? periodsMatrix : undefined, // cannot be empty string\n\n intervals: options.oldFormat ? undefined : extractUniqueIntervals(settings, groups, teachers, courses, events, lockedTimes, options),\n\n dependencies: fromLocations(locations, settings, options),\n\n groups: fromGroups(groups, settings, options)\n .concat(fromTeachers(teachers, settings, options)),\n\n individuals: options.oldFormat ? undefined : extractUniqueIndividuals(persons, courses, events, lockedTimes, options),\n\n events: [\n ...fromCollections(courses, settings, options, periodsMap),\n ...fromDynamicLockedTimes(lockedTimes, settings, options)\n ]\n };\n\n return data;\n};"],"mappings":";;;;;;;;;;;;AAaA,SAAgB,WACd,UACA,UAAkC,IACd;CAEpB,MAAM,WAAgB,SAAS;CAC/B,MAAM,WAAgB,SAAS;CAC/B,MAAM,SAAgB,SAAS,UAAiB;CAChD,MAAM,WAAgB,SAAS,YAAiB;CAChD,MAAM,YAAgB,SAAS,aAAiB;CAChD,MAAM,SAAgB,SAAS,UAAiB;CAChD,MAAM,cAAgB,SAAS,eAAiB;CAChD,MAAM,UAAgB,SAAS,WAAiB;CAChD,MAAM,UAAgB,SAAS,WAAiB;CAChD,MAAM,UAAgB,SAAS,WAAiB;AAMhD;EAAC;EAAQ;EAAU;EAAW;EAAS;EAAQ;GAAa,SAAQ,aAAY;AAC9E,WAAS,SAAQ,WAAU;AACzB,OAAS,OAAO,aAAa,OAAO,UAAU,UAAU,EAAG,QAAO,YAAY;YACrE,OAAO,cAAc,KAA6B,QAAO,YAAY;;;CAKlF,MAAM,EAAE,KAAK,YAAY,QAAQ,kBAAkB,aAAa,SAAS,UAAU;CAEnF,MAAMA,OAA2B;EAC/B,UAAU,cAAc;EACxB,SAAU,aAAc,UAAU,YAAY;EAE9C,SAAS,eAAe,SAAS,gBAAgB;EAEjD,WAAW,QAAQ,YAAY,SAAY,uBAAuB,UAAU,QAAQ,UAAU,SAAS,QAAQ,aAAa;EAE5H,cAAc,cAAc,WAAW,UAAU;EAEjD,QAAQ,WAAW,QAAQ,UAAU,SAClC,OAAO,aAAa,UAAU,UAAU;EAE3C,aAAa,QAAQ,YAAY,SAAY,yBAAyB,SAAS,SAAS,QAAQ,aAAa;EAE7G,QAAQ,CACN,GAAG,gBAAgB,SAAS,UAAU,SAAS,aAC/C,GAAG,uBAAuB,aAAa,UAAU;;AAIrD,QAAO"}
@@ -1,12 +1,12 @@
1
1
  import { BaseOptions } from "../../../common/types.js";
2
2
  import { Types } from "../../../core/types/index.js";
3
- import * as xlsx1 from "xlsx";
3
+ import * as xlsx0 from "xlsx";
4
4
 
5
5
  //#region src/SchoolSoft/file/to/index.d.ts
6
6
  declare class export_default {
7
7
  static schedules: (schedule: Types.mixed.schedule & {
8
8
  division?: Types.mixed.division;
9
- }, options?: BaseOptions) => xlsx1.WorkBook;
9
+ }, options?: BaseOptions) => xlsx0.WorkBook;
10
10
  }
11
11
  //#endregion
12
12
  export { export_default };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@royalschedule/maps",
3
3
  "description": "",
4
- "version": "4.0.5",
4
+ "version": "4.0.7",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",