@lokalise/tm-sdk 9.1.0 → 10.0.1
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/README.md
CHANGED
|
@@ -33,9 +33,16 @@ const client = new TranslationMemoryClient({
|
|
|
33
33
|
To create new records, call `upsertRecords()` method:
|
|
34
34
|
|
|
35
35
|
```typescript
|
|
36
|
+
const requestContext = {
|
|
37
|
+
reqId: randomUUID(),
|
|
38
|
+
logger: globalLogger,
|
|
39
|
+
}
|
|
40
|
+
const ownerGroupId = {
|
|
41
|
+
ownerId: randomUUID(), // must be UUID
|
|
42
|
+
groupId: 'my-group-id'
|
|
43
|
+
}
|
|
36
44
|
const records = [
|
|
37
45
|
{
|
|
38
|
-
ownerId: '018dac6e-bff7-689a-f0ba-e84f49c5e432',
|
|
39
46
|
sourceLocale: 'en',
|
|
40
47
|
targetLocale: 'de',
|
|
41
48
|
sourcePrevContent: 'Localization meets AI',
|
|
@@ -45,12 +52,18 @@ const records = [
|
|
|
45
52
|
'Save money, speed up your market entry, and charm customers in every language.',
|
|
46
53
|
},
|
|
47
54
|
]
|
|
48
|
-
|
|
55
|
+
|
|
56
|
+
client.upsertRecords(requestContext, ownerGroupId, records)
|
|
49
57
|
```
|
|
50
58
|
|
|
51
59
|
To search for exact matching records, you can use `findMatches()` API.
|
|
52
60
|
|
|
53
61
|
```typescript
|
|
62
|
+
const requestContext = {
|
|
63
|
+
reqId: randomUUID(),
|
|
64
|
+
logger: globalLogger,
|
|
65
|
+
}
|
|
66
|
+
const ownerId = randomUUID()
|
|
54
67
|
const searchRequest = {
|
|
55
68
|
sourceText: 'Your one-stop solution for AI-powered translations and automated localization.',
|
|
56
69
|
sourceLocale: 'en',
|
|
@@ -63,7 +76,7 @@ const searchRequest = {
|
|
|
63
76
|
* targetText: 'Ihre Lösung aus einer Hand für KI-gestützte Übersetzungen.'
|
|
64
77
|
* }]
|
|
65
78
|
*/
|
|
66
|
-
const matches = client.findMatches(
|
|
79
|
+
const matches = client.findMatches(requestContext, ownerId, searchRequest)
|
|
67
80
|
```
|
|
68
81
|
|
|
69
82
|
You can also use `bulkFindMatches()` and `bulkFindMatchesIterative()` APIs to perform the same kind of lookup for
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { RequestContext } from '@lokalise/fastify-extras';
|
|
2
2
|
import { type ErrorReporter } from '@lokalise/node-core';
|
|
3
|
-
import
|
|
3
|
+
import type { TmOwnerGroupId } from '@lokalise/tm-api-schemas';
|
|
4
|
+
import { type BulkTranslationMemoryMatches, type TranslationMemoryRecord, type TranslationMemoryRecordsResponse, type UpsertTranslationMemoryRecordDto } from '@lokalise/tm-api-schemas';
|
|
4
5
|
import type { RetryConfig } from 'undici-retry';
|
|
5
|
-
import type { BulkFindMatchesRequest, FindMatchesRequest } from './types/requests.ts';
|
|
6
|
+
import type { BulkFindMatchesRequest, FindMatchesRequest, GetRecordsQuery } from './types/requests.ts';
|
|
6
7
|
export type TranslationMemoryClientConfig = {
|
|
7
8
|
baseUrl: string;
|
|
8
9
|
jwtToken: string;
|
|
@@ -11,23 +12,24 @@ export type TranslationMemoryClientConfig = {
|
|
|
11
12
|
isEnabled?: boolean;
|
|
12
13
|
};
|
|
13
14
|
export type TranslationMemoryClientContext = {
|
|
14
|
-
reqContext
|
|
15
|
+
reqContext: RequestContext;
|
|
15
16
|
metadata?: Record<string, unknown>;
|
|
16
17
|
};
|
|
17
18
|
export declare class TranslationMemoryClient {
|
|
18
19
|
private readonly maxFindMatchesRequestSize;
|
|
19
20
|
private readonly isEnabled;
|
|
21
|
+
private readonly errorReporter?;
|
|
20
22
|
private readonly httpClient;
|
|
23
|
+
private readonly pathPrefix;
|
|
21
24
|
private readonly headers;
|
|
22
25
|
private readonly retryConfig;
|
|
23
|
-
private readonly errorReporter?;
|
|
24
26
|
constructor(config: TranslationMemoryClientConfig);
|
|
25
|
-
findMatches(
|
|
26
|
-
bulkFindMatches(
|
|
27
|
-
bulkFindMatchesIterative(
|
|
28
|
-
getRecords(
|
|
29
|
-
upsertRecords(
|
|
30
|
-
deleteRecords(
|
|
27
|
+
findMatches(context: TranslationMemoryClientContext, ownerId: string, request: FindMatchesRequest): Promise<TranslationMemoryRecord[]>;
|
|
28
|
+
bulkFindMatches(context: TranslationMemoryClientContext, ownerId: string, { filters, options }: BulkFindMatchesRequest): Promise<BulkTranslationMemoryMatches[]>;
|
|
29
|
+
bulkFindMatchesIterative(context: TranslationMemoryClientContext, ownerId: string, { filters, options }: BulkFindMatchesRequest): AsyncGenerator<BulkTranslationMemoryMatches[]>;
|
|
30
|
+
getRecords(context: TranslationMemoryClientContext, ownerId: string, query?: GetRecordsQuery): Promise<TranslationMemoryRecordsResponse>;
|
|
31
|
+
upsertRecords(context: TranslationMemoryClientContext, ownerGroupId: TmOwnerGroupId, records: UpsertTranslationMemoryRecordDto[]): Promise<void>;
|
|
32
|
+
deleteRecords(context: TranslationMemoryClientContext, ownerId: string, recordIds: string[]): Promise<void>;
|
|
31
33
|
private internalBulkFindMatches;
|
|
32
34
|
private handleError;
|
|
33
35
|
}
|
|
@@ -6,13 +6,17 @@ import { TranslationMemoryClientError } from "./errors/TranslationMemoryClientEr
|
|
|
6
6
|
export class TranslationMemoryClient {
|
|
7
7
|
maxFindMatchesRequestSize = 20;
|
|
8
8
|
isEnabled;
|
|
9
|
+
errorReporter;
|
|
9
10
|
httpClient;
|
|
11
|
+
pathPrefix;
|
|
10
12
|
headers;
|
|
11
13
|
retryConfig;
|
|
12
|
-
errorReporter;
|
|
13
14
|
constructor(config) {
|
|
14
15
|
this.isEnabled = config.isEnabled ?? true;
|
|
15
|
-
|
|
16
|
+
const parsedUrl = new URL(config.baseUrl);
|
|
17
|
+
const baseUrl = parsedUrl.origin;
|
|
18
|
+
this.pathPrefix = parsedUrl.pathname;
|
|
19
|
+
this.httpClient = buildClient(baseUrl);
|
|
16
20
|
this.headers = {
|
|
17
21
|
'Content-Type': 'application/json',
|
|
18
22
|
Authorization: `Bearer ${config.jwtToken}`,
|
|
@@ -33,12 +37,13 @@ export class TranslationMemoryClient {
|
|
|
33
37
|
};
|
|
34
38
|
this.errorReporter = config.errorReporter;
|
|
35
39
|
}
|
|
36
|
-
async findMatches(
|
|
40
|
+
async findMatches(context, ownerId, request) {
|
|
37
41
|
if (!this.isEnabled)
|
|
38
42
|
return [];
|
|
39
43
|
try {
|
|
40
44
|
const response = await sendByGetRoute(this.httpClient, getTranslationMemoryMatchesContract, {
|
|
41
|
-
|
|
45
|
+
pathPrefix: this.pathPrefix,
|
|
46
|
+
pathParams: { ownerId },
|
|
42
47
|
headers: this.headers,
|
|
43
48
|
queryParams: transformToKebabCase(request),
|
|
44
49
|
}, {
|
|
@@ -54,23 +59,23 @@ export class TranslationMemoryClient {
|
|
|
54
59
|
throw this.handleError(e, context);
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
|
-
async bulkFindMatches(
|
|
62
|
+
async bulkFindMatches(context, ownerId, { filters, options }) {
|
|
58
63
|
const response = [];
|
|
59
64
|
for (const part of chunk(filters, this.maxFindMatchesRequestSize)) {
|
|
60
|
-
const partialResponse = await this.internalBulkFindMatches(
|
|
65
|
+
const partialResponse = await this.internalBulkFindMatches(context, ownerId, {
|
|
61
66
|
filters: part,
|
|
62
67
|
options,
|
|
63
|
-
}
|
|
68
|
+
});
|
|
64
69
|
response.push(...partialResponse);
|
|
65
70
|
}
|
|
66
71
|
return response;
|
|
67
72
|
}
|
|
68
|
-
async *bulkFindMatchesIterative(
|
|
73
|
+
async *bulkFindMatchesIterative(context, ownerId, { filters, options }) {
|
|
69
74
|
for (const part of chunk(filters, this.maxFindMatchesRequestSize)) {
|
|
70
|
-
yield await this.internalBulkFindMatches(
|
|
75
|
+
yield await this.internalBulkFindMatches(context, ownerId, { filters: part, options });
|
|
71
76
|
}
|
|
72
77
|
}
|
|
73
|
-
async getRecords(
|
|
78
|
+
async getRecords(context, ownerId, query) {
|
|
74
79
|
if (!this.isEnabled) {
|
|
75
80
|
return {
|
|
76
81
|
records: [],
|
|
@@ -79,8 +84,9 @@ export class TranslationMemoryClient {
|
|
|
79
84
|
}
|
|
80
85
|
try {
|
|
81
86
|
const response = await sendByGetRoute(this.httpClient, getTranslationMemoryRecordsContract, {
|
|
82
|
-
|
|
83
|
-
|
|
87
|
+
pathPrefix: this.pathPrefix,
|
|
88
|
+
pathParams: { ownerId },
|
|
89
|
+
queryParams: transformToKebabCase(query) ?? {},
|
|
84
90
|
headers: this.headers,
|
|
85
91
|
}, {
|
|
86
92
|
reqContext: context.reqContext,
|
|
@@ -95,7 +101,7 @@ export class TranslationMemoryClient {
|
|
|
95
101
|
throw this.handleError(e, context);
|
|
96
102
|
}
|
|
97
103
|
}
|
|
98
|
-
async upsertRecords(
|
|
104
|
+
async upsertRecords(context, ownerGroupId, records) {
|
|
99
105
|
if (!this.isEnabled)
|
|
100
106
|
return;
|
|
101
107
|
// Avoiding sending empty records
|
|
@@ -104,7 +110,8 @@ export class TranslationMemoryClient {
|
|
|
104
110
|
return;
|
|
105
111
|
try {
|
|
106
112
|
await sendByPayloadRoute(this.httpClient, putTranslationMemoryRecordsContract, {
|
|
107
|
-
|
|
113
|
+
pathPrefix: this.pathPrefix,
|
|
114
|
+
pathParams: ownerGroupId,
|
|
108
115
|
body: recordsToInsert,
|
|
109
116
|
headers: this.headers,
|
|
110
117
|
}, {
|
|
@@ -119,7 +126,7 @@ export class TranslationMemoryClient {
|
|
|
119
126
|
throw this.handleError(e, context);
|
|
120
127
|
}
|
|
121
128
|
}
|
|
122
|
-
async deleteRecords(
|
|
129
|
+
async deleteRecords(context, ownerId, recordIds) {
|
|
123
130
|
if (!this.isEnabled)
|
|
124
131
|
return;
|
|
125
132
|
// Avoid sending empty requests
|
|
@@ -127,7 +134,8 @@ export class TranslationMemoryClient {
|
|
|
127
134
|
return;
|
|
128
135
|
try {
|
|
129
136
|
await sendByPayloadRoute(this.httpClient, postDeleteTranslationMemoryRecordsContract, {
|
|
130
|
-
|
|
137
|
+
pathPrefix: this.pathPrefix,
|
|
138
|
+
pathParams: { ownerId },
|
|
131
139
|
body: { recordIds },
|
|
132
140
|
headers: this.headers,
|
|
133
141
|
}, {
|
|
@@ -142,7 +150,7 @@ export class TranslationMemoryClient {
|
|
|
142
150
|
throw this.handleError(e, context);
|
|
143
151
|
}
|
|
144
152
|
}
|
|
145
|
-
async internalBulkFindMatches(
|
|
153
|
+
async internalBulkFindMatches(context, ownerId, request) {
|
|
146
154
|
const result = [];
|
|
147
155
|
if (!this.isEnabled)
|
|
148
156
|
return result;
|
|
@@ -163,7 +171,8 @@ export class TranslationMemoryClient {
|
|
|
163
171
|
}
|
|
164
172
|
try {
|
|
165
173
|
const response = await sendByPayloadRoute(this.httpClient, postBulkFindMatchesContract, {
|
|
166
|
-
|
|
174
|
+
pathPrefix: this.pathPrefix,
|
|
175
|
+
pathParams: { ownerId },
|
|
167
176
|
body: request,
|
|
168
177
|
headers: this.headers,
|
|
169
178
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationMemoryClient.js","sourceRoot":"","sources":["../../src/sdk/TranslationMemoryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,kBAAkB,GACnB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAsB,aAAa,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"TranslationMemoryClient.js","sourceRoot":"","sources":["../../src/sdk/TranslationMemoryClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,kBAAkB,GACnB,MAAM,+BAA+B,CAAA;AAEtC,OAAO,EAAsB,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAEvE,OAAO,EAEL,mCAAmC,EACnC,mCAAmC,EACnC,2BAA2B,EAC3B,0CAA0C,EAC1C,mCAAmC,GAIpC,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,KAAK,EAAE,o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OAAO,CAAC,QAAQ;aACpB;SACF,CAAC,CAAA;QACF,OAAO,KAAK,CAAA;IACd,CAAC;CACF"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import type { GetTranslationMemoryRecordsQueryInput } from '@lokalise/tm-api-schemas';
|
|
1
2
|
export type FindMatchesFilter = {
|
|
3
|
+
groupId?: string;
|
|
2
4
|
sourceText: string;
|
|
3
5
|
sourceLocale: string;
|
|
4
6
|
targetLocale: string;
|
|
@@ -17,3 +19,7 @@ export type BulkFindMatchesRequest = {
|
|
|
17
19
|
filters: BulkFindMatchesFilter[];
|
|
18
20
|
options?: FindMatchesOptions;
|
|
19
21
|
};
|
|
22
|
+
export type GetRecordsQuery = Omit<GetTranslationMemoryRecordsQueryInput, 'group-id' | 'flex-search-query'> & {
|
|
23
|
+
groupId?: GetTranslationMemoryRecordsQueryInput['group-id'];
|
|
24
|
+
flexSearchQuery?: GetTranslationMemoryRecordsQueryInput['flex-search-query'];
|
|
25
|
+
};
|