@lokalise/tm-api-schemas 1.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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # API schemas for Translation Memory service
2
+
3
+ This package contains types, schemas and API contracts that are used in Translation Memory service and SDK
@@ -0,0 +1,5 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const GROUP_REQUEST_PARAMS_SCHEMA: z.ZodObject<{
3
+ groupId: z.ZodString;
4
+ }, z.core.$strip>;
5
+ export type GroupRequestParams = z.infer<typeof GROUP_REQUEST_PARAMS_SCHEMA>;
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod/v4';
2
+ import { GROUP_ID_SCHEMA } from "../objects.js";
3
+ export const GROUP_REQUEST_PARAMS_SCHEMA = z.object({
4
+ /*
5
+ TODO: decide how to make sure that groupId is unique
6
+ Note: reflect the change on TRANSLATION_MEMORY_RECORD_SCHEMA too
7
+ */
8
+ groupId: GROUP_ID_SCHEMA,
9
+ });
10
+ //# sourceMappingURL=common.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/api-schemas/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/C,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD;;;OAGG;IACH,OAAO,EAAE,eAAe;CACzB,CAAC,CAAA"}
@@ -0,0 +1,76 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const GET_FIND_MATCHES_REQUEST_QUERY_SCHEMA: z.ZodObject<{
3
+ 'source-text': z.ZodString;
4
+ 'source-locale': z.ZodString;
5
+ 'target-locale': z.ZodString;
6
+ 'prev-content': z.ZodOptional<z.ZodString>;
7
+ 'next-content': z.ZodOptional<z.ZodString>;
8
+ 'max-matches': z.ZodDefault<z.ZodCoercedNumber<unknown>>;
9
+ }, z.core.$strip>;
10
+ export type GetFindMatchesRequestQuery = z.infer<typeof GET_FIND_MATCHES_REQUEST_QUERY_SCHEMA>;
11
+ export declare const GET_FIND_MATCHES_RESPONSE_SCHEMA: z.ZodObject<{
12
+ data: z.ZodArray<z.ZodObject<{
13
+ id: z.ZodString;
14
+ groupId: z.ZodString;
15
+ ownerId: z.ZodGUID;
16
+ sourceLocale: z.ZodString;
17
+ targetLocale: z.ZodString;
18
+ sourceText: z.ZodString;
19
+ targetText: z.ZodString;
20
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
21
+ sourceNextContent: z.ZodOptional<z.ZodString>;
22
+ createdAt: z.ZodISODateTime;
23
+ updatedAt: z.ZodISODateTime;
24
+ }, z.core.$strip>>;
25
+ }, z.core.$strip>;
26
+ export type GetFindMatchesResponse = z.infer<typeof GET_FIND_MATCHES_RESPONSE_SCHEMA>;
27
+ export declare const POST_BULK_FIND_MATCHES_REQUEST_BODY_SCHEMA: z.ZodObject<{
28
+ filters: z.ZodArray<z.ZodObject<{
29
+ filterId: z.ZodOptional<z.ZodString>;
30
+ sourceText: z.ZodString;
31
+ sourceLocale: z.ZodString;
32
+ targetLocale: z.ZodString;
33
+ prevContent: z.ZodOptional<z.ZodString>;
34
+ nextContent: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>>;
36
+ options: z.ZodOptional<z.ZodObject<{
37
+ maxMatches: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
38
+ }, z.core.$strip>>;
39
+ }, z.core.$strip>;
40
+ export type PostBulkFindMatchesRequestBody = z.infer<typeof POST_BULK_FIND_MATCHES_REQUEST_BODY_SCHEMA>;
41
+ export declare const BULK_TRANSLATION_MEMORY_MATCHES_SCHEMA: z.ZodObject<{
42
+ filterId: z.ZodOptional<z.ZodString>;
43
+ matches: z.ZodArray<z.ZodObject<{
44
+ id: z.ZodString;
45
+ groupId: z.ZodString;
46
+ ownerId: z.ZodGUID;
47
+ sourceLocale: z.ZodString;
48
+ targetLocale: z.ZodString;
49
+ sourceText: z.ZodString;
50
+ targetText: z.ZodString;
51
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
52
+ sourceNextContent: z.ZodOptional<z.ZodString>;
53
+ createdAt: z.ZodISODateTime;
54
+ updatedAt: z.ZodISODateTime;
55
+ }, z.core.$strip>>;
56
+ }, z.core.$strip>;
57
+ export type BulkTranslationMemoryMatches = z.infer<typeof BULK_TRANSLATION_MEMORY_MATCHES_SCHEMA>;
58
+ export declare const POST_BULK_FIND_MATCHES_RESPONSE_SCHEMA: z.ZodObject<{
59
+ data: z.ZodArray<z.ZodObject<{
60
+ filterId: z.ZodOptional<z.ZodString>;
61
+ matches: z.ZodArray<z.ZodObject<{
62
+ id: z.ZodString;
63
+ groupId: z.ZodString;
64
+ ownerId: z.ZodGUID;
65
+ sourceLocale: z.ZodString;
66
+ targetLocale: z.ZodString;
67
+ sourceText: z.ZodString;
68
+ targetText: z.ZodString;
69
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
70
+ sourceNextContent: z.ZodOptional<z.ZodString>;
71
+ createdAt: z.ZodISODateTime;
72
+ updatedAt: z.ZodISODateTime;
73
+ }, z.core.$strip>>;
74
+ }, z.core.$strip>>;
75
+ }, z.core.$strip>;
76
+ export type PostBulkFindMatchesResponse = z.infer<typeof POST_BULK_FIND_MATCHES_RESPONSE_SCHEMA>;
@@ -0,0 +1,43 @@
1
+ import { z } from 'zod/v4';
2
+ import { LOCALE_SCHEMA, TRANSLATION_MEMORY_FILTER_SCHEMA, TRANSLATION_MEMORY_LOOKUP_OPTIONS_SCHEMA, TRANSLATION_MEMORY_RECORD_SCHEMA, } from "../objects.js";
3
+ export const GET_FIND_MATCHES_REQUEST_QUERY_SCHEMA = z.object({
4
+ 'source-text': z.string().min(1).describe('Seeked translation in source language'),
5
+ 'source-locale': LOCALE_SCHEMA.describe('Source language tag (locale), e.g. "de" or "en-CA"'),
6
+ 'target-locale': LOCALE_SCHEMA.describe('Target translation language tag (locale), e.g. "de" or "en-CA"'),
7
+ 'prev-content': z
8
+ .string()
9
+ .optional()
10
+ .describe('Text that appears right before the seeked translation, used for in-context match'),
11
+ 'next-content': z
12
+ .string()
13
+ .optional()
14
+ .describe('Text that appears right after the seeked translation, used for in-context match'),
15
+ 'max-matches': z.coerce
16
+ .number()
17
+ .gt(0)
18
+ .max(10)
19
+ .default(1)
20
+ .describe('Maximum amount of matches to return (1 by default)'),
21
+ });
22
+ export const GET_FIND_MATCHES_RESPONSE_SCHEMA = z.object({
23
+ data: z
24
+ .array(TRANSLATION_MEMORY_RECORD_SCHEMA)
25
+ .describe('Found matches sorted from the most relevant to least relevant'),
26
+ });
27
+ export const POST_BULK_FIND_MATCHES_REQUEST_BODY_SCHEMA = z.object({
28
+ filters: z
29
+ .array(TRANSLATION_MEMORY_FILTER_SCHEMA)
30
+ .min(1)
31
+ .describe('List of separate filtering conditions, each will return a separate list of matches'),
32
+ options: TRANSLATION_MEMORY_LOOKUP_OPTIONS_SCHEMA.optional().describe('Lookup options applied to every search'),
33
+ });
34
+ export const BULK_TRANSLATION_MEMORY_MATCHES_SCHEMA = z.object({
35
+ filterId: z.string().min(1).optional().describe('Individual results ID'),
36
+ matches: z
37
+ .array(TRANSLATION_MEMORY_RECORD_SCHEMA)
38
+ .describe('Array of translation memory records'),
39
+ });
40
+ export const POST_BULK_FIND_MATCHES_RESPONSE_SCHEMA = z.object({
41
+ data: z.array(BULK_TRANSLATION_MEMORY_MATCHES_SCHEMA),
42
+ });
43
+ //# sourceMappingURL=find-matches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-matches.js","sourceRoot":"","sources":["../../src/api-schemas/find-matches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EACL,aAAa,EACb,gCAAgC,EAChC,wCAAwC,EACxC,gCAAgC,GACjC,MAAM,eAAe,CAAA;AAEtB,MAAM,CAAC,MAA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QAAQ,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACxE,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,gCAAgC,CAAC;SACvC,QAAQ,CAAC,qCAAqC,CAAC;CACnD,CAAC,CAAA;AAGF,MAAM,CAAC,MAAM,sCAAsC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,sCAAsC,CAAC;CACtD,CAAC,CAAA"}
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const GET_TRANSLATION_MEMORY_RECORDS_REQUEST_QUERY_SCHEMA: z.ZodObject<{
3
+ before: z.ZodOptional<z.ZodString>;
4
+ after: z.ZodOptional<z.ZodString>;
5
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
6
+ }, z.core.$strip>;
7
+ export type GetTranslationMemoryRecordsRequestQuery = z.infer<typeof GET_TRANSLATION_MEMORY_RECORDS_REQUEST_QUERY_SCHEMA>;
8
+ export declare const GET_TRANSLATION_MEMORY_RECORDS_RESPONSE_SCHEMA: z.ZodObject<{
9
+ data: z.ZodArray<z.ZodObject<{
10
+ id: z.ZodString;
11
+ groupId: z.ZodString;
12
+ ownerId: z.ZodGUID;
13
+ sourceLocale: z.ZodString;
14
+ targetLocale: z.ZodString;
15
+ sourceText: z.ZodString;
16
+ targetText: z.ZodString;
17
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
18
+ sourceNextContent: z.ZodOptional<z.ZodString>;
19
+ createdAt: z.ZodISODateTime;
20
+ updatedAt: z.ZodISODateTime;
21
+ }, z.core.$strip>>;
22
+ meta: z.ZodObject<{
23
+ count: z.ZodNumber;
24
+ cursor: z.ZodOptional<z.ZodString>;
25
+ hasMore: z.ZodOptional<z.ZodBoolean>;
26
+ }, z.core.$strip>;
27
+ }, z.core.$strip>;
28
+ export type GetTranslationMemoryRecordsResponse = z.infer<typeof GET_TRANSLATION_MEMORY_RECORDS_RESPONSE_SCHEMA>;
@@ -0,0 +1,17 @@
1
+ import { MANDATORY_PAGINATION_CONFIG_SCHEMA, zMeta } from '@lokalise/api-common';
2
+ import { z } from 'zod/v4';
3
+ import { TRANSLATION_MEMORY_RECORD_SCHEMA } from "../objects.js";
4
+ const MaxRecordsLimit = 500;
5
+ export const GET_TRANSLATION_MEMORY_RECORDS_REQUEST_QUERY_SCHEMA = MANDATORY_PAGINATION_CONFIG_SCHEMA.extend({
6
+ limit: z.coerce
7
+ .number()
8
+ .min(1)
9
+ .max(MaxRecordsLimit)
10
+ .default(MaxRecordsLimit)
11
+ .describe('Amount of records to be returned'),
12
+ });
13
+ export const GET_TRANSLATION_MEMORY_RECORDS_RESPONSE_SCHEMA = z.object({
14
+ data: z.array(TRANSLATION_MEMORY_RECORD_SCHEMA),
15
+ meta: zMeta,
16
+ });
17
+ //# sourceMappingURL=get-records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-records.js","sourceRoot":"","sources":["../../src/api-schemas/get-records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kCAAkC,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AAChF,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAA;AAEhE,MAAM,eAAe,GAAG,GAAG,CAAA;AAC3B,MAAM,CAAC,MAAM,mDAAmD,GAC9D,kCAAkC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM;SACZ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,eAAe,CAAC;SACpB,OAAO,CAAC,eAAe,CAAC;SACxB,QAAQ,CAAC,kCAAkC,CAAC;CAChD,CAAC,CAAA;AAKJ,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAAC,CAAC,MAAM,CAAC;IACrE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,gCAAgC,CAAC;IAC/C,IAAI,EAAE,KAAK;CACZ,CAAC,CAAA"}
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const PUT_TRANSLATION_MEMORY_RECORD_REQUEST_BODY_SCHEMA: z.ZodArray<z.ZodObject<{
3
+ ownerId: z.ZodGUID;
4
+ sourceLocale: z.ZodString;
5
+ targetLocale: z.ZodString;
6
+ sourceText: z.ZodString;
7
+ targetText: z.ZodString;
8
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
9
+ sourceNextContent: z.ZodOptional<z.ZodString>;
10
+ }, z.core.$strip>>;
11
+ export type PutTranslationMemoryRecordRequestBody = z.infer<typeof PUT_TRANSLATION_MEMORY_RECORD_REQUEST_BODY_SCHEMA>;
@@ -0,0 +1,6 @@
1
+ import { z } from 'zod/v4';
2
+ import { UPSERT_TRANSLATION_MEMORY_RECORD_SCHEMA } from "../objects.js";
3
+ export const PUT_TRANSLATION_MEMORY_RECORD_REQUEST_BODY_SCHEMA = z
4
+ .array(UPSERT_TRANSLATION_MEMORY_RECORD_SCHEMA)
5
+ .min(1);
6
+ //# sourceMappingURL=put-records.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"put-records.js","sourceRoot":"","sources":["../../src/api-schemas/put-records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,uCAAuC,EAAE,MAAM,eAAe,CAAA;AAEvE,MAAM,CAAC,MAAM,iDAAiD,GAAG,CAAC;KAC/D,KAAK,CAAC,uCAAuC,CAAC;KAC9C,GAAG,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,5 @@
1
+ export * from './api-schemas/common.ts';
2
+ export * from './api-schemas/find-matches.ts';
3
+ export * from './api-schemas/get-records.ts';
4
+ export * from './api-schemas/put-records.ts';
5
+ export * from './objects.ts';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./api-schemas/common.js";
2
+ export * from "./api-schemas/find-matches.js";
3
+ export * from "./api-schemas/get-records.js";
4
+ export * from "./api-schemas/put-records.js";
5
+ export * from "./objects.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAE5C,cAAc,cAAc,CAAA"}
@@ -0,0 +1,46 @@
1
+ import type { PaginationMeta } from '@lokalise/api-common';
2
+ import { z } from 'zod/v4';
3
+ export declare const LOCALE_SCHEMA: z.ZodString;
4
+ export declare const GROUP_ID_SCHEMA: z.ZodString;
5
+ export type GroupId = z.infer<typeof GROUP_ID_SCHEMA>;
6
+ export declare const TRANSLATION_MEMORY_RECORD_SCHEMA: z.ZodObject<{
7
+ id: z.ZodString;
8
+ groupId: z.ZodString;
9
+ ownerId: z.ZodGUID;
10
+ sourceLocale: z.ZodString;
11
+ targetLocale: z.ZodString;
12
+ sourceText: z.ZodString;
13
+ targetText: z.ZodString;
14
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
15
+ sourceNextContent: z.ZodOptional<z.ZodString>;
16
+ createdAt: z.ZodISODateTime;
17
+ updatedAt: z.ZodISODateTime;
18
+ }, z.core.$strip>;
19
+ export type TranslationMemoryRecord = z.infer<typeof TRANSLATION_MEMORY_RECORD_SCHEMA>;
20
+ export declare const UPSERT_TRANSLATION_MEMORY_RECORD_SCHEMA: z.ZodObject<{
21
+ ownerId: z.ZodGUID;
22
+ sourceLocale: z.ZodString;
23
+ targetLocale: z.ZodString;
24
+ sourceText: z.ZodString;
25
+ targetText: z.ZodString;
26
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
27
+ sourceNextContent: z.ZodOptional<z.ZodString>;
28
+ }, z.core.$strip>;
29
+ export type UpsertTranslationMemoryRecordDto = z.infer<typeof UPSERT_TRANSLATION_MEMORY_RECORD_SCHEMA>;
30
+ export type TranslationMemoryRecordsResponse = {
31
+ records: TranslationMemoryRecord[];
32
+ meta: PaginationMeta;
33
+ };
34
+ export declare const TRANSLATION_MEMORY_LOOKUP_OPTIONS_SCHEMA: z.ZodObject<{
35
+ maxMatches: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
36
+ }, z.core.$strip>;
37
+ export type TranslationMemoryLookupOptions = z.infer<typeof TRANSLATION_MEMORY_LOOKUP_OPTIONS_SCHEMA>;
38
+ export declare const TRANSLATION_MEMORY_FILTER_SCHEMA: z.ZodObject<{
39
+ filterId: z.ZodOptional<z.ZodString>;
40
+ sourceText: z.ZodString;
41
+ sourceLocale: z.ZodString;
42
+ targetLocale: z.ZodString;
43
+ prevContent: z.ZodOptional<z.ZodString>;
44
+ nextContent: z.ZodOptional<z.ZodString>;
45
+ }, z.core.$strip>;
46
+ export type TranslationMemoryFilter = z.infer<typeof TRANSLATION_MEMORY_FILTER_SCHEMA>;
@@ -0,0 +1,63 @@
1
+ import { isSupportedLocale } from '@lokalise/supported-languages';
2
+ import { z } from 'zod/v4';
3
+ export const LOCALE_SCHEMA = z.string().min(1).refine(isSupportedLocale, {
4
+ message: 'Unsupported locale',
5
+ });
6
+ export const GROUP_ID_SCHEMA = z
7
+ .string()
8
+ .min(1)
9
+ .describe('Identifier of an isolated group of records (e.g. can be used to separate searches per different projects)');
10
+ export const TRANSLATION_MEMORY_RECORD_SCHEMA = z.object({
11
+ id: z.string().nonempty().describe('Unique record ID, generated by TM service'),
12
+ groupId: GROUP_ID_SCHEMA,
13
+ ownerId: z
14
+ .guid()
15
+ .describe('Unique identifier of a record owner - only owner can UPDATE or DELETE such record'),
16
+ sourceLocale: LOCALE_SCHEMA.describe('Source language tag (locale), e.g. "de" or "en-CA"'),
17
+ targetLocale: LOCALE_SCHEMA.describe('Target language tag (locale), e.g. "de" or "en-CA"'),
18
+ sourceText: z.string().min(1).describe('Translation text in source language'),
19
+ targetText: z.string().min(1).describe('Translation text in target language'),
20
+ sourcePrevContent: z
21
+ .string()
22
+ .min(1)
23
+ .optional()
24
+ .describe('Text that appears right before the seeked translation'),
25
+ sourceNextContent: z
26
+ .string()
27
+ .min(1)
28
+ .optional()
29
+ .describe('Text that appears right after the seeked translation'),
30
+ createdAt: z.iso.datetime().describe('Timestamp of record creation, generated by TM service'),
31
+ updatedAt: z.iso.datetime().describe('Timestamp of record creation, generated by TM service'),
32
+ });
33
+ export const UPSERT_TRANSLATION_MEMORY_RECORD_SCHEMA = TRANSLATION_MEMORY_RECORD_SCHEMA.omit({
34
+ id: true,
35
+ groupId: true,
36
+ createdAt: true,
37
+ updatedAt: true,
38
+ });
39
+ export const TRANSLATION_MEMORY_LOOKUP_OPTIONS_SCHEMA = z.object({
40
+ maxMatches: z.coerce
41
+ .number()
42
+ .min(1)
43
+ .max(10)
44
+ .default(1)
45
+ .describe('Maximum amount of matches to return (1 by default)'),
46
+ });
47
+ export const TRANSLATION_MEMORY_FILTER_SCHEMA = z.object({
48
+ filterId: z.string().min(1).optional().describe('Individual results ID'),
49
+ sourceText: z.string().min(1).describe('Seeked translation in source language'),
50
+ sourceLocale: LOCALE_SCHEMA.describe('Source language tag (locale), e.g. "de" or "en-CA"'),
51
+ targetLocale: LOCALE_SCHEMA.describe('Target translation language tag (locale), e.g. "de" or "en-CA"'),
52
+ prevContent: z
53
+ .string()
54
+ .min(1)
55
+ .optional()
56
+ .describe('Text that appears right before the seeked translation, used for in-context match'),
57
+ nextContent: z
58
+ .string()
59
+ .min(1)
60
+ .optional()
61
+ .describe('Text that appears right after the seeked translation, used for in-context match'),
62
+ });
63
+ //# sourceMappingURL=objects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objects.js","sourceRoot":"","sources":["../src/objects.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AACjE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,MAAM,CAAC,MAAM,aAAa,GAAG,CA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as",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "author": {
6
+ "name": "Lokalise",
7
+ "url": "https://lokalise.com/"
8
+ },
9
+ "description": "API schemas for Lokalise Translation Memory service",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "license": "Apache-2.0",
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git://github.com/lokalise/tm-service.git"
17
+ },
18
+ "main": "dist/index.js",
19
+ "exports": {
20
+ ".": "./dist/index.js",
21
+ "./package.json": "./package.json"
22
+ },
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "scripts": {
27
+ "build": "npm run clean && tsc --project tsconfig.build.json",
28
+ "clean": "rimraf dist",
29
+ "lint": "biome check && tsc",
30
+ "lint:fix": "biome check --write",
31
+ "test:ci": "echo \"No tests\"",
32
+ "package-version": "echo $npm_package_version",
33
+ "prepublishOnly": "node --run build",
34
+ "postversion": "biome check --write package.json"
35
+ },
36
+ "dependencies": {},
37
+ "peerDependencies": {
38
+ "zod": ">=3.25.76 <5.0.0"
39
+ },
40
+ "devDependencies": {
41
+ "@biomejs/biome": "^2.2.0",
42
+ "@lokalise/api-common": "^6.0.0",
43
+ "@lokalise/biome-config": "^3.1.0",
44
+ "@lokalise/supported-languages": "^3.1.0",
45
+ "@lokalise/tsconfig": "^2.0.0",
46
+ "@types/node": "24.3.0",
47
+ "rimraf": "^6.0.1",
48
+ "typescript": "5.9.2",
49
+ "zod": "^3.25.76"
50
+ }
51
+ }