Skip to content

Conversation

@kbode-sf
Copy link
Collaborator

@kbode-sf kbode-sf commented Oct 29, 2025

This PR updates the yarn updateApis script to pull in APIs based on API versions instead of pulling the latest APIs, as we now have to align our releases with ECOM which have pinned versions each release. This versions are controlled in a file, api-versions.txt.

Testing

  1. set the ANYPOINT_USERNAME and ANYPOINT_PASSWORD environment variables
  2. update api-versions.txt with the following:
shopper-baskets-oas-v1=1.9.1
shopper-baskets-oas-v2=2.1.1
shopper-configurations-oas=1.0.0
shopper-consents-oas-v1=1.1.2
shopper-context-oas-v1=1.1.2
shopper-custom-objects-oas-v1=1.0.10
shopper-customers-oas-v1=1.1.2
shopper-experience-oas-v1=1.0.9
shopper-gift-certificates-oas-v1=1.0.27
shopper-login-oas-v1=1.40.0
shopper-orders-oas-v1=1.5.1
shopper-products-oas-v1=1.0.39
shopper-promotions-oas-v1=1.0.37
shopper-search-oas-v1=1.5.1
shopper-seo-oas-v1=1.0.14
shopper-stores-oas-v1=1.0.18
  1. run yarn updateApis and verify that APIs have been updated to that specific version

… step to update the version file it self with the latest available version
@kbode-sf kbode-sf force-pushed the kbode.W-18557453-fullReplacement branch from e8bfc02 to 076cc3f Compare October 29, 2025 15:00
@joeluong-sfcc
Copy link
Contributor

joeluong-sfcc commented Oct 30, 2025

@kbode-sf Can you add steps in the PR description on how to run the yarn updateApiVersions command? I'm still unable to run it:

Checking latest version for shopper-payments-oas-v1
Error fetching latest version for shopper-payments-oas-v1: Command failed: anypoint-cli-v4 exchange:asset:describe 893f605e-10e2-423a-bdb4-f952f56eb6d8/shopper-payments-oas/1.2.0-master-b70 -o json --username '<REDACTED>' --password '<REDACTED>'
(node:75968) TypeError Plugin: anypoint-cli-secrets-mgr-plugin: core_1.Flags.file is not a function
module: @oclif/[email protected]
task: toCached
plugin: anypoint-cli-secrets-mgr-plugin
root: /Users/joel.uong/Desktop/workspace/commerce-sdk-isomorphic/node_modules/anypoint-cli-secrets-mgr-plugin
See more details with DEBUG=*
(Use `node --trace-warnings ...` to show where the warning was created)
(node:75968) TypeError Plugin: anypoint-cli-secrets-mgr-plugin: core_1.Flags.file is not a function
module: @oclif/[email protected]
task: toCached
plugin: anypoint-cli-secrets-mgr-plugin
root: /Users/joel.uong/Desktop/workspace/commerce-sdk-isomorphic/node_modules/anypoint-cli-secrets-mgr-plugin
See more details with DEBUG=*
(node:75968) TypeError Plugin: anypoint-cli-secrets-mgr-plugin: core_1.Flags.file is not a function
module: @oclif/[email protected]
task: toCached
plugin: anypoint-cli-secrets-mgr-plugin
root: /Users/joel.uong/Desktop/workspace/commerce-sdk-isomorphic/node_modules/anypoint-cli-secrets-mgr-plugin
See more details with DEBUG=*
(node:75968) TypeError Plugin: anypoint-cli-secrets-mgr-plugin: core_1.Flags.file is not a function
module: @oclif/[email protected]
task: toCached
plugin: anypoint-cli-secrets-mgr-plugin
root: /Users/joel.uong/Desktop/workspace/commerce-sdk-isomorphic/node_modules/anypoint-cli-secrets-mgr-plugin
See more details with DEBUG=*
(node:75968) TypeError Plugin: anypoint-cli-secrets-mgr-plugin: core_1.Flags.file is not a function
module: @oclif/[email protected]
task: toCached
plugin: anypoint-cli-secrets-mgr-plugin
root: /Users/joel.uong/Desktop/workspace/commerce-sdk-isomorphic/node_modules/anypoint-cli-secrets-mgr-plugin
See more details with DEBUG=*
(node:75968) TypeError Plugin: anypoint-cli-secrets-mgr-plugin: core_1.Flags.file is not a function
module: @oclif/[email protected]
task: toCached
plugin: anypoint-cli-secrets-mgr-plugin
root: /Users/joel.uong/Desktop/workspace/commerce-sdk-isomorphic/node_modules/anypoint-cli-secrets-mgr-plugin
See more details with DEBUG=*
    Error: 'undefined' environment not found in Salesforce organization

@felix-schaube can you please test this as well. I asked Duc yesterday and he did not require any other configuration. So it seem to be a local setup issue of Joel.

Copy link
Contributor

@joeluong-sfcc joeluong-sfcc left a comment

Choose a reason for hiding this comment

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

To confirm, yarn updateApis now updates the APIs based on the versions in api-versions.txt and yarn updateApiVersions updates the api-versions.txt to the latest versions available in anypoint exchange correct?

api-versions.txt Outdated
shopper-search-oas-v1=1.3.0
shopper-seo-oas-v1=1.0.13
shopper-stores-oas-v1=1.0.17
shopper-payments-oas-v1=1.2.0-master-b70
Copy link
Contributor

Choose a reason for hiding this comment

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

I think in future updates we can add better error handling for improper formatting of API name and version

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agree, this was only a draft

@joeluong-sfcc joeluong-sfcc changed the title W-18557453 added build step to update apis using a version map file +… Feat: Update updateApis script to pull APIs based on versions (@W-18557453@) Nov 17, 2025
@joeluong-sfcc joeluong-sfcc marked this pull request as ready for review November 17, 2025 20:49
@joeluong-sfcc joeluong-sfcc requested a review from a team as a code owner November 17, 2025 20:49
@vcua-mobify
Copy link
Contributor

For the updateApis PR, are we sure we want the updateApiVersions setting snapshot versions rather than the latest stable version on Anypoint Exchange?

@kbode-sf
Copy link
Collaborator Author

kbode-sf commented Nov 18, 2025

To confirm, yarn updateApis now updates the APIs based on the versions in api-versions.txt and yarn updateApiVersions updates the api-versions.txt to the latest versions available in anypoint exchange correct?

@joeluong-sfcc thats correct. However as mentioned in a private slack conversation I think updateApiVersions needs "refinement". To support different modes like only pulling the latest release version and not SNAPSHOTs or limit the update on a list of APIs. (FYI @vcua-mobify )
I think in the current state it is easy to misuse it.
Hence, I suggested to remove this function for now or factor it out in a feature branch.
I also tend to change the name from yarn updateApis to -> 'yarn downloadAPIsByVersion' to make the intent more clear.
I did not do it by now because it causes changes in other integrations.

@joeluong-sfcc
Copy link
Contributor

Hence, I suggested to remove this function for now or factor it out in a feature branch. I also tend to change the name from yarn updateApis to -> 'yarn downloadAPIsByVersion' to make the intent more clear. I did not do it by now because it causes changes in other integrations.

Removed this script and created another branch for it: https://github.com/SalesforceCommerceCloud/commerce-sdk-isomorphic/pulls

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.

5 participants