{"_id":"@byoc/google-drive","_rev":"4-738ed65cea3aa427fd9497b926f70a7b","name":"@byoc/google-drive","dist-tags":{"latest":"0.4.0"},"versions":{"0.2.0":{"name":"@byoc/google-drive","version":"0.2.0","keywords":["byoc","google-drive","cloud-storage","adapter","oauth2","pkce"],"author":{"name":"BYOC Team"},"license":"Apache-2.0","_id":"@byoc/google-drive@0.2.0","maintainers":[{"name":"ajayvarmaramineni","email":"ajayvarmawork11@gmail.com"}],"homepage":"https://github.com/Ajayvarmaramineni/BYOC#readme","bugs":{"url":"https://github.com/Ajayvarmaramineni/BYOC/issues"},"dist":{"shasum":"2b8b96168f9b86d75d65462d408a8c4164759610","tarball":"https://registry.npmjs.org/@byoc/google-drive/-/google-drive-0.2.0.tgz","fileCount":51,"integrity":"sha512-yOtDSPy4/R2MQwSSzERKV+x1ZG8WrwflBJ5MJj55TmBVhrqlSTOKx9ocL4foqDri7jjYdQhbkWwrWtz2ls2PuQ==","signatures":[{"sig":"MEUCIAQ620LaI6u7zUMNGfiAqLDWGm2itJYBxy9vpsi2MWNmAiEApYzJHl2jFOGmbgKR80A0/Iu2QvwnjvAH0wgDSjeQXTw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":148926},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"3bb0599bc8e926588b1d052d5dbd82ac1c598772","scripts":{"build":"tsc -b","clean":"rm -rf dist tsconfig.tsbuildinfo"},"_npmUser":{"name":"ajayvarmaramineni","email":"ajayvarmawork11@gmail.com"},"repository":{"url":"git+https://github.com/Ajayvarmaramineni/BYOC.git","type":"git","directory":"packages/google-drive"},"_npmVersion":"11.11.0","description":"Google Drive storage provider adapter for BYOC (Bring Your Own Cloud)","directories":{},"_nodeVersion":"25.8.1","dependencies":{"@byoc/core":"^0.2.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/google-drive_0.2.0_1787717972566_0.6579764619534674","host":"s3://npm-registry-packages-npm-production"}},"0.2.1":{"name":"@byoc/google-drive","version":"0.2.1","keywords":["byoc","google-drive","cloud-storage","adapter","oauth2","pkce"],"author":{"name":"Ajay Ramineni"},"license":"Apache-2.0","_id":"@byoc/google-drive@0.2.1","maintainers":[{"name":"ajayvarmaramineni","email":"ajayvarmawork11@gmail.com"}],"homepage":"https://github.com/Ajayvarmaramineni/BYOC/tree/main/packages/google-drive#readme","bugs":{"url":"https://github.com/Ajayvarmaramineni/BYOC/issues"},"dist":{"shasum":"0310b20810ac5f0a24d7b2b66730ef5cb3585831","tarball":"https://registry.npmjs.org/@byoc/google-drive/-/google-drive-0.2.1.tgz","fileCount":51,"integrity":"sha512-sgV9Dv4BBXiNYhUfeUp4Pt1+li3m5PByrNJB2FVz07fQStxR9c99+xpyBDJRB3AAYixsMN8EJTkXBzWYlq8k/A==","signatures":[{"sig":"MEYCIQDBaRy1DpRbtBQVs6tejrFu4SMMrzN1jbtOJ4rnqCqgLgIhAPXHhdSEGYrHDJIMl4USkzo5cYJJSqK8Ldiq/2nZB9/F","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":149194},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"ed39479c5c352a8dd388011f0b968f3c8dca9d9c","scripts":{"build":"tsc -b","clean":"rm -rf dist tsconfig.tsbuildinfo"},"_npmUser":{"name":"ajayvarmaramineni","email":"ajayvarmawork11@gmail.com"},"repository":{"url":"git+https://github.com/Ajayvarmaramineni/BYOC.git","type":"git","directory":"packages/google-drive"},"_npmVersion":"11.11.0","description":"Google Drive storage provider adapter for BYOC (Bring Your Own Cloud)","directories":{},"sideEffects":false,"_nodeVersion":"25.8.1","dependencies":{"@byoc/core":"^0.2.1","@types/node":">=20"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/google-drive_0.2.1_1787800927128_0.5799302631195631","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@byoc/google-drive","version":"0.3.0","keywords":["byoc","google-drive","cloud-storage","adapter","oauth2","pkce"],"author":{"name":"Ajay Ramineni"},"license":"Apache-2.0","_id":"@byoc/google-drive@0.3.0","maintainers":[{"name":"ajayvarmaramineni","email":"ajayvarmawork11@gmail.com"}],"homepage":"https://github.com/Ajayvarmaramineni/BYOC/tree/main/packages/google-drive#readme","bugs":{"url":"https://github.com/Ajayvarmaramineni/BYOC/issues"},"dist":{"shasum":"07e1b087c33e178307e431e6d8a20133eefab89d","tarball":"https://registry.npmjs.org/@byoc/google-drive/-/google-drive-0.3.0.tgz","fileCount":51,"integrity":"sha512-NmXYZlBvUB6j7Jjj2VzXNFuTG1991Y2xCo0OyhKyA/c9W3vEwk258x2r2gG7HwpTZwfXE96WkXN7+luFPVLMqw==","signatures":[{"sig":"MEUCIH4kYZxyuvBFYHPgHsKINbZbesN8b9Jum/zJWEykcgToAiEAhu7kPhnwTQlEEhJ99xfaYe+1Mnix3Jw//6DpRQdYoag=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":149194},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"gitHead":"08cd88be6fa4b7a9c3cbf29275c8eee04c88bcf6","scripts":{"build":"tsc -b","clean":"rm -rf dist tsconfig.tsbuildinfo"},"_npmUser":{"name":"ajayvarmaramineni","email":"ajayvarmawork11@gmail.com"},"repository":{"url":"git+https://github.com/Ajayvarmaramineni/BYOC.git","type":"git","directory":"packages/google-drive"},"_npmVersion":"11.11.0","description":"Google Drive storage provider adapter for BYOC (Bring Your Own Cloud)","directories":{},"sideEffects":false,"_nodeVersion":"25.8.1","dependencies":{"@byoc/core":"^0.3.0","@types/node":">=20"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/google-drive_0.3.0_1788102933111_0.5852778617208563","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@byoc/google-drive","version":"0.4.0","description":"Google Drive storage provider adapter for BYOC (Bring Your Own Cloud)","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","default":"./dist/index.js"}},"scripts":{"build":"tsc -b","clean":"rm -rf dist tsconfig.tsbuildinfo"},"dependencies":{"@byoc/core":"^0.4.0","@types/node":">=26"},"keywords":["byoc","google-drive","cloud-storage","adapter","oauth2","pkce"],"author":{"name":"Ajay Ramineni"},"license":"Apache-2.0","repository":{"type":"git","url":"git+https://github.com/Ajayvarmaramineni/BYOC.git","directory":"packages/google-drive"},"publishConfig":{"access":"public"},"homepage":"https://github.com/Ajayvarmaramineni/BYOC/tree/main/packages/google-drive#readme","bugs":{"url":"https://github.com/Ajayvarmaramineni/BYOC/issues"},"engines":{"node":">=20"},"sideEffects":false,"gitHead":"4b2a714094177d387691f4a1bc7fb04d89a74081","_id":"@byoc/google-drive@0.4.0","_nodeVersion":"25.8.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-8V5dSQ7VUuV0+ILWcawiHmCHkNpwuNZ4O8rZKqFOLGK03XE/riZAcHelM2eKGYA4HRdr/MhUA60484XLDdvtMg==","shasum":"eeae9d945cc60f4b32f4b512ce3d13498287bcc3","tarball":"https://registry.npmjs.org/@byoc/google-drive/-/google-drive-0.4.0.tgz","fileCount":51,"unpackedSize":164754,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCApqASWjLyBg0jzrMe/wzd2X/KHiZC7BcGKlV1HS9nIwIhANDIHCz2xobWOv57xEPbpKJOxfKfbvqL9zi3Dwk4CWLm"}]},"_npmUser":{"name":"ajayvarmaramineni","email":"ajayvarmawork11@gmail.com"},"directories":{},"maintainers":[{"name":"ajayvarmaramineni","email":"ajayvarmawork11@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/google-drive_0.4.0_1788653099525_0.24055066233185007"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-26T04:19:31.768Z","modified":"2026-09-06T00:04:59.896Z","0.2.0":"2026-08-26T04:19:32.717Z","0.2.1":"2026-08-27T03:22:07.283Z","0.3.0":"2026-08-30T15:15:33.251Z","0.4.0":"2026-09-06T00:04:59.704Z"},"bugs":{"url":"https://github.com/Ajayvarmaramineni/BYOC/issues"},"author":{"name":"Ajay Ramineni"},"license":"Apache-2.0","homepage":"https://github.com/Ajayvarmaramineni/BYOC/tree/main/packages/google-drive#readme","keywords":["byoc","google-drive","cloud-storage","adapter","oauth2","pkce"],"repository":{"type":"git","url":"git+https://github.com/Ajayvarmaramineni/BYOC.git","directory":"packages/google-drive"},"description":"Google Drive storage provider adapter for BYOC (Bring Your Own Cloud)","maintainers":[{"name":"ajayvarmaramineni","email":"ajayvarmawork11@gmail.com"}],"readme":"# @byoc/google-drive\n\nGoogle Drive provider adapter for **BYOC (Bring Your Own Cloud)**: keep application files in the Drive account the end user already owns.\n\n> Part of the [BYOC monorepo](https://github.com/Ajayvarmaramineni/BYOC). Requires `@byoc/core`.\n>\n> **Status: v0.2.0.** Unit tested, and validated against the live Google Drive API.\n\n## Install\n\n```bash\nnpm install @byoc/core @byoc/google-drive\n```\n\n## Setup\n\nYou need a Google Cloud OAuth client before any of this works. [**Google Drive OAuth Setup**](../../docs/google-oauth-setup.md) covers it end to end, including the console's silent-failure spots.\n\n## OAuth 2.0 with PKCE\n\nThis adapter uses the non-restricted `drive.file` scope, so an application never needs a Google Restricted Scope Security Assessment. It can only see files it created or that the user explicitly opened with it.\n\n```ts\nimport { BYOC } from \"@byoc/core\";\nimport {\n  GoogleDriveProvider,\n  GoogleDriveScope,\n  generateCodeVerifier,\n  generateCodeChallenge,\n  generateOAuthState\n} from \"@byoc/google-drive\";\n\nconst codeVerifier = generateCodeVerifier(64);\nconst codeChallenge = await generateCodeChallenge(codeVerifier);\nconst state = generateOAuthState(32);\n\nconst gdrive = new GoogleDriveProvider({\n  auth: {\n    clientId: process.env.GOOGLE_CLIENT_ID!,\n    redirectUri: \"https://myapp.com/api/auth/callback\",\n    scopes: [GoogleDriveScope.FILE]\n  },\n  rootFolderName: \"MyApplication\"\n});\n\n// Redirect the user here, then handle the callback:\nconst loginUrl = gdrive.oauth.getAuthorizationUrl({ state, codeChallenge });\nawait gdrive.oauth.exchangeCode({ code, codeVerifier });\n\nconst storage = new BYOC({ provider: gdrive });\nawait storage.connect();\nawait storage.writeText(\"notes/meeting.md\", \"# Q3 Strategy Notes\");\n```\n\n## Persisting refresh tokens\n\nThe default `InMemoryTokenStorage` clears on restart. For long-lived sessions use `EncryptedFileTokenStorage`, which persists tokens with AES-256-GCM:\n\n```ts\nimport { EncryptedFileTokenStorage } from \"@byoc/google-drive\";\n\nconst gdrive = new GoogleDriveProvider({\n  auth: { clientId: process.env.GOOGLE_CLIENT_ID! },\n  tokenStorage: new EncryptedFileTokenStorage({\n    filePath: \"./.byoc-session.enc\",\n    encryptionKey: process.env.TOKEN_ENCRYPTION_KEY!\n  })\n});\n```\n\n## What this adapter handles\n\n- **Virtual POSIX paths**: `users/123/report.pdf` is resolved to Drive's opaque file IDs, with nested folders created on demand.\n- **404 self-healing**: if a user renames or deletes a file in the Drive web UI, the stale cache entry is invalidated and the path re-resolved.\n- **Resumable uploads**: multi-gigabyte files in 256 KiB-aligned chunks with `onProgress` callbacks and network-failure resumption.\n- **Query escaping**: filenames containing `'` or `\\` are escaped per the Drive API v3 spec.\n- **Rate limiting**: 429 and 5xx responses retried with exponential backoff.\n\n## License\n\n[Apache-2.0](./LICENSE)\n","readmeFilename":"README.md"}