@@ -3,6 +3,8 @@ const AWS = require('aws-sdk');
3
3
const crypto = require ( 'crypto' ) ;
4
4
const fs = require ( 'fs' ) ;
5
5
6
+ const { isValidVersion } = require ( './version' ) ;
7
+
6
8
// Load S3 configuration from JSON file
7
9
// eslint-disable-next-line node/no-unpublished-require
8
10
const s3Config = require ( '../../conf/aws.s3.json' ) ;
@@ -71,6 +73,8 @@ class ProcessingSession {
71
73
this . startTime = new Date ( ) ;
72
74
this . endTime = null ;
73
75
this . duration = - 1 ;
76
+ this . snapshotAPIVersion = "" ;
77
+ this . genshareVersion = "" ;
74
78
75
79
// Add initial log with session start
76
80
this . addLog ( 'Session started' , 'INFO' ) ;
@@ -79,6 +83,34 @@ class ProcessingSession {
79
83
}
80
84
}
81
85
86
+ getSnapshotAPIVersion ( ) {
87
+ return this . snapshotAPIVersion ;
88
+ }
89
+
90
+ getGenshareVersion ( ) {
91
+ return this . genshareVersion ;
92
+ }
93
+
94
+ setSnapshotAPIVersion ( version ) {
95
+ if ( ! isValidVersion ( version ) ) {
96
+ this . snapshotAPIVersion = '' ;
97
+ this . addLog ( `Invalid Snapshot API Version format: ${ version } . Setting empty string.` , 'WARN' ) ;
98
+ return ;
99
+ }
100
+ this . snapshotAPIVersion = version ;
101
+ this . addLog ( `Snapshot API Version set to: ${ version } ` , 'INFO' ) ;
102
+ }
103
+
104
+ setGenshareVersion ( version ) {
105
+ if ( ! isValidVersion ( version ) ) {
106
+ this . genshareVersion = '' ;
107
+ this . addLog ( `Invalid Genshare Version format: ${ version } . Setting empty string.` , 'WARN' ) ;
108
+ return ;
109
+ }
110
+ this . genshareVersion = version ;
111
+ this . addLog ( `Genshare Version set to: ${ version } ` , 'INFO' ) ;
112
+ }
113
+
82
114
getBasePath ( ) {
83
115
return `${ s3Config . s3Folder } /${ this . userId } /${ this . requestId } ` ;
84
116
}
@@ -136,7 +168,9 @@ class ProcessingSession {
136
168
startDate : formatLogDate ( this . startTime ) ,
137
169
endDate : formatLogDate ( this . endTime ) ,
138
170
duration : `${ this . duration } ms` ,
139
- hasFile : ! ! this . file
171
+ hasFile : ! ! this . file ,
172
+ snapshotAPIVersion : this . snapshotAPIVersion ,
173
+ genshareVersion : this . genshareVersion
140
174
} ;
141
175
142
176
// Add common files that don't depend on this.file
0 commit comments