@trafficgroup/knex-rel 0.1.11 → 0.1.12

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 (110) hide show
  1. package/.claude/settings.local.json +2 -5
  2. package/CLAUDE.md +11 -2
  3. package/dist/constants/folder.constants.d.ts +12 -0
  4. package/dist/constants/folder.constants.js +28 -0
  5. package/dist/constants/folder.constants.js.map +1 -0
  6. package/dist/constants/video.constants.d.ts +2 -2
  7. package/dist/constants/video.constants.js +9 -5
  8. package/dist/constants/video.constants.js.map +1 -1
  9. package/dist/dao/VideoMinuteResultDAO.d.ts +1 -1
  10. package/dist/dao/VideoMinuteResultDAO.js +29 -23
  11. package/dist/dao/VideoMinuteResultDAO.js.map +1 -1
  12. package/dist/dao/auth/auth.dao.js +4 -1
  13. package/dist/dao/auth/auth.dao.js.map +1 -1
  14. package/dist/dao/batch/batch.dao.js +13 -14
  15. package/dist/dao/batch/batch.dao.js.map +1 -1
  16. package/dist/dao/camera/camera.dao.js +10 -7
  17. package/dist/dao/camera/camera.dao.js.map +1 -1
  18. package/dist/dao/chat/chat.dao.d.ts +1 -1
  19. package/dist/dao/chat/chat.dao.js +27 -40
  20. package/dist/dao/chat/chat.dao.js.map +1 -1
  21. package/dist/dao/folder/folder.dao.d.ts +10 -1
  22. package/dist/dao/folder/folder.dao.js +44 -6
  23. package/dist/dao/folder/folder.dao.js.map +1 -1
  24. package/dist/dao/location/location.dao.js +16 -9
  25. package/dist/dao/location/location.dao.js.map +1 -1
  26. package/dist/dao/message/message.dao.d.ts +1 -1
  27. package/dist/dao/message/message.dao.js +18 -26
  28. package/dist/dao/message/message.dao.js.map +1 -1
  29. package/dist/dao/report-configuration/report-configuration.dao.js +32 -31
  30. package/dist/dao/report-configuration/report-configuration.dao.js.map +1 -1
  31. package/dist/dao/study/study.dao.js +7 -2
  32. package/dist/dao/study/study.dao.js.map +1 -1
  33. package/dist/dao/user/user.dao.js +4 -1
  34. package/dist/dao/user/user.dao.js.map +1 -1
  35. package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js +26 -8
  36. package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js.map +1 -1
  37. package/dist/dao/video/video.dao.js +30 -28
  38. package/dist/dao/video/video.dao.js.map +1 -1
  39. package/dist/index.d.ts +8 -5
  40. package/dist/index.js +5 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/interfaces/batch/batch.interfaces.d.ts +1 -1
  43. package/dist/interfaces/camera/camera.interfaces.d.ts +1 -1
  44. package/dist/interfaces/chat/chat.interfaces.d.ts +3 -3
  45. package/dist/interfaces/folder/folder.interfaces.d.ts +1 -1
  46. package/dist/interfaces/message/message.interfaces.d.ts +2 -2
  47. package/dist/interfaces/study/study.interfaces.d.ts +2 -2
  48. package/dist/interfaces/user/user.interfaces.d.ts +1 -1
  49. package/dist/interfaces/user-push-notification-token/user-push-notification-token.interfaces.d.ts +1 -1
  50. package/dist/interfaces/video/video.interfaces.d.ts +2 -2
  51. package/migrations/20250717160737_migration.ts +1 -1
  52. package/migrations/20250717160908_migration.ts +5 -2
  53. package/migrations/20250717161310_migration.ts +1 -1
  54. package/migrations/20250717161406_migration.ts +3 -3
  55. package/migrations/20250717162431_migration.ts +1 -1
  56. package/migrations/20250717173228_migration.ts +2 -2
  57. package/migrations/20250717204731_migration.ts +1 -1
  58. package/migrations/20250722210109_migration.ts +8 -4
  59. package/migrations/20250722211019_migration.ts +1 -1
  60. package/migrations/20250723153852_migration.ts +13 -10
  61. package/migrations/20250723162257_migration.ts +4 -7
  62. package/migrations/20250723171109_migration.ts +4 -7
  63. package/migrations/20250723205331_migration.ts +6 -9
  64. package/migrations/20250724191345_migration.ts +8 -11
  65. package/migrations/20250730180932_migration.ts +14 -13
  66. package/migrations/20250730213625_migration.ts +8 -11
  67. package/migrations/20250804124509_migration.ts +26 -21
  68. package/migrations/20250804132053_migration.ts +5 -8
  69. package/migrations/20250804164518_migration.ts +7 -7
  70. package/migrations/20250823223016_migration.ts +32 -21
  71. package/migrations/20250910015452_migration.ts +18 -6
  72. package/migrations/20250911000000_migration.ts +18 -4
  73. package/migrations/20250917144153_migration.ts +14 -7
  74. package/migrations/20250930200521_migration.ts +8 -4
  75. package/migrations/20251010143500_migration.ts +27 -6
  76. package/migrations/20251020225758_migration.ts +51 -15
  77. package/migrations/20251112120000_migration.ts +10 -2
  78. package/migrations/20251112120200_migration.ts +19 -7
  79. package/migrations/20251112120300_migration.ts +7 -2
  80. package/package.json +1 -1
  81. package/src/constants/folder.constants.ts +29 -0
  82. package/src/constants/video.constants.ts +11 -7
  83. package/src/d.types.ts +18 -14
  84. package/src/dao/VideoMinuteResultDAO.ts +72 -49
  85. package/src/dao/auth/auth.dao.ts +58 -55
  86. package/src/dao/batch/batch.dao.ts +101 -98
  87. package/src/dao/camera/camera.dao.ts +124 -121
  88. package/src/dao/chat/chat.dao.ts +45 -45
  89. package/src/dao/folder/folder.dao.ts +112 -55
  90. package/src/dao/location/location.dao.ts +109 -87
  91. package/src/dao/message/message.dao.ts +32 -32
  92. package/src/dao/report-configuration/report-configuration.dao.ts +370 -342
  93. package/src/dao/study/study.dao.ts +88 -63
  94. package/src/dao/user/user.dao.ts +52 -50
  95. package/src/dao/user-push-notification-token/user-push-notification-token.dao.ts +80 -48
  96. package/src/dao/video/video.dao.ts +385 -334
  97. package/src/entities/BaseEntity.ts +1 -1
  98. package/src/index.ts +42 -17
  99. package/src/interfaces/auth/auth.interfaces.ts +10 -10
  100. package/src/interfaces/batch/batch.interfaces.ts +1 -1
  101. package/src/interfaces/camera/camera.interfaces.ts +9 -9
  102. package/src/interfaces/chat/chat.interfaces.ts +4 -4
  103. package/src/interfaces/folder/folder.interfaces.ts +2 -2
  104. package/src/interfaces/location/location.interfaces.ts +7 -7
  105. package/src/interfaces/message/message.interfaces.ts +3 -3
  106. package/src/interfaces/report-configuration/report-configuration.interfaces.ts +16 -16
  107. package/src/interfaces/study/study.interfaces.ts +3 -3
  108. package/src/interfaces/user/user.interfaces.ts +9 -9
  109. package/src/interfaces/user-push-notification-token/user-push-notification-token.interfaces.ts +9 -9
  110. package/src/interfaces/video/video.interfaces.ts +34 -34
@@ -1,4 +1,4 @@
1
1
  export interface IBaseEntity {
2
2
  id: number;
3
3
  uuid: string;
4
- }
4
+ }
package/src/index.ts CHANGED
@@ -15,40 +15,65 @@ export { VideoMinuteResultDAO } from "./dao/VideoMinuteResultDAO";
15
15
 
16
16
  // Constants
17
17
  export {
18
- VALID_VIDEO_SORT_FIELDS,
19
- VALID_SORT_ORDERS,
20
- VIDEO_SORT_COLUMN_MAP
18
+ VALID_VIDEO_SORT_FIELDS,
19
+ VALID_SORT_ORDERS,
20
+ VIDEO_SORT_COLUMN_MAP,
21
21
  } from "./constants/video.constants";
22
22
  export type { VideoSortField, SortOrder } from "./constants/video.constants";
23
23
 
24
+ export {
25
+ VALID_FOLDER_SORT_FIELDS,
26
+ VALID_FOLDER_STATUSES,
27
+ FOLDER_SORT_COLUMN_MAP,
28
+ } from "./constants/folder.constants";
29
+ export type {
30
+ FolderSortField,
31
+ FolderStatus,
32
+ } from "./constants/folder.constants";
33
+
34
+ // Folder filters interface
35
+ export type { IFolderFilters } from "./dao/folder/folder.dao";
36
+
24
37
  // Interfaces
25
38
  export { IDataPaginator } from "./d.types";
26
39
  export { IAuth } from "./interfaces/auth/auth.interfaces";
27
40
  export { IBatch } from "./interfaces/batch/batch.interfaces";
28
41
  export { ICamera } from "./interfaces/camera/camera.interfaces";
29
- export { IChat, IChatCreate, IChatUpdate } from "./interfaces/chat/chat.interfaces";
42
+ export {
43
+ IChat,
44
+ IChatCreate,
45
+ IChatUpdate,
46
+ } from "./interfaces/chat/chat.interfaces";
30
47
  export { IFolder } from "./interfaces/folder/folder.interfaces";
31
48
  export { ILocation } from "./interfaces/location/location.interfaces";
32
- export { IMessage, IMessageCreate, IMessageUpdate } from "./interfaces/message/message.interfaces";
33
49
  export {
34
- IReportConfiguration,
35
- IReportConfigurationData,
36
- IReportConfigurationInput,
37
- ICustomClass,
38
- IValidationResult
50
+ IMessage,
51
+ IMessageCreate,
52
+ IMessageUpdate,
53
+ } from "./interfaces/message/message.interfaces";
54
+ export {
55
+ IReportConfiguration,
56
+ IReportConfigurationData,
57
+ IReportConfigurationInput,
58
+ ICustomClass,
59
+ IValidationResult,
39
60
  } from "./interfaces/report-configuration/report-configuration.interfaces";
40
61
  export { IStudy } from "./interfaces/study/study.interfaces";
41
62
  export { IUser } from "./interfaces/user/user.interfaces";
42
63
  export { IUserPushNotificationToken } from "./interfaces/user-push-notification-token/user-push-notification-token.interfaces";
43
64
  export { IVideo, ITrimPeriod } from "./interfaces/video/video.interfaces";
44
- export { IVideoMinuteResult, IVideoMinuteResultInput, IVideoMinuteBatch } from "./entities/VideoMinuteResult";
65
+ export {
66
+ IVideoMinuteResult,
67
+ IVideoMinuteResultInput,
68
+ IVideoMinuteBatch,
69
+ } from "./entities/VideoMinuteResult";
45
70
  export type {
46
- IStudyTimeGroupResult,
47
- IGroupedStudyResponse,
48
- IGroupedResponse,
49
- IGroupedResult,
50
- ITMCResult,
51
- IATRResult,
71
+ IStudyTimeGroupResult,
72
+ IGroupedStudyResponse,
73
+ IGroupedResponse,
74
+ IGroupedResult,
75
+ ITMCResult,
76
+ IATRResult,
52
77
  } from "./dao/VideoMinuteResultDAO";
53
78
 
54
79
  import KnexManager from "./KnexConnection";
@@ -1,11 +1,11 @@
1
1
  export interface IAuth {
2
- id: number;
3
- userId: number;
4
- password: string;
5
- twofaEnabled: boolean;
6
- twofaSecret: string | null;
7
- emailToken: string | null;
8
- emailVerified: boolean;
9
- created_at: string;
10
- updated_at: string;
11
- }
2
+ id: number;
3
+ userId: number;
4
+ password: string;
5
+ twofaEnabled: boolean;
6
+ twofaSecret: string | null;
7
+ emailToken: string | null;
8
+ emailVerified: boolean;
9
+ created_at: string;
10
+ updated_at: string;
11
+ }
@@ -4,7 +4,7 @@ export interface IBatch {
4
4
  id: number;
5
5
  uuid: string;
6
6
  folderId: number;
7
- status: 'PENDING' | 'IN_PROGRESS' | 'COMPLETED' | 'FAILED';
7
+ status: "PENDING" | "IN_PROGRESS" | "COMPLETED" | "FAILED";
8
8
  totalVideos: number;
9
9
  completedVideos: number;
10
10
  failedVideos: number;
@@ -1,11 +1,11 @@
1
1
  export interface ICamera {
2
- id: number;
3
- uuid: string;
4
- locationId: number;
5
- name: string;
6
- description?: string;
7
- status: 'ACTIVE' | 'INACTIVE' | 'MAINTENANCE';
8
- metadata: Record<string, any>;
9
- created_at: string;
10
- updated_at: string;
2
+ id: number;
3
+ uuid: string;
4
+ locationId: number;
5
+ name: string;
6
+ description?: string;
7
+ status: "ACTIVE" | "INACTIVE" | "MAINTENANCE";
8
+ metadata: Record<string, any>;
9
+ created_at: string;
10
+ updated_at: string;
11
11
  }
@@ -3,7 +3,7 @@ export interface IChat {
3
3
  uuid?: string;
4
4
  userId: number;
5
5
  title: string;
6
- status?: 'active' | 'archived';
6
+ status?: "active" | "archived";
7
7
  created_at?: Date;
8
8
  updated_at?: Date;
9
9
  }
@@ -11,10 +11,10 @@ export interface IChat {
11
11
  export interface IChatCreate {
12
12
  userId: number;
13
13
  title: string;
14
- status?: 'active' | 'archived';
14
+ status?: "active" | "archived";
15
15
  }
16
16
 
17
17
  export interface IChatUpdate {
18
18
  title?: string;
19
- status?: 'active' | 'archived';
20
- }
19
+ status?: "active" | "archived";
20
+ }
@@ -5,9 +5,9 @@ export interface IFolder {
5
5
  uuid: string;
6
6
  name: string;
7
7
  createdBy: number; // user.id
8
- status: 'UPLOADING' | 'COMPLETE';
8
+ status: "UPLOADING" | "COMPLETE";
9
9
  studyId: number; // study.id
10
10
  created_at: string;
11
11
  updated_at: string;
12
12
  study?: IStudy;
13
- }
13
+ }
@@ -1,9 +1,9 @@
1
1
  export interface ILocation {
2
- id: number;
3
- uuid: string;
4
- name: string;
5
- longitude: number;
6
- latitude: number;
7
- created_at: string;
8
- updated_at: string;
2
+ id: number;
3
+ uuid: string;
4
+ name: string;
5
+ longitude: number;
6
+ latitude: number;
7
+ created_at: string;
8
+ updated_at: string;
9
9
  }
@@ -1,7 +1,7 @@
1
1
  export interface IMessage {
2
2
  id?: number;
3
3
  chatId: number;
4
- role: 'user' | 'assistant';
4
+ role: "user" | "assistant";
5
5
  content: string;
6
6
  created_at?: Date;
7
7
  updated_at?: Date;
@@ -9,10 +9,10 @@ export interface IMessage {
9
9
 
10
10
  export interface IMessageCreate {
11
11
  chatId: number;
12
- role: 'user' | 'assistant';
12
+ role: "user" | "assistant";
13
13
  content: string;
14
14
  }
15
15
 
16
16
  export interface IMessageUpdate {
17
17
  content?: string;
18
- }
18
+ }
@@ -1,30 +1,30 @@
1
1
  export interface IReportConfiguration {
2
- id: number;
3
- uuid: string;
4
- name: string;
5
- description?: string;
6
- configuration: IReportConfigurationData;
7
- created_at: Date;
8
- updated_at: Date;
2
+ id: number;
3
+ uuid: string;
4
+ name: string;
5
+ description?: string;
6
+ configuration: IReportConfigurationData;
7
+ created_at: Date;
8
+ updated_at: Date;
9
9
  }
10
10
 
11
11
  export interface IReportConfigurationData {
12
- version: string;
13
- customClasses: ICustomClass[];
12
+ version: string;
13
+ customClasses: ICustomClass[];
14
14
  }
15
15
 
16
16
  export interface ICustomClass {
17
- name: string; // Max 30 chars
18
- fhwaClasses: number[]; // Array of 1-13
17
+ name: string; // Max 30 chars
18
+ fhwaClasses: number[]; // Array of 1-13
19
19
  }
20
20
 
21
21
  export interface IReportConfigurationInput {
22
- name: string;
23
- description?: string;
24
- configuration: IReportConfigurationData;
22
+ name: string;
23
+ description?: string;
24
+ configuration: IReportConfigurationData;
25
25
  }
26
26
 
27
27
  export interface IValidationResult {
28
- valid: boolean;
29
- errors: string[];
28
+ valid: boolean;
29
+ errors: string[];
30
30
  }
@@ -6,13 +6,13 @@ export interface IStudy {
6
6
  uuid: string;
7
7
  name: string;
8
8
  description?: string;
9
- type: 'TMC' | 'ATR';
9
+ type: "TMC" | "ATR";
10
10
  createdBy: number;
11
11
  locationId?: number;
12
12
  isMultiCamera: boolean;
13
- status: 'COMPLETE' | 'IN PROGRESS' | 'FAILED';
13
+ status: "COMPLETE" | "IN PROGRESS" | "FAILED";
14
14
  created_at: string;
15
15
  updated_at: string;
16
16
  user?: IUser;
17
17
  location?: ILocation;
18
- }
18
+ }
@@ -1,11 +1,11 @@
1
1
  export interface IUser {
2
- id: number;
3
- uuid: string;
4
- email: string;
5
- nombre: string;
6
- role: 'ADMIN' | 'USER';
7
- profilePhoto?: string;
8
- company?: string;
9
- created_at: string;
10
- updated_at: string;
2
+ id: number;
3
+ uuid: string;
4
+ email: string;
5
+ nombre: string;
6
+ role: "ADMIN" | "USER";
7
+ profilePhoto?: string;
8
+ company?: string;
9
+ created_at: string;
10
+ updated_at: string;
11
11
  }
@@ -1,10 +1,10 @@
1
1
  export interface IUserPushNotificationToken {
2
- id: number;
3
- userId: number;
4
- token: string;
5
- available: boolean;
6
- token_type: 'expo' | 'native';
7
- device_type?: string;
8
- created_at: string;
9
- updated_at: string;
10
- }
2
+ id: number;
3
+ userId: number;
4
+ token: string;
5
+ available: boolean;
6
+ token_type: "expo" | "native";
7
+ device_type?: string;
8
+ created_at: string;
9
+ updated_at: string;
10
+ }
@@ -1,44 +1,44 @@
1
1
  import type { IFolder } from "../folder/folder.interfaces";
2
2
 
3
3
  export interface ITrimPeriod {
4
- startTime: string;
5
- endTime: string;
4
+ startTime: string;
5
+ endTime: string;
6
6
  }
7
7
 
8
8
  export interface IVideo {
9
- id: number;
10
- uuid: string;
11
- folderId: number;
12
- annotationSourceId?: number;
13
- cameraId?: number;
14
- name: string;
15
- videoLocation: string;
16
- videoOutputLocation: string | null;
17
- generateVideoOutput: boolean;
18
- videoRate: number;
19
- videoType: 'TMC' | 'ATR' | 'JUNCTION' | 'ROUNDABOUT' | 'PATHWAY';
20
- metadata: Record<string, any>;
21
- status: 'QUEUED' | 'PROCESSING' | 'COMPLETED' | 'FAILED' | 'PENDING';
22
- progress: number;
23
- remainingTime: string;
24
- results: Record<string, any>;
25
- durationSeconds?: number;
9
+ id: number;
10
+ uuid: string;
11
+ folderId: number;
12
+ annotationSourceId?: number;
13
+ cameraId?: number;
14
+ name: string;
15
+ videoLocation: string;
16
+ videoOutputLocation: string | null;
17
+ generateVideoOutput: boolean;
18
+ videoRate: number;
19
+ videoType: "TMC" | "ATR" | "JUNCTION" | "ROUNDABOUT" | "PATHWAY";
20
+ metadata: Record<string, any>;
21
+ status: "QUEUED" | "PROCESSING" | "COMPLETED" | "FAILED" | "PENDING";
22
+ progress: number;
23
+ remainingTime: string;
24
+ results: Record<string, any>;
25
+ durationSeconds?: number;
26
26
 
27
- // HLS streaming support
28
- isHlsEnabled: boolean;
29
- hlsPlaylist: string | null;
30
- videoSizeMB: number | null;
27
+ // HLS streaming support
28
+ isHlsEnabled: boolean;
29
+ hlsPlaylist: string | null;
30
+ videoSizeMB: number | null;
31
31
 
32
- // Enhanced metadata for hybrid streaming
33
- streamingMetadata: Record<string, any> | null;
32
+ // Enhanced metadata for hybrid streaming
33
+ streamingMetadata: Record<string, any> | null;
34
34
 
35
- // Recording start time and video trimming support
36
- recordingStartedAt?: Date;
37
- trimEnabled?: boolean;
38
- trimPeriods?: ITrimPeriod[] | null;
39
- batchId?: number | null;
35
+ // Recording start time and video trimming support
36
+ recordingStartedAt?: Date;
37
+ trimEnabled?: boolean;
38
+ trimPeriods?: ITrimPeriod[] | null;
39
+ batchId?: number | null;
40
40
 
41
- created_at: string;
42
- updated_at: string;
43
- folder?: IFolder;
44
- }
41
+ created_at: string;
42
+ updated_at: string;
43
+ folder?: IFolder;
44
+ }