@trafficgroup/knex-rel 0.1.9 → 0.1.10

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 (107) hide show
  1. package/.claude/settings.local.json +5 -2
  2. package/.env.prod +5 -0
  3. package/CLAUDE.md +2 -11
  4. package/dist/constants/video.constants.d.ts +12 -0
  5. package/dist/constants/video.constants.js +18 -0
  6. package/dist/constants/video.constants.js.map +1 -0
  7. package/dist/dao/VideoMinuteResultDAO.d.ts +1 -1
  8. package/dist/dao/VideoMinuteResultDAO.js +23 -29
  9. package/dist/dao/VideoMinuteResultDAO.js.map +1 -1
  10. package/dist/dao/auth/auth.dao.js +1 -4
  11. package/dist/dao/auth/auth.dao.js.map +1 -1
  12. package/dist/dao/batch/batch.dao.js +14 -13
  13. package/dist/dao/batch/batch.dao.js.map +1 -1
  14. package/dist/dao/camera/camera.dao.js +7 -10
  15. package/dist/dao/camera/camera.dao.js.map +1 -1
  16. package/dist/dao/chat/chat.dao.d.ts +1 -1
  17. package/dist/dao/chat/chat.dao.js +35 -25
  18. package/dist/dao/chat/chat.dao.js.map +1 -1
  19. package/dist/dao/folder/folder.dao.js +2 -7
  20. package/dist/dao/folder/folder.dao.js.map +1 -1
  21. package/dist/dao/location/location.dao.js +9 -16
  22. package/dist/dao/location/location.dao.js.map +1 -1
  23. package/dist/dao/message/message.dao.d.ts +1 -1
  24. package/dist/dao/message/message.dao.js +26 -18
  25. package/dist/dao/message/message.dao.js.map +1 -1
  26. package/dist/dao/report-configuration/report-configuration.dao.js +31 -32
  27. package/dist/dao/report-configuration/report-configuration.dao.js.map +1 -1
  28. package/dist/dao/study/study.dao.js +2 -7
  29. package/dist/dao/study/study.dao.js.map +1 -1
  30. package/dist/dao/user/user.dao.js +1 -4
  31. package/dist/dao/user/user.dao.js.map +1 -1
  32. package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js +8 -26
  33. package/dist/dao/user-push-notification-token/user-push-notification-token.dao.js.map +1 -1
  34. package/dist/dao/video/video.dao.d.ts +2 -1
  35. package/dist/dao/video/video.dao.js +42 -28
  36. package/dist/dao/video/video.dao.js.map +1 -1
  37. package/dist/index.d.ts +6 -4
  38. package/dist/index.js +6 -1
  39. package/dist/index.js.map +1 -1
  40. package/dist/interfaces/batch/batch.interfaces.d.ts +1 -1
  41. package/dist/interfaces/camera/camera.interfaces.d.ts +1 -1
  42. package/dist/interfaces/chat/chat.interfaces.d.ts +3 -3
  43. package/dist/interfaces/folder/folder.interfaces.d.ts +1 -1
  44. package/dist/interfaces/message/message.interfaces.d.ts +2 -2
  45. package/dist/interfaces/study/study.interfaces.d.ts +2 -2
  46. package/dist/interfaces/user/user.interfaces.d.ts +1 -1
  47. package/dist/interfaces/user-push-notification-token/user-push-notification-token.interfaces.d.ts +1 -1
  48. package/dist/interfaces/video/video.interfaces.d.ts +2 -2
  49. package/migrations/20250717160737_migration.ts +1 -1
  50. package/migrations/20250717160908_migration.ts +2 -5
  51. package/migrations/20250717161310_migration.ts +1 -1
  52. package/migrations/20250717161406_migration.ts +3 -3
  53. package/migrations/20250717162431_migration.ts +1 -1
  54. package/migrations/20250717173228_migration.ts +2 -2
  55. package/migrations/20250717204731_migration.ts +1 -1
  56. package/migrations/20250722210109_migration.ts +4 -8
  57. package/migrations/20250722211019_migration.ts +1 -1
  58. package/migrations/20250723153852_migration.ts +10 -13
  59. package/migrations/20250723162257_migration.ts +7 -4
  60. package/migrations/20250723171109_migration.ts +7 -4
  61. package/migrations/20250723205331_migration.ts +9 -6
  62. package/migrations/20250724191345_migration.ts +11 -8
  63. package/migrations/20250730180932_migration.ts +13 -14
  64. package/migrations/20250730213625_migration.ts +11 -8
  65. package/migrations/20250804124509_migration.ts +21 -26
  66. package/migrations/20250804132053_migration.ts +8 -5
  67. package/migrations/20250804164518_migration.ts +7 -7
  68. package/migrations/20250823223016_migration.ts +21 -32
  69. package/migrations/20250910015452_migration.ts +6 -18
  70. package/migrations/20250911000000_migration.ts +4 -18
  71. package/migrations/20250917144153_migration.ts +7 -14
  72. package/migrations/20250930200521_migration.ts +4 -8
  73. package/migrations/20251010143500_migration.ts +6 -27
  74. package/migrations/20251020225758_migration.ts +15 -51
  75. package/migrations/20251112120000_migration.ts +2 -10
  76. package/migrations/20251112120200_migration.ts +7 -19
  77. package/migrations/20251112120300_migration.ts +2 -7
  78. package/package.json +1 -1
  79. package/src/constants/video.constants.ts +19 -0
  80. package/src/d.types.ts +14 -18
  81. package/src/dao/VideoMinuteResultDAO.ts +49 -72
  82. package/src/dao/auth/auth.dao.ts +55 -58
  83. package/src/dao/batch/batch.dao.ts +98 -101
  84. package/src/dao/camera/camera.dao.ts +121 -124
  85. package/src/dao/chat/chat.dao.ts +43 -45
  86. package/src/dao/folder/folder.dao.ts +56 -65
  87. package/src/dao/location/location.dao.ts +87 -109
  88. package/src/dao/message/message.dao.ts +32 -32
  89. package/src/dao/report-configuration/report-configuration.dao.ts +342 -370
  90. package/src/dao/study/study.dao.ts +63 -88
  91. package/src/dao/user/user.dao.ts +50 -52
  92. package/src/dao/user-push-notification-token/user-push-notification-token.dao.ts +49 -83
  93. package/src/dao/video/video.dao.ts +339 -357
  94. package/src/entities/BaseEntity.ts +1 -1
  95. package/src/index.ts +22 -26
  96. package/src/interfaces/auth/auth.interfaces.ts +10 -10
  97. package/src/interfaces/batch/batch.interfaces.ts +1 -1
  98. package/src/interfaces/camera/camera.interfaces.ts +9 -9
  99. package/src/interfaces/chat/chat.interfaces.ts +4 -4
  100. package/src/interfaces/folder/folder.interfaces.ts +2 -2
  101. package/src/interfaces/location/location.interfaces.ts +7 -7
  102. package/src/interfaces/message/message.interfaces.ts +3 -3
  103. package/src/interfaces/report-configuration/report-configuration.interfaces.ts +16 -16
  104. package/src/interfaces/study/study.interfaces.ts +3 -3
  105. package/src/interfaces/user/user.interfaces.ts +9 -9
  106. package/src/interfaces/user-push-notification-token/user-push-notification-token.interfaces.ts +9 -9
  107. 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
@@ -13,46 +13,42 @@ export { UserPushNotificationTokenDAO } from "./dao/user-push-notification-token
13
13
  export { VideoDAO } from "./dao/video/video.dao";
14
14
  export { VideoMinuteResultDAO } from "./dao/VideoMinuteResultDAO";
15
15
 
16
+ // Constants
17
+ export {
18
+ VALID_VIDEO_SORT_FIELDS,
19
+ VALID_SORT_ORDERS,
20
+ VIDEO_SORT_COLUMN_MAP
21
+ } from "./constants/video.constants";
22
+ export type { VideoSortField, SortOrder } from "./constants/video.constants";
23
+
16
24
  // Interfaces
17
25
  export { IDataPaginator } from "./d.types";
18
26
  export { IAuth } from "./interfaces/auth/auth.interfaces";
19
27
  export { IBatch } from "./interfaces/batch/batch.interfaces";
20
28
  export { ICamera } from "./interfaces/camera/camera.interfaces";
21
- export {
22
- IChat,
23
- IChatCreate,
24
- IChatUpdate,
25
- } from "./interfaces/chat/chat.interfaces";
29
+ export { IChat, IChatCreate, IChatUpdate } from "./interfaces/chat/chat.interfaces";
26
30
  export { IFolder } from "./interfaces/folder/folder.interfaces";
27
31
  export { ILocation } from "./interfaces/location/location.interfaces";
32
+ export { IMessage, IMessageCreate, IMessageUpdate } from "./interfaces/message/message.interfaces";
28
33
  export {
29
- IMessage,
30
- IMessageCreate,
31
- IMessageUpdate,
32
- } from "./interfaces/message/message.interfaces";
33
- export {
34
- IReportConfiguration,
35
- IReportConfigurationData,
36
- IReportConfigurationInput,
37
- ICustomClass,
38
- IValidationResult,
34
+ IReportConfiguration,
35
+ IReportConfigurationData,
36
+ IReportConfigurationInput,
37
+ ICustomClass,
38
+ IValidationResult
39
39
  } from "./interfaces/report-configuration/report-configuration.interfaces";
40
40
  export { IStudy } from "./interfaces/study/study.interfaces";
41
41
  export { IUser } from "./interfaces/user/user.interfaces";
42
42
  export { IUserPushNotificationToken } from "./interfaces/user-push-notification-token/user-push-notification-token.interfaces";
43
43
  export { IVideo, ITrimPeriod } from "./interfaces/video/video.interfaces";
44
- export {
45
- IVideoMinuteResult,
46
- IVideoMinuteResultInput,
47
- IVideoMinuteBatch,
48
- } from "./entities/VideoMinuteResult";
44
+ export { IVideoMinuteResult, IVideoMinuteResultInput, IVideoMinuteBatch } from "./entities/VideoMinuteResult";
49
45
  export type {
50
- IStudyTimeGroupResult,
51
- IGroupedStudyResponse,
52
- IGroupedResponse,
53
- IGroupedResult,
54
- ITMCResult,
55
- IATRResult,
46
+ IStudyTimeGroupResult,
47
+ IGroupedStudyResponse,
48
+ IGroupedResponse,
49
+ IGroupedResult,
50
+ ITMCResult,
51
+ IATRResult,
56
52
  } from "./dao/VideoMinuteResultDAO";
57
53
 
58
54
  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
+ }