@shopware/api-gen 1.0.4 → 1.0.5

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/README.md +2 -7
  2. package/dist/cli.mjs +75 -32
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -233,13 +233,8 @@ Prepare your config file named **api-gen.config.json**:
233
233
 
234
234
  Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/api-gen/CHANGELOG.md)
235
235
 
236
- ### Latest changes: 1.0.4
236
+ ### Latest changes: 1.0.5
237
237
 
238
238
  ### Patch Changes
239
239
 
240
- - [#1074](https://github.com/shopware/frontends/pull/1074) [`b688163`](https://github.com/shopware/frontends/commit/b68816391ee8ed1ac94a6462a2a016d708f259b4) Thanks [@mkucmus](https://github.com/mkucmus)! - Set `translated` property as required in provided schemas
241
-
242
- - [#1089](https://github.com/shopware/frontends/pull/1089) [`db7c93f`](https://github.com/shopware/frontends/commit/db7c93ff8cbb581221c11a492e77068af8faa8d6) Thanks [@mkucmus](https://github.com/mkucmus)! - Migrate eslint config to flat format
243
-
244
- - Updated dependencies [[`db7c93f`](https://github.com/shopware/frontends/commit/db7c93ff8cbb581221c11a492e77068af8faa8d6), [`b688163`](https://github.com/shopware/frontends/commit/b68816391ee8ed1ac94a6462a2a016d708f259b4)]:
245
- - @shopware/api-client@1.0.2
240
+ - [#1269](https://github.com/shopware/frontends/pull/1269) [`999b076`](https://github.com/shopware/frontends/commit/999b076db88bc34614d9d3221b96a04b997009a3) Thanks [@patzick](https://github.com/patzick)! - reading environment variables not only from the .env file but also injected by the system
package/dist/cli.mjs CHANGED
@@ -421,7 +421,7 @@ function configDotenv (options) {
421
421
  }
422
422
 
423
423
  // Populates process.env from .env file
424
- function config$3 (options) {
424
+ function config$1 (options) {
425
425
  // fallback to original dotenv if DOTENV_KEY is not set
426
426
  if (_dotenvKey(options).length === 0) {
427
427
  return DotenvModule.configDotenv(options)
@@ -505,7 +505,7 @@ const DotenvModule = {
505
505
  configDotenv,
506
506
  _configVault,
507
507
  _parseVault,
508
- config: config$3,
508
+ config: config$1,
509
509
  decrypt,
510
510
  parse: parse$1,
511
511
  populate
@@ -197719,6 +197719,40 @@ function transformOpenApiTypes(schema) {
197719
197719
  return [operationsMap, componentsMap, existingTypes];
197720
197720
  }
197721
197721
 
197722
+ let getPromiseValue$1 = () => 'Promise{…}';
197723
+ try {
197724
+ // @ts-ignore
197725
+ const { getPromiseDetails, kPending, kRejected } = process.binding('util');
197726
+ if (Array.isArray(getPromiseDetails(Promise.resolve()))) {
197727
+ getPromiseValue$1 = (value, options) => {
197728
+ const [state, innerValue] = getPromiseDetails(value);
197729
+ if (state === kPending) {
197730
+ return 'Promise{<pending>}';
197731
+ }
197732
+ return `Promise${state === kRejected ? '!' : ''}{${options.inspect(innerValue, options)}}`;
197733
+ };
197734
+ }
197735
+ }
197736
+ catch (notNode) {
197737
+ /* ignore */
197738
+ }
197739
+
197740
+ /* !
197741
+ * loupe
197742
+ * Copyright(c) 2013 Jake Luer <jake@alogicalparadox.com>
197743
+ * MIT Licensed
197744
+ */
197745
+ let nodeInspect$1 = false;
197746
+ try {
197747
+ // eslint-disable-next-line global-require
197748
+ // @ts-ignore
197749
+ const nodeUtil = require('util');
197750
+ nodeInspect$1 = nodeUtil.inspect ? nodeUtil.inspect.custom : false;
197751
+ }
197752
+ catch (noNodeInspect) {
197753
+ nodeInspect$1 = false;
197754
+ }
197755
+
197722
197756
  // src/index.ts
197723
197757
  var f$1 = {
197724
197758
  reset: [0, 0],
@@ -200243,10 +200277,10 @@ function diff(a, b, options) {
200243
200277
  let omitDifference = false;
200244
200278
  if (aType === "object" && typeof a.asymmetricMatch === "function") {
200245
200279
  if (a.$$typeof !== Symbol.for("jest.asymmetricMatcher")) {
200246
- return null;
200280
+ return void 0;
200247
200281
  }
200248
200282
  if (typeof a.getExpectedType !== "function") {
200249
- return null;
200283
+ return void 0;
200250
200284
  }
200251
200285
  expectedType = a.getExpectedType();
200252
200286
  omitDifference = expectedType === "string";
@@ -200265,7 +200299,7 @@ ${bDisplay}`;
200265
200299
  ${bDiff}`;
200266
200300
  }
200267
200301
  if (omitDifference) {
200268
- return null;
200302
+ return void 0;
200269
200303
  }
200270
200304
  switch (aType) {
200271
200305
  case "string":
@@ -201148,7 +201182,7 @@ function inspect(value, opts = {}) {
201148
201182
  __name(inspect, "inspect");
201149
201183
 
201150
201184
  // lib/chai/config.js
201151
- var config$2 = {
201185
+ var config = {
201152
201186
  /**
201153
201187
  * ### config.includeStack
201154
201188
  *
@@ -201262,7 +201296,7 @@ function inspect2(obj, showHidden, depth, colors) {
201262
201296
  colors,
201263
201297
  depth: typeof depth === "undefined" ? 2 : depth,
201264
201298
  showHidden,
201265
- truncate: config$2.truncateThreshold ? config$2.truncateThreshold : Infinity
201299
+ truncate: config.truncateThreshold ? config.truncateThreshold : Infinity
201266
201300
  };
201267
201301
  return inspect(obj, options);
201268
201302
  }
@@ -201271,7 +201305,7 @@ __name(inspect2, "inspect");
201271
201305
  // lib/chai/utils/objDisplay.js
201272
201306
  function objDisplay(obj) {
201273
201307
  var str = inspect2(obj), type3 = Object.prototype.toString.call(obj);
201274
- if (config$2.truncateThreshold && str.length >= config$2.truncateThreshold) {
201308
+ if (config.truncateThreshold && str.length >= config.truncateThreshold) {
201275
201309
  if (type3 === "[object Function]") {
201276
201310
  return !obj.name || obj.name === "" ? "[Function]" : "[Function: " + obj.name + "]";
201277
201311
  } else if (type3 === "[object Array]") {
@@ -201707,28 +201741,28 @@ function Assertion(obj, msg, ssfi, lockSsfi) {
201707
201741
  flag(this, "lockSsfi", lockSsfi);
201708
201742
  flag(this, "object", obj);
201709
201743
  flag(this, "message", msg);
201710
- flag(this, "eql", config$2.deepEqual || deep_eql_default);
201744
+ flag(this, "eql", config.deepEqual || deep_eql_default);
201711
201745
  return proxify(this);
201712
201746
  }
201713
201747
  __name(Assertion, "Assertion");
201714
201748
  Object.defineProperty(Assertion, "includeStack", {
201715
201749
  get: function() {
201716
201750
  console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
201717
- return config$2.includeStack;
201751
+ return config.includeStack;
201718
201752
  },
201719
201753
  set: function(value) {
201720
201754
  console.warn("Assertion.includeStack is deprecated, use chai.config.includeStack instead.");
201721
- config$2.includeStack = value;
201755
+ config.includeStack = value;
201722
201756
  }
201723
201757
  });
201724
201758
  Object.defineProperty(Assertion, "showDiff", {
201725
201759
  get: function() {
201726
201760
  console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
201727
- return config$2.showDiff;
201761
+ return config.showDiff;
201728
201762
  },
201729
201763
  set: function(value) {
201730
201764
  console.warn("Assertion.showDiff is deprecated, use chai.config.showDiff instead.");
201731
- config$2.showDiff = value;
201765
+ config.showDiff = value;
201732
201766
  }
201733
201767
  });
201734
201768
  Assertion.addProperty = function(name, fn) {
@@ -201755,7 +201789,7 @@ Assertion.prototype.assert = function(expr, msg, negateMsg, expected, _actual, s
201755
201789
  showDiff = true;
201756
201790
  if (void 0 === expected && void 0 === _actual)
201757
201791
  showDiff = false;
201758
- if (true !== config$2.showDiff)
201792
+ if (true !== config.showDiff)
201759
201793
  showDiff = false;
201760
201794
  if (!ok) {
201761
201795
  msg = getMessage2(this, arguments);
@@ -201772,7 +201806,7 @@ Assertion.prototype.assert = function(expr, msg, negateMsg, expected, _actual, s
201772
201806
  throw new AssertionError(
201773
201807
  msg,
201774
201808
  assertionErrorObjectProperties,
201775
- config$2.includeStack ? this.assert : flag(this, "ssfi")
201809
+ config.includeStack ? this.assert : flag(this, "ssfi")
201776
201810
  );
201777
201811
  }
201778
201812
  };
@@ -201791,7 +201825,7 @@ Object.defineProperty(
201791
201825
 
201792
201826
  // lib/chai/utils/isProxyEnabled.js
201793
201827
  function isProxyEnabled() {
201794
- return config$2.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined";
201828
+ return config.useProxy && typeof Proxy !== "undefined" && typeof Reflect !== "undefined";
201795
201829
  }
201796
201830
  __name(isProxyEnabled, "isProxyEnabled");
201797
201831
 
@@ -201863,7 +201897,7 @@ function proxify(obj, nonChainableMethodName) {
201863
201897
  return obj;
201864
201898
  return new Proxy(obj, {
201865
201899
  get: /* @__PURE__ */ __name(function proxyGetter(target, property) {
201866
- if (typeof property === "string" && config$2.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
201900
+ if (typeof property === "string" && config.proxyExcludedKeys.indexOf(property) === -1 && !Reflect.has(target, property)) {
201867
201901
  if (nonChainableMethodName) {
201868
201902
  throw Error("Invalid Chai property: " + nonChainableMethodName + "." + property + '. See docs for proper usage of "' + nonChainableMethodName + '".');
201869
201903
  }
@@ -204096,7 +204130,7 @@ function use(fn) {
204096
204130
  const exports = {
204097
204131
  AssertionError,
204098
204132
  util: utils_exports,
204099
- config: config$2,
204133
+ config,
204100
204134
  expect,
204101
204135
  assert,
204102
204136
  Assertion,
@@ -204378,6 +204412,12 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
204378
204412
  });
204379
204413
  }
204380
204414
 
204415
+ f.green;
204416
+ f.red;
204417
+ f.inverse;
204418
+ f.bold;
204419
+ f.dim;
204420
+
204381
204421
  function equals(a, b, customTesters, strictCheck) {
204382
204422
  customTesters = customTesters || [];
204383
204423
  return eq(a, b, [], [], customTesters, strictCheck ? hasKey : hasDefinedKey);
@@ -206174,7 +206214,7 @@ ${error}
206174
206214
  );
206175
206215
  }
206176
206216
 
206177
- const config$1 = config_1().parsed || {};
206217
+ config_1();
206178
206218
  async function generate(args) {
206179
206219
  const inputFilename = args.filename ? args.filename : `${args.apiType}ApiSchema.json`;
206180
206220
  try {
@@ -206228,7 +206268,7 @@ async function generate(args) {
206228
206268
  alreadyApliedPatches
206229
206269
  });
206230
206270
  schema = await openapiTS(patchedSchema, {
206231
- version: +(config$1.OPENAPI_VERSION || 3),
206271
+ version: +(process.env.OPENAPI_VERSION || 3),
206232
206272
  exportType: true,
206233
206273
  // pathParamsAsTypes: true,
206234
206274
  // rawSchema: false,
@@ -206399,7 +206439,7 @@ async function generate(args) {
206399
206439
  }
206400
206440
 
206401
206441
  const name = "@shopware/api-gen";
206402
- const version = "1.0.4";
206442
+ const version = "1.0.5";
206403
206443
  const description = "Shopware CLI for API client generation.";
206404
206444
  const author = "Shopware";
206405
206445
  const type = "module";
@@ -206439,20 +206479,20 @@ const scripts = {
206439
206479
  const devDependencies = {
206440
206480
  "@types/prettier": "3.0.0",
206441
206481
  "@types/yargs": "17.0.32",
206442
- "@vitest/coverage-v8": "2.0.4",
206482
+ "@vitest/coverage-v8": "2.0.5",
206443
206483
  "eslint-config-shopware": "workspace:*",
206444
206484
  json5: "2.2.3",
206445
206485
  picocolors: "1.0.1",
206446
206486
  tsconfig: "workspace:*",
206447
206487
  unbuild: "2.0.0",
206448
- vitest: "2.0.4"
206488
+ vitest: "2.0.5"
206449
206489
  };
206450
206490
  const dependencies = {
206451
206491
  "@shopware/api-client": "workspace:*",
206452
206492
  ofetch: "1.3.4",
206453
206493
  "openapi-typescript": "6.7.6",
206454
206494
  prettier: "3.3.3",
206455
- "ts-morph": "22.0.0",
206495
+ "ts-morph": "23.0.0",
206456
206496
  yargs: "17.7.2"
206457
206497
  };
206458
206498
  const packageJson = {
@@ -206473,7 +206513,7 @@ const packageJson = {
206473
206513
  dependencies: dependencies
206474
206514
  };
206475
206515
 
206476
- const config = config_1().parsed || {};
206516
+ config_1();
206477
206517
  const SCHEMA_ENDPOINT = "_info/openapi3.json";
206478
206518
  const STORE_API_ENDPOINT = `/store-api/${SCHEMA_ENDPOINT}`;
206479
206519
  const ADMIN_API_ENDPOINT = `/api/${SCHEMA_ENDPOINT}`;
@@ -206486,16 +206526,19 @@ async function loadSchema(args) {
206486
206526
  }
206487
206527
  const isAdminApi = args.apiType === "admin";
206488
206528
  const outputFilename = args.filename ? args.filename : `${args.apiType}ApiSchema.json`;
206489
- const requiredEnvVars = ["OPENAPI_JSON_URL"];
206529
+ const OPENAPI_JSON_URL = process.env.OPENAPI_JSON_URL;
206530
+ const requiredEnvVars = [];
206490
206531
  if (isAdminApi) {
206491
206532
  requiredEnvVars.push("SHOPWARE_ADMIN_USERNAME");
206492
206533
  requiredEnvVars.push("SHOPWARE_ADMIN_PASSWORD");
206493
206534
  } else {
206494
206535
  requiredEnvVars.push("OPENAPI_ACCESS_KEY");
206495
206536
  }
206496
- const missingEnvVars = requiredEnvVars.filter((envVar) => !config[envVar]);
206537
+ const missingEnvVars = requiredEnvVars.filter(
206538
+ (envVar) => !process.env[envVar]
206539
+ );
206497
206540
  try {
206498
- if (missingEnvVars.length) {
206541
+ if (missingEnvVars.length || !OPENAPI_JSON_URL) {
206499
206542
  console.error(
206500
206543
  c$1.red(
206501
206544
  `Missing ${c$1.bold(
@@ -206508,7 +206551,7 @@ Check whether the .env file is created.
206508
206551
  );
206509
206552
  process.exit(1);
206510
206553
  }
206511
- const configUrl = config.OPENAPI_JSON_URL.replace(
206554
+ const configUrl = OPENAPI_JSON_URL.replace(
206512
206555
  "/api/_info/openapi3.json",
206513
206556
  ""
206514
206557
  ).replace("/atore-api/_info/openapi3.json", "");
@@ -206521,8 +206564,8 @@ Check whether the .env file is created.
206521
206564
  grant_type: "password",
206522
206565
  client_id: "administration",
206523
206566
  scopes: "write",
206524
- username: config.SHOPWARE_ADMIN_USERNAME,
206525
- password: config.SHOPWARE_ADMIN_PASSWORD
206567
+ username: process.env.SHOPWARE_ADMIN_USERNAME,
206568
+ password: process.env.SHOPWARE_ADMIN_PASSWORD
206526
206569
  }
206527
206570
  });
206528
206571
  const result = await adminClient.invoke(
@@ -206536,7 +206579,7 @@ Check whether the .env file is created.
206536
206579
  } else {
206537
206580
  const apiClient = createAPIClient({
206538
206581
  baseURL: `${configUrl}/store-api`,
206539
- accessToken: config.OPENAPI_ACCESS_KEY
206582
+ accessToken: process.env.OPENAPI_ACCESS_KEY
206540
206583
  });
206541
206584
  const result = await apiClient.invoke(
206542
206585
  "api-info get /_info/openapi3.json",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopware/api-gen",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "Shopware CLI for API client generation.",
5
5
  "author": "Shopware",
6
6
  "type": "module",
@@ -30,19 +30,19 @@
30
30
  "devDependencies": {
31
31
  "@types/prettier": "3.0.0",
32
32
  "@types/yargs": "17.0.32",
33
- "@vitest/coverage-v8": "2.0.4",
33
+ "@vitest/coverage-v8": "2.0.5",
34
34
  "json5": "2.2.3",
35
35
  "picocolors": "1.0.1",
36
36
  "unbuild": "2.0.0",
37
- "vitest": "2.0.4",
38
- "eslint-config-shopware": "1.0.0",
39
- "tsconfig": "0.0.0"
37
+ "vitest": "2.0.5",
38
+ "tsconfig": "0.0.0",
39
+ "eslint-config-shopware": "1.0.0"
40
40
  },
41
41
  "dependencies": {
42
42
  "ofetch": "1.3.4",
43
43
  "openapi-typescript": "6.7.6",
44
44
  "prettier": "3.3.3",
45
- "ts-morph": "22.0.0",
45
+ "ts-morph": "23.0.0",
46
46
  "yargs": "17.7.2",
47
47
  "@shopware/api-client": "1.0.2"
48
48
  },