@vc-shell/api-client-generator 1.1.0-alpha.1 → 1.1.0-alpha.3

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.
package/CHANGELOG.md CHANGED
@@ -1,4 +1,80 @@
1
- # [1.1.0-alpha.1](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.326...v1.1.0-alpha.1) (2024-11-13)
1
+ ## [v1.1.0-alpha.2](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.340...vv1.1.0-alpha.2) (2025-02-25)
2
+
3
+
4
+ ### Features
5
+
6
+ * partial redesign ([846e215](https://github.com/VirtoCommerce/vc-shell/commit/846e2152c6e48753622ca7cf3a71300323c99d51))
7
+
8
+
9
+ ### Reverts
10
+
11
+ * Revert "release: v1.1.0-alpha.2" ([80b0dc9](https://github.com/VirtoCommerce/vc-shell/commit/80b0dc99fdd318205f26bde81e6a49ab79214cb3))
12
+
13
+
14
+
15
+ # [1.1.0-alpha.1](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.327...v1.1.0-alpha.1) (2024-11-13)
16
+
17
+
18
+
19
+ ## [1.1.0-alpha.1](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.326...v1.1.0-alpha.1) (2024-11-13)
20
+
21
+
22
+
23
+ ## [1.0.340](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.339...v1.0.340) (2025-02-06)
24
+
25
+
26
+
27
+ ## [1.0.339](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.338...v1.0.339) (2025-02-05)
28
+
29
+
30
+
31
+ ## [1.0.338](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.337...v1.0.338) (2025-02-05)
32
+
33
+
34
+
35
+ ## [1.0.337](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.336...v1.0.337) (2025-01-29)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * **api-client:** correct type export path generation ([40464e9](https://github.com/VirtoCommerce/vc-shell/commit/40464e9d94be6409c8224cc8e90b1a39794b2328))
41
+
42
+
43
+
44
+ ## [1.0.336](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.335...v1.0.336) (2025-01-29)
45
+
46
+
47
+
48
+ ## [1.0.335](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.334...v1.0.335) (2025-01-22)
49
+
50
+
51
+
52
+ ## [1.0.334](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.333...v1.0.334) (2025-01-22)
53
+
54
+
55
+
56
+ ## [1.0.333](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.332...v1.0.333) (2025-01-21)
57
+
58
+
59
+
60
+ ## [1.0.332](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.331...v1.0.332) (2025-01-21)
61
+
62
+
63
+
64
+ ## [1.0.331](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.330...v1.0.331) (2025-01-21)
65
+
66
+
67
+
68
+ ## [1.0.330](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.329...v1.0.330) (2024-12-19)
69
+
70
+
71
+
72
+ ## [1.0.329](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.328...v1.0.329) (2024-12-04)
73
+
74
+
75
+
76
+ ## [1.0.328](https://github.com/VirtoCommerce/vc-shell/compare/v1.0.326...v1.0.328) (2024-11-14)
77
+
2
78
 
3
79
 
4
80
 
package/README.md CHANGED
@@ -1,83 +1,83 @@
1
- # Platform Manager REST Client
2
-
3
- # Generate API client
4
-
5
- This guide describes the process of generating an API client to access the VC Platform API from your custom application.
6
-
7
- !!! note
8
- Platform Manager REST Client offers generated REST API methods that make it easy to interact with the existing VirtoCommerce Platform API.
9
-
10
- ## Prerequisites
11
-
12
- * .NET Core 6.0, particularly if you are using MacOS or Linux.
13
-
14
- ## Generate TypeScript API clients
15
-
16
- To enable TypeScript API client generation in your project:
17
-
18
- 1. Add dependencies to your project:
19
-
20
- Using command
21
-
22
- ```bash
23
- yarn add @vc-shell/api-client-generator cross-env
24
- ```
25
- <br>
26
-
27
- `cross-env` runs scripts that set and use environment variables across platforms.
28
-
29
- Manually
30
-
31
- Add the dependencies to your project's **package.json**:
32
-
33
- ```json title="vc-app/package.json" linenums="1"
34
- {
35
- ...
36
- "devDependencies": {
37
- ...
38
- "@vc-shell/api-client-generator": "latest",
39
- "cross-env": "latest",
40
- ...
41
- }
42
- }
43
- ```
44
-
45
- 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
- ```title="vc-app-extend/package.json" linenums="1"
48
- {
49
- "scripts": {
50
- ...
51
- "generate-api-client": cross-env api-client-generator --APP_PLATFORM_MODULES='[MarketplaceVendor,Catalog,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> Customize the `--APP_PLATFORM_MODULES` list<br>to match your project's requirements. | `--APP_PLATFORM_MODULES='[MarketplaceVendor,Orders,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=vc-app-extend` |
64
- | `--APP_PACKAGE_VERSION` | Package version for generated API clients. <br>{==string==} | `--APP_PACKAGE_VERSION=1.0.0` |
65
- | `--APP_OUT_DIR` | Output directory for generated API clients. <br>{==string==} | `--APP_OUT_DIR=./src/api_client/` |
66
- | `--SKIP_BUILD` | Skip build step. <br>{==boolean==} | `--SKIP_BUILD=true` |
67
-
68
- 3. Configure Platform URL to ensure your project can access the platform's API configurations. Add the platform URL to your project's **.env** file:
69
-
70
- ```title="vc-app-extend/.env"
71
- APP_PLATFORM_URL=https://vcmp-dev.govirto.com/
72
- ```
73
-
74
- !!! note
75
- Alternatively, you can specify the Platform URL as a command option in the previous step when running the `"generate-api-client"` command.
76
-
77
- 4. Generate the API clients using the following command:
78
-
79
- ```
80
- yarn generate-api-client
81
- ```
82
-
83
- 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.
1
+ # Platform Manager REST Client
2
+
3
+ # Generate API client
4
+
5
+ This guide describes the process of generating an API client to access the VC Platform API from your custom application.
6
+
7
+ !!! note
8
+ Platform Manager REST Client offers generated REST API methods that make it easy to interact with the existing VirtoCommerce Platform API.
9
+
10
+ ## Prerequisites
11
+
12
+ * .NET Core 6.0, particularly if you are using MacOS or Linux.
13
+
14
+ ## Generate TypeScript API clients
15
+
16
+ To enable TypeScript API client generation in your project:
17
+
18
+ 1. Add dependencies to your project:
19
+
20
+ Using command
21
+
22
+ ```bash
23
+ yarn add @vc-shell/api-client-generator cross-env
24
+ ```
25
+ <br>
26
+
27
+ `cross-env` runs scripts that set and use environment variables across platforms.
28
+
29
+ Manually
30
+
31
+ Add the dependencies to your project's **package.json**:
32
+
33
+ ```json title="vc-app/package.json" linenums="1"
34
+ {
35
+ ...
36
+ "devDependencies": {
37
+ ...
38
+ "@vc-shell/api-client-generator": "latest",
39
+ "cross-env": "latest",
40
+ ...
41
+ }
42
+ }
43
+ ```
44
+
45
+ 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
+ ```title="vc-app-extend/package.json" linenums="1"
48
+ {
49
+ "scripts": {
50
+ ...
51
+ "generate-api-client": cross-env api-client-generator --APP_PLATFORM_MODULES='[MarketplaceVendor,Catalog,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> Customize the `--APP_PLATFORM_MODULES` list<br>to match your project's requirements. | `--APP_PLATFORM_MODULES='[MarketplaceVendor,Orders,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=vc-app-extend` |
64
+ | `--APP_PACKAGE_VERSION` | Package version for generated API clients. <br>{==string==} | `--APP_PACKAGE_VERSION=1.0.0` |
65
+ | `--APP_OUT_DIR` | Output directory for generated API clients. <br>{==string==} | `--APP_OUT_DIR=./src/api_client/` |
66
+ | `--SKIP_BUILD` | Skip build step. <br>{==boolean==} | `--SKIP_BUILD=true` |
67
+
68
+ 3. Configure Platform URL to ensure your project can access the platform's API configurations. Add the platform URL to your project's **.env** file:
69
+
70
+ ```title="vc-app-extend/.env"
71
+ APP_PLATFORM_URL=https://vcmp-dev.govirto.com/
72
+ ```
73
+
74
+ !!! note
75
+ Alternatively, you can specify the Platform URL as a command option in the previous step when running the `"generate-api-client"` command.
76
+
77
+ 4. Generate the API clients using the following command:
78
+
79
+ ```
80
+ yarn generate-api-client
81
+ ```
82
+
83
+ 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.
@@ -5,15 +5,15 @@ import { existsSync as D, readFileSync as C, writeFileSync as T } from "node:fs"
5
5
  import A, { dirname as b, resolve as L, join as m, relative as _ } from "node:path";
6
6
  import { fileURLToPath as R } from "node:url";
7
7
  import { cwd as S } from "node:process";
8
- const k = R(import.meta.url), j = b(k);
9
- class E {
8
+ const k = R(import.meta.url), E = b(k);
9
+ class j {
10
10
  workingDirectory;
11
11
  generatorDirectory;
12
12
  assetsDirectory;
13
13
  apiClientDirectory;
14
14
  nswagPaths;
15
15
  constructor(e) {
16
- this.workingDirectory = S(), this.generatorDirectory = L(j, ".."), this.assetsDirectory = m(this.generatorDirectory, "public", "assets"), this.apiClientDirectory = L(this.workingDirectory, e), this.nswagPaths = {
16
+ this.workingDirectory = S(), this.generatorDirectory = L(E, ".."), this.assetsDirectory = m(this.generatorDirectory, "public", "assets"), this.apiClientDirectory = L(this.workingDirectory, e), this.nswagPaths = {
17
17
  configuration: m(_(this.workingDirectory, this.assetsDirectory), "config.nswag"),
18
18
  authApiBase: "authApiBase.ts",
19
19
  templates: "templates"
@@ -28,35 +28,35 @@ class E {
28
28
  };
29
29
  }
30
30
  }
31
- function y(n) {
32
- return n == null ? [] : Array.isArray(n) ? n : [n];
31
+ function y(t) {
32
+ return t == null ? [] : Array.isArray(t) ? t : [t];
33
33
  }
34
- function $(n, e, i, t) {
35
- var c, s = n[e], u = ~t.string.indexOf(e) ? i == null || i === !0 ? "" : String(i) : typeof i == "boolean" ? i : ~t.boolean.indexOf(e) ? i === "false" ? !1 : i === "true" || (n._.push((c = +i, c * 0 === 0 ? c : i)), !!i) : (c = +i, c * 0 === 0 ? c : i);
36
- n[e] = s == null ? u : Array.isArray(s) ? s.concat(u) : [s, u];
34
+ function $(t, e, i, n) {
35
+ var c, s = t[e], u = ~n.string.indexOf(e) ? i == null || i === !0 ? "" : String(i) : typeof i == "boolean" ? i : ~n.boolean.indexOf(e) ? i === "false" ? !1 : i === "true" || (t._.push((c = +i, c * 0 === 0 ? c : i)), !!i) : (c = +i, c * 0 === 0 ? c : i);
36
+ t[e] = s == null ? u : Array.isArray(s) ? s.concat(u) : [s, u];
37
37
  }
38
- function B(n, e) {
39
- n = n || [], e = e || {};
40
- var i, t, c, s, u, o = { _: [] }, r = 0, a = 0, l = 0, f = n.length;
38
+ function B(t, e) {
39
+ t = t || [], e = e || {};
40
+ var i, n, c, s, u, o = { _: [] }, r = 0, a = 0, l = 0, f = t.length;
41
41
  const P = e.alias !== void 0, h = e.unknown !== void 0, p = e.default !== void 0;
42
42
  if (e.alias = e.alias || {}, e.string = y(e.string), e.boolean = y(e.boolean), P)
43
43
  for (i in e.alias)
44
- for (t = e.alias[i] = y(e.alias[i]), r = 0; r < t.length; r++)
45
- (e.alias[t[r]] = t.concat(i)).splice(r, 1);
44
+ for (n = e.alias[i] = y(e.alias[i]), r = 0; r < n.length; r++)
45
+ (e.alias[n[r]] = n.concat(i)).splice(r, 1);
46
46
  for (r = e.boolean.length; r-- > 0; )
47
- for (t = e.alias[e.boolean[r]] || [], a = t.length; a-- > 0; ) e.boolean.push(t[a]);
47
+ for (n = e.alias[e.boolean[r]] || [], a = n.length; a-- > 0; ) e.boolean.push(n[a]);
48
48
  for (r = e.string.length; r-- > 0; )
49
- for (t = e.alias[e.string[r]] || [], a = t.length; a-- > 0; ) e.string.push(t[a]);
49
+ for (n = e.alias[e.string[r]] || [], a = n.length; a-- > 0; ) e.string.push(n[a]);
50
50
  if (p) {
51
51
  for (i in e.default)
52
- if (s = typeof e.default[i], t = e.alias[i] = e.alias[i] || [], e[s] !== void 0)
53
- for (e[s].push(i), r = 0; r < t.length; r++)
54
- e[s].push(t[r]);
52
+ if (s = typeof e.default[i], n = e.alias[i] = e.alias[i] || [], e[s] !== void 0)
53
+ for (e[s].push(i), r = 0; r < n.length; r++)
54
+ e[s].push(n[r]);
55
55
  }
56
56
  const d = h ? Object.keys(e.alias) : [];
57
57
  for (r = 0; r < f; r++) {
58
- if (c = n[r], c === "--") {
59
- o._ = o._.concat(n.slice(++r));
58
+ if (c = t[r], c === "--") {
59
+ o._ = o._.concat(t.slice(++r));
60
60
  break;
61
61
  }
62
62
  for (a = 0; a < c.length && c.charCodeAt(a) === 45; a++)
@@ -70,9 +70,9 @@ function B(n, e) {
70
70
  } else {
71
71
  for (l = a + 1; l < c.length && c.charCodeAt(l) !== 61; l++)
72
72
  ;
73
- for (s = c.substring(a, l), u = c.substring(++l) || r + 1 === f || ("" + n[r + 1]).charCodeAt(0) === 45 || n[++r], t = a === 2 ? [s] : s, l = 0; l < t.length; l++) {
74
- if (s = t[l], h && !~d.indexOf(s)) return e.unknown("-".repeat(a) + s);
75
- $(o, s, l + 1 < t.length || u, e);
73
+ for (s = c.substring(a, l), u = c.substring(++l) || r + 1 === f || ("" + t[r + 1]).charCodeAt(0) === 45 || t[++r], n = a === 2 ? [s] : s, l = 0; l < n.length; l++) {
74
+ if (s = n[l], h && !~d.indexOf(s)) return e.unknown("-".repeat(a) + s);
75
+ $(o, s, l + 1 < n.length || u, e);
76
76
  }
77
77
  }
78
78
  }
@@ -81,25 +81,25 @@ function B(n, e) {
81
81
  o[i] === void 0 && (o[i] = e.default[i]);
82
82
  if (P)
83
83
  for (i in o)
84
- for (t = e.alias[i] || []; t.length > 0; )
85
- o[t.shift()] = o[i];
84
+ for (n = e.alias[i] || []; n.length > 0; )
85
+ o[n.shift()] = o[i];
86
86
  return o;
87
87
  }
88
88
  async function M() {
89
89
  await I({}, "build");
90
- const n = B(process.argv.slice(2)), e = process.env.APP_PLATFORM_URL ?? n.APP_PLATFORM_URL;
90
+ const t = B(process.argv.slice(2)), e = process.env.APP_PLATFORM_URL ?? t.APP_PLATFORM_URL;
91
91
  if (!e)
92
92
  return console.log(
93
93
  g.red("error"),
94
94
  "api-client-generator APP_PLATFORM_URL is required in .env config or as api-client-generator argument"
95
95
  );
96
- if (!n.APP_PLATFORM_MODULES)
96
+ if (!t.APP_PLATFORM_MODULES)
97
97
  return console.log(g.red("error"), "api-client-generator modules command is required");
98
- if (!n.APP_API_CLIENT_DIRECTORY)
98
+ if (!t.APP_API_CLIENT_DIRECTORY)
99
99
  return console.log(g.red("error"), "api-client-generator outDir command is required");
100
- const i = n.APP_OUT_DIR ?? "./", t = new E(n.APP_API_CLIENT_DIRECTORY), c = n.APP_PLATFORM_MODULES.replace(/[[\]]/g, "").split(","), s = {};
100
+ const i = t.APP_OUT_DIR ?? "./", n = new j(t.APP_API_CLIENT_DIRECTORY), c = t.APP_PLATFORM_MODULES.replace(/[[\]]/g, "").split(","), s = {};
101
101
  let u, o;
102
- if (!n.SKIP_BUILD && (u = A.join(n.APP_API_CLIENT_DIRECTORY, "tsconfig.json"), o = {
102
+ if (!t.SKIP_BUILD && (u = A.join(t.APP_API_CLIENT_DIRECTORY, "tsconfig.json"), o = {
103
103
  extends: "@vc-shell/ts-config/tsconfig.json",
104
104
  compilerOptions: {
105
105
  baseUrl: ".",
@@ -114,7 +114,7 @@ async function M() {
114
114
  o = { ...o, ...r }, o && (o.compilerOptions = { ...o.compilerOptions, ...r.compilerOptions }, o.files = Array.from(new Set(o.files.concat(r.files || []))), o.include = Array.from(new Set(o.include.concat(r.include || [])))), console.log("api-client-generator %s Generated tsconfig.json", g.greenBright("success"));
115
115
  }
116
116
  for (const r of c) {
117
- const a = t.resolveApiClientPaths(r);
117
+ const a = n.resolveApiClientPaths(r);
118
118
  console.log(
119
119
  "api-client-generator %s Generating API client for %s module on %s environment",
120
120
  g.green("info"),
@@ -125,8 +125,8 @@ async function M() {
125
125
  "npx nswag",
126
126
  [
127
127
  "run",
128
- t.nswagPaths.configuration,
129
- `/variables:APP_PLATFORM_URL=${e},APP_PLATFORM_MODULE=${r},APP_AUTH_API_BASE_PATH=${t.nswagPaths.authApiBase},APP_TEMPLATE_DIRECTORY=${t.nswagPaths.templates},APP_API_CLIENT_PATH=${a.nswag}`,
128
+ n.nswagPaths.configuration,
129
+ `/variables:APP_PLATFORM_URL=${e},APP_PLATFORM_MODULE=${r},APP_AUTH_API_BASE_PATH=${n.nswagPaths.authApiBase},APP_TEMPLATE_DIRECTORY=${n.nswagPaths.templates},APP_API_CLIENT_PATH=${a.nswag}`,
130
130
  "/runtime:Net60"
131
131
  ],
132
132
  {
@@ -139,12 +139,12 @@ async function M() {
139
139
  "api-client-generator %s Successfully generated %s",
140
140
  g.greenBright("success"),
141
141
  g.whiteBright(a.console)
142
- ), !n.SKIP_BUILD && o) {
142
+ ), !t.SKIP_BUILD && o) {
143
143
  const f = r.toLowerCase();
144
144
  o.files.includes(`${f}.ts`) || o.files.push(`${f}.ts`);
145
145
  const P = {
146
146
  import: i !== "./" ? `./${i}/${f}.js` : `./${f}.js`,
147
- types: i !== "./" ? `./${i}/types/${f}.d.ts` : `./types/${f}.js`
147
+ types: i !== "./" ? `./${i}/types/${f}.d.ts` : `./types/${f}.d.ts`
148
148
  }, h = Object.keys(s).find(
149
149
  (p) => s[p].import.includes(`${f}.js`)
150
150
  );
@@ -158,15 +158,15 @@ async function M() {
158
158
  l
159
159
  );
160
160
  }
161
- if (!n.SKIP_BUILD && u && o) {
161
+ if (!t.SKIP_BUILD && u && o) {
162
162
  T(u, JSON.stringify(o, null, 2)), console.log("api-client-generator %s Compiling TypeScript files to JavaScript", g.green("info")), O("npx tsc", ["--project", u], {
163
163
  stdio: ["ignore", "inherit", "ignore"],
164
164
  shell: !0
165
165
  }).status === 0 ? console.log("api-client-generator %s Successfully compiled TypeScript files", g.greenBright("success")) : console.error("api-client-generator %s Failed to compile TypeScript files", g.red("error"));
166
- const a = A.join(n.APP_API_CLIENT_DIRECTORY, "package.json");
166
+ const a = A.join(t.APP_API_CLIENT_DIRECTORY, "package.json");
167
167
  let l = {
168
- name: n.APP_PACKAGE_NAME || "api-client",
169
- version: n.APP_PACKAGE_VERSION || "1.0.0",
168
+ name: t.APP_PACKAGE_NAME || "api-client",
169
+ version: t.APP_PACKAGE_VERSION || "1.0.0",
170
170
  files: i !== "./" ? [i, "package.json"] : ["package.json"],
171
171
  exports: s
172
172
  };
@@ -1,21 +1,21 @@
1
- /* eslint-disable */
2
- export class AuthApiBase {
3
- authToken = "";
4
- protected constructor() {}
5
-
6
- // Enforce always return empty string as baseUrl
7
- getBaseUrl(defaultUrl: string, baseUrl: string) {
8
- return "";
9
- }
10
-
11
- setAuthToken(token: string) {
12
- this.authToken = token;
13
- }
14
-
15
- protected transformOptions(options: any): Promise<any> {
16
- if (this.authToken) {
17
- options.headers["authorization"] = `Bearer ${this.authToken}`;
18
- }
19
- return Promise.resolve(options);
20
- }
21
- }
1
+ /* eslint-disable */
2
+ export class AuthApiBase {
3
+ authToken = "";
4
+ protected constructor() {}
5
+
6
+ // Enforce always return empty string as baseUrl
7
+ getBaseUrl(defaultUrl: string, baseUrl: string) {
8
+ return "";
9
+ }
10
+
11
+ setAuthToken(token: string) {
12
+ this.authToken = token;
13
+ }
14
+
15
+ protected transformOptions(options: any): Promise<any> {
16
+ if (this.authToken) {
17
+ options.headers["authorization"] = `Bearer ${this.authToken}`;
18
+ }
19
+ return Promise.resolve(options);
20
+ }
21
+ }
@@ -1,76 +1,76 @@
1
- {
2
- "runtime": "Default",
3
- "defaultVariables": null,
4
- "documentGenerator": {
5
- "fromDocument": {
6
- "url": "$(APP_PLATFORM_URL)docs/$(APP_PLATFORM_MODULE)/swagger.json",
7
- "output": null,
8
- "newLineBehavior": "Auto"
9
- }
10
- },
11
- "codeGenerators": {
12
- "openApiToTypeScriptClient": {
13
- "className": "{controller}Client",
14
- "moduleName": "",
15
- "namespace": "",
16
- "typeScriptVersion": 4.3,
17
- "template": "Fetch",
18
- "promiseType": "Promise",
19
- "httpClass": "HttpClient",
20
- "withCredentials": false,
21
- "useSingletonProvider": false,
22
- "injectionTokenType": "OpaqueToken",
23
- "rxJsVersion": 6.0,
24
- "dateTimeType": "Date",
25
- "nullValue": "Undefined",
26
- "generateClientClasses": true,
27
- "generateClientInterfaces": false,
28
- "generateOptionalParameters": true,
29
- "exportTypes": true,
30
- "wrapDtoExceptions": false,
31
- "exceptionClass": "ApiException",
32
- "clientBaseClass": "AuthApiBase",
33
- "wrapResponses": false,
34
- "wrapResponseMethods": [],
35
- "generateResponseClasses": true,
36
- "responseClass": "SwaggerResponse",
37
- "protectedMethods": [],
38
- "configurationClass": "",
39
- "useTransformOptionsMethod": true,
40
- "useTransformResultMethod": false,
41
- "generateDtoTypes": true,
42
- "operationGenerationMode": "MultipleClientsFromOperationId",
43
- "markOptionalProperties": true,
44
- "generateCloneMethod": false,
45
- "typeStyle": "Class",
46
- "enumStyle": "Enum",
47
- "useLeafType": false,
48
- "classTypes": [],
49
- "extendedClasses": [],
50
- "extensionCode": "$(APP_AUTH_API_BASE_PATH)",
51
- "generateDefaultValues": true,
52
- "excludedTypeNames": [],
53
- "excludedParameterNames": [],
54
- "handleReferences": false,
55
- "generateTypeCheckFunctions": false,
56
- "generateConstructorInterface": true,
57
- "convertConstructorInterfaceData": false,
58
- "importRequiredTypes": true,
59
- "useGetBaseUrlMethod": true,
60
- "baseUrlTokenName": "API_BASE_URL",
61
- "queryNullValue": "",
62
- "useAbortSignal": false,
63
- "inlineNamedDictionaries": false,
64
- "inlineNamedAny": false,
65
- "includeHttpContext": false,
66
- "templateDirectory": "$(APP_TEMPLATE_DIRECTORY)",
67
- "typeNameGeneratorType": null,
68
- "propertyNameGeneratorType": null,
69
- "enumNameGeneratorType": null,
70
- "serviceHost": null,
71
- "serviceSchemes": null,
72
- "output": "$(APP_API_CLIENT_PATH)",
73
- "newLineBehavior": "Auto"
74
- }
75
- }
76
- }
1
+ {
2
+ "runtime": "Default",
3
+ "defaultVariables": null,
4
+ "documentGenerator": {
5
+ "fromDocument": {
6
+ "url": "$(APP_PLATFORM_URL)docs/$(APP_PLATFORM_MODULE)/swagger.json",
7
+ "output": null,
8
+ "newLineBehavior": "Auto"
9
+ }
10
+ },
11
+ "codeGenerators": {
12
+ "openApiToTypeScriptClient": {
13
+ "className": "{controller}Client",
14
+ "moduleName": "",
15
+ "namespace": "",
16
+ "typeScriptVersion": 4.3,
17
+ "template": "Fetch",
18
+ "promiseType": "Promise",
19
+ "httpClass": "HttpClient",
20
+ "withCredentials": false,
21
+ "useSingletonProvider": false,
22
+ "injectionTokenType": "OpaqueToken",
23
+ "rxJsVersion": 6.0,
24
+ "dateTimeType": "Date",
25
+ "nullValue": "Undefined",
26
+ "generateClientClasses": true,
27
+ "generateClientInterfaces": false,
28
+ "generateOptionalParameters": true,
29
+ "exportTypes": true,
30
+ "wrapDtoExceptions": false,
31
+ "exceptionClass": "ApiException",
32
+ "clientBaseClass": "AuthApiBase",
33
+ "wrapResponses": false,
34
+ "wrapResponseMethods": [],
35
+ "generateResponseClasses": true,
36
+ "responseClass": "SwaggerResponse",
37
+ "protectedMethods": [],
38
+ "configurationClass": "",
39
+ "useTransformOptionsMethod": true,
40
+ "useTransformResultMethod": false,
41
+ "generateDtoTypes": true,
42
+ "operationGenerationMode": "MultipleClientsFromOperationId",
43
+ "markOptionalProperties": true,
44
+ "generateCloneMethod": false,
45
+ "typeStyle": "Class",
46
+ "enumStyle": "Enum",
47
+ "useLeafType": false,
48
+ "classTypes": [],
49
+ "extendedClasses": [],
50
+ "extensionCode": "$(APP_AUTH_API_BASE_PATH)",
51
+ "generateDefaultValues": true,
52
+ "excludedTypeNames": [],
53
+ "excludedParameterNames": [],
54
+ "handleReferences": false,
55
+ "generateTypeCheckFunctions": false,
56
+ "generateConstructorInterface": true,
57
+ "convertConstructorInterfaceData": false,
58
+ "importRequiredTypes": true,
59
+ "useGetBaseUrlMethod": true,
60
+ "baseUrlTokenName": "API_BASE_URL",
61
+ "queryNullValue": "",
62
+ "useAbortSignal": false,
63
+ "inlineNamedDictionaries": false,
64
+ "inlineNamedAny": false,
65
+ "includeHttpContext": false,
66
+ "templateDirectory": "$(APP_TEMPLATE_DIRECTORY)",
67
+ "typeNameGeneratorType": null,
68
+ "propertyNameGeneratorType": null,
69
+ "enumNameGeneratorType": null,
70
+ "serviceHost": null,
71
+ "serviceSchemes": null,
72
+ "output": "$(APP_API_CLIENT_PATH)",
73
+ "newLineBehavior": "Auto"
74
+ }
75
+ }
76
+ }
@@ -1,4 +1,4 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- // ReSharper disable InconsistentNaming
4
- // @ts-nocheck
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ // ReSharper disable InconsistentNaming
4
+ // @ts-nocheck
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": "1.1.0-alpha.1",
4
+ "version": "1.1.0-alpha.3",
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": "^1.1.0-alpha.1",
16
+ "@vc-shell/ts-config": "^1.1.0-alpha.3",
17
17
  "typescript": "~5.3.3"
18
18
  },
19
19
  "dependencies": {
@@ -27,5 +27,5 @@
27
27
  "access": "public",
28
28
  "registry": "https://registry.npmjs.org/"
29
29
  },
30
- "stableVersion": "1.0.327"
30
+ "stableVersion": "1.0.340"
31
31
  }
@@ -1,21 +1,21 @@
1
- /* eslint-disable */
2
- export class AuthApiBase {
3
- authToken = "";
4
- protected constructor() {}
5
-
6
- // Enforce always return empty string as baseUrl
7
- getBaseUrl(defaultUrl: string, baseUrl: string) {
8
- return "";
9
- }
10
-
11
- setAuthToken(token: string) {
12
- this.authToken = token;
13
- }
14
-
15
- protected transformOptions(options: any): Promise<any> {
16
- if (this.authToken) {
17
- options.headers["authorization"] = `Bearer ${this.authToken}`;
18
- }
19
- return Promise.resolve(options);
20
- }
21
- }
1
+ /* eslint-disable */
2
+ export class AuthApiBase {
3
+ authToken = "";
4
+ protected constructor() {}
5
+
6
+ // Enforce always return empty string as baseUrl
7
+ getBaseUrl(defaultUrl: string, baseUrl: string) {
8
+ return "";
9
+ }
10
+
11
+ setAuthToken(token: string) {
12
+ this.authToken = token;
13
+ }
14
+
15
+ protected transformOptions(options: any): Promise<any> {
16
+ if (this.authToken) {
17
+ options.headers["authorization"] = `Bearer ${this.authToken}`;
18
+ }
19
+ return Promise.resolve(options);
20
+ }
21
+ }
@@ -1,76 +1,76 @@
1
- {
2
- "runtime": "Default",
3
- "defaultVariables": null,
4
- "documentGenerator": {
5
- "fromDocument": {
6
- "url": "$(APP_PLATFORM_URL)docs/$(APP_PLATFORM_MODULE)/swagger.json",
7
- "output": null,
8
- "newLineBehavior": "Auto"
9
- }
10
- },
11
- "codeGenerators": {
12
- "openApiToTypeScriptClient": {
13
- "className": "{controller}Client",
14
- "moduleName": "",
15
- "namespace": "",
16
- "typeScriptVersion": 4.3,
17
- "template": "Fetch",
18
- "promiseType": "Promise",
19
- "httpClass": "HttpClient",
20
- "withCredentials": false,
21
- "useSingletonProvider": false,
22
- "injectionTokenType": "OpaqueToken",
23
- "rxJsVersion": 6.0,
24
- "dateTimeType": "Date",
25
- "nullValue": "Undefined",
26
- "generateClientClasses": true,
27
- "generateClientInterfaces": false,
28
- "generateOptionalParameters": true,
29
- "exportTypes": true,
30
- "wrapDtoExceptions": false,
31
- "exceptionClass": "ApiException",
32
- "clientBaseClass": "AuthApiBase",
33
- "wrapResponses": false,
34
- "wrapResponseMethods": [],
35
- "generateResponseClasses": true,
36
- "responseClass": "SwaggerResponse",
37
- "protectedMethods": [],
38
- "configurationClass": "",
39
- "useTransformOptionsMethod": true,
40
- "useTransformResultMethod": false,
41
- "generateDtoTypes": true,
42
- "operationGenerationMode": "MultipleClientsFromOperationId",
43
- "markOptionalProperties": true,
44
- "generateCloneMethod": false,
45
- "typeStyle": "Class",
46
- "enumStyle": "Enum",
47
- "useLeafType": false,
48
- "classTypes": [],
49
- "extendedClasses": [],
50
- "extensionCode": "$(APP_AUTH_API_BASE_PATH)",
51
- "generateDefaultValues": true,
52
- "excludedTypeNames": [],
53
- "excludedParameterNames": [],
54
- "handleReferences": false,
55
- "generateTypeCheckFunctions": false,
56
- "generateConstructorInterface": true,
57
- "convertConstructorInterfaceData": false,
58
- "importRequiredTypes": true,
59
- "useGetBaseUrlMethod": true,
60
- "baseUrlTokenName": "API_BASE_URL",
61
- "queryNullValue": "",
62
- "useAbortSignal": false,
63
- "inlineNamedDictionaries": false,
64
- "inlineNamedAny": false,
65
- "includeHttpContext": false,
66
- "templateDirectory": "$(APP_TEMPLATE_DIRECTORY)",
67
- "typeNameGeneratorType": null,
68
- "propertyNameGeneratorType": null,
69
- "enumNameGeneratorType": null,
70
- "serviceHost": null,
71
- "serviceSchemes": null,
72
- "output": "$(APP_API_CLIENT_PATH)",
73
- "newLineBehavior": "Auto"
74
- }
75
- }
76
- }
1
+ {
2
+ "runtime": "Default",
3
+ "defaultVariables": null,
4
+ "documentGenerator": {
5
+ "fromDocument": {
6
+ "url": "$(APP_PLATFORM_URL)docs/$(APP_PLATFORM_MODULE)/swagger.json",
7
+ "output": null,
8
+ "newLineBehavior": "Auto"
9
+ }
10
+ },
11
+ "codeGenerators": {
12
+ "openApiToTypeScriptClient": {
13
+ "className": "{controller}Client",
14
+ "moduleName": "",
15
+ "namespace": "",
16
+ "typeScriptVersion": 4.3,
17
+ "template": "Fetch",
18
+ "promiseType": "Promise",
19
+ "httpClass": "HttpClient",
20
+ "withCredentials": false,
21
+ "useSingletonProvider": false,
22
+ "injectionTokenType": "OpaqueToken",
23
+ "rxJsVersion": 6.0,
24
+ "dateTimeType": "Date",
25
+ "nullValue": "Undefined",
26
+ "generateClientClasses": true,
27
+ "generateClientInterfaces": false,
28
+ "generateOptionalParameters": true,
29
+ "exportTypes": true,
30
+ "wrapDtoExceptions": false,
31
+ "exceptionClass": "ApiException",
32
+ "clientBaseClass": "AuthApiBase",
33
+ "wrapResponses": false,
34
+ "wrapResponseMethods": [],
35
+ "generateResponseClasses": true,
36
+ "responseClass": "SwaggerResponse",
37
+ "protectedMethods": [],
38
+ "configurationClass": "",
39
+ "useTransformOptionsMethod": true,
40
+ "useTransformResultMethod": false,
41
+ "generateDtoTypes": true,
42
+ "operationGenerationMode": "MultipleClientsFromOperationId",
43
+ "markOptionalProperties": true,
44
+ "generateCloneMethod": false,
45
+ "typeStyle": "Class",
46
+ "enumStyle": "Enum",
47
+ "useLeafType": false,
48
+ "classTypes": [],
49
+ "extendedClasses": [],
50
+ "extensionCode": "$(APP_AUTH_API_BASE_PATH)",
51
+ "generateDefaultValues": true,
52
+ "excludedTypeNames": [],
53
+ "excludedParameterNames": [],
54
+ "handleReferences": false,
55
+ "generateTypeCheckFunctions": false,
56
+ "generateConstructorInterface": true,
57
+ "convertConstructorInterfaceData": false,
58
+ "importRequiredTypes": true,
59
+ "useGetBaseUrlMethod": true,
60
+ "baseUrlTokenName": "API_BASE_URL",
61
+ "queryNullValue": "",
62
+ "useAbortSignal": false,
63
+ "inlineNamedDictionaries": false,
64
+ "inlineNamedAny": false,
65
+ "includeHttpContext": false,
66
+ "templateDirectory": "$(APP_TEMPLATE_DIRECTORY)",
67
+ "typeNameGeneratorType": null,
68
+ "propertyNameGeneratorType": null,
69
+ "enumNameGeneratorType": null,
70
+ "serviceHost": null,
71
+ "serviceSchemes": null,
72
+ "output": "$(APP_API_CLIENT_PATH)",
73
+ "newLineBehavior": "Auto"
74
+ }
75
+ }
76
+ }
@@ -1,4 +1,4 @@
1
- /* tslint:disable */
2
- /* eslint-disable */
3
- // ReSharper disable InconsistentNaming
4
- // @ts-nocheck
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ // ReSharper disable InconsistentNaming
4
+ // @ts-nocheck