Skip to content

feat: Add support for Parse.File.setDirectory, setMetadata, setTags with stream-based file upload - #2937

Merged
mtrezza merged 5 commits into
parse-community:alphafrom
mtrezza:feat/file-stream-dir
Mar 4, 2026
Merged

mtrezza merged 5 commits into
parse-community:alphafrom
mtrezza:feat/file-stream-dir

Conversation

@mtrezza

@mtrezza mtrezza commented Mar 4, 2026 •

Copy link
Copy Markdown
Member

Pull Request

Issue

Add support for setting Parse.File.setDirectory, setMetadata , setTags for stream-based file upload

Tasks

  • Add tests
  • Add changes to documentation (guides, repository pages, code comments)

Summary by CodeRabbit

  • Bug Fixes

    • Stream-based files now save correctly with metadata, tags, and directory by routing to the binary upload path when appropriate; headers are included so these fields are preserved.
  • Documentation

    • Clarified that stream-based metadata/tags/directory are supported when Parse Server >= 9.5.0 and noted JSON-encoding behavior for certain cases.
  • Tests

    • Updated tests to assert streaming uploads send metadata, tags, and directory headers instead of throwing.

@parse-github-assistant

parse-github-assistant Bot commented Mar 4, 2026 •

Copy link
Copy Markdown

🚀 Thanks for opening this pull request!

@parseplatformorg

parseplatformorg commented Mar 4, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
✅ Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@mtrezza mtrezza changed the title feat: Add support for setting Parse.File.setDirectory, setMetadata , setTags for stream-based file upload feat: Add support for setting Parse.File.setDirectory, setMetadata, setTags for stream-based file upload Mar 4, 2026
@coderabbitai

coderabbitai Bot commented Mar 4, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Route stream-based files through the binary upload path when appropriate, allowing directory, metadata, and tags to be sent as headers; update JSDoc, types, and tests to reflect Parse Server >= 9.5.0 requirements and the new save behavior.

Changes

Cohort / File(s) Summary
Stream Save Logic
src/ParseFile.ts
Allow stream-backed files to use the binary upload flow when saveBinary is enabled or when there is no file data. Include directory, metadata, and tags in headers sent by DefaultController.saveBinary. Adjust hasFileData logic and JSDoc noting Parse Server >= 9.5.0 for stream directory support.
Tests
src/__tests__/ParseFile-test.js
Replace previous error-expecting test with one asserting the binary/ajax upload path is used for stream saves and that X-Parse-Directory, X-Parse-Metadata, and X-Parse-Tags headers are set. Mocking adjusted accordingly.
Types / Docs
types/ParseFile.d.ts
Update JSDoc comments to indicate metadata/tags/directory are supported for stream uploads when Parse Server >= 9.5.0 and note JSON encoding behavior; no signature changes.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant SDK as DefaultController/ParseFile
    participant Server
    Client->>SDK: save(fileStream, { directory, metadata, tags, saveBinary })
    SDK->>SDK: detect stream & evaluate saveBinary / hasFileData
    SDK->>Server: POST /files (binary) with headers: X-Parse-Directory, X-Parse-Metadata, X-Parse-Tags
    Server-->>SDK: 201 Created (file info)
    SDK-->>Client: resolve(saved File)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description includes the required Issue section and marks the relevant Tasks as completed, but omits the Approach section explaining the implementation details. Add an Approach section describing how directory, metadata, and tags are now supported for stream-based uploads in the Parse.File implementation.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main feature: adding support for directory, metadata, and tags with stream-based file uploads.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mtrezza mtrezza changed the title feat: Add support for setting Parse.File.setDirectory, setMetadata, setTags for stream-based file upload feat: Add support for setting Parse.File.setDirectory, setMetadata, setTags with stream-based file upload Mar 4, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@types/ParseFile.d.ts`:
- Around line 203-205: Update the conflicting JSDoc comments in ParseFile.d.ts
so they match the new behavior: replace any statements that say "stream files
with metadata/tags throw" with a version-note that stream-based uploads support
metadata/tags when Parse Server >= 9.5.0 (same phrasing as the new note near
"Sets metadata..."). Specifically edit the earlier JSDoc blocks (the comment
near line ~67 and the block around the current 154-156) and also the other
occurrences noted (around 211, 218-220, 226, 235) to remove the "throws"
language and add the version requirement/compatibility note and/or remove
contradictory warnings so all comments consistently state that metadata/tags on
stream-based files require Parse Server >= 9.5.0.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f16a5e4a-437e-47fc-9acf-7067bf18ce19

📥 Commits

Reviewing files that changed from the base of the PR and between 634793f and 3347bd7.

📒 Files selected for processing (1)
  • types/ParseFile.d.ts

Comment thread types/ParseFile.d.ts Resolved
@codecov

codecov Bot commented Mar 4, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d02621e) to head (2db6235).
⚠️ Report is 8 commits behind head on alpha.

Additional details and impacted files
@@            Coverage Diff            @@
##             alpha     #2937   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           64        64           
  Lines         6327      6331    +4     
  Branches      1516      1518    +2     
=========================================
+ Hits          6327      6331    +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mtrezza mtrezza changed the title feat: Add support for setting Parse.File.setDirectory, setMetadata, setTags with stream-based file upload feat: Add support for Parse.File.setDirectory, setMetadata, setTags with stream-based file upload Mar 4, 2026
@mtrezza
mtrezza merged commit 18ded83 into parse-community:alpha Mar 4, 2026
12 of 13 checks passed
@mtrezza
mtrezza deleted the feat/file-stream-dir branch March 4, 2026 16:47
parseplatformorg pushed a commit that referenced this pull request Mar 4, 2026
# [8.4.0-alpha.1](8.3.0...8.4.0-alpha.1) (2026-03-04)

### Features

* Add support for `Parse.File.setDirectory`, `setMetadata`, `setTags` with stream-based file upload ([#2937](#2937)) ([18ded83](18ded83))
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 8.4.0-alpha.1

@parseplatformorg parseplatformorg added the state:released-alpha Released as alpha version label Mar 4, 2026
parseplatformorg pushed a commit that referenced this pull request Mar 4, 2026
# [8.4.0](8.3.0...8.4.0) (2026-03-04)

### Features

* Add support for `Parse.File.setDirectory`, `setMetadata`, `setTags` with stream-based file upload ([#2937](#2937)) ([18ded83](18ded83))
@parseplatformorg

Copy link
Copy Markdown
Contributor

🎉 This change has been released in version 8.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:released Released as stable version state:released-alpha Released as alpha version

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants