@lokalise/tm-sdk 2.0.1 → 2.2.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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { MandatoryPaginationParams } from '@lokalise/api-common';
|
|
2
|
+
import type { RequestContext } from '@lokalise/fastify-extras';
|
|
2
3
|
import type { ErrorReporter } from '@lokalise/node-core';
|
|
3
4
|
import type { RetryConfig } from 'undici-retry';
|
|
4
5
|
import type { BulkTranslationMemoryMatches, TranslationMemoryMatch, TranslationMemoryRecordsResponse, UpsertRecordDto } from './types/models';
|
|
@@ -10,19 +11,23 @@ export type TranslationMemoryClientConfig = {
|
|
|
10
11
|
errorReporter?: ErrorReporter;
|
|
11
12
|
isEnabled?: boolean;
|
|
12
13
|
};
|
|
14
|
+
export type TranslationMemoryClientContext = {
|
|
15
|
+
reqContext?: RequestContext;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
};
|
|
13
18
|
export declare class TranslationMemoryClient {
|
|
14
19
|
private readonly maxFindMatchesRequestSize;
|
|
20
|
+
private readonly isEnabled;
|
|
15
21
|
private readonly httpClient;
|
|
16
|
-
private readonly retryConfig;
|
|
17
22
|
private readonly headers;
|
|
23
|
+
private readonly retryConfig;
|
|
18
24
|
private readonly errorReporter?;
|
|
19
|
-
private readonly isEnabled;
|
|
20
25
|
constructor(config: TranslationMemoryClientConfig);
|
|
21
|
-
findMatches(groupId: string, request: FindMatchesRequest): Promise<TranslationMemoryMatch[]>;
|
|
22
|
-
bulkFindMatches(groupId: string, { filters, options }: BulkFindMatchesRequest): Promise<BulkTranslationMemoryMatches[]>;
|
|
23
|
-
bulkFindMatchesIterative(groupId: string, { filters, options }: BulkFindMatchesRequest): AsyncGenerator<BulkTranslationMemoryMatches[]>;
|
|
24
|
-
getRecords(groupId: string, pagination?: MandatoryPaginationParams): Promise<TranslationMemoryRecordsResponse>;
|
|
25
|
-
upsertRecords(groupId: string, records: UpsertRecordDto[]): Promise<void>;
|
|
26
|
+
findMatches(groupId: string, request: FindMatchesRequest, context?: TranslationMemoryClientContext): Promise<TranslationMemoryMatch[]>;
|
|
27
|
+
bulkFindMatches(groupId: string, { filters, options }: BulkFindMatchesRequest, context?: TranslationMemoryClientContext): Promise<BulkTranslationMemoryMatches[]>;
|
|
28
|
+
bulkFindMatchesIterative(groupId: string, { filters, options }: BulkFindMatchesRequest, context?: TranslationMemoryClientContext): AsyncGenerator<BulkTranslationMemoryMatches[]>;
|
|
29
|
+
getRecords(groupId: string, pagination?: MandatoryPaginationParams, context?: TranslationMemoryClientContext): Promise<TranslationMemoryRecordsResponse>;
|
|
30
|
+
upsertRecords(groupId: string, records: UpsertRecordDto[], context?: TranslationMemoryClientContext): Promise<void>;
|
|
26
31
|
private internalBulkFindMatches;
|
|
27
32
|
private handleError;
|
|
28
33
|
}
|
|
@@ -6,12 +6,13 @@ const objectUtils_1 = require("@lokalise/node-core/dist/src/utils/objectUtils");
|
|
|
6
6
|
const TranslationMemoryClientError_1 = require("./errors/TranslationMemoryClientError");
|
|
7
7
|
class TranslationMemoryClient {
|
|
8
8
|
maxFindMatchesRequestSize = 20; // TODO: TBD
|
|
9
|
+
isEnabled;
|
|
9
10
|
httpClient;
|
|
10
|
-
retryConfig;
|
|
11
11
|
headers;
|
|
12
|
+
retryConfig;
|
|
12
13
|
errorReporter;
|
|
13
|
-
isEnabled;
|
|
14
14
|
constructor(config) {
|
|
15
|
+
this.isEnabled = config.isEnabled ?? true;
|
|
15
16
|
this.httpClient = (0, node_core_1.buildClient)(config.baseUrl);
|
|
16
17
|
this.headers = {
|
|
17
18
|
'Content-Type': 'application/json',
|
|
@@ -32,14 +33,14 @@ class TranslationMemoryClient {
|
|
|
32
33
|
...config.retryConfig,
|
|
33
34
|
};
|
|
34
35
|
this.errorReporter = config.errorReporter;
|
|
35
|
-
this.isEnabled = config.isEnabled ?? true;
|
|
36
36
|
}
|
|
37
|
-
async findMatches(groupId, request) {
|
|
37
|
+
async findMatches(groupId, request, context = {}) {
|
|
38
38
|
if (!this.isEnabled) {
|
|
39
39
|
return [];
|
|
40
40
|
}
|
|
41
41
|
try {
|
|
42
42
|
const response = await (0, node_core_1.sendGet)(this.httpClient, `/v1/groups/${groupId}/actions/find-matches`, {
|
|
43
|
+
reqContext: context.reqContext,
|
|
43
44
|
headers: this.headers,
|
|
44
45
|
retryConfig: this.retryConfig,
|
|
45
46
|
requestLabel: '(tm-sdk) Find matches',
|
|
@@ -48,26 +49,26 @@ class TranslationMemoryClient {
|
|
|
48
49
|
return response.result.body.data;
|
|
49
50
|
}
|
|
50
51
|
catch (e) {
|
|
51
|
-
throw this.handleError(e);
|
|
52
|
+
throw this.handleError(e, context);
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
|
-
async bulkFindMatches(groupId, { filters, options }) {
|
|
55
|
+
async bulkFindMatches(groupId, { filters, options }, context = {}) {
|
|
55
56
|
const response = [];
|
|
56
57
|
for (const part of (0, node_core_1.chunk)(filters, this.maxFindMatchesRequestSize)) {
|
|
57
58
|
const partialResponse = await this.internalBulkFindMatches(groupId, {
|
|
58
59
|
filters: part,
|
|
59
60
|
options,
|
|
60
|
-
});
|
|
61
|
+
}, context);
|
|
61
62
|
response.push(...partialResponse);
|
|
62
63
|
}
|
|
63
64
|
return response;
|
|
64
65
|
}
|
|
65
|
-
async *bulkFindMatchesIterative(groupId, { filters, options }) {
|
|
66
|
+
async *bulkFindMatchesIterative(groupId, { filters, options }, context = {}) {
|
|
66
67
|
for (const part of (0, node_core_1.chunk)(filters, this.maxFindMatchesRequestSize)) {
|
|
67
|
-
yield await this.internalBulkFindMatches(groupId, { filters: part, options });
|
|
68
|
+
yield await this.internalBulkFindMatches(groupId, { filters: part, options }, context);
|
|
68
69
|
}
|
|
69
70
|
}
|
|
70
|
-
async getRecords(groupId, pagination) {
|
|
71
|
+
async getRecords(groupId, pagination, context = {}) {
|
|
71
72
|
if (!this.isEnabled) {
|
|
72
73
|
return {
|
|
73
74
|
records: [],
|
|
@@ -76,6 +77,7 @@ class TranslationMemoryClient {
|
|
|
76
77
|
}
|
|
77
78
|
try {
|
|
78
79
|
const response = await (0, node_core_1.sendGet)(this.httpClient, `/v1/groups/${groupId}/records`, {
|
|
80
|
+
reqContext: context.reqContext,
|
|
79
81
|
headers: this.headers,
|
|
80
82
|
retryConfig: this.retryConfig,
|
|
81
83
|
requestLabel: '(tm-sdk) Get records',
|
|
@@ -87,41 +89,69 @@ class TranslationMemoryClient {
|
|
|
87
89
|
};
|
|
88
90
|
}
|
|
89
91
|
catch (e) {
|
|
90
|
-
throw this.handleError(e);
|
|
92
|
+
throw this.handleError(e, context);
|
|
91
93
|
}
|
|
92
94
|
}
|
|
93
|
-
async upsertRecords(groupId, records) {
|
|
95
|
+
async upsertRecords(groupId, records, context = {}) {
|
|
94
96
|
if (!this.isEnabled) {
|
|
95
97
|
return;
|
|
96
98
|
}
|
|
99
|
+
// Avoiding sending empty records
|
|
100
|
+
const recordsToInsert = records.filter((record) => record.sourceText.trim().length > 0 && record.targetText.trim().length > 0);
|
|
101
|
+
if (recordsToInsert.length === 0) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
97
104
|
try {
|
|
98
|
-
await (0, node_core_1.sendPut)(this.httpClient, `/v1/groups/${groupId}/records`,
|
|
105
|
+
await (0, node_core_1.sendPut)(this.httpClient, `/v1/groups/${groupId}/records`, recordsToInsert, {
|
|
106
|
+
reqContext: context.reqContext,
|
|
99
107
|
headers: this.headers,
|
|
100
108
|
retryConfig: this.retryConfig,
|
|
101
109
|
requestLabel: '(tm-sdk) Create or update records',
|
|
102
110
|
});
|
|
103
111
|
}
|
|
104
112
|
catch (e) {
|
|
105
|
-
throw this.handleError(e);
|
|
113
|
+
throw this.handleError(e, context);
|
|
106
114
|
}
|
|
107
115
|
}
|
|
108
|
-
async internalBulkFindMatches(groupId, request) {
|
|
116
|
+
async internalBulkFindMatches(groupId, request, context) {
|
|
117
|
+
const result = [];
|
|
109
118
|
if (!this.isEnabled) {
|
|
110
|
-
return
|
|
119
|
+
return result;
|
|
120
|
+
}
|
|
121
|
+
if (request.options?.ignoreEmptyFilters) {
|
|
122
|
+
const { emptyFilters, nonEmptyFilters } = request.filters.reduce((acc, filter) => {
|
|
123
|
+
if (filter.sourceText.trim().length === 0) {
|
|
124
|
+
acc.emptyFilters.push(filter);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
acc.nonEmptyFilters.push(filter);
|
|
128
|
+
}
|
|
129
|
+
return acc;
|
|
130
|
+
}, {
|
|
131
|
+
emptyFilters: [],
|
|
132
|
+
nonEmptyFilters: [],
|
|
133
|
+
});
|
|
134
|
+
result.push(...emptyFilters.map((filter) => ({
|
|
135
|
+
filterId: filter.filterId,
|
|
136
|
+
matches: [{ sourceText: filter.sourceText, targetText: '' }],
|
|
137
|
+
})));
|
|
138
|
+
request.filters = nonEmptyFilters;
|
|
111
139
|
}
|
|
112
140
|
try {
|
|
113
141
|
const response = await (0, node_core_1.sendPost)(this.httpClient, `/v1/groups/${groupId}/actions/bulk-find-matches`, request, {
|
|
142
|
+
reqContext: context.reqContext,
|
|
114
143
|
headers: this.headers,
|
|
115
144
|
retryConfig: this.retryConfig,
|
|
116
145
|
requestLabel: '(tm-sdk) Bulk find matches',
|
|
117
146
|
});
|
|
118
|
-
|
|
147
|
+
result.push(...response.result.body.data);
|
|
148
|
+
return result;
|
|
119
149
|
}
|
|
120
150
|
catch (e) {
|
|
121
|
-
throw this.handleError(e);
|
|
151
|
+
throw this.handleError(e, context);
|
|
122
152
|
}
|
|
123
153
|
}
|
|
124
|
-
handleError(e) {
|
|
154
|
+
handleError(e, context) {
|
|
125
155
|
let error;
|
|
126
156
|
if (e instanceof Error) {
|
|
127
157
|
error = (0, node_core_1.isResponseStatusError)(e) ? new TranslationMemoryClientError_1.TranslationMemoryClientError(e) : e;
|
|
@@ -133,7 +163,13 @@ class TranslationMemoryClient {
|
|
|
133
163
|
details: { error: JSON.stringify(e) },
|
|
134
164
|
});
|
|
135
165
|
}
|
|
136
|
-
this.errorReporter?.report({
|
|
166
|
+
this.errorReporter?.report({
|
|
167
|
+
error,
|
|
168
|
+
context: {
|
|
169
|
+
reqId: context.reqContext?.reqId,
|
|
170
|
+
...context.metadata,
|
|
171
|
+
},
|
|
172
|
+
});
|
|
137
173
|
return error;
|
|
138
174
|
}
|
|
139
175
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationMemoryClient.js","sourceRoot":"","sources":["../../src/sdk/TranslationMemoryClient.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"TranslationMemoryClient.js","sourceRoot":"","sources":["../../src/sdk/TranslationMemoryClient.ts"],"names":[],"mappings":";;;AAGA,mDAQ4B;AAC5B,gFAAqF;AAIrF,wFAAoF;AA+BpF,MAAa,uBAAuB;IACjB,yBAAyB,GAAG,EAAE,CAAA,CAAC,YAAY;IAE3C,SAAS,CAAS;IAClB,UAAU,CAAQ;IAClB,OAAO,CAAyB;IAChC,WAAW,CAAa;IAExB,aAAa,CAAgB;IAE9C,YAAY,MAAqC;QAC/C,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,IAAI,CAAA;QACzC,IAAI,CAAC,UAAU,GAAG,IAAA,uBAAW,EAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAC7C,IAAI,CAAC,OAAO,GAAG;YACb,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,MAAM,CAAC,QAAQ,EAAE;SAC3C,CAAA;QACD,IAAI,CAAC,WAAW,GAAG;YACjB,cAAc,EAAE,KAAK;YACrB,WAAW,EAAE,CAAC;YACd,2BAA2B,EAAE,GAAG;YAChC,kBAAkB,EAAE;gBAClB,GAAG,EAAE,kBAAkB;gBACvB,GAAG,EAAE,sBAAsB;gBAC3B,GAAG,EAAE,oBAAoB;gBACzB,GAAG,EAAE,wBAAwB;gBAC7B,GAAG,EAAE,sBAAsB;gBAC3B,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ACvB,KAAK,GAAG,IAAA,iCAAqB,EAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,2DAA4B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QAC5E,CAAC;aAAM,CAAC;YACN,KAAK,GAAG,IAAI,yBAAa,CAAC;gBACxB,OAAO,EAAE,eAAe;gBACxB,SAAS,EAAE,eAAe;gBAC1B,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;aACtC,CAAC,CAAA;QACJ,CAAC;QAED,IAAI,CAAC,aAAa,EAAE,MAAM,CAAC;YACzB,KAAK;YACL,OAAO,EAAE;gBACP,KAAK,EAAE,OAAO,CAAC,UAAU,EAAE,KAAK;gBAChC,GAAG,OAAO,CAAC,QAAQ;aACpB;SACF,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;CACF;AAtOD,0DAsOC"}
|
|
@@ -7,11 +7,12 @@ export type FindMatchesFilter = {
|
|
|
7
7
|
};
|
|
8
8
|
export type FindMatchesOptions = {
|
|
9
9
|
maxMatches?: number;
|
|
10
|
+
ignoreEmptyFilters?: boolean;
|
|
10
11
|
};
|
|
11
12
|
export type BulkFindMatchesFilter = FindMatchesFilter & {
|
|
12
13
|
filterId?: string;
|
|
13
14
|
};
|
|
14
|
-
export type FindMatchesRequest = FindMatchesFilter & FindMatchesOptions
|
|
15
|
+
export type FindMatchesRequest = FindMatchesFilter & Omit<FindMatchesOptions, 'ignoreEmptyFilters'>;
|
|
15
16
|
export type BulkFindMatchesRequest = {
|
|
16
17
|
filters: BulkFindMatchesFilter[];
|
|
17
18
|
options?: FindMatchesOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/tm-sdk",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Lokalise",
|
|
6
6
|
"url": "https://lokalise.com/"
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"undici-retry": "^5.0.2"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
|
+
"@lokalise/fastify-extras": "^16.6.0",
|
|
42
43
|
"@types/node": "20.11.20",
|
|
43
44
|
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
|
44
45
|
"@typescript-eslint/parser": "^7.0.2",
|