@tolgee/cli 2.10.0 → 2.10.2

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.
@@ -11,7 +11,7 @@ import createClient from 'openapi-fetch';
11
11
  import base32Decode from 'base32-decode';
12
12
  import { API_KEY_PAK_PREFIX, USER_AGENT } from '../constants.js';
13
13
  import { getApiKeyInformation } from './getApiKeyInformation.js';
14
- import { debug } from '../utils/logger.js';
14
+ import { debug, isDebugEnabled } from '../utils/logger.js';
15
15
  import { errorFromLoadable } from './errorFromLoadable.js';
16
16
  function parseResponse(response, parseAs) {
17
17
  return __awaiter(this, void 0, void 0, function* () {
@@ -62,7 +62,18 @@ export function createApiClient({ baseUrl, apiKey, projectId, autoThrow = false,
62
62
  debug(`[HTTP] Requesting: ${request.method} ${request.url}`);
63
63
  },
64
64
  onResponse: (_a) => __awaiter(this, [_a], void 0, function* ({ response, options }) {
65
- debug(`[HTTP] Response: ${response.url} [${response.status}]`);
65
+ let responseText = `[HTTP] Response: ${response.url} [${response.status}]`;
66
+ const apiVersion = response.headers.get('x-tolgee-version');
67
+ if (apiVersion) {
68
+ responseText += ` [${response.headers.get('x-tolgee-version')}]`;
69
+ }
70
+ if (!response.ok && isDebugEnabled()) {
71
+ const clonedBody = yield response.clone().text();
72
+ if (clonedBody) {
73
+ responseText += ` [${clonedBody}]`;
74
+ }
75
+ }
76
+ debug(responseText);
66
77
  if (autoThrow && !response.ok) {
67
78
  const loadable = yield parseResponse(response, options.parseAs);
68
79
  throw new Error(`Tolgee request error ${response.url} ${errorFromLoadable(loadable)}`);
@@ -144,7 +144,12 @@ const pushHandler = (config) => function () {
144
144
  format: format,
145
145
  languageTag: f.language,
146
146
  namespace: (_a = f.namespace) !== null && _a !== void 0 ? _a : '',
147
- languageTagsToImport: opts.languages,
147
+ // there can be multiple languages inside the file
148
+ // that is detected on the backend
149
+ // and we only say which we want to import by `languageTagsToImport`
150
+ // however we don't want to use this property,
151
+ // when it's explicitly defined what language is in the file
152
+ languageTagsToImport: !f.language ? opts.languages : undefined,
148
153
  };
149
154
  }),
150
155
  removeOtherKeys: opts.removeOtherKeys,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolgee/cli",
3
- "version": "2.10.0",
3
+ "version": "2.10.2",
4
4
  "type": "module",
5
5
  "description": "A tool to interact with the Tolgee Platform through CLI",
6
6
  "repository": {