@doist/comms-sdk 0.8.0 → 0.10.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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SearchResultSchema = exports.SEARCH_RESULT_TYPES = exports.UnreadConversationSchema = exports.UnreadThreadSchema = exports.InboxThreadSchema = exports.ConversationMessageSchema = exports.ConversationMessageObjectSchema = exports.WorkspaceUserSchema = exports.CommentSchema = exports.CommentObjectSchema = exports.ConversationSchema = exports.ConversationObjectSchema = exports.GroupSchema = exports.ThreadSchema = exports.ThreadObjectSchema = exports.ChannelSchema = exports.ChannelObjectSchema = exports.WorkspaceSchema = exports.UserSchema = exports.BaseUserSchema = exports.RequestAttachmentSchema = exports.AttachmentSchema = exports.HookSubscribeResponseSchema = exports.StatusOkSchema = exports.SystemMessageSchema = void 0;
|
|
3
|
+
exports.SearchResultSchema = exports.ConversationSearchResultSchema = exports.ThreadSearchResultSchema = exports.SEARCH_RESULT_TYPES = exports.UnreadConversationSchema = exports.UnreadThreadSchema = exports.InboxThreadSchema = exports.ConversationMessageSchema = exports.ConversationMessageObjectSchema = exports.WorkspaceUserSchema = exports.CommentSchema = exports.CommentObjectSchema = exports.ConversationSchema = exports.ConversationObjectSchema = exports.GroupSchema = exports.ThreadSchema = exports.ThreadObjectSchema = exports.ChannelSchema = exports.ChannelObjectSchema = exports.WorkspaceSchema = exports.UserSchema = exports.BaseUserSchema = exports.RequestAttachmentSchema = exports.AttachmentSchema = exports.HookSubscribeResponseSchema = exports.StatusOkSchema = exports.SystemMessageSchema = void 0;
|
|
4
4
|
exports.createChannelSchema = createChannelSchema;
|
|
5
5
|
exports.createThreadSchema = createThreadSchema;
|
|
6
6
|
exports.createConversationSchema = createConversationSchema;
|
|
@@ -420,19 +420,43 @@ exports.UnreadConversationSchema = zod_1.z.object({
|
|
|
420
420
|
directMention: zod_1.z.boolean(),
|
|
421
421
|
});
|
|
422
422
|
// SearchResult entity from API.
|
|
423
|
-
|
|
424
|
-
|
|
423
|
+
// The API emits 'thread' and 'conversation' results: a match inside a
|
|
424
|
+
// comment is returned as a 'thread' result with `commentId` set, and a match inside a
|
|
425
|
+
// message as a 'conversation' result with `messageId` set.
|
|
426
|
+
const searchResultBaseShape = {
|
|
427
|
+
/**
|
|
428
|
+
* Opaque search-result key in the form `thread_<threadId>` or
|
|
429
|
+
* `conversation_<conversationId>`. Unique per result; not a Comms object id — use
|
|
430
|
+
* `threadId`, `conversationId`, `commentId`, or `messageId` to reference objects.
|
|
431
|
+
*/
|
|
425
432
|
id: zod_1.z.string(),
|
|
426
|
-
type: zod_1.z.enum(exports.SEARCH_RESULT_TYPES),
|
|
427
433
|
snippet: zod_1.z.string(),
|
|
428
434
|
snippetCreatorId: zod_1.z.number(),
|
|
429
435
|
snippetLastUpdated: zod_1.z.date(),
|
|
430
|
-
threadId: zod_1.z.string().nullable().optional(),
|
|
431
|
-
conversationId: zod_1.z.string().nullable().optional(),
|
|
432
|
-
commentId: zod_1.z.string().nullable().optional(),
|
|
433
436
|
channelId: zod_1.z.string().nullable().optional(),
|
|
434
437
|
channelName: zod_1.z.string().nullable().optional(),
|
|
435
438
|
channelColor: zod_1.z.number().nullable().optional(),
|
|
436
439
|
title: zod_1.z.string().nullable().optional(),
|
|
437
440
|
closed: zod_1.z.boolean().nullable().optional(),
|
|
441
|
+
};
|
|
442
|
+
exports.SEARCH_RESULT_TYPES = ['thread', 'conversation'];
|
|
443
|
+
exports.ThreadSearchResultSchema = zod_1.z.object({
|
|
444
|
+
...searchResultBaseShape,
|
|
445
|
+
type: zod_1.z.literal('thread'),
|
|
446
|
+
/** The owning thread id. */
|
|
447
|
+
threadId: zod_1.z.string(),
|
|
448
|
+
/** The matched comment id, set when the match is a comment. */
|
|
449
|
+
commentId: zod_1.z.string().nullable().optional(),
|
|
450
|
+
});
|
|
451
|
+
exports.ConversationSearchResultSchema = zod_1.z.object({
|
|
452
|
+
...searchResultBaseShape,
|
|
453
|
+
type: zod_1.z.literal('conversation'),
|
|
454
|
+
/** The owning conversation id. */
|
|
455
|
+
conversationId: zod_1.z.string(),
|
|
456
|
+
/** The matched message id. */
|
|
457
|
+
messageId: zod_1.z.union([zod_1.z.string(), zod_1.z.number()]).transform(String).nullable().optional(),
|
|
438
458
|
});
|
|
459
|
+
exports.SearchResultSchema = zod_1.z.discriminatedUnion('type', [
|
|
460
|
+
exports.ThreadSearchResultSchema,
|
|
461
|
+
exports.ConversationSearchResultSchema,
|
|
462
|
+
]);
|
|
@@ -410,19 +410,43 @@ export const UnreadConversationSchema = z.object({
|
|
|
410
410
|
directMention: z.boolean(),
|
|
411
411
|
});
|
|
412
412
|
// SearchResult entity from API.
|
|
413
|
-
|
|
414
|
-
|
|
413
|
+
// The API emits 'thread' and 'conversation' results: a match inside a
|
|
414
|
+
// comment is returned as a 'thread' result with `commentId` set, and a match inside a
|
|
415
|
+
// message as a 'conversation' result with `messageId` set.
|
|
416
|
+
const searchResultBaseShape = {
|
|
417
|
+
/**
|
|
418
|
+
* Opaque search-result key in the form `thread_<threadId>` or
|
|
419
|
+
* `conversation_<conversationId>`. Unique per result; not a Comms object id — use
|
|
420
|
+
* `threadId`, `conversationId`, `commentId`, or `messageId` to reference objects.
|
|
421
|
+
*/
|
|
415
422
|
id: z.string(),
|
|
416
|
-
type: z.enum(SEARCH_RESULT_TYPES),
|
|
417
423
|
snippet: z.string(),
|
|
418
424
|
snippetCreatorId: z.number(),
|
|
419
425
|
snippetLastUpdated: z.date(),
|
|
420
|
-
threadId: z.string().nullable().optional(),
|
|
421
|
-
conversationId: z.string().nullable().optional(),
|
|
422
|
-
commentId: z.string().nullable().optional(),
|
|
423
426
|
channelId: z.string().nullable().optional(),
|
|
424
427
|
channelName: z.string().nullable().optional(),
|
|
425
428
|
channelColor: z.number().nullable().optional(),
|
|
426
429
|
title: z.string().nullable().optional(),
|
|
427
430
|
closed: z.boolean().nullable().optional(),
|
|
431
|
+
};
|
|
432
|
+
export const SEARCH_RESULT_TYPES = ['thread', 'conversation'];
|
|
433
|
+
export const ThreadSearchResultSchema = z.object({
|
|
434
|
+
...searchResultBaseShape,
|
|
435
|
+
type: z.literal('thread'),
|
|
436
|
+
/** The owning thread id. */
|
|
437
|
+
threadId: z.string(),
|
|
438
|
+
/** The matched comment id, set when the match is a comment. */
|
|
439
|
+
commentId: z.string().nullable().optional(),
|
|
440
|
+
});
|
|
441
|
+
export const ConversationSearchResultSchema = z.object({
|
|
442
|
+
...searchResultBaseShape,
|
|
443
|
+
type: z.literal('conversation'),
|
|
444
|
+
/** The owning conversation id. */
|
|
445
|
+
conversationId: z.string(),
|
|
446
|
+
/** The matched message id. */
|
|
447
|
+
messageId: z.union([z.string(), z.number()]).transform(String).nullable().optional(),
|
|
428
448
|
});
|
|
449
|
+
export const SearchResultSchema = z.discriminatedUnion('type', [
|
|
450
|
+
ThreadSearchResultSchema,
|
|
451
|
+
ConversationSearchResultSchema,
|
|
452
|
+
]);
|
|
@@ -2802,28 +2802,65 @@ export declare const UnreadConversationSchema: z.ZodObject<{
|
|
|
2802
2802
|
directMention: z.ZodBoolean;
|
|
2803
2803
|
}, z.core.$strip>;
|
|
2804
2804
|
export type UnreadConversation = z.infer<typeof UnreadConversationSchema>;
|
|
2805
|
-
export declare const SEARCH_RESULT_TYPES: readonly ["thread", "
|
|
2805
|
+
export declare const SEARCH_RESULT_TYPES: readonly ["thread", "conversation"];
|
|
2806
2806
|
export type SearchResultType = (typeof SEARCH_RESULT_TYPES)[number];
|
|
2807
|
-
export declare const
|
|
2807
|
+
export declare const ThreadSearchResultSchema: z.ZodObject<{
|
|
2808
|
+
type: z.ZodLiteral<"thread">;
|
|
2809
|
+
threadId: z.ZodString;
|
|
2810
|
+
commentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2808
2811
|
id: z.ZodString;
|
|
2809
|
-
type: z.ZodEnum<{
|
|
2810
|
-
thread: "thread";
|
|
2811
|
-
message: "message";
|
|
2812
|
-
comment: "comment";
|
|
2813
|
-
conversation: "conversation";
|
|
2814
|
-
}>;
|
|
2815
2812
|
snippet: z.ZodString;
|
|
2816
2813
|
snippetCreatorId: z.ZodNumber;
|
|
2817
2814
|
snippetLastUpdated: z.ZodDate;
|
|
2818
|
-
threadId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2819
|
-
conversationId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2820
|
-
commentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2821
2815
|
channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2822
2816
|
channelName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2823
2817
|
channelColor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
2824
2818
|
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2825
2819
|
closed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
2826
2820
|
}, z.core.$strip>;
|
|
2821
|
+
export type ThreadSearchResult = z.infer<typeof ThreadSearchResultSchema>;
|
|
2822
|
+
export declare const ConversationSearchResultSchema: z.ZodObject<{
|
|
2823
|
+
type: z.ZodLiteral<"conversation">;
|
|
2824
|
+
conversationId: z.ZodString;
|
|
2825
|
+
messageId: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
2826
|
+
id: z.ZodString;
|
|
2827
|
+
snippet: z.ZodString;
|
|
2828
|
+
snippetCreatorId: z.ZodNumber;
|
|
2829
|
+
snippetLastUpdated: z.ZodDate;
|
|
2830
|
+
channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2831
|
+
channelName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2832
|
+
channelColor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
2833
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2834
|
+
closed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
2835
|
+
}, z.core.$strip>;
|
|
2836
|
+
export type ConversationSearchResult = z.infer<typeof ConversationSearchResultSchema>;
|
|
2837
|
+
export declare const SearchResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
2838
|
+
type: z.ZodLiteral<"thread">;
|
|
2839
|
+
threadId: z.ZodString;
|
|
2840
|
+
commentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2841
|
+
id: z.ZodString;
|
|
2842
|
+
snippet: z.ZodString;
|
|
2843
|
+
snippetCreatorId: z.ZodNumber;
|
|
2844
|
+
snippetLastUpdated: z.ZodDate;
|
|
2845
|
+
channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2846
|
+
channelName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2847
|
+
channelColor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
2848
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2849
|
+
closed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
2850
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
2851
|
+
type: z.ZodLiteral<"conversation">;
|
|
2852
|
+
conversationId: z.ZodString;
|
|
2853
|
+
messageId: z.ZodOptional<z.ZodNullable<z.ZodPipe<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>, z.ZodTransform<string, string | number>>>>;
|
|
2854
|
+
id: z.ZodString;
|
|
2855
|
+
snippet: z.ZodString;
|
|
2856
|
+
snippetCreatorId: z.ZodNumber;
|
|
2857
|
+
snippetLastUpdated: z.ZodDate;
|
|
2858
|
+
channelId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2859
|
+
channelName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2860
|
+
channelColor: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
2861
|
+
title: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
2862
|
+
closed: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
2863
|
+
}, z.core.$strip>], "type">;
|
|
2827
2864
|
export type SearchResult = z.infer<typeof SearchResultSchema>;
|
|
2828
2865
|
export type SearchResponse = {
|
|
2829
2866
|
items: SearchResult[];
|