@W-23296058 - feat: UI Bundle upload command - #62
Conversation
| try { | ||
| response = await orgConnection.request<{ jobId: string; status: string; message?: string }>({ | ||
| method: 'POST', | ||
| url: `${orgConnection.baseUrl()}/connect/ui-bundle/deployments`, |
There was a problem hiding this comment.
Pin the API version. baseUrl() → v.0, but endpoint is minVersion 262 (v62.0) per section 2.5,
and we never pin apiVersion. On an org defaulting below 62.0 this silently 404s as an opaque
error. Pin v62.0 explicitly + clear 404 message.
There was a problem hiding this comment.
This is intended as a failure case since we aren't going to support orgs running < 262 anyway. We should just match the version that corresponds to the target org.
There was a problem hiding this comment.
You should add the --api-version flag (https://github.com/salesforcecli/plugin-data/blob/6d78b50ded33d2944c6e253d0d8fd14387d52645/src/commands/data/search.ts#L3
3-L61) and just do a check for >262
If a user tries to use an older api version, throw a meaningful error
| url: `${orgConnection.baseUrl()}/connect/ui-bundle/deployments`, | ||
| body: form.getBuffer(), | ||
| headers: form.getHeaders(), | ||
| }); |
There was a problem hiding this comment.
Multipart POST has no end-to-end coverage. NUT tests this.skip() on an env var never set; unit
tests stub request and only assert the input buffer. Nothing verifies jsforce transmits
form.getBuffer() as raw multipart (the L122 comment's exact worry). A nock/http-level test
capturing outbound bytes would close this.
There was a problem hiding this comment.
Once the full Connect API changes are in we can wire a full E2E NUT on a real org rather than a mocked test. For now will keep as-is.
jshackell-sfdc
left a comment
There was a problem hiding this comment.
See my suggestions and comments!
|
|
||
| # flags.use-salesforce-pages.summary | ||
|
|
||
| Toggle whether this UI Bundle should be uploaded to Salesforce Pages. Currently this is a required flag as only Salesforce Pages uploads are supported. |
There was a problem hiding this comment.
| Toggle whether this UI Bundle should be uploaded to Salesforce Pages. Currently this is a required flag as only Salesforce Pages uploads are supported. | |
| Upload UI Bundle to Salesforce Pages. This is a required flag as only Salesforce Pages uploads are currently supported. |
There was a problem hiding this comment.
Are you soon going to add more options to where the bundle can be uploaded? It seems odd to add a required flag for something that has no other options, you know?
For example, you could make Salesforce Pages the default upload location, and for now have no flag because it's not needed. Then, when you add new locations, add a flag like --upload-location, and include options such as "salesforce-pages", "other-location", etc. Just a thought. I should have said something like this earlier, but I was looking only at the name of the flag, not how it work, sorry.
There was a problem hiding this comment.
Yes it's a little weird right now. The intent down the line is to support both "Pages" and "Non-Pages" upload paths. This flag may change shape as well depending on the second look when that work.
For now we intend to be very specific for the initial Salesforce Pages feature
There was a problem hiding this comment.
Side note - applied all your suggestions manually so your existing suggestion comments here are linking to the wrong sections. But I have applied all that you suggested @jshackell-sfdc
| } | ||
| // An empty directory produces no zip entries; reject rather than POST an empty bundle. | ||
| if (fileCount === 0) { | ||
| throw new SfError(messages.getMessage('error.bundle-dir-empty'), 'UiBundleUploadValidationError'); |
There was a problem hiding this comment.
FYI: you can use the messages helper messages.createError() instead
| const apiVersionExplicit = flags['api-version'] !== undefined && !metadata.flags['api-version']?.setFromDefault; | ||
| if (apiVersionExplicit && parseInt(flags['api-version']!, 10) < MINIMUM_SUPPORTED_API_VERSION) { | ||
| throw messages.createError('error.uiBundleUploadApiVersionError', [ | ||
| flags['api-version']!, | ||
| String(MINIMUM_SUPPORTED_API_VERSION), | ||
| ]); | ||
| } | ||
|
|
||
| // Step 1: Resolve the org connection. | ||
| const orgConnection = flags['target-org'].getConnection(flags['api-version']); |
There was a problem hiding this comment.
Here is an example in plugin-packaging on checking for a minimum version https://github.com/salesforcecli/plugin-packaging/blob/4c6e1686a11066919811f78e637f8e89aaba8289/src/commands/package/install.ts#L131-L136
What does this PR do?
SDD-led implementation of the new
sf ui-bundle uploadcommand which is a foundational piece of the new Salesforce Pages featureWhat issues does this PR fix or reference?
@W-23296058@