Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[INTEG-1417] Update aiig create upload function to handle latest upload function for both spaceId and environmentId #5324

Merged
merged 7 commits into from
Dec 19, 2023

Conversation

ryunsong-contentful
Copy link
Contributor

@ryunsong-contentful ryunsong-contentful commented Oct 30, 2023

Purpose

The create asset upload function has been changed to take both spaceId and the environmentId, therefore we need to adjust accordingly to the new api params.

Approach

  • Pass environment id when creating the upload
  • Check the created upload and return the environment scoped URL when the environment is present. (Preserves backward compatibility when CMA.js doesn't have support for environment ids in uploads.)

Testing steps

Testing results on sandbox:

Correct images:
image

Using environment scoped upload URLs:

image

Dependencies and/or References

Will require latest contentful-management.js package version or else merging this PR will break the backend

@netlify
Copy link

netlify bot commented Oct 30, 2023

Deploy Preview for ecommerce-app-base-components ready!

Name Link
🔨 Latest commit 388a4ef
🔍 Latest deploy log https://app.netlify.com/sites/ecommerce-app-base-components/deploys/6581c45474032a000829b2d5
😎 Deploy Preview https://deploy-preview-5324--ecommerce-app-base-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@ryunsong-contentful ryunsong-contentful added the do not merge Don't merge this PR until this label is removed label Oct 30, 2023
@jsdalton
Copy link
Member

Currently blocked during testing by https://github.com/contentful/app-upload-to-delivery/pull/269

@jsdalton
Copy link
Member

Currently blocked by contentful/node-apps-toolkit#461

@jsdalton jsdalton removed the do not merge Don't merge this PR until this label is removed label Dec 19, 2023
@@ -26,6 +26,8 @@
"@types/sinon-chai": "^3.2.9",
"chai": "^4.3.7",
"mocha": "^10.2.0",
"node-addon-api": "^7.0.0",
"node-gyp": "^10.0.1",
Copy link
Member

Choose a reason for hiding this comment

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

These two are required by sharp 0.33 for our installation to work locally

);
});

describe('when environment id not present in upload response', () => {
Copy link
Member

Choose a reason for hiding this comment

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

Keep an explicit test that ensures correct behavior if for some reason the old upload (without environment id) is created.

@@ -10,11 +11,17 @@ const UPLOAD_DOMAIN: Record<string, URL> = {
),
};

type UploadPropsWithEnvironment = {
// TODO: use upstream UplpadProps directly once environment id has been added
Copy link
Member

Choose a reason for hiding this comment

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

@jsdalton jsdalton self-assigned this Dec 19, 2023
Copy link
Contributor

@whitelisab whitelisab left a comment

Choose a reason for hiding this comment

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

Looks good! 🎊

@@ -10,11 +11,17 @@ const UPLOAD_DOMAIN: Record<string, URL> = {
),
};

type UploadPropsWithEnvironment = {
// TODO: use upstream UplpadProps directly once environment id has been added
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: typo in this comment, UplpadPropsshould be UploadProps 😄

@jsdalton jsdalton merged commit 78f499e into master Dec 19, 2023
12 checks passed
@jsdalton jsdalton deleted the INTEG-1417-final branch December 19, 2023 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants