@lokalise/glossary-api-contracts 0.6.0 → 0.7.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/api/contracts/glossaries/confirm-import-upload-completion.d.ts +1 -7
- package/dist/api/contracts/glossaries/confirm-import-upload-completion.js +2 -9
- package/dist/api/contracts/glossaries/confirm-import-upload-completion.js.map +1 -1
- package/dist/api/errors/glossaryErrors.d.ts +0 -10
- package/dist/api/errors/glossaryErrors.js +0 -4
- package/dist/api/errors/glossaryErrors.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import z from 'zod/v4';
|
|
2
2
|
declare const CONFIRM_IMPORT_UPLOAD_COMPLETION_REQUEST_BODY_SCHEMA: z.ZodObject<{
|
|
3
3
|
fileId: z.ZodUUID;
|
|
4
|
-
sourceLocale: z.ZodString;
|
|
5
4
|
}, z.core.$strip>;
|
|
6
5
|
export type ConfirmImportUploadCompletionRequestBody = z.infer<typeof CONFIRM_IMPORT_UPLOAD_COMPLETION_REQUEST_BODY_SCHEMA>;
|
|
7
6
|
declare const CONFIRM_IMPORT_UPLOAD_COMPLETION_RESPONSE_BODY_SCHEMA: z.ZodObject<{
|
|
@@ -13,7 +12,7 @@ export type ConfirmImportUploadCompletionResponseBody = z.infer<typeof CONFIRM_I
|
|
|
13
12
|
export declare const confirmImportUploadCompletionContract: Omit<{
|
|
14
13
|
readonly method: "post";
|
|
15
14
|
readonly summary: "Import an uploaded file into a glossary";
|
|
16
|
-
readonly description: "Imports the file of an upload form into the glossary, after the client posted the file to the storage. The import turns each row of the CSV file that Expert exports into a concept with its terms. A failed import does not store any term. The import consumes the upload, so a second confirmation of the same upload gets 400. While another import into the glossary runs, the confirmation gets 409 and keeps the upload. The import has a time limit of 30 seconds. An import that reaches the limit before its commit stops and gets 503, and an import whose commit ends after the limit gets 200. When the client closes the connection before the import commits, the import stops, and the service ends the request with 400. After a 503, the client starts again with a new upload form, because the service might have consumed the upload already.";
|
|
15
|
+
readonly description: "Imports the file of an upload form into the glossary, after the client posted the file to the storage. The import turns each row of the CSV file that Expert exports into a concept with its terms. The `term` column gets the locale of the first language column of the file, and a file without a language column or with a first language column that is not a locale gets 400. A failed import does not store any term. The import consumes the upload, so a second confirmation of the same upload gets 400. While another import into the glossary runs, the confirmation gets 409 and keeps the upload. The import has a time limit of 30 seconds. An import that reaches the limit before its commit stops and gets 503, and an import whose commit ends after the limit gets 200. When the client closes the connection before the import commits, the import stops, and the service ends the request with 400. After a 503, the client starts again with a new upload form, because the service might have consumed the upload already.";
|
|
17
16
|
readonly tags: readonly ["Glossaries"];
|
|
18
17
|
readonly visibility: "internal";
|
|
19
18
|
readonly requestPathParamsSchema: z.ZodObject<{
|
|
@@ -22,7 +21,6 @@ export declare const confirmImportUploadCompletionContract: Omit<{
|
|
|
22
21
|
}, z.core.$strip>;
|
|
23
22
|
readonly requestBodySchema: z.ZodObject<{
|
|
24
23
|
fileId: z.ZodUUID;
|
|
25
|
-
sourceLocale: z.ZodString;
|
|
26
24
|
}, z.core.$strip>;
|
|
27
25
|
readonly requestHeaderSchema: z.ZodObject<{
|
|
28
26
|
authorization: z.ZodOptional<z.ZodString>;
|
|
@@ -41,10 +39,6 @@ export declare const confirmImportUploadCompletionContract: Omit<{
|
|
|
41
39
|
message: z.ZodString;
|
|
42
40
|
code: z.ZodLiteral<"INVALID_IMPORT_FILE">;
|
|
43
41
|
errorCode: z.ZodLiteral<"INVALID_IMPORT_FILE">;
|
|
44
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
45
|
-
message: z.ZodString;
|
|
46
|
-
code: z.ZodLiteral<"INVALID_SOURCE_LOCALE">;
|
|
47
|
-
errorCode: z.ZodLiteral<"INVALID_SOURCE_LOCALE">;
|
|
48
42
|
}, z.core.$strip>, z.ZodObject<{
|
|
49
43
|
message: z.ZodString;
|
|
50
44
|
code: z.ZodLiteral<"IMPORT_FILE_NOT_FOUND">;
|
|
@@ -2,10 +2,9 @@ import { defineApiContract } from '@lokalise/api-contracts';
|
|
|
2
2
|
import { mergeErrorSchemasByStatusCode } from '@lokalise/errors';
|
|
3
3
|
import z from 'zod/v4';
|
|
4
4
|
import { EXPERT_ADMIN_ROLES } from '../../auth.js';
|
|
5
|
-
import { FILE_STORAGE_UNAVAILABLE_ERROR_DEFINITION, GLOSSARY_NOT_FOUND_ERROR_DEFINITION, IMPORT_ALREADY_RUNNING_ERROR_DEFINITION, IMPORT_CANCELLED_ERROR_DEFINITION, IMPORT_FILE_NOT_FOUND_ERROR_DEFINITION, IMPORT_TIME_LIMIT_REACHED_ERROR_DEFINITION, INVALID_IMPORT_FILE_ERROR_DEFINITION,
|
|
5
|
+
import { FILE_STORAGE_UNAVAILABLE_ERROR_DEFINITION, GLOSSARY_NOT_FOUND_ERROR_DEFINITION, IMPORT_ALREADY_RUNNING_ERROR_DEFINITION, IMPORT_CANCELLED_ERROR_DEFINITION, IMPORT_FILE_NOT_FOUND_ERROR_DEFINITION, IMPORT_TIME_LIMIT_REACHED_ERROR_DEFINITION, INVALID_IMPORT_FILE_ERROR_DEFINITION, } from '../../errors/index.js';
|
|
6
6
|
import { OpenApiTags } from '../../open-api-tags.js';
|
|
7
7
|
import { AUTH_ERROR_RESPONSES, AUTH_HEADERS, INTERNAL_SERVER_ERROR_RESPONSE_SCHEMA, TEAM_ID_SCHEMA, VALIDATION_ERROR_RESPONSE_SCHEMA, } from '../common.js';
|
|
8
|
-
import { MAX_LOCALE_LENGTH } from '../concepts/common.js';
|
|
9
8
|
import { GLOSSARY_ID_SCHEMA } from './common.js';
|
|
10
9
|
// POST /v1/teams/:teamId/glossaries/:glossaryId/import/actions/confirm-upload-completion
|
|
11
10
|
const CONFIRM_IMPORT_UPLOAD_COMPLETION_REQUEST_PARAMS_SCHEMA = z.compile(z.object({
|
|
@@ -14,11 +13,6 @@ const CONFIRM_IMPORT_UPLOAD_COMPLETION_REQUEST_PARAMS_SCHEMA = z.compile(z.objec
|
|
|
14
13
|
}));
|
|
15
14
|
const CONFIRM_IMPORT_UPLOAD_COMPLETION_REQUEST_BODY_SCHEMA = z.compile(z.object({
|
|
16
15
|
fileId: z.uuid().describe('ID of the file that the request for the upload form returned'),
|
|
17
|
-
sourceLocale: z
|
|
18
|
-
.string()
|
|
19
|
-
.min(1)
|
|
20
|
-
.max(MAX_LOCALE_LENGTH)
|
|
21
|
-
.describe('Locale of the source terms of the file, such as `en-US`'),
|
|
22
16
|
}));
|
|
23
17
|
const CONFIRM_IMPORT_UPLOAD_COMPLETION_RESPONSE_BODY_SCHEMA = z.compile(z.object({
|
|
24
18
|
importedTerms: z
|
|
@@ -40,7 +34,7 @@ const CONFIRM_IMPORT_UPLOAD_COMPLETION_RESPONSE_BODY_SCHEMA = z.compile(z.object
|
|
|
40
34
|
export const confirmImportUploadCompletionContract = defineApiContract({
|
|
41
35
|
method: 'post',
|
|
42
36
|
summary: 'Import an uploaded file into a glossary',
|
|
43
|
-
description: 'Imports the file of an upload form into the glossary, after the client posted the file to the storage. The import turns each row of the CSV file that Expert exports into a concept with its terms. A failed import does not store any term. The import consumes the upload, so a second confirmation of the same upload gets 400. While another import into the glossary runs, the confirmation gets 409 and keeps the upload. The import has a time limit of 30 seconds. An import that reaches the limit before its commit stops and gets 503, and an import whose commit ends after the limit gets 200. When the client closes the connection before the import commits, the import stops, and the service ends the request with 400. After a 503, the client starts again with a new upload form, because the service might have consumed the upload already.',
|
|
37
|
+
description: 'Imports the file of an upload form into the glossary, after the client posted the file to the storage. The import turns each row of the CSV file that Expert exports into a concept with its terms. The `term` column gets the locale of the first language column of the file, and a file without a language column or with a first language column that is not a locale gets 400. A failed import does not store any term. The import consumes the upload, so a second confirmation of the same upload gets 400. While another import into the glossary runs, the confirmation gets 409 and keeps the upload. The import has a time limit of 30 seconds. An import that reaches the limit before its commit stops and gets 503, and an import whose commit ends after the limit gets 200. When the client closes the connection before the import commits, the import stops, and the service ends the request with 400. After a 503, the client starts again with a new upload form, because the service might have consumed the upload already.',
|
|
44
38
|
tags: [OpenApiTags.Glossaries.name],
|
|
45
39
|
visibility: 'internal',
|
|
46
40
|
requestPathParamsSchema: CONFIRM_IMPORT_UPLOAD_COMPLETION_REQUEST_PARAMS_SCHEMA,
|
|
@@ -55,7 +49,6 @@ export const confirmImportUploadCompletionContract = defineApiContract({
|
|
|
55
49
|
// the error definitions would drop the validation schema, so the union lists the schemas.
|
|
56
50
|
400: z.union([
|
|
57
51
|
INVALID_IMPORT_FILE_ERROR_DEFINITION.schema,
|
|
58
|
-
INVALID_SOURCE_LOCALE_ERROR_DEFINITION.schema,
|
|
59
52
|
IMPORT_FILE_NOT_FOUND_ERROR_DEFINITION.schema,
|
|
60
53
|
IMPORT_CANCELLED_ERROR_DEFINITION.schema,
|
|
61
54
|
VALIDATION_ERROR_RESPONSE_SCHEMA,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm-import-upload-completion.js","sourceRoot":"","sources":["../../../../src/api/contracts/glossaries/confirm-import-upload-completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,kBAAkB,EAAoC,MAAM,eAAe,CAAA;AACpF,OAAO,EACL,yCAAyC,EACzC,mCAAmC,EACnC,uCAAuC,EACvC,iCAAiC,EACjC,sCAAsC,EACtC,0CAA0C,EAC1C,oCAAoC,
|
|
1
|
+
{"version":3,"file":"confirm-import-upload-completion.js","sourceRoot":"","sources":["../../../../src/api/contracts/glossaries/confirm-import-upload-completion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAA;AAC3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,k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yC;IAClD,WAAW,EACT,o/BAAo/B;IACt/B,IAAI,EAAE,CAAC,WAAW,CAAC,UAAU,CAAC,IAAI,CAAC;IACnC,UAAU,EAAE,UAAU;IACtB,uBAAuB,EAAE,sDAAsD;IAC/E,iBAAiB,EAAE,oDAAoD;IACvE,mBAAmB,EAAE,YAAY;IACjC,YAAY,EAAE,CAAC,MAAM,EAAE,EAAE,CACvB,aAAa,MAAM,CAAC,MAAM,eAAe,MAAM,CAAC,UAAU,2CAA2C;IACvG,qBAAqB,EAAE;QACrB,GAAG,EAAE,qDAAqD;QAC1D,GAAG,oBAAoB;QACvB,6FAA6F;QAC7F,8FAA8F;QAC9F,0FAA0F;QAC1F,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC;YACX,oCAAoC,CAAC,MAAM;YAC3C,sCAAsC,CAAC,MAAM;YAC7C,iCAAiC,CAAC,MAAM;YACxC,gCAAgC;SACjC,CAAC;QACF,GAAG,6BAA6B,CAAC;YAC/B,mCAAmC;YACnC,uCAAuC;YACvC,yCAAyC;YACzC,0CAA0C;SAC3C,CAAC;QACF,KAAK,EAAE,qCAAqC;KAC7C;IACD,QAAQ,EAAE;QACR,sBAAsB,EAAE,kBAAkB;KACL;CACxC,CAAC,CAAA"}
|
|
@@ -28,16 +28,6 @@ export declare const INVALID_IMPORT_FILE_ERROR_DEFINITION: {
|
|
|
28
28
|
errorCode: import("zod").ZodLiteral<"INVALID_IMPORT_FILE">;
|
|
29
29
|
}, import("zod/v4/core").$strip>;
|
|
30
30
|
};
|
|
31
|
-
export declare const INVALID_SOURCE_LOCALE_ERROR_DEFINITION: {
|
|
32
|
-
readonly code: "INVALID_SOURCE_LOCALE";
|
|
33
|
-
readonly type: "bad-request";
|
|
34
|
-
} & {
|
|
35
|
-
schema: import("zod").ZodObject<{
|
|
36
|
-
message: import("zod").ZodString;
|
|
37
|
-
code: import("zod").ZodLiteral<"INVALID_SOURCE_LOCALE">;
|
|
38
|
-
errorCode: import("zod").ZodLiteral<"INVALID_SOURCE_LOCALE">;
|
|
39
|
-
}, import("zod/v4/core").$strip>;
|
|
40
|
-
};
|
|
41
31
|
export declare const IMPORT_FILE_NOT_FOUND_ERROR_DEFINITION: {
|
|
42
32
|
readonly code: "IMPORT_FILE_NOT_FOUND";
|
|
43
33
|
readonly type: "bad-request";
|
|
@@ -12,10 +12,6 @@ export const INVALID_IMPORT_FILE_ERROR_DEFINITION = definePublicError({
|
|
|
12
12
|
code: 'INVALID_IMPORT_FILE',
|
|
13
13
|
type: ErrorType.BAD_REQUEST,
|
|
14
14
|
});
|
|
15
|
-
export const INVALID_SOURCE_LOCALE_ERROR_DEFINITION = definePublicError({
|
|
16
|
-
code: 'INVALID_SOURCE_LOCALE',
|
|
17
|
-
type: ErrorType.BAD_REQUEST,
|
|
18
|
-
});
|
|
19
15
|
export const IMPORT_FILE_NOT_FOUND_ERROR_DEFINITION = definePublicError({
|
|
20
16
|
code: 'IMPORT_FILE_NOT_FOUND',
|
|
21
17
|
type: ErrorType.BAD_REQUEST,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glossaryErrors.js","sourceRoot":"","sources":["../../../src/api/errors/glossaryErrors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE/D,uFAAuF;AACvF,MAAM,CAAC,MAAM,oCAAoC,GAAG,iBAAiB,CAAC;IACpE,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,SAAS,CAAC,QAAQ;CACzB,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mCAAmC,GAAG,iBAAiB,CAAC;IACnE,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,SAAS,CAAC,SAAS;CAC1B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,iBAAiB,CAAC;IACpE,IAAI,EAAE,qBAAqB;IAC3B,IAAI,EAAE,SAAS,CAAC,WAAW;CAC5B,CAAC,CAAA;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