@adobe/helix-google-support 1.3.4 → 1.4.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,24 @@
1
+ ## [1.4.2](https://github.com/adobe/helix-google-support/compare/v1.4.1...v1.4.2) (2022-05-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update dependency @adobe/helix-onedrive-support to v8.0.1 ([4e43fcb](https://github.com/adobe/helix-google-support/commit/4e43fcbced273a4bb68463ec5579a1442bdc535a))
7
+
8
+ ## [1.4.1](https://github.com/adobe/helix-google-support/compare/v1.4.0...v1.4.1) (2022-05-04)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * save refresh token ([#19](https://github.com/adobe/helix-google-support/issues/19)) ([f3fea7b](https://github.com/adobe/helix-google-support/commit/f3fea7ba0d868fd96288579463c842410b956dd5))
14
+
15
+ # [1.4.0](https://github.com/adobe/helix-google-support/compare/v1.3.4...v1.4.0) (2022-05-04)
16
+
17
+
18
+ ### Features
19
+
20
+ * log token cache operations ([#18](https://github.com/adobe/helix-google-support/issues/18)) ([8ceb35d](https://github.com/adobe/helix-google-support/commit/8ceb35db0856da3c28992fb435e6409341775456))
21
+
1
22
  ## [1.3.4](https://github.com/adobe/helix-google-support/compare/v1.3.3...v1.3.4) (2022-05-04)
2
23
 
3
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-google-support",
3
- "version": "1.3.4",
3
+ "version": "1.4.2",
4
4
  "description": "Helix Google Support",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -31,7 +31,7 @@
31
31
  "reporter-options": "configFile=.mocha-multi.json"
32
32
  },
33
33
  "dependencies": {
34
- "@adobe/helix-onedrive-support": "8.0.0",
34
+ "@adobe/helix-onedrive-support": "8.0.1",
35
35
  "googleapis": "100.0.0",
36
36
  "lru-cache": "7.9.0"
37
37
  },
@@ -107,7 +107,10 @@ export class GoogleClient {
107
107
  const originalRefreshTokenNoCache = this.auth.refreshTokenNoCache.bind(this.auth);
108
108
  this.auth.refreshTokenNoCache = async (...args) => {
109
109
  const ret = await originalRefreshTokenNoCache(...args);
110
- await this.cache.store(ret.tokens);
110
+ await this.cache.store({
111
+ refresh_token: this.auth.credentials.refresh_token,
112
+ ...ret.tokens,
113
+ });
111
114
  return ret;
112
115
  };
113
116
  }
@@ -40,12 +40,25 @@ export class GoogleTokenCache {
40
40
  this.tokens = JSON.parse(str);
41
41
  }
42
42
 
43
+ logTokens(msg) {
44
+ const {
45
+ access_token: accessToken,
46
+ refresh_token: refreshToken,
47
+ expiry_date: expiryDate,
48
+ } = this.tokens;
49
+ const exp = expiryDate ? new Date(expiryDate).toISOString() : '?';
50
+ this.log.info(`${msg}: access_token=${accessToken ? '***' : '?'} refresh_token=${refreshToken ? '***' : '?'} expires=${exp}`);
51
+ }
52
+
43
53
  async load() {
44
- return this.plugin.beforeCacheAccess(this.context);
54
+ const ret = await this.plugin.beforeCacheAccess(this.context);
55
+ this.logTokens('GoogleTokenCache loaded');
56
+ return ret;
45
57
  }
46
58
 
47
59
  async store(tokens) {
48
60
  this.tokens = tokens;
61
+ this.logTokens('GoogleTokenCache stored');
49
62
  this.context.cacheHasChanged = true;
50
63
  try {
51
64
  await this.plugin.afterCacheAccess(this.context);