11import { SlackIcon } from '@/components/icons'
2+ import { createLogger } from '@/lib/logs/console/logger'
23import type { BlockConfig } from '@/blocks/types'
34import { AuthMode } from '@/blocks/types'
45import type { SlackResponse } from '@/tools/slack/types'
56import { getTrigger } from '@/triggers'
67
8+ const logger = createLogger ( 'SlackBlock' )
9+
710export const SlackBlock : BlockConfig < SlackResponse > = {
811 type : 'slack' ,
912 name : 'Slack' ,
@@ -181,7 +184,6 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
181184 id : 'threadTs' ,
182185 title : 'Thread Timestamp' ,
183186 type : 'short-input' ,
184- canonicalParamId : 'thread_ts' ,
185187 placeholder : 'Reply to thread (e.g., 1405894322.002768)' ,
186188 condition : {
187189 field : 'operation' ,
@@ -263,7 +265,6 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
263265 id : 'channelLimit' ,
264266 title : 'Channel Limit' ,
265267 type : 'short-input' ,
266- canonicalParamId : 'limit' ,
267268 placeholder : '100' ,
268269 condition : {
269270 field : 'operation' ,
@@ -275,7 +276,6 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
275276 id : 'memberLimit' ,
276277 title : 'Member Limit' ,
277278 type : 'short-input' ,
278- canonicalParamId : 'limit' ,
279279 placeholder : '100' ,
280280 condition : {
281281 field : 'operation' ,
@@ -301,7 +301,6 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
301301 id : 'userLimit' ,
302302 title : 'User Limit' ,
303303 type : 'short-input' ,
304- canonicalParamId : 'limit' ,
305304 placeholder : '100' ,
306305 condition : {
307306 field : 'operation' ,
@@ -358,7 +357,6 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
358357 id : 'updateTimestamp' ,
359358 title : 'Message Timestamp' ,
360359 type : 'short-input' ,
361- canonicalParamId : 'timestamp' ,
362360 placeholder : 'Message timestamp (e.g., 1405894322.002768)' ,
363361 condition : {
364362 field : 'operation' ,
@@ -382,7 +380,6 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
382380 id : 'deleteTimestamp' ,
383381 title : 'Message Timestamp' ,
384382 type : 'short-input' ,
385- canonicalParamId : 'timestamp' ,
386383 placeholder : 'Message timestamp (e.g., 1405894322.002768)' ,
387384 condition : {
388385 field : 'operation' ,
@@ -395,7 +392,6 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
395392 id : 'reactionTimestamp' ,
396393 title : 'Message Timestamp' ,
397394 type : 'short-input' ,
398- canonicalParamId : 'timestamp' ,
399395 placeholder : 'Message timestamp (e.g., 1405894322.002768)' ,
400396 condition : {
401397 field : 'operation' ,
@@ -407,7 +403,6 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
407403 id : 'emojiName' ,
408404 title : 'Emoji Name' ,
409405 type : 'short-input' ,
410- canonicalParamId : 'name' ,
411406 placeholder : 'Emoji name without colons (e.g., thumbsup, heart, eyes)' ,
412407 condition : {
413408 field : 'operation' ,
@@ -554,47 +549,35 @@ export const SlackBlock: BlockConfig<SlackResponse> = {
554549 baseParams . content = content
555550 break
556551
557- case 'read' :
558- if ( limit ) {
559- const parsedLimit = Number . parseInt ( limit , 10 )
560- baseParams . limit = ! Number . isNaN ( parsedLimit ) ? parsedLimit : 10
561- } else {
562- baseParams . limit = 10
552+ case 'read' : {
553+ const parsedLimit = limit ? Number . parseInt ( limit , 10 ) : 10
554+ if ( Number . isNaN ( parsedLimit ) || parsedLimit < 1 || parsedLimit > 15 ) {
555+ throw new Error ( 'Message limit must be between 1 and 15' )
563556 }
557+ baseParams . limit = parsedLimit
564558 if ( oldest ) {
565559 baseParams . oldest = oldest
566560 }
567561 break
562+ }
568563
569- case 'list_channels' :
564+ case 'list_channels' : {
570565 baseParams . includePrivate = includePrivate !== 'false'
571566 baseParams . excludeArchived = true
572- if ( channelLimit ) {
573- const parsedLimit = Number . parseInt ( channelLimit , 10 )
574- baseParams . limit = ! Number . isNaN ( parsedLimit ) ? parsedLimit : 100
575- } else {
576- baseParams . limit = 100
577- }
567+ baseParams . limit = channelLimit ? Number . parseInt ( channelLimit , 10 ) : 100
578568 break
569+ }
579570
580- case 'list_members' :
581- if ( memberLimit ) {
582- const parsedLimit = Number . parseInt ( memberLimit , 10 )
583- baseParams . limit = ! Number . isNaN ( parsedLimit ) ? parsedLimit : 100
584- } else {
585- baseParams . limit = 100
586- }
571+ case 'list_members' : {
572+ baseParams . limit = memberLimit ? Number . parseInt ( memberLimit , 10 ) : 100
587573 break
574+ }
588575
589- case 'list_users' :
576+ case 'list_users' : {
590577 baseParams . includeDeleted = includeDeleted === 'true'
591- if ( userLimit ) {
592- const parsedLimit = Number . parseInt ( userLimit , 10 )
593- baseParams . limit = ! Number . isNaN ( parsedLimit ) ? parsedLimit : 100
594- } else {
595- baseParams . limit = 100
596- }
578+ baseParams . limit = userLimit ? Number . parseInt ( userLimit , 10 ) : 100
597579 break
580+ }
598581
599582 case 'get_user' :
600583 if ( ! userId ) {
0 commit comments