@lokalise/glossary-api-contracts 0.1.0 → 0.2.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.
@@ -12,7 +12,7 @@ export type ConfirmImportUploadCompletionResponseBody = z.infer<typeof CONFIRM_I
12
12
  export declare const confirmImportUploadCompletionContract: Omit<{
13
13
  readonly method: "post";
14
14
  readonly summary: "Import an uploaded file into a glossary";
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. A failed import stores no terms. The import consumes the upload, so a second confirmation of the same upload gets 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. A failed import does not store any term. The import consumes the upload, so a second confirmation of the same upload gets 400. 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.";
16
16
  readonly tags: readonly ["Glossaries"];
17
17
  readonly visibility: "internal";
18
18
  readonly requestPathParamsSchema: z.ZodObject<{
@@ -47,6 +47,10 @@ export declare const confirmImportUploadCompletionContract: Omit<{
47
47
  message: z.ZodString;
48
48
  code: z.ZodLiteral<"IMPORT_FILE_NOT_FOUND">;
49
49
  errorCode: z.ZodLiteral<"IMPORT_FILE_NOT_FOUND">;
50
+ }, z.core.$strip>, z.ZodObject<{
51
+ message: z.ZodString;
52
+ code: z.ZodLiteral<"IMPORT_CANCELLED">;
53
+ errorCode: z.ZodLiteral<"IMPORT_CANCELLED">;
50
54
  }, z.core.$strip>, z.ZodObject<{
51
55
  message: z.ZodString;
52
56
  errorCode: z.ZodString;
@@ -97,10 +101,18 @@ export declare const confirmImportUploadCompletionContract: Omit<{
97
101
  message: string;
98
102
  code: "FILE_STORAGE_UNAVAILABLE";
99
103
  errorCode: "FILE_STORAGE_UNAVAILABLE";
104
+ } | {
105
+ message: string;
106
+ code: "IMPORT_TIME_LIMIT_REACHED";
107
+ errorCode: "IMPORT_TIME_LIMIT_REACHED";
100
108
  }, unknown, z.core.$ZodTypeInternals<{
101
109
  message: string;
102
110
  code: "FILE_STORAGE_UNAVAILABLE";
103
111
  errorCode: "FILE_STORAGE_UNAVAILABLE";
112
+ } | {
113
+ message: string;
114
+ code: "IMPORT_TIME_LIMIT_REACHED";
115
+ errorCode: "IMPORT_TIME_LIMIT_REACHED";
104
116
  }, unknown>>;
105
117
  };
106
118
  readonly metadata: {
@@ -2,7 +2,7 @@ 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_FILE_NOT_FOUND_ERROR_DEFINITION, INVALID_IMPORT_FILE_ERROR_DEFINITION, INVALID_SOURCE_LOCALE_ERROR_DEFINITION, } from '../../errors/index.js';
5
+ import { FILE_STORAGE_UNAVAILABLE_ERROR_DEFINITION, GLOSSARY_NOT_FOUND_ERROR_DEFINITION, IMPORT_CANCELLED_ERROR_DEFINITION, IMPORT_FILE_NOT_FOUND_ERROR_DEFINITION, IMPORT_TIME_LIMIT_REACHED_ERROR_DEFINITION, INVALID_IMPORT_FILE_ERROR_DEFINITION, INVALID_SOURCE_LOCALE_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
8
  import { MAX_LOCALE_LENGTH } from '../concepts/common.js';
@@ -35,7 +35,7 @@ const CONFIRM_IMPORT_UPLOAD_COMPLETION_RESPONSE_BODY_SCHEMA = z.compile(z.object
35
35
  export const confirmImportUploadCompletionContract = defineApiContract({
36
36
  method: 'post',
37
37
  summary: 'Import an uploaded file into a glossary',
38
- 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 stores no terms. The import consumes the upload, so a second confirmation of the same upload gets 400. After a 503, the client starts again with a new upload form, because the service might have consumed the upload already.',
38
+ 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. 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.',
39
39
  tags: [OpenApiTags.Glossaries.name],
40
40
  visibility: 'internal',
41
41
  requestPathParamsSchema: CONFIRM_IMPORT_UPLOAD_COMPLETION_REQUEST_PARAMS_SCHEMA,
@@ -52,11 +52,13 @@ export const confirmImportUploadCompletionContract = defineApiContract({
52
52
  INVALID_IMPORT_FILE_ERROR_DEFINITION.schema,
53
53
  INVALID_SOURCE_LOCALE_ERROR_DEFINITION.schema,
54
54
  IMPORT_FILE_NOT_FOUND_ERROR_DEFINITION.schema,
55
+ IMPORT_CANCELLED_ERROR_DEFINITION.schema,
55
56
  VALIDATION_ERROR_RESPONSE_SCHEMA,
56
57
  ]),
57
58
  ...mergeErrorSchemasByStatusCode([
58
59
  GLOSSARY_NOT_FOUND_ERROR_DEFINITION,
59
60
  FILE_STORAGE_UNAVAILABLE_ERROR_DEFINITION,
61
+ IMPORT_TIME_LIMIT_REACHED_ERROR_DEFINITION,
60
62
  ]),
61
63
  '5xx': INTERNAL_SERVER_ERROR_RESPONSE_SCHEMA,
62
64
  },
@@ -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,sCAAsC,EACtC,oCAAoC,EACpC,sCAAsC,GACvC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EACL,oBAAoB,EACpB,YAAY,EACZ,qCAAqC,EACrC,cAAc,EACd,gCAAgC,GACjC,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAEhD,yFAAyF;AACzF,MAAM,sDAAsD,GAAG,CAAC,CAAC,OAAO,CACtE,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,cAAc;IACtB,UAAU,EAAE,kBAAkB;CAC/B,CAAC,CACH,CAAA;AAED,MAAM,oDAAoD,GAAG,CAAC,CAAC,OAAO,CACpE,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,8DAA8D,CAAC;IACzF,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,iBAAiB,CAAC;SACtB,QAAQ,CAAC,yDAAyD,CAAC;CACvE,CAAC,CACH,CAAA;AAKD,MAAM,qDAAqD,GAAG,CAAC,CAAC,OAAO,CACrE,CAAC,CAAC,MAAM,CAAC;IACP,aAAa,EAAE,CAAC;SACb,MAAM,EAAE;SACR,GAAG,EAAE;SACL,WAAW,EAAE;SACb,QAAQ,CAAC,wCAAwC,CAAC;IACrD,YAAY,EAAE,CAAC;SACZ,MAAM,EAAE;SACR,GAAG,EAAE;SACL,WAAW,EAAE;SACb,QAAQ,CAAC,qDAAqD,CAAC;CACnE,CAAC,CACH,CAAA;AAKD,MAAM,CAAC,MAAM,qCAAqC,GAAG,iBAAiB,CAAC;IACrE,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,yCAAyC;IAClD,WAAW,EACT,qbAAqb;IACvb,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,sCAAsC,CAAC,MAAM;YAC7C,gCAAgC;SACjC,CAAC;QACF,GAAG,6BAA6B,CAAC;YAC/B,mCAAmC;YACnC,yCAAyC;SAC1C,CAAC;QACF,KAAK,EAAE,qCAAqC;KAC7C;IACD,QAAQ,EAAE;QACR,sBAAsB,EAAE,kBAAkB;KACL;CACxC,CAAC,CAAA"}
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,E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AAE;SACb,QAAQ,CAAC,qDAAqD,CAAC;CACnE,CAAC,CACH,CAAA;AAKD,MAAM,CAAC,MAAM,qCAAqC,GAAG,iBAAiB,CAAC;IACrE,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,yCAAyC;IAClD,WAAW,EACT,uuBAAuuB;IACzuB,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,sCAAsC,CAAC,MAAM;YAC7C,iCAAiC,CAAC,MAAM;YACxC,gCAAgC;SACjC,CAAC;QACF,GAAG,6BAA6B,CAAC;YAC/B,mCAAmC;YACnC,yCAAyC;YACzC,0CAA0C;SAC3C,CAAC;QACF,KAAK,EAAE,qCAAqC;KAC7C;IACD,QAAQ,EAAE;QACR,sBAAsB,EAAE,kBAAkB;KACL;CACxC,CAAC,CAAA"}
@@ -48,3 +48,23 @@ export declare const IMPORT_FILE_NOT_FOUND_ERROR_DEFINITION: {
48
48
  errorCode: import("zod").ZodLiteral<"IMPORT_FILE_NOT_FOUND">;
49
49
  }, import("zod/v4/core").$strip>;
50
50
  };
51
+ export declare const IMPORT_TIME_LIMIT_REACHED_ERROR_DEFINITION: {
52
+ readonly code: "IMPORT_TIME_LIMIT_REACHED";
53
+ readonly type: "unavailable";
54
+ } & {
55
+ schema: import("zod").ZodObject<{
56
+ message: import("zod").ZodString;
57
+ code: import("zod").ZodLiteral<"IMPORT_TIME_LIMIT_REACHED">;
58
+ errorCode: import("zod").ZodLiteral<"IMPORT_TIME_LIMIT_REACHED">;
59
+ }, import("zod/v4/core").$strip>;
60
+ };
61
+ export declare const IMPORT_CANCELLED_ERROR_DEFINITION: {
62
+ readonly code: "IMPORT_CANCELLED";
63
+ readonly type: "bad-request";
64
+ } & {
65
+ schema: import("zod").ZodObject<{
66
+ message: import("zod").ZodString;
67
+ code: import("zod").ZodLiteral<"IMPORT_CANCELLED">;
68
+ errorCode: import("zod").ZodLiteral<"IMPORT_CANCELLED">;
69
+ }, import("zod/v4/core").$strip>;
70
+ };
@@ -20,4 +20,12 @@ export const IMPORT_FILE_NOT_FOUND_ERROR_DEFINITION = definePublicError({
20
20
  code: 'IMPORT_FILE_NOT_FOUND',
21
21
  type: ErrorType.BAD_REQUEST,
22
22
  });
23
+ export const IMPORT_TIME_LIMIT_REACHED_ERROR_DEFINITION = definePublicError({
24
+ code: 'IMPORT_TIME_LIMIT_REACHED',
25
+ type: ErrorType.UNAVAILABLE,
26
+ });
27
+ export const IMPORT_CANCELLED_ERROR_DEFINITION = definePublicError({
28
+ code: 'IMPORT_CANCELLED',
29
+ type: ErrorType.BAD_REQUEST,
30
+ });
23
31
  //# sourceMappingURL=glossaryErrors.js.map
@@ -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,oBA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;IACtE,IAAI,EAAE,uBAAuB;IAC7B,IAAI,EAAE,SAAS,CAAC,WAAW;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,0CAA0C,GAAG,iBAAiB,CAAC;IAC1E,IAAI,EAAE,2BAA2B;IACjC,IAAI,EAAE,SAAS,CAAC,WAAW;CAC5B,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iCAAiC,GAAG,iBAAiB,CAAC;IACjE,IAAI,EAAE,kBAAkB;IACxB,IAAI,EAAE,SAAS,CAAC,WAAW;CAC5B,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lokalise/glossary-api-contracts",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "API contracts of the Glossary service",
5
5
  "repository": {
6
6
  "type": "git",