@royalschedule/maps 4.1.2-beta.0 → 4.1.2
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.
- package/dist/Excel/index.d.ts +21 -19
- package/dist/Excel/v1/index.d.ts +21 -21
- package/dist/Excel/v2/index.d.ts +22 -20
- package/dist/PlanDigital/index.d.ts +13 -13
- package/dist/RS/from/schedules.js +7 -4
- package/dist/RS/from/schedules.js.map +1 -1
- package/dist/RS/to/input/teachers.js +1 -1
- package/dist/RS/to/input/teachers.js.map +1 -1
- package/dist/RS/to/input/util/util.js +43 -1
- package/dist/RS/to/input/util/util.js.map +1 -1
- package/dist/SchoolSoft/api/index.d.ts +38 -38
- package/dist/Skola24/txt/to/schedules.js +1 -1
- package/dist/Skola24/txt/to/schedules.js.map +1 -1
- package/dist/core/interfaces/other/companies.d.ts +1 -0
- package/dist/core/interfaces/other/companies.js.map +1 -1
- package/dist/core/interfaces/vertices/conversations.d.ts +32 -0
- package/dist/core/interfaces/vertices/courses.d.ts +1 -1
- package/dist/core/interfaces/vertices/division-settings.d.ts +1 -0
- package/dist/core/interfaces/vertices/events.d.ts +3 -0
- package/dist/core/interfaces/vertices/index.d.ts +15 -1
- package/dist/core/interfaces/vertices/messages.d.ts +21 -0
- package/dist/core/interfaces/vertices/periods.d.ts +1 -0
- package/dist/core/interfaces/vertices/syllabuses.d.ts +2 -0
- package/dist/core/interfaces/vertices/util/vertex.d.ts +1 -1
- package/dist/core/interfaces/vertices/vertex-query.d.ts +7 -1
- package/dist/core/interfaces/vertices/vertex-query.js +8 -0
- package/dist/core/interfaces/vertices/vertex-query.js.map +1 -1
- package/dist/core/types/index.d.ts +5 -0
- package/package.json +1 -1
package/dist/Excel/index.d.ts
CHANGED
|
@@ -52,16 +52,16 @@ declare class ExcelMap {
|
|
|
52
52
|
lastModifiedBy?: string | undefined;
|
|
53
53
|
tags?: Tag[] | undefined;
|
|
54
54
|
minBreakLength?: number | undefined;
|
|
55
|
-
intervals?: Interval[] | undefined;
|
|
56
|
-
days?: Day[] | undefined;
|
|
57
|
-
weight?: number | undefined;
|
|
58
|
-
signature?: string | undefined;
|
|
59
55
|
maxNumWorkingHours?: number | false | undefined;
|
|
60
56
|
maxNumDailyWorkingHours?: number | number[] | false | undefined;
|
|
61
|
-
plannedScheduledDuration?: PlannedScheduledDuration | undefined;
|
|
62
57
|
maximumScheduleSpan?: MaximumScheduleSpan | undefined;
|
|
63
58
|
forbidOverlappingEvents?: boolean | undefined;
|
|
64
59
|
disableDayLengthPunishment?: boolean | undefined;
|
|
60
|
+
weight?: number | undefined;
|
|
61
|
+
intervals?: Interval[] | undefined;
|
|
62
|
+
days?: Day[] | undefined;
|
|
63
|
+
signature?: string | undefined;
|
|
64
|
+
plannedScheduledDuration?: PlannedScheduledDuration | undefined;
|
|
65
65
|
belongsTo?: string | undefined;
|
|
66
66
|
rootInterval?: string | undefined;
|
|
67
67
|
lockedTimes?: string[] | undefined;
|
|
@@ -81,8 +81,8 @@ declare class ExcelMap {
|
|
|
81
81
|
createdAt?: string | undefined;
|
|
82
82
|
updatedAt?: string | undefined;
|
|
83
83
|
lastModifiedBy?: string | undefined;
|
|
84
|
-
tags?: Tag[] | undefined;
|
|
85
84
|
type?: "Student" | "Teacher" | "Other" | undefined;
|
|
85
|
+
tags?: Tag[] | undefined;
|
|
86
86
|
lastName?: string | undefined;
|
|
87
87
|
firstName?: string | undefined;
|
|
88
88
|
birthDate?: Date | undefined;
|
|
@@ -115,15 +115,15 @@ declare class ExcelMap {
|
|
|
115
115
|
lastModifiedBy?: string | undefined;
|
|
116
116
|
tags?: Tag[] | undefined;
|
|
117
117
|
minBreakLength?: number | undefined;
|
|
118
|
-
intervals?: Interval[] | undefined;
|
|
119
|
-
days?: Day[] | undefined;
|
|
120
|
-
weight?: number | undefined;
|
|
121
118
|
maxNumWorkingHours?: number | false | undefined;
|
|
122
119
|
maxNumDailyWorkingHours?: number | number[] | false | undefined;
|
|
123
120
|
maximumScheduleSpan?: MaximumScheduleSpan | undefined;
|
|
124
121
|
forbidOverlappingEvents?: boolean | undefined;
|
|
125
122
|
disableDayLengthPunishment?: boolean | undefined;
|
|
123
|
+
weight?: number | undefined;
|
|
126
124
|
species?: "class" | undefined;
|
|
125
|
+
intervals?: Interval[] | undefined;
|
|
126
|
+
days?: Day[] | undefined;
|
|
127
127
|
belongsTo?: string | undefined;
|
|
128
128
|
parentGroups?: string[] | undefined;
|
|
129
129
|
subGroups?: string[] | undefined;
|
|
@@ -149,17 +149,17 @@ declare class ExcelMap {
|
|
|
149
149
|
createdAt?: string | undefined;
|
|
150
150
|
updatedAt?: string | undefined;
|
|
151
151
|
lastModifiedBy?: string | undefined;
|
|
152
|
+
type?: string | undefined;
|
|
152
153
|
tags?: Tag[] | undefined;
|
|
153
|
-
subject?: string | undefined;
|
|
154
|
-
color?: string | undefined;
|
|
155
154
|
minBreakLength?: MinBreakLength | undefined;
|
|
155
|
+
weight?: number | undefined;
|
|
156
156
|
intervals?: Interval[] | undefined;
|
|
157
157
|
days?: Day[] | undefined;
|
|
158
|
+
subject?: string | undefined;
|
|
159
|
+
color?: string | undefined;
|
|
158
160
|
eventDurationVariance?: number | undefined;
|
|
159
161
|
centerOfAttraction?: string | null | undefined;
|
|
160
162
|
density?: number | undefined;
|
|
161
|
-
weight?: number | undefined;
|
|
162
|
-
type?: string | undefined;
|
|
163
163
|
plannedDuration?: string | undefined;
|
|
164
164
|
minutesPerWeek?: number | undefined;
|
|
165
165
|
expectedTotalHours?: number | undefined;
|
|
@@ -200,24 +200,24 @@ declare class ExcelMap {
|
|
|
200
200
|
createdAt?: string | undefined;
|
|
201
201
|
updatedAt?: string | undefined;
|
|
202
202
|
lastModifiedBy?: string | undefined;
|
|
203
|
+
start?: (moment0.Moment | string) | undefined;
|
|
204
|
+
end?: (moment0.Moment | string) | undefined;
|
|
205
|
+
potentialCenter?: string | undefined;
|
|
206
|
+
type?: string | undefined;
|
|
203
207
|
tags?: Tag[] | undefined;
|
|
204
|
-
color?: string | null | undefined;
|
|
205
208
|
minBreakLength?: (MinBreakLength | null) | undefined;
|
|
209
|
+
weight?: number | undefined;
|
|
206
210
|
intervals?: Interval[] | null | undefined;
|
|
207
211
|
days?: Day[] | null | undefined;
|
|
212
|
+
color?: string | null | undefined;
|
|
208
213
|
centerOfAttraction?: string | null | undefined;
|
|
209
214
|
density?: number | undefined;
|
|
210
|
-
weight?: number | undefined;
|
|
211
|
-
type?: string | undefined;
|
|
212
215
|
fixedStart?: boolean | undefined;
|
|
213
216
|
visible?: boolean | undefined;
|
|
214
|
-
potentialCenter?: string | undefined;
|
|
215
217
|
parked?: boolean | undefined;
|
|
216
218
|
preferredDuration: number;
|
|
217
219
|
durationVariance?: number | undefined;
|
|
218
220
|
duration?: number | undefined;
|
|
219
|
-
start?: (moment0.Moment | string) | undefined;
|
|
220
|
-
end?: (moment0.Moment | string) | undefined;
|
|
221
221
|
weeks?: number[] | undefined;
|
|
222
222
|
belongsTo?: string | undefined;
|
|
223
223
|
course?: string | undefined;
|
|
@@ -278,9 +278,11 @@ declare class ExcelMap {
|
|
|
278
278
|
createdAt?: string | undefined;
|
|
279
279
|
updatedAt?: string | undefined;
|
|
280
280
|
lastModifiedBy?: string | undefined;
|
|
281
|
+
color?: string | null | undefined;
|
|
281
282
|
schoolType: string;
|
|
282
283
|
subjectCode?: string | undefined;
|
|
283
284
|
subjectName: string;
|
|
285
|
+
icon?: string | null | undefined;
|
|
284
286
|
subjectDesignation?: string | undefined;
|
|
285
287
|
courseCode?: string | undefined;
|
|
286
288
|
courseName?: string | undefined;
|
package/dist/Excel/v1/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { MaximumScheduleSpan } from "../../core/interfaces/vertices/properties/m
|
|
|
6
6
|
import { PlannedScheduledDuration } from "../../core/interfaces/vertices/properties/planned-scheduled-duration.js";
|
|
7
7
|
import { MinBreakLength } from "../../core/interfaces/vertices/properties/min-break-length.js";
|
|
8
8
|
import { Types } from "./types/index.js";
|
|
9
|
-
import * as
|
|
9
|
+
import * as moment5 from "moment";
|
|
10
10
|
|
|
11
11
|
//#region src/Excel/v1/index.d.ts
|
|
12
12
|
declare class Map {
|
|
@@ -50,17 +50,17 @@ declare class Map {
|
|
|
50
50
|
belongsTo?: string | undefined;
|
|
51
51
|
tags?: Tag[] | undefined;
|
|
52
52
|
minBreakLength?: number | undefined;
|
|
53
|
-
intervals?: Interval[] | undefined;
|
|
54
|
-
days?: Day[] | undefined;
|
|
55
|
-
weight?: number | undefined;
|
|
56
|
-
signature?: string | undefined;
|
|
57
53
|
maxNumWorkingHours?: number | false | undefined;
|
|
58
54
|
maxNumDailyWorkingHours?: number | number[] | false | undefined;
|
|
59
|
-
plannedScheduledDuration?: PlannedScheduledDuration | undefined;
|
|
60
55
|
maximumScheduleSpan?: MaximumScheduleSpan | undefined;
|
|
61
56
|
forbidOverlappingEvents?: boolean | undefined;
|
|
62
57
|
disableDayLengthPunishment?: boolean | undefined;
|
|
58
|
+
weight?: number | undefined;
|
|
59
|
+
intervals?: Interval[] | undefined;
|
|
60
|
+
days?: Day[] | undefined;
|
|
63
61
|
lunch?: string[] | undefined;
|
|
62
|
+
signature?: string | undefined;
|
|
63
|
+
plannedScheduledDuration?: PlannedScheduledDuration | undefined;
|
|
64
64
|
complementaryTimes?: string[] | undefined;
|
|
65
65
|
}[];
|
|
66
66
|
persons: {
|
|
@@ -73,8 +73,8 @@ declare class Map {
|
|
|
73
73
|
lastModifiedBy?: string | undefined;
|
|
74
74
|
group?: string | undefined;
|
|
75
75
|
belongsTo?: string | undefined;
|
|
76
|
-
tags?: Tag[] | undefined;
|
|
77
76
|
type?: "Student" | "Teacher" | "Other" | undefined;
|
|
77
|
+
tags?: Tag[] | undefined;
|
|
78
78
|
lastName?: string | undefined;
|
|
79
79
|
firstName?: string | undefined;
|
|
80
80
|
birthDate?: Date | undefined;
|
|
@@ -106,18 +106,18 @@ declare class Map {
|
|
|
106
106
|
belongsTo?: string | undefined;
|
|
107
107
|
tags?: Tag[] | undefined;
|
|
108
108
|
minBreakLength?: number | undefined;
|
|
109
|
-
intervals?: Interval[] | undefined;
|
|
110
|
-
days?: Day[] | undefined;
|
|
111
|
-
weight?: number | undefined;
|
|
112
109
|
maxNumWorkingHours?: number | false | undefined;
|
|
113
110
|
maxNumDailyWorkingHours?: number | number[] | false | undefined;
|
|
114
111
|
maximumScheduleSpan?: MaximumScheduleSpan | undefined;
|
|
115
112
|
forbidOverlappingEvents?: boolean | undefined;
|
|
116
113
|
disableDayLengthPunishment?: boolean | undefined;
|
|
117
|
-
|
|
114
|
+
weight?: number | undefined;
|
|
118
115
|
species?: "class" | undefined;
|
|
116
|
+
intervals?: Interval[] | undefined;
|
|
117
|
+
days?: Day[] | undefined;
|
|
119
118
|
parentGroups?: string[] | undefined;
|
|
120
119
|
subGroups?: string[] | undefined;
|
|
120
|
+
lunch?: string[] | undefined;
|
|
121
121
|
members?: string[] | undefined;
|
|
122
122
|
derivedParentGroups?: {
|
|
123
123
|
implicit?: boolean | undefined;
|
|
@@ -154,17 +154,17 @@ declare class Map {
|
|
|
154
154
|
period?: string | undefined;
|
|
155
155
|
syllabus?: string | undefined;
|
|
156
156
|
belongsTo?: string | undefined;
|
|
157
|
+
type?: string | undefined;
|
|
157
158
|
tags?: Tag[] | undefined;
|
|
158
|
-
subject?: string | undefined;
|
|
159
|
-
color?: string | undefined;
|
|
160
159
|
minBreakLength?: MinBreakLength | undefined;
|
|
160
|
+
weight?: number | undefined;
|
|
161
161
|
intervals?: Interval[] | undefined;
|
|
162
162
|
days?: Day[] | undefined;
|
|
163
|
+
subject?: string | undefined;
|
|
164
|
+
color?: string | undefined;
|
|
163
165
|
eventDurationVariance?: number | undefined;
|
|
164
166
|
centerOfAttraction?: string | null | undefined;
|
|
165
167
|
density?: number | undefined;
|
|
166
|
-
weight?: number | undefined;
|
|
167
|
-
type?: string | undefined;
|
|
168
168
|
plannedDuration?: string | undefined;
|
|
169
169
|
minutesPerWeek?: number | undefined;
|
|
170
170
|
expectedTotalHours?: number | undefined;
|
|
@@ -201,29 +201,29 @@ declare class Map {
|
|
|
201
201
|
course?: string | undefined;
|
|
202
202
|
linkedEventsSet?: string | undefined;
|
|
203
203
|
period?: string | undefined;
|
|
204
|
+
start?: (moment5.Moment | string) | undefined;
|
|
205
|
+
end?: (moment5.Moment | string) | undefined;
|
|
204
206
|
belongsTo?: string | undefined;
|
|
207
|
+
potentialCenter?: string | undefined;
|
|
208
|
+
type?: string | undefined;
|
|
205
209
|
tags?: Tag[] | undefined;
|
|
206
|
-
color?: string | null | undefined;
|
|
207
210
|
minBreakLength?: (MinBreakLength | null) | undefined;
|
|
211
|
+
weight?: number | undefined;
|
|
208
212
|
intervals?: Interval[] | null | undefined;
|
|
209
213
|
days?: Day[] | null | undefined;
|
|
214
|
+
color?: string | null | undefined;
|
|
210
215
|
centerOfAttraction?: string | null | undefined;
|
|
211
216
|
density?: number | undefined;
|
|
212
|
-
weight?: number | undefined;
|
|
213
|
-
type?: string | undefined;
|
|
214
217
|
participants?: {
|
|
215
218
|
groupIndex?: number | undefined;
|
|
216
219
|
to: string;
|
|
217
220
|
}[] | undefined;
|
|
218
221
|
fixedStart?: boolean | undefined;
|
|
219
222
|
visible?: boolean | undefined;
|
|
220
|
-
potentialCenter?: string | undefined;
|
|
221
223
|
parked?: boolean | undefined;
|
|
222
224
|
preferredDuration: number;
|
|
223
225
|
durationVariance?: number | undefined;
|
|
224
226
|
duration?: number | undefined;
|
|
225
|
-
start?: (moment7.Moment | string) | undefined;
|
|
226
|
-
end?: (moment7.Moment | string) | undefined;
|
|
227
227
|
weeks?: number[] | undefined;
|
|
228
228
|
overlapSpecies?: string | undefined;
|
|
229
229
|
inLocations?: (string | null)[] | undefined;
|
package/dist/Excel/v2/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { MaximumScheduleSpan } from "../../core/interfaces/vertices/properties/m
|
|
|
6
6
|
import { PlannedScheduledDuration } from "../../core/interfaces/vertices/properties/planned-scheduled-duration.js";
|
|
7
7
|
import { MinBreakLength } from "../../core/interfaces/vertices/properties/min-break-length.js";
|
|
8
8
|
import { Types } from "./types/index.js";
|
|
9
|
-
import * as
|
|
9
|
+
import * as moment7 from "moment";
|
|
10
10
|
|
|
11
11
|
//#region src/Excel/v2/index.d.ts
|
|
12
12
|
declare class Map {
|
|
@@ -49,16 +49,16 @@ declare class Map {
|
|
|
49
49
|
lastModifiedBy?: string | undefined;
|
|
50
50
|
tags?: Tag[] | undefined;
|
|
51
51
|
minBreakLength?: number | undefined;
|
|
52
|
-
intervals?: Interval[] | undefined;
|
|
53
|
-
days?: Day[] | undefined;
|
|
54
|
-
weight?: number | undefined;
|
|
55
|
-
signature?: string | undefined;
|
|
56
52
|
maxNumWorkingHours?: number | false | undefined;
|
|
57
53
|
maxNumDailyWorkingHours?: number | number[] | false | undefined;
|
|
58
|
-
plannedScheduledDuration?: PlannedScheduledDuration | undefined;
|
|
59
54
|
maximumScheduleSpan?: MaximumScheduleSpan | undefined;
|
|
60
55
|
forbidOverlappingEvents?: boolean | undefined;
|
|
61
56
|
disableDayLengthPunishment?: boolean | undefined;
|
|
57
|
+
weight?: number | undefined;
|
|
58
|
+
intervals?: Interval[] | undefined;
|
|
59
|
+
days?: Day[] | undefined;
|
|
60
|
+
signature?: string | undefined;
|
|
61
|
+
plannedScheduledDuration?: PlannedScheduledDuration | undefined;
|
|
62
62
|
belongsTo?: string | undefined;
|
|
63
63
|
rootInterval?: string | undefined;
|
|
64
64
|
lockedTimes?: string[] | undefined;
|
|
@@ -78,8 +78,8 @@ declare class Map {
|
|
|
78
78
|
createdAt?: string | undefined;
|
|
79
79
|
updatedAt?: string | undefined;
|
|
80
80
|
lastModifiedBy?: string | undefined;
|
|
81
|
-
tags?: Tag[] | undefined;
|
|
82
81
|
type?: "Student" | "Teacher" | "Other" | undefined;
|
|
82
|
+
tags?: Tag[] | undefined;
|
|
83
83
|
lastName?: string | undefined;
|
|
84
84
|
firstName?: string | undefined;
|
|
85
85
|
birthDate?: Date | undefined;
|
|
@@ -112,15 +112,15 @@ declare class Map {
|
|
|
112
112
|
lastModifiedBy?: string | undefined;
|
|
113
113
|
tags?: Tag[] | undefined;
|
|
114
114
|
minBreakLength?: number | undefined;
|
|
115
|
-
intervals?: Interval[] | undefined;
|
|
116
|
-
days?: Day[] | undefined;
|
|
117
|
-
weight?: number | undefined;
|
|
118
115
|
maxNumWorkingHours?: number | false | undefined;
|
|
119
116
|
maxNumDailyWorkingHours?: number | number[] | false | undefined;
|
|
120
117
|
maximumScheduleSpan?: MaximumScheduleSpan | undefined;
|
|
121
118
|
forbidOverlappingEvents?: boolean | undefined;
|
|
122
119
|
disableDayLengthPunishment?: boolean | undefined;
|
|
120
|
+
weight?: number | undefined;
|
|
123
121
|
species?: "class" | undefined;
|
|
122
|
+
intervals?: Interval[] | undefined;
|
|
123
|
+
days?: Day[] | undefined;
|
|
124
124
|
belongsTo?: string | undefined;
|
|
125
125
|
parentGroups?: string[] | undefined;
|
|
126
126
|
subGroups?: string[] | undefined;
|
|
@@ -146,17 +146,17 @@ declare class Map {
|
|
|
146
146
|
createdAt?: string | undefined;
|
|
147
147
|
updatedAt?: string | undefined;
|
|
148
148
|
lastModifiedBy?: string | undefined;
|
|
149
|
+
type?: string | undefined;
|
|
149
150
|
tags?: Tag[] | undefined;
|
|
150
|
-
subject?: string | undefined;
|
|
151
|
-
color?: string | undefined;
|
|
152
151
|
minBreakLength?: MinBreakLength | undefined;
|
|
152
|
+
weight?: number | undefined;
|
|
153
153
|
intervals?: Interval[] | undefined;
|
|
154
154
|
days?: Day[] | undefined;
|
|
155
|
+
subject?: string | undefined;
|
|
156
|
+
color?: string | undefined;
|
|
155
157
|
eventDurationVariance?: number | undefined;
|
|
156
158
|
centerOfAttraction?: string | null | undefined;
|
|
157
159
|
density?: number | undefined;
|
|
158
|
-
weight?: number | undefined;
|
|
159
|
-
type?: string | undefined;
|
|
160
160
|
plannedDuration?: string | undefined;
|
|
161
161
|
minutesPerWeek?: number | undefined;
|
|
162
162
|
expectedTotalHours?: number | undefined;
|
|
@@ -197,24 +197,24 @@ declare class Map {
|
|
|
197
197
|
createdAt?: string | undefined;
|
|
198
198
|
updatedAt?: string | undefined;
|
|
199
199
|
lastModifiedBy?: string | undefined;
|
|
200
|
+
start?: (moment7.Moment | string) | undefined;
|
|
201
|
+
end?: (moment7.Moment | string) | undefined;
|
|
202
|
+
potentialCenter?: string | undefined;
|
|
203
|
+
type?: string | undefined;
|
|
200
204
|
tags?: Tag[] | undefined;
|
|
201
|
-
color?: string | null | undefined;
|
|
202
205
|
minBreakLength?: (MinBreakLength | null) | undefined;
|
|
206
|
+
weight?: number | undefined;
|
|
203
207
|
intervals?: Interval[] | null | undefined;
|
|
204
208
|
days?: Day[] | null | undefined;
|
|
209
|
+
color?: string | null | undefined;
|
|
205
210
|
centerOfAttraction?: string | null | undefined;
|
|
206
211
|
density?: number | undefined;
|
|
207
|
-
weight?: number | undefined;
|
|
208
|
-
type?: string | undefined;
|
|
209
212
|
fixedStart?: boolean | undefined;
|
|
210
213
|
visible?: boolean | undefined;
|
|
211
|
-
potentialCenter?: string | undefined;
|
|
212
214
|
parked?: boolean | undefined;
|
|
213
215
|
preferredDuration: number;
|
|
214
216
|
durationVariance?: number | undefined;
|
|
215
217
|
duration?: number | undefined;
|
|
216
|
-
start?: (moment5.Moment | string) | undefined;
|
|
217
|
-
end?: (moment5.Moment | string) | undefined;
|
|
218
218
|
weeks?: number[] | undefined;
|
|
219
219
|
belongsTo?: string | undefined;
|
|
220
220
|
course?: string | undefined;
|
|
@@ -275,9 +275,11 @@ declare class Map {
|
|
|
275
275
|
createdAt?: string | undefined;
|
|
276
276
|
updatedAt?: string | undefined;
|
|
277
277
|
lastModifiedBy?: string | undefined;
|
|
278
|
+
color?: string | null | undefined;
|
|
278
279
|
schoolType: string;
|
|
279
280
|
subjectCode?: string | undefined;
|
|
280
281
|
subjectName: string;
|
|
282
|
+
icon?: string | null | undefined;
|
|
281
283
|
subjectDesignation?: string | undefined;
|
|
282
284
|
courseCode?: string | undefined;
|
|
283
285
|
courseName?: string | undefined;
|
|
@@ -23,18 +23,18 @@ declare class PlanDigitalMap {
|
|
|
23
23
|
belongsTo?: string | undefined;
|
|
24
24
|
tags?: Tag[] | undefined;
|
|
25
25
|
minBreakLength?: number | undefined;
|
|
26
|
-
intervals?: Interval[] | undefined;
|
|
27
|
-
days?: Day[] | undefined;
|
|
28
|
-
weight?: number | undefined;
|
|
29
26
|
maxNumWorkingHours?: number | false | undefined;
|
|
30
27
|
maxNumDailyWorkingHours?: number | number[] | false | undefined;
|
|
31
28
|
maximumScheduleSpan?: MaximumScheduleSpan | undefined;
|
|
32
29
|
forbidOverlappingEvents?: boolean | undefined;
|
|
33
30
|
disableDayLengthPunishment?: boolean | undefined;
|
|
34
|
-
|
|
31
|
+
weight?: number | undefined;
|
|
35
32
|
species?: "class" | undefined;
|
|
33
|
+
intervals?: Interval[] | undefined;
|
|
34
|
+
days?: Day[] | undefined;
|
|
36
35
|
parentGroups?: string[] | undefined;
|
|
37
36
|
subGroups?: string[] | undefined;
|
|
37
|
+
lunch?: string[] | undefined;
|
|
38
38
|
members?: string[] | undefined;
|
|
39
39
|
derivedParentGroups?: {
|
|
40
40
|
implicit?: boolean | undefined;
|
|
@@ -56,17 +56,17 @@ declare class PlanDigitalMap {
|
|
|
56
56
|
belongsTo?: string | undefined;
|
|
57
57
|
tags?: Tag[] | undefined;
|
|
58
58
|
minBreakLength?: number | undefined;
|
|
59
|
-
intervals?: Interval[] | undefined;
|
|
60
|
-
days?: Day[] | undefined;
|
|
61
|
-
weight?: number | undefined;
|
|
62
|
-
signature?: string | undefined;
|
|
63
59
|
maxNumWorkingHours?: number | false | undefined;
|
|
64
60
|
maxNumDailyWorkingHours?: number | number[] | false | undefined;
|
|
65
|
-
plannedScheduledDuration?: PlannedScheduledDuration | undefined;
|
|
66
61
|
maximumScheduleSpan?: MaximumScheduleSpan | undefined;
|
|
67
62
|
forbidOverlappingEvents?: boolean | undefined;
|
|
68
63
|
disableDayLengthPunishment?: boolean | undefined;
|
|
64
|
+
weight?: number | undefined;
|
|
65
|
+
intervals?: Interval[] | undefined;
|
|
66
|
+
days?: Day[] | undefined;
|
|
69
67
|
lunch?: string[] | undefined;
|
|
68
|
+
signature?: string | undefined;
|
|
69
|
+
plannedScheduledDuration?: PlannedScheduledDuration | undefined;
|
|
70
70
|
complementaryTimes?: string[] | undefined;
|
|
71
71
|
}[];
|
|
72
72
|
courses?: {
|
|
@@ -97,17 +97,17 @@ declare class PlanDigitalMap {
|
|
|
97
97
|
period?: string | undefined;
|
|
98
98
|
syllabus?: string | undefined;
|
|
99
99
|
belongsTo?: string | undefined;
|
|
100
|
+
type?: string | undefined;
|
|
100
101
|
tags?: Tag[] | undefined;
|
|
101
|
-
subject?: string | undefined;
|
|
102
|
-
color?: string | undefined;
|
|
103
102
|
minBreakLength?: MinBreakLength | undefined;
|
|
103
|
+
weight?: number | undefined;
|
|
104
104
|
intervals?: Interval[] | undefined;
|
|
105
105
|
days?: Day[] | undefined;
|
|
106
|
+
subject?: string | undefined;
|
|
107
|
+
color?: string | undefined;
|
|
106
108
|
eventDurationVariance?: number | undefined;
|
|
107
109
|
centerOfAttraction?: string | null | undefined;
|
|
108
110
|
density?: number | undefined;
|
|
109
|
-
weight?: number | undefined;
|
|
110
|
-
type?: string | undefined;
|
|
111
111
|
plannedDuration?: string | undefined;
|
|
112
112
|
minutesPerWeek?: number | undefined;
|
|
113
113
|
expectedTotalHours?: number | undefined;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getVertexId } from "../../core/util.js";
|
|
2
|
-
import {
|
|
2
|
+
import { fromId } from "../to/input/util/util.js";
|
|
3
3
|
import moment from "moment";
|
|
4
4
|
|
|
5
5
|
//#region src/RS/from/schedules.ts
|
|
@@ -12,9 +12,12 @@ function schedules(input, options = {}) {
|
|
|
12
12
|
if (!eventConfigurations) throw new Error("Missing `output.events` in input.");
|
|
13
13
|
const eventsToUpdate = new Set(schedule.events?.map((x) => getVertexId(x, options)));
|
|
14
14
|
eventConfigurations.forEach(({ id: collectionAndId,...placement }) => {
|
|
15
|
-
const collection =
|
|
16
|
-
const
|
|
17
|
-
|
|
15
|
+
const { collection, entityId: id } = fromId.aggregate(collectionAndId);
|
|
16
|
+
const event = (() => {
|
|
17
|
+
if (collection == "events") return schedule.events?.find((x) => getVertexId(x, options) == id);
|
|
18
|
+
if (collection == "lockedTimes") return schedule.lockedTimes?.find((x) => getVertexId(x, options) == id);
|
|
19
|
+
throw new Error(`Unknown collection "${collection}" in id "${collectionAndId}"`);
|
|
20
|
+
})();
|
|
18
21
|
if (!event) {
|
|
19
22
|
warnings.push(`Could not find ${id} (${collectionAndId}) in ${collection} collection.`);
|
|
20
23
|
return;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schedules.js","names":["warnings: string[]"],"sources":["../../../src/RS/from/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport type { Types } from '../types';\nimport {
|
|
1
|
+
{"version":3,"file":"schedules.js","names":["warnings: string[]"],"sources":["../../../src/RS/from/schedules.ts"],"sourcesContent":["import moment from 'moment';\nimport type { Types } from '../types';\nimport { fromId } from '../to/input/util/util';\nimport { getVertexId } from '../../core/util';\nimport type { CoreTypes } from '../../core';\n\nexport function schedules (\n input: Partial<Types.toOutput>,\n options: Pick<Types.toOptions, 'idKey'> = {}\n): Partial<CoreTypes.SerializedWithOptionalId.Schedule> {\n // set default idKey if not provided\n if (!options.idKey) options.idKey = 'id';\n\n const warnings: string[] = [];\n\n const schedule = input.coreData;\n const eventConfigurations = input.output?.at(0)?.events;\n\n if (!schedule ) throw new Error('Missing `coreData` in input.');\n if (!eventConfigurations) throw new Error('Missing `output.events` in input.');\n\n // check on later to ensure that all events are updated\n const eventsToUpdate = new Set(schedule.events?.map(x => getVertexId(x, options)));\n\n eventConfigurations.forEach(({ id: collectionAndId, ...placement }) => {\n // locate the corresponding event/locked time\n const { collection, entityId: id } = fromId.aggregate(collectionAndId);\n const event = (() => {\n if (collection == 'events') {\n return schedule.events?.find(x => getVertexId(x, options) == id);\n }\n if (collection == 'lockedTimes') {\n return schedule.lockedTimes?.find(x => getVertexId(x, options) == id);\n }\n throw new Error(`Unknown collection \"${collection}\" in id \"${collectionAndId}\"`);\n })();\n\n\n if (!event) {\n warnings.push(`Could not find ${id} (${collectionAndId}) in ${collection} collection.`);\n return;\n }\n\n event.parked = false;\n event.start = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.start, 'minutes').toISOString();\n event.end = moment.utc('1970-01-05T00:00').add(placement.day, 'days').add(placement.end, 'minutes').toISOString();\n event.duration = placement.end - placement.start;\n\n if (collection == 'events') {\n (event as CoreTypes.Serialized.Event).inLocations = placement.dependencies?.filter(Boolean) ?? [];\n\n // remove from events to be updates\n eventsToUpdate.delete(id);\n }\n });\n\n // check if there are events that were not updated\n if (eventsToUpdate.size) {\n warnings.push(`The following events were not updated: ${[...eventsToUpdate].join(', ')}`);\n }\n\n\n return Object.assign(schedule, {\n meta: {\n ...warnings.length && { warnings: warnings }\n }\n });\n};"],"mappings":";;;;;AAMA,SAAgB,UACd,OACA,UAA0C,IACY;AAEtD,KAAI,CAAC,QAAQ,MAAO,SAAQ,QAAQ;CAEpC,MAAMA,WAAqB;CAE3B,MAAM,WAAsB,MAAM;CAClC,MAAM,sBAAsB,MAAM,QAAQ,GAAG,IAAI;AAEjD,KAAI,CAAC,SAAqB,OAAM,IAAI,MAAM;AAC1C,KAAI,CAAC,oBAAqB,OAAM,IAAI,MAAM;CAG1C,MAAM,iBAAiB,IAAI,IAAI,SAAS,QAAQ,KAAI,MAAK,YAAY,GAAG;AAExE,qBAAoB,SAAS,EAAE,IAAI,gBAAiB,GAAG,gBAAgB;EAErE,MAAM,EAAE,YAAY,UAAU,OAAO,OAAO,UAAU;EACtD,MAAM,eAAe;AACnB,OAAI,cAAc,SAChB,QAAO,SAAS,QAAQ,MAAK,MAAK,YAAY,GAAG,YAAY;AAE/D,OAAI,cAAc,cAChB,QAAO,SAAS,aAAa,MAAK,MAAK,YAAY,GAAG,YAAY;AAEpE,SAAM,IAAI,MAAM,uBAAuB,WAAW,WAAW,gBAAgB;;AAI/E,MAAI,CAAC,OAAO;AACV,YAAS,KAAK,kBAAkB,GAAG,IAAI,gBAAgB,OAAO,WAAW;AACzE;;AAGF,QAAM,SAAW;AACjB,QAAM,QAAW,OAAO,IAAI,oBAAoB,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,OAAO,WAAW;AAC3G,QAAM,MAAW,OAAO,IAAI,oBAAoB,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAO,WAAW;AAC3G,QAAM,WAAW,UAAU,MAAM,UAAU;AAE3C,MAAI,cAAc,UAAU;AAC1B,GAAC,MAAqC,cAAc,UAAU,cAAc,OAAO,YAAY;AAG/F,kBAAe,OAAO;;;AAK1B,KAAI,eAAe,KACjB,UAAS,KAAK,0CAA0C,CAAC,GAAG,gBAAgB,KAAK;AAInF,QAAO,OAAO,OAAO,UAAU,EAC7B,MAAM,EACJ,GAAG,SAAS,UAAU,EAAY"}
|
|
@@ -13,7 +13,7 @@ function fromTeachers(teachers, settings, options) {
|
|
|
13
13
|
const doc = {
|
|
14
14
|
id: idOf.teacher(teacher, options),
|
|
15
15
|
group_type: "personal",
|
|
16
|
-
minimizeGaps:
|
|
16
|
+
minimizeGaps: settings.minimizeTeacherGaps,
|
|
17
17
|
minimizeDependencyAlternation: true,
|
|
18
18
|
weight: teacher.weight,
|
|
19
19
|
intervals: idOf.intervalPairReference(intervals, rootInterval, options),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"teachers.js","names":["doc: Types.Entities.Group"],"sources":["../../../../src/RS/to/input/teachers.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { parseDayIndices } from './util/parse-days';\nimport { idOf } from './util/util';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromTeachers (\n teachers: ConnectedTypes.teacher[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.Entities.Group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return teachers\n .map(teacher => {\n const intervals = teacher.intervals ?? defaultInterval;\n const rootInterval = teacher.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.Entities.Group = {\n id: idOf.teacher(teacher, options),\n group_type: 'personal',\n minimizeGaps:
|
|
1
|
+
{"version":3,"file":"teachers.js","names":["doc: Types.Entities.Group"],"sources":["../../../../src/RS/to/input/teachers.ts"],"sourcesContent":["import { omitBy } from 'lodash-es';\nimport type { Types } from '../../types';\nimport type { ConnectedTypes } from '../../make-connected';\nimport { parseMaxWorkingHours } from './util/parse-max-working-hours';\nimport { parseDayIndices } from './util/parse-days';\nimport { idOf } from './util/util';\nimport { getDefaultInterval } from './intervals';\n\nexport function fromTeachers (\n teachers: ConnectedTypes.teacher[],\n settings: ConnectedTypes.divisionSettings,\n options: Types.parsedToOptions\n): Types.Entities.Group[] {\n const defaultInterval = getDefaultInterval(settings);\n\n return teachers\n .map(teacher => {\n const intervals = teacher.intervals ?? defaultInterval;\n const rootInterval = teacher.rootInterval ?? settings.defaultRootInterval;\n\n const doc: Types.Entities.Group = {\n id: idOf.teacher(teacher, options),\n group_type: 'personal',\n minimizeGaps: settings.minimizeTeacherGaps,\n minimizeDependencyAlternation: true,\n weight: teacher.weight,\n intervals: idOf.intervalPairReference(intervals, rootInterval, options),\n days: parseDayIndices(teacher.days, settings),\n blockedTimes: teacher.lockedTimes?.map(x => idOf.lockedTime(x, options)),\n minBreakDuration: teacher.minBreakLength,\n ...parseMaxWorkingHours(teacher),\n };\n\n if (options.includeEntityMeta) {\n doc.name = teacher.displayName;\n }\n\n return omitBy(doc, x => x == null) as Types.Entities.Group;\n });\n};\n"],"mappings":";;;;;;;AAQA,SAAgB,aACd,UACA,UACA,SACwB;CACxB,MAAM,kBAAkB,mBAAmB;AAE3C,QAAO,SACJ,KAAI,YAAW;EACd,MAAM,YAAe,QAAQ,aAAgB;EAC7C,MAAM,eAAe,QAAQ,gBAAgB,SAAS;EAEtD,MAAMA,MAA4B;GAChC,IAA+B,KAAK,QAAQ,SAAS;GACrD,YAA+B;GAC/B,cAA+B,SAAS;GACxC,+BAA+B;GAC/B,QAA+B,QAAQ;GACvC,WAA+B,KAAK,sBAAsB,WAAW,cAAc;GACnF,MAA+B,gBAAgB,QAAQ,MAAM;GAC7D,cAA+B,QAAQ,aAAa,KAAI,MAAK,KAAK,WAAW,GAAG;GAChF,kBAA+B,QAAQ;GACvC,GAAG,qBAAqB;;AAG1B,MAAI,QAAQ,kBACV,KAAI,OAAO,QAAQ;AAGrB,SAAO,OAAO,MAAK,MAAK,KAAK"}
|
|
@@ -18,6 +18,21 @@ const COLLECTION_ID = {
|
|
|
18
18
|
events: "events",
|
|
19
19
|
lockedTimes: "lockedtimes"
|
|
20
20
|
};
|
|
21
|
+
const COLLECTION_BY_ID = Object.fromEntries(Object.entries(COLLECTION_ID).map(([collection, id]) => [id, collection]));
|
|
22
|
+
function parseAggregateId(aggregateId, expectedCollection) {
|
|
23
|
+
const indexOfDot = aggregateId.indexOf(".");
|
|
24
|
+
if (indexOfDot == -1) throw new Error(`(RS::To::fromId) Missing collection separator in aggregate id "${aggregateId}"`);
|
|
25
|
+
const collectionId = aggregateId.substring(0, indexOfDot).toLowerCase();
|
|
26
|
+
const entityId = aggregateId.substring(indexOfDot + 1);
|
|
27
|
+
if (!entityId) throw new Error(`(RS::To::fromId) Missing entity id in aggregate id "${aggregateId}"`);
|
|
28
|
+
const collection = COLLECTION_BY_ID[collectionId];
|
|
29
|
+
if (!collection) throw new Error(`(RS::To::fromId) Unknown collection id "${collectionId}" in aggregate id "${aggregateId}"`);
|
|
30
|
+
if (expectedCollection && collection != expectedCollection) throw new Error(`(RS::To::fromId) Expected collection "${expectedCollection}" but got "${collection}" in aggregate id "${aggregateId}"`);
|
|
31
|
+
return {
|
|
32
|
+
collection,
|
|
33
|
+
entityId
|
|
34
|
+
};
|
|
35
|
+
}
|
|
21
36
|
let idOf;
|
|
22
37
|
(function(_idOf) {
|
|
23
38
|
function person(person$1, options) {
|
|
@@ -53,7 +68,34 @@ let idOf;
|
|
|
53
68
|
}
|
|
54
69
|
_idOf.intervalPairReference = intervalPairReference;
|
|
55
70
|
})(idOf || (idOf = {}));
|
|
71
|
+
let fromId;
|
|
72
|
+
(function(_fromId) {
|
|
73
|
+
function aggregate(aggregateId) {
|
|
74
|
+
return parseAggregateId(aggregateId);
|
|
75
|
+
}
|
|
76
|
+
_fromId.aggregate = aggregate;
|
|
77
|
+
function person(aggregateId) {
|
|
78
|
+
return parseAggregateId(aggregateId, "persons").entityId;
|
|
79
|
+
}
|
|
80
|
+
_fromId.person = person;
|
|
81
|
+
function group(aggregateId) {
|
|
82
|
+
return parseAggregateId(aggregateId, "groups").entityId;
|
|
83
|
+
}
|
|
84
|
+
_fromId.group = group;
|
|
85
|
+
function teacher(aggregateId) {
|
|
86
|
+
return parseAggregateId(aggregateId, "teachers").entityId;
|
|
87
|
+
}
|
|
88
|
+
_fromId.teacher = teacher;
|
|
89
|
+
function event(aggregateId) {
|
|
90
|
+
return parseAggregateId(aggregateId, "events").entityId;
|
|
91
|
+
}
|
|
92
|
+
_fromId.event = event;
|
|
93
|
+
function lockedTime(aggregateId) {
|
|
94
|
+
return parseAggregateId(aggregateId, "lockedTimes").entityId;
|
|
95
|
+
}
|
|
96
|
+
_fromId.lockedTime = lockedTime;
|
|
97
|
+
})(fromId || (fromId = {}));
|
|
56
98
|
|
|
57
99
|
//#endregion
|
|
58
|
-
export { COLLECTION_ID, idOf, min2hrs, toTimeFloat };
|
|
100
|
+
export { COLLECTION_ID, fromId, idOf, min2hrs, toTimeFloat };
|
|
59
101
|
//# sourceMappingURL=util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":["person","group","teacher","event","lockedTime"],"sources":["../../../../../src/RS/to/input/util/util.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport type { Collection } from '../../../../core/types/common';\nimport { getVertexId } from '../../../../core/util';\nimport type { GroupWithExclude } from '../../../../core/interfaces/vertices/util/edges';\nimport type { Interval } from '../../../../core/interfaces';\n\nexport function min2hrs (min: number | undefined | null) {\n if (min == null) return;\n return min / 60;\n}\n\n/**\n * Converts a time string in the format \"HH:MM\" to a float representation, e.g., \"12:30\" becomes 12.3.\n */\nexport function toTimeFloat (str: string) {\n return parseFloat(str.replace(':', '.'));\n}\n\nexport function getPeriodIndex (\n period: ConnectedTypes.period | string | undefined | null,\n periodsMap: Map<string | undefined, number>,\n options: Types.parsedToOptions\n): number | undefined {\n // if no periods exist, return undefined\n if (periodsMap.size == 0) return;\n\n // if no period is given, return undefined\n if (!period) return;\n\n const id = getVertexId(period, options);\n const periodIndex = periodsMap.get(id);\n if (periodIndex === undefined) {\n throw new Error(`(RS::To::getPeriodIndex) Period \"${id}\" is not in periodsMap`);\n }\n return periodIndex;\n}\n\nexport const COLLECTION_ID = {\n persons: 'persons',\n groups: 'groups',\n teachers: 'teachers',\n events: 'events',\n lockedTimes: 'lockedtimes',\n} satisfies Partial<Record<Collection, string>>;\n\n/**\n * returns a combined id for the vertex or edge by combining the type(s) and id(s).\n */\nexport namespace idOf {\n /** `persons.id` */\n export function person (\n person: ConnectedTypes.person | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.persons}.${ getVertexId(person, options) }`;\n }\n\n /** `groups.id` */\n export function group (\n group: ConnectedTypes.group,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group, options) }`;\n }\n\n /** `teachers.id` */\n export function teacher (\n teacher: ConnectedTypes.teacher,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.teachers}.${ getVertexId(teacher, options) }`;\n }\n\n /** `events.id` */\n export function event (\n event: ConnectedTypes.event,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.events}.${ getVertexId(event, options) }`;\n }\n\n /** `lockedtimes.id` */\n export function lockedTime (\n lockedTime: ConnectedTypes.lockedTime,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.lockedTimes}.${ getVertexId(lockedTime, options) }`;\n }\n\n /** `groups.id<.exclude.id1.id2...>` */\n export function groupReference (\n group: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group.to, options) }`\n + (group.exclude?.length\n ? '.exclude.' + group.exclude\n .map(x => getVertexId(x, options))\n .sort()\n .join('.')\n : '');\n }\n\n /** `<rootIntervalsId&>JSON.stringify(intervals)>` */\n export function intervalPairReference (\n interval: Interval[] | undefined,\n rootInterval: ConnectedTypes.rootInterval | undefined,\n options: Types.parsedToOptions\n ): string {\n // replace null with undefined\n if (interval === null) interval = undefined;\n if (rootInterval === null) rootInterval = undefined;\n\n // replace empty intervals with undefined\n if (interval && interval.length == 0) interval = undefined;\n\n const out = (rootInterval ? getVertexId(rootInterval, options) + '&' : '') + JSON.stringify(interval);\n return out;\n }\n}\n"],"mappings":";;;AAOA,SAAgB,QAAS,KAAgC;AACvD,KAAI,OAAO,KAAM;AACjB,QAAO,MAAM;;;;;AAMf,SAAgB,YAAa,KAAa;AACxC,QAAO,WAAW,IAAI,QAAQ,KAAK;;AAsBrC,MAAa,gBAAgB;CAC3B,SAAa;CACb,QAAa;CACb,UAAa;CACb,QAAa;CACb,aAAa
|
|
1
|
+
{"version":3,"file":"util.js","names":["person","group","teacher","event","lockedTime"],"sources":["../../../../../src/RS/to/input/util/util.ts"],"sourcesContent":["import type { ConnectedTypes } from '../../../make-connected';\nimport type { Types } from '../../../types';\nimport type { Collection } from '../../../../core/types/common';\nimport { getVertexId } from '../../../../core/util';\nimport type { GroupWithExclude } from '../../../../core/interfaces/vertices/util/edges';\nimport type { Interval } from '../../../../core/interfaces';\n\nexport function min2hrs (min: number | undefined | null) {\n if (min == null) return;\n return min / 60;\n}\n\n/**\n * Converts a time string in the format \"HH:MM\" to a float representation, e.g., \"12:30\" becomes 12.3.\n */\nexport function toTimeFloat (str: string) {\n return parseFloat(str.replace(':', '.'));\n}\n\nexport function getPeriodIndex (\n period: ConnectedTypes.period | string | undefined | null,\n periodsMap: Map<string | undefined, number>,\n options: Types.parsedToOptions\n): number | undefined {\n // if no periods exist, return undefined\n if (periodsMap.size == 0) return;\n\n // if no period is given, return undefined\n if (!period) return;\n\n const id = getVertexId(period, options);\n const periodIndex = periodsMap.get(id);\n if (periodIndex === undefined) {\n throw new Error(`(RS::To::getPeriodIndex) Period \"${id}\" is not in periodsMap`);\n }\n return periodIndex;\n}\n\nexport const COLLECTION_ID = {\n persons: 'persons' as const,\n groups: 'groups' as const,\n teachers: 'teachers' as const,\n events: 'events' as const,\n lockedTimes: 'lockedtimes' as const,\n} satisfies Partial<Record<Collection, string>>;\n\n/**\n * a type generic that inverses a record type, i.e., { a: 'x', b: 'y' } becomes { x: 'a', y: 'b' }\n */\ntype InverseRecord<T extends Record<string, string>> = {\n [K in keyof T as T[K]]: K\n};\n\nconst COLLECTION_BY_ID = Object.fromEntries(Object.entries(COLLECTION_ID).map(([collection, id]) => [id, collection])) as InverseRecord<typeof COLLECTION_ID>;\n\n\nexport type AggregateCollection = keyof typeof COLLECTION_ID;\n\ntype AggregateIdParts<TCollection extends AggregateCollection = AggregateCollection> = {\n collection: TCollection\n entityId: string\n};\n\n\nfunction parseAggregateId<TCollection extends AggregateCollection = AggregateCollection> (\n aggregateId: string,\n expectedCollection?: TCollection\n): AggregateIdParts<TCollection> {\n const indexOfDot = aggregateId.indexOf('.');\n if (indexOfDot == -1) {\n throw new Error(`(RS::To::fromId) Missing collection separator in aggregate id \"${aggregateId}\"`);\n }\n\n const collectionId = aggregateId.substring(0, indexOfDot).toLowerCase() as keyof typeof COLLECTION_BY_ID;\n const entityId = aggregateId.substring(indexOfDot + 1);\n\n if (!entityId) {\n throw new Error(`(RS::To::fromId) Missing entity id in aggregate id \"${aggregateId}\"`);\n }\n\n const collection = COLLECTION_BY_ID[collectionId];\n if (!collection) {\n throw new Error(`(RS::To::fromId) Unknown collection id \"${collectionId}\" in aggregate id \"${aggregateId}\"`);\n }\n\n if (expectedCollection && collection != expectedCollection) {\n throw new Error(`(RS::To::fromId) Expected collection \"${expectedCollection}\" but got \"${collection}\" in aggregate id \"${aggregateId}\"`);\n }\n\n return {\n collection: collection as TCollection,\n entityId,\n };\n}\n\n/**\n * returns a combined id for the vertex or edge by combining the type(s) and id(s).\n */\nexport namespace idOf {\n /** `persons.id` */\n export function person (\n person: ConnectedTypes.person | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.persons}.${ getVertexId(person, options) }`;\n }\n\n /** `groups.id` */\n export function group (\n group: ConnectedTypes.group | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group, options) }`;\n }\n\n /** `teachers.id` */\n export function teacher (\n teacher: ConnectedTypes.teacher | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.teachers}.${ getVertexId(teacher, options) }`;\n }\n\n /** `events.id` */\n export function event (\n event: ConnectedTypes.event | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.events}.${ getVertexId(event, options) }`;\n }\n\n /** `lockedtimes.id` */\n export function lockedTime (\n lockedTime: ConnectedTypes.lockedTime | string,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.lockedTimes}.${ getVertexId(lockedTime, options) }`;\n }\n\n /** `groups.id<.exclude.id1.id2...>` */\n export function groupReference (\n group: GroupWithExclude.Util.Value<ConnectedTypes.group, ConnectedTypes.person>,\n options: Types.parsedToOptions\n ): string {\n return `${COLLECTION_ID.groups}.${ getVertexId(group.to, options) }`\n + (group.exclude?.length\n ? '.exclude.' + group.exclude\n .map(x => getVertexId(x, options))\n .sort()\n .join('.')\n : '');\n }\n\n /** `<rootIntervalsId&>JSON.stringify(intervals)>` */\n export function intervalPairReference (\n interval: Interval[] | undefined,\n rootInterval: ConnectedTypes.rootInterval | undefined,\n options: Types.parsedToOptions\n ): string {\n // replace null with undefined\n if (interval === null) interval = undefined;\n if (rootInterval === null) rootInterval = undefined;\n\n // replace empty intervals with undefined\n if (interval && interval.length == 0) interval = undefined;\n\n const out = (rootInterval ? getVertexId(rootInterval, options) + '&' : '') + JSON.stringify(interval);\n return out;\n }\n}\n\nexport namespace fromId {\n export function aggregate (aggregateId: string): AggregateIdParts {\n return parseAggregateId(aggregateId);\n }\n\n /** `persons.id` -> `id` */\n export function person (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'persons').entityId;\n }\n\n /** `groups.id` -> `id` */\n export function group (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'groups').entityId;\n }\n\n /** `teachers.id` -> `id` */\n export function teacher (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'teachers').entityId;\n }\n\n /** `events.id` -> `id` */\n export function event (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'events').entityId;\n }\n\n /** `lockedtimes.id` -> `id` */\n export function lockedTime (aggregateId: string): string {\n return parseAggregateId(aggregateId, 'lockedTimes').entityId;\n }\n}\n"],"mappings":";;;AAOA,SAAgB,QAAS,KAAgC;AACvD,KAAI,OAAO,KAAM;AACjB,QAAO,MAAM;;;;;AAMf,SAAgB,YAAa,KAAa;AACxC,QAAO,WAAW,IAAI,QAAQ,KAAK;;AAsBrC,MAAa,gBAAgB;CAC3B,SAAa;CACb,QAAa;CACb,UAAa;CACb,QAAa;CACb,aAAa;;AAUf,MAAM,mBAAmB,OAAO,YAAY,OAAO,QAAQ,eAAe,KAAK,CAAC,YAAY,QAAQ,CAAC,IAAI;AAWzG,SAAS,iBACP,aACA,oBAC+B;CAC/B,MAAM,aAAa,YAAY,QAAQ;AACvC,KAAI,cAAc,GAChB,OAAM,IAAI,MAAM,kEAAkE,YAAY;CAGhG,MAAM,eAAe,YAAY,UAAU,GAAG,YAAY;CAC1D,MAAM,WAAW,YAAY,UAAU,aAAa;AAEpD,KAAI,CAAC,SACH,OAAM,IAAI,MAAM,uDAAuD,YAAY;CAGrF,MAAM,aAAa,iBAAiB;AACpC,KAAI,CAAC,WACH,OAAM,IAAI,MAAM,2CAA2C,aAAa,qBAAqB,YAAY;AAG3G,KAAI,sBAAsB,cAAc,mBACtC,OAAM,IAAI,MAAM,yCAAyC,mBAAmB,aAAa,WAAW,qBAAqB,YAAY;AAGvI,QAAO;EACO;EACZ;;;;;CASK,SAAS,OACd,UACA,SACQ;AACR,SAAO,GAAG,cAAc,QAAQ,GAAI,YAAYA,UAAQ;;;CAInD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,QACd,WACA,SACQ;AACR,SAAO,GAAG,cAAc,SAAS,GAAI,YAAYC,WAAS;;;CAIrD,SAAS,MACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYC,SAAO;;;CAIjD,SAAS,WACd,cACA,SACQ;AACR,SAAO,GAAG,cAAc,YAAY,GAAI,YAAYC,cAAY;;;CAI3D,SAAS,eACd,SACA,SACQ;AACR,SAAO,GAAG,cAAc,OAAO,GAAI,YAAYH,QAAM,IAAI,cACpDA,QAAM,SAAS,SACd,cAAcA,QAAM,QACnB,KAAI,MAAK,YAAY,GAAG,UACxB,OACA,KAAK,OACN;;;CAID,SAAS,sBACd,UACA,cACA,SACQ;AAER,MAAI,aAAiB,KAAM,YAAe;AAC1C,MAAI,iBAAiB,KAAM,gBAAe;AAG1C,MAAI,YAAY,SAAS,UAAU,EAAG,YAAW;EAEjD,MAAM,OAAO,eAAe,YAAY,cAAc,WAAW,MAAM,MAAM,KAAK,UAAU;AAC5F,SAAO;;;;;;CAKF,SAAS,UAAW,aAAuC;AAChE,SAAO,iBAAiB;;;CAInB,SAAS,OAAQ,aAA6B;AACnD,SAAO,iBAAiB,aAAa,WAAW;;;CAI3C,SAAS,MAAO,aAA6B;AAClD,SAAO,iBAAiB,aAAa,UAAU;;;CAI1C,SAAS,QAAS,aAA6B;AACpD,SAAO,iBAAiB,aAAa,YAAY;;;CAI5C,SAAS,MAAO,aAA6B;AAClD,SAAO,iBAAiB,aAAa,UAAU;;;CAI1C,SAAS,WAAY,aAA6B;AACvD,SAAO,iBAAiB,aAAa,eAAe"}
|