@lokalise/polyglot-sdk 9.1.0 → 10.1.0

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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export { PolyglotClient } from './sdk/PolyglotClient';
2
2
  export { PolyglotError } from './sdk/errors/PolyglotError';
3
- export * from './sdk/types/client';
3
+ export type { ClientOptions, PolyglotClientConfig } from './sdk/types/client';
4
4
  export { AiIntegrationEngineEnum, MtIntegrationEngineEnum, RealIntegrationEngineEnum, IntegrationEngineEnum, } from './sdk/schemas/common/commonSchemas';
5
5
  export { TRANSLATION_CONTEXT_SCHEMA, isStructuredStyleGuide, } from './sdk/schemas/common/translationContextSchemas';
6
6
  export type { StructuredStyleGuide, FreeformStyleGuide, StyleGuideData, TranslationContext, } from './sdk/schemas/common/translationContextSchemas';
@@ -9,7 +9,7 @@ export * from './sdk/schemas/lqa/lqaAsyncV1Schemas';
9
9
  export * from './sdk/schemas/lqa/lqaSyncV2Schemas';
10
10
  export * from './sdk/schemas/scoring/scoreV1Schemas';
11
11
  export * from './sdk/schemas/translation/generateVariantsV1';
12
- export { TRANSLATE_SYNC_V2_BODY_SCHEMA, TRANSLATE_SYNC_V2_HEADERS_SCHEMA, TRANSLATE_SYNC_V2_RESPONSE_SCHEMA, } from './sdk/schemas/translation/translateSyncV2Schemas';
13
- export type { TranslateSyncV2Body, TranslateSyncV2Headers, TranslateSyncV2Response, } from './sdk/schemas/translation/translateSyncV2Schemas';
14
- export { TRANSLATE_ASYNC_V2_BODY_SCHEMA, TRANSLATE_ASYNC_V2_HEADERS_SCHEMA, TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA, TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA, } from './sdk/schemas/translation/translateAsyncV2Schemas';
15
- export type { TranslateAsyncV2Body, TranslateAsyncV2Headers, TranslateAsyncV2Response, TranslateAsyncV2Callback, } from './sdk/schemas/translation/translateAsyncV2Schemas';
12
+ export { TRANSLATE_SYNC_V2_BODY_SCHEMA, TRANSLATE_SYNC_V2_HEADERS_SCHEMA, TRANSLATE_SYNC_V2_RESPONSE_SCHEMA, TRANSLATE_SYNC_V2_CONTENT_UNIT_SCHEMA, TRANSLATE_SYNC_V2_SEGMENT_SCHEMA, } from './sdk/schemas/translation/translateSyncV2Schemas';
13
+ export type { TranslateSyncV2Body, TranslateSyncV2Headers, TranslateSyncV2Response, TranslateSyncV2ContentUnit, TranslateSyncV2Segment, } from './sdk/schemas/translation/translateSyncV2Schemas';
14
+ export { TRANSLATE_ASYNC_V2_BODY_SCHEMA, TRANSLATE_ASYNC_V2_HEADERS_SCHEMA, TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA, TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA, TRANSLATE_ASYNC_V2_CONTENT_UNIT_SCHEMA, TRANSLATE_ASYNC_V2_SEGMENT_SCHEMA, } from './sdk/schemas/translation/translateAsyncV2Schemas';
15
+ export type { TranslateAsyncV2Body, TranslateAsyncV2Headers, TranslateAsyncV2Response, TranslateAsyncV2Callback, TranslateAsyncV2ContentUnit, TranslateAsyncV2Segment, } from './sdk/schemas/translation/translateAsyncV2Schemas';
package/dist/index.js CHANGED
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA = exports.TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA = exports.TRANSLATE_ASYNC_V2_HEADERS_SCHEMA = exports.TRANSLATE_ASYNC_V2_BODY_SCHEMA = exports.TRANSLATE_SYNC_V2_RESPONSE_SCHEMA = exports.TRANSLATE_SYNC_V2_HEADERS_SCHEMA = exports.TRANSLATE_SYNC_V2_BODY_SCHEMA = exports.LqaIssueSeverityEnum = exports.LqaIssueCategoryEnum = exports.isStructuredStyleGuide = exports.TRANSLATION_CONTEXT_SCHEMA = exports.IntegrationEngineEnum = exports.RealIntegrationEngineEnum = exports.MtIntegrationEngineEnum = exports.AiIntegrationEngineEnum = exports.PolyglotError = exports.PolyglotClient = void 0;
3
+ exports.TRANSLATE_ASYNC_V2_SEGMENT_SCHEMA = exports.TRANSLATE_ASYNC_V2_CONTENT_UNIT_SCHEMA = exports.TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA = exports.TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA = exports.TRANSLATE_ASYNC_V2_HEADERS_SCHEMA = exports.TRANSLATE_ASYNC_V2_BODY_SCHEMA = exports.TRANSLATE_SYNC_V2_SEGMENT_SCHEMA = exports.TRANSLATE_SYNC_V2_CONTENT_UNIT_SCHEMA = exports.TRANSLATE_SYNC_V2_RESPONSE_SCHEMA = exports.TRANSLATE_SYNC_V2_HEADERS_SCHEMA = exports.TRANSLATE_SYNC_V2_BODY_SCHEMA = exports.LqaIssueSeverityEnum = exports.LqaIssueCategoryEnum = exports.isStructuredStyleGuide = exports.TRANSLATION_CONTEXT_SCHEMA = exports.IntegrationEngineEnum = exports.RealIntegrationEngineEnum = exports.MtIntegrationEngineEnum = exports.AiIntegrationEngineEnum = exports.PolyglotError = exports.PolyglotClient = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  var PolyglotClient_1 = require("./sdk/PolyglotClient");
6
6
  Object.defineProperty(exports, "PolyglotClient", { enumerable: true, get: function () { return PolyglotClient_1.PolyglotClient; } });
7
7
  var PolyglotError_1 = require("./sdk/errors/PolyglotError");
8
8
  Object.defineProperty(exports, "PolyglotError", { enumerable: true, get: function () { return PolyglotError_1.PolyglotError; } });
9
- tslib_1.__exportStar(require("./sdk/types/client"), exports);
10
9
  var commonSchemas_1 = require("./sdk/schemas/common/commonSchemas");
11
10
  Object.defineProperty(exports, "AiIntegrationEngineEnum", { enumerable: true, get: function () { return commonSchemas_1.AiIntegrationEngineEnum; } });
12
11
  Object.defineProperty(exports, "MtIntegrationEngineEnum", { enumerable: true, get: function () { return commonSchemas_1.MtIntegrationEngineEnum; } });
@@ -26,9 +25,13 @@ var translateSyncV2Schemas_1 = require("./sdk/schemas/translation/translateSyncV
26
25
  Object.defineProperty(exports, "TRANSLATE_SYNC_V2_BODY_SCHEMA", { enumerable: true, get: function () { return translateSyncV2Schemas_1.TRANSLATE_SYNC_V2_BODY_SCHEMA; } });
27
26
  Object.defineProperty(exports, "TRANSLATE_SYNC_V2_HEADERS_SCHEMA", { enumerable: true, get: function () { return translateSyncV2Schemas_1.TRANSLATE_SYNC_V2_HEADERS_SCHEMA; } });
28
27
  Object.defineProperty(exports, "TRANSLATE_SYNC_V2_RESPONSE_SCHEMA", { enumerable: true, get: function () { return translateSyncV2Schemas_1.TRANSLATE_SYNC_V2_RESPONSE_SCHEMA; } });
28
+ Object.defineProperty(exports, "TRANSLATE_SYNC_V2_CONTENT_UNIT_SCHEMA", { enumerable: true, get: function () { return translateSyncV2Schemas_1.TRANSLATE_SYNC_V2_CONTENT_UNIT_SCHEMA; } });
29
+ Object.defineProperty(exports, "TRANSLATE_SYNC_V2_SEGMENT_SCHEMA", { enumerable: true, get: function () { return translateSyncV2Schemas_1.TRANSLATE_SYNC_V2_SEGMENT_SCHEMA; } });
29
30
  var translateAsyncV2Schemas_1 = require("./sdk/schemas/translation/translateAsyncV2Schemas");
30
31
  Object.defineProperty(exports, "TRANSLATE_ASYNC_V2_BODY_SCHEMA", { enumerable: true, get: function () { return translateAsyncV2Schemas_1.TRANSLATE_ASYNC_V2_BODY_SCHEMA; } });
31
32
  Object.defineProperty(exports, "TRANSLATE_ASYNC_V2_HEADERS_SCHEMA", { enumerable: true, get: function () { return translateAsyncV2Schemas_1.TRANSLATE_ASYNC_V2_HEADERS_SCHEMA; } });
32
33
  Object.defineProperty(exports, "TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA", { enumerable: true, get: function () { return translateAsyncV2Schemas_1.TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA; } });
33
34
  Object.defineProperty(exports, "TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA", { enumerable: true, get: function () { return translateAsyncV2Schemas_1.TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA; } });
35
+ Object.defineProperty(exports, "TRANSLATE_ASYNC_V2_CONTENT_UNIT_SCHEMA", { enumerable: true, get: function () { return translateAsyncV2Schemas_1.TRANSLATE_ASYNC_V2_CONTENT_UNIT_SCHEMA; } });
36
+ Object.defineProperty(exports, "TRANSLATE_ASYNC_V2_SEGMENT_SCHEMA", { enumerable: true, get: function () { return translateAsyncV2Schemas_1.TRANSLATE_ASYNC_V2_SEGMENT_SCHEMA; } });
34
37
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,uDAAqD;AAA5C,gHAAA,cAAc,OAAA;AACvB,4DAA0D;AAAjD,8GAAA,aAAa,OAAA;AACtB,6DAAkC;AAElC,oEAK2C;AAJzC,wHAAA,uBAAuB,OAAA;AACvB,wHAAA,uBAAuB,OAAA;AACvB,0HAAA,yBAAyB,OAAA;AACzB,sHAAA,qBAAqB,OAAA;AAEvB,4FAGuD;AAFrD,uIAAA,0BAA0B,OAAA;AAC1B,mIAAA,sBAAsB,OAAA;AASxB,iEAA4F;AAAnF,qHAAA,oBAAoB,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AACnD,8EAAmD;AACnD,6EAAkD;AAClD,+EAAoD;AACpD,uFAA4D;AAE5D,2FAIyD;AAHvD,uIAAA,6BAA6B,OAAA;AAC7B,0IAAA,gCAAgC,OAAA;AAChC,2IAAA,iCAAiC,OAAA;AAQnC,6FAK0D;AAJxD,yIAAA,8BAA8B,OAAA;AAC9B,4IAAA,iCAAiC,OAAA;AACjC,6IAAA,kCAAkC,OAAA;AAClC,6IAAA,kCAAkC,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,uDAAqD;AAA5C,gHAAA,cAAc,OAAA;AACvB,4DAA0D;AAAjD,8GAAA,aAAa,OAAA;AAGtB,oEAK2C;AAJzC,wHAAA,uBAAuB,OAAA;AACvB,wHAAA,uBAAuB,OAAA;AACvB,0HAAA,yBAAyB,OAAA;AACzB,sHAAA,qBAAqB,OAAA;AAEvB,4FAGuD;AAFrD,uIAAA,0BAA0B,OAAA;AAC1B,mIAAA,sBAAsB,OAAA;AASxB,iEAA4F;AAAnF,qHAAA,oBAAoB,OAAA;AAAE,qHAAA,oBAAoB,OAAA;AACnD,8EAAmD;AACnD,6EAAkD;AAClD,+EAAoD;AACpD,uFAA4D;AAE5D,2FAMyD;AALvD,uIAAA,6BAA6B,OAAA;AAC7B,0IAAA,gCAAgC,OAAA;AAChC,2IAAA,iCAAiC,OAAA;AACjC,+IAAA,qCAAqC,OAAA;AACrC,0IAAA,gCAAgC,OAAA;AAUlC,6FAO0D;AANxD,yIAAA,8BAA8B,OAAA;AAC9B,4IAAA,iCAAiC,OAAA;AACjC,6IAAA,kCAAkC,OAAA;AAClC,6IAAA,kCAAkC,OAAA;AAClC,iJAAA,sCAAsC,OAAA;AACtC,4IAAA,iCAAiC,OAAA"}
@@ -1,12 +1,14 @@
1
1
  import type { Either } from '@lokalise/node-core';
2
- import type { RequestResult } from 'undici-retry';
2
+ import { InternalError } from '@lokalise/node-core';
3
+ import { PolyglotError } from './errors/PolyglotError';
3
4
  import type { LqaAsyncV1Body, LqaAsyncV1Response } from './schemas/lqa/lqaAsyncV1Schemas';
4
5
  import type { LqaSyncV2Body, LqaSyncV2Response } from './schemas/lqa/lqaSyncV2Schemas';
5
6
  import type { ScoreV1Body, ScoreV1Response } from './schemas/scoring/scoreV1Schemas';
6
- import type { GenerateVariantsV1Body } from './schemas/translation/generateVariantsV1';
7
+ import type { GenerateVariantsV1Body, GenerateVariantsV1Response } from './schemas/translation/generateVariantsV1';
7
8
  import type { TranslateAsyncV2Body, TranslateAsyncV2Response } from './schemas/translation/translateAsyncV2Schemas';
8
9
  import type { TranslateSyncV2Body, TranslateSyncV2Response } from './schemas/translation/translateSyncV2Schemas';
9
- import type { ClientOptions, ClientOptionsWithRequestContext, PolyglotClientConfig } from './types/client';
10
+ import type { ClientOptions, PolyglotClientConfig } from './types/client';
11
+ type InstrumentationOutput<T> = Either<PolyglotError | InternalError, T>;
10
12
  export declare class PolyglotClient {
11
13
  private readonly client;
12
14
  private readonly clientHeaders;
@@ -17,17 +19,16 @@ export declare class PolyglotClient {
17
19
  * Re-translates a given translation pair and provides several different variants. Can take previously generated
18
20
  * variants as an input - in attempt to avoid repetition.
19
21
  */
20
- generateVariants(request: GenerateVariantsV1Body, options?: ClientOptions): Promise<string[]>;
22
+ generateVariants(request: GenerateVariantsV1Body, options?: ClientOptions): Promise<InstrumentationOutput<GenerateVariantsV1Response>>;
21
23
  /**
22
24
  * Scores passed translations
23
25
  */
24
- scoreTranslations(request: ScoreV1Body, options?: ClientOptions): Promise<ScoreV1Response>;
25
- translateSync(requestBody: TranslateSyncV2Body, options?: ClientOptions): Promise<RequestResult<TranslateSyncV2Response>>;
26
- translateAsync(requestBody: TranslateAsyncV2Body, options: ClientOptionsWithRequestContext): Promise<Either<Error, TranslateAsyncV2Response>>;
27
- lqaAsync(requestBody: LqaAsyncV1Body, options: ClientOptionsWithRequestContext): Promise<Either<Error, LqaAsyncV1Response>>;
28
- lqaSync(requestBody: LqaSyncV2Body, options: ClientOptionsWithRequestContext): Promise<RequestResult<LqaSyncV2Response>>;
29
- private callAsyncApi;
30
- private wrapWithErrorHandling;
26
+ scoreTranslations(request: ScoreV1Body, options?: ClientOptions): Promise<InstrumentationOutput<ScoreV1Response>>;
27
+ translateAsync(requestBody: TranslateAsyncV2Body, options?: ClientOptions): Promise<InstrumentationOutput<TranslateAsyncV2Response>>;
28
+ translateSync(requestBody: TranslateSyncV2Body, options?: ClientOptions): Promise<InstrumentationOutput<TranslateSyncV2Response>>;
29
+ lqaAsync(requestBody: LqaAsyncV1Body, options?: ClientOptions): Promise<InstrumentationOutput<LqaAsyncV1Response>>;
30
+ lqaSync(requestBody: LqaSyncV2Body, options?: ClientOptions): Promise<InstrumentationOutput<LqaSyncV2Response>>;
31
+ private getRequestOptions;
31
32
  /**
32
33
  * Calls the provided request function and logs the execution time and metadata with the provided logger
33
34
  * @private
@@ -35,3 +36,4 @@ export declare class PolyglotClient {
35
36
  private wrapWithInstrumentation;
36
37
  private wrapError;
37
38
  }
39
+ export {};
@@ -1,9 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PolyglotClient = void 0;
4
+ const backend_http_client_1 = require("@lokalise/backend-http-client");
4
5
  const node_core_1 = require("@lokalise/node-core");
5
- const typeUtils_1 = require("@lokalise/node-core/dist/src/utils/typeUtils");
6
6
  const PolyglotError_1 = require("./errors/PolyglotError");
7
+ const lqaSyncV2Schemas_1 = require("./schemas/lqa/lqaSyncV2Schemas");
8
+ const scoreV1Schemas_1 = require("./schemas/scoring/scoreV1Schemas");
9
+ const generateVariantsV1_1 = require("./schemas/translation/generateVariantsV1");
10
+ const translateAsyncV2Schemas_1 = require("./schemas/translation/translateAsyncV2Schemas");
11
+ const translateSyncV2Schemas_1 = require("./schemas/translation/translateSyncV2Schemas");
7
12
  const DEFAULT_CLIENT_OPTIONS = {
8
13
  timeout: 30000,
9
14
  };
@@ -19,7 +24,7 @@ class PolyglotClient {
19
24
  retryConfig;
20
25
  logger;
21
26
  constructor({ baseUrl, jwtToken, retryConfig, logger }) {
22
- this.client = (0, node_core_1.buildClient)(baseUrl);
27
+ this.client = (0, backend_http_client_1.buildClient)(baseUrl);
23
28
  this.clientHeaders = {
24
29
  'Content-Type': 'application/json',
25
30
  Authorization: `Bearer ${jwtToken}`,
@@ -46,20 +51,12 @@ class PolyglotClient {
46
51
  */
47
52
  async generateVariants(request, options = DEFAULT_CLIENT_OPTIONS) {
48
53
  const resolvedOptions = resolveOptions(options);
49
- if (request.sourceValue.trim() === '' || request.targetValue.trim() === '') {
50
- return [];
51
- }
52
54
  const requestLabel = 'Generate variants (Polyglot)';
53
- const response = await this.wrapWithInstrumentation(() => {
54
- return (0, node_core_1.sendPost)(this.client, '/v1/content/actions/generate-variants', request, {
55
- reqContext: resolvedOptions.reqContext,
56
- retryConfig: this.retryConfig,
57
- timeout: resolvedOptions.timeout,
58
- headers: {
59
- ...this.clientHeaders,
60
- 'x-fake-processing': resolvedOptions.fakeProcessing ? 'true' : undefined,
61
- },
55
+ return await this.wrapWithInstrumentation(() => {
56
+ return (0, backend_http_client_1.sendPost)(this.client, '/v1/content/actions/generate-variants', request, {
57
+ ...this.getRequestOptions(resolvedOptions),
62
58
  requestLabel,
59
+ responseSchema: generateVariantsV1_1.GENERATE_VARIANTS_V1_RESPONSE_SCHEMA,
63
60
  });
64
61
  }, {
65
62
  requestLabel,
@@ -72,7 +69,6 @@ class PolyglotClient {
72
69
  }),
73
70
  },
74
71
  });
75
- return response.body.variants;
76
72
  }
77
73
  /**
78
74
  * Scores passed translations
@@ -80,16 +76,11 @@ class PolyglotClient {
80
76
  async scoreTranslations(request, options = DEFAULT_CLIENT_OPTIONS) {
81
77
  const resolvedOptions = resolveOptions(options);
82
78
  const requestLabel = 'Score translations (Polyglot)';
83
- const response = await this.wrapWithInstrumentation(() => {
84
- return (0, node_core_1.sendPost)(this.client, '/v1/content/actions/score', request, {
85
- reqContext: resolvedOptions.reqContext,
86
- retryConfig: this.retryConfig,
87
- timeout: resolvedOptions.timeout,
88
- headers: {
89
- ...this.clientHeaders,
90
- 'x-fake-processing': resolvedOptions.fakeProcessing ? 'true' : undefined,
91
- },
79
+ return await this.wrapWithInstrumentation(() => {
80
+ return (0, backend_http_client_1.sendPost)(this.client, '/v1/content/actions/score', request, {
81
+ ...this.getRequestOptions(resolvedOptions),
92
82
  requestLabel,
83
+ responseSchema: scoreV1Schemas_1.SCORE_V1_RESPONSE_SCHEMA,
93
84
  });
94
85
  }, {
95
86
  requestLabel,
@@ -100,21 +91,15 @@ class PolyglotClient {
100
91
  }),
101
92
  },
102
93
  });
103
- return response.body;
104
94
  }
105
- async translateSync(requestBody, options = DEFAULT_CLIENT_OPTIONS) {
95
+ async translateAsync(requestBody, options = DEFAULT_CLIENT_OPTIONS) {
106
96
  const resolvedOptions = resolveOptions(options);
107
- const requestLabel = 'Translate synchronously (Polyglot)';
97
+ const requestLabel = 'Translate asynchronously (Polyglot)';
108
98
  return await this.wrapWithInstrumentation(() => {
109
- return (0, node_core_1.sendPost)(this.client, '/v2/content/actions/translate-sync', requestBody, {
110
- reqContext: resolvedOptions.reqContext,
111
- retryConfig: this.retryConfig,
112
- timeout: resolvedOptions.timeout,
113
- headers: {
114
- ...this.clientHeaders,
115
- 'x-fake-processing': resolvedOptions.fakeProcessing ? 'true' : undefined,
116
- },
99
+ return (0, backend_http_client_1.sendPost)(this.client, '/v2/content/actions/translate-async', requestBody, {
100
+ ...this.getRequestOptions(resolvedOptions),
117
101
  requestLabel,
102
+ responseSchema: translateAsyncV2Schemas_1.TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA,
118
103
  });
119
104
  }, {
120
105
  requestLabel,
@@ -127,49 +112,34 @@ class PolyglotClient {
127
112
  },
128
113
  });
129
114
  }
130
- async translateAsync(requestBody, options) {
131
- const result = await this.callAsyncApi('/v2/content/actions/translate-async', requestBody, options, 'Translate asynchronously (Polyglot)');
132
- if (result.error === null) {
133
- result.error = new node_core_1.InternalError({
134
- message: 'Failed to schedule asynchronous translation',
135
- errorCode: 'FAILED_TO_SCHEDULE_ASYNC_TRANSLATION',
136
- details: {
137
- originCorrelationId: requestBody.originCorrelationId,
138
- tenantId: requestBody.tenantId,
139
- ownerId: requestBody.ownerId,
140
- },
141
- });
142
- }
143
- return result;
144
- }
145
- async lqaAsync(requestBody, options) {
146
- const result = await this.callAsyncApi('/v1/content/actions/lqa-async', requestBody, options, 'LQA asynchronously (Polyglot)');
147
- if (result.error === null) {
148
- result.error = new node_core_1.InternalError({
149
- message: 'Failed to schedule asynchronous LQA',
150
- errorCode: 'FAILED_TO_SCHEDULE_ASYNC_LQA',
151
- details: {
152
- originCorrelationId: requestBody.originCorrelationId,
153
- tenantId: requestBody.tenantId,
154
- ownerId: requestBody.ownerId,
155
- },
115
+ async translateSync(requestBody, options = DEFAULT_CLIENT_OPTIONS) {
116
+ const resolvedOptions = resolveOptions(options);
117
+ const requestLabel = 'Translate synchronously (Polyglot)';
118
+ return await this.wrapWithInstrumentation(() => {
119
+ return (0, backend_http_client_1.sendPost)(this.client, '/v2/content/actions/translate-sync', requestBody, {
120
+ ...this.getRequestOptions(resolvedOptions),
121
+ requestLabel,
122
+ responseSchema: translateSyncV2Schemas_1.TRANSLATE_SYNC_V2_RESPONSE_SCHEMA,
156
123
  });
157
- }
158
- return result;
124
+ }, {
125
+ requestLabel,
126
+ callMetadata: {
127
+ ...resolvedOptions.metadata,
128
+ fakeProcessing: JSON.stringify(resolvedOptions.fakeProcessing),
129
+ reqContext: JSON.stringify({
130
+ reqId: resolvedOptions.reqContext?.reqId,
131
+ }),
132
+ },
133
+ });
159
134
  }
160
- async lqaSync(requestBody, options) {
135
+ async lqaAsync(requestBody, options = DEFAULT_CLIENT_OPTIONS) {
161
136
  const resolvedOptions = resolveOptions(options);
162
- const requestLabel = 'LQA synchronously (Polyglot)';
137
+ const requestLabel = 'LQA asynchronously (Polyglot)';
163
138
  return await this.wrapWithInstrumentation(() => {
164
- return (0, node_core_1.sendPost)(this.client, '/v2/content/actions/lqa-sync', requestBody, {
165
- reqContext: resolvedOptions.reqContext,
166
- retryConfig: this.retryConfig,
167
- timeout: resolvedOptions.timeout,
168
- headers: {
169
- ...this.clientHeaders,
170
- 'x-fake-processing': resolvedOptions.fakeProcessing ? 'true' : undefined,
171
- },
139
+ return (0, backend_http_client_1.sendPost)(this.client, '/v1/content/actions/lqa-async', requestBody, {
140
+ ...this.getRequestOptions(resolvedOptions),
172
141
  requestLabel,
142
+ responseSchema: translateAsyncV2Schemas_1.TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA,
173
143
  });
174
144
  }, {
175
145
  requestLabel,
@@ -182,36 +152,36 @@ class PolyglotClient {
182
152
  },
183
153
  });
184
154
  }
185
- async callAsyncApi(path, requestBody, options, requestLabel) {
155
+ async lqaSync(requestBody, options = DEFAULT_CLIENT_OPTIONS) {
186
156
  const resolvedOptions = resolveOptions(options);
187
- const result = await this.wrapWithErrorHandling(() => {
188
- return (0, node_core_1.sendPost)(this.client, path, requestBody, {
189
- reqContext: resolvedOptions.reqContext,
190
- retryConfig: this.retryConfig,
191
- throwOnError: false,
192
- timeout: resolvedOptions.timeout,
193
- headers: {
194
- ...this.clientHeaders,
195
- 'x-fake-processing': resolvedOptions.fakeProcessing ? 'true' : undefined,
196
- },
157
+ const requestLabel = 'LQA synchronously (Polyglot)';
158
+ return await this.wrapWithInstrumentation(() => {
159
+ return (0, backend_http_client_1.sendPost)(this.client, '/v2/content/actions/lqa-sync', requestBody, {
160
+ ...this.getRequestOptions(resolvedOptions),
197
161
  requestLabel,
162
+ responseSchema: lqaSyncV2Schemas_1.LQA_SYNC_V2_RESPONSE_SCHEMA,
198
163
  });
164
+ }, {
165
+ requestLabel,
166
+ callMetadata: {
167
+ ...resolvedOptions.metadata,
168
+ fakeProcessing: JSON.stringify(resolvedOptions.fakeProcessing),
169
+ reqContext: JSON.stringify({
170
+ reqId: resolvedOptions.reqContext?.reqId,
171
+ }),
172
+ },
199
173
  });
200
- if (result.error)
201
- return result;
202
- return result.result.statusCode === 202 ? (0, node_core_1.success)(result.result.body) : (0, node_core_1.failure)(null);
203
174
  }
204
- async wrapWithErrorHandling(innerFn) {
205
- try {
206
- const { result, error } = await innerFn();
207
- if (error) {
208
- return (0, node_core_1.failure)(this.wrapError(error));
209
- }
210
- return (0, node_core_1.success)(result);
211
- }
212
- catch (error) {
213
- return (0, node_core_1.failure)(this.wrapError(error));
214
- }
175
+ getRequestOptions(options) {
176
+ return {
177
+ reqContext: options.reqContext,
178
+ retryConfig: this.retryConfig,
179
+ timeout: options.timeout,
180
+ headers: {
181
+ ...this.clientHeaders,
182
+ 'x-fake-processing': options.fakeProcessing ? 'true' : undefined,
183
+ },
184
+ };
215
185
  }
216
186
  /**
217
187
  * Calls the provided request function and logs the execution time and metadata with the provided logger
@@ -224,14 +194,13 @@ class PolyglotClient {
224
194
  const { result, error } = await innerFn();
225
195
  // We might receive an non-satisfactory response, but it might not be an Error object - so we have to wrap it
226
196
  if (error) {
227
- // noinspection ExceptionCaughtLocallyJS
228
- throw error;
197
+ return { error: this.wrapError(error) };
229
198
  }
230
199
  successful = true;
231
- return result;
200
+ return { result: result.body };
232
201
  }
233
- catch (e) {
234
- throw this.wrapError(e);
202
+ catch (err) {
203
+ return { error: this.wrapError(err) };
235
204
  }
236
205
  finally {
237
206
  this.logger?.info({
@@ -242,19 +211,15 @@ class PolyglotClient {
242
211
  });
243
212
  }
244
213
  }
245
- wrapError(e) {
246
- let error;
247
- if ((0, typeUtils_1.isError)(e)) {
248
- error = (0, node_core_1.isResponseStatusError)(e) ? new PolyglotError_1.PolyglotError(e) : e;
214
+ wrapError(err) {
215
+ if ((0, backend_http_client_1.isResponseStatusError)(err)) {
216
+ return new PolyglotError_1.PolyglotError(err);
249
217
  }
250
- else {
251
- error = new node_core_1.InternalError({
252
- message: 'Unknown error',
253
- errorCode: 'UNKNOWN_ERROR',
254
- details: { error: JSON.stringify(e) },
255
- });
256
- }
257
- return error;
218
+ return new node_core_1.InternalError({
219
+ message: 'Unknown error',
220
+ errorCode: 'UNKNOWN_ERROR',
221
+ details: { error: JSON.stringify(err) },
222
+ });
258
223
  }
259
224
  }
260
225
  exports.PolyglotClient = PolyglotClient;
@@ -1 +1 @@
1
- {"version":3,"file":"PolyglotClient.js","sourceRoot":"","sources":["../../src/sdk/PolyglotClient.ts"],"names":[],"mappings":";;;AACA,mDAO4B;AAE5B,4EAAsE;AAKtE,0DAAsD;AAuBtD,MAAM,sBAAsB,GAAkB;IAC5C,OAAO,EAAE,KAAK;CACf,CAAA;AAED,SAAS,cAAc,CAA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,GAAG,EAAE,GAAG,SAAS;aACxC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAEO,SAAS,CAAC,GAAY;QAC5B,IAAI,IAAA,2CAAqB,EAAC,GAAG,CAAC,EAAE,CAAC;YAC/B,OAAO,IAAI,6BAAa,CAAC,GAAG,CAAC,CAAA;QAC/B,CAAC;QAED,OAAO,IAAI,yBAAa,CAAC;YACvB,OAAO,EAAE,eAAe;YACxB,SAAS,EAAE,eAAe;YAC1B,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;SACxC,CAAC,CAAA;IACJ,CAAC;CACF;AApQD,wCAoQC"}
@@ -1,4 +1,4 @@
1
- import type { ResponseStatusError } from '@lokalise/node-core';
1
+ import type { ResponseStatusError } from '@lokalise/backend-http-client';
2
2
  import { InternalError } from '@lokalise/node-core';
3
3
  export declare class PolyglotError extends InternalError {
4
4
  constructor(error: ResponseStatusError);
@@ -1,4 +1,201 @@
1
1
  import z from 'zod';
2
+ declare const LQA_SEGMENT_SCHEMA: z.ZodObject<{
3
+ sourceValue: z.ZodString;
4
+ translations: z.ZodArray<z.ZodObject<{
5
+ id: z.ZodString;
6
+ locale: z.ZodEffects<z.ZodString, string, string>;
7
+ value: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ value: string;
10
+ locale: string;
11
+ id: string;
12
+ }, {
13
+ value: string;
14
+ locale: string;
15
+ id: string;
16
+ }>, "atleastone">;
17
+ tmMatch: z.ZodOptional<z.ZodObject<{
18
+ sourceValue: z.ZodString;
19
+ translatedValue: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ sourceValue: string;
22
+ translatedValue: string;
23
+ }, {
24
+ sourceValue: string;
25
+ translatedValue: string;
26
+ }>>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ sourceValue: string;
29
+ translations: [{
30
+ value: string;
31
+ locale: string;
32
+ id: string;
33
+ }, ...{
34
+ value: string;
35
+ locale: string;
36
+ id: string;
37
+ }[]];
38
+ tmMatch?: {
39
+ sourceValue: string;
40
+ translatedValue: string;
41
+ } | undefined;
42
+ }, {
43
+ sourceValue: string;
44
+ translations: [{
45
+ value: string;
46
+ locale: string;
47
+ id: string;
48
+ }, ...{
49
+ value: string;
50
+ locale: string;
51
+ id: string;
52
+ }[]];
53
+ tmMatch?: {
54
+ sourceValue: string;
55
+ translatedValue: string;
56
+ } | undefined;
57
+ }>;
58
+ declare const LQA_CONTENT_UNIT_SCHEMA: z.ZodObject<{
59
+ id: z.ZodString;
60
+ context: z.ZodOptional<z.ZodObject<{
61
+ description: z.ZodOptional<z.ZodString>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ description?: string | undefined;
64
+ }, {
65
+ description?: string | undefined;
66
+ }>>;
67
+ segments: z.ZodArray<z.ZodObject<{
68
+ sourceValue: z.ZodString;
69
+ translations: z.ZodArray<z.ZodObject<{
70
+ id: z.ZodString;
71
+ locale: z.ZodEffects<z.ZodString, string, string>;
72
+ value: z.ZodString;
73
+ }, "strip", z.ZodTypeAny, {
74
+ value: string;
75
+ locale: string;
76
+ id: string;
77
+ }, {
78
+ value: string;
79
+ locale: string;
80
+ id: string;
81
+ }>, "atleastone">;
82
+ tmMatch: z.ZodOptional<z.ZodObject<{
83
+ sourceValue: z.ZodString;
84
+ translatedValue: z.ZodString;
85
+ }, "strip", z.ZodTypeAny, {
86
+ sourceValue: string;
87
+ translatedValue: string;
88
+ }, {
89
+ sourceValue: string;
90
+ translatedValue: string;
91
+ }>>;
92
+ }, "strip", z.ZodTypeAny, {
93
+ sourceValue: string;
94
+ translations: [{
95
+ value: string;
96
+ locale: string;
97
+ id: string;
98
+ }, ...{
99
+ value: string;
100
+ locale: string;
101
+ id: string;
102
+ }[]];
103
+ tmMatch?: {
104
+ sourceValue: string;
105
+ translatedValue: string;
106
+ } | undefined;
107
+ }, {
108
+ sourceValue: string;
109
+ translations: [{
110
+ value: string;
111
+ locale: string;
112
+ id: string;
113
+ }, ...{
114
+ value: string;
115
+ locale: string;
116
+ id: string;
117
+ }[]];
118
+ tmMatch?: {
119
+ sourceValue: string;
120
+ translatedValue: string;
121
+ } | undefined;
122
+ }>, "atleastone">;
123
+ characterLimit: z.ZodOptional<z.ZodNumber>;
124
+ }, "strip", z.ZodTypeAny, {
125
+ id: string;
126
+ segments: [{
127
+ sourceValue: string;
128
+ translations: [{
129
+ value: string;
130
+ locale: string;
131
+ id: string;
132
+ }, ...{
133
+ value: string;
134
+ locale: string;
135
+ id: string;
136
+ }[]];
137
+ tmMatch?: {
138
+ sourceValue: string;
139
+ translatedValue: string;
140
+ } | undefined;
141
+ }, ...{
142
+ sourceValue: string;
143
+ translations: [{
144
+ value: string;
145
+ locale: string;
146
+ id: string;
147
+ }, ...{
148
+ value: string;
149
+ locale: string;
150
+ id: string;
151
+ }[]];
152
+ tmMatch?: {
153
+ sourceValue: string;
154
+ translatedValue: string;
155
+ } | undefined;
156
+ }[]];
157
+ context?: {
158
+ description?: string | undefined;
159
+ } | undefined;
160
+ characterLimit?: number | undefined;
161
+ }, {
162
+ id: string;
163
+ segments: [{
164
+ sourceValue: string;
165
+ translations: [{
166
+ value: string;
167
+ locale: string;
168
+ id: string;
169
+ }, ...{
170
+ value: string;
171
+ locale: string;
172
+ id: string;
173
+ }[]];
174
+ tmMatch?: {
175
+ sourceValue: string;
176
+ translatedValue: string;
177
+ } | undefined;
178
+ }, ...{
179
+ sourceValue: string;
180
+ translations: [{
181
+ value: string;
182
+ locale: string;
183
+ id: string;
184
+ }, ...{
185
+ value: string;
186
+ locale: string;
187
+ id: string;
188
+ }[]];
189
+ tmMatch?: {
190
+ sourceValue: string;
191
+ translatedValue: string;
192
+ } | undefined;
193
+ }[]];
194
+ context?: {
195
+ description?: string | undefined;
196
+ } | undefined;
197
+ characterLimit?: number | undefined;
198
+ }>;
2
199
  export declare const LQA_ASYNC_V1_BODY_SCHEMA: z.ZodObject<z.objectUtil.extendShape<{
3
200
  originCorrelationId: z.ZodString;
4
201
  ownerId: z.ZodString;
@@ -644,3 +841,6 @@ export type LqaAsyncV1Body = z.infer<typeof LQA_ASYNC_V1_BODY_SCHEMA>;
644
841
  export type LqaAsyncV1Headers = z.infer<typeof LQA_ASYNC_V1_HEADERS_SCHEMA>;
645
842
  export type LqaAsyncV1Response = z.infer<typeof LQA_ASYNC_V1_RESPONSE_SCHEMA>;
646
843
  export type LqaAsyncV1CallbackBody = z.infer<typeof LQA_ASYNC_V1_CALLBACK_SCHEMA>;
844
+ export type LqaAsyncV1ContentUnit = z.infer<typeof LQA_CONTENT_UNIT_SCHEMA>;
845
+ export type LqaAsyncV1Segment = z.infer<typeof LQA_SEGMENT_SCHEMA>;
846
+ export {};
@@ -1,4 +1,201 @@
1
1
  import z from 'zod';
2
+ declare const SEGMENT_SCHEMA: z.ZodObject<{
3
+ sourceValue: z.ZodString;
4
+ translations: z.ZodArray<z.ZodObject<{
5
+ id: z.ZodString;
6
+ locale: z.ZodEffects<z.ZodString, string, string>;
7
+ value: z.ZodString;
8
+ }, "strip", z.ZodTypeAny, {
9
+ value: string;
10
+ locale: string;
11
+ id: string;
12
+ }, {
13
+ value: string;
14
+ locale: string;
15
+ id: string;
16
+ }>, "atleastone">;
17
+ tmMatch: z.ZodOptional<z.ZodObject<{
18
+ sourceValue: z.ZodString;
19
+ translatedValue: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ sourceValue: string;
22
+ translatedValue: string;
23
+ }, {
24
+ sourceValue: string;
25
+ translatedValue: string;
26
+ }>>;
27
+ }, "strip", z.ZodTypeAny, {
28
+ sourceValue: string;
29
+ translations: [{
30
+ value: string;
31
+ locale: string;
32
+ id: string;
33
+ }, ...{
34
+ value: string;
35
+ locale: string;
36
+ id: string;
37
+ }[]];
38
+ tmMatch?: {
39
+ sourceValue: string;
40
+ translatedValue: string;
41
+ } | undefined;
42
+ }, {
43
+ sourceValue: string;
44
+ translations: [{
45
+ value: string;
46
+ locale: string;
47
+ id: string;
48
+ }, ...{
49
+ value: string;
50
+ locale: string;
51
+ id: string;
52
+ }[]];
53
+ tmMatch?: {
54
+ sourceValue: string;
55
+ translatedValue: string;
56
+ } | undefined;
57
+ }>;
58
+ declare const CONTENT_UNIT_SCHEMA: z.ZodObject<{
59
+ id: z.ZodString;
60
+ context: z.ZodOptional<z.ZodObject<{
61
+ description: z.ZodOptional<z.ZodString>;
62
+ }, "strip", z.ZodTypeAny, {
63
+ description?: string | undefined;
64
+ }, {
65
+ description?: string | undefined;
66
+ }>>;
67
+ characterLimit: z.ZodOptional<z.ZodNumber>;
68
+ segments: z.ZodArray<z.ZodObject<{
69
+ sourceValue: z.ZodString;
70
+ translations: z.ZodArray<z.ZodObject<{
71
+ id: z.ZodString;
72
+ locale: z.ZodEffects<z.ZodString, string, string>;
73
+ value: z.ZodString;
74
+ }, "strip", z.ZodTypeAny, {
75
+ value: string;
76
+ locale: string;
77
+ id: string;
78
+ }, {
79
+ value: string;
80
+ locale: string;
81
+ id: string;
82
+ }>, "atleastone">;
83
+ tmMatch: z.ZodOptional<z.ZodObject<{
84
+ sourceValue: z.ZodString;
85
+ translatedValue: z.ZodString;
86
+ }, "strip", z.ZodTypeAny, {
87
+ sourceValue: string;
88
+ translatedValue: string;
89
+ }, {
90
+ sourceValue: string;
91
+ translatedValue: string;
92
+ }>>;
93
+ }, "strip", z.ZodTypeAny, {
94
+ sourceValue: string;
95
+ translations: [{
96
+ value: string;
97
+ locale: string;
98
+ id: string;
99
+ }, ...{
100
+ value: string;
101
+ locale: string;
102
+ id: string;
103
+ }[]];
104
+ tmMatch?: {
105
+ sourceValue: string;
106
+ translatedValue: string;
107
+ } | undefined;
108
+ }, {
109
+ sourceValue: string;
110
+ translations: [{
111
+ value: string;
112
+ locale: string;
113
+ id: string;
114
+ }, ...{
115
+ value: string;
116
+ locale: string;
117
+ id: string;
118
+ }[]];
119
+ tmMatch?: {
120
+ sourceValue: string;
121
+ translatedValue: string;
122
+ } | undefined;
123
+ }>, "atleastone">;
124
+ }, "strip", z.ZodTypeAny, {
125
+ id: string;
126
+ segments: [{
127
+ sourceValue: string;
128
+ translations: [{
129
+ value: string;
130
+ locale: string;
131
+ id: string;
132
+ }, ...{
133
+ value: string;
134
+ locale: string;
135
+ id: string;
136
+ }[]];
137
+ tmMatch?: {
138
+ sourceValue: string;
139
+ translatedValue: string;
140
+ } | undefined;
141
+ }, ...{
142
+ sourceValue: string;
143
+ translations: [{
144
+ value: string;
145
+ locale: string;
146
+ id: string;
147
+ }, ...{
148
+ value: string;
149
+ locale: string;
150
+ id: string;
151
+ }[]];
152
+ tmMatch?: {
153
+ sourceValue: string;
154
+ translatedValue: string;
155
+ } | undefined;
156
+ }[]];
157
+ context?: {
158
+ description?: string | undefined;
159
+ } | undefined;
160
+ characterLimit?: number | undefined;
161
+ }, {
162
+ id: string;
163
+ segments: [{
164
+ sourceValue: string;
165
+ translations: [{
166
+ value: string;
167
+ locale: string;
168
+ id: string;
169
+ }, ...{
170
+ value: string;
171
+ locale: string;
172
+ id: string;
173
+ }[]];
174
+ tmMatch?: {
175
+ sourceValue: string;
176
+ translatedValue: string;
177
+ } | undefined;
178
+ }, ...{
179
+ sourceValue: string;
180
+ translations: [{
181
+ value: string;
182
+ locale: string;
183
+ id: string;
184
+ }, ...{
185
+ value: string;
186
+ locale: string;
187
+ id: string;
188
+ }[]];
189
+ tmMatch?: {
190
+ sourceValue: string;
191
+ translatedValue: string;
192
+ } | undefined;
193
+ }[]];
194
+ context?: {
195
+ description?: string | undefined;
196
+ } | undefined;
197
+ characterLimit?: number | undefined;
198
+ }>;
2
199
  export declare const LQA_SYNC_V2_BODY_SCHEMA: z.ZodObject<{
3
200
  sourceLocale: z.ZodEffects<z.ZodString, string, string>;
4
201
  context: z.ZodOptional<z.ZodObject<{
@@ -617,3 +814,6 @@ export declare const LQA_SYNC_V2_RESPONSE_SCHEMA: z.ZodObject<{
617
814
  export type LqaSyncV2Body = z.infer<typeof LQA_SYNC_V2_BODY_SCHEMA>;
618
815
  export type LqaSyncV2Headers = z.infer<typeof LQA_SYNC_V2_HEADERS_SCHEMA>;
619
816
  export type LqaSyncV2Response = z.infer<typeof LQA_SYNC_V2_RESPONSE_SCHEMA>;
817
+ export type LqaSyncV2ContentUnit = z.infer<typeof CONTENT_UNIT_SCHEMA>;
818
+ export type LqaSyncV2Segment = z.infer<typeof SEGMENT_SCHEMA>;
819
+ export {};
@@ -1057,3 +1057,5 @@ export type TranslateAsyncV2Body = z.infer<typeof TRANSLATE_ASYNC_V2_BODY_SCHEMA
1057
1057
  export type TranslateAsyncV2Headers = z.infer<typeof TRANSLATE_ASYNC_V2_HEADERS_SCHEMA>;
1058
1058
  export type TranslateAsyncV2Response = z.infer<typeof TRANSLATE_ASYNC_V2_RESPONSE_SCHEMA>;
1059
1059
  export type TranslateAsyncV2Callback = z.infer<typeof TRANSLATE_ASYNC_V2_CALLBACK_SCHEMA>;
1060
+ export type TranslateAsyncV2ContentUnit = z.infer<typeof TRANSLATE_ASYNC_V2_CONTENT_UNIT_SCHEMA>;
1061
+ export type TranslateAsyncV2Segment = z.infer<typeof TRANSLATE_ASYNC_V2_SEGMENT_SCHEMA>;
@@ -705,3 +705,5 @@ export declare const TRANSLATE_SYNC_V2_RESPONSE_SCHEMA: z.ZodObject<{
705
705
  export type TranslateSyncV2Body = z.infer<typeof TRANSLATE_SYNC_V2_BODY_SCHEMA>;
706
706
  export type TranslateSyncV2Headers = z.infer<typeof TRANSLATE_SYNC_V2_HEADERS_SCHEMA>;
707
707
  export type TranslateSyncV2Response = z.infer<typeof TRANSLATE_SYNC_V2_RESPONSE_SCHEMA>;
708
+ export type TranslateSyncV2ContentUnit = z.infer<typeof TRANSLATE_SYNC_V2_CONTENT_UNIT_SCHEMA>;
709
+ export type TranslateSyncV2Segment = z.infer<typeof TRANSLATE_SYNC_V2_SEGMENT_SCHEMA>;
@@ -7,16 +7,6 @@ export type ClientOptions = {
7
7
  metadata?: Record<string, string>;
8
8
  timeout?: number;
9
9
  };
10
- export type ClientOptionsWithRequestContext = {
11
- fakeProcessing?: boolean;
12
- reqContext: RequestContext;
13
- metadata?: Record<string, string>;
14
- timeout?: number;
15
- };
16
- export type InstrumentationOptions = {
17
- requestLabel: string;
18
- callMetadata?: Record<string, string>;
19
- };
20
10
  export type PolyglotClientConfig = {
21
11
  baseUrl: string;
22
12
  jwtToken: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/polyglot-sdk",
3
- "version": "9.1.0",
3
+ "version": "10.1.0",
4
4
  "author": {
5
5
  "name": "Lokalise",
6
6
  "url": "https://lokalise.com/"
@@ -33,20 +33,21 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@amplitude/analytics-types": "^2.6.0",
36
- "@lokalise/fastify-extras": "^21.3.0",
36
+ "@lokalise/backend-http-client": "^2.0.1",
37
+ "@lokalise/fastify-extras": "^21.4.1",
37
38
  "@lokalise/id-utils": "^2.1.0",
38
- "@lokalise/node-core": "^9.20.0",
39
+ "@lokalise/node-core": "^11.2.0",
39
40
  "@lokalise/supported-languages": "^2.0.0",
40
41
  "@lokalise/zod-extras": "^2.1.0",
41
- "undici": "^6.19.2",
42
- "undici-retry": "^5.0.2",
43
- "zod": "^3.23.4"
42
+ "undici": "^6.19.4",
43
+ "undici-retry": "^5.0.3",
44
+ "zod": "^3.23.8"
44
45
  },
45
46
  "devDependencies": {
46
- "@types/node": "^20.14.10",
47
- "@typescript-eslint/eslint-plugin": "^7.4.0",
48
- "@typescript-eslint/parser": "^7.4.0",
49
- "@vitest/coverage-v8": "^1.6.0",
47
+ "@types/node": "^20.14.11",
48
+ "@typescript-eslint/eslint-plugin": "^7.17.0",
49
+ "@typescript-eslint/parser": "^7.17.0",
50
+ "@vitest/coverage-v8": "^2.0.4",
50
51
  "auto-changelog": "^2.4.0",
51
52
  "eslint": "^8.57.0",
52
53
  "eslint-plugin-import": "^2.29.1",
@@ -56,6 +57,6 @@
56
57
  "shx": "^0.3.4",
57
58
  "ts-deepmerge": "^7.0.0",
58
59
  "typescript": "5.5.3",
59
- "vitest": "^1.6.0"
60
+ "vitest": "^2.0.4"
60
61
  }
61
62
  }