@lokalise/tm-sdk 2.1.0 → 2.3.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
|
}
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TranslationMemoryClient = void 0;
|
|
4
|
+
const backend_http_client_1 = require("@lokalise/backend-http-client");
|
|
4
5
|
const node_core_1 = require("@lokalise/node-core");
|
|
5
6
|
const objectUtils_1 = require("@lokalise/node-core/dist/src/utils/objectUtils");
|
|
7
|
+
const zod_1 = require("zod");
|
|
6
8
|
const TranslationMemoryClientError_1 = require("./errors/TranslationMemoryClientError");
|
|
9
|
+
const ANY_SCHEMA = zod_1.z.any();
|
|
7
10
|
class TranslationMemoryClient {
|
|
8
11
|
maxFindMatchesRequestSize = 20; // TODO: TBD
|
|
12
|
+
isEnabled;
|
|
9
13
|
httpClient;
|
|
10
|
-
retryConfig;
|
|
11
14
|
headers;
|
|
15
|
+
retryConfig;
|
|
12
16
|
errorReporter;
|
|
13
|
-
isEnabled;
|
|
14
17
|
constructor(config) {
|
|
15
|
-
this.
|
|
18
|
+
this.isEnabled = config.isEnabled ?? true;
|
|
19
|
+
this.httpClient = (0, backend_http_client_1.buildClient)(config.baseUrl);
|
|
16
20
|
this.headers = {
|
|
17
21
|
'Content-Type': 'application/json',
|
|
18
22
|
Authorization: `Bearer ${config.jwtToken}`,
|
|
@@ -32,15 +36,17 @@ class TranslationMemoryClient {
|
|
|
32
36
|
...config.retryConfig,
|
|
33
37
|
};
|
|
34
38
|
this.errorReporter = config.errorReporter;
|
|
35
|
-
this.isEnabled = config.isEnabled ?? true;
|
|
36
39
|
}
|
|
37
|
-
async findMatches(groupId, request) {
|
|
40
|
+
async findMatches(groupId, request, context = {}) {
|
|
38
41
|
if (!this.isEnabled) {
|
|
39
42
|
return [];
|
|
40
43
|
}
|
|
41
44
|
try {
|
|
42
|
-
const response = await (0,
|
|
45
|
+
const response = await (0, backend_http_client_1.sendGet)(this.httpClient, `/v1/groups/${groupId}/actions/find-matches`, {
|
|
46
|
+
reqContext: context.reqContext,
|
|
43
47
|
headers: this.headers,
|
|
48
|
+
responseSchema: ANY_SCHEMA,
|
|
49
|
+
validateResponse: false,
|
|
44
50
|
retryConfig: this.retryConfig,
|
|
45
51
|
requestLabel: '(tm-sdk) Find matches',
|
|
46
52
|
query: (0, objectUtils_1.transformToKebabCase)(request),
|
|
@@ -48,26 +54,26 @@ class TranslationMemoryClient {
|
|
|
48
54
|
return response.result.body.data;
|
|
49
55
|
}
|
|
50
56
|
catch (e) {
|
|
51
|
-
throw this.handleError(e);
|
|
57
|
+
throw this.handleError(e, context);
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
|
-
async bulkFindMatches(groupId, { filters, options }) {
|
|
60
|
+
async bulkFindMatches(groupId, { filters, options }, context = {}) {
|
|
55
61
|
const response = [];
|
|
56
62
|
for (const part of (0, node_core_1.chunk)(filters, this.maxFindMatchesRequestSize)) {
|
|
57
63
|
const partialResponse = await this.internalBulkFindMatches(groupId, {
|
|
58
64
|
filters: part,
|
|
59
65
|
options,
|
|
60
|
-
});
|
|
66
|
+
}, context);
|
|
61
67
|
response.push(...partialResponse);
|
|
62
68
|
}
|
|
63
69
|
return response;
|
|
64
70
|
}
|
|
65
|
-
async *bulkFindMatchesIterative(groupId, { filters, options }) {
|
|
71
|
+
async *bulkFindMatchesIterative(groupId, { filters, options }, context = {}) {
|
|
66
72
|
for (const part of (0, node_core_1.chunk)(filters, this.maxFindMatchesRequestSize)) {
|
|
67
|
-
yield await this.internalBulkFindMatches(groupId, { filters: part, options });
|
|
73
|
+
yield await this.internalBulkFindMatches(groupId, { filters: part, options }, context);
|
|
68
74
|
}
|
|
69
75
|
}
|
|
70
|
-
async getRecords(groupId, pagination) {
|
|
76
|
+
async getRecords(groupId, pagination, context = {}) {
|
|
71
77
|
if (!this.isEnabled) {
|
|
72
78
|
return {
|
|
73
79
|
records: [],
|
|
@@ -75,8 +81,11 @@ class TranslationMemoryClient {
|
|
|
75
81
|
};
|
|
76
82
|
}
|
|
77
83
|
try {
|
|
78
|
-
const response = await (0,
|
|
84
|
+
const response = await (0, backend_http_client_1.sendGet)(this.httpClient, `/v1/groups/${groupId}/records`, {
|
|
85
|
+
reqContext: context.reqContext,
|
|
79
86
|
headers: this.headers,
|
|
87
|
+
validateResponse: false,
|
|
88
|
+
responseSchema: ANY_SCHEMA,
|
|
80
89
|
retryConfig: this.retryConfig,
|
|
81
90
|
requestLabel: '(tm-sdk) Get records',
|
|
82
91
|
query: pagination,
|
|
@@ -87,10 +96,10 @@ class TranslationMemoryClient {
|
|
|
87
96
|
};
|
|
88
97
|
}
|
|
89
98
|
catch (e) {
|
|
90
|
-
throw this.handleError(e);
|
|
99
|
+
throw this.handleError(e, context);
|
|
91
100
|
}
|
|
92
101
|
}
|
|
93
|
-
async upsertRecords(groupId, records) {
|
|
102
|
+
async upsertRecords(groupId, records, context = {}) {
|
|
94
103
|
if (!this.isEnabled) {
|
|
95
104
|
return;
|
|
96
105
|
}
|
|
@@ -100,17 +109,20 @@ class TranslationMemoryClient {
|
|
|
100
109
|
return;
|
|
101
110
|
}
|
|
102
111
|
try {
|
|
103
|
-
await (0,
|
|
112
|
+
await (0, backend_http_client_1.sendPut)(this.httpClient, `/v1/groups/${groupId}/records`, recordsToInsert, {
|
|
113
|
+
reqContext: context.reqContext,
|
|
104
114
|
headers: this.headers,
|
|
115
|
+
responseSchema: ANY_SCHEMA,
|
|
116
|
+
validateResponse: false,
|
|
105
117
|
retryConfig: this.retryConfig,
|
|
106
118
|
requestLabel: '(tm-sdk) Create or update records',
|
|
107
119
|
});
|
|
108
120
|
}
|
|
109
121
|
catch (e) {
|
|
110
|
-
throw this.handleError(e);
|
|
122
|
+
throw this.handleError(e, context);
|
|
111
123
|
}
|
|
112
124
|
}
|
|
113
|
-
async internalBulkFindMatches(groupId, request) {
|
|
125
|
+
async internalBulkFindMatches(groupId, request, context) {
|
|
114
126
|
const result = [];
|
|
115
127
|
if (!this.isEnabled) {
|
|
116
128
|
return result;
|
|
@@ -135,8 +147,11 @@ class TranslationMemoryClient {
|
|
|
135
147
|
request.filters = nonEmptyFilters;
|
|
136
148
|
}
|
|
137
149
|
try {
|
|
138
|
-
const response = await (0,
|
|
150
|
+
const response = await (0, backend_http_client_1.sendPost)(this.httpClient, `/v1/groups/${groupId}/actions/bulk-find-matches`, request, {
|
|
151
|
+
reqContext: context.reqContext,
|
|
139
152
|
headers: this.headers,
|
|
153
|
+
responseSchema: ANY_SCHEMA,
|
|
154
|
+
validateResponse: false,
|
|
140
155
|
retryConfig: this.retryConfig,
|
|
141
156
|
requestLabel: '(tm-sdk) Bulk find matches',
|
|
142
157
|
});
|
|
@@ -144,13 +159,13 @@ class TranslationMemoryClient {
|
|
|
144
159
|
return result;
|
|
145
160
|
}
|
|
146
161
|
catch (e) {
|
|
147
|
-
throw this.handleError(e);
|
|
162
|
+
throw this.handleError(e, context);
|
|
148
163
|
}
|
|
149
164
|
}
|
|
150
|
-
handleError(e) {
|
|
165
|
+
handleError(e, context) {
|
|
151
166
|
let error;
|
|
152
167
|
if (e instanceof Error) {
|
|
153
|
-
error = (0,
|
|
168
|
+
error = (0, backend_http_client_1.isResponseStatusError)(e) ? new TranslationMemoryClientError_1.TranslationMemoryClientError(e) : e;
|
|
154
169
|
}
|
|
155
170
|
else {
|
|
156
171
|
error = new node_core_1.InternalError({
|
|
@@ -159,7 +174,13 @@ class TranslationMemoryClient {
|
|
|
159
174
|
details: { error: JSON.stringify(e) },
|
|
160
175
|
});
|
|
161
176
|
}
|
|
162
|
-
this.errorReporter?.report({
|
|
177
|
+
this.errorReporter?.report({
|
|
178
|
+
error,
|
|
179
|
+
context: {
|
|
180
|
+
reqId: context.reqContext?.reqId,
|
|
181
|
+
...context.metadata,
|
|
182
|
+
},
|
|
183
|
+
});
|
|
163
184
|
return error;
|
|
164
185
|
}
|
|
165
186
|
}
|
|
@@ -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":";;;AACA,uEAMsC;AAGtC,mDAA0D;AAC1D,gFAAqF;AAGrF,6BAAuB;AAEvB,wFAAoF;AA+BpF,MAAM,UAAU,GAAG,OAAC,CAAC,GAAG,EAAE,CAAA;AAE1B,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,iCAAW,EAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAC7C,IAAI,CAAC,OAAO,GAAG;YACb,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,MAAM,CAAC,QAAQ,EAAE;SAC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AC,OAAO;gBACrB,cAAc,EAAE,UAAU;gBAC1B,gBAAgB,EAAE,KAAK;gBACvB,WAAW,EAAE,IAAI,CAAC,WAAW;gBAC7B,YAAY,EAAE,4BAA4B;aAC3C,CACF,CAAA;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;YACzC,OAAO,MAAM,CAAA;QACf,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,CAAA;QACpC,CAAC;IACH,CAAC;IAEO,WAAW,CAAC,CAAU,EAAE,OAAuC;QACrE,IAAI,KAAwB,CAAA;QAC5B,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;YACvB,KAAK,GAAG,IAAA,2CAAqB,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;AA9OD,0DA8OC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ResponseStatusError } from '@lokalise/
|
|
1
|
+
import type { ResponseStatusError } from '@lokalise/backend-http-client';
|
|
2
2
|
import { InternalError } from '@lokalise/node-core';
|
|
3
3
|
export declare class TranslationMemoryClientError extends InternalError {
|
|
4
4
|
constructor(error: ResponseStatusError);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/tm-sdk",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Lokalise",
|
|
6
6
|
"url": "https://lokalise.com/"
|
|
@@ -32,24 +32,30 @@
|
|
|
32
32
|
"prepublishOnly": "npm run build:publish"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@lokalise/api-common": "^3.
|
|
36
|
-
"@lokalise/
|
|
37
|
-
"@lokalise/
|
|
38
|
-
"
|
|
39
|
-
"undici
|
|
35
|
+
"@lokalise/api-common": "^3.2.5",
|
|
36
|
+
"@lokalise/backend-http-client": "^2.1.0",
|
|
37
|
+
"@lokalise/id-utils": "^2.0.0",
|
|
38
|
+
"@lokalise/node-core": "^12.0.0",
|
|
39
|
+
"undici": "^6.19.8",
|
|
40
|
+
"undici-retry": "^5.0.3"
|
|
41
|
+
},
|
|
42
|
+
"peerDependencies": {
|
|
43
|
+
"zod": "^3.23.8"
|
|
40
44
|
},
|
|
41
45
|
"devDependencies": {
|
|
42
|
-
"@
|
|
43
|
-
"@
|
|
44
|
-
"@typescript-eslint/
|
|
45
|
-
"@
|
|
46
|
+
"@lokalise/fastify-extras": "^18.0.0",
|
|
47
|
+
"@types/node": "20.12.2",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
49
|
+
"@typescript-eslint/parser": "^7.4.0",
|
|
50
|
+
"@vitest/coverage-v8": "^1.4.0",
|
|
46
51
|
"eslint": "^8.57.0",
|
|
47
52
|
"eslint-plugin-import": "^2.29.1",
|
|
48
|
-
"eslint-plugin-vitest": "^0.
|
|
49
|
-
"mockttp": "^3.
|
|
53
|
+
"eslint-plugin-vitest": "^0.4.1",
|
|
54
|
+
"mockttp": "^3.11.0",
|
|
50
55
|
"prettier": "^3.2.4",
|
|
51
56
|
"shx": "^0.3.4",
|
|
52
|
-
"typescript": "5.
|
|
53
|
-
"vitest": "^1.2.2"
|
|
57
|
+
"typescript": "5.4.3",
|
|
58
|
+
"vitest": "^1.2.2",
|
|
59
|
+
"zod": "^3.23.8"
|
|
54
60
|
}
|
|
55
61
|
}
|