@theholocron/google-client 1.58.0-alpha.17 → 1.58.0-alpha.18

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/README.md CHANGED
@@ -28,7 +28,7 @@ const [err, doc] = await google.documents.get("1BxiMVs0XRA...");
28
28
 
29
29
  ### Service Account
30
30
 
31
- Set credentials via environment variables:
31
+ Set credentials via environment variables. Each is read as `HOLOCRON_<NAME>` first (`HOLOCRON_GOOGLE_PROJECT_ID`), then the bare name shown here, which keeps working:
32
32
 
33
33
  ```bash
34
34
  # Option 1 — full JSON key file
package/dist/index.mjs CHANGED
@@ -1,18 +1,19 @@
1
1
  import { google as google$1 } from "googleapis";
2
2
  import http from "node:http";
3
3
  import url from "node:url";
4
- import { createEnvLookup } from "@theholocron/env-utils/lookup";
4
+ import { holocronEnv } from "@theholocron/env-utils/lookup";
5
5
  import open from "open";
6
6
  import destroyer from "server-destroy";
7
7
  // src/key.ts
8
8
  /**
9
9
  * Load service account credentials from environment variables.
10
+ * Each variable is read as `HOLOCRON_<NAME>` first, then the bare `<NAME>`.
10
11
  * Set GOOGLE_SERVICE_ACCOUNT_JSON to the full JSON key file content,
11
12
  * or set individual GOOGLE_* variables for each field.
12
13
  *
13
14
  * @param env - Where to read the variables from; defaults to the process environment, pass a fake in tests.
14
15
  */
15
- function loadServiceAccountKey(env = createEnvLookup()) {
16
+ function loadServiceAccountKey(env = holocronEnv()) {
16
17
  const raw = env.get("GOOGLE_SERVICE_ACCOUNT_JSON");
17
18
  if (raw) return JSON.parse(raw);
18
19
  for (const key of [
@@ -50,7 +51,7 @@ function buildOAuth2Client(env) {
50
51
  *
51
52
  * @param env - Where to read the GOOGLE_* variables from; defaults to the process environment.
52
53
  */
53
- const oauth = async (scopes, env = createEnvLookup()) => {
54
+ const oauth = async (scopes, env = holocronEnv()) => {
54
55
  const oauth2Client = buildOAuth2Client(env);
55
56
  const port = parseInt(env.get("GOOGLE_REDIRECT_PORT") ?? "4000", 10);
56
57
  return new Promise((resolve, reject) => {
@@ -82,7 +83,7 @@ const oauth = async (scopes, env = createEnvLookup()) => {
82
83
  *
83
84
  * @param env - Where to read the GOOGLE_* variables from; defaults to the process environment.
84
85
  */
85
- async function googleAuth(scopes, env = createEnvLookup()) {
86
+ async function googleAuth(scopes, env = holocronEnv()) {
86
87
  return await new google$1.auth.GoogleAuth({
87
88
  credentials: loadServiceAccountKey(env),
88
89
  scopes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/google-client",
3
- "version": "1.58.0-alpha.17",
3
+ "version": "1.58.0-alpha.18",
4
4
  "description": "A TypeScript client for Google Workspace APIs (Docs, Sheets)",
5
5
  "keywords": [
6
6
  "google",
@@ -32,7 +32,7 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "google-auth-library": "^11.3.2",
35
+ "google-auth-library": "^11.3.3",
36
36
  "googleapis": "^188.0.0",
37
37
  "open": "^11.0.0",
38
38
  "server-destroy": "^1.0.1",
@@ -41,17 +41,17 @@
41
41
  "devDependencies": {
42
42
  "@types/node": "^26",
43
43
  "@types/server-destroy": "^1.0.4",
44
- "@vitest/coverage-v8": "^5.0.5",
44
+ "@vitest/coverage-v8": "^5.1.0",
45
45
  "@vitest/eslint-plugin": "^1.6.28",
46
46
  "eslint": "^10.14.0",
47
47
  "eslint-plugin-n": "^18.5.0",
48
48
  "globals": "^17.14.0",
49
- "tsdown": "^0.23.4",
49
+ "tsdown": "^0.23.5",
50
50
  "typescript": "^5.9.3",
51
- "vitest": "^5.0.5",
51
+ "vitest": "^5.1.0",
52
52
  "@theholocron/eslint-config": "^8.9.0-alpha.11",
53
- "@theholocron/tsdown-config": "^8.9.0-alpha.11",
54
53
  "@theholocron/tsconfig": "^8.9.0-alpha.11",
54
+ "@theholocron/tsdown-config": "^8.9.0-alpha.11",
55
55
  "@theholocron/vitest-config": "^8.9.0-alpha.11"
56
56
  },
57
57
  "engines": {