diff --git a/.changeset/stream-multipart-uploads.md b/.changeset/stream-multipart-uploads.md deleted file mode 100644 index 98150928..00000000 --- a/.changeset/stream-multipart-uploads.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -"@googleworkspace/cli": patch ---- - -Stream multipart uploads to avoid OOM on large files. File content is now streamed in chunks via `ReaderStream` instead of being read entirely into memory, reducing memory usage from O(file_size) to O(64 KB). diff --git a/.changeset/upload-content-type.md b/.changeset/upload-content-type.md deleted file mode 100644 index c4ac7e0b..00000000 --- a/.changeset/upload-content-type.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -"@googleworkspace/cli": minor ---- - -Add `--upload-content-type` flag and smart MIME inference for multipart uploads - -Previously, multipart uploads used the metadata `mimeType` field for both the Drive -metadata and the media part's `Content-Type` header. This made it impossible to upload -a file in one format (e.g. Markdown) and have Drive convert it to another (e.g. Google Docs), -because the media `Content-Type` and the target `mimeType` must differ for import conversions. - -The new `--upload-content-type` flag allows setting the media `Content-Type` explicitly. -When omitted, the media type is now inferred from the file extension before falling back -to the metadata `mimeType`. This matches Google Drive's model where metadata `mimeType` -is the *target* type (what the file should become) while the media `Content-Type` is the -*source* type (what the bytes are). - -This means import conversions now work automatically: -```bash -# Extension inference detects text/markdown → conversion just works -gws drive files create \ - --json '{"name":"My Doc","mimeType":"application/vnd.google-apps.document"}' \ - --upload notes.md - -# Explicit flag still available as an override -gws drive files create \ - --json '{"name":"My Doc","mimeType":"application/vnd.google-apps.document"}' \ - --upload notes.md \ - --upload-content-type text/markdown -``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 21ddb9ed..46ea6f17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,41 @@ # @googleworkspace/cli +## 0.14.0 + +### Minor Changes + +- dc561e0: Add `--upload-content-type` flag and smart MIME inference for multipart uploads + + Previously, multipart uploads used the metadata `mimeType` field for both the Drive + metadata and the media part's `Content-Type` header. This made it impossible to upload + a file in one format (e.g. Markdown) and have Drive convert it to another (e.g. Google Docs), + because the media `Content-Type` and the target `mimeType` must differ for import conversions. + + The new `--upload-content-type` flag allows setting the media `Content-Type` explicitly. + When omitted, the media type is now inferred from the file extension before falling back + to the metadata `mimeType`. This matches Google Drive's model where metadata `mimeType` + is the _target_ type (what the file should become) while the media `Content-Type` is the + _source_ type (what the bytes are). + + This means import conversions now work automatically: + + ```bash + # Extension inference detects text/markdown → conversion just works + gws drive files create \ + --json '{"name":"My Doc","mimeType":"application/vnd.google-apps.document"}' \ + --upload notes.md + + # Explicit flag still available as an override + gws drive files create \ + --json '{"name":"My Doc","mimeType":"application/vnd.google-apps.document"}' \ + --upload notes.md \ + --upload-content-type text/markdown + ``` + +### Patch Changes + +- 945ac91: Stream multipart uploads to avoid OOM on large files. File content is now streamed in chunks via `ReaderStream` instead of being read entirely into memory, reducing memory usage from O(file_size) to O(64 KB). + ## 0.13.3 ### Patch Changes diff --git a/Cargo.lock b/Cargo.lock index 198e3212..4cfeacac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -861,7 +861,7 @@ dependencies = [ [[package]] name = "gws" -version = "0.13.3" +version = "0.14.0" dependencies = [ "aes-gcm", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 8aa0db22..96d9c07a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ [package] name = "gws" -version = "0.13.3" +version = "0.14.0" edition = "2021" description = "Google Workspace CLI — dynamic command surface from Discovery Service" license = "Apache-2.0" diff --git a/package.json b/package.json index ff477de5..175b8508 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@googleworkspace/cli", - "version": "0.13.3", + "version": "0.14.0", "private": true, "description": "Google Workspace CLI — dynamic command surface from Discovery Service", "license": "Apache-2.0",