@lokalise/connector-api-contracts 1.9.2 → 1.11.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/dist/contracts/authContracts.d.ts +4 -4
- package/dist/contracts/cacheContracts.d.ts +24 -0
- package/dist/contracts/cacheContracts.js +23 -7
- package/dist/contracts/cacheContracts.js.map +1 -1
- package/dist/contracts/commonSchemas.d.ts +21 -0
- package/dist/contracts/commonSchemas.js +25 -0
- package/dist/contracts/commonSchemas.js.map +1 -1
- package/dist/contracts/envContracts.d.ts +1 -1
- package/dist/contracts/itemListContracts.d.ts +2 -0
- package/dist/contracts/itemListContracts.js +7 -4
- package/dist/contracts/itemListContracts.js.map +1 -1
- package/dist/contracts/paginationSchemas.d.ts +36 -0
- package/dist/contracts/paginationSchemas.js +50 -0
- package/dist/contracts/paginationSchemas.js.map +1 -0
- package/dist/contracts/publishContracts.d.ts +2 -0
- package/dist/contracts/publishContracts.js +2 -1
- package/dist/contracts/publishContracts.js.map +1 -1
- package/dist/contracts/translateContracts.d.ts +12 -0
- package/dist/contracts/translateContracts.js +11 -5
- package/dist/contracts/translateContracts.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -17,7 +17,7 @@ export declare const getAuthContract: import("@lokalise/api-contracts").GetRoute
|
|
|
17
17
|
}, z.core.$strip>, undefined, undefined, z.ZodObject<{
|
|
18
18
|
'ce-config': z.ZodString;
|
|
19
19
|
"x-connector-id": z.ZodString;
|
|
20
|
-
}, z.core.$strip>, false, false, {
|
|
20
|
+
}, z.core.$strip>, undefined, false, false, {
|
|
21
21
|
200: z.ZodObject<{
|
|
22
22
|
type: z.ZodEnum<{
|
|
23
23
|
OAuth: "OAuth";
|
|
@@ -32,7 +32,7 @@ export type PostAuthResponseBody = Record<string, unknown> & {
|
|
|
32
32
|
export declare const postAuthContract: import("@lokalise/api-contracts").PayloadRouteDefinition<z.ZodOptional<z.ZodNull>, z.ZodObject<{}, z.core.$loose>, undefined, undefined, z.ZodObject<{
|
|
33
33
|
'ce-config': z.ZodString;
|
|
34
34
|
"x-connector-id": z.ZodString;
|
|
35
|
-
}, z.core.$strip>, false, false, {
|
|
35
|
+
}, z.core.$strip>, undefined, false, false, {
|
|
36
36
|
200: z.ZodObject<{}, z.core.$loose>;
|
|
37
37
|
403: z.ZodObject<{
|
|
38
38
|
message: z.ZodString;
|
|
@@ -43,7 +43,7 @@ export declare const postAuthRefreshContract: import("@lokalise/api-contracts").
|
|
|
43
43
|
'ce-config': z.ZodString;
|
|
44
44
|
'ce-auth': z.ZodString;
|
|
45
45
|
"x-connector-id": z.ZodString;
|
|
46
|
-
}, z.core.$strip>, false, false, {
|
|
46
|
+
}, z.core.$strip>, undefined, false, false, {
|
|
47
47
|
200: z.ZodObject<{}, z.core.$loose>;
|
|
48
48
|
403: z.ZodObject<{
|
|
49
49
|
message: z.ZodString;
|
|
@@ -65,7 +65,7 @@ export declare const postAuthResponseContract: import("@lokalise/api-contracts")
|
|
|
65
65
|
}, z.core.$strip>, z.ZodObject<{}, z.core.$loose>, undefined, undefined, z.ZodObject<{
|
|
66
66
|
'ce-config': z.ZodString;
|
|
67
67
|
"x-connector-id": z.ZodString;
|
|
68
|
-
}, z.core.$strip>, false, false, {
|
|
68
|
+
}, z.core.$strip>, undefined, false, false, {
|
|
69
69
|
200: z.ZodObject<{}, z.core.$loose>;
|
|
70
70
|
403: z.ZodObject<{
|
|
71
71
|
message: z.ZodString;
|
|
@@ -28,6 +28,8 @@ export declare const PARTIAL_CACHE_ITEM_SCHEMA: z.ZodObject<{
|
|
|
28
28
|
*/
|
|
29
29
|
export declare const listCacheRequestQueryString: z.ZodObject<{
|
|
30
30
|
next: z.ZodOptional<z.ZodString>;
|
|
31
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
31
33
|
}, z.core.$strip>;
|
|
32
34
|
/**
|
|
33
35
|
* @deprecated Use `getItemList` API instead
|
|
@@ -39,6 +41,8 @@ export declare const listCacheResponseBody: z.ZodObject<{
|
|
|
39
41
|
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
40
42
|
}, z.core.$strip>>;
|
|
41
43
|
next: z.ZodOptional<z.ZodString>;
|
|
44
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
42
46
|
}, z.core.$strip>;
|
|
43
47
|
/**
|
|
44
48
|
* @deprecated Use `getItemList` API instead
|
|
@@ -52,6 +56,8 @@ export declare const cacheResponseBody: z.ZodObject<{
|
|
|
52
56
|
title: z.ZodString;
|
|
53
57
|
groupTitle: z.ZodString;
|
|
54
58
|
}, z.core.$strip>>;
|
|
59
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
55
61
|
}, z.core.$strip>;
|
|
56
62
|
/**
|
|
57
63
|
* @deprecated Use `getItemList` API instead
|
|
@@ -62,6 +68,8 @@ export declare const cacheRequestBody: z.ZodObject<{
|
|
|
62
68
|
groupId: z.ZodString;
|
|
63
69
|
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
64
70
|
}, z.core.$strip>>;
|
|
71
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
65
73
|
}, z.core.$strip>;
|
|
66
74
|
/**
|
|
67
75
|
* @deprecated Use `getItemList` API instead
|
|
@@ -104,12 +112,18 @@ export declare const getCacheContract: import("@lokalise/api-contracts").GetRout
|
|
|
104
112
|
groupId: z.ZodString;
|
|
105
113
|
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
106
114
|
}, z.core.$strip>>;
|
|
115
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
116
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
107
117
|
}, z.core.$strip>, undefined, z.ZodObject<{
|
|
108
118
|
next: z.ZodOptional<z.ZodString>;
|
|
119
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
109
121
|
}, z.core.$strip>, z.ZodObject<{
|
|
110
122
|
'ce-config': z.ZodString;
|
|
111
123
|
'ce-auth': z.ZodString;
|
|
112
124
|
"x-connector-id": z.ZodString;
|
|
125
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
126
|
+
'x-continue-after': z.ZodOptional<z.ZodString>;
|
|
113
127
|
}, z.core.$strip>, false, false, {
|
|
114
128
|
200: z.ZodObject<{
|
|
115
129
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -118,6 +132,8 @@ export declare const getCacheContract: import("@lokalise/api-contracts").GetRout
|
|
|
118
132
|
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
119
133
|
}, z.core.$strip>>;
|
|
120
134
|
next: z.ZodOptional<z.ZodString>;
|
|
135
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
136
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
121
137
|
}, z.core.$strip>;
|
|
122
138
|
}>;
|
|
123
139
|
export declare const postCacheItemsContract: import("@lokalise/api-contracts").PayloadRouteDefinition<z.ZodObject<{
|
|
@@ -126,6 +142,8 @@ export declare const postCacheItemsContract: import("@lokalise/api-contracts").P
|
|
|
126
142
|
groupId: z.ZodString;
|
|
127
143
|
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
128
144
|
}, z.core.$strip>>;
|
|
145
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
129
147
|
}, z.core.$strip>, z.ZodObject<{
|
|
130
148
|
items: z.ZodArray<z.ZodObject<{
|
|
131
149
|
uniqueId: z.ZodString;
|
|
@@ -135,10 +153,14 @@ export declare const postCacheItemsContract: import("@lokalise/api-contracts").P
|
|
|
135
153
|
title: z.ZodString;
|
|
136
154
|
groupTitle: z.ZodString;
|
|
137
155
|
}, z.core.$strip>>;
|
|
156
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
157
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
138
158
|
}, z.core.$strip>, undefined, undefined, z.ZodObject<{
|
|
139
159
|
'ce-config': z.ZodString;
|
|
140
160
|
'ce-auth': z.ZodString;
|
|
141
161
|
"x-connector-id": z.ZodString;
|
|
162
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
163
|
+
'x-continue-after': z.ZodOptional<z.ZodString>;
|
|
142
164
|
}, z.core.$strip>, false, false, {
|
|
143
165
|
200: z.ZodObject<{
|
|
144
166
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -149,5 +171,7 @@ export declare const postCacheItemsContract: import("@lokalise/api-contracts").P
|
|
|
149
171
|
title: z.ZodString;
|
|
150
172
|
groupTitle: z.ZodString;
|
|
151
173
|
}, z.core.$strip>>;
|
|
174
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
175
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
152
176
|
}, z.core.$strip>;
|
|
153
177
|
}>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { buildGetRoute, buildPayloadRoute } from '@lokalise/api-contracts';
|
|
2
2
|
import { z } from 'zod/v4';
|
|
3
3
|
import { isValidNextParam } from "../utils/nextParamUtils.js";
|
|
4
|
-
import { CONNECTOR_REQUEST_HEADERS_SCHEMA, ITEM_IDENTIFIER_SCHEMA } from "./commonSchemas.js";
|
|
4
|
+
import { CONNECTOR_REQUEST_HEADERS_SCHEMA, ITEM_IDENTIFIER_SCHEMA, RATE_LIMIT_RESPONSE_HEADERS_SCHEMA, } from "./commonSchemas.js";
|
|
5
|
+
import { PAGINATION_REQUEST_PARAMS_SCHEMA, PAGINATION_RESPONSE_METADATA_SCHEMA, } from "./paginationSchemas.js";
|
|
5
6
|
export const MAX_TITLE_LENGTH = 256;
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated Use `getItemList` API instead
|
|
@@ -22,6 +23,9 @@ export const PARTIAL_CACHE_ITEM_SCHEMA = CACHE_ITEM_SCHEMA.extend({
|
|
|
22
23
|
*/
|
|
23
24
|
export const listCacheRequestQueryString = z
|
|
24
25
|
.object({
|
|
26
|
+
/**
|
|
27
|
+
* @deprecated Use `cursor` instead
|
|
28
|
+
*/
|
|
25
29
|
next: z
|
|
26
30
|
.string()
|
|
27
31
|
.includes(':', {
|
|
@@ -29,28 +33,38 @@ export const listCacheRequestQueryString = z
|
|
|
29
33
|
})
|
|
30
34
|
.optional(),
|
|
31
35
|
})
|
|
36
|
+
.extend(PAGINATION_REQUEST_PARAMS_SCHEMA.shape)
|
|
32
37
|
.refine(({ next }) => !next || isValidNextParam(next), {
|
|
33
38
|
message: 'Must contain skip and limit numeric values divided by colon',
|
|
34
39
|
});
|
|
35
40
|
/**
|
|
36
41
|
* @deprecated Use `getItemList` API instead
|
|
37
42
|
*/
|
|
38
|
-
export const listCacheResponseBody = z
|
|
43
|
+
export const listCacheResponseBody = z
|
|
44
|
+
.object({
|
|
39
45
|
items: z.array(ITEM_IDENTIFIER_SCHEMA),
|
|
46
|
+
/**
|
|
47
|
+
* @deprecated Use `nextCursor` instead
|
|
48
|
+
*/
|
|
40
49
|
next: z.string().optional(),
|
|
41
|
-
})
|
|
50
|
+
})
|
|
51
|
+
.extend(PAGINATION_RESPONSE_METADATA_SCHEMA.shape);
|
|
42
52
|
/**
|
|
43
53
|
* @deprecated Use `getItemList` API instead
|
|
44
54
|
*/
|
|
45
|
-
export const cacheResponseBody = z
|
|
55
|
+
export const cacheResponseBody = z
|
|
56
|
+
.object({
|
|
46
57
|
items: z.array(CACHE_ITEM_SCHEMA),
|
|
47
|
-
})
|
|
58
|
+
})
|
|
59
|
+
.extend(PAGINATION_RESPONSE_METADATA_SCHEMA.shape);
|
|
48
60
|
/**
|
|
49
61
|
* @deprecated Use `getItemList` API instead
|
|
50
62
|
*/
|
|
51
|
-
export const cacheRequestBody = z
|
|
63
|
+
export const cacheRequestBody = z
|
|
64
|
+
.object({
|
|
52
65
|
items: z.array(ITEM_IDENTIFIER_SCHEMA),
|
|
53
|
-
})
|
|
66
|
+
})
|
|
67
|
+
.extend(PAGINATION_REQUEST_PARAMS_SCHEMA.shape);
|
|
54
68
|
/**
|
|
55
69
|
* @deprecated Use `getItemList` API instead
|
|
56
70
|
*/
|
|
@@ -71,6 +85,7 @@ export const getCacheContract = buildGetRoute({
|
|
|
71
85
|
200: listCacheResponseBody,
|
|
72
86
|
},
|
|
73
87
|
requestHeaderSchema: CONNECTOR_REQUEST_HEADERS_SCHEMA,
|
|
88
|
+
responseHeaderSchema: RATE_LIMIT_RESPONSE_HEADERS_SCHEMA,
|
|
74
89
|
});
|
|
75
90
|
export const postCacheItemsContract = buildPayloadRoute({
|
|
76
91
|
method: 'post',
|
|
@@ -82,5 +97,6 @@ export const postCacheItemsContract = buildPayloadRoute({
|
|
|
82
97
|
200: cacheResponseBody,
|
|
83
98
|
},
|
|
84
99
|
requestHeaderSchema: CONNECTOR_REQUEST_HEADERS_SCHEMA,
|
|
100
|
+
responseHeaderSchema: RATE_LIMIT_RESPONSE_HEADERS_SCHEMA,
|
|
85
101
|
});
|
|
86
102
|
//# sourceMappingURL=cacheContracts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cacheContracts.js","sourceRoot":"","sources":["../../src/contracts/cacheContracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,
|
|
1
|
+
{"version":3,"file":"cacheContracts.js","sourceRoot":"","sources":["../../src/contracts/cacheContracts.ts"],"names":[],"m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/C,2BAA2B,EAAE;QAC3B,GAAG,EAAE,qBAAqB;KAC3B;IACD,mBAAmB,EAAE,gCAAgC;IACrD,oBAAoB,EAAE,kCAAkC;CACzD,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;IACtD,MAAM,EAAE,MAAM;IACd,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc;IAClC,WAAW,EAAE,oDAAoD;IACjE,iBAAiB,EAAE,gBAAgB;IACnC,yBAAyB,EAAE,iBAAiB;IAC5C,2BAA2B,EAAE;QAC3B,GAAG,EAAE,iBAAiB;KACvB;IACD,mBAAmB,EAAE,gCAAgC;IACrD,oBAAoB,EAAE,kCAAkC;CACzD,CAAC,CAAA"}
|
|
@@ -55,3 +55,24 @@ export declare const CONNECTOR_REQUEST_HEADERS_SCHEMA: z.ZodObject<{
|
|
|
55
55
|
'ce-auth': z.ZodString;
|
|
56
56
|
"x-connector-id": z.ZodString;
|
|
57
57
|
}, z.core.$strip>;
|
|
58
|
+
/**
|
|
59
|
+
* Response headers schema for APIs that support rate limiting.
|
|
60
|
+
*
|
|
61
|
+
* Connectors can optionally include these headers in their response
|
|
62
|
+
* to signal rate limit information to Content Engine, allowing it to
|
|
63
|
+
* respect third-party API rate limits.
|
|
64
|
+
*
|
|
65
|
+
* This follows standard HTTP rate limiting header conventions.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* // Connector returns rate limit headers
|
|
70
|
+
* response.headers = {
|
|
71
|
+
* 'x-continue-after': '1734567890' // Unix timestamp in seconds
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare const RATE_LIMIT_RESPONSE_HEADERS_SCHEMA: z.ZodObject<{
|
|
76
|
+
'x-continue-after': z.ZodOptional<z.ZodString>;
|
|
77
|
+
}, z.core.$strip>;
|
|
78
|
+
export type RateLimitResponseHeaders = z.infer<typeof RATE_LIMIT_RESPONSE_HEADERS_SCHEMA>;
|
|
@@ -43,4 +43,29 @@ export const CONNECTOR_REQUEST_HEADERS_SCHEMA = z.object({
|
|
|
43
43
|
'ce-auth': z.string(),
|
|
44
44
|
[CONNECTOR_ID_HEADER]: z.string(),
|
|
45
45
|
});
|
|
46
|
+
/**
|
|
47
|
+
* Response headers schema for APIs that support rate limiting.
|
|
48
|
+
*
|
|
49
|
+
* Connectors can optionally include these headers in their response
|
|
50
|
+
* to signal rate limit information to Content Engine, allowing it to
|
|
51
|
+
* respect third-party API rate limits.
|
|
52
|
+
*
|
|
53
|
+
* This follows standard HTTP rate limiting header conventions.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* // Connector returns rate limit headers
|
|
58
|
+
* response.headers = {
|
|
59
|
+
* 'x-continue-after': '1734567890' // Unix timestamp in seconds
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export const RATE_LIMIT_RESPONSE_HEADERS_SCHEMA = z.object({
|
|
64
|
+
/**
|
|
65
|
+
* Unix timestamp (in seconds) indicating when the rate limit window resets.
|
|
66
|
+
* Content Engine will delay subsequent requests until this time to respect
|
|
67
|
+
* third-party API rate limits.
|
|
68
|
+
*/
|
|
69
|
+
'x-continue-after': z.string().optional(),
|
|
70
|
+
});
|
|
46
71
|
//# sourceMappingURL=commonSchemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commonSchemas.js","sourceRoot":"","sources":["../../src/contracts/commonSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAEhE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,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;IACrB,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;CAClC,CAAC,CAAA;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,MAAM,CAAC;IACzD;;;;OAIG;IACH,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAA"}
|
|
@@ -35,7 +35,7 @@ export declare const getEnvContract: import("@lokalise/api-contracts").GetRouteD
|
|
|
35
35
|
'ce-config': z.ZodString;
|
|
36
36
|
'ce-auth': z.ZodString;
|
|
37
37
|
"x-connector-id": z.ZodString;
|
|
38
|
-
}, z.core.$strip>, false, false, {
|
|
38
|
+
}, z.core.$strip>, undefined, false, false, {
|
|
39
39
|
200: z.ZodObject<{
|
|
40
40
|
defaultLocale: z.ZodString;
|
|
41
41
|
locales: z.ZodArray<z.ZodObject<{
|
|
@@ -49,6 +49,8 @@ export declare const getItemListContract: import("@lokalise/api-contracts").GetR
|
|
|
49
49
|
'ce-config': z.ZodString;
|
|
50
50
|
'ce-auth': z.ZodString;
|
|
51
51
|
"x-connector-id": z.ZodString;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
'x-continue-after': z.ZodOptional<z.ZodString>;
|
|
52
54
|
}, z.core.$strip>, false, false, {
|
|
53
55
|
200: z.ZodObject<{
|
|
54
56
|
data: z.ZodArray<z.ZodObject<{
|
|
@@ -3,13 +3,15 @@ import { buildGetRoute } from '@lokalise/api-contracts';
|
|
|
3
3
|
import { toArrayPreprocessor } from '@lokalise/zod-extras';
|
|
4
4
|
import { z } from 'zod/v4';
|
|
5
5
|
import { MAX_TITLE_LENGTH } from "./cacheContracts.js";
|
|
6
|
-
import { COMMON_ERROR_RESPONSE_SCHEMA, CONNECTOR_REQUEST_HEADERS_SCHEMA, ITEM_IDENTIFIER_SCHEMA, } from "./commonSchemas.js";
|
|
6
|
+
import { COMMON_ERROR_RESPONSE_SCHEMA, CONNECTOR_REQUEST_HEADERS_SCHEMA, ITEM_IDENTIFIER_SCHEMA, RATE_LIMIT_RESPONSE_HEADERS_SCHEMA, } from "./commonSchemas.js";
|
|
7
7
|
export const itemListRequestQueryString = z.object({
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* If specified
|
|
9
|
+
* Maximum number of items to return in this response.
|
|
10
|
+
* If not specified, connector-specific default will be used.
|
|
11
|
+
* If specified value exceeds connector-specific default, the default value will be used instead.
|
|
12
|
+
* Connector should return min(limit, connector_default_limit).
|
|
11
13
|
*/
|
|
12
|
-
limit: z.coerce.number().optional(),
|
|
14
|
+
limit: z.coerce.number().int().positive().optional(),
|
|
13
15
|
/**
|
|
14
16
|
* Opaque connector-specific string that can be used to retrieve the next page of items.
|
|
15
17
|
* If not specified, the first page of items will be returned.
|
|
@@ -37,5 +39,6 @@ export const getItemListContract = buildGetRoute({
|
|
|
37
39
|
401: COMMON_ERROR_RESPONSE_SCHEMA,
|
|
38
40
|
},
|
|
39
41
|
requestHeaderSchema: CONNECTOR_REQUEST_HEADERS_SCHEMA,
|
|
42
|
+
responseHeaderSchema: RATE_LIMIT_RESPONSE_HEADERS_SCHEMA,
|
|
40
43
|
});
|
|
41
44
|
//# sourceMappingURL=itemListContracts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"itemListContracts.js","sourceRoot":"","sources":["../../src/contracts/itemListContracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,s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AAC,CAAA;AAE1E,MAAM,CAAC,MAAM,mBAAmB,GAAG,aAAa,CAAC;IAC/C,YAAY,EAAE,GAAG,EAAE,CAAC,WAAW;IAC/B,WAAW,EAAE,6BAA6B;IAC1C,kBAAkB,EAAE,0BAA0B;IAC9C,yBAAyB,EAAE,oBAAoB;IAC/C,2BAA2B,EAAE;QAC3B,GAAG,EAAE,oBAAoB;QACzB,GAAG,EAAE,4BAA4B;KAClC;IACD,mBAAmB,EAAE,gCAAgC;IACrD,oBAAoB,EAAE,kCAAkC;CACzD,CAAC,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Default maximum items to request from connectors per batch.
|
|
4
|
+
* Connectors may return fewer items based on their own constraints.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DEFAULT_MAX_ITEMS: 100;
|
|
7
|
+
/**
|
|
8
|
+
* Absolute maximum items limit to prevent excessive memory usage.
|
|
9
|
+
*/
|
|
10
|
+
export declare const MAX_ITEMS_LIMIT: 1000;
|
|
11
|
+
/**
|
|
12
|
+
* Common pagination metadata included in connector responses.
|
|
13
|
+
* Used to indicate if more data is available and how to fetch it.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PAGINATION_RESPONSE_METADATA_SCHEMA: z.ZodObject<{
|
|
16
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export type PaginationResponseMetadata = z.infer<typeof PAGINATION_RESPONSE_METADATA_SCHEMA>;
|
|
20
|
+
/**
|
|
21
|
+
* Common request parameters for pagination.
|
|
22
|
+
* Connectors should return min(maxItems, connector_default_limit).
|
|
23
|
+
*/
|
|
24
|
+
export declare const PAGINATION_REQUEST_PARAMS_SCHEMA: z.ZodObject<{
|
|
25
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
export type PaginationRequestParams = z.infer<typeof PAGINATION_REQUEST_PARAMS_SCHEMA>;
|
|
29
|
+
/**
|
|
30
|
+
* Helper to extend a response schema with pagination metadata
|
|
31
|
+
*/
|
|
32
|
+
export declare const withPaginationMetadata: <T extends z.ZodObject<z.ZodRawShape>>(schema: T) => z.ZodObject<{
|
|
33
|
+
readonly [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
34
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Default maximum items to request from connectors per batch.
|
|
4
|
+
* Connectors may return fewer items based on their own constraints.
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_MAX_ITEMS = 100;
|
|
7
|
+
/**
|
|
8
|
+
* Absolute maximum items limit to prevent excessive memory usage.
|
|
9
|
+
*/
|
|
10
|
+
export const MAX_ITEMS_LIMIT = 1000;
|
|
11
|
+
/**
|
|
12
|
+
* Common pagination metadata included in connector responses.
|
|
13
|
+
* Used to indicate if more data is available and how to fetch it.
|
|
14
|
+
*/
|
|
15
|
+
export const PAGINATION_RESPONSE_METADATA_SCHEMA = z.object({
|
|
16
|
+
/**
|
|
17
|
+
* Indicates whether more items are available beyond this response
|
|
18
|
+
*/
|
|
19
|
+
hasMore: z.boolean().optional(),
|
|
20
|
+
/**
|
|
21
|
+
* Opaque cursor string to retrieve the next page of results.
|
|
22
|
+
* Format is connector-specific.
|
|
23
|
+
*/
|
|
24
|
+
nextCursor: z.string().optional(),
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Common request parameters for pagination.
|
|
28
|
+
* Connectors should return min(maxItems, connector_default_limit).
|
|
29
|
+
*/
|
|
30
|
+
export const PAGINATION_REQUEST_PARAMS_SCHEMA = z.object({
|
|
31
|
+
/**
|
|
32
|
+
* Maximum number of items to return in this response.
|
|
33
|
+
* If not specified, connector-specific default will be used.
|
|
34
|
+
* If specified value exceeds connector-specific default, the default value will be used instead.
|
|
35
|
+
*/
|
|
36
|
+
maxItems: z.number().int().positive().max(MAX_ITEMS_LIMIT).optional(),
|
|
37
|
+
/**
|
|
38
|
+
* Opaque cursor string to continue from a previous request.
|
|
39
|
+
* Should be the value of `nextCursor` from the previous response.
|
|
40
|
+
* If not specified, processing starts from the beginning.
|
|
41
|
+
*/
|
|
42
|
+
cursor: z.string().optional(),
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Helper to extend a response schema with pagination metadata
|
|
46
|
+
*/
|
|
47
|
+
export const withPaginationMetadata = (schema) => {
|
|
48
|
+
return schema.extend(PAGINATION_RESPONSE_METADATA_SCHEMA.shape);
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=paginationSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"paginationSchemas.js","sourceRoot":"","sources":["../../src/contracts/paginationSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAY,CAAA;AAE7C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,IAAa,CAAA;AAE5C;;;GAGG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1D;;OAEG;IACH,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC/B;;;OAGG;IACH,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAA;AAIF;;;GAGG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IACvD;;;;OAIG;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,QAAQ,EAAE;IACrE;;;;OAIG;IACH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC9B,CAAC,CAAA;AAIF;;GAEG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAuC,MAAS,EAAE,EAAE;IACxF,OAAO,MAAM,CAAC,MAAM,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAA;AACjE,CAAC,CAAA"}
|
|
@@ -43,6 +43,8 @@ export declare const postPublishContract: import("@lokalise/api-contracts").Payl
|
|
|
43
43
|
'ce-config': z.ZodString;
|
|
44
44
|
'ce-auth': z.ZodString;
|
|
45
45
|
"x-connector-id": z.ZodString;
|
|
46
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
47
|
+
'x-continue-after': z.ZodOptional<z.ZodString>;
|
|
46
48
|
}, z.core.$strip>, false, false, {
|
|
47
49
|
200: z.ZodObject<{
|
|
48
50
|
statusCode: z.ZodNumber;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildPayloadRoute } from '@lokalise/api-contracts';
|
|
2
2
|
import { z } from 'zod/v4';
|
|
3
|
-
import { CONNECTOR_REQUEST_HEADERS_SCHEMA, CONTENT_ITEM_SCHEMA } from "./commonSchemas.js";
|
|
3
|
+
import { CONNECTOR_REQUEST_HEADERS_SCHEMA, CONTENT_ITEM_SCHEMA, RATE_LIMIT_RESPONSE_HEADERS_SCHEMA, } from "./commonSchemas.js";
|
|
4
4
|
export const publishRequestBody = z.object({
|
|
5
5
|
items: z.array(CONTENT_ITEM_SCHEMA),
|
|
6
6
|
defaultLocale: z.string(),
|
|
@@ -28,5 +28,6 @@ export const postPublishContract = buildPayloadRoute({
|
|
|
28
28
|
200: publishResponseBody,
|
|
29
29
|
},
|
|
30
30
|
requestHeaderSchema: CONNECTOR_REQUEST_HEADERS_SCHEMA,
|
|
31
|
+
responseHeaderSchema: RATE_LIMIT_RESPONSE_HEADERS_SCHEMA,
|
|
31
32
|
});
|
|
32
33
|
//# sourceMappingURL=publishContracts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publishContracts.js","sourceRoot":"","sources":["../../src/contracts/publishContracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"publishContracts.js","sourceRoot":"","sources":["../../src/contracts/publishContracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EACL,gCAAgC,EAChC,mBAAmB,EACnB,kCAAkC,GACnC,MAAM,oBAAoB,CAAA;AAE3B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;IACnC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,OAAO,EAAE,CAAC;SACP,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;YAChB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;SACnC,CAAC;KACH,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAA;AAKF,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,CAAC;IACnD,YAAY,EAAE,GAAG,EAAE,CAAC,UAAU;IAC9B,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,wCAAwC;IACrD,iBAAiB,EAAE,kBAAkB;IACrC,yBAAyB,EAAE,mBAAmB;IAC9C,2BAA2B,EAAE;QAC3B,GAAG,EAAE,mBAAmB;KACzB;IACD,mBAAmB,EAAE,gCAAgC;IACrD,oBAAoB,EAAE,kCAAkC;CACzD,CAAC,CAAA"}
|
|
@@ -7,6 +7,8 @@ export declare const translateRequestBody: z.ZodObject<{
|
|
|
7
7
|
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
8
8
|
}, z.core.$strip>>;
|
|
9
9
|
defaultLocale: z.ZodString;
|
|
10
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
12
|
}, z.core.$strip>;
|
|
11
13
|
export declare const translateResponseBody: z.ZodObject<{
|
|
12
14
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -22,6 +24,8 @@ export declare const translateResponseBody: z.ZodObject<{
|
|
|
22
24
|
errors: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
23
25
|
}, z.core.$strip>;
|
|
24
26
|
}, z.core.$strip>>;
|
|
27
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
25
29
|
}, z.core.$strip>;
|
|
26
30
|
export type ReferenceProcessingMode = 'no-references-export' | 'export-all-references' | 'export-without-slugs';
|
|
27
31
|
export type TranslateRequestBody = z.infer<typeof translateRequestBody>;
|
|
@@ -34,6 +38,8 @@ export declare const postTranslateContract: import("@lokalise/api-contracts").Pa
|
|
|
34
38
|
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
35
39
|
}, z.core.$strip>>;
|
|
36
40
|
defaultLocale: z.ZodString;
|
|
41
|
+
maxItems: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
37
43
|
}, z.core.$strip>, z.ZodObject<{
|
|
38
44
|
items: z.ZodArray<z.ZodObject<{
|
|
39
45
|
uniqueId: z.ZodString;
|
|
@@ -48,10 +54,14 @@ export declare const postTranslateContract: import("@lokalise/api-contracts").Pa
|
|
|
48
54
|
errors: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
49
55
|
}, z.core.$strip>;
|
|
50
56
|
}, z.core.$strip>>;
|
|
57
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
51
59
|
}, z.core.$strip>, undefined, undefined, z.ZodObject<{
|
|
52
60
|
'ce-config': z.ZodString;
|
|
53
61
|
'ce-auth': z.ZodString;
|
|
54
62
|
"x-connector-id": z.ZodString;
|
|
63
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
64
|
+
'x-continue-after': z.ZodOptional<z.ZodString>;
|
|
55
65
|
}, z.core.$strip>, false, false, {
|
|
56
66
|
200: z.ZodObject<{
|
|
57
67
|
items: z.ZodArray<z.ZodObject<{
|
|
@@ -67,6 +77,8 @@ export declare const postTranslateContract: import("@lokalise/api-contracts").Pa
|
|
|
67
77
|
errors: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
68
78
|
}, z.core.$strip>;
|
|
69
79
|
}, z.core.$strip>>;
|
|
80
|
+
hasMore: z.ZodOptional<z.ZodBoolean>;
|
|
81
|
+
nextCursor: z.ZodOptional<z.ZodString>;
|
|
70
82
|
}, z.core.$strip>;
|
|
71
83
|
403: z.ZodObject<{
|
|
72
84
|
statusCode: z.ZodNumber;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { buildPayloadRoute } from '@lokalise/api-contracts';
|
|
2
2
|
import { z } from 'zod/v4';
|
|
3
|
-
import { COMMON_ERROR_RESPONSE_SCHEMA, CONNECTOR_REQUEST_HEADERS_SCHEMA, CONTENT_ITEM_SCHEMA, ITEM_IDENTIFIER_SCHEMA, } from "./commonSchemas.js";
|
|
4
|
-
|
|
3
|
+
import { COMMON_ERROR_RESPONSE_SCHEMA, CONNECTOR_REQUEST_HEADERS_SCHEMA, CONTENT_ITEM_SCHEMA, ITEM_IDENTIFIER_SCHEMA, RATE_LIMIT_RESPONSE_HEADERS_SCHEMA, } from "./commonSchemas.js";
|
|
4
|
+
import { PAGINATION_REQUEST_PARAMS_SCHEMA, PAGINATION_RESPONSE_METADATA_SCHEMA, } from "./paginationSchemas.js";
|
|
5
|
+
export const translateRequestBody = z
|
|
6
|
+
.object({
|
|
5
7
|
locales: z.array(z.string()),
|
|
6
8
|
items: z.array(ITEM_IDENTIFIER_SCHEMA),
|
|
7
9
|
defaultLocale: z.string(),
|
|
8
|
-
})
|
|
9
|
-
|
|
10
|
+
})
|
|
11
|
+
.extend(PAGINATION_REQUEST_PARAMS_SCHEMA.shape);
|
|
12
|
+
export const translateResponseBody = z
|
|
13
|
+
.object({
|
|
10
14
|
items: z.array(CONTENT_ITEM_SCHEMA),
|
|
11
15
|
payload: z
|
|
12
16
|
.object({
|
|
@@ -17,7 +21,8 @@ export const translateResponseBody = z.object({
|
|
|
17
21
|
}),
|
|
18
22
|
})
|
|
19
23
|
.optional(),
|
|
20
|
-
})
|
|
24
|
+
})
|
|
25
|
+
.extend(PAGINATION_RESPONSE_METADATA_SCHEMA.shape);
|
|
21
26
|
export const postTranslateContract = buildPayloadRoute({
|
|
22
27
|
pathResolver: () => `/translate`,
|
|
23
28
|
method: 'post',
|
|
@@ -29,5 +34,6 @@ export const postTranslateContract = buildPayloadRoute({
|
|
|
29
34
|
403: COMMON_ERROR_RESPONSE_SCHEMA,
|
|
30
35
|
},
|
|
31
36
|
requestHeaderSchema: CONNECTOR_REQUEST_HEADERS_SCHEMA,
|
|
37
|
+
responseHeaderSchema: RATE_LIMIT_RESPONSE_HEADERS_SCHEMA,
|
|
32
38
|
});
|
|
33
39
|
//# sourceMappingURL=translateContracts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translateContracts.js","sourceRoot":"","sources":["../../src/contracts/translateContracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,mBAAmB,EACnB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"translateContracts.js","sourceRoot":"","sources":["../../src/contracts/translateContracts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EACL,4BAA4B,EAC5B,gCAAgC,EAChC,mBAAmB,EACnB,sBAAsB,EACtB,kCAAkC,GACnC,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,gCAAgC,EAChC,mCAAmC,GACpC,MAAM,wBAAwB,CAAA;AAE/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC;KAClC,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC;IACtC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC;KACD,MAAM,CAAC,gCAAgC,CAAC,KAAK,CAAC,CAAA;AAEjD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC;KACnC,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,mBAAmB,CAAC;IACnC,OAAO,EAAE,CAAC;SACP,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;QACrB,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;YAChB,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;SACnC,CAAC;KACH,CAAC;SACD,QAAQ,EAAE;CACd,CAAC;KACD,MAAM,CAAC,mCAAmC,CAAC,KAAK,CAAC,CAAA;AAUpD,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;IACrD,YAAY,EAAE,GAAG,EAAE,CAAC,YAAY;IAChC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,wCAAwC;IACrD,iBAAiB,EAAE,oBAAoB;IACvC,yBAAyB,EAAE,qBAAqB;IAChD,2BAA2B,EAAE;QAC3B,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,4BAA4B;KAClC;IACD,mBAAmB,EAAE,gCAAgC;IACrD,oBAAoB,EAAE,kCAAkC;CACzD,CAAC,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from './contracts/commonSchemas.ts';
|
|
|
4
4
|
export * from './contracts/connectorApiConstants.ts';
|
|
5
5
|
export * from './contracts/envContracts.ts';
|
|
6
6
|
export * from './contracts/itemListContracts.ts';
|
|
7
|
+
export * from './contracts/paginationSchemas.ts';
|
|
7
8
|
export * from './contracts/publishContracts.ts';
|
|
8
9
|
export * from './contracts/translateContracts.ts';
|
|
9
10
|
export * from './utils/nextParamUtils.ts';
|
package/dist/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./contracts/commonSchemas.js";
|
|
|
4
4
|
export * from "./contracts/connectorApiConstants.js";
|
|
5
5
|
export * from "./contracts/envContracts.js";
|
|
6
6
|
export * from "./contracts/itemListContracts.js";
|
|
7
|
+
export * from "./contracts/paginationSchemas.js";
|
|
7
8
|
export * from "./contracts/publishContracts.js";
|
|
8
9
|
export * from "./contracts/translateContracts.js";
|
|
9
10
|
export * from "./utils/nextParamUtils.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sCAAsC,CAAA;AACpD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,8BAA8B,CAAA;AAC5C,cAAc,sCAAsC,CAAA;AACpD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,mCAAmC,CAAA;AACjD,cAAc,2BAA2B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lokalise/connector-api-contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Lokalise Connector API schemas and contracts",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"url": "https://github.com/lokalise/service-contracts.git"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@lokalise/api-contracts": "^
|
|
32
|
+
"@lokalise/api-contracts": "^6.0.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"@lokalise/api-common": ">=6.1.0",
|