@aneuhold/core-ts-db-lib 2.0.0 → 2.0.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.
Files changed (62) hide show
  1. package/lib/documents/common/ApiKey.d.ts +2 -0
  2. package/lib/documents/common/ApiKey.d.ts.map +1 -1
  3. package/lib/documents/common/ApiKey.js +2 -0
  4. package/lib/documents/common/ApiKey.js.map +1 -1
  5. package/lib/documents/common/ApiKey.ts +2 -0
  6. package/lib/documents/common/User.d.ts +8 -0
  7. package/lib/documents/common/User.d.ts.map +1 -1
  8. package/lib/documents/common/User.js +8 -0
  9. package/lib/documents/common/User.js.map +1 -1
  10. package/lib/documents/common/User.ts +8 -0
  11. package/lib/documents/dashboard/Task.d.ts +3 -0
  12. package/lib/documents/dashboard/Task.d.ts.map +1 -1
  13. package/lib/documents/dashboard/Task.js +3 -0
  14. package/lib/documents/dashboard/Task.js.map +1 -1
  15. package/lib/documents/dashboard/Task.ts +3 -0
  16. package/lib/embedded-types/dashboard/task/FilterSettings.d.ts +12 -0
  17. package/lib/embedded-types/dashboard/task/FilterSettings.d.ts.map +1 -1
  18. package/lib/embedded-types/dashboard/task/FilterSettings.js +12 -0
  19. package/lib/embedded-types/dashboard/task/FilterSettings.js.map +1 -1
  20. package/lib/embedded-types/dashboard/task/FilterSettings.ts +12 -0
  21. package/lib/embedded-types/dashboard/task/RecurrenceInfo.d.ts +6 -0
  22. package/lib/embedded-types/dashboard/task/RecurrenceInfo.d.ts.map +1 -1
  23. package/lib/embedded-types/dashboard/task/RecurrenceInfo.js +7 -1
  24. package/lib/embedded-types/dashboard/task/RecurrenceInfo.js.map +1 -1
  25. package/lib/embedded-types/dashboard/task/RecurrenceInfo.ts +11 -2
  26. package/lib/embedded-types/dashboard/task/SortSettings.d.ts +18 -0
  27. package/lib/embedded-types/dashboard/task/SortSettings.d.ts.map +1 -1
  28. package/lib/embedded-types/dashboard/task/SortSettings.js +12 -0
  29. package/lib/embedded-types/dashboard/task/SortSettings.js.map +1 -1
  30. package/lib/embedded-types/dashboard/task/SortSettings.ts +18 -0
  31. package/lib/schemas/type-guards/commonTypeGuards.d.ts +30 -0
  32. package/lib/schemas/type-guards/commonTypeGuards.d.ts.map +1 -1
  33. package/lib/schemas/type-guards/commonTypeGuards.js +30 -0
  34. package/lib/schemas/type-guards/commonTypeGuards.js.map +1 -1
  35. package/lib/schemas/type-guards/commonTypeGuards.ts +30 -0
  36. package/lib/schemas/validators/ValidateUtil.d.ts +75 -0
  37. package/lib/schemas/validators/ValidateUtil.d.ts.map +1 -1
  38. package/lib/schemas/validators/ValidateUtil.js +75 -0
  39. package/lib/schemas/validators/ValidateUtil.js.map +1 -1
  40. package/lib/schemas/validators/ValidateUtil.ts +75 -0
  41. package/lib/services/dashboard/Task/TaskFilterService.d.ts +10 -4
  42. package/lib/services/dashboard/Task/TaskFilterService.d.ts.map +1 -1
  43. package/lib/services/dashboard/Task/TaskFilterService.js +10 -4
  44. package/lib/services/dashboard/Task/TaskFilterService.js.map +1 -1
  45. package/lib/services/dashboard/Task/TaskFilterService.ts +10 -4
  46. package/lib/services/dashboard/Task/TaskRecurrenceService.d.ts +14 -2
  47. package/lib/services/dashboard/Task/TaskRecurrenceService.d.ts.map +1 -1
  48. package/lib/services/dashboard/Task/TaskRecurrenceService.js +14 -2
  49. package/lib/services/dashboard/Task/TaskRecurrenceService.js.map +1 -1
  50. package/lib/services/dashboard/Task/TaskRecurrenceService.ts +18 -3
  51. package/lib/services/dashboard/Task/TaskService.d.ts +33 -4
  52. package/lib/services/dashboard/Task/TaskService.d.ts.map +1 -1
  53. package/lib/services/dashboard/Task/TaskService.js +33 -4
  54. package/lib/services/dashboard/Task/TaskService.js.map +1 -1
  55. package/lib/services/dashboard/Task/TaskService.spec.ts +31 -0
  56. package/lib/services/dashboard/Task/TaskService.ts +33 -4
  57. package/lib/services/dashboard/Task/TaskSortService.d.ts +44 -0
  58. package/lib/services/dashboard/Task/TaskSortService.d.ts.map +1 -1
  59. package/lib/services/dashboard/Task/TaskSortService.js +44 -0
  60. package/lib/services/dashboard/Task/TaskSortService.js.map +1 -1
  61. package/lib/services/dashboard/Task/TaskSortService.ts +47 -3
  62. package/package.json +2 -2
@@ -14,13 +14,19 @@ import { DashboardTagSettings } from '../../../embedded-types/dashboard/userConf
14
14
  export default class DashboardTaskSortService {
15
15
  /**
16
16
  * Sorts the provided task IDs based on the provided sort settings.
17
+ *
18
+ * @param taskMap The map of tasks.
19
+ * @param taskIds The IDs of the tasks to sort.
20
+ * @param sortSettings The settings to sort by.
21
+ * @param tagSettings The tag settings.
22
+ * @returns The sorted task IDs.
17
23
  */
18
24
  static sort(
19
25
  taskMap: DashboardTaskMap,
20
26
  taskIds: string[],
21
27
  sortSettings: DashboardTaskListSortSettings,
22
28
  tagSettings: DashboardTagSettings
23
- ) {
29
+ ): string[] {
24
30
  return taskIds.sort((idA, idB) => {
25
31
  const taskA = taskMap[idA];
26
32
  const taskB = taskMap[idB];
@@ -49,6 +55,14 @@ export default class DashboardTaskSortService {
49
55
  * Gets a map of task IDs to tag header names. Used only for when sorting by
50
56
  * tags. If the first task in the list has no high-priority tags, then
51
57
  * noPriorityTagsIndicator will be used as the header name.
58
+ *
59
+ * @param taskMap The map of tasks.
60
+ * @param taskIds The IDs of the tasks.
61
+ * @param userId The user ID.
62
+ * @param tagSettings The tag settings.
63
+ * @param noPriorityTagsIndicator The indicator for no priority tags.
64
+ * @param sortDirection The sort direction.
65
+ * @returns A map of task IDs to tag header names.
52
66
  */
53
67
  static getTagHeaderMap(
54
68
  taskMap: DashboardTaskMap,
@@ -91,12 +105,21 @@ export default class DashboardTaskSortService {
91
105
  return tagHeaderMap;
92
106
  }
93
107
 
108
+ /**
109
+ * Gets the task sort function based on the sort by and sort direction.
110
+ *
111
+ * @param sortBy The field to sort by.
112
+ * @param sortDirection The direction to sort.
113
+ * @param tagSettings The tag settings.
114
+ * @param userId The user ID.
115
+ * @returns A function that compares two tasks.
116
+ */
94
117
  private static getTaskSortFunction(
95
118
  sortBy: DashboardTaskSortBy,
96
119
  sortDirection: DashboardTaskSortDirection,
97
120
  tagSettings: DashboardTagSettings,
98
121
  userId: string
99
- ) {
122
+ ): (taskA: DashboardTask, taskB: DashboardTask) => number {
100
123
  switch (sortBy) {
101
124
  case DashboardTaskSortBy.tags:
102
125
  return (taskA: DashboardTask, taskB: DashboardTask) => {
@@ -160,6 +183,12 @@ export default class DashboardTaskSortService {
160
183
  /**
161
184
  * Gets the highest priority tag for the provided task. If there are no tags,
162
185
  * or if there are no tags with a priority, then this will return null.
186
+ *
187
+ * @param task The task.
188
+ * @param userId The user ID.
189
+ * @param tagSettings The tag settings.
190
+ * @param sortDirection The sort direction.
191
+ * @returns The highest priority tag or null.
163
192
  */
164
193
  private static getHighestPriorityTag(
165
194
  task: DashboardTask,
@@ -178,13 +207,19 @@ export default class DashboardTaskSortService {
178
207
 
179
208
  /**
180
209
  * Gets the highest priority tag value for the provided task.
210
+ *
211
+ * @param task The task.
212
+ * @param userId The user ID.
213
+ * @param tagSettings The tag settings.
214
+ * @param sortDirection The sort direction.
215
+ * @returns The highest priority tag value.
181
216
  */
182
217
  private static getHighestPriorityTagValue(
183
218
  task: DashboardTask,
184
219
  userId: string,
185
220
  tagSettings: DashboardTagSettings,
186
221
  sortDirection: DashboardTaskSortDirection
187
- ) {
222
+ ): number {
188
223
  const priorityTag = this.getPriorityTagForTask(
189
224
  task,
190
225
  userId,
@@ -194,6 +229,15 @@ export default class DashboardTaskSortService {
194
229
  return priorityTag ? priorityTag.priority : 0;
195
230
  }
196
231
 
232
+ /**
233
+ * Gets the priority tag for the provided task.
234
+ *
235
+ * @param task The task.
236
+ * @param userId The user ID.
237
+ * @param tagSettings The tag settings.
238
+ * @param sortDirection The sort direction.
239
+ * @returns The priority tag or null.
240
+ */
197
241
  private static getPriorityTagForTask(
198
242
  task: DashboardTask,
199
243
  userId: string,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@aneuhold/core-ts-db-lib",
3
3
  "author": "Anton G. Neuhold Jr.",
4
4
  "license": "MIT",
5
- "version": "2.0.0",
5
+ "version": "2.0.2",
6
6
  "description": "A core database library used for personal projects",
7
7
  "packageManager": "yarn@4.5.1",
8
8
  "type": "module",
@@ -47,7 +47,7 @@
47
47
  "bson": "^6.2.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@aneuhold/eslint-config": "^1.0.37",
50
+ "@aneuhold/eslint-config": "^1.0.40",
51
51
  "@aneuhold/main-scripts": "^2.0.6",
52
52
  "@types/node": "^20.16.10",
53
53
  "eslint": "^9.13.0",