@lokalise/tm-api-schemas 1.0.0 → 2.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.
@@ -1,29 +1,4 @@
1
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
2
  export declare const POST_BULK_FIND_MATCHES_REQUEST_BODY_SCHEMA: z.ZodObject<{
28
3
  filters: z.ZodArray<z.ZodObject<{
29
4
  filterId: z.ZodOptional<z.ZodString>;
@@ -74,3 +49,35 @@ export declare const POST_BULK_FIND_MATCHES_RESPONSE_SCHEMA: z.ZodObject<{
74
49
  }, z.core.$strip>>;
75
50
  }, z.core.$strip>;
76
51
  export type PostBulkFindMatchesResponse = z.infer<typeof POST_BULK_FIND_MATCHES_RESPONSE_SCHEMA>;
52
+ export declare const postBulkFindMatchesContract: import("@lokalise/api-contracts").PayloadRouteDefinition<z.ZodObject<{
53
+ filters: z.ZodArray<z.ZodObject<{
54
+ filterId: z.ZodOptional<z.ZodString>;
55
+ sourceText: z.ZodString;
56
+ sourceLocale: z.ZodString;
57
+ targetLocale: z.ZodString;
58
+ prevContent: z.ZodOptional<z.ZodString>;
59
+ nextContent: z.ZodOptional<z.ZodString>;
60
+ }, z.core.$strip>>;
61
+ options: z.ZodOptional<z.ZodObject<{
62
+ maxMatches: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
63
+ }, z.core.$strip>>;
64
+ }, z.core.$strip>, z.ZodObject<{
65
+ data: z.ZodArray<z.ZodObject<{
66
+ filterId: z.ZodOptional<z.ZodString>;
67
+ matches: z.ZodArray<z.ZodObject<{
68
+ id: z.ZodString;
69
+ groupId: z.ZodString;
70
+ ownerId: z.ZodGUID;
71
+ sourceLocale: z.ZodString;
72
+ targetLocale: z.ZodString;
73
+ sourceText: z.ZodString;
74
+ targetText: z.ZodString;
75
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
76
+ sourceNextContent: z.ZodOptional<z.ZodString>;
77
+ createdAt: z.ZodISODateTime;
78
+ updatedAt: z.ZodISODateTime;
79
+ }, z.core.$strip>>;
80
+ }, z.core.$strip>>;
81
+ }, z.core.$strip>, z.ZodObject<{
82
+ groupId: z.ZodString;
83
+ }, z.core.$strip>, undefined, z.ZodAny, false, false>;
@@ -0,0 +1,38 @@
1
+ import { buildPayloadRoute } from '@lokalise/api-contracts';
2
+ import { commonErrorResponses } from '@lokalise/common-api-schemas';
3
+ import { z } from 'zod/v4';
4
+ import { TRANSLATION_MEMORY_FILTER_SCHEMA, TRANSLATION_MEMORY_LOOKUP_OPTIONS_SCHEMA, TRANSLATION_MEMORY_RECORD_SCHEMA, } from "../objects.js";
5
+ import { GROUP_REQUEST_PARAMS_SCHEMA } from "./common.js";
6
+ // --------------------------------------------------
7
+ // POST /v1/groups/:groupId/actions/bulk-find-matches
8
+ // --------------------------------------------------
9
+ export const POST_BULK_FIND_MATCHES_REQUEST_BODY_SCHEMA = z.object({
10
+ filters: z
11
+ .array(TRANSLATION_MEMORY_FILTER_SCHEMA)
12
+ .min(1)
13
+ .describe('List of separate filtering conditions, each will return a separate list of matches'),
14
+ options: TRANSLATION_MEMORY_LOOKUP_OPTIONS_SCHEMA.optional().describe('Lookup options applied to every search'),
15
+ });
16
+ export const BULK_TRANSLATION_MEMORY_MATCHES_SCHEMA = z.object({
17
+ filterId: z.string().min(1).optional().describe('Individual results ID'),
18
+ matches: z
19
+ .array(TRANSLATION_MEMORY_RECORD_SCHEMA)
20
+ .describe('Array of translation memory records'),
21
+ });
22
+ export const POST_BULK_FIND_MATCHES_RESPONSE_SCHEMA = z.object({
23
+ data: z.array(BULK_TRANSLATION_MEMORY_MATCHES_SCHEMA),
24
+ });
25
+ export const postBulkFindMatchesContract = buildPayloadRoute({
26
+ method: 'post',
27
+ requestPathParamsSchema: GROUP_REQUEST_PARAMS_SCHEMA,
28
+ requestBodySchema: POST_BULK_FIND_MATCHES_REQUEST_BODY_SCHEMA,
29
+ requestHeaderSchema: z.any(),
30
+ pathResolver: (params) => `/v1/groups/${params.groupId}/actions/bulk-find-matches`,
31
+ description: 'Get TM matches for a set of queries',
32
+ successResponseBodySchema: POST_BULK_FIND_MATCHES_RESPONSE_SCHEMA,
33
+ responseSchemasByStatusCode: {
34
+ ...commonErrorResponses,
35
+ 200: POST_BULK_FIND_MATCHES_RESPONSE_SCHEMA,
36
+ },
37
+ });
38
+ //# sourceMappingURL=bulk-find-matches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bulk-find-matches.js","sourceRoot":"","sources":["../../src/api-schemas/bulk-find-matches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,CAAC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ACjE,2BAA2B,EAAE;QAC3B,GAAG,oBAAoB;QACvB,GAAG,EAAE,sCAAsC;KAC5C;CACF,CAAC,CAAA"}
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod/v4';
2
+ export declare const GET_TRANSLATION_MEMORY_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 GetTranslationMemoryMatchesRequestQuery = z.infer<typeof GET_TRANSLATION_MEMORY_MATCHES_REQUEST_QUERY_SCHEMA>;
11
+ export declare const GET_TRANSLATION_MEMORY_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 GetTranslationMemoryMatchesResponse = z.infer<typeof GET_TRANSLATION_MEMORY_MATCHES_RESPONSE_SCHEMA>;
27
+ export declare const getTranslationMemoryMatchesContract: import("@lokalise/api-contracts").GetRouteDefinition<z.ZodObject<{
28
+ data: z.ZodArray<z.ZodObject<{
29
+ id: z.ZodString;
30
+ groupId: z.ZodString;
31
+ ownerId: z.ZodGUID;
32
+ sourceLocale: z.ZodString;
33
+ targetLocale: z.ZodString;
34
+ sourceText: z.ZodString;
35
+ targetText: z.ZodString;
36
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
37
+ sourceNextContent: z.ZodOptional<z.ZodString>;
38
+ createdAt: z.ZodISODateTime;
39
+ updatedAt: z.ZodISODateTime;
40
+ }, z.core.$strip>>;
41
+ }, z.core.$strip>, z.ZodObject<{
42
+ groupId: z.ZodString;
43
+ }, z.core.$strip>, z.ZodObject<{
44
+ 'source-text': z.ZodString;
45
+ 'source-locale': z.ZodString;
46
+ 'target-locale': z.ZodString;
47
+ 'prev-content': z.ZodOptional<z.ZodString>;
48
+ 'next-content': z.ZodOptional<z.ZodString>;
49
+ 'max-matches': z.ZodDefault<z.ZodCoercedNumber<unknown>>;
50
+ }, z.core.$strip>, z.ZodAny, false, false>;
@@ -0,0 +1,45 @@
1
+ import { buildGetRoute } from '@lokalise/api-contracts';
2
+ import { commonErrorResponses } from '@lokalise/common-api-schemas';
3
+ import { z } from 'zod/v4';
4
+ import { LOCALE_SCHEMA, TRANSLATION_MEMORY_RECORD_SCHEMA } from "../objects.js";
5
+ import { GROUP_REQUEST_PARAMS_SCHEMA } from "./common.js";
6
+ // --------------------------------------------
7
+ // GET /v1/groups/:groupId/matches
8
+ // --------------------------------------------
9
+ export const GET_TRANSLATION_MEMORY_MATCHES_REQUEST_QUERY_SCHEMA = z.object({
10
+ 'source-text': z.string().min(1).describe('Seeked translation in source language'),
11
+ 'source-locale': LOCALE_SCHEMA.describe('Source language tag (locale), e.g. "de" or "en-CA"'),
12
+ 'target-locale': LOCALE_SCHEMA.describe('Target translation language tag (locale), e.g. "de" or "en-CA"'),
13
+ 'prev-content': z
14
+ .string()
15
+ .optional()
16
+ .describe('Text that appears right before the seeked translation, used for in-context match'),
17
+ 'next-content': z
18
+ .string()
19
+ .optional()
20
+ .describe('Text that appears right after the seeked translation, used for in-context match'),
21
+ 'max-matches': z.coerce
22
+ .number()
23
+ .gt(0)
24
+ .max(10)
25
+ .default(1)
26
+ .describe('Maximum amount of matches to return (1 by default)'),
27
+ });
28
+ export const GET_TRANSLATION_MEMORY_MATCHES_RESPONSE_SCHEMA = z.object({
29
+ data: z
30
+ .array(TRANSLATION_MEMORY_RECORD_SCHEMA)
31
+ .describe('Found matches sorted from the most relevant to least relevant'),
32
+ });
33
+ export const getTranslationMemoryMatchesContract = buildGetRoute({
34
+ requestPathParamsSchema: GROUP_REQUEST_PARAMS_SCHEMA,
35
+ requestQuerySchema: GET_TRANSLATION_MEMORY_MATCHES_REQUEST_QUERY_SCHEMA,
36
+ requestHeaderSchema: z.any(),
37
+ pathResolver: (params) => `/v1/groups/${params.groupId}/matches`,
38
+ description: 'Get TM matches for a given query',
39
+ successResponseBodySchema: GET_TRANSLATION_MEMORY_MATCHES_RESPONSE_SCHEMA,
40
+ responseSchemasByStatusCode: {
41
+ ...commonErrorResponses,
42
+ 200: GET_TRANSLATION_MEMORY_MATCHES_RESPONSE_SCHEMA,
43
+ },
44
+ });
45
+ //# sourceMappingURL=get-matches.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-matches.js","sourceRoot":"","sources":["../../src/api-schemas/get-matches.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,aAAa,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAA;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAEzD,+CAA+C;AAC/C,kCAAkC;AAClC,+CAA+C;AAE/C,MAAM,CAAC,MAAM,mDAAmD,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1E,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAClF,eAAe,EAAE,aAAa,CAAC,QAAQ,CAAC,oDAAoD,CAAC;IAC7F,eAAe,EAAE,aAAa,CAAC,QAAQ,CACrC,gEAAgE,CACjE;IACD,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,kFAAkF,CAAC;IAC/F,cAAc,EAAE,CAAC;SACd,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,iFAAiF,CAAC;IAC9F,aAAa,EAAE,CAAC,CAAC,MAAM;SACpB,MAAM,EAAE;SACR,EAAE,CAAC,CAAC,CAAC;SACL,GAAG,CAAC,EAAE,CAAC;SACP,OAAO,CAAC,CAAC,CAAC;SACV,QAAQ,CAAC,oDAAoD,CAAC;CAClE,CAAC,CAAA;AAKF,MAAM,CAAC,MAAM,8CAA8C,GAAG,CAAC,CAAC,MAAM,CAAC;IACrE,IAAI,EAAE,CAAC;SACJ,KAAK,CAAC,gCAAgC,CAAC;SACvC,QAAQ,CAAC,+DAA+D,CAAC;CAC7E,CAAC,CAAA;AAKF,MAAM,CAAC,MAAM,mCAAmC,GAAG,aAAa,CAAC;IAC/D,uBAAuB,EAAE,2BAA2B;IACpD,kBAAkB,EAAE,mDAAmD;IACvE,mBAAmB,EAAE,CAAC,CAAC,GAAG,EAAE;IAC5B,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,MAAM,CAAC,OAAO,UAAU;IAChE,WAAW,EAAE,kCAAkC;IAC/C,yBAAyB,EAAE,8CAA8C;IACzE,2BAA2B,EAAE;QAC3B,GAAG,oBAAoB;QACvB,GAAG,EAAE,8CAA8C;KACpD;CACF,CAAC,CAAA"}
@@ -26,3 +26,29 @@ export declare const GET_TRANSLATION_MEMORY_RECORDS_RESPONSE_SCHEMA: z.ZodObject
26
26
  }, z.core.$strip>;
27
27
  }, z.core.$strip>;
28
28
  export type GetTranslationMemoryRecordsResponse = z.infer<typeof GET_TRANSLATION_MEMORY_RECORDS_RESPONSE_SCHEMA>;
29
+ export declare const getTranslationMemoryRecordsContract: import("@lokalise/api-contracts").GetRouteDefinition<z.ZodObject<{
30
+ data: z.ZodArray<z.ZodObject<{
31
+ id: z.ZodString;
32
+ groupId: z.ZodString;
33
+ ownerId: z.ZodGUID;
34
+ sourceLocale: z.ZodString;
35
+ targetLocale: z.ZodString;
36
+ sourceText: z.ZodString;
37
+ targetText: z.ZodString;
38
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
39
+ sourceNextContent: z.ZodOptional<z.ZodString>;
40
+ createdAt: z.ZodISODateTime;
41
+ updatedAt: z.ZodISODateTime;
42
+ }, z.core.$strip>>;
43
+ meta: z.ZodObject<{
44
+ count: z.ZodNumber;
45
+ cursor: z.ZodOptional<z.ZodString>;
46
+ hasMore: z.ZodOptional<z.ZodBoolean>;
47
+ }, z.core.$strip>;
48
+ }, z.core.$strip>, z.ZodObject<{
49
+ groupId: z.ZodString;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ before: z.ZodOptional<z.ZodString>;
52
+ after: z.ZodOptional<z.ZodString>;
53
+ limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
54
+ }, z.core.$strip>, z.ZodAny, false, false>;
@@ -1,6 +1,12 @@
1
1
  import { MANDATORY_PAGINATION_CONFIG_SCHEMA, zMeta } from '@lokalise/api-common';
2
+ import { buildGetRoute } from '@lokalise/api-contracts';
3
+ import { commonErrorResponses } from '@lokalise/common-api-schemas';
2
4
  import { z } from 'zod/v4';
3
5
  import { TRANSLATION_MEMORY_RECORD_SCHEMA } from "../objects.js";
6
+ import { GROUP_REQUEST_PARAMS_SCHEMA } from './common.js';
7
+ // --------------------------------------------
8
+ // GET /v1/groups/:groupId/records
9
+ // --------------------------------------------
4
10
  const MaxRecordsLimit = 500;
5
11
  export const GET_TRANSLATION_MEMORY_RECORDS_REQUEST_QUERY_SCHEMA = MANDATORY_PAGINATION_CONFIG_SCHEMA.extend({
6
12
  limit: z.coerce
@@ -14,4 +20,16 @@ export const GET_TRANSLATION_MEMORY_RECORDS_RESPONSE_SCHEMA = z.object({
14
20
  data: z.array(TRANSLATION_MEMORY_RECORD_SCHEMA),
15
21
  meta: zMeta,
16
22
  });
23
+ export const getTranslationMemoryRecordsContract = buildGetRoute({
24
+ requestPathParamsSchema: GROUP_REQUEST_PARAMS_SCHEMA,
25
+ requestQuerySchema: GET_TRANSLATION_MEMORY_RECORDS_REQUEST_QUERY_SCHEMA,
26
+ requestHeaderSchema: z.any(),
27
+ pathResolver: (params) => `/v1/groups/${params.groupId}/records`,
28
+ successResponseBodySchema: GET_TRANSLATION_MEMORY_RECORDS_RESPONSE_SCHEMA,
29
+ description: 'Retrieve TM records for a specific group',
30
+ responseSchemasByStatusCode: {
31
+ ...commonErrorResponses,
32
+ 200: GET_TRANSLATION_MEMORY_RECORDS_RESPONSE_SCHEMA,
33
+ },
34
+ });
17
35
  //# sourceMappingURL=get-records.js.map
@@ -1 +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"}
1
+ {"version":3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G,EAAE,8CAA8C;KACpD;CACF,CAAC,CAAA"}
@@ -9,3 +9,14 @@ export declare const PUT_TRANSLATION_MEMORY_RECORD_REQUEST_BODY_SCHEMA: z.ZodArr
9
9
  sourceNextContent: z.ZodOptional<z.ZodString>;
10
10
  }, z.core.$strip>>;
11
11
  export type PutTranslationMemoryRecordRequestBody = z.infer<typeof PUT_TRANSLATION_MEMORY_RECORD_REQUEST_BODY_SCHEMA>;
12
+ export declare const putTranslationMemoryRecordsContract: import("@lokalise/api-contracts").PayloadRouteDefinition<z.ZodArray<z.ZodObject<{
13
+ ownerId: z.ZodGUID;
14
+ sourceLocale: z.ZodString;
15
+ targetLocale: z.ZodString;
16
+ sourceText: z.ZodString;
17
+ targetText: z.ZodString;
18
+ sourcePrevContent: z.ZodOptional<z.ZodString>;
19
+ sourceNextContent: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$strip>>, z.ZodUndefined, z.ZodObject<{
21
+ groupId: z.ZodString;
22
+ }, z.core.$strip>, undefined, z.ZodAny, false, true>;
@@ -1,6 +1,26 @@
1
+ import { buildPayloadRoute } from '@lokalise/api-contracts';
2
+ import { commonErrorResponses } from '@lokalise/common-api-schemas';
1
3
  import { z } from 'zod/v4';
2
4
  import { UPSERT_TRANSLATION_MEMORY_RECORD_SCHEMA } from "../objects.js";
5
+ import { GROUP_REQUEST_PARAMS_SCHEMA } from "./common.js";
6
+ // --------------------------------------------
7
+ // PUT /v1/groups/:groupId/records
8
+ // --------------------------------------------
3
9
  export const PUT_TRANSLATION_MEMORY_RECORD_REQUEST_BODY_SCHEMA = z
4
10
  .array(UPSERT_TRANSLATION_MEMORY_RECORD_SCHEMA)
5
11
  .min(1);
12
+ export const putTranslationMemoryRecordsContract = buildPayloadRoute({
13
+ method: 'put',
14
+ requestPathParamsSchema: GROUP_REQUEST_PARAMS_SCHEMA,
15
+ requestBodySchema: PUT_TRANSLATION_MEMORY_RECORD_REQUEST_BODY_SCHEMA,
16
+ requestHeaderSchema: z.any(),
17
+ pathResolver: (params) => `/v1/groups/${params.groupId}/records`,
18
+ description: 'Create or update TM records',
19
+ successResponseBodySchema: z.undefined(),
20
+ isEmptyResponseExpected: true,
21
+ responseSchemasByStatusCode: {
22
+ ...commonErrorResponses,
23
+ 202: z.undefined().describe('Request succeeded'),
24
+ },
25
+ });
6
26
  //# sourceMappingURL=put-records.js.map
@@ -1 +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"}
1
+ {"version":3,"file":"put-records.js","sourceRoot":"","sources":["../../src/api-schemas/put-records.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAA;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,uCAAuC,EAAE,MAAM,eAAe,CAAA;AACvE,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AAEzD,+CAA+C;AAC/C,kCAAkC;AAClC,+CAA+C;AAE/C,MAAM,CAAC,MAAM,iDAAiD,GAAG,CAAC;KAC/D,KAAK,CAAC,uCAAuC,CAAC;KAC9C,GAAG,CAAC,CAAC,CAAC,CAAA;AAKT,MAAM,CAAC,MAAM,mCAAmC,GAAG,iBAAiB,CAAC;IACnE,MAAM,EAAE,KAAK;IACb,uBAAuB,EAAE,2BAA2B;IACpD,iBAAiB,EAAE,iDAAiD;IACpE,mBAAmB,EAAE,CAAC,CAAC,GAAG,EAAE;IAC5B,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,cAAc,MAAM,CAAC,OAAO,UAAU;IAChE,WAAW,EAAE,6BAA6B;IAC1C,yBAAyB,EAAE,CAAC,CAAC,SAAS,EAAE;IACxC,uBAAuB,EAAE,IAAI;IAC7B,2BAA2B,EAAE;QAC3B,GAAG,oBAAoB;QACvB,GAAG,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;KACjD;CACF,CAAC,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
+ export * from './api-schemas/bulk-find-matches.ts';
1
2
  export * from './api-schemas/common.ts';
2
- export * from './api-schemas/find-matches.ts';
3
+ export * from './api-schemas/get-matches.ts';
3
4
  export * from './api-schemas/get-records.ts';
4
5
  export * from './api-schemas/put-records.ts';
5
6
  export * from './objects.ts';
package/dist/index.js CHANGED
@@ -1,5 +1,6 @@
1
+ export * from "./api-schemas/bulk-find-matches.js";
1
2
  export * from "./api-schemas/common.js";
2
- export * from "./api-schemas/find-matches.js";
3
+ export * from "./api-schemas/get-matches.js";
3
4
  export * from "./api-schemas/get-records.js";
4
5
  export * from "./api-schemas/put-records.js";
5
6
  export * from "./objects.js";
package/dist/index.js.map CHANGED
@@ -1 +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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,oCAAoC,CAAA;AAClD,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,8BAA8B,CAAA;AAE5C,cAAc,cAAc,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/tm-api-schemas",
3
- "version": "1.0.0",
3
+ "version": "2.0.0",
4
4
  "type": "module",
5
5
  "author": {
6
6
  "name": "Lokalise",
@@ -33,19 +33,22 @@
33
33
  "prepublishOnly": "node --run build",
34
34
  "postversion": "biome check --write package.json"
35
35
  },
36
- "dependencies": {},
36
+ "dependencies": {
37
+ "@lokalise/api-common": "^6.0.0",
38
+ "@lokalise/api-contracts": "^5.0.0",
39
+ "@lokalise/common-api-schemas": "^1.1.0",
40
+ "@lokalise/supported-languages": "^3.1.0",
41
+ "zod": "^3.25.76"
42
+ },
37
43
  "peerDependencies": {
38
44
  "zod": ">=3.25.76 <5.0.0"
39
45
  },
40
46
  "devDependencies": {
41
47
  "@biomejs/biome": "^2.2.0",
42
- "@lokalise/api-common": "^6.0.0",
43
48
  "@lokalise/biome-config": "^3.1.0",
44
- "@lokalise/supported-languages": "^3.1.0",
45
49
  "@lokalise/tsconfig": "^2.0.0",
46
50
  "@types/node": "24.3.0",
47
51
  "rimraf": "^6.0.1",
48
- "typescript": "5.9.2",
49
- "zod": "^3.25.76"
52
+ "typescript": "5.9.2"
50
53
  }
51
54
  }
@@ -1,43 +0,0 @@
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
@@ -1 +0,0 @@
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,MAAM,qCAAqC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5D,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IAClF,eAAe,EAAE,aAAa,CAAC,QAAQ,CAAC,oDAAoD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