Repository navigation
Add types for file bucket calls (developer preview) - #399
Open
DolevEpshtein wants to merge 1 commit into
Open
DolevEpshtein wants to merge 1 commit into
DolevEpshtein wants to merge 1 commit into
Conversation
- UploadPrivateFile: optional bucket, folder, and data inputs - New Core calls: UpdatePrivateFile, DeletePrivateFile, ListPrivateFiles - PrivateFileItem, PrivateFileFolder, and the new params/result types - entities get(): optional _file_links (EntityFileLinks) on the record - Unit tests pinning the multipart encoding (data sent as JSON text) and type tests for the new calls Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DW9diQxNSCzrvANwtqdMBk
Contributor
🚀 Package Preview Available!Install this PR's preview build with npm: npm i @base44-preview/sdk@0.8.64-pr.399.0af3d20Prefer not to change any import paths? Install using npm alias so your code still imports npm i "@base44/sdk@npm:@base44-preview/sdk@0.8.64-pr.399.0af3d20"Or add it to your {
"dependencies": {
"@base44/sdk": "npm:@base44-preview/sdk@0.8.64-pr.399.0af3d20"
}
}
Preview published to npm registry — try new features instantly! |
This branch has not been deployed
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
Adds TypeScript types and reference docs for the platform's file bucket calls. They're Core integration calls, reached the same way as
UploadPrivateFile. Every new type, field, and method is marked@alphaand documented as a developer preview that needs file buckets enabled for the app.Source of the contract. This PR follows a contract given in the task brief. It was copied from open, unmerged platform pull requests: base44-dev/apper#49162, #49212, #49213, #49214, and #45254. I couldn't read the platform repo. If those PRs change before they merge, these types need to change too.
What's added
UploadPrivateFile: new optionalbucket,folder, anddatainputs. Withoutbucket, the call behaves exactly as it does today.CoreIntegrations:UpdatePrivateFile(returnsPrivateFileItem),DeletePrivateFile(returns{ file_uri, deleted: true }), andListPrivateFiles(returns{ files, next_cursor, folders, folders_next_cursor }).PrivateFileItem,PrivateFileFolder,UpdatePrivateFileParams,DeletePrivateFileParams,DeletePrivateFileResult,ListPrivateFilesParams, andListPrivateFilesResult.EntityHandler.get()now returnsPromise<T & EntityGetExtraFields>, which adds an optional_file_links?: EntityFileLinks. List methods are unchanged, so they never carry it. The user's ownTis kept,EntityHandler<any>staysany, and assigning the result to aTvariable still compiles. A type test covers all three.EntityFileLinksandEntityGetExtraFieldsare exported.@throwsin the docs. No new error classes.Base44Error.codealready readserror.codefrom the{ error: { code, message, details } }body.Runtime (item 3): no change was needed
When any param is a
File,createIntegrationsModulealready sends non-null objects asJSON.stringify(value), andFiles as files. Other values are appended as they are, so strings stay strings and numbers and booleans become their string form. That meansdataalready arrives as JSON text andbucketandfolderarrive as plain strings. I didn't change the runtime. New unit tests intests/unit/integrations.test.tslock in that behavior:datais JSON text, not[object Object], and it parses back to the same object.bucketandfolderare plain strings, and the file keeps its name.bucketsends onlyfile./apps/{appId}/integration-endpoints/Core/{name}.Notes and mismatches
undefinedornullin multipart (existing behavior, left unchanged). In theFilepath, a key set toundefinedis sent as the text"undefined", andnullis sent as"null". A call likeUploadPrivateFile({ file, bucket, folder: maybeFolder })withmaybeFolder === undefinedwould sendfolder="undefined". The brief limited runtime changes to object encoding, so I didn't fix this. A follow-up could skipundefinedkeys.folderholds for a file at the bucket's root, so the docs don't say either.get()'s Returns section shows theEntityGetExtraFieldsproperties. The record's own fields come from the user'sT, so the docs can't list them, and the returns text says this.Test plan
npm test -w @base44/sdk(type tests plus vitest): 33 files, 489 tests passednpm run lint: cleannpm run build -w @base44/sdk: OKnpm run create-docs -w @base44/sdk: generated. I checked the integrations and entities pages, and the Throws anchors (#throwsto#throws-4) point to the right methods.Generated by Claude Code