Connect
.
After completing this page, you should be able to:
- List the new features and changes in Connect.
- Demonstrate the use of templates in Connect.
- Create and use a common module.
- Install and use Connect CLI.
Time to complete page: 20 minutes
In 2024, Connect has introduced several exciting features and updates aimed at enhancing integration capabilities and improving user experience. Some of the important releases include:
Updates for Custom Applications
The applicationType for the Merchant Center Custom Applications has been changed for better clarity. You must now use merchant-center-custom-application instead of mc-app as the applicationType for Custom Applications.
Moreover, for better flexibility, the environment variables ENTRY_POINT_URI_PATH and CUSTOM_APPLICATION_ID in connect.yaml are now required and reserved for the application entry point URI path and application ID.
Version Field in ConnectorReference Deprecated
The version field of ConnectorReference is now optional. It will be completely removed in a future release. This change eases the deployment of Connectors because you can now deploy a Connector without needing to specify its version, as the latest version is used by default.
Integration Types Field
The integrationTypes field is now available to categorize Connectors based on their integration type. It allows you to filter the results of queries and searches for ConnectorStaged, Connectors, and Deployments based on their integration type, for example, psp, oms, tax etc.
The integrationType is also added as a query parameter in Query Deployments along with deploymentType. The integrationType and deploymentType can be used to filter deployments based on their integration type and deployment type, production or preview.
Redeploy with Updated Connector
You can now update a Connector when redeploying a Deployment. By setting the updateConnector property to true on the redeploy update action, you can ensure that the Connector is updated to its latest state.
{"action": "redeploy","skipScripts": true,"configurationValues": [{"applicationName": "app-1","standardConfiguration": [{"key": "CONFIG_KEY","value": "config-key-value"}],"securedConfiguration": [{"key": "CONFIG_SECRET_KEY","value": "config-secret-key-value"}]}],"updateConnector": true}
Assets Application Type
With this release, an application of Assets applicationType can be created to host static assets with CDN capabilities.
Application Templates
Four new application templates have been created to help you reduce the implementation time when working with these common use cases:
Working with templates not only saves you implementation time by providing a robust starting point but also helps you follow the best practices for third party integrations.
Please note that these templates are provided for development purposes. They require further customization before being used in production projects.
Sharing Code between Applications
With the introduction of Common modules, code can be shared between multiple applications. This helps improve code efficiency, reduce implementation and maintenance time, and decrease potential bugs and inconsistencies. To create and use a common module:
- Create your directory structure as below.
.├── README.md├── common-connect # The common module you want to share│ ├── package.json│ ├── src│ ├── tsconfig.json│ └── tsconfig.tsbuildinfo├── connect.yaml└── service├── jest.config.cjs├── package.json├── src├── tests├── tsconfig.json└── tsconfig.tsbuildinfo
- Install the common module using
npmoryarn. - In the
package.jsonfile, add abuildscript that includes building local common modules and includes your test scripts, for example:
"scripts": {..."build": "yarn --cwd ../common-connect install &&yarn --cwd ../common-connect run build && rimraf ./build && tsc","test": "yarn run build && jest --config jest.config.cjs"}
- You don’t need to change anything in
connect.yamlas the common modules are directly referenced by the applications in the same project.
Connect CLI
Managing your Connectors is now easier and faster with Connect's CLI. To use the Connect CLI, you must utilize the following:
Install and Verify Connect CLI
npm install -g @commercetools/clicommercetools --version
With the Connect CLI, you can:
- Log in to and authenticate with commercetools.
- Bootstrap a new Connector from a starter template or from one of our application templates.
- Update and manage ConnectorStaged.
- Create, test, build, bundle, and locally validate Connect applications.
You can find the full list of commands in the CLI section of the Connect documentation.
Global Configuration
One of the frustrations you shared with us was having to re-enter the same configuration in each application. We've listened to your feedback and introduced global configuration to ensure consistency and reduce redundancy. You can add global configuration under the inheritAs property in connect.yaml.
deployAs:- name: merchant-center-custom-applicationapplicationType: merchant-center-custom-applicationconfiguration:standardConfiguration:- key: CUSTOM_APPLICATION_IDdescription: The Custom Application IDrequired: true- key: CLOUD_IDENTIFIERdescription: The cloud identifierdefault: 'gcp-eu'- key: ENTRY_POINT_URI_PATHdescription: The Application entry point URI pathrequired: true- name: assetsapplicationType: assetsinheritAs:configuration:securedConfiguration:- key: GLOBAL_SECURED_CONFIGURATIONdescription: Secured configuration that is applied to all applicationsrequired: truestandardConfiguration:- key: GLOBAL_STANDARD_CONFIGURATIONdescription: Standard configuration that is applied to all applicationsrequired: true
Global configuration can contain secured and standard configuration and is shared with all the applications.