@royalschedule/maps 4.0.15 → 4.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Additio/from/courses.js.map +1 -1
- package/dist/Additio/from/events.js.map +1 -1
- package/dist/Additio/from/groups.js.map +1 -1
- package/dist/Additio/from/index.js.map +1 -1
- package/dist/Additio/from/locations.js.map +1 -1
- package/dist/Additio/from/persons.js.map +1 -1
- package/dist/Additio/from/schedules.d.ts +7 -6
- package/dist/Additio/from/schedules.js +2 -4
- package/dist/Additio/from/schedules.js.map +1 -1
- package/dist/Additio/from/teachers.js.map +1 -1
- package/dist/Additio/to/index.d.ts +13 -11
- package/dist/Additio/to/schedules.js +2 -4
- package/dist/Additio/to/schedules.js.map +1 -1
- package/dist/Admentum/from/courses.js.map +1 -1
- package/dist/Admentum/from/events.js.map +1 -1
- package/dist/Admentum/from/groups.js.map +1 -1
- package/dist/Admentum/from/index.js.map +1 -1
- package/dist/Admentum/from/locations.js.map +1 -1
- package/dist/Admentum/from/persons.js.map +1 -1
- package/dist/Admentum/from/schedules.d.ts +7 -6
- package/dist/Admentum/from/schedules.js +2 -4
- package/dist/Admentum/from/schedules.js.map +1 -1
- package/dist/Admentum/from/teachers.js.map +1 -1
- package/dist/Admentum/to/index.d.ts +9 -8
- package/dist/Admentum/to/schedules.js +4 -7
- package/dist/Admentum/to/schedules.js.map +1 -1
- package/dist/Excel/index.d.ts +263 -26
- package/dist/Excel/v1/from/index.js +2 -1
- package/dist/Excel/v1/from/index.js.map +1 -1
- package/dist/Excel/v1/index.d.ts +218 -20
- package/dist/Excel/v2/from/index.js +49 -57
- package/dist/Excel/v2/from/index.js.map +1 -1
- package/dist/Excel/v2/index.d.ts +263 -26
- package/dist/IdunSoft/from/courses.js.map +1 -1
- package/dist/IdunSoft/from/events.js +1 -2
- package/dist/IdunSoft/from/events.js.map +1 -1
- package/dist/IdunSoft/from/groups.js.map +1 -1
- package/dist/IdunSoft/from/index.js.map +1 -1
- package/dist/IdunSoft/from/locations.js.map +1 -1
- package/dist/IdunSoft/from/schedules.d.ts +6 -5
- package/dist/IdunSoft/from/schedules.js.map +1 -1
- package/dist/IdunSoft/from/teachers.js.map +1 -1
- package/dist/IdunSoft/to/index.d.ts +2 -1
- package/dist/IdunSoft/to/schedules.js +5 -8
- package/dist/IdunSoft/to/schedules.js.map +1 -1
- package/dist/InfoMentor/to/index.d.ts +2 -1
- package/dist/InfoMentor/to/schedules.js +3 -4
- package/dist/InfoMentor/to/schedules.js.map +1 -1
- package/dist/PlanDigital/from/index.js.map +1 -1
- package/dist/PlanDigital/from/schedules.js +9 -11
- package/dist/PlanDigital/from/schedules.js.map +1 -1
- package/dist/PlanDigital/index.d.ts +73 -58
- package/dist/Quiculum/file/to/index.d.ts +10 -9
- package/dist/Quiculum/file/to/schedules.js +5 -9
- package/dist/Quiculum/file/to/schedules.js.map +1 -1
- package/dist/RS/from/division.d.ts +2 -1
- package/dist/RS/from/division.js +9 -6
- package/dist/RS/from/division.js.map +1 -1
- package/dist/RS/from/index.js.map +1 -1
- package/dist/RS/from/schedules.d.ts +2 -1
- package/dist/RS/from/schedules.js.map +1 -1
- package/dist/RS/make-connected.d.ts +17 -16
- package/dist/RS/make-connected.js +63 -96
- package/dist/RS/make-connected.js.map +1 -1
- package/dist/RS/to/index.js.map +1 -1
- package/dist/RS/to/initial-configuration.js +4 -6
- package/dist/RS/to/initial-configuration.js.map +1 -1
- package/dist/RS/to/input/collections.js.map +1 -1
- package/dist/RS/to/input/default.js +1 -2
- package/dist/RS/to/input/default.js.map +1 -1
- package/dist/RS/to/input/dependencies.js +1 -3
- package/dist/RS/to/input/dependencies.js.map +1 -1
- package/dist/RS/to/input/dynamic-locked-times.js +1 -2
- package/dist/RS/to/input/dynamic-locked-times.js.map +1 -1
- package/dist/RS/to/input/events.js +5 -3
- package/dist/RS/to/input/events.js.map +1 -1
- package/dist/RS/to/input/groups.js.map +1 -1
- package/dist/RS/to/input/individuals.js +2 -3
- package/dist/RS/to/input/individuals.js.map +1 -1
- package/dist/RS/to/input/input.js +1 -3
- package/dist/RS/to/input/input.js.map +1 -1
- package/dist/RS/to/input/intervals.js +2 -4
- package/dist/RS/to/input/intervals.js.map +1 -1
- package/dist/RS/to/input/periods.js +6 -8
- package/dist/RS/to/input/periods.js.map +1 -1
- package/dist/RS/to/input/settings.js.map +1 -1
- package/dist/RS/to/input/teachers.js.map +1 -1
- package/dist/RS/to/input/util/attach-locked-times.js.map +1 -1
- package/dist/RS/to/input/util/parse-days.js.map +1 -1
- package/dist/RS/to/input/util/parse-group-references.js.map +1 -1
- package/dist/RS/to/input/util/parse-intervals.js +2 -4
- package/dist/RS/to/input/util/parse-intervals.js.map +1 -1
- package/dist/RS/to/input/util/parse-location-references.js +1 -2
- package/dist/RS/to/input/util/parse-location-references.js.map +1 -1
- package/dist/RS/to/input/util/parse-max-working-hours.js.map +1 -1
- package/dist/RS/to/input/util/parse-minimum-break-length.js.map +1 -1
- package/dist/RS/to/input/util/util.js +1 -2
- package/dist/RS/to/input/util/util.js.map +1 -1
- package/dist/RS/to/schedules.js +1 -1
- package/dist/RS/to/schedules.js.map +1 -1
- package/dist/RS/types/to.d.ts +12 -3
- package/dist/RS/types/to.js +1 -1
- package/dist/RS/types/to.js.map +1 -1
- package/dist/SS12000/from/activities.js +1 -2
- package/dist/SS12000/from/activities.js.map +1 -1
- package/dist/SS12000/from/calendar-events.js.map +1 -1
- package/dist/SS12000/from/duties.js.map +1 -1
- package/dist/SS12000/from/groups.js.map +1 -1
- package/dist/SS12000/from/index.js.map +1 -1
- package/dist/SS12000/from/persons.js.map +1 -1
- package/dist/SS12000/from/resources.js.map +1 -1
- package/dist/SS12000/from/rooms.js.map +1 -1
- package/dist/SS12000/from/syllabuses.js.map +1 -1
- package/dist/SS12000/index.d.ts +12567 -9
- package/dist/SS12000/to/activities.js.map +1 -1
- package/dist/SS12000/to/calendar-events.js.map +1 -1
- package/dist/SS12000/to/common.js.map +1 -1
- package/dist/SS12000/to/duties.js.map +1 -1
- package/dist/SS12000/to/groups.js.map +1 -1
- package/dist/SS12000/to/index.d.ts +17 -16
- package/dist/SS12000/to/persons.js.map +1 -1
- package/dist/SS12000/to/resources.js.map +1 -1
- package/dist/SS12000/to/rooms.js.map +1 -1
- package/dist/SS12000/to/syllabuses.js.map +1 -1
- package/dist/SchoolSoft/api/from/index.js.map +1 -1
- package/dist/SchoolSoft/api/from/schedules.js +8 -12
- package/dist/SchoolSoft/api/from/schedules.js.map +1 -1
- package/dist/SchoolSoft/api/index.d.ts +444 -9
- package/dist/SchoolSoft/file/from/index.js.map +1 -1
- package/dist/SchoolSoft/file/from/schedules.js +83 -87
- package/dist/SchoolSoft/file/from/schedules.js.map +1 -1
- package/dist/SchoolSoft/file/index.d.ts +2 -1
- package/dist/SchoolSoft/file/to/index.d.ts +5 -4
- package/dist/SchoolSoft/file/to/schedules.js +1 -2
- package/dist/SchoolSoft/file/to/schedules.js.map +1 -1
- package/dist/SchoolSoft/index.d.ts +2 -1
- package/dist/Schoolity/txt/to/index.d.ts +2 -1
- package/dist/Schoolity/txt/to/schedules.js +5 -12
- package/dist/Schoolity/txt/to/schedules.js.map +1 -1
- package/dist/Skola24/mdb/from/course-and-events.js +3 -5
- package/dist/Skola24/mdb/from/course-and-events.js.map +1 -1
- package/dist/Skola24/mdb/from/groups.js.map +1 -1
- package/dist/Skola24/mdb/from/index.js.map +1 -1
- package/dist/Skola24/mdb/from/locations.js.map +1 -1
- package/dist/Skola24/mdb/from/schedule.d.ts +6 -5
- package/dist/Skola24/mdb/from/schedule.js.map +1 -1
- package/dist/Skola24/mdb/from/teachers.js.map +1 -1
- package/dist/Skola24/txt/from/calendar-exceptions.js +1 -2
- package/dist/Skola24/txt/from/calendar-exceptions.js.map +1 -1
- package/dist/Skola24/txt/from/division.js.map +1 -1
- package/dist/Skola24/txt/from/index.js.map +1 -1
- package/dist/Skola24/txt/from/period.js +31 -34
- package/dist/Skola24/txt/from/period.js.map +1 -1
- package/dist/Skola24/txt/from/schedules.d.ts +9 -8
- package/dist/Skola24/txt/from/schedules.js +10 -12
- package/dist/Skola24/txt/from/schedules.js.map +1 -1
- package/dist/Skola24/txt/from/util.js.map +1 -1
- package/dist/Skola24/txt/index.d.ts +2 -1
- package/dist/Skola24/txt/to/index.d.ts +2 -1
- package/dist/Skola24/txt/to/schedules.js +5 -12
- package/dist/Skola24/txt/to/schedules.js.map +1 -1
- package/dist/common/constants.js.map +1 -1
- package/dist/common/functions.js +46 -10
- package/dist/common/functions.js.map +1 -1
- package/dist/common/get-date.js.map +1 -1
- package/dist/common/make-chainable/index.js.map +1 -1
- package/dist/common/types.d.ts +3 -6
- package/dist/core/from/configurations.js.map +1 -1
- package/dist/core/from/courses.js.map +1 -1
- package/dist/core/from/events.js +1 -1
- package/dist/core/from/events.js.map +1 -1
- package/dist/core/from/exceptions.js.map +1 -1
- package/dist/core/from/groups.js.map +1 -1
- package/dist/core/from/index.js +9 -6
- package/dist/core/from/index.js.map +1 -1
- package/dist/core/from/locations.js.map +1 -1
- package/dist/core/from/locked-times.js.map +1 -1
- package/dist/core/from/overlap-groups.js.map +1 -1
- package/dist/core/from/periods.js.map +1 -1
- package/dist/core/from/persons.js.map +1 -1
- package/dist/core/from/root-intervals.js.map +1 -1
- package/dist/core/from/schedules.js.map +1 -1
- package/dist/core/from/syllabuses.js.map +1 -1
- package/dist/core/from/teachers.js.map +1 -1
- package/dist/core/index.d.ts +24 -1
- package/dist/core/index.js +4 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/interfaces/index.d.ts +23 -0
- package/dist/core/interfaces/index.js +6 -0
- package/dist/core/interfaces/other/companies.d.ts +132 -0
- package/dist/core/interfaces/other/companies.js +9 -0
- package/dist/core/interfaces/other/companies.js.map +1 -0
- package/dist/core/interfaces/other/etc.d.ts +19 -0
- package/dist/core/interfaces/other/index.d.ts +6 -0
- package/dist/core/interfaces/other/integrations.d.ts +17 -0
- package/dist/core/interfaces/other/operations.d.ts +36 -0
- package/dist/core/interfaces/other/policies.d.ts +31 -0
- package/dist/core/interfaces/other/sync-logs.d.ts +21 -0
- package/dist/core/interfaces/other/users.d.ts +35 -0
- package/dist/core/interfaces/vertices/companies.d.ts +8 -0
- package/dist/core/interfaces/vertices/configurations.d.ts +58 -0
- package/dist/core/interfaces/vertices/courses.d.ts +68 -0
- package/dist/core/{types → interfaces/vertices}/division-settings.d.ts +31 -29
- package/dist/core/interfaces/vertices/divisions.d.ts +31 -0
- package/dist/core/interfaces/vertices/events.d.ts +100 -0
- package/dist/core/interfaces/vertices/exceptions.d.ts +74 -0
- package/dist/core/interfaces/vertices/generations.d.ts +23 -0
- package/dist/core/interfaces/vertices/groups.d.ts +53 -0
- package/dist/core/interfaces/vertices/index.d.ts +209 -0
- package/dist/core/interfaces/vertices/index.js +3 -0
- package/dist/core/interfaces/vertices/locations.d.ts +22 -0
- package/dist/core/interfaces/vertices/locked-times.d.ts +37 -0
- package/dist/core/interfaces/vertices/overlap-groups.d.ts +17 -0
- package/dist/core/interfaces/vertices/periods.d.ts +15 -0
- package/dist/core/interfaces/vertices/persons.d.ts +32 -0
- package/dist/core/interfaces/vertices/properties/belongs-to.d.ts +11 -0
- package/dist/core/interfaces/vertices/properties/coalesced.d.ts +8 -0
- package/dist/core/interfaces/vertices/properties/days.d.ts +9 -0
- package/dist/core/interfaces/vertices/properties/index.d.ts +15 -0
- package/dist/core/interfaces/vertices/properties/intervals.d.ts +10 -0
- package/dist/core/{types/common → interfaces/vertices/properties}/maximum-schedule-span.d.ts +1 -1
- package/dist/core/interfaces/vertices/properties/min-break-length.d.ts +5 -0
- package/dist/core/{types/common/planned-schedule-duration.d.ts → interfaces/vertices/properties/planned-scheduled-duration.d.ts} +2 -2
- package/dist/core/interfaces/vertices/properties/species.d.ts +9 -0
- package/dist/core/interfaces/vertices/properties/tags.d.ts +9 -0
- package/dist/core/interfaces/vertices/properties/week.d.ts +22 -0
- package/dist/core/interfaces/vertices/properties/week.js +6 -0
- package/dist/core/interfaces/vertices/properties/week.js.map +1 -0
- package/dist/core/interfaces/vertices/root-intervals.d.ts +14 -0
- package/dist/core/interfaces/vertices/syllabuses.d.ts +18 -0
- package/dist/core/interfaces/vertices/teachers.d.ts +43 -0
- package/dist/core/interfaces/vertices/users.d.ts +8 -0
- package/dist/core/interfaces/vertices/util/common.d.ts +28 -0
- package/dist/core/interfaces/vertices/util/custom-vertex-export/index.d.ts +31 -0
- package/dist/core/interfaces/vertices/util/custom-vertex-export/util.d.ts +51 -0
- package/dist/core/interfaces/vertices/util/deep-vertex-export/index.d.ts +64 -0
- package/dist/core/interfaces/vertices/util/edges.d.ts +105 -0
- package/dist/core/interfaces/vertices/util/index.d.ts +5 -0
- package/dist/core/interfaces/vertices/util/keys-of.d.ts +27 -0
- package/dist/core/interfaces/vertices/util/serialized-vertex-export.d.ts +12 -0
- package/dist/core/interfaces/vertices/util/util.d.ts +76 -0
- package/dist/core/interfaces/vertices/util/vertex-query/index.d.ts +44 -0
- package/dist/core/interfaces/vertices/util/vertex-query/util.d.ts +13 -0
- package/dist/core/interfaces/vertices/util/vertex.d.ts +70 -0
- package/dist/core/interfaces/vertices/vertex-query.d.ts +102 -0
- package/dist/core/interfaces/vertices/vertex-query.js +94 -0
- package/dist/core/interfaces/vertices/vertex-query.js.map +1 -0
- package/dist/core/to/configurations.js +2 -3
- package/dist/core/to/configurations.js.map +1 -1
- package/dist/core/to/courses.js +2 -3
- package/dist/core/to/courses.js.map +1 -1
- package/dist/core/to/division.js.map +1 -1
- package/dist/core/to/events.js +2 -3
- package/dist/core/to/events.js.map +1 -1
- package/dist/core/to/exceptions.js +4 -4
- package/dist/core/to/exceptions.js.map +1 -1
- package/dist/core/to/groups.js +2 -3
- package/dist/core/to/groups.js.map +1 -1
- package/dist/core/to/locations.js +2 -3
- package/dist/core/to/locations.js.map +1 -1
- package/dist/core/to/locked-times.js +2 -3
- package/dist/core/to/locked-times.js.map +1 -1
- package/dist/core/to/overlap-groups.js +2 -3
- package/dist/core/to/overlap-groups.js.map +1 -1
- package/dist/core/to/periods.js +2 -3
- package/dist/core/to/periods.js.map +1 -1
- package/dist/core/to/persons.js +3 -9
- package/dist/core/to/persons.js.map +1 -1
- package/dist/core/to/root-intervals.js +2 -3
- package/dist/core/to/root-intervals.js.map +1 -1
- package/dist/core/to/schedules.d.ts +17 -18
- package/dist/core/to/schedules.js.map +1 -1
- package/dist/core/to/settings.js +2 -3
- package/dist/core/to/settings.js.map +1 -1
- package/dist/core/to/syllabuses.js +2 -3
- package/dist/core/to/syllabuses.js.map +1 -1
- package/dist/core/to/teachers.js +4 -4
- package/dist/core/to/teachers.js.map +1 -1
- package/dist/core/to/util.d.ts +4 -8
- package/dist/core/to/util.js +7 -5
- package/dist/core/to/util.js.map +1 -1
- package/dist/core/types/common/index.d.ts +4 -41
- package/dist/core/types/index.d.ts +108 -112
- package/dist/core/util.js +4 -5
- package/dist/core/util.js.map +1 -1
- package/dist/identify/constants/index.d.ts +1 -1
- package/dist/identify/constants/index.js.map +1 -1
- package/dist/identify/index.js +1 -2
- package/dist/identify/index.js.map +1 -1
- package/dist/index.d.ts +23 -1
- package/dist/index.js +4 -1
- package/dist/sdui/from/classes.js.map +1 -1
- package/dist/sdui/from/courses.js.map +1 -1
- package/dist/sdui/from/holidays.js.map +1 -1
- package/dist/sdui/from/index.js.map +1 -1
- package/dist/sdui/from/lessons.js +4 -0
- package/dist/sdui/from/lessons.js.map +1 -1
- package/dist/sdui/from/rooms.js.map +1 -1
- package/dist/sdui/from/schedules.d.ts +10 -8
- package/dist/sdui/from/schedules.js.map +1 -1
- package/dist/sdui/from/school-years.js +0 -1
- package/dist/sdui/from/school-years.js.map +1 -1
- package/dist/sdui/from/substitution-plans.js.map +1 -1
- package/dist/sdui/from/teachers.js.map +1 -1
- package/dist/sdui/index.d.ts +1 -1
- package/dist/sdui/to/classes.js.map +1 -1
- package/dist/sdui/to/courses.js.map +1 -1
- package/dist/sdui/to/holidays.js.map +1 -1
- package/dist/sdui/to/hours.js.map +1 -1
- package/dist/sdui/to/index.d.ts +12 -10
- package/dist/sdui/to/lessons.js.map +1 -1
- package/dist/sdui/to/rooms.js.map +1 -1
- package/dist/sdui/to/schedules.js.map +1 -1
- package/dist/sdui/to/school-years.js.map +1 -1
- package/dist/sdui/to/substitution-plans.js +3 -6
- package/dist/sdui/to/substitution-plans.js.map +1 -1
- package/dist/sdui/to/teachers.js.map +1 -1
- package/dist/vKlass/from/index.js.map +1 -1
- package/dist/vKlass/from/schedule.d.ts +4 -3
- package/dist/vKlass/from/schedule.js +2 -2
- package/dist/vKlass/from/schedule.js.map +1 -1
- package/dist/vKlass/to/schedules.d.ts +4 -4
- package/dist/vKlass/to/schedules.js +6 -17
- package/dist/vKlass/to/schedules.js.map +1 -1
- package/package.json +24 -22
- package/dist/core/types/areas.d.ts +0 -10
- package/dist/core/types/common/break-lengths.d.ts +0 -5
- package/dist/core/types/common/days.d.ts +0 -8
- package/dist/core/types/common/intervals.d.ts +0 -20
- package/dist/core/types/common/tag.d.ts +0 -9
- package/dist/core/types/configurations.d.ts +0 -31
- package/dist/core/types/courses.d.ts +0 -60
- package/dist/core/types/divisions.d.ts +0 -24
- package/dist/core/types/events.d.ts +0 -56
- package/dist/core/types/exceptions.d.ts +0 -35
- package/dist/core/types/groups.d.ts +0 -44
- package/dist/core/types/locations.d.ts +0 -27
- package/dist/core/types/locked-times.d.ts +0 -33
- package/dist/core/types/overlap-groups.d.ts +0 -14
- package/dist/core/types/periods.d.ts +0 -14
- package/dist/core/types/persons.d.ts +0 -38
- package/dist/core/types/root-intervals.d.ts +0 -13
- package/dist/core/types/schedules.d.ts +0 -44
- package/dist/core/types/syllabus.d.ts +0 -18
- package/dist/core/types/teachers.d.ts +0 -44
- package/dist/core/vertex-mapping.d.ts +0 -69
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ExpandKey, SelectKey } from "../common.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/interfaces/vertices/util/custom-vertex-export/util.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Lookup type that returns the value type for key K in object Obj,
|
|
7
|
+
*/
|
|
8
|
+
type Lookup<Obj, K$1> = K$1 extends keyof Obj ? Obj[K$1] : never;
|
|
9
|
+
/**
|
|
10
|
+
* Intersect two expand/select specifications.
|
|
11
|
+
*
|
|
12
|
+
* - For the SelectKey ('select'): returns an array whose element type is the
|
|
13
|
+
* intersection of the element types from A and B, preserving null/undefined from A.
|
|
14
|
+
* - For the ExpandKey ('expand'): keeps only keys present in both A and B and
|
|
15
|
+
* recurses into their sub-specs.
|
|
16
|
+
* - Other keys are dropped.
|
|
17
|
+
*
|
|
18
|
+
* Useful to constrain a requested expand/select spec (A) by an allowed/spec (B),
|
|
19
|
+
* yielding only the common subset.
|
|
20
|
+
*/
|
|
21
|
+
type IntersectExpandSelectPath<A, B$1> = [A] extends [never] ? never : { [K in keyof A & keyof B$1]: K extends SelectKey ? NonNullable<A[K]> extends (infer V1)[] ? NonNullable<B$1[K]> extends (infer V2)[] ? (V1 & V2)[] | Extract<A[K], null | undefined> : never : never : K extends ExpandKey ? { [S in keyof A[K] & keyof B$1[K]]: A[K][S] extends object ? B$1[K][S] extends object ? IntersectExpandSelectPath<A[K][S], B$1[K][S]> : never : never } : never };
|
|
22
|
+
/**
|
|
23
|
+
* Extracts the parent keys from a set of dot-notation keys.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* Keys: 'a' | 'b.1' | 'c.2' | 'd' => 'a' | 'b' | 'c' | 'd'
|
|
27
|
+
*/
|
|
28
|
+
type ExtractParentKeys<Keys extends keyof any> = Keys extends `${infer B}.${string}` ? B : Keys;
|
|
29
|
+
/**
|
|
30
|
+
* Extracts the child keys from a set of dot-notation keys, given a parent key.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ParentKey: 'a'
|
|
34
|
+
* Keys: 'a' | 'a.1' | 'a.2' | 'b.1' | 'c' => '1' | '2'
|
|
35
|
+
*/
|
|
36
|
+
type ExtractChildKeys<Keys extends keyof any, ParentKey extends string> = Keys extends `${ParentKey}.${infer K}` ? K : never;
|
|
37
|
+
/**
|
|
38
|
+
* Extracts the child object from an object, given a parent key.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ParentKey: 'a'
|
|
42
|
+
* Object: { 'a': string; 'a.1': number; 'a.2': boolean; 'b.1': string; 'c': Date } => { '1': number; '2': boolean }
|
|
43
|
+
*/
|
|
44
|
+
type ExtractChildObject<Object$1, ParentKey> = { [K in keyof Object$1 as K extends `${ParentKey & string}.${infer S}` ? S : never]: Object$1[K] };
|
|
45
|
+
/**
|
|
46
|
+
* Does the same as the built-in Pick<T, Keys>, but does not restrict the Keys to keyof T. Nullish and undefined values are preserved.
|
|
47
|
+
*/
|
|
48
|
+
type RelaxedPick<T extends object | null | undefined, Keys extends keyof any> = Extract<T, null | undefined> | (T extends object ? { [K in keyof NonNullable<T> as K extends Keys ? K : never]: NonNullable<T>[K] } : never);
|
|
49
|
+
//#endregion
|
|
50
|
+
export { ExtractChildKeys, ExtractChildObject, ExtractParentKeys, IntersectExpandSelectPath, Lookup, RelaxedPick };
|
|
51
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Collection, IDKey, IDType, OmitInternalVertexKeys, PrivateIDKey, PrivateIDType, Vertex } from "../vertex.js";
|
|
2
|
+
import { AvailableLocation, Coalesced, EdgeBase, EdgeWrapper, GroupWithExclude, Plain, Wrapped } from "../edges.js";
|
|
3
|
+
import { ExtractNullish, Prettify, SetMultiplicity } from "../util.js";
|
|
4
|
+
import { Decrement, MaxDepth, MinDepth, OmitEdges, PickEdges, SupportedDepths } from "../common.js";
|
|
5
|
+
|
|
6
|
+
//#region src/core/interfaces/vertices/util/deep-vertex-export/index.d.ts
|
|
7
|
+
type ExportOptions = {
|
|
8
|
+
mixed?: boolean;
|
|
9
|
+
optionalId?: boolean;
|
|
10
|
+
omitPrivateId?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type IDTypes = IDType | PrivateIDType;
|
|
13
|
+
declare namespace HandleEdge {
|
|
14
|
+
type Recursion<V extends Vertex<Collection>, D extends SupportedDepths, Opts extends ExportOptions> = _DeepVertexExport<V, Decrement<D>, Opts> | (Opts['mixed'] extends true ? IDTypes : never);
|
|
15
|
+
export type Plain<E$1 extends EdgeBase<any, any>, D extends SupportedDepths, Opts extends ExportOptions> = E$1 extends Plain.Edge<infer V> ? Recursion<V, D, Opts> : never;
|
|
16
|
+
export type Wrapped<E$1 extends EdgeBase<any, any>, D extends SupportedDepths, Opts extends ExportOptions> = E$1 extends Wrapped.Edge<infer K, infer V extends Vertex<any>, infer Extra extends object> ? Wrapped.Util.Value<K, Recursion<V, D, Opts>, Extra> : never;
|
|
17
|
+
export type Coalesced<E$1 extends EdgeBase<any, any>, D extends SupportedDepths, Opts extends ExportOptions> = E$1 extends Coalesced.Edge<infer V, infer O extends object, infer Extra extends object> ? V extends Vertex<Collection> ? Coalesced.Util.Value<Recursion<V, D, Opts>, Coalesced.Util.ToModel<V>, O, Extra> : never : never;
|
|
18
|
+
export type GroupWithExclude<E$1 extends EdgeBase<any, any>, D extends SupportedDepths, Opts extends ExportOptions> = E$1 extends GroupWithExclude.Edge<infer G extends Vertex<any>, infer P extends Vertex<any>, infer Extra extends object> ? GroupWithExclude.Util.Value<Recursion<G, D, Opts>, Recursion<P, D, Opts>, Extra> : never;
|
|
19
|
+
export type AvailableLocation<E$1 extends EdgeBase<any, any>, D extends SupportedDepths, Opts extends ExportOptions> = E$1 extends AvailableLocation.Edge<infer L extends Vertex<any>, infer Extra extends object> ? AvailableLocation.Util.Value<Recursion<L, D, Opts>, Extra> : never;
|
|
20
|
+
export {};
|
|
21
|
+
}
|
|
22
|
+
type _MinDepthType = any;
|
|
23
|
+
type TryPrettify<T> = 0 extends (1 & T) ? _MinDepthType : Prettify<T>;
|
|
24
|
+
type InternalIdKeys = IDKey | PrivateIDKey;
|
|
25
|
+
type PartialIf<T extends object, Condition extends boolean | undefined> = Condition extends true ? Partial<T> : T;
|
|
26
|
+
type OmitPrivateIdIf<T extends object, Condition extends boolean | undefined> = Condition extends true ? Omit<T, PrivateIDKey> : T;
|
|
27
|
+
type _DeepVertexExport<V extends Vertex<Collection>, D extends SupportedDepths, Opts extends ExportOptions> = D extends MinDepth ? _MinDepthType : Prettify<OmitPrivateIdIf<PartialIf<{ [K in keyof Pick<V, InternalIdKeys>]: V[K] }, Opts['optionalId']>, Opts['omitPrivateId']> & { [K in keyof Omit<OmitInternalVertexKeys<OmitEdges<V>>, InternalIdKeys>]: V[K] } & { [K in keyof PickEdges<V>]: [V[K]] extends [never] ? never : NonNullable<V[K]> extends EdgeWrapper<infer M, infer E extends EdgeBase<any, any> | null | undefined> ? (SetMultiplicity<TryPrettify<E extends EdgeBase<any, any> ? (HandleEdge.Plain<E, D, Opts> | HandleEdge.Wrapped<E, D, Opts> | HandleEdge.Coalesced<E, D, Opts> | HandleEdge.GroupWithExclude<E, D, Opts> | HandleEdge.AvailableLocation<E, D, Opts>) : E>, M> | ExtractNullish<V[K]>) : never }>;
|
|
28
|
+
/**
|
|
29
|
+
* Recursively transforms a Vertex type into a deeply exported, plain object structure.
|
|
30
|
+
* - Non-edge properties are preserved as-is.
|
|
31
|
+
* - Edge properties are expanded according to their edge type (Plain, Coalesced, GroupWithExclude, AvailableLocation).
|
|
32
|
+
* - Invalid or unsupported edge unions are filtered out as `never`.
|
|
33
|
+
* - Handles multiplicity (single/array) and optional/null edge cases.
|
|
34
|
+
* - There is a maximum recursion depth to increase performance.
|
|
35
|
+
* - Once the maximum depth is reached, all vertices are represented as `any`.
|
|
36
|
+
*/
|
|
37
|
+
type DeepVertexExport<V extends Vertex<Collection>> = _DeepVertexExport<V, MaxDepth, {
|
|
38
|
+
mixed: false;
|
|
39
|
+
optionalId: false;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Similar to {@link DeepVertexExport}, but each edge is represented as both the fully expanded object
|
|
43
|
+
* and the vertex ID (`string | ObjectId`).
|
|
44
|
+
*/
|
|
45
|
+
type MixedVertexExport<V extends Vertex<Collection>> = _DeepVertexExport<V, MaxDepth, {
|
|
46
|
+
mixed: true;
|
|
47
|
+
optionalId: false;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Similar to {@link MixedVertexExport}, but the ID fields (`_id` and `id`) are optional.
|
|
51
|
+
*/
|
|
52
|
+
type MixedWithOptionalIdVertexExport<V extends Vertex<Collection>> = _DeepVertexExport<V, MaxDepth, {
|
|
53
|
+
mixed: true;
|
|
54
|
+
optionalId: true;
|
|
55
|
+
}>;
|
|
56
|
+
/**
|
|
57
|
+
* Similar to {@link DeepVertexExport}, but omits the private ID field (`_id`) from the exported type.
|
|
58
|
+
*/
|
|
59
|
+
type DeepVertexExportOmitPrivateId<V extends Vertex<Collection>> = _DeepVertexExport<V, MaxDepth, {
|
|
60
|
+
omitPrivateId: true;
|
|
61
|
+
}>;
|
|
62
|
+
//#endregion
|
|
63
|
+
export { DeepVertexExport, DeepVertexExportOmitPrivateId, IDTypes, MixedVertexExport, MixedWithOptionalIdVertexExport };
|
|
64
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { Collection, Vertex } from "./vertex.js";
|
|
2
|
+
import { AllTrue, IsUnion, NoneIsUnion } from "./util.js";
|
|
3
|
+
|
|
4
|
+
//#region src/core/interfaces/vertices/util/edges.d.ts
|
|
5
|
+
declare const EDGE_TYPE_ID_KEY = "__edge_type_id";
|
|
6
|
+
declare const EDGE_INVALID_KEY = "__invalid";
|
|
7
|
+
declare const EDGE_VALUE_KEY = "__value";
|
|
8
|
+
type EdgeValueKey = typeof EDGE_VALUE_KEY;
|
|
9
|
+
type EdgeTypeIdValues = {
|
|
10
|
+
PLAIN: 'PLAIN';
|
|
11
|
+
WRAPPED: 'WRAPPED';
|
|
12
|
+
COALESCED: 'COALESCED';
|
|
13
|
+
GROUP_WITH_EXCLUDE: 'GROUP_WITH_EXCLUDE';
|
|
14
|
+
AVAILABLE_LOCATION: 'AVAILABLE_LOCATION';
|
|
15
|
+
};
|
|
16
|
+
type EdgeTypeIdValue = (EdgeTypeIdValues)[keyof EdgeTypeIdValues];
|
|
17
|
+
type EdgeBase<ID extends EdgeTypeIdValue, Invalid extends boolean> = {
|
|
18
|
+
[EDGE_TYPE_ID_KEY]: ID;
|
|
19
|
+
[EDGE_INVALID_KEY]: Invalid;
|
|
20
|
+
};
|
|
21
|
+
type EdgeIsValid<T extends EdgeBase<any, any>> = [T] extends [{
|
|
22
|
+
[EDGE_INVALID_KEY]: false;
|
|
23
|
+
}] ? true : false;
|
|
24
|
+
declare namespace Plain {
|
|
25
|
+
namespace Util {}
|
|
26
|
+
type Edge<V$1 extends Vertex<Collection>> = EdgeBase<EdgeTypeIdValues['PLAIN'], NoneIsUnion<[V$1]> extends never ? true : false> & {
|
|
27
|
+
[EDGE_VALUE_KEY]: V$1;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
declare namespace Wrapped {
|
|
31
|
+
namespace Util {
|
|
32
|
+
type Options<T extends string> = {
|
|
33
|
+
key: T;
|
|
34
|
+
};
|
|
35
|
+
type Value<K extends string, To, Extra = object> = Extra & { [k in K]: To };
|
|
36
|
+
}
|
|
37
|
+
type Edge<K extends string, V$1 extends Vertex<Collection>, E extends object = object> = EdgeBase<EdgeTypeIdValues['WRAPPED'], NoneIsUnion<[K, V$1]> extends never ? true : false> & {
|
|
38
|
+
[EDGE_VALUE_KEY]: Util.Value<K, V$1, E>;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
declare namespace Coalesced {
|
|
42
|
+
namespace Util {
|
|
43
|
+
export namespace Keys {
|
|
44
|
+
const TO = "to";
|
|
45
|
+
type To = typeof TO;
|
|
46
|
+
const TO_MODEL = "toModel";
|
|
47
|
+
type ToModel = typeof TO_MODEL;
|
|
48
|
+
}
|
|
49
|
+
export type Options = {
|
|
50
|
+
optional?: boolean;
|
|
51
|
+
};
|
|
52
|
+
type makePartial<T, O extends Options> = O extends {
|
|
53
|
+
optional: true;
|
|
54
|
+
} ? Partial<T> : T;
|
|
55
|
+
export type ToModel<V$1 extends Vertex<Collection>> = V$1 extends Vertex<infer C> ? C extends 'events' ? C | 'courseevents' : C : never;
|
|
56
|
+
export type Value<To, ToModel, Opts extends Util.Options = object, Extra = object> = Extra & makePartial<{
|
|
57
|
+
[Keys.TO]: To;
|
|
58
|
+
[Keys.TO_MODEL]: ToModel;
|
|
59
|
+
}, Opts>;
|
|
60
|
+
export {};
|
|
61
|
+
}
|
|
62
|
+
type Edge<V$1 extends Vertex<Collection>, Opts extends Util.Options = object, E extends object = object> = EdgeBase<EdgeTypeIdValues['COALESCED'], NoneIsUnion<[V$1]> extends never ? true : false> & {
|
|
63
|
+
[EDGE_VALUE_KEY]: Util.Value<V$1, Util.ToModel<V$1>, Opts, E>;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
declare namespace GroupWithExclude {
|
|
67
|
+
namespace Util {
|
|
68
|
+
namespace Keys {
|
|
69
|
+
const TO = "to";
|
|
70
|
+
type To = typeof TO;
|
|
71
|
+
const EXCLUDE = "exclude";
|
|
72
|
+
type Exclude = typeof EXCLUDE;
|
|
73
|
+
}
|
|
74
|
+
type Value<To, Exclude, Extra = object> = Extra & {
|
|
75
|
+
[Keys.TO]: To;
|
|
76
|
+
[Keys.EXCLUDE]?: Exclude[];
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
type Edge<G extends Vertex<Collection>, P extends Vertex<Collection>, E extends object = object> = EdgeBase<EdgeTypeIdValues['GROUP_WITH_EXCLUDE'], NoneIsUnion<[G, P]> extends never ? true : false> & {
|
|
80
|
+
[EDGE_VALUE_KEY]: Util.Value<G, P[], E>;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
declare namespace AvailableLocation {
|
|
84
|
+
namespace Util {
|
|
85
|
+
namespace Keys {
|
|
86
|
+
const LOCATIONS = "locations";
|
|
87
|
+
type Locations = typeof LOCATIONS;
|
|
88
|
+
}
|
|
89
|
+
type Value<L, Extra = object> = Extra & {
|
|
90
|
+
[Keys.LOCATIONS]: [L];
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
type Edge<L extends Vertex<Collection>, E extends object = object> = EdgeBase<EdgeTypeIdValues['AVAILABLE_LOCATION'], NoneIsUnion<[L]> extends never ? true : false> & {
|
|
94
|
+
[EDGE_VALUE_KEY]: Util.Value<L, E>;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
type AllowedEdgeType<T extends EdgeBase<EdgeTypeIdValue, boolean>> = IsUnion<T> extends never ? true : T extends Coalesced.Edge<any, any> ? true : false;
|
|
98
|
+
type EdgeMultiplicity = 'single' | 'array';
|
|
99
|
+
type EdgeWrapper<M extends EdgeMultiplicity, T extends EdgeBase<EdgeTypeIdValue, boolean> | null | undefined> = AllTrue<[AllowedEdgeType<NonNullable<T>>, EdgeIsValid<NonNullable<T>>]> extends false ? never : {
|
|
100
|
+
__edge_multiplicity: M;
|
|
101
|
+
__edge_type: T;
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { AvailableLocation, Coalesced, EdgeBase, EdgeMultiplicity, EdgeValueKey, EdgeWrapper, GroupWithExclude, Plain, Wrapped };
|
|
105
|
+
//# sourceMappingURL=edges.d.ts.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Collection, PseudoCollection, RealCollection, Vertex, VertexFactory } from "./vertex.js";
|
|
2
|
+
import { AvailableLocation, Coalesced, EdgeWrapper, GroupWithExclude, Plain, Wrapped } from "./edges.js";
|
|
3
|
+
import { CustomVertexExport } from "./custom-vertex-export/index.js";
|
|
4
|
+
import { DeepVertexExport, MixedVertexExport, MixedWithOptionalIdVertexExport } from "./deep-vertex-export/index.js";
|
|
5
|
+
import { SerializedVertexExport } from "./serialized-vertex-export.js";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Collection, OmitInternalVertexKeys, Vertex } from "./vertex.js";
|
|
2
|
+
import { EdgeBase, EdgeValueKey, EdgeWrapper } from "./edges.js";
|
|
3
|
+
import { AllKeys } from "./util.js";
|
|
4
|
+
import { ExpandKey, RemoveNeverValues, SelectKey } from "./common.js";
|
|
5
|
+
import { VertexQuery } from "./vertex-query/index.js";
|
|
6
|
+
|
|
7
|
+
//#region src/core/interfaces/vertices/util/keys-of.d.ts
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Returns all possible keys of a vertex, including nested keys in dot-notation for edges.
|
|
11
|
+
*/
|
|
12
|
+
type AllKeysOf<V extends Vertex<Collection>> = keyof { [K in keyof RemoveNeverValues<OmitInternalVertexKeys<V>> as NonNullable<V[K]> extends EdgeWrapper<any, infer E extends EdgeBase<any, any> | null | undefined> ? EdgeValueKey extends keyof NonNullable<E> ? NonNullable<E>[EdgeValueKey] extends Vertex<Collection> ? K : AllKeys<NonNullable<E>[EdgeValueKey]> extends (infer S extends string) ? K | `${K}.${S}` : never : never : K]-?: true };
|
|
13
|
+
/**
|
|
14
|
+
* combines keys from 'select' and 'expand' and defaults to all keys if neither is specified
|
|
15
|
+
*/
|
|
16
|
+
type _CombinePaths<V extends Vertex<any>, Q extends VertexQuery<V>> = ExpandKey extends keyof Q ? SelectKey extends keyof Q ? NonNullable<Q[SelectKey]>[number] | keyof Q[ExpandKey] : keyof Q[ExpandKey] : SelectKey extends keyof Q ? NonNullable<Q[SelectKey]>[number] : keyof OmitInternalVertexKeys<V>;
|
|
17
|
+
/**
|
|
18
|
+
* Replaces all top-level keys with the full paths of their children, if they have any.
|
|
19
|
+
*/
|
|
20
|
+
type _FlattenKeys<Keys, AvailableKeys> = Keys extends (infer K extends string) ? [Extract<AvailableKeys, `${K}.${string}`>] extends [never] ? K : Extract<AvailableKeys, `${K}.${string}`> : never;
|
|
21
|
+
/**
|
|
22
|
+
* Given a vertex type and expand/select paths, returns the corresponding fully flattened (using dot-notation) keys.
|
|
23
|
+
*/
|
|
24
|
+
type KeysOf<V extends Vertex<any>, Q extends VertexQuery<V>> = _FlattenKeys<_CombinePaths<V, Q>, AllKeysOf<V>>;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { AllKeysOf, KeysOf };
|
|
27
|
+
//# sourceMappingURL=keys-of.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Collection, Vertex } from "./vertex.js";
|
|
2
|
+
import { CustomVertexExport } from "./custom-vertex-export/index.js";
|
|
3
|
+
|
|
4
|
+
//#region src/core/interfaces/vertices/util/serialized-vertex-export.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
type SerializedVertexExport<V extends Vertex<Collection>> = CustomVertexExport<V, object>;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { SerializedVertexExport };
|
|
12
|
+
//# sourceMappingURL=serialized-vertex-export.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { EdgeMultiplicity } from "./edges.js";
|
|
2
|
+
|
|
3
|
+
//#region src/core/interfaces/vertices/util/util.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Similar to O[K], but does not require K to be a key of O. Extracts the property K from each member of the possible union types in U.
|
|
7
|
+
*/
|
|
8
|
+
type GetByKey<O, K$1 extends keyof any> = O extends { [P in K$1]: infer T } ? T : O extends { [P in K$1]?: infer T } ? T | undefined : never;
|
|
9
|
+
/**
|
|
10
|
+
* keyof { a1: ..., a2: ..., ... } | { b1: ..., b2: ..., ... } | ... => 'a1' | 'a2' | ... | 'b1' | 'b2' | ...
|
|
11
|
+
*/
|
|
12
|
+
type AllKeys<U$1> = U$1 extends any ? keyof U$1 : never;
|
|
13
|
+
declare namespace MakeMixedNs {
|
|
14
|
+
type ExtractArrayType<T$1> = T$1 extends Array<any> ? T$1 : never;
|
|
15
|
+
type ExtractObjectType<T$1> = T$1 extends Array<any> ? never : T$1 extends object ? T$1 : never;
|
|
16
|
+
type _MakeMixedArray<T$1 extends any[]> = [T$1] extends [never] ? never : (T$1 extends Array<infer U> ? U : never) extends infer U ? Array<MakeMixed<U>> : never;
|
|
17
|
+
type _MakeMixedObject<T$1 extends object> = [T$1] extends [never] ? never : { [K in AllKeys<T$1>]: MakeMixed<GetByKey<T$1, K>> };
|
|
18
|
+
export type MakeMixed<T$1> = (ExtractArrayType<T$1> extends (infer V extends any[]) ? _MakeMixedArray<V> : never) | (ExtractObjectType<T$1> extends (infer V extends object) ? _MakeMixedObject<V> : never) | (T$1 extends object ? never : T$1);
|
|
19
|
+
export {};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Merges a union of types into a single type by combining properties of object types and merging array element types.
|
|
23
|
+
*/
|
|
24
|
+
type MakeMixed<T$1> = MakeMixedNs.MakeMixed<T$1>;
|
|
25
|
+
/**
|
|
26
|
+
* Deep partial type that allows for partial properties at any level of nesting.
|
|
27
|
+
*/
|
|
28
|
+
type DeepPartial<T$1> = T$1 extends Array<infer U> ? Array<DeepPartial<U>> : T$1 extends object ? { [K in keyof T$1]?: DeepPartial<T$1[K]> } : T$1;
|
|
29
|
+
type _IsUnion<T$1, U$1 = T$1> = T$1 extends any ? [U$1] extends [T$1] ? false : true : never;
|
|
30
|
+
/**
|
|
31
|
+
* Lets a type pass if it is a union type, otherwise returns `never`.
|
|
32
|
+
*/
|
|
33
|
+
type IsUnion<T$1> = _IsUnion<T$1> extends true ? T$1 : never;
|
|
34
|
+
/**
|
|
35
|
+
* Returns never if any type in the tuple is a union, otherwise returns the tuple.
|
|
36
|
+
*/
|
|
37
|
+
type NoneIsUnion<T$1 extends any[]> = AnyUnion<T$1> extends true ? never : T$1;
|
|
38
|
+
type AnyUnion<T$1 extends any[]> = T$1 extends [infer Head, ...infer Tail] ? _IsUnion<Head> extends true ? true : AnyUnion<Tail extends any[] ? Tail : []> : false;
|
|
39
|
+
/**
|
|
40
|
+
* Returns `true` if every element in the tuple is `true`, otherwise returns `false`.
|
|
41
|
+
* Returns `never` for an empty tuple.
|
|
42
|
+
*/
|
|
43
|
+
type AllTrue<T$1 extends any[]> = T$1 extends [] ? never : _AllTrue<T$1>;
|
|
44
|
+
type _AllTrue<T$1 extends any[]> = T$1 extends [infer Head, ...infer Tail] ? Head extends true ? Tail extends any[] ? _AllTrue<Tail> : never : false : true;
|
|
45
|
+
/**
|
|
46
|
+
* Returns the tail of a tuple, or `never` if the tuple is empty.
|
|
47
|
+
*/
|
|
48
|
+
type Tail<T$1 extends any[]> = T$1 extends [any, ...infer V extends [any, ...any[]]] ? Tail<V> : T$1 extends [infer U] ? U : never;
|
|
49
|
+
/**
|
|
50
|
+
* Prettify<T>
|
|
51
|
+
* Materializes T into a plain object type for clearer tooltips and stable structural equality.
|
|
52
|
+
*
|
|
53
|
+
* Preserves:
|
|
54
|
+
* - Keys, property types, and readonly/optional modifiers (homomorphic mapping).
|
|
55
|
+
*
|
|
56
|
+
* Useful for:
|
|
57
|
+
* - Flattening intersections and mapped types into a single object-like shape so
|
|
58
|
+
* libraries like ts-expect's TypeEqual consider two equivalent types equal.
|
|
59
|
+
*
|
|
60
|
+
* Notes:
|
|
61
|
+
* - Does not change semantics or add/remove properties.
|
|
62
|
+
* - Inner unions remain unions; only the outer shape is normalized.
|
|
63
|
+
* - The `& {}` forces recomputation and a simpler displayed shape in editor/tooling.
|
|
64
|
+
*/
|
|
65
|
+
type Prettify<T$1> = { [K in keyof T$1]: T$1[K] } & {};
|
|
66
|
+
/**
|
|
67
|
+
* Wraps the given type T into an array if its multiplicity M is 'array'.
|
|
68
|
+
*/
|
|
69
|
+
type SetMultiplicity<T$1, M = EdgeMultiplicity> = M extends 'array' ? T$1[] : T$1;
|
|
70
|
+
/**
|
|
71
|
+
* Extracts null and undefined from a type T, resulting in `null | undefined` if both are present, otherwise `null`, `undefined`, or `never`.
|
|
72
|
+
*/
|
|
73
|
+
type ExtractNullish<T$1> = Extract<T$1, null | undefined>;
|
|
74
|
+
//#endregion
|
|
75
|
+
export { AllKeys, AllTrue, DeepPartial, ExtractNullish, IsUnion, MakeMixed, NoneIsUnion, Prettify, SetMultiplicity, Tail };
|
|
76
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Collection, Vertex } from "../vertex.js";
|
|
2
|
+
import { AvailableLocation, Coalesced, EdgeBase, EdgeMultiplicity, EdgeWrapper, GroupWithExclude, Plain, Wrapped } from "../edges.js";
|
|
3
|
+
import { DeepPartial, MakeMixed } from "../util.js";
|
|
4
|
+
import { Decrement, EXPAND_KEY, InvalidEdgeMessage, MaxDepth, MinDepth, PickEdges, RemoveNeverValues, SELECT_KEY, SupportedDepths } from "../common.js";
|
|
5
|
+
import { AllKeysOf } from "../keys-of.js";
|
|
6
|
+
import { FLATTEN_KEY, _Flatten } from "./util.js";
|
|
7
|
+
|
|
8
|
+
//#region src/core/interfaces/vertices/util/vertex-query/index.d.ts
|
|
9
|
+
declare namespace HandleEdge {
|
|
10
|
+
type Plain<E$1 extends EdgeBase<any, any>, D extends SupportedDepths> = E$1 extends Plain.Edge<infer U> ? _VertexQuery<U, D> : never;
|
|
11
|
+
type Wrapped<E$1 extends EdgeBase<any, any>, D extends SupportedDepths> = E$1 extends Wrapped.Edge<infer K extends string, infer V extends Vertex<Collection>, object> ? ({
|
|
12
|
+
[FLATTEN_KEY]: true;
|
|
13
|
+
} & { [k in K]: V extends any ? _VertexQuery<V, D> : never }) : never;
|
|
14
|
+
type Coalesced<E$1 extends EdgeBase<any, any>, D extends SupportedDepths> = (E$1 extends Coalesced.Edge<infer V, object, object> ? V : null) extends (infer V extends Vertex<Collection>) ? {
|
|
15
|
+
[FLATTEN_KEY]: true;
|
|
16
|
+
[Coalesced.Util.Keys.TO]: MakeMixed<
|
|
17
|
+
// must mix here to support all different vertex types
|
|
18
|
+
V extends any ? _VertexQuery<V, D> : never>;
|
|
19
|
+
} : never;
|
|
20
|
+
type GroupWithExclude<E$1 extends EdgeBase<any, any>, D extends SupportedDepths> = E$1 extends GroupWithExclude.Edge<infer G extends Vertex<Collection>, infer P extends Vertex<Collection>, object> ? {
|
|
21
|
+
[FLATTEN_KEY]: true;
|
|
22
|
+
[GroupWithExclude.Util.Keys.TO]: G extends any ? _VertexQuery<G, D> : never;
|
|
23
|
+
[GroupWithExclude.Util.Keys.EXCLUDE]: P extends any ? _VertexQuery<P, D> : never;
|
|
24
|
+
} : never;
|
|
25
|
+
type AvailableLocation<E$1 extends EdgeBase<any, any>, D extends SupportedDepths> = E$1 extends AvailableLocation.Edge<infer L extends Vertex<Collection>, object> ? {
|
|
26
|
+
[FLATTEN_KEY]: true;
|
|
27
|
+
[AvailableLocation.Util.Keys.LOCATIONS]: L extends any ? _VertexQuery<L, D> : never;
|
|
28
|
+
} : never;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
type _VertexQuery<V$1 extends Vertex<Collection>, D extends SupportedDepths> = D extends MinDepth ? any : {
|
|
34
|
+
[EXPAND_KEY]: { [K in keyof PickEdges<V$1> as V$1[K] extends never ? K : never]: InvalidEdgeMessage } & _Flatten<RemoveNeverValues<{ [K in keyof PickEdges<V$1> as V$1[K] extends never ? never : K]-?: NonNullable<V$1[K]> extends EdgeWrapper<EdgeMultiplicity, infer E extends EdgeBase<any, any> | null | undefined> ? (HandleEdge.Plain<NonNullable<E>, Decrement<D>> | HandleEdge.Wrapped<NonNullable<E>, Decrement<D>> | HandleEdge.Coalesced<NonNullable<E>, Decrement<D>> | HandleEdge.GroupWithExclude<NonNullable<E>, Decrement<D>> | HandleEdge.AvailableLocation<NonNullable<E>, Decrement<D>>) : never }>>;
|
|
35
|
+
} & {
|
|
36
|
+
[SELECT_KEY]: Array<AllKeysOf<V$1>>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
type VertexQuery<V$1 extends Vertex<Collection>> = DeepPartial<_VertexQuery<V$1, MaxDepth>>;
|
|
42
|
+
//#endregion
|
|
43
|
+
export { VertexQuery };
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/core/interfaces/vertices/util/vertex-query/util.d.ts
|
|
2
|
+
declare const FLATTEN_KEY = "__flatten";
|
|
3
|
+
type FlattenKey = typeof FLATTEN_KEY;
|
|
4
|
+
/**
|
|
5
|
+
* Flattens an object by replacing all keys that have a `{ [FLATTEN_KEY]: true }` marker with their child keys in dot-notation.
|
|
6
|
+
*/
|
|
7
|
+
type _Flatten<T extends object> = { [K in _FlattenedEntries<T> as K extends [infer A, any] ? A : never]: K extends [any, infer B] ? B : never };
|
|
8
|
+
type _FlattenedEntries<T extends object> = { [K in keyof T]: T[K] extends {
|
|
9
|
+
[FLATTEN_KEY]: true;
|
|
10
|
+
} ? { [S in keyof Omit<T[K], FlattenKey>]: [`${K & string}.${S & string}`, T[K][S]] }[keyof Omit<T[K], FlattenKey>] : [K, T[K]] }[keyof T];
|
|
11
|
+
//#endregion
|
|
12
|
+
export { FLATTEN_KEY, _Flatten };
|
|
13
|
+
//# sourceMappingURL=util.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Types } from "mongoose";
|
|
2
|
+
|
|
3
|
+
//#region src/core/interfaces/vertices/util/vertex.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
type RealCollection = 'settings' | 'divisionSettings' | 'exceptions' | 'groups' | 'teachers' | 'locations' | 'configurations' | 'courses' | 'events' | 'generations' | 'lockedTimes' | 'overlapGroups' | 'periods' | 'rootIntervals' | 'persons' | 'syllabuses' | 'divisions' | 'companies' | 'users';
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
*/
|
|
12
|
+
type PseudoCollection = 'scheduleEvents' | 'calendarEvents' | 'students';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
type Collection = RealCollection | PseudoCollection;
|
|
17
|
+
declare const ID_KEY = "id";
|
|
18
|
+
type IDKey = typeof ID_KEY;
|
|
19
|
+
type IDType = string;
|
|
20
|
+
declare const PRIVATE_ID_KEY = "_id";
|
|
21
|
+
type PrivateIDKey = typeof PRIVATE_ID_KEY;
|
|
22
|
+
type PrivateIDType = Types.ObjectId;
|
|
23
|
+
declare const PUBLIC_ID_KEY = "ids";
|
|
24
|
+
type PublicIDKey = typeof PUBLIC_ID_KEY;
|
|
25
|
+
declare const VERTEX_COLLECTION_KEY = "__vertex_collection";
|
|
26
|
+
type VertexCollectionKey = typeof VERTEX_COLLECTION_KEY;
|
|
27
|
+
type InternalVertexKeys = VertexCollectionKey;
|
|
28
|
+
type OmitInternalVertexKeys<T extends object> = Omit<T, InternalVertexKeys>;
|
|
29
|
+
type CollectionIsRecord = {
|
|
30
|
+
exceptions: 'exception';
|
|
31
|
+
groups: 'group';
|
|
32
|
+
teachers: 'teacher';
|
|
33
|
+
locations: 'location';
|
|
34
|
+
configurations: 'configuration';
|
|
35
|
+
courses: 'course';
|
|
36
|
+
events: 'event';
|
|
37
|
+
scheduleEvents: 'event';
|
|
38
|
+
generations: 'generation';
|
|
39
|
+
settings: 'setting';
|
|
40
|
+
divisionSettings: 'setting';
|
|
41
|
+
lockedTimes: 'lockedTime';
|
|
42
|
+
overlapGroups: 'overlapGroup';
|
|
43
|
+
periods: 'period';
|
|
44
|
+
rootIntervals: 'rootInterval';
|
|
45
|
+
persons: 'person';
|
|
46
|
+
syllabuses: 'syllabus';
|
|
47
|
+
divisions: 'division';
|
|
48
|
+
};
|
|
49
|
+
type CollectionToIs<C extends Collection> = C extends keyof CollectionIsRecord ? CollectionIsRecord[C] : never;
|
|
50
|
+
type Vertex<C extends Collection> = {
|
|
51
|
+
[ID_KEY]: IDType;
|
|
52
|
+
[PRIVATE_ID_KEY]: PrivateIDType;
|
|
53
|
+
[PUBLIC_ID_KEY]?: string;
|
|
54
|
+
is?: CollectionToIs<C>;
|
|
55
|
+
displayName?: string;
|
|
56
|
+
createdAt?: string;
|
|
57
|
+
updatedAt?: string;
|
|
58
|
+
/**
|
|
59
|
+
* @deprecated promote to an edge?
|
|
60
|
+
*/
|
|
61
|
+
lastModifiedBy?: string;
|
|
62
|
+
/** A helper property used solely by typescript to infer the a vertex */
|
|
63
|
+
[VERTEX_COLLECTION_KEY]: C;
|
|
64
|
+
};
|
|
65
|
+
type OmitVertexProperties<T extends object> = Omit<T, keyof Vertex<Collection>>;
|
|
66
|
+
type PickVertexProperties<T extends Vertex<Collection>> = Pick<T, keyof Vertex<Collection>>;
|
|
67
|
+
type VertexFactory<C extends Collection, T extends object = object> = Vertex<C> & T;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { Collection, IDKey, IDType, OmitInternalVertexKeys, OmitVertexProperties, PickVertexProperties, PrivateIDKey, PrivateIDType, PseudoCollection, PublicIDKey, RealCollection, Vertex, VertexFactory };
|
|
70
|
+
//# sourceMappingURL=vertex.d.ts.map
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { VertexQuery } from "./util/vertex-query/index.js";
|
|
2
|
+
import { CustomVertexExport } from "./util/custom-vertex-export/index.js";
|
|
3
|
+
import "./util/index.js";
|
|
4
|
+
import { PeriodVertex } from "./periods.js";
|
|
5
|
+
import { RootIntervalVertex } from "./root-intervals.js";
|
|
6
|
+
import { DivisionSettingsVertex } from "./division-settings.js";
|
|
7
|
+
import { GenerationVertex } from "./generations.js";
|
|
8
|
+
import { DivisionVertex } from "./divisions.js";
|
|
9
|
+
import { PersonVertex } from "./persons.js";
|
|
10
|
+
import { LocationVertex } from "./locations.js";
|
|
11
|
+
import { CalendarEventVertex, EventVertex, ScheduleEventVertex } from "./events.js";
|
|
12
|
+
import { OverlapGroupVertex } from "./overlap-groups.js";
|
|
13
|
+
import { SyllabusVertex } from "./syllabuses.js";
|
|
14
|
+
import { CourseVertex } from "./courses.js";
|
|
15
|
+
import { ExceptionVertex } from "./exceptions.js";
|
|
16
|
+
import { GroupVertex } from "./groups.js";
|
|
17
|
+
import { LockedTimeVertex } from "./locked-times.js";
|
|
18
|
+
import { TeacherVertex } from "./teachers.js";
|
|
19
|
+
import { CompanyVertex } from "./companies.js";
|
|
20
|
+
import { UserVertex } from "./users.js";
|
|
21
|
+
import { ConfigurationVertex } from "./configurations.js";
|
|
22
|
+
|
|
23
|
+
//#region src/core/interfaces/vertices/vertex-query.d.ts
|
|
24
|
+
type VertexRecord = {
|
|
25
|
+
divisions: DivisionVertex;
|
|
26
|
+
divisionSettings: DivisionSettingsVertex;
|
|
27
|
+
settings: DivisionSettingsVertex;
|
|
28
|
+
teachers: TeacherVertex;
|
|
29
|
+
exceptions: ExceptionVertex;
|
|
30
|
+
events: EventVertex;
|
|
31
|
+
scheduleEvents: ScheduleEventVertex;
|
|
32
|
+
calendarEvents: CalendarEventVertex;
|
|
33
|
+
courses: CourseVertex;
|
|
34
|
+
generations: GenerationVertex;
|
|
35
|
+
groups: GroupVertex;
|
|
36
|
+
locations: LocationVertex;
|
|
37
|
+
lockedTimes: LockedTimeVertex;
|
|
38
|
+
overlapGroups: OverlapGroupVertex;
|
|
39
|
+
periods: PeriodVertex;
|
|
40
|
+
persons: PersonVertex;
|
|
41
|
+
students: PersonVertex;
|
|
42
|
+
rootIntervals: RootIntervalVertex;
|
|
43
|
+
syllabuses: SyllabusVertex;
|
|
44
|
+
configurations: ConfigurationVertex;
|
|
45
|
+
companies: CompanyVertex;
|
|
46
|
+
users: UserVertex;
|
|
47
|
+
};
|
|
48
|
+
type BaseQueryRecord<C$1 extends keyof VertexRecord> = VertexQuery<VertexRecord[C$1]>;
|
|
49
|
+
/**
|
|
50
|
+
* See {@link createVertexQuery}
|
|
51
|
+
*/
|
|
52
|
+
declare class VertexQuery$1<C$1 extends keyof VertexRecord, Q$1 extends BaseQueryRecord<C$1>> {
|
|
53
|
+
private readonly _collection;
|
|
54
|
+
private readonly _query;
|
|
55
|
+
constructor(_collection: C$1, _query: Q$1);
|
|
56
|
+
get collection(): C$1;
|
|
57
|
+
get query(): Q$1;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Infers the result type for a query created via createVertexQuery.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* const personQuery = createVertexQuery('persons', { select: ['id', 'firstName'] });
|
|
64
|
+
* type PersonType = Infer<typeof personQuery>;
|
|
65
|
+
*/
|
|
66
|
+
type Infer<T extends VertexQuery$1<any, any>> = T extends VertexQuery$1<infer C, infer Q> ? CustomVertexExport<VertexRecord[C], Q> : never;
|
|
67
|
+
/**
|
|
68
|
+
* Builds a typed vertex query for a given vertex type using a select/expand shape.
|
|
69
|
+
*
|
|
70
|
+
* Use together with Infer<T> to obtain the serialized result type.
|
|
71
|
+
*
|
|
72
|
+
* @typeParam Q - The select/expand query shape for that vertex.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* const groupQuery = createVertexQuery.group({
|
|
76
|
+
* select: ['id', 'displayName'],
|
|
77
|
+
* expand: { members: { select: ['id'] } }
|
|
78
|
+
* });
|
|
79
|
+
* type GroupType = Infer<typeof groupQuery>;
|
|
80
|
+
*/
|
|
81
|
+
declare namespace createVertexQuery {
|
|
82
|
+
function division<Q$1 extends VertexQuery<DivisionVertex>>(query: Q$1): VertexQuery$1<"divisions", Q$1>;
|
|
83
|
+
function settings<Q$1 extends VertexQuery<DivisionSettingsVertex>>(query: Q$1): VertexQuery$1<"divisionSettings", Q$1>;
|
|
84
|
+
function exception<Q$1 extends VertexQuery<ExceptionVertex>>(query: Q$1): VertexQuery$1<"exceptions", Q$1>;
|
|
85
|
+
function event<Q$1 extends VertexQuery<EventVertex>>(query: Q$1): VertexQuery$1<"events", Q$1>;
|
|
86
|
+
function scheduleEvent<Q$1 extends VertexQuery<ScheduleEventVertex>>(query: Q$1): VertexQuery$1<"scheduleEvents", Q$1>;
|
|
87
|
+
function calendarEvent<Q$1 extends VertexQuery<CalendarEventVertex>>(query: Q$1): VertexQuery$1<"calendarEvents", Q$1>;
|
|
88
|
+
function course<Q$1 extends VertexQuery<CourseVertex>>(query: Q$1): VertexQuery$1<"courses", Q$1>;
|
|
89
|
+
function generation<Q$1 extends VertexQuery<GenerationVertex>>(query: Q$1): VertexQuery$1<"generations", Q$1>;
|
|
90
|
+
function location<Q$1 extends VertexQuery<LocationVertex>>(query: Q$1): VertexQuery$1<"locations", Q$1>;
|
|
91
|
+
function lockedTime<Q$1 extends VertexQuery<LockedTimeVertex>>(query: Q$1): VertexQuery$1<"lockedTimes", Q$1>;
|
|
92
|
+
function overlapGroup<Q$1 extends VertexQuery<OverlapGroupVertex>>(query: Q$1): VertexQuery$1<"overlapGroups", Q$1>;
|
|
93
|
+
function period<Q$1 extends VertexQuery<PeriodVertex>>(query: Q$1): VertexQuery$1<"periods", Q$1>;
|
|
94
|
+
function person<Q$1 extends VertexQuery<PersonVertex>>(query: Q$1): VertexQuery$1<"persons", Q$1>;
|
|
95
|
+
function rootInterval<Q$1 extends VertexQuery<RootIntervalVertex>>(query: Q$1): VertexQuery$1<"rootIntervals", Q$1>;
|
|
96
|
+
function syllabus<Q$1 extends VertexQuery<SyllabusVertex>>(query: Q$1): VertexQuery$1<"syllabuses", Q$1>;
|
|
97
|
+
function group<Q$1 extends VertexQuery<GroupVertex>>(query: Q$1): VertexQuery$1<"groups", Q$1>;
|
|
98
|
+
function teacher<Q$1 extends VertexQuery<TeacherVertex>>(query: Q$1): VertexQuery$1<"teachers", Q$1>;
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
export { Infer, VertexQuery$1 as VertexQuery, createVertexQuery };
|
|
102
|
+
//# sourceMappingURL=vertex-query.d.ts.map
|