feat: add GoogleDriveTransport for uploading docx as Google Docs#12
Merged
Conversation
Adds a Transport implementation that uploads a .docx buffer to Google Drive and converts it into a native Google Doc on import. ### Features - `GoogleDriveTransport` in `src/google.ts` uses the Drive v3 API's `files.create`/`files.update` with the `.docx` bytes as the media body and `mimeType: application/vnd.google-apps.document`, so Drive performs the conversion on upload; the returned `fileId` is stored. - Scoped to `drive.file` only; access-token acquisition is left to the consumer rather than baked into the transport. - `@googleapis/drive` is imported lazily so consumers who never touch Google Drive don't pay for loading the SDK. - `google-auth-library` is declared as an optional peer dependency. ### Refactoring - `DOCX_MIME_TYPE` moves to `src/transport.ts` and is re-exported from `src/sharepoint.ts`, keeping the public API surface unchanged while letting both transports share the constant. Closes #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GoogleDriveTransport, aTransportimplementation that uploads a.docxbuffer to Google Drive and converts it into a native Google Doc on import.Changes
Features
GoogleDriveTransportusing the Drive v3 API'sfiles.create/files.update, with the.docxbytes as the media body andmimeType: application/vnd.google-apps.documentso Drive converts the file on upload; the returnedfileIdis stored.drive.filescope only; access-token acquisition is left to the consumer rather than baked into the transport.@googleapis/driveis imported lazily so consumers who never touch Google Drive don't pay for loading the SDK.google-auth-libraryas an optional peer dependency.Refactoring
DOCX_MIME_TYPErelocated here fromsrc/sharepoint.ts.DOCX_MIME_TYPEfromsrc/transport.ts, keeping the public API surface unchanged while letting both transports share the constant.GoogleDriveTransportexport.Tests
.docxupload/convert flow and asserting thedrive.filescope.Documentation
GoogleDriveTransportusage.Test plan
pnpm check(biome + tsc + 162 vitest tests + build) passesCloses #5