@lokalise/chatter-api-contracts 0.0.0-stage → 0.1.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/LICENSE +190 -0
- package/README.md +28 -2
- package/dist/api/contracts/comments/delete-comment-reply.d.ts +62 -0
- package/dist/api/contracts/comments/delete-comment-reply.js +32 -0
- package/dist/api/contracts/comments/delete-comment-reply.js.map +1 -0
- package/dist/api/contracts/comments/delete-comment.d.ts +59 -0
- package/dist/api/contracts/comments/delete-comment.js +31 -0
- package/dist/api/contracts/comments/delete-comment.js.map +1 -0
- package/dist/api/contracts/comments/get-comment-replies.d.ts +137 -0
- package/dist/api/contracts/comments/get-comment-replies.js +61 -0
- package/dist/api/contracts/comments/get-comment-replies.js.map +1 -0
- package/dist/api/contracts/comments/get-comments.d.ts +70 -0
- package/dist/api/contracts/comments/get-comments.js +40 -0
- package/dist/api/contracts/comments/get-comments.js.map +1 -0
- package/dist/api/contracts/comments/patch-comment-reply.d.ts +153 -0
- package/dist/api/contracts/comments/patch-comment-reply.js +41 -0
- package/dist/api/contracts/comments/patch-comment-reply.js.map +1 -0
- package/dist/api/contracts/comments/patch-comment.d.ts +188 -0
- package/dist/api/contracts/comments/patch-comment.js +49 -0
- package/dist/api/contracts/comments/patch-comment.js.map +1 -0
- package/dist/api/contracts/comments/post-comment-reply.d.ts +150 -0
- package/dist/api/contracts/comments/post-comment-reply.js +40 -0
- package/dist/api/contracts/comments/post-comment-reply.js.map +1 -0
- package/dist/api/contracts/comments/post-comment.d.ts +177 -0
- package/dist/api/contracts/comments/post-comment.js +48 -0
- package/dist/api/contracts/comments/post-comment.js.map +1 -0
- package/dist/api/contracts/comments/post-comments-actions-search.d.ts +166 -0
- package/dist/api/contracts/comments/post-comments-actions-search.js +65 -0
- package/dist/api/contracts/comments/post-comments-actions-search.js.map +1 -0
- package/dist/api/contracts/comments/put-comment-read-state.d.ts +66 -0
- package/dist/api/contracts/comments/put-comment-read-state.js +45 -0
- package/dist/api/contracts/comments/put-comment-read-state.js.map +1 -0
- package/dist/api/contracts/comments/put-comment-subscription.d.ts +77 -0
- package/dist/api/contracts/comments/put-comment-subscription.js +43 -0
- package/dist/api/contracts/comments/put-comment-subscription.js.map +1 -0
- package/dist/api/contracts/common.d.ts +10 -0
- package/dist/api/contracts/common.js +11 -0
- package/dist/api/contracts/common.js.map +1 -0
- package/dist/api/contracts/index.d.ts +11 -0
- package/dist/api/contracts/index.js +12 -0
- package/dist/api/contracts/index.js.map +1 -0
- package/dist/api/errors/index.d.ts +1 -0
- package/dist/api/errors/index.js +2 -0
- package/dist/api/errors/index.js.map +1 -0
- package/dist/api/errors/team-access-denied.d.ts +10 -0
- package/dist/api/errors/team-access-denied.js +7 -0
- package/dist/api/errors/team-access-denied.js.map +1 -0
- package/dist/api/objects/comment-reply.d.ts +26 -0
- package/dist/api/objects/comment-reply.js +16 -0
- package/dist/api/objects/comment-reply.js.map +1 -0
- package/dist/api/objects/comment.d.ts +50 -0
- package/dist/api/objects/comment.js +47 -0
- package/dist/api/objects/comment.js.map +1 -0
- package/dist/api/objects/index.d.ts +3 -0
- package/dist/api/objects/index.js +4 -0
- package/dist/api/objects/index.js.map +1 -0
- package/dist/api/objects/message.d.ts +47 -0
- package/dist/api/objects/message.js +57 -0
- package/dist/api/objects/message.js.map +1 -0
- package/dist/api/open-api-tags.d.ts +17 -0
- package/dist/api/open-api-tags.js +18 -0
- package/dist/api/open-api-tags.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -3
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
declare const PUT_COMMENT_READ_STATE_PATH_PARAMS_SCHEMA: z.ZodObject<{
|
|
3
|
+
teamId: z.ZodUUID;
|
|
4
|
+
commentId: z.ZodUUID;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type PutCommentReadStatePathParams = z.infer<typeof PUT_COMMENT_READ_STATE_PATH_PARAMS_SCHEMA>;
|
|
7
|
+
declare const PUT_COMMENT_READ_STATE_REQUEST_BODY_SCHEMA: z.ZodObject<{
|
|
8
|
+
lastReadAt: z.ZodOptional<z.ZodISODateTime>;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
export type PutCommentReadStateRequestBody = z.infer<typeof PUT_COMMENT_READ_STATE_REQUEST_BODY_SCHEMA>;
|
|
11
|
+
export declare const putCommentReadStateContract: Omit<{
|
|
12
|
+
readonly method: "put";
|
|
13
|
+
readonly visibility: "internal";
|
|
14
|
+
readonly summary: "Mark a comment thread as read or unread";
|
|
15
|
+
readonly description: string;
|
|
16
|
+
readonly tags: readonly ["Comments"];
|
|
17
|
+
readonly requestHeaderSchema: z.ZodObject<{
|
|
18
|
+
authorization: z.ZodString;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
readonly requestPathParamsSchema: z.ZodObject<{
|
|
21
|
+
teamId: z.ZodUUID;
|
|
22
|
+
commentId: z.ZodUUID;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
readonly requestBodySchema: z.ZodObject<{
|
|
25
|
+
lastReadAt: z.ZodOptional<z.ZodISODateTime>;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
readonly pathResolver: ({ teamId, commentId }: {
|
|
28
|
+
teamId: string;
|
|
29
|
+
commentId: string;
|
|
30
|
+
}) => `/v1/teams/${string}/comments/${string}/read-state`;
|
|
31
|
+
readonly responsesByStatusCode: {
|
|
32
|
+
204: import("@lokalise/api-contracts").NoBodyContentResponseEntry;
|
|
33
|
+
400: z.ZodObject<{
|
|
34
|
+
message: z.ZodString;
|
|
35
|
+
code: z.ZodString;
|
|
36
|
+
errorCode: z.ZodString;
|
|
37
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
38
|
+
}, z.core.$strip>;
|
|
39
|
+
401: z.ZodObject<{
|
|
40
|
+
message: z.ZodString;
|
|
41
|
+
code: z.ZodString;
|
|
42
|
+
errorCode: z.ZodString;
|
|
43
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
403: z.ZodObject<{
|
|
46
|
+
message: z.ZodString;
|
|
47
|
+
code: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
|
|
48
|
+
errorCode: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
404: z.ZodObject<{
|
|
51
|
+
message: z.ZodString;
|
|
52
|
+
code: z.ZodString;
|
|
53
|
+
errorCode: z.ZodString;
|
|
54
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
500: z.ZodObject<{
|
|
57
|
+
message: z.ZodString;
|
|
58
|
+
code: z.ZodString;
|
|
59
|
+
errorCode: z.ZodString;
|
|
60
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
61
|
+
}, z.core.$strip>;
|
|
62
|
+
};
|
|
63
|
+
}, "visibility"> & {
|
|
64
|
+
visibility: import("@lokalise/api-contracts").RouteVisibility;
|
|
65
|
+
};
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineApiContract, noBodyResponse } from '@lokalise/api-contracts';
|
|
2
|
+
import z from 'zod/v4';
|
|
3
|
+
import { teamAccessDeniedErrorDefinition } from '../../errors/index.js';
|
|
4
|
+
import { OpenApiTags } from '../../open-api-tags.js';
|
|
5
|
+
import { AUTH_HEADERS, ERROR_RESPONSE_SCHEMA } from '../common.js';
|
|
6
|
+
// ------------------------------------------------------------
|
|
7
|
+
// PUT /v1/teams/:teamId/comments/:commentId/read-state
|
|
8
|
+
// ------------------------------------------------------------
|
|
9
|
+
const PUT_COMMENT_READ_STATE_PATH_PARAMS_SCHEMA = z.compile(z.object({
|
|
10
|
+
teamId: z.uuid().describe('Id of the team'),
|
|
11
|
+
commentId: z.uuid().describe('Id of the comment'),
|
|
12
|
+
}));
|
|
13
|
+
const PUT_COMMENT_READ_STATE_REQUEST_BODY_SCHEMA = z.compile(z
|
|
14
|
+
.object({
|
|
15
|
+
lastReadAt: z.iso
|
|
16
|
+
.datetime()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe('Thread activity up to this time is read, and later activity is unread. ' +
|
|
19
|
+
'Defaults to the current time. It cannot be in the future'),
|
|
20
|
+
})
|
|
21
|
+
.refine((body) => !body.lastReadAt || new Date(body.lastReadAt) <= new Date(), {
|
|
22
|
+
message: '`lastReadAt` cannot be in the future',
|
|
23
|
+
path: ['lastReadAt'],
|
|
24
|
+
}));
|
|
25
|
+
export const putCommentReadStateContract = defineApiContract({
|
|
26
|
+
method: 'put',
|
|
27
|
+
visibility: 'internal',
|
|
28
|
+
summary: 'Mark a comment thread as read or unread',
|
|
29
|
+
description: 'Sets until when the requesting user has read the thread of a comment. ' +
|
|
30
|
+
'Moving `lastReadAt` forward marks newer activity as read; moving it back marks it as unread.',
|
|
31
|
+
tags: [OpenApiTags.Comments.name],
|
|
32
|
+
requestHeaderSchema: AUTH_HEADERS,
|
|
33
|
+
requestPathParamsSchema: PUT_COMMENT_READ_STATE_PATH_PARAMS_SCHEMA,
|
|
34
|
+
requestBodySchema: PUT_COMMENT_READ_STATE_REQUEST_BODY_SCHEMA,
|
|
35
|
+
pathResolver: ({ teamId, commentId }) => `/v1/teams/${teamId}/comments/${commentId}/read-state`,
|
|
36
|
+
responsesByStatusCode: {
|
|
37
|
+
204: noBodyResponse({ description: 'Read state updated' }),
|
|
38
|
+
400: ERROR_RESPONSE_SCHEMA,
|
|
39
|
+
401: ERROR_RESPONSE_SCHEMA,
|
|
40
|
+
403: teamAccessDeniedErrorDefinition.schema,
|
|
41
|
+
404: ERROR_RESPONSE_SCHEMA,
|
|
42
|
+
500: ERROR_RESPONSE_SCHEMA,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
//# sourceMappingURL=put-comment-read-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"put-comment-read-state.js","sourceRoot":"","sources":["../../../../src/api/contracts/comments/put-comment-read-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC3E,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAElE,+DAA+D;AAC/D,uDAAuD;AACvD,+DAA+D;AAC/D,MAAM,yCAAyC,GAAG,CAAC,CAAC,OAAO,CACzD,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CAClD,CAAC,CACH,CAAA;AAKD,MAAM,0CAA0C,GAAG,CAAC,CAAC,OAAO,CAC1D,CAAC;KACE,MAAM,CAAC;IACN,UAAU,EAAE,CAAC,CAAC,GAAG;SACd,QAAQ,EAAE;SACV,QAAQ,EAAE;SACV,QAAQ,CACP,yEAAyE;QACvE,0DAA0D,CAC7D;CACJ,CAAC;KACD,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,IAAI,IAAI,EAAE,EAAE;IAC7E,OAAO,EAAE,sCAAsC;IAC/C,IAAI,EAAE,CAAC,YAAY,CAAC;CACrB,CAAC,CACL,CAAA;AAKD,MAAM,CAAC,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;IAC3D,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,UAAU;IACtB,OAAO,EAAE,yCAAyC;IAClD,WAAW,EACT,wEAAwE;QACxE,8FAA8F;IAChG,IAAI,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;IACjC,mBAAmB,EAAE,YAAY;IACjC,uBAAuB,EAAE,yCAAyC;IAClE,iBAAiB,EAAE,0CAA0C;IAC7D,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,aAAa,MAAM,aAAa,SAAS,aAAa;IAC/F,qBAAqB,EAAE;QACrB,GAAG,EAAE,cAAc,CAAC,EAAE,WAAW,EAAE,oBAAoB,EAAE,CAAC;QAC1D,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,+BAA+B,CAAC,MAAM;QAC3C,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,qBAAqB;KAC3B;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
export declare const CommentSubscriptionActionEnum: {
|
|
3
|
+
readonly SUBSCRIBE: 'SUBSCRIBE';
|
|
4
|
+
readonly UNSUBSCRIBE: 'UNSUBSCRIBE';
|
|
5
|
+
};
|
|
6
|
+
export type CommentSubscriptionAction = (typeof CommentSubscriptionActionEnum)[keyof typeof CommentSubscriptionActionEnum];
|
|
7
|
+
declare const PUT_COMMENT_SUBSCRIPTION_PATH_PARAMS_SCHEMA: z.ZodObject<{
|
|
8
|
+
teamId: z.ZodUUID;
|
|
9
|
+
commentId: z.ZodUUID;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export type PutCommentSubscriptionPathParams = z.infer<typeof PUT_COMMENT_SUBSCRIPTION_PATH_PARAMS_SCHEMA>;
|
|
12
|
+
declare const PUT_COMMENT_SUBSCRIPTION_REQUEST_BODY_SCHEMA: z.ZodObject<{
|
|
13
|
+
action: z.ZodEnum<{
|
|
14
|
+
readonly SUBSCRIBE: 'SUBSCRIBE';
|
|
15
|
+
readonly UNSUBSCRIBE: 'UNSUBSCRIBE';
|
|
16
|
+
}>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
export type PutCommentSubscriptionRequestBody = z.infer<typeof PUT_COMMENT_SUBSCRIPTION_REQUEST_BODY_SCHEMA>;
|
|
19
|
+
export declare const putCommentSubscriptionContract: Omit<{
|
|
20
|
+
readonly method: "put";
|
|
21
|
+
readonly visibility: "internal";
|
|
22
|
+
readonly summary: "Subscribe to or unsubscribe from a comment thread";
|
|
23
|
+
readonly description: string;
|
|
24
|
+
readonly tags: readonly ["Comments"];
|
|
25
|
+
readonly requestHeaderSchema: z.ZodObject<{
|
|
26
|
+
authorization: z.ZodString;
|
|
27
|
+
}, z.core.$strip>;
|
|
28
|
+
readonly requestPathParamsSchema: z.ZodObject<{
|
|
29
|
+
teamId: z.ZodUUID;
|
|
30
|
+
commentId: z.ZodUUID;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
readonly requestBodySchema: z.ZodObject<{
|
|
33
|
+
action: z.ZodEnum<{
|
|
34
|
+
readonly SUBSCRIBE: 'SUBSCRIBE';
|
|
35
|
+
readonly UNSUBSCRIBE: 'UNSUBSCRIBE';
|
|
36
|
+
}>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
readonly pathResolver: ({ teamId, commentId }: {
|
|
39
|
+
teamId: string;
|
|
40
|
+
commentId: string;
|
|
41
|
+
}) => `/v1/teams/${string}/comments/${string}/subscription`;
|
|
42
|
+
readonly responsesByStatusCode: {
|
|
43
|
+
204: import("@lokalise/api-contracts").NoBodyContentResponseEntry;
|
|
44
|
+
400: z.ZodObject<{
|
|
45
|
+
message: z.ZodString;
|
|
46
|
+
code: z.ZodString;
|
|
47
|
+
errorCode: z.ZodString;
|
|
48
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
401: z.ZodObject<{
|
|
51
|
+
message: z.ZodString;
|
|
52
|
+
code: z.ZodString;
|
|
53
|
+
errorCode: z.ZodString;
|
|
54
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
403: z.ZodObject<{
|
|
57
|
+
message: z.ZodString;
|
|
58
|
+
code: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
|
|
59
|
+
errorCode: z.ZodLiteral<"TEAM_ACCESS_DENIED">;
|
|
60
|
+
}, z.core.$strip>;
|
|
61
|
+
404: z.ZodObject<{
|
|
62
|
+
message: z.ZodString;
|
|
63
|
+
code: z.ZodString;
|
|
64
|
+
errorCode: z.ZodString;
|
|
65
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
500: z.ZodObject<{
|
|
68
|
+
message: z.ZodString;
|
|
69
|
+
code: z.ZodString;
|
|
70
|
+
errorCode: z.ZodString;
|
|
71
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
};
|
|
74
|
+
}, "visibility"> & {
|
|
75
|
+
visibility: import("@lokalise/api-contracts").RouteVisibility;
|
|
76
|
+
};
|
|
77
|
+
export {};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { defineApiContract, noBodyResponse } from '@lokalise/api-contracts';
|
|
2
|
+
import z from 'zod/v4';
|
|
3
|
+
import { teamAccessDeniedErrorDefinition } from '../../errors/index.js';
|
|
4
|
+
import { OpenApiTags } from '../../open-api-tags.js';
|
|
5
|
+
import { AUTH_HEADERS, ERROR_RESPONSE_SCHEMA } from '../common.js';
|
|
6
|
+
// ------------------------------------------------------------
|
|
7
|
+
// PUT /v1/teams/:teamId/comments/:commentId/subscription
|
|
8
|
+
// ------------------------------------------------------------
|
|
9
|
+
export const CommentSubscriptionActionEnum = {
|
|
10
|
+
SUBSCRIBE: 'SUBSCRIBE',
|
|
11
|
+
UNSUBSCRIBE: 'UNSUBSCRIBE',
|
|
12
|
+
};
|
|
13
|
+
const PUT_COMMENT_SUBSCRIPTION_PATH_PARAMS_SCHEMA = z.compile(z.object({
|
|
14
|
+
teamId: z.uuid().describe('Id of the team'),
|
|
15
|
+
commentId: z.uuid().describe('Id of the comment'),
|
|
16
|
+
}));
|
|
17
|
+
const PUT_COMMENT_SUBSCRIPTION_REQUEST_BODY_SCHEMA = z.compile(z.object({
|
|
18
|
+
action: z
|
|
19
|
+
.enum(CommentSubscriptionActionEnum)
|
|
20
|
+
.describe('Whether to subscribe to or unsubscribe from the thread'),
|
|
21
|
+
}));
|
|
22
|
+
export const putCommentSubscriptionContract = defineApiContract({
|
|
23
|
+
method: 'put',
|
|
24
|
+
visibility: 'internal',
|
|
25
|
+
summary: 'Subscribe to or unsubscribe from a comment thread',
|
|
26
|
+
description: 'Subscribes the requesting user to the thread of a comment, so they are notified of its changes, ' +
|
|
27
|
+
'or unsubscribes them so they are no longer notified. ' +
|
|
28
|
+
'Subscribing when already subscribed, or unsubscribing when not subscribed, has no effect.',
|
|
29
|
+
tags: [OpenApiTags.Comments.name],
|
|
30
|
+
requestHeaderSchema: AUTH_HEADERS,
|
|
31
|
+
requestPathParamsSchema: PUT_COMMENT_SUBSCRIPTION_PATH_PARAMS_SCHEMA,
|
|
32
|
+
requestBodySchema: PUT_COMMENT_SUBSCRIPTION_REQUEST_BODY_SCHEMA,
|
|
33
|
+
pathResolver: ({ teamId, commentId }) => `/v1/teams/${teamId}/comments/${commentId}/subscription`,
|
|
34
|
+
responsesByStatusCode: {
|
|
35
|
+
204: noBodyResponse({ description: 'Subscription updated' }),
|
|
36
|
+
400: ERROR_RESPONSE_SCHEMA,
|
|
37
|
+
401: ERROR_RESPONSE_SCHEMA,
|
|
38
|
+
403: teamAccessDeniedErrorDefinition.schema,
|
|
39
|
+
404: ERROR_RESPONSE_SCHEMA,
|
|
40
|
+
500: ERROR_RESPONSE_SCHEMA,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=put-comment-subscription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"put-comment-subscription.js","sourceRoot":"","sources":["../../../../src/api/contracts/comments/put-comment-subscription.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC3E,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAElE,+DAA+D;AAC/D,yDAAyD;AACzD,+DAA+D;AAE/D,MAAM,CAAC,MAAM,6BAA6B,GAAG;IAC3C,SAAS,EAAE,WAAW;IACtB,WAAW,EAAE,aAAa;CAClB,CAAA;AAIV,MAAM,2CAA2C,GAAG,CAAC,CAAC,OAAO,CAC3D,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC;IAC3C,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC;CAClD,CAAC,CACH,CAAA;AAKD,MAAM,4CAA4C,GAAG,CAAC,CAAC,OAAO,CAC5D,CAAC,CAAC,MAAM,CAAC;IACP,MAAM,EAAE,CAAC;SACN,IAAI,CAAC,6BAA6B,CAAC;SACnC,QAAQ,CAAC,wDAAwD,CAAC;CACtE,CAAC,CACH,CAAA;AAKD,MAAM,CAAC,MAAM,8BAA8B,GAAG,iBAAiB,CAAC;IAC9D,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,UAAU;IACtB,OAAO,EAAE,mDAAmD;IAC5D,WAAW,EACT,kGAAkG;QAClG,uDAAuD;QACvD,2FAA2F;IAC7F,IAAI,EAAE,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC;IACjC,mBAAmB,EAAE,YAAY;IACjC,uBAAuB,EAAE,2CAA2C;IACpE,iBAAiB,EAAE,4CAA4C;IAC/D,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,aAAa,MAAM,aAAa,SAAS,eAAe;IACjG,qBAAqB,EAAE;QACrB,GAAG,EAAE,cAAc,CAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;QAC5D,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,+BAA+B,CAAC,MAAM;QAC3C,GAAG,EAAE,qBAAqB;QAC1B,GAAG,EAAE,qBAAqB;KAC3B;CACF,CAAC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
export declare const AUTH_HEADERS: z.ZodObject<{
|
|
3
|
+
authorization: z.ZodString;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export declare const ERROR_RESPONSE_SCHEMA: z.ZodObject<{
|
|
6
|
+
message: z.ZodString;
|
|
7
|
+
code: z.ZodString;
|
|
8
|
+
errorCode: z.ZodString;
|
|
9
|
+
details: z.ZodOptional<z.ZodUnknown>;
|
|
10
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
export const AUTH_HEADERS = z.compile(z.object({
|
|
3
|
+
authorization: z.string().describe('Bearer token authorizing the request'),
|
|
4
|
+
}));
|
|
5
|
+
export const ERROR_RESPONSE_SCHEMA = z.compile(z.object({
|
|
6
|
+
message: z.string().describe('Human-readable error message'),
|
|
7
|
+
code: z.string().describe('Machine-readable error code'),
|
|
8
|
+
errorCode: z.string().describe('Machine-readable error code (legacy alias of `code`)'),
|
|
9
|
+
details: z.unknown().optional().describe('Optional structured error details'),
|
|
10
|
+
}));
|
|
11
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/api/contracts/common.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAA;AAEtB,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,OAAO,CACnC,CAAC,CAAC,MAAM,CAAC;IACP,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;CAC3E,CAAC,CACH,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,OAAO,CAC5C,CAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAC5D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,6BAA6B,CAAC;IACxD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IACtF,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;CAC9E,CAAC,CACH,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './comments/delete-comment.ts';
|
|
2
|
+
export * from './comments/delete-comment-reply.ts';
|
|
3
|
+
export * from './comments/get-comment-replies.ts';
|
|
4
|
+
export * from './comments/get-comments.ts';
|
|
5
|
+
export * from './comments/patch-comment.ts';
|
|
6
|
+
export * from './comments/patch-comment-reply.ts';
|
|
7
|
+
export * from './comments/post-comment.ts';
|
|
8
|
+
export * from './comments/post-comment-reply.ts';
|
|
9
|
+
export * from './comments/post-comments-actions-search.ts';
|
|
10
|
+
export * from './comments/put-comment-read-state.ts';
|
|
11
|
+
export * from './comments/put-comment-subscription.ts';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './comments/delete-comment.js';
|
|
2
|
+
export * from './comments/delete-comment-reply.js';
|
|
3
|
+
export * from './comments/get-comment-replies.js';
|
|
4
|
+
export * from './comments/get-comments.js';
|
|
5
|
+
export * from './comments/patch-comment.js';
|
|
6
|
+
export * from './comments/patch-comment-reply.js';
|
|
7
|
+
export * from './comments/post-comment.js';
|
|
8
|
+
export * from './comments/post-comment-reply.js';
|
|
9
|
+
export * from './comments/post-comments-actions-search.js';
|
|
10
|
+
export * from './comments/put-comment-read-state.js';
|
|
11
|
+
export * from './comments/put-comment-subscription.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAA;AAC5C,cAAc,oCAAoC,CAAA;AAClD,cAAc,mCAAmC,CAAA;AACjD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,mCAAmC,CAAA;AACjD,cAAc,4BAA4B,CAAA;AAC1C,cAAc,kCAAkC,CAAA;AAChD,cAAc,4CAA4C,CAAA;AAC1D,cAAc,sCAAsC,CAAA;AACpD,cAAc,wCAAwC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './team-access-denied.ts';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const teamAccessDeniedErrorDefinition: {
|
|
2
|
+
readonly code: "TEAM_ACCESS_DENIED";
|
|
3
|
+
readonly type: "permission-denied";
|
|
4
|
+
} & {
|
|
5
|
+
schema: import("zod").ZodObject<{
|
|
6
|
+
message: import("zod").ZodString;
|
|
7
|
+
code: import("zod").ZodLiteral<"TEAM_ACCESS_DENIED">;
|
|
8
|
+
errorCode: import("zod").ZodLiteral<"TEAM_ACCESS_DENIED">;
|
|
9
|
+
}, import("zod/v4/core").$strip>;
|
|
10
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { definePublicError, ErrorType } from '@lokalise/errors';
|
|
2
|
+
// The token is valid but does not belong to the team in the path
|
|
3
|
+
export const teamAccessDeniedErrorDefinition = definePublicError({
|
|
4
|
+
code: 'TEAM_ACCESS_DENIED',
|
|
5
|
+
type: ErrorType.PERMISSION_DENIED,
|
|
6
|
+
});
|
|
7
|
+
//# sourceMappingURL=team-access-denied.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"team-access-denied.js","sourceRoot":"","sources":["../../../src/api/errors/team-access-denied.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE/D,iEAAiE;AACjE,MAAM,CAAC,MAAM,+BAA+B,GAAG,iBAAiB,CAAC;IAC/D,IAAI,EAAE,oBAAoB;IAC1B,IAAI,EAAE,SAAS,CAAC,iBAAiB;CAClC,CAAC,CAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
export declare const COMMENT_REPLY_SCHEMA: z.ZodObject<{
|
|
3
|
+
id: z.ZodUUID;
|
|
4
|
+
commentId: z.ZodUUID;
|
|
5
|
+
message: z.ZodObject<{
|
|
6
|
+
version: z.ZodLiteral<1>;
|
|
7
|
+
blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
8
|
+
type: z.ZodLiteral<"paragraph">;
|
|
9
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"text">;
|
|
11
|
+
text: z.ZodString;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
type: z.ZodLiteral<"userMention">;
|
|
14
|
+
userId: z.ZodUUID;
|
|
15
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
16
|
+
type: z.ZodLiteral<"link">;
|
|
17
|
+
href: z.ZodURL;
|
|
18
|
+
text: z.ZodString;
|
|
19
|
+
}, z.core.$strip>], "type">>;
|
|
20
|
+
}, z.core.$strip>], "type">>;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
messageUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
23
|
+
createdBy: z.ZodUUID;
|
|
24
|
+
createdAt: z.ZodISODateTime;
|
|
25
|
+
}, z.core.$strip>;
|
|
26
|
+
export type CommentReply = z.infer<typeof COMMENT_REPLY_SCHEMA>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
import { MESSAGE_SCHEMA } from './message.js';
|
|
3
|
+
export const COMMENT_REPLY_SCHEMA = z.compile(z
|
|
4
|
+
.object({
|
|
5
|
+
id: z.uuid().describe('Id of the reply'),
|
|
6
|
+
commentId: z.uuid().describe('Id of the thread the reply belongs to'),
|
|
7
|
+
message: MESSAGE_SCHEMA,
|
|
8
|
+
messageUpdatedAt: z.iso
|
|
9
|
+
.datetime()
|
|
10
|
+
.nullish()
|
|
11
|
+
.describe('Last edit of the message. `null` if the message was never edited'),
|
|
12
|
+
createdBy: z.uuid().describe('Id of the author'),
|
|
13
|
+
createdAt: z.iso.datetime().describe('Creation time'),
|
|
14
|
+
})
|
|
15
|
+
.describe('Reply in a thread'));
|
|
16
|
+
//# sourceMappingURL=comment-reply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-reply.js","sourceRoot":"","sources":["../../../src/api/objects/comment-reply.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,OAAO,CAC3C,CAAC;KACE,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;IACxC,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,uCAAuC,CAAC;IACrE,OAAO,EAAE,cAAc;IACvB,gBAAgB,EAAE,CAAC,CAAC,GAAG;SACpB,QAAQ,EAAE;SACV,OAAO,EAAE;SACT,QAAQ,CAAC,kEAAkE,CAAC;IAC/E,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAChD,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;CACtD,CAAC;KACD,QAAQ,CAAC,mBAAmB,CAAC,CACjC,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
export declare const CommentEntityTypeEnum: {
|
|
3
|
+
readonly SEGMENT: 'SEGMENT';
|
|
4
|
+
};
|
|
5
|
+
export type CommentEntityType = (typeof CommentEntityTypeEnum)[keyof typeof CommentEntityTypeEnum];
|
|
6
|
+
export declare const CommentStatusEnum: {
|
|
7
|
+
readonly OPEN: 'OPEN';
|
|
8
|
+
readonly RESOLVED: 'RESOLVED';
|
|
9
|
+
};
|
|
10
|
+
export type CommentStatus = (typeof CommentStatusEnum)[keyof typeof CommentStatusEnum];
|
|
11
|
+
export declare const COMMENT_SCHEMA: z.ZodObject<{
|
|
12
|
+
id: z.ZodUUID;
|
|
13
|
+
teamId: z.ZodUUID;
|
|
14
|
+
projectId: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
15
|
+
entityType: z.ZodEnum<{
|
|
16
|
+
readonly SEGMENT: 'SEGMENT';
|
|
17
|
+
}>;
|
|
18
|
+
entityId: z.ZodUUID;
|
|
19
|
+
status: z.ZodEnum<{
|
|
20
|
+
readonly OPEN: 'OPEN';
|
|
21
|
+
readonly RESOLVED: 'RESOLVED';
|
|
22
|
+
}>;
|
|
23
|
+
message: z.ZodObject<{
|
|
24
|
+
version: z.ZodLiteral<1>;
|
|
25
|
+
blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<"paragraph">;
|
|
27
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
28
|
+
type: z.ZodLiteral<"text">;
|
|
29
|
+
text: z.ZodString;
|
|
30
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"userMention">;
|
|
32
|
+
userId: z.ZodUUID;
|
|
33
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"link">;
|
|
35
|
+
href: z.ZodURL;
|
|
36
|
+
text: z.ZodString;
|
|
37
|
+
}, z.core.$strip>], "type">>;
|
|
38
|
+
}, z.core.$strip>], "type">>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
messageUpdatedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
41
|
+
resolvedBy: z.ZodOptional<z.ZodNullable<z.ZodUUID>>;
|
|
42
|
+
resolvedAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
43
|
+
replyCount: z.ZodInt;
|
|
44
|
+
lastActivityAt: z.ZodISODateTime;
|
|
45
|
+
lastReadAt: z.ZodOptional<z.ZodNullable<z.ZodISODateTime>>;
|
|
46
|
+
subscribed: z.ZodBoolean;
|
|
47
|
+
createdBy: z.ZodUUID;
|
|
48
|
+
createdAt: z.ZodISODateTime;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
export type Comment = z.infer<typeof COMMENT_SCHEMA>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
import { MESSAGE_SCHEMA } from './message.js';
|
|
3
|
+
export const CommentEntityTypeEnum = {
|
|
4
|
+
SEGMENT: 'SEGMENT',
|
|
5
|
+
};
|
|
6
|
+
export const CommentStatusEnum = {
|
|
7
|
+
OPEN: 'OPEN',
|
|
8
|
+
RESOLVED: 'RESOLVED',
|
|
9
|
+
};
|
|
10
|
+
export const COMMENT_SCHEMA = z.compile(z
|
|
11
|
+
.object({
|
|
12
|
+
id: z.uuid().describe('Id of the comment. It is also the id of the thread'),
|
|
13
|
+
teamId: z.uuid().describe('Id of the team that owns the comment'),
|
|
14
|
+
projectId: z
|
|
15
|
+
.uuid()
|
|
16
|
+
.nullish()
|
|
17
|
+
.describe('Id of the project of the commented entity. `null` for entities without a project'),
|
|
18
|
+
entityType: z.enum(CommentEntityTypeEnum).describe('Type of the commented entity'),
|
|
19
|
+
entityId: z.uuid().describe('Id of the commented entity in the service that owns it'),
|
|
20
|
+
status: z.enum(CommentStatusEnum).describe('Status of the thread'),
|
|
21
|
+
message: MESSAGE_SCHEMA,
|
|
22
|
+
messageUpdatedAt: z.iso
|
|
23
|
+
.datetime()
|
|
24
|
+
.nullish()
|
|
25
|
+
.describe('Last edit of the message. `null` if the message was never edited'),
|
|
26
|
+
resolvedBy: z
|
|
27
|
+
.uuid()
|
|
28
|
+
.nullish()
|
|
29
|
+
.describe('Id of the user who resolved the thread. `null` when open'),
|
|
30
|
+
resolvedAt: z.iso
|
|
31
|
+
.datetime()
|
|
32
|
+
.nullish()
|
|
33
|
+
.describe('Time the thread was resolved. `null` when open'),
|
|
34
|
+
replyCount: z.int().nonnegative().describe('Number of replies in the thread'),
|
|
35
|
+
lastActivityAt: z.iso
|
|
36
|
+
.datetime()
|
|
37
|
+
.describe('Creation time of the newest message in the thread: the newest reply, or the comment when it has no replies'),
|
|
38
|
+
lastReadAt: z.iso
|
|
39
|
+
.datetime()
|
|
40
|
+
.nullish()
|
|
41
|
+
.describe('Read watermark of the requesting user: thread activity after this time is unread. `null` if never read'),
|
|
42
|
+
subscribed: z.boolean().describe('Whether the requesting user is subscribed to the thread'),
|
|
43
|
+
createdBy: z.uuid().describe('Id of the author'),
|
|
44
|
+
createdAt: z.iso.datetime().describe('Creation time'),
|
|
45
|
+
})
|
|
46
|
+
.describe('Root comment of a thread'));
|
|
47
|
+
//# sourceMappingURL=comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.js","sourceRoot":"","sources":["../../../src/api/objects/comment.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,OAAO,EAAE,SAAS;CACV,CAAA;AAGV,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;CACZ,CAAA;AAGV,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,OAAO,CACrC,CAAC;KACE,MAAM,CAAC;IACN,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;IAC3E,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACjE,SAAS,EAAE,CAAC;SACT,IAAI,EAAE;SACN,OAAO,EAAE;SACT,QAAQ,CACP,kFAAkF,CACnF;IACH,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,QAAQ,CAAC,8BAA8B,CAAC;IAClF,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;IACrF,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IAClE,OAAO,EAAE,cAAc;IACvB,gBAAgB,EAAE,CAAC,CAAC,GAAG;SACpB,QAAQ,EAAE;SACV,OAAO,EAAE;SACT,QAAQ,CAAC,kEAAkE,CAAC;IAC/E,UAAU,EAAE,CAAC;SACV,IAAI,EAAE;SACN,OAAO,EAAE;SACT,QAAQ,CAAC,0DAA0D,CAAC;IACvE,UAAU,EAAE,CAAC,CAAC,GAAG;SACd,QAAQ,EAAE;SACV,OAAO,EAAE;SACT,QAAQ,CAAC,gDAAgD,CAAC;IAC7D,UAAU,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;IAC7E,cAAc,EAAE,CAAC,CAAC,GAAG;SAClB,QAAQ,EAAE;SACV,QAAQ,CACP,4GAA4G,CAC7G;IACH,UAAU,EAAE,CAAC,CAAC,GAAG;SACd,QAAQ,EAAE;SACV,OAAO,EAAE;SACT,QAAQ,CACP,wGAAwG,CACzG;IACH,UAAU,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,yDAAyD,CAAC;IAC3F,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC;IAChD,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,eAAe,CAAC;CACtD,CAAC;KACD,QAAQ,CAAC,0BAA0B,CAAC,CACxC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/api/objects/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
declare const MESSAGE_CONTENT_SCHEMA: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
3
|
+
type: z.ZodLiteral<"text">;
|
|
4
|
+
text: z.ZodString;
|
|
5
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
6
|
+
type: z.ZodLiteral<"userMention">;
|
|
7
|
+
userId: z.ZodUUID;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"link">;
|
|
10
|
+
href: z.ZodURL;
|
|
11
|
+
text: z.ZodString;
|
|
12
|
+
}, z.core.$strip>], "type">;
|
|
13
|
+
export type MessageContent = z.infer<typeof MESSAGE_CONTENT_SCHEMA>;
|
|
14
|
+
declare const MESSAGE_BLOCK_SCHEMA: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
15
|
+
type: z.ZodLiteral<"paragraph">;
|
|
16
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
17
|
+
type: z.ZodLiteral<"text">;
|
|
18
|
+
text: z.ZodString;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
type: z.ZodLiteral<"userMention">;
|
|
21
|
+
userId: z.ZodUUID;
|
|
22
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
23
|
+
type: z.ZodLiteral<"link">;
|
|
24
|
+
href: z.ZodURL;
|
|
25
|
+
text: z.ZodString;
|
|
26
|
+
}, z.core.$strip>], "type">>;
|
|
27
|
+
}, z.core.$strip>], "type">;
|
|
28
|
+
export type MessageBlock = z.infer<typeof MESSAGE_BLOCK_SCHEMA>;
|
|
29
|
+
export declare const MESSAGE_SCHEMA: z.ZodObject<{
|
|
30
|
+
version: z.ZodLiteral<1>;
|
|
31
|
+
blocks: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
32
|
+
type: z.ZodLiteral<"paragraph">;
|
|
33
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
34
|
+
type: z.ZodLiteral<"text">;
|
|
35
|
+
text: z.ZodString;
|
|
36
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
37
|
+
type: z.ZodLiteral<"userMention">;
|
|
38
|
+
userId: z.ZodUUID;
|
|
39
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<"link">;
|
|
41
|
+
href: z.ZodURL;
|
|
42
|
+
text: z.ZodString;
|
|
43
|
+
}, z.core.$strip>], "type">>;
|
|
44
|
+
}, z.core.$strip>], "type">>;
|
|
45
|
+
}, z.core.$strip>;
|
|
46
|
+
export type Message = z.infer<typeof MESSAGE_SCHEMA>;
|
|
47
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import z from 'zod/v4';
|
|
2
|
+
const createBaseTypedSchema = (type) => z.object({
|
|
3
|
+
type: z
|
|
4
|
+
.literal(type)
|
|
5
|
+
.describe(`Element type, always \`${type}\`. It selects the shape of the element`),
|
|
6
|
+
});
|
|
7
|
+
const MESSAGE_CONTENT_SCHEMA = z
|
|
8
|
+
.discriminatedUnion('type', [
|
|
9
|
+
createBaseTypedSchema('text').extend({
|
|
10
|
+
text: z.string().min(1).describe('Plain text, without formatting'),
|
|
11
|
+
}),
|
|
12
|
+
createBaseTypedSchema('userMention').extend({
|
|
13
|
+
userId: z.uuid().describe('Id of the mentioned user. Names are never stored in the message'),
|
|
14
|
+
}),
|
|
15
|
+
createBaseTypedSchema('link').extend({
|
|
16
|
+
href: z
|
|
17
|
+
.url({ protocol: /^https?$/ })
|
|
18
|
+
.describe('Link target. Only `http` and `https` URLs are accepted'),
|
|
19
|
+
text: z.string().min(1).describe('Text displayed for the link'),
|
|
20
|
+
}),
|
|
21
|
+
])
|
|
22
|
+
.describe('Content element of a block');
|
|
23
|
+
const MESSAGE_BLOCK_SCHEMA = z
|
|
24
|
+
.discriminatedUnion('type', [
|
|
25
|
+
createBaseTypedSchema('paragraph').extend({
|
|
26
|
+
content: z.array(MESSAGE_CONTENT_SCHEMA).describe('Content elements of the paragraph'),
|
|
27
|
+
}),
|
|
28
|
+
])
|
|
29
|
+
.describe('Block of the message');
|
|
30
|
+
const MESSAGE_MAX_LENGTH = 1000;
|
|
31
|
+
const getContentText = (contents) => contents.map((content) => (content.type === 'userMention' ? '' : content.text)).join('');
|
|
32
|
+
export const MESSAGE_SCHEMA = z.compile(z
|
|
33
|
+
.object({
|
|
34
|
+
version: z.literal(1).describe('Format version. It only changes on a breaking change'),
|
|
35
|
+
blocks: z.array(MESSAGE_BLOCK_SCHEMA).min(1).describe('Blocks of the message, in order'),
|
|
36
|
+
})
|
|
37
|
+
.superRefine((message, ctx) => {
|
|
38
|
+
const contents = message.blocks.flatMap((block) => block.content);
|
|
39
|
+
const text = getContentText(contents);
|
|
40
|
+
const containsUserMention = contents.some((content) => content.type === 'userMention');
|
|
41
|
+
if (text.trim().length === 0 && !containsUserMention) {
|
|
42
|
+
ctx.addIssue({ code: 'custom', message: 'Message must not be empty', path: ['blocks'] });
|
|
43
|
+
}
|
|
44
|
+
else if (text.length > MESSAGE_MAX_LENGTH) {
|
|
45
|
+
ctx.addIssue({
|
|
46
|
+
code: 'too_big',
|
|
47
|
+
origin: 'string',
|
|
48
|
+
maximum: MESSAGE_MAX_LENGTH,
|
|
49
|
+
inclusive: true,
|
|
50
|
+
input: message,
|
|
51
|
+
message: `Message must not exceed ${MESSAGE_MAX_LENGTH} characters`,
|
|
52
|
+
path: ['blocks'],
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
.describe('Message of a comment or reply, in the Chatter rich message format'));
|
|
57
|
+
//# sourceMappingURL=message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/api/objects/message.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical OpenAPI tag catalog for this service's public API.
|
|
3
|
+
*
|
|
4
|
+
* Each tag's `name` and `description` are defined together, exactly ONCE, so a
|
|
5
|
+
* tag name never ends up carrying different descriptions across contracts.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* - a contract tags itself with `OpenApiTags.<Tag>.name`;
|
|
9
|
+
* - the app registers the `{ name, description }` objects under `openapi.tags`
|
|
10
|
+
* (see `src/app.ts`) so the descriptions reach the generated OpenAPI document.
|
|
11
|
+
*/
|
|
12
|
+
export declare const OpenApiTags: {
|
|
13
|
+
readonly Comments: {
|
|
14
|
+
readonly name: 'Comments';
|
|
15
|
+
readonly description: 'Comment threads on Lokalise entities, such as segments.';
|
|
16
|
+
};
|
|
17
|
+
};
|