
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
@vc-shell/api-client-generator
Advanced tools
This guide describes the process of generating an API client to access the VC Platform API from your custom application.
!!! note Platform Manager REST Client offers generated REST API methods that make it easy to interact with the existing VirtoCommerce Platform API.
To enable TypeScript API client generation in your project:
Using command
yarn add @vc-shell/api-client-generator cross-env
cross-env
runs scripts that set and use environment variables across platforms.
Manually
Add the dependencies to your project's package.json:
{
...
"devDependencies": {
...
"@vc-shell/api-client-generator": "latest",
"cross-env": "latest",
...
}
}
Configure client generation in your project. Inside your project's package.json file, add a "generate-api-client"
command to the list of scripts:
{
"scripts": {
...
"generate-api-client": cross-env api-client-generator --APP_PLATFORM_MODULES='[Virtocommerce.MarketplaceVendor,Virtocommerce.Catalog,Virtocommerce.Orders]' --APP_API_CLIENT_DIRECTORY=./src/api_client/
}
}
The options are listed in the table below:
Options | Description | Example |
---|---|---|
--APP_PLATFORM_MODULES | Platform modules to generate API client. {==string[]==} Customize the --APP_PLATFORM_MODULES listto match your project's requirements. | --APP_PLATFORM_MODULES='[Virtocommerce.MarketplaceVendor,Virtocommerce.Orders,Virtocommerce.Catalog]' |
--APP_API_CLIENT_DIRECTORY | Output directory for generated API clients. {==string==} | --APP_API_CLIENT_DIRECTORY=./src/api_client/ |
--APP_PLATFORM_URL | Platform URL to obtain client API configs. {==string==} | --APP_PLATFORM_URL=https://vcmp-dev.govirto.com/ |
--APP_PACKAGE_NAME | Package name for generated API clients. {==string==} | --APP_PACKAGE_NAME=@api-client |
--APP_PACKAGE_VERSION | Package version for generated API clients. {==string==} | --APP_PACKAGE_VERSION=1.1.0 |
--APP_OUT_DIR | Output directory for generated API clients. {==string==} | --APP_OUT_DIR=./src/api_client/ |
--APP_TYPE_STYLE | Sets the type style for generated DTOs. Can be 'Class' or 'Interface'. {==string==} | --APP_TYPE_STYLE=Interface |
--APP_BUILD_DIR | Directory where TypeScript files will be compiled. {==string==} | --APP_BUILD_DIR=lib (default is "dist") |
--SKIP_BUILD | Skip build step. {==boolean==} | --SKIP_BUILD=true |
--VERBOSE | Enable verbose logging. {==boolean==} | --VERBOSE=true |
Configure Platform URL to ensure your project can access the platform's API configurations. Add the platform URL to your project's .env file:
APP_PLATFORM_URL=https://vcmp-dev.govirto.com/
!!! note
Alternatively, you can specify the Platform URL as a command option in the previous step when running the "generate-api-client"
command.
Generate the API clients using the following command:
yarn generate-api-client
This command generates the required API clients for your custom application. Now you can effortlessly access the VC Platform API from your custom application using the generated API client.
The generator now intelligently merges configuration files to preserve your custom settings. When you update an existing API client:
API client now includes metadata to track the generation:
{
"apiClientGenerator": {
"version": "1.1.0",
"generatedAt": "2025-04-01T12:30:45.123Z"
}
}
The generator handles multiple API clients effectively:
./{moduleName}
) and full names (./virtocommerce.{moduleName}
)module
and types
fields that conflict with multiple exportsThe generator now intelligently handles root exports based on the number of API modules:
.
) and module
/types
fields are maintained./moduleA
, ./moduleB
)This enables both simple usage for single-API packages and proper subpath exporting for multi-API packages:
// Single API package (using root export)
import { MyClient } from '@myapp/api';
// Multi-API package (using subpath exports)
import { ClientA } from '@myapp/api/moduleA';
import { ClientB } from '@myapp/api/moduleB';
Target directories are automatically created if they don't exist.
Enable detailed logging to troubleshoot generation issues:
yarn generate-api-client --VERBOSE=true
You can specify a custom build directory where TypeScript files will be compiled:
yarn generate-api-client --APP_BUILD_DIR=lib
By default, the build directory is "dist".
Better error handling and reporting make it easier to diagnose issues during client generation.
If you encounter issues during API client generation:
--VERBOSE=true
--VERBOSE=true
flag to see detailed error messagesFAQs
Tool for API clients generation
The npm package @vc-shell/api-client-generator receives a total of 1,018 weekly downloads. As such, @vc-shell/api-client-generator popularity was classified as popular.
We found that @vc-shell/api-client-generator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.