@ixon-cdk/core 1.24.0 → 1.25.0-next.1

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.
@@ -11,13 +11,20 @@ export class ApiBaseService {
11
11
  * to now, or `-1` when the file doesn't exist.
12
12
  * */
13
13
  _getAccessTokenFileModifiedRelativeToNow() {
14
- if (fs.existsSync(this._getAccessTokenFilePath())) {
15
- const stats = fs.statSync(this._getAccessTokenFilePath());
16
- return Math.floor((new Date().getTime() - stats.mtimeMs) / 1000);
14
+ const lastModified = this._getAccessTokenFileLastModified();
15
+ if (lastModified) {
16
+ return Math.floor((new Date().getTime() - lastModified.getTime()) / 1000);
17
17
  }
18
18
  return -1;
19
19
  }
20
20
 
21
+ _getAccessTokenFileLastModified() {
22
+ if (fs.existsSync(this._getAccessTokenFilePath())) {
23
+ return new Date(fs.statSync(this._getAccessTokenFilePath()).mtimeMs);
24
+ }
25
+ return null;
26
+ }
27
+
21
28
  /** Returns an absolute path to the `.accesstoken` file. */
22
29
  _getAccessTokenFilePath() {
23
30
  return path.join(getRootDir(), '.accesstoken');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixon-cdk/core",
3
- "version": "1.24.0",
3
+ "version": "1.25.0-next.1",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "index.js",
package/server/index.js CHANGED
@@ -96,6 +96,10 @@ export class Server {
96
96
  cors({ origin: `http://localhost:${this._opts.port}` }),
97
97
  (req, res) => {
98
98
  res.type('text/plain');
99
+ const lastModified = this._apiSrv._getAccessTokenFileLastModified();
100
+ if (lastModified) {
101
+ res.append('Last-Modified', lastModified);
102
+ }
99
103
  res.send(this._apiSrv._getSecretId() || '');
100
104
  },
101
105
  );