@lokalise/polyglot-sdk 17.0.2 → 18.0.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/LICENSE +13 -0
- package/dist/index.d.ts +23 -23
- package/dist/index.js +21 -34
- package/dist/index.js.map +1 -1
- package/dist/sdk/PolyglotClient.d.ts +8 -8
- package/dist/sdk/PolyglotClient.js +28 -33
- package/dist/sdk/PolyglotClient.js.map +1 -1
- package/dist/sdk/errors/PolyglotError.js +2 -6
- package/dist/sdk/errors/PolyglotError.js.map +1 -1
- package/dist/sdk/helpers/htmlEscaping.d.ts +1 -1
- package/dist/sdk/helpers/htmlEscaping.js +12 -17
- package/dist/sdk/helpers/htmlEscaping.js.map +1 -1
- package/dist/sdk/helpers/isEnumValue.js +1 -5
- package/dist/sdk/helpers/isEnumValue.js.map +1 -1
- package/dist/sdk/helpers/nonTranslatableContentHelper.d.ts +1 -1
- package/dist/sdk/helpers/nonTranslatableContentHelper.js +10 -16
- package/dist/sdk/helpers/nonTranslatableContentHelper.js.map +1 -1
- package/dist/sdk/helpers/nonTranslatableContentWrappers.d.ts +10 -3
- package/dist/sdk/helpers/nonTranslatableContentWrappers.js +17 -15
- package/dist/sdk/helpers/nonTranslatableContentWrappers.js.map +1 -1
- package/dist/sdk/schemas/common/asyncRequestSchemas.d.ts +1 -1
- package/dist/sdk/schemas/common/asyncRequestSchemas.js +12 -16
- package/dist/sdk/schemas/common/asyncRequestSchemas.js.map +1 -1
- package/dist/sdk/schemas/common/commonSchemas.d.ts +1 -1
- package/dist/sdk/schemas/common/commonSchemas.js +48 -52
- package/dist/sdk/schemas/common/commonSchemas.js.map +1 -1
- package/dist/sdk/schemas/common/errorSchemas.d.ts +1 -1
- package/dist/sdk/schemas/common/errorSchemas.js +13 -17
- package/dist/sdk/schemas/common/errorSchemas.js.map +1 -1
- package/dist/sdk/schemas/common/translationContextSchemas.js +33 -38
- package/dist/sdk/schemas/common/translationContextSchemas.js.map +1 -1
- package/dist/sdk/schemas/lqa/commonSchemas.d.ts +1 -1
- package/dist/sdk/schemas/lqa/commonSchemas.js +1 -4
- package/dist/sdk/schemas/lqa/commonSchemas.js.map +1 -1
- package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js +46 -50
- package/dist/sdk/schemas/lqa/lqaAsyncSchemas.js.map +1 -1
- package/dist/sdk/schemas/lqa/lqaSyncSchemas.js +38 -42
- package/dist/sdk/schemas/lqa/lqaSyncSchemas.js.map +1 -1
- package/dist/sdk/schemas/scoring/scoreSchemas.js +24 -27
- package/dist/sdk/schemas/scoring/scoreSchemas.js.map +1 -1
- package/dist/sdk/schemas/translation/generateVariants.js +23 -27
- package/dist/sdk/schemas/translation/generateVariants.js.map +1 -1
- package/dist/sdk/schemas/translation/rewriteTextSchemas.d.ts +1 -1
- package/dist/sdk/schemas/translation/rewriteTextSchemas.js +51 -55
- package/dist/sdk/schemas/translation/rewriteTextSchemas.js.map +1 -1
- package/dist/sdk/schemas/translation/sharedSchemas.d.ts +2 -2
- package/dist/sdk/schemas/translation/sharedSchemas.js +54 -58
- package/dist/sdk/schemas/translation/sharedSchemas.js.map +1 -1
- package/dist/sdk/schemas/translation/translateAsyncSchemas.js +49 -53
- package/dist/sdk/schemas/translation/translateAsyncSchemas.js.map +1 -1
- package/dist/sdk/schemas/translation/translateSyncSchemas.js +32 -36
- package/dist/sdk/schemas/translation/translateSyncSchemas.js.map +1 -1
- package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js +26 -30
- package/dist/sdk/schemas/translation/translateTextSegmentSchemas.js.map +1 -1
- package/dist/sdk/types/client.js +1 -2
- package/dist/sdk/types/common.js +1 -2
- package/dist/sdk/validation/isSegmentUnderLengthLimit.d.ts +1 -1
- package/dist/sdk/validation/isSegmentUnderLengthLimit.js +7 -11
- package/dist/sdk/validation/isSegmentUnderLengthLimit.js.map +1 -1
- package/dist/sdk/validation/requestSizeLimit.d.ts +2 -2
- package/dist/sdk/validation/requestSizeLimit.js +10 -16
- package/dist/sdk/validation/requestSizeLimit.js.map +1 -1
- package/package.json +8 -7
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type IntegrationEngineEnum } from '../schemas/common/commonSchemas';
|
|
2
|
-
import type { ContentUnitLike } from '../schemas/translation/sharedSchemas';
|
|
1
|
+
import { type IntegrationEngineEnum } from '../schemas/common/commonSchemas.js';
|
|
2
|
+
import type { ContentUnitLike } from '../schemas/translation/sharedSchemas.js';
|
|
3
3
|
/**
|
|
4
4
|
* Checks if every segment in the content unit is under the size limit.
|
|
5
5
|
*/
|
|
@@ -1,30 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.getRequestSizeLimit = exports.isRequestSizeUnderLimit = exports.isContentUnitSizeUnderLimit = void 0;
|
|
4
|
-
const commonSchemas_1 = require("../schemas/common/commonSchemas");
|
|
5
|
-
const isSegmentUnderLengthLimit_1 = require("./isSegmentUnderLengthLimit");
|
|
1
|
+
import { REQUEST_SIZE_LIMIT_MAP, SEGMENT_VALUE_MAX_LENGTH_DEFAULT, } from '../schemas/common/commonSchemas.js';
|
|
2
|
+
import { isSegmentUnderLengthLimit } from './isSegmentUnderLengthLimit.js';
|
|
6
3
|
/**
|
|
7
4
|
* Checks if every segment in the content unit is under the size limit.
|
|
8
5
|
*/
|
|
9
|
-
const isContentUnitSizeUnderLimit = (segments, forcedIntegration) => {
|
|
10
|
-
return segments.every(({ value }) =>
|
|
6
|
+
export const isContentUnitSizeUnderLimit = (segments, forcedIntegration) => {
|
|
7
|
+
return segments.every(({ value }) => isSegmentUnderLengthLimit(value, forcedIntegration));
|
|
11
8
|
};
|
|
12
|
-
exports.isContentUnitSizeUnderLimit = isContentUnitSizeUnderLimit;
|
|
13
9
|
/**
|
|
14
10
|
* Checks if every content unit in the request is under the size limit.
|
|
15
11
|
*/
|
|
16
|
-
const isRequestSizeUnderLimit = (contentUnits, forcedIntegration) => {
|
|
17
|
-
return contentUnits.every((contentUnit) =>
|
|
12
|
+
export const isRequestSizeUnderLimit = (contentUnits, forcedIntegration) => {
|
|
13
|
+
return contentUnits.every((contentUnit) => isContentUnitSizeUnderLimit(contentUnit.segments, forcedIntegration));
|
|
18
14
|
};
|
|
19
|
-
exports.isRequestSizeUnderLimit = isRequestSizeUnderLimit;
|
|
20
15
|
/**
|
|
21
16
|
* Returns the request size limit based on the integration.
|
|
22
17
|
*/
|
|
23
|
-
const getRequestSizeLimit = (integration) => {
|
|
24
|
-
if (integration && Object.hasOwn(
|
|
25
|
-
return
|
|
18
|
+
export const getRequestSizeLimit = (integration) => {
|
|
19
|
+
if (integration && Object.hasOwn(REQUEST_SIZE_LIMIT_MAP, integration)) {
|
|
20
|
+
return REQUEST_SIZE_LIMIT_MAP[integration];
|
|
26
21
|
}
|
|
27
|
-
return
|
|
22
|
+
return SEGMENT_VALUE_MAX_LENGTH_DEFAULT;
|
|
28
23
|
};
|
|
29
|
-
exports.getRequestSizeLimit = getRequestSizeLimit;
|
|
30
24
|
//# sourceMappingURL=requestSizeLimit.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestSizeLimit.js","sourceRoot":"","sources":["../../../src/sdk/validation/requestSizeLimit.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"requestSizeLimit.js","sourceRoot":"","sources":["../../../src/sdk/validation/requestSizeLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,sBAAsB,EACtB,gCAAgC,GACjC,MAAM,oCAAoC,CAAA;AAE3C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAE1E;;GAEG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,QAAqC,EACrC,iBAAyC,EAChC,EAAE;IACX,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,yBAAyB,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAA;AAC3F,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,YAA+B,EAC/B,iBAAyC,EAChC,EAAE;IACX,OAAO,YAAY,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,EAAE,CACxC,2BAA2B,CAAC,WAAW,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CACrE,CAAA;AACH,CAAC,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,WAAmC,EAAU,EAAE;IACjF,IAAI,WAAW,IAAI,MAAM,CAAC,MAAM,CAAC,sBAAsB,EAAE,WAAW,CAAC,EAAE,CAAC;QACtE,OAAO,sBAAsB,CAAC,WAAW,CAAC,CAAA;IAC5C,CAAC;IAED,OAAO,gCAAgC,CAAA;AACzC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/polyglot-sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "18.0.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Lokalise",
|
|
6
6
|
"url": "https://lokalise.com/"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"node": ">=18"
|
|
16
16
|
},
|
|
17
17
|
"files": ["dist"],
|
|
18
|
-
"type": "
|
|
18
|
+
"type": "module",
|
|
19
19
|
"main": "dist/index.js",
|
|
20
20
|
"exports": {
|
|
21
21
|
".": "./dist/index.js",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"access": "public"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "
|
|
30
|
-
"lint": "biome check . && tsc
|
|
29
|
+
"build": "rimraf dist && tsc -p tsconfig.build.json",
|
|
30
|
+
"lint": "biome check . && tsc",
|
|
31
31
|
"lint:fix": "biome check --write",
|
|
32
32
|
"test": "vitest",
|
|
33
33
|
"test:coverage": "npm test -- --coverage",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@lokalise/backend-http-client": "^3.0.0",
|
|
40
40
|
"@lokalise/id-utils": "^2.2.0",
|
|
41
41
|
"@lokalise/node-core": "^13.4.0",
|
|
42
|
-
"@lokalise/non-translatable-markup": "^
|
|
42
|
+
"@lokalise/non-translatable-markup": "^3.0.0",
|
|
43
43
|
"@lokalise/supported-languages": "^2.1.0",
|
|
44
44
|
"@lokalise/zod-extras": "^2.1.0",
|
|
45
45
|
"html-escaper": "^3.0.3",
|
|
@@ -55,13 +55,14 @@
|
|
|
55
55
|
"@biomejs/biome": "^1.9.4",
|
|
56
56
|
"@lokalise/biome-config": "^1.5.0",
|
|
57
57
|
"@lokalise/fastify-extras": "^26.0.0",
|
|
58
|
+
"@types/html-escaper": "^3.0.4",
|
|
58
59
|
"@types/node": "^22.13.8",
|
|
59
60
|
"@vitest/coverage-v8": "^3.0.7",
|
|
60
61
|
"auto-changelog": "^2.5.0",
|
|
61
62
|
"mockttp": "^3.16.0",
|
|
62
|
-
"
|
|
63
|
+
"rimraf": "^6.0.1",
|
|
63
64
|
"ts-deepmerge": "^7.0.1",
|
|
64
|
-
"typescript": "5.
|
|
65
|
+
"typescript": "5.8.2",
|
|
65
66
|
"vitest": "^3.0.4"
|
|
66
67
|
}
|
|
67
68
|
}
|