@adobe/helix-google-support 3.2.17 → 3.3.0

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,10 @@
1
+ # [3.3.0](https://github.com/adobe/helix-google-support/compare/v3.2.17...v3.3.0) (2025-06-16)
2
+
3
+
4
+ ### Features
5
+
6
+ * export google objects ([#493](https://github.com/adobe/helix-google-support/issues/493)) ([24d1e6f](https://github.com/adobe/helix-google-support/commit/24d1e6f80c3243a2a7514b74969fec02dbdd7ae6))
7
+
1
8
  ## [3.2.17](https://github.com/adobe/helix-google-support/compare/v3.2.16...v3.2.17) (2025-05-26)
2
9
 
3
10
 
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ import importPlugin from 'eslint-plugin-import';
13
+ import { defineConfig, globalIgnores } from '@eslint/config-helpers'
14
+ import { recommended, source, test } from '@adobe/eslint-config-helix';
15
+
16
+ export default defineConfig([
17
+ globalIgnores([
18
+ '.vscode/*',
19
+ 'coverage/*',
20
+ ]),
21
+ {
22
+ rules: {
23
+ 'import/extensions': ['error', 'ignorePackages'],
24
+ 'import/prefer-default-export': 0,
25
+ // see https://github.com/import-js/eslint-plugin-import/issues/1868
26
+ 'import/no-unresolved': ['error', { ignore: ['@octokit/rest'] }],
27
+ },
28
+ plugins: {
29
+ import: recommended.plugins.import,
30
+ },
31
+ extends: [recommended],
32
+ },
33
+ source,
34
+ test,
35
+ ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-google-support",
3
- "version": "3.2.17",
3
+ "version": "3.3.0",
4
4
  "description": "Helix Google Support",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -36,21 +36,23 @@
36
36
  "dependencies": {
37
37
  "@adobe/helix-shared-string": "^2.1.0",
38
38
  "googleapis": "^149.0.0",
39
+ "googleapis-common": "7.2.0",
39
40
  "lru-cache": "^11.0.2"
40
41
  },
41
42
  "devDependencies": {
42
- "@adobe/eslint-config-helix": "2.0.9",
43
+ "@adobe/eslint-config-helix": "3.0.3",
43
44
  "@adobe/helix-shared-tokencache": "1.5.0",
45
+ "@eslint/config-helpers": "0.2.2",
44
46
  "@semantic-release/changelog": "6.0.3",
45
47
  "@semantic-release/git": "10.0.1",
46
48
  "c8": "10.1.3",
47
- "eslint": "8.57.1",
49
+ "eslint": "9.4.0",
48
50
  "eslint-plugin-header": "3.1.1",
49
51
  "eslint-plugin-import": "2.31.0",
50
52
  "husky": "9.1.7",
51
53
  "junit-report-builder": "5.1.1",
52
- "lint-staged": "16.0.0",
53
- "mocha": "11.5.0",
54
+ "lint-staged": "16.1.0",
55
+ "mocha": "11.6.0",
54
56
  "mocha-multi-reporters": "1.5.1",
55
57
  "mocha-suppress-logs": "0.5.1",
56
58
  "nock": "13.5.6",
@@ -10,12 +10,12 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  import { LRUCache } from 'lru-cache';
13
- import { google } from 'googleapis';
14
13
  import {
15
14
  editDistance, sanitizeName, splitByExtension,
16
15
  } from '@adobe/helix-shared-string';
17
16
  import { GoogleTokenCache } from './GoogleTokenCache.js';
18
17
  import { StatusCodeError } from './StatusCodeError.js';
18
+ import { google } from './google.js';
19
19
 
20
20
  let lru = new LRUCache({ max: 1000, ttl: 60000 });
21
21
 
package/src/google.js ADDED
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ import { AuthPlus } from 'googleapis-common';
13
+ import docs from 'googleapis/build/src/apis/docs/index.js';
14
+ import drive from 'googleapis/build/src/apis/drive/index.js';
15
+ import sheets from 'googleapis/build/src/apis/sheets/index.js';
16
+ import oauth2 from 'googleapis/build/src/apis/oauth2/index.js';
17
+
18
+ /**
19
+ * Given an API object exposing a `VERSIONS` property, return the appropriate instance
20
+ * of that API based on the `version` property in options.
21
+ *
22
+ * @param {any} api API object exposing a `VERSIONS` property.
23
+ * @param {object} opts options
24
+ * @returns API instance
25
+ */
26
+ function apiVersion(api, opts) {
27
+ const ctor = api.VERSIONS[opts.version];
28
+ // eslint-disable-next-line no-param-reassign
29
+ delete opts.version;
30
+ // eslint-disable-next-line new-cap
31
+ return new ctor(opts);
32
+ }
33
+
34
+ const google = {
35
+ auth: new AuthPlus(),
36
+ oauth2: (opts) => apiVersion(oauth2, opts),
37
+ docs: (opts) => apiVersion(docs, opts),
38
+ drive: (opts) => apiVersion(drive, opts),
39
+ sheets: (opts) => apiVersion(sheets, opts),
40
+ };
41
+
42
+ export { google };
package/src/index.js CHANGED
@@ -11,3 +11,4 @@
11
11
  */
12
12
  export { GoogleClient } from './GoogleClient.js';
13
13
  export { GoogleTokenCache } from './GoogleTokenCache.js';
14
+ export { google } from './google.js';