@lokalise/connector-api-contracts 0.9.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 +3 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/authSchemas.d.ts +12 -0
- package/dist/schemas/authSchemas.js +7 -0
- package/dist/schemas/authSchemas.js.map +1 -0
- package/dist/schemas/cacheSchemas.d.ts +58 -0
- package/dist/schemas/cacheSchemas.js +40 -0
- package/dist/schemas/cacheSchemas.js.map +1 -0
- package/dist/schemas/commonSchemas.d.ts +23 -0
- package/dist/schemas/commonSchemas.js +21 -0
- package/dist/schemas/commonSchemas.js.map +1 -0
- package/dist/schemas/envSchemas.d.ts +23 -0
- package/dist/schemas/envSchemas.js +12 -0
- package/dist/schemas/envSchemas.js.map +1 -0
- package/dist/schemas/publishSchemas.d.ts +23 -0
- package/dist/schemas/publishSchemas.js +20 -0
- package/dist/schemas/publishSchemas.js.map +1 -0
- package/dist/schemas/translateSchemas.d.ts +28 -0
- package/dist/schemas/translateSchemas.js +20 -0
- package/dist/schemas/translateSchemas.js.map +1 -0
- package/dist/utils/nextParamUtils.d.ts +7 -0
- package/dist/utils/nextParamUtils.js +15 -0
- package/dist/utils/nextParamUtils.js.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './schemas/authSchemas.ts';
|
|
2
|
+
export * from './schemas/cacheSchemas.ts';
|
|
3
|
+
export * from './schemas/commonSchemas.ts';
|
|
4
|
+
export * from './schemas/envSchemas.ts';
|
|
5
|
+
export * from './schemas/publishSchemas.ts';
|
|
6
|
+
export * from './schemas/translateSchemas.ts';
|
|
7
|
+
export * from './utils/nextParamUtils.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from "./schemas/authSchemas.js";
|
|
2
|
+
export * from "./schemas/cacheSchemas.js";
|
|
3
|
+
export * from "./schemas/commonSchemas.js";
|
|
4
|
+
export * from "./schemas/envSchemas.js";
|
|
5
|
+
export * from "./schemas/publishSchemas.js";
|
|
6
|
+
export * from "./schemas/translateSchemas.js";
|
|
7
|
+
export * from "./utils/nextParamUtils.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA;AAC1C,cAAc,yBAAyB,CAAA;AACvC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,+BAA+B,CAAA;AAC7C,cAAc,2BAA2B,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const getAuthResponseBody: z.ZodObject<{
|
|
3
|
+
type: z.ZodEnum<{
|
|
4
|
+
OAuth: "OAuth";
|
|
5
|
+
apiToken: "apiToken";
|
|
6
|
+
}>;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export declare const postAuthResponseBody: z.ZodObject<{}, z.core.$loose>;
|
|
9
|
+
export type GetAuthResponseBody = z.infer<typeof getAuthResponseBody>;
|
|
10
|
+
export type PostAuthResponseBody = Record<string, unknown> & {
|
|
11
|
+
url?: string;
|
|
12
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
const AUTH_TYPES_AVAILABLE = ['OAuth', 'apiToken'];
|
|
3
|
+
export const getAuthResponseBody = z.object({
|
|
4
|
+
type: z.enum(AUTH_TYPES_AVAILABLE),
|
|
5
|
+
});
|
|
6
|
+
export const postAuthResponseBody = z.looseObject({});
|
|
7
|
+
//# sourceMappingURL=authSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authSchemas.js","sourceRoot":"","sources":["../../src/schemas/authSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,MAAM,oBAAoB,GAAG,CAAC,OAAO,EAAE,UAAU,CAAU,CAAA;AAE3D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC;CACnC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const MAX_TITLE_LENGTH = 256;
|
|
3
|
+
export declare const cacheItem: z.ZodObject<{
|
|
4
|
+
uniqueId: z.ZodString;
|
|
5
|
+
groupId: z.ZodString;
|
|
6
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
7
|
+
fields: z.ZodObject<{}, z.core.$loose>;
|
|
8
|
+
title: z.ZodString;
|
|
9
|
+
groupTitle: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const partialCacheItem: z.ZodObject<{
|
|
12
|
+
uniqueId: z.ZodString;
|
|
13
|
+
groupId: z.ZodString;
|
|
14
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
15
|
+
fields: z.ZodObject<{}, z.core.$loose>;
|
|
16
|
+
title: z.ZodString;
|
|
17
|
+
groupTitle: z.ZodString;
|
|
18
|
+
updatedAtTimestamp: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
export declare const listCacheRequestQueryString: z.ZodObject<{
|
|
21
|
+
next: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
export declare const listCacheResponseBody: z.ZodObject<{
|
|
24
|
+
items: z.ZodArray<z.ZodObject<{
|
|
25
|
+
uniqueId: z.ZodString;
|
|
26
|
+
groupId: z.ZodString;
|
|
27
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
28
|
+
}, z.core.$strip>>;
|
|
29
|
+
next: z.ZodOptional<z.ZodString>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export declare const cacheResponseBody: z.ZodObject<{
|
|
32
|
+
items: z.ZodArray<z.ZodObject<{
|
|
33
|
+
uniqueId: z.ZodString;
|
|
34
|
+
groupId: z.ZodString;
|
|
35
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
36
|
+
fields: z.ZodObject<{}, z.core.$loose>;
|
|
37
|
+
title: z.ZodString;
|
|
38
|
+
groupTitle: z.ZodString;
|
|
39
|
+
}, z.core.$strip>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export declare const cacheRequestBody: z.ZodObject<{
|
|
42
|
+
items: z.ZodArray<z.ZodObject<{
|
|
43
|
+
uniqueId: z.ZodString;
|
|
44
|
+
groupId: z.ZodString;
|
|
45
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
46
|
+
}, z.core.$strip>>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
export type CacheItem = z.infer<typeof cacheItem>;
|
|
49
|
+
export type PartialCacheItem = z.infer<typeof partialCacheItem>;
|
|
50
|
+
export declare const buildUniqueId: (entryId: string, fieldId: string) => string;
|
|
51
|
+
export declare const parseUniqueId: (uniqueId: string) => {
|
|
52
|
+
entryId: string | undefined;
|
|
53
|
+
fieldId: string | undefined;
|
|
54
|
+
};
|
|
55
|
+
export type ListCacheRequestQueryString = z.infer<typeof listCacheRequestQueryString>;
|
|
56
|
+
export type ListCacheResponseBody = z.infer<typeof listCacheResponseBody>;
|
|
57
|
+
export type CacheRequestBody = z.infer<typeof cacheRequestBody>;
|
|
58
|
+
export type CacheResponseBody = z.infer<typeof cacheResponseBody>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { isValidNextParam } from "../utils/nextParamUtils.js";
|
|
3
|
+
import { itemIdentifier } from "./commonSchemas.js";
|
|
4
|
+
export const MAX_TITLE_LENGTH = 256;
|
|
5
|
+
export const cacheItem = itemIdentifier.extend({
|
|
6
|
+
fields: z.looseObject({}),
|
|
7
|
+
title: z.string().max(MAX_TITLE_LENGTH),
|
|
8
|
+
groupTitle: z.string().max(MAX_TITLE_LENGTH),
|
|
9
|
+
});
|
|
10
|
+
export const partialCacheItem = cacheItem.extend({
|
|
11
|
+
updatedAtTimestamp: z.number().optional(),
|
|
12
|
+
});
|
|
13
|
+
export const listCacheRequestQueryString = z
|
|
14
|
+
.object({
|
|
15
|
+
next: z
|
|
16
|
+
.string()
|
|
17
|
+
.includes(':', {
|
|
18
|
+
message: 'Must include skip and limit values separated by colon `{skip}:{limit}`',
|
|
19
|
+
})
|
|
20
|
+
.optional(),
|
|
21
|
+
})
|
|
22
|
+
.refine(({ next }) => !next || isValidNextParam(next), {
|
|
23
|
+
message: 'Must contain skip and limit numeric values divided by colon',
|
|
24
|
+
});
|
|
25
|
+
export const listCacheResponseBody = z.object({
|
|
26
|
+
items: z.array(itemIdentifier),
|
|
27
|
+
next: z.string().optional(),
|
|
28
|
+
});
|
|
29
|
+
export const cacheResponseBody = z.object({
|
|
30
|
+
items: z.array(cacheItem),
|
|
31
|
+
});
|
|
32
|
+
export const cacheRequestBody = z.object({
|
|
33
|
+
items: z.array(itemIdentifier),
|
|
34
|
+
});
|
|
35
|
+
export const buildUniqueId = (entryId, fieldId) => `${entryId}:${fieldId}`;
|
|
36
|
+
export const parseUniqueId = (uniqueId) => {
|
|
37
|
+
const [entryId, fieldId] = uniqueId.split(':');
|
|
38
|
+
return { entryId, fieldId };
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=cacheSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cacheSchemas.js","sourceRoot":"","sources":["../../src/schemas/cacheSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAEnC,MAAM,CAAC,MAAM,SAAS,GAAG,cAAc,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;IACzB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,gBAAgB,CAAC;CAC7C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CAAC;IAC/C,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC;KACzC,MAAM,CAAC;IACN,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,CAAC,GAAG,EAAE;QACb,OAAO,EAAE,wEAAwE;KAClF,CAAC;SACD,QAAQ,EAAE;CACd,CAAC;KACD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,gBAAgB,CAAC,IAAI,CAAC,EAAE;IACrD,OAAO,EAAE,6DAA6D;CACvE,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IAC9B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC;CAC1B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;CAC/B,CAAC,CAAA;AAKF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,OAAe,EAAE,EAAE,CAAC,GAAG,OAAO,IAAI,OAAO,EAAE,CAAA;AAC1F,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAgB,EAAE,EAAE;IAChD,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC9C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAA;AAC7B,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const itemIdentifier: z.ZodObject<{
|
|
3
|
+
uniqueId: z.ZodString;
|
|
4
|
+
groupId: z.ZodString;
|
|
5
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
6
|
+
}, z.core.$strip>;
|
|
7
|
+
export declare const contentItem: z.ZodObject<{
|
|
8
|
+
uniqueId: z.ZodString;
|
|
9
|
+
groupId: z.ZodString;
|
|
10
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
11
|
+
translations: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
12
|
+
}, z.core.$strip>;
|
|
13
|
+
export declare const apiError: z.ZodObject<{
|
|
14
|
+
message: z.ZodString;
|
|
15
|
+
statusCode: z.ZodNumber;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export declare const authError: z.ZodObject<{
|
|
18
|
+
message: z.ZodString;
|
|
19
|
+
errorCode: z.ZodNumber;
|
|
20
|
+
details: z.ZodObject<{}, z.core.$loose>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export declare const integrationConfig: z.ZodObject<{}, z.core.$loose>;
|
|
23
|
+
export declare const authConfig: z.ZodObject<{}, z.core.$loose>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export const itemIdentifier = z.object({
|
|
3
|
+
uniqueId: z.string(),
|
|
4
|
+
groupId: z.string(),
|
|
5
|
+
metadata: z.record(z.any(), z.any()),
|
|
6
|
+
});
|
|
7
|
+
export const contentItem = itemIdentifier.extend({
|
|
8
|
+
translations: z.record(z.string(), z.string()),
|
|
9
|
+
});
|
|
10
|
+
export const apiError = z.object({
|
|
11
|
+
message: z.string(),
|
|
12
|
+
statusCode: z.number(),
|
|
13
|
+
});
|
|
14
|
+
export const authError = z.object({
|
|
15
|
+
message: z.string(),
|
|
16
|
+
errorCode: z.number(),
|
|
17
|
+
details: z.looseObject({}),
|
|
18
|
+
});
|
|
19
|
+
export const integrationConfig = z.looseObject({});
|
|
20
|
+
export const authConfig = z.looseObject({});
|
|
21
|
+
//# sourceMappingURL=commonSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonSchemas.js","sourceRoot":"","sources":["../../src/schemas/commonSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC;CACrC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC,MAAM,CAAC;IAC/C,YAAY,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;CAC/C,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;CACvB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,OAAO,EAAE,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC;CAC3B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA;AAElD,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,CAAC,WAAW,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const localeDefinition: z.ZodObject<{
|
|
3
|
+
defaultLocale: z.ZodString;
|
|
4
|
+
locales: z.ZodArray<z.ZodObject<{
|
|
5
|
+
name: z.ZodString;
|
|
6
|
+
code: z.ZodString;
|
|
7
|
+
}, z.core.$strip>>;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare const envResponseBody: z.ZodObject<{
|
|
10
|
+
defaultLocale: z.ZodString;
|
|
11
|
+
locales: z.ZodArray<z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
code: z.ZodString;
|
|
14
|
+
}, z.core.$strip>>;
|
|
15
|
+
cacheItemStructure: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export type EnvCacheItemStructure = {
|
|
18
|
+
id: string;
|
|
19
|
+
contentType: string;
|
|
20
|
+
updatedAt: string;
|
|
21
|
+
};
|
|
22
|
+
export type EnvLocaleDefinition = z.infer<typeof localeDefinition>;
|
|
23
|
+
export type EnvResponseBody = z.infer<typeof envResponseBody>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export const localeDefinition = z.object({
|
|
3
|
+
defaultLocale: z.string(),
|
|
4
|
+
locales: z.array(z.object({
|
|
5
|
+
name: z.string(),
|
|
6
|
+
code: z.string(),
|
|
7
|
+
})),
|
|
8
|
+
});
|
|
9
|
+
export const envResponseBody = localeDefinition.extend({
|
|
10
|
+
cacheItemStructure: z.record(z.string(), z.string()),
|
|
11
|
+
});
|
|
12
|
+
//# sourceMappingURL=envSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"envSchemas.js","sourceRoot":"","sources":["../../src/schemas/envSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;IACzB,OAAO,EAAE,CAAC,CAAC,KAAK,CACd,CAAC,CAAC,MAAM,CAAC;QACP,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;KACjB,CAAC,CACH;CACF,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAC,MAAM,CAAC;IACrD,kBAAkB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;CACrD,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const publishRequestBody: z.ZodObject<{
|
|
3
|
+
items: z.ZodArray<z.ZodObject<{
|
|
4
|
+
uniqueId: z.ZodString;
|
|
5
|
+
groupId: z.ZodString;
|
|
6
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
7
|
+
translations: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
8
|
+
}, z.core.$strip>>;
|
|
9
|
+
defaultLocale: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const publishResponseBody: z.ZodObject<{
|
|
12
|
+
statusCode: z.ZodNumber;
|
|
13
|
+
message: z.ZodOptional<z.ZodString>;
|
|
14
|
+
payload: z.ZodOptional<z.ZodObject<{
|
|
15
|
+
message: z.ZodString;
|
|
16
|
+
errorCode: z.ZodString;
|
|
17
|
+
details: z.ZodObject<{
|
|
18
|
+
errors: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
}, z.core.$strip>>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
export type PublishRequestBody = z.infer<typeof publishRequestBody>;
|
|
23
|
+
export type PublishResponseBody = z.infer<typeof publishResponseBody>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { contentItem } from "./commonSchemas.js";
|
|
3
|
+
export const publishRequestBody = z.object({
|
|
4
|
+
items: z.array(contentItem),
|
|
5
|
+
defaultLocale: z.string(),
|
|
6
|
+
});
|
|
7
|
+
export const publishResponseBody = z.object({
|
|
8
|
+
statusCode: z.number(),
|
|
9
|
+
message: z.string().optional(),
|
|
10
|
+
payload: z
|
|
11
|
+
.object({
|
|
12
|
+
message: z.string(),
|
|
13
|
+
errorCode: z.string(),
|
|
14
|
+
details: z.object({
|
|
15
|
+
errors: z.array(z.looseObject({})),
|
|
16
|
+
}),
|
|
17
|
+
})
|
|
18
|
+
.optional(),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=publishSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publishSchemas.js","sourceRoot":"","sources":["../../src/schemas/publishSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAEhD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;IAC3B,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"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
export declare const translateRequestBody: z.ZodObject<{
|
|
3
|
+
locales: z.ZodArray<z.ZodString>;
|
|
4
|
+
items: z.ZodArray<z.ZodObject<{
|
|
5
|
+
uniqueId: z.ZodString;
|
|
6
|
+
groupId: z.ZodString;
|
|
7
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
8
|
+
}, z.core.$strip>>;
|
|
9
|
+
defaultLocale: z.ZodString;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare const translateResponseBody: z.ZodObject<{
|
|
12
|
+
items: z.ZodArray<z.ZodObject<{
|
|
13
|
+
uniqueId: z.ZodString;
|
|
14
|
+
groupId: z.ZodString;
|
|
15
|
+
metadata: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
16
|
+
translations: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
17
|
+
}, z.core.$strip>>;
|
|
18
|
+
payload: z.ZodOptional<z.ZodObject<{
|
|
19
|
+
message: z.ZodString;
|
|
20
|
+
errorCode: z.ZodString;
|
|
21
|
+
details: z.ZodObject<{
|
|
22
|
+
errors: z.ZodArray<z.ZodObject<{}, z.core.$loose>>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
}, z.core.$strip>>;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type ReferenceProcessingMode = 'no-references-export' | 'export-all-references' | 'export-without-slugs';
|
|
27
|
+
export type TranslateRequestBody = z.infer<typeof translateRequestBody>;
|
|
28
|
+
export type TranslateResponseBody = z.infer<typeof translateResponseBody>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { contentItem, itemIdentifier } from "./commonSchemas.js";
|
|
3
|
+
export const translateRequestBody = z.object({
|
|
4
|
+
locales: z.array(z.string()),
|
|
5
|
+
items: z.array(itemIdentifier),
|
|
6
|
+
defaultLocale: z.string(),
|
|
7
|
+
});
|
|
8
|
+
export const translateResponseBody = z.object({
|
|
9
|
+
items: z.array(contentItem),
|
|
10
|
+
payload: z
|
|
11
|
+
.object({
|
|
12
|
+
message: z.string(),
|
|
13
|
+
errorCode: z.string(),
|
|
14
|
+
details: z.object({
|
|
15
|
+
errors: z.array(z.looseObject({})),
|
|
16
|
+
}),
|
|
17
|
+
})
|
|
18
|
+
.optional(),
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=translateSchemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"translateSchemas.js","sourceRoot":"","sources":["../../src/schemas/translateSchemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEhE,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;IAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC;IAC9B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE;CAC1B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;IAC3B,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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type NextPageCursor = {
|
|
2
|
+
skip: number;
|
|
3
|
+
limit: number;
|
|
4
|
+
};
|
|
5
|
+
export declare const encodeNextParam: (next: NextPageCursor) => string;
|
|
6
|
+
export declare const isValidNextParam: (nextParam: string) => boolean;
|
|
7
|
+
export declare const decodeNextParam: (nextParam: string) => NextPageCursor;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const encodeNextParam = (next) => {
|
|
2
|
+
return [next.skip, next.limit].join(':');
|
|
3
|
+
};
|
|
4
|
+
export const isValidNextParam = (nextParam) => {
|
|
5
|
+
const [skip, limit] = nextParam.split(':');
|
|
6
|
+
return (Number.isSafeInteger(Number(skip)) &&
|
|
7
|
+
Number.isSafeInteger(Number(limit)) &&
|
|
8
|
+
Number(skip) >= 0 &&
|
|
9
|
+
Number(limit) > 0);
|
|
10
|
+
};
|
|
11
|
+
export const decodeNextParam = (nextParam) => {
|
|
12
|
+
const [skip, limit] = nextParam.split(':');
|
|
13
|
+
return { skip: Number(skip), limit: Number(limit) };
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=nextParamUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nextParamUtils.js","sourceRoot":"","sources":["../../src/utils/nextParamUtils.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,IAAoB,EAAU,EAAE;IAC9D,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AAC1C,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,SAAiB,EAAW,EAAE;IAC7D,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC1C,OAAO,CACL,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;QACjB,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAClB,CAAA;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,SAAiB,EAAkB,EAAE;IACnE,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CAAA;AACrD,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@lokalise/connector-api-contracts",
|
|
3
|
+
"version": "0.9.0",
|
|
4
|
+
"description": "Lokalise Connector API schemas and contracts",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/index.js",
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"private": false,
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"access": "public"
|
|
17
|
+
},
|
|
18
|
+
"sideEffects": false,
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clean": "rimraf dist",
|
|
21
|
+
"build": "rimraf dist && tsc --project tsconfig.build.json",
|
|
22
|
+
"lint": "biome check . && tsc",
|
|
23
|
+
"lint:fix": "biome check --write",
|
|
24
|
+
"test": "vitest --coverage",
|
|
25
|
+
"package-version": "echo $npm_package_version"
|
|
26
|
+
},
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "https://github.com/lokalise/service-contracts.git"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@lokalise/api-contracts": "^5.0.0",
|
|
33
|
+
"zod": "^3.25.76"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@types/node": "^22.17.2",
|
|
37
|
+
"@biomejs/biome": "^2.2.0",
|
|
38
|
+
"@lokalise/biome-config": "^3.1.0",
|
|
39
|
+
"@lokalise/tsconfig": "^2.0.0",
|
|
40
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
41
|
+
"rimraf": "^6.0.1",
|
|
42
|
+
"typescript": "^5.9.2",
|
|
43
|
+
"vitest": "^3.2.3"
|
|
44
|
+
}
|
|
45
|
+
}
|