@royalschedule/maps 4.0.0 → 4.0.1

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,14 @@
1
1
  //#region src/Additio/types/options.d.ts
2
2
  type Options = {
3
+ /**
4
+ * If we should include events (lessons) in the export.
5
+ * @default true
6
+ */
3
7
  includeEvents?: boolean;
8
+ /**
9
+ * If we should include complementary times (locked times of type 'COMPLEMENTARY_TIME') in the export.
10
+ * @default true
11
+ */
4
12
  includeComplementaryTimes?: boolean;
5
13
  };
6
14
  //#endregion
@@ -1,5 +1,5 @@
1
- import { AvailableLocation, GroupReference, ID, PersonReference } from "../core/types/common/index.js";
2
1
  import { DateType } from "../common/types.js";
2
+ import { AvailableLocation, GroupReference, ID, PersonReference } from "../core/types/common/index.js";
3
3
  import { BreakLength } from "../core/types/common/break-lengths.js";
4
4
  import { AllowedInterval } from "../core/types/common/intervals.js";
5
5
  import { Day } from "../core/types/common/days.js";
@@ -15,55 +15,55 @@ declare class PlanDigitalMap {
15
15
  groups?: {
16
16
  exceptions?: string[] | undefined;
17
17
  lockedTimes?: string[] | undefined;
18
- createdAt?: string | undefined;
19
- updatedAt?: string | undefined;
20
- lastModifiedBy?: unknown;
21
18
  ids?: ID | undefined;
19
+ createdAt?: DateType | undefined;
20
+ updatedAt?: DateType | undefined;
21
+ lastModifiedBy?: unknown;
22
22
  belongsTo?: string | undefined;
23
23
  rank?: number | undefined;
24
24
  displayName?: string | undefined;
25
- days?: Day[] | undefined;
25
+ lunch?: string[] | undefined;
26
26
  intervals?: AllowedInterval[] | undefined;
27
+ days?: Day[] | undefined;
27
28
  minBreakLength?: BreakLength | undefined;
29
+ tags?: Tag[] | undefined;
28
30
  maximumScheduleSpan?: MaximumScheduleSpan | undefined;
29
31
  forbidOverlappingEvents?: boolean | undefined;
30
32
  disableDayLengthPunishment?: boolean | undefined;
31
33
  weight?: number | undefined;
34
+ rootInterval?: string | undefined;
35
+ maxNumWorkingHours?: number | boolean | undefined;
36
+ maxNumDailyWorkingHours?: number | number[] | boolean | undefined;
32
37
  species?: "class" | undefined;
33
38
  parentGroups?: string[] | undefined;
34
39
  subGroups?: string[] | undefined;
35
- lunch?: string[] | undefined;
36
40
  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
- createdAt?: string | undefined;
46
- updatedAt?: string | undefined;
47
- lastModifiedBy?: unknown;
48
45
  ids?: ID | undefined;
46
+ createdAt?: DateType | undefined;
47
+ updatedAt?: DateType | undefined;
48
+ lastModifiedBy?: unknown;
49
49
  belongsTo?: string | undefined;
50
50
  rank?: number | undefined;
51
51
  displayName?: string | undefined;
52
- days?: Day[] | undefined;
52
+ lunch?: string[] | undefined;
53
53
  intervals?: AllowedInterval[] | undefined;
54
+ days?: Day[] | undefined;
54
55
  minBreakLength?: BreakLength | undefined;
56
+ tags?: Tag[] | undefined;
57
+ plannedScheduledDuration?: PlannedScheduledDuration | undefined;
55
58
  maximumScheduleSpan?: MaximumScheduleSpan | undefined;
56
59
  forbidOverlappingEvents?: boolean | undefined;
57
60
  disableDayLengthPunishment?: boolean | undefined;
58
61
  weight?: number | undefined;
59
- lunch?: string[] | undefined;
62
+ person?: string | undefined;
60
63
  rootInterval?: string | undefined;
61
- tags?: Tag[] | undefined;
64
+ signature?: string | undefined;
62
65
  maxNumWorkingHours?: number | boolean | undefined;
63
66
  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
- createdAt?: string | undefined;
76
- updatedAt?: string | undefined;
77
- lastModifiedBy?: unknown;
78
75
  ids?: ID | undefined;
76
+ createdAt?: DateType | undefined;
77
+ updatedAt?: DateType | undefined;
78
+ lastModifiedBy?: unknown;
79
79
  belongsTo?: string | undefined;
80
- type?: string | undefined;
81
80
  displayName?: string | undefined;
82
- days?: Day[] | undefined;
83
- weeks?: number[] | undefined;
84
- period?: string | undefined;
85
81
  intervals?: AllowedInterval[] | undefined;
82
+ days?: Day[] | undefined;
86
83
  minBreakLength?: BreakLength | undefined;
87
- weight?: number | undefined;
88
84
  tags?: Tag[] | undefined;
89
- color?: string | undefined;
85
+ weeks?: number[] | undefined;
86
+ weight?: number | undefined;
87
+ period?: string | undefined;
90
88
  participants?: PersonReference<string>[] | undefined;
91
89
  density?: number | undefined;
92
90
  subject?: string | undefined;
91
+ color?: string | undefined;
93
92
  eventDurationVariance?: number | undefined;
94
93
  totalTime?: string | undefined;
94
+ type?: string | undefined;
95
95
  comment?: string | undefined;
96
96
  startDate?: DateType | undefined;
97
97
  endDate?: DateType | undefined;
@@ -6,6 +6,9 @@ interface EventConfiguration {
6
6
  day: number;
7
7
  collection?: string;
8
8
  dependencies?: string[];
9
+ /**
10
+ * @deprecated Currently no need to use this as groups are fixed
11
+ */
9
12
  groups?: ({
10
13
  groups: string[];
11
14
  } | {
@@ -16,7 +16,9 @@ interface Group {
16
16
  days?: (Types.day | number)[];
17
17
  minimizeGaps?: boolean;
18
18
  minimizeDependencyAlternation?: boolean;
19
+ /** @deprecated in v3 */
19
20
  forbidOverlappingEvents?: boolean;
21
+ /** @deprecated replaced by minimizeGaps in v3 */
20
22
  disableDayLengthPunishment?: boolean;
21
23
  meta?: Record<string, unknown>;
22
24
  }
@@ -7,7 +7,9 @@ import { Types as Types$1 } from "./index.js";
7
7
  //#region src/RS/types/to.d.ts
8
8
  type ToInput = MixedScheduleData;
9
9
  type PartialScheduleOptions<IDs extends Array<string> | Set<string>> = {
10
+ /** @description undefined means all included */
10
11
  includedEvents?: IDs;
12
+ /** @description undefined means all included */
11
13
  includedLocations?: IDs;
12
14
  omittedEventsHandling: 'ignore' | 'freeze';
13
15
  };
@@ -17,9 +19,22 @@ interface ToOptions extends BaseOptions {
17
19
  isPublicId?: boolean;
18
20
  appendCoreData?: boolean;
19
21
  appendOutput?: boolean;
22
+ /**
23
+ * @deprecated
24
+ * If true, the mapping becomes the same as the previous version 2 one. That means:
25
+ *
26
+ * - New root level entries: `intervals` and `individuals`
27
+ * - As the there is now a root level `intervals` the former may be references from `Collection.intervals`, `Group.intervals` etc.
28
+ * - The `Collection.groups` and `Event.groups` supports referencing `individuals` (and `individuals sets`) in addition to `groups`
29
+ * - The `Group.forbidOverlappingEvents` has been removed.
30
+ * - The `Group.disableDayLengthPunishment` has been replaced by `Group.minimizeGaps`
31
+ */
20
32
  oldFormat?: boolean;
21
33
  partialScheduleOptions?: PartialScheduleOptions<Array<string> | Set<string>>;
22
34
  algorithmWeightParameters?: AlgorithmWeightParameters;
35
+ /**
36
+ * to be used before whe have migrated from "maxNumWorkingHours" and "maxNumDailyWorkingHours" to "maximumScheduleSpan"
37
+ */
23
38
  useMaximumScheduleSpan?: boolean;
24
39
  }
25
40
  interface ParsedToOptions extends Omit<ToOptions, 'partialScheduleOptions'> {
@@ -116,10 +116,23 @@ declare namespace Types {
116
116
  type ta = TA;
117
117
  type lesson = Lesson;
118
118
  type student = Student;
119
+ type errorType = ErrorType;
119
120
  type errorCode = ErrorCode;
120
121
  }
121
122
  type Options = {
123
+ /**
124
+ * Specifies which field to use as the source for creating additional scheduling periods.
125
+ * By default, lessons are associated with their course's period, but this option allows
126
+ * creating distinct periods based on all unique values found in either the 'Week' or
127
+ * 'ActualWeeks' field of lesson data, and applying these periods to the lessons.
128
+ */
122
129
  createPeriodsFrom?: 'Week' | 'ActualWeeks' | null;
130
+ /**
131
+ * Import also events for which we cannot deduce the course.
132
+ * This is useful for example when you want to load all events for a teacher or a group
133
+ * but you don't care about the course. If you set this to true, we will create a
134
+ * dummy course for each event that doesn't have a course.
135
+ */
123
136
  includeEventsMissingCourse?: boolean;
124
137
  };
125
138
  //#endregion
@@ -3,10 +3,17 @@ import { Moment } from "moment";
3
3
 
4
4
  //#region src/common/types.d.ts
5
5
  type DateType = Moment | string | Date;
6
+ /**
7
+ * T1 | T2 | ... => T1 & T2 & ...
8
+ */
6
9
  type Intersect<T> = (T extends any ? ((x: T) => 0) : never) extends ((x: infer R) => 0) ? R : never;
7
10
  type BaseOptions = {
8
11
  idKey?: IdKey;
9
12
  };
13
+ /**
14
+ * The interface required for the "from" mapping functions.
15
+ */
16
+
10
17
  //#endregion
11
18
  export { BaseOptions, DateType, Intersect };
12
19
  //# sourceMappingURL=types.d.ts.map
@@ -1,10 +1,14 @@
1
- import { Vertex } from "../types/common/index.js";
2
1
  import { Intersect } from "../../common/types.js";
2
+ import { Vertex } from "../types/common/index.js";
3
3
 
4
4
  //#region src/core/to/util.d.ts
5
5
 
6
6
  declare const keys: readonly ["_id", "createdAt", "updatedAt", "belongsTo", "lastModifiedBy", "CONTEXT"];
7
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
+ */
8
12
  //#endregion
9
13
  export { InternalKeysOmitted };
10
14
  //# sourceMappingURL=util.d.ts.map
@@ -1,3 +1,4 @@
1
+ import { DateType } from "../../../common/types.js";
1
2
  import { Types } from "mongoose";
2
3
 
3
4
  //#region src/core/types/common/index.d.ts
@@ -8,8 +9,8 @@ type Vertex = ({
8
9
  } | {
9
10
  id: ID;
10
11
  }) & {
11
- createdAt?: string;
12
- updatedAt?: string;
12
+ createdAt?: DateType;
13
+ updatedAt?: DateType;
13
14
  lastModifiedBy?: unknown;
14
15
  ids?: ID;
15
16
  };
@@ -6,7 +6,13 @@ type Interval<T = DateType> = {
6
6
  end: T;
7
7
  };
8
8
  interface AllowedInterval<T = DateType> extends Interval<T> {
9
+ /**
10
+ * @deprecated IS THIS REALLY OPTIONAL? ALSO, IS THIS USED ANYWHERE?
11
+ */
9
12
  day?: number;
13
+ /**
14
+ * @deprecated WHAT IS THE VALUE OF THE STRING!?
15
+ */
10
16
  type?: string;
11
17
  }
12
18
  //#endregion
@@ -1,6 +1,17 @@
1
1
  //#region src/core/types/common/maximum-schedule-span.d.ts
2
+ /**
3
+ * The maximum number of minutes a schedule is allowed to span over a day and week
4
+ */
2
5
  type MaximumScheduleSpan = {
6
+ /**
7
+ * The maximum number of minutes a schedule is allowed to span over a day.
8
+ * The daily schedule span is the duration between the start of the first event and the end of the last event that day.
9
+ */
3
10
  daily?: number | null;
11
+ /**
12
+ * The maximum number of minutes a schedule is allowed to span over a week.
13
+ * The weekly schedule span is the sum of the daily schedule spans for each day of the week.
14
+ */
4
15
  weekly?: number | null;
5
16
  };
6
17
  //#endregion
@@ -1,5 +1,11 @@
1
1
  //#region src/core/types/common/planned-schedule-duration.d.ts
2
+ /**
3
+ * The planned/expected total weekly minutes of schedule events assigned to a teacher
4
+ */
2
5
  type PlannedScheduledDuration = {
6
+ /**
7
+ * The planned/expected total weekly minutes of schedule events assigned to a teacher
8
+ */
3
9
  weekly?: number | null;
4
10
  };
5
11
  //#endregion
@@ -1,5 +1,5 @@
1
- import { AvailableLocation, GroupReference, PersonReference, Vertex } from "./common/index.js";
2
1
  import { DateType } from "../../common/types.js";
2
+ import { AvailableLocation, GroupReference, PersonReference, Vertex } from "./common/index.js";
3
3
  import { BreakLength } from "./common/break-lengths.js";
4
4
  import { AllowedInterval } from "./common/intervals.js";
5
5
  import { Day } from "./common/days.js";
@@ -48,7 +48,9 @@ type Course = Vertex & {
48
48
  overlapSpecies?: OverlapGroup | null;
49
49
  plannedDuration?: string;
50
50
  tags?: Tag[];
51
+ /** @deprecated replaced by plannedDuration? */
51
52
  minutesPerWeek?: number;
53
+ /** @deprecated replaced by plannedDuration? */
52
54
  expectedTotalHours?: number;
53
55
  };
54
56
  //#endregion
@@ -1,5 +1,5 @@
1
- import { Vertex } from "./common/index.js";
2
1
  import { DateType } from "../../common/types.js";
2
+ import { Vertex } from "./common/index.js";
3
3
  import { RootInterval } from "./root-intervals.js";
4
4
  import { MaximumScheduleSpan } from "./common/maximum-schedule-span.js";
5
5
  import { PlannedScheduledDuration } from "./common/planned-schedule-duration.js";
@@ -44,7 +44,9 @@ type DivisionSettings = Vertex & {
44
44
  eventTime?: number;
45
45
  eventTimeActive?: boolean;
46
46
  defaultRootInterval?: RootInterval;
47
+ /** @deprecated replaced by defaultMaximumScheduleSpan */
47
48
  defaultMaxNumWorkingHours?: number | null;
49
+ /** @deprecated replaced by defaultMaximumScheduleSpan */
48
50
  defaultMaxNumDailyWorkingHours?: number | null;
49
51
  };
50
52
  //#endregion
@@ -1,5 +1,5 @@
1
- import { Vertex } from "./common/index.js";
2
1
  import { DateType } from "../../common/types.js";
2
+ import { Vertex } from "./common/index.js";
3
3
  import { DivisionSettings } from "./division-settings.js";
4
4
  import { Meta } from "./common/meta.js";
5
5
 
@@ -8,7 +8,7 @@ import { Meta } from "./common/meta.js";
8
8
  type StepGuideProgress = {
9
9
  checked: string[];
10
10
  completed: boolean;
11
- updatedAt?: string;
11
+ updatedAt?: DateType;
12
12
  };
13
13
  type Division = Vertex & {
14
14
  settings?: DivisionSettings;
@@ -1,5 +1,5 @@
1
- import { AvailableLocation, GroupReference, PersonReference, Vertex } from "./common/index.js";
2
1
  import { DateType } from "../../common/types.js";
2
+ import { AvailableLocation, GroupReference, PersonReference, Vertex } from "./common/index.js";
3
3
  import { BreakLength } from "./common/break-lengths.js";
4
4
  import { AllowedInterval } from "./common/intervals.js";
5
5
  import { Day } from "./common/days.js";
@@ -1,5 +1,5 @@
1
- import { Coalesced, Vertex } from "./common/index.js";
2
1
  import { DateType } from "../../common/types.js";
2
+ import { Coalesced, Vertex } from "./common/index.js";
3
3
  import { Group } from "./groups.js";
4
4
  import { Person } from "./persons.js";
5
5
  import { Teacher } from "./teachers.js";
@@ -31,7 +31,9 @@ type Group = Vertex & {
31
31
  rootInterval?: RootInterval;
32
32
  days?: Day[];
33
33
  tags?: Tag[];
34
+ /** @deprecated replaced by maximumScheduleSpan */
34
35
  maxNumWorkingHours?: number | boolean;
36
+ /** @deprecated replaced by maximumScheduleSpan */
35
37
  maxNumDailyWorkingHours?: number | number[] | boolean;
36
38
  };
37
39
  //#endregion
@@ -1,5 +1,5 @@
1
- import { Coalesced, Vertex } from "./common/index.js";
2
1
  import { DateType } from "../../common/types.js";
2
+ import { Coalesced, Vertex } from "./common/index.js";
3
3
  import { AllowedInterval } from "./common/intervals.js";
4
4
  import { Day } from "./common/days.js";
5
5
  import { Tag } from "./common/tag.js";
@@ -11,7 +11,7 @@ import { Course } from "./courses.js";
11
11
  import { Division } from "./divisions.js";
12
12
 
13
13
  //#region src/core/types/locked-times.d.ts
14
- type Type = 'LUNCH' | 'COMPLEMENTARY_TIME';
14
+ type Type = /* 'ANY' | */'LUNCH' | 'COMPLEMENTARY_TIME';
15
15
  type LockedTime = Vertex & {
16
16
  belongsTo?: Division;
17
17
  displayName?: string;
@@ -1,5 +1,5 @@
1
- import { Vertex } from "./common/index.js";
2
1
  import { DateType } from "../../common/types.js";
2
+ import { Vertex } from "./common/index.js";
3
3
  import { Tag } from "./common/tag.js";
4
4
  import { Group } from "./groups.js";
5
5
  import { LockedTime } from "./locked-times.js";
@@ -31,7 +31,9 @@ type Teacher = Vertex & {
31
31
  signature?: string;
32
32
  rank?: number;
33
33
  tags?: Tag[];
34
+ /** @deprecated replaced by maximumScheduleSpan */
34
35
  maxNumWorkingHours?: number | boolean;
36
+ /** @deprecated replaced by maximumScheduleSpan */
35
37
  maxNumDailyWorkingHours?: number | number[] | boolean;
36
38
  };
37
39
  //#endregion
@@ -42,8 +42,17 @@ type _Mixed<T extends Vertex, Depth extends SupportedDepths = MaxDepth, IgnoreIn
42
42
  depth: Depth;
43
43
  ignoreInternalId: IgnoreInternalId;
44
44
  }> };
45
+ /**
46
+ * Given a vertex type, this will return a new type where all references to other vertices are replaced with their mixed type.
47
+ */
45
48
  type Mixed<T extends Vertex> = _Mixed<T>;
49
+ /**
50
+ * Given a vertex type, this will return a new type where all references to other vertices are replaced with their mixed type, but without the internal id (`_id` and `id`)
51
+ */
46
52
  type MixedWithoutInternalId<T extends Vertex> = Omit<_Mixed<T, MaxDepth, true>, InternalIdKey>;
53
+ /**
54
+ * Given a vertex type, this will return a new type where all references to other vertices are replaced with their serialized type at the specified depth.
55
+ */
47
56
  type Serialized<T extends Vertex, DepthIndex extends SupportedDepths = 0> = Vertex & { [K in keyof T]: TransformGeneral<T[K], {
48
57
  type: 'serialized';
49
58
  depth: DepthIndex;
@@ -51,6 +60,10 @@ type Serialized<T extends Vertex, DepthIndex extends SupportedDepths = 0> = Vert
51
60
  type: 'serialized';
52
61
  depth: DepthIndex;
53
62
  }> };
63
+ /**
64
+ * Given a object that contains entries of vertices or arrays of vertices, this will return a new type where all references to other vertices are replaced with their serialized type.
65
+ */
66
+
54
67
  //#endregion
55
68
  export { Mixed, MixedWithoutInternalId, Serialized };
56
69
  //# sourceMappingURL=vertex-mapping.d.ts.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@royalschedule/maps",
3
3
  "description": "",
4
- "version": "4.0.0",
4
+ "version": "4.0.1",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",