@weclapp/sdk 2.0.0-dev.39 → 2.0.0-dev.41

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 (2) hide show
  1. package/dist/cli.js +9 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1309,13 +1309,17 @@ const cli = async () => {
1309
1309
  .option('use-query-language', {
1310
1310
  describe: 'Generate the new where property for some and count queries',
1311
1311
  type: 'boolean'
1312
+ })
1313
+ .option('apiVersion', {
1314
+ describe: 'Specify the api version (only needed when not using a local file)',
1315
+ type: 'string'
1312
1316
  })
1313
1317
  .epilog(`Copyright ${new Date().getFullYear()} weclapp GmbH`);
1314
1318
  if (argv.fromEnv) {
1315
1319
  config();
1316
1320
  }
1317
1321
  const { WECLAPP_API_KEY, WECLAPP_BACKEND_URL } = process.env;
1318
- const { query, cache = false, deprecated = false, key = WECLAPP_API_KEY, _: [src = WECLAPP_BACKEND_URL] } = argv;
1322
+ const { query, cache = false, deprecated = false, key = WECLAPP_API_KEY, apiVersion, _: [src = WECLAPP_BACKEND_URL] } = argv;
1319
1323
  const options = {
1320
1324
  deprecated,
1321
1325
  generateUnique: argv.generateUnique ?? false,
@@ -1338,9 +1342,11 @@ const cli = async () => {
1338
1342
  if (!key) {
1339
1343
  return Promise.reject(new Error('API key is missing'));
1340
1344
  }
1345
+ if (!apiVersion) {
1346
+ return Promise.reject(new Error('API version is missing'));
1347
+ }
1341
1348
  const url = new URL(src.startsWith('http') ? src : `https://${src}`);
1342
- // At the moment just v1
1343
- url.pathname = '/webapp/api/v1/meta/openapi.json';
1349
+ url.pathname = `/webapp/api/${apiVersion}/meta/openapi.json`;
1344
1350
  if (query?.length) {
1345
1351
  for (const param of query.split(',')) {
1346
1352
  const [name, value] = param.split('=');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weclapp/sdk",
3
- "version": "2.0.0-dev.39",
3
+ "version": "2.0.0-dev.41",
4
4
  "description": "SDK generator based on a weclapp api swagger file",
5
5
  "author": "weclapp",
6
6
  "sideEffects": false,