@vc-shell/api-client-generator 2.0.0-alpha.33 → 2.0.0-alpha.33-pr220.455e322

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/README.md +55 -50
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -36,10 +36,10 @@
36
36
 
37
37
  # [2.0.0-alpha.24](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.23...v2.0.0-alpha.24) (2026-03-25)
38
38
 
39
-
40
39
  ### Features
41
40
 
42
- * **api-client, migrate:** default to Interface for new API clients, add nswag class-to-interface migration ([569a1f7](https://github.com/VirtoCommerce/vc-shell/commit/569a1f79532d5ca2e1a9968e3b249b3d3ffeed71))
41
+ - **api-client, migrate:** default to Interface for new API clients, add nswag class-to-interface migration ([569a1f7](https://github.com/VirtoCommerce/vc-shell/commit/569a1f79532d5ca2e1a9968e3b249b3d3ffeed71))
42
+
43
43
  # [2.0.0-alpha.23](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.22...v2.0.0-alpha.23) (2026-03-23)
44
44
 
45
45
  **Note:** Version bump only for package @vc-shell/api-client-generator
@@ -66,10 +66,10 @@
66
66
 
67
67
  # [2.0.0-alpha.17](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.16...v2.0.0-alpha.17) (2026-03-23)
68
68
 
69
-
70
69
  ### Features
71
70
 
72
- * **api-client:** add simple mode — generate only .ts files by default ([2f5a475](https://github.com/VirtoCommerce/vc-shell/commit/2f5a475ad9ec9928f7aae8e2ecf03e38b0a22bd1))
71
+ - **api-client:** add simple mode — generate only .ts files by default ([2f5a475](https://github.com/VirtoCommerce/vc-shell/commit/2f5a475ad9ec9928f7aae8e2ecf03e38b0a22bd1))
72
+
73
73
  # [2.0.0-alpha.16](https://github.com/VirtoCommerce/vc-shell/compare/v2.0.0-alpha.15...v2.0.0-alpha.16) (2026-03-20)
74
74
 
75
75
  **Note:** Version bump only for package @vc-shell/api-client-generator
package/README.md CHANGED
@@ -5,11 +5,11 @@
5
5
  This guide describes the process of generating an API client to access the VC Platform API from your custom application.
6
6
 
7
7
  !!! note
8
- Platform Manager REST Client offers generated REST API methods that make it easy to interact with the existing VirtoCommerce Platform API.
8
+ Platform Manager REST Client offers generated REST API methods that make it easy to interact with the existing VirtoCommerce Platform API.
9
9
 
10
10
  ## Prerequisites
11
11
 
12
- * .NET Core 6.0, particularly if you are using MacOS or Linux.
12
+ - .NET Core 6.0, particularly if you are using MacOS or Linux.
13
13
 
14
14
  ## Generate TypeScript API clients
15
15
 
@@ -22,6 +22,7 @@ Using command
22
22
  ```bash
23
23
  yarn add @vc-shell/api-client-generator cross-env
24
24
  ```
25
+
25
26
  <br>
26
27
 
27
28
  `cross-env` runs scripts that set and use environment variables across platforms.
@@ -44,57 +45,57 @@ Add the dependencies to your project's **package.json**:
44
45
 
45
46
  2. Configure client generation in your project. Inside your project's **package.json** file, add a `"generate-api-client"` command to the list of scripts:
46
47
 
47
- ```title="vc-app-extend/package.json" linenums="1"
48
- {
49
- "scripts": {
50
- ...
51
- "generate-api-client": cross-env api-client-generator --APP_PLATFORM_MODULES='[Virtocommerce.MarketplaceVendor,Virtocommerce.Catalog,Virtocommerce.Orders]' --APP_API_CLIENT_DIRECTORY=./src/api_client/
52
- }
53
- }
54
- ```
55
-
56
- The options are listed in the table below:
57
-
58
- | Options | Description | Example |
59
- |----------------------------- |---------------------------------------------------------------- |------------------------------------------------------------ |
60
- | `--APP_PLATFORM_MODULES` | Platform modules to generate API client.<br>{==string[]==} <br> Supports spaces in module lists: `[Module1, Module2]` or `[Module1,Module2]`<br>Customize the `--APP_PLATFORM_MODULES` list<br>to match your project's requirements. | `--APP_PLATFORM_MODULES='[Virtocommerce.MarketplaceVendor, Virtocommerce.Orders, Virtocommerce.Catalog]'` |
61
- | `--APP_API_CLIENT_DIRECTORY` | Output directory for generated API clients. <br>{==string==} | `--APP_API_CLIENT_DIRECTORY=./src/api_client/` |
62
- | `--APP_PLATFORM_URL` | Platform URL to obtain client API configs. <br>{==string==} | `--APP_PLATFORM_URL=https://vcmp-dev.govirto.com/` |
63
- | `--APP_PACKAGE_NAME` | Package name for generated API clients. <br>{==string==} | `--APP_PACKAGE_NAME=@api-client` |
64
- | `--APP_PACKAGE_VERSION` | Package version for generated API clients. <br>{==string==} | `--APP_PACKAGE_VERSION=1.1.0` |
65
- | `--APP_OUT_DIR` | Output directory for generated API clients. <br>{==string==} | `--APP_OUT_DIR=./src/api_client/` |
66
- | `--APP_TYPE_STYLE` | Sets the type style for generated DTOs. Can be 'Class' or 'Interface'.<br>{==string==} | `--APP_TYPE_STYLE=Interface` |
67
- | `--APP_BUILD_DIR` | Directory where TypeScript files will be compiled. <br>{==string==} | `--APP_BUILD_DIR=lib` (default is "dist") |
68
- | `--SKIP_BUILD` | Skip build step. <br>{==boolean==} | `--SKIP_BUILD=true` |
69
- | `--VERBOSE` | Enable verbose logging. <br>{==boolean==} | `--VERBOSE=true` |
70
-
71
- !!! note
72
- For the `--APP_TYPE_STYLE` parameter, use **exactly** `"Class"` or `"Interface"` (case-sensitive). Any other value will cause an error.
73
-
74
- !!! tip
75
- Use `--APP_TYPE_STYLE=Interface` for better TypeScript integration and smaller bundle sizes. Use `--APP_TYPE_STYLE=Class` when you need runtime type checking or class-specific features.
48
+ ```title="vc-app-extend/package.json" linenums="1"
49
+ {
50
+ "scripts": {
51
+ ...
52
+ "generate-api-client": cross-env api-client-generator --APP_PLATFORM_MODULES='[Virtocommerce.MarketplaceVendor,Virtocommerce.Catalog,Virtocommerce.Orders]' --APP_API_CLIENT_DIRECTORY=./src/api_client/
53
+ }
54
+ }
55
+ ```
56
+
57
+ The options are listed in the table below:
58
+
59
+ | Options | Description | Example |
60
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------- |
61
+ | `--APP_PLATFORM_MODULES` | Platform modules to generate API client.<br>{==string[]==} <br> Supports spaces in module lists: `[Module1, Module2]` or `[Module1,Module2]`<br>Customize the `--APP_PLATFORM_MODULES` list<br>to match your project's requirements. | `--APP_PLATFORM_MODULES='[Virtocommerce.MarketplaceVendor, Virtocommerce.Orders, Virtocommerce.Catalog]'` |
62
+ | `--APP_API_CLIENT_DIRECTORY` | Output directory for generated API clients. <br>{==string==} | `--APP_API_CLIENT_DIRECTORY=./src/api_client/` |
63
+ | `--APP_PLATFORM_URL` | Platform URL to obtain client API configs. <br>{==string==} | `--APP_PLATFORM_URL=https://vcmp-dev.govirto.com/` |
64
+ | `--APP_PACKAGE_NAME` | Package name for generated API clients. <br>{==string==} | `--APP_PACKAGE_NAME=@api-client` |
65
+ | `--APP_PACKAGE_VERSION` | Package version for generated API clients. <br>{==string==} | `--APP_PACKAGE_VERSION=1.1.0` |
66
+ | `--APP_OUT_DIR` | Output directory for generated API clients. <br>{==string==} | `--APP_OUT_DIR=./src/api_client/` |
67
+ | `--APP_TYPE_STYLE` | Sets the type style for generated DTOs. Can be 'Class' or 'Interface'.<br>{==string==} | `--APP_TYPE_STYLE=Interface` |
68
+ | `--APP_BUILD_DIR` | Directory where TypeScript files will be compiled. <br>{==string==} | `--APP_BUILD_DIR=lib` (default is "dist") |
69
+ | `--SKIP_BUILD` | Skip build step. <br>{==boolean==} | `--SKIP_BUILD=true` |
70
+ | `--VERBOSE` | Enable verbose logging. <br>{==boolean==} | `--VERBOSE=true` |
71
+
72
+ !!! note
73
+ For the `--APP_TYPE_STYLE` parameter, use **exactly** `"Class"` or `"Interface"` (case-sensitive). Any other value will cause an error.
74
+
75
+ !!! tip
76
+ Use `--APP_TYPE_STYLE=Interface` for better TypeScript integration and smaller bundle sizes. Use `--APP_TYPE_STYLE=Class` when you need runtime type checking or class-specific features.
76
77
 
77
78
  3. Configure Platform URL and other settings in your project's **.env** file:
78
79
 
79
- ```title="vc-app-extend/.env"
80
- APP_PLATFORM_URL=https://vcmp-dev.govirto.com/
81
- APP_PLATFORM_MODULES=[Virtocommerce.MarketplaceVendor,Virtocommerce.Catalog,Virtocommerce.Orders]
82
- APP_API_CLIENT_DIRECTORY=./src/api_client/
83
- APP_PACKAGE_NAME=@my-app/api-client
84
- APP_PACKAGE_VERSION=1.0.0
85
- APP_BUILD_DIR=dist
86
- VERBOSE=true
87
- SKIP_BUILD=false
88
- ```
80
+ ```title="vc-app-extend/.env"
81
+ APP_PLATFORM_URL=https://vcmp-dev.govirto.com/
82
+ APP_PLATFORM_MODULES=[Virtocommerce.MarketplaceVendor,Virtocommerce.Catalog,Virtocommerce.Orders]
83
+ APP_API_CLIENT_DIRECTORY=./src/api_client/
84
+ APP_PACKAGE_NAME=@my-app/api-client
85
+ APP_PACKAGE_VERSION=1.0.0
86
+ APP_BUILD_DIR=dist
87
+ VERBOSE=true
88
+ SKIP_BUILD=false
89
+ ```
89
90
 
90
- !!! note
91
- All configuration options can be set via environment variables in `.env` file or passed as command line arguments. Environment variables take precedence over CLI arguments.
91
+ !!! note
92
+ All configuration options can be set via environment variables in `.env` file or passed as command line arguments. Environment variables take precedence over CLI arguments.
92
93
 
93
94
  4. Generate the API clients using the following command:
94
95
 
95
- ```
96
- yarn generate-api-client
97
- ```
96
+ ```
97
+ yarn generate-api-client
98
+ ```
98
99
 
99
100
  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.
100
101
 
@@ -125,7 +126,7 @@ API client now includes metadata to track the generation:
125
126
 
126
127
  The generator handles multiple API clients effectively:
127
128
 
128
- - Creates standardized exports with both short names (`./{moduleName}`) and full names (`./virtocommerce.{moduleName}`)
129
+ - Creates standardized exports with both short names (`./{moduleName}`) and full names (`./virtocommerce.{moduleName}`)
129
130
  - Prevents duplicate module exports by intelligently merging with existing ones
130
131
  - Automatically removes `module` and `types` fields that conflict with multiple exports
131
132
  - Works properly with incremental generation (can add new APIs without breaking existing ones)
@@ -142,11 +143,11 @@ This enables both simple usage for single-API packages and proper subpath export
142
143
 
143
144
  ```js
144
145
  // Single API package (using root export)
145
- import { MyClient } from '@myapp/api';
146
+ import { MyClient } from "@myapp/api";
146
147
 
147
148
  // Multi-API package (using subpath exports)
148
- import { ClientA } from '@myapp/api/moduleA';
149
- import { ClientB } from '@myapp/api/moduleB';
149
+ import { ClientA } from "@myapp/api/moduleA";
150
+ import { ClientB } from "@myapp/api/moduleB";
150
151
  ```
151
152
 
152
153
  ### Directory Creation
@@ -223,6 +224,7 @@ If you encounter issues during API client generation:
223
224
  #### APP_TYPE_STYLE Error
224
225
 
225
226
  If you see an error like:
227
+
226
228
  ```
227
229
  Error converting value "$(APP_TYPE_STYLE)" to type 'NJsonSchema.CodeGeneration.TypeScript.TypeScriptTypeStyle'
228
230
  ```
@@ -230,11 +232,13 @@ Error converting value "$(APP_TYPE_STYLE)" to type 'NJsonSchema.CodeGeneration.T
230
232
  This means the `APP_TYPE_STYLE` parameter was not properly validated or passed to NSwag:
231
233
 
232
234
  **Solution:**
235
+
233
236
  1. Ensure you're using exactly `"Class"` or `"Interface"` (case-sensitive)
234
237
  2. Check that you're passing the parameter correctly: `--APP_TYPE_STYLE=Interface`
235
238
  3. Enable verbose logging to see what value is being passed: `--VERBOSE=true`
236
239
 
237
240
  **Example of correct usage:**
241
+
238
242
  ```bash
239
243
  yarn generate-api-client --APP_TYPE_STYLE=Interface --VERBOSE=true
240
244
  ```
@@ -242,6 +246,7 @@ yarn generate-api-client --APP_TYPE_STYLE=Interface --VERBOSE=true
242
246
  #### NSwag Command Failed
243
247
 
244
248
  If NSwag fails with exit code, check:
249
+
245
250
  1. .NET Core 6.0 or later is installed
246
251
  2. The platform URL is accessible
247
252
  3. The specified modules exist on the platform
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vc-shell/api-client-generator",
3
3
  "description": "Tool for API clients generation",
4
- "version": "2.0.0-alpha.33",
4
+ "version": "2.0.0-alpha.33-pr220.455e322",
5
5
  "type": "module",
6
6
  "bin": "./dist/api-client-generator.js",
7
7
  "files": [
@@ -13,7 +13,7 @@
13
13
  },
14
14
  "devDependencies": {
15
15
  "@types/cross-spawn": "^6.0.6",
16
- "@vc-shell/ts-config": "2.0.0-alpha.33",
16
+ "@vc-shell/ts-config": "2.0.0-alpha.33-pr220.455e322",
17
17
  "typescript": "^5.8.3"
18
18
  },
19
19
  "dependencies": {