@kaa5945/slack-cli 2026.4.11
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 +21 -0
- package/README.md +620 -0
- package/README.zh-TW.md +620 -0
- package/dist/commands/bookmark.d.ts +3 -0
- package/dist/commands/bookmark.d.ts.map +1 -0
- package/dist/commands/bookmark.js +62 -0
- package/dist/commands/bookmark.js.map +1 -0
- package/dist/commands/canvas.d.ts +3 -0
- package/dist/commands/canvas.d.ts.map +1 -0
- package/dist/commands/canvas.js +92 -0
- package/dist/commands/canvas.js.map +1 -0
- package/dist/commands/channel.d.ts +3 -0
- package/dist/commands/channel.d.ts.map +1 -0
- package/dist/commands/channel.js +53 -0
- package/dist/commands/channel.js.map +1 -0
- package/dist/commands/channels.d.ts +3 -0
- package/dist/commands/channels.d.ts.map +1 -0
- package/dist/commands/channels.js +41 -0
- package/dist/commands/channels.js.map +1 -0
- package/dist/commands/config-subcommands.d.ts +17 -0
- package/dist/commands/config-subcommands.d.ts.map +1 -0
- package/dist/commands/config-subcommands.js +170 -0
- package/dist/commands/config-subcommands.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +40 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/delete.d.ts +3 -0
- package/dist/commands/delete.d.ts.map +1 -0
- package/dist/commands/delete.js +28 -0
- package/dist/commands/delete.js.map +1 -0
- package/dist/commands/edit.d.ts +3 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +29 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/history-display.d.ts +9 -0
- package/dist/commands/history-display.d.ts.map +1 -0
- package/dist/commands/history-display.js +17 -0
- package/dist/commands/history-display.js.map +1 -0
- package/dist/commands/history-validators.d.ts +5 -0
- package/dist/commands/history-validators.d.ts.map +1 -0
- package/dist/commands/history-validators.js +35 -0
- package/dist/commands/history-validators.js.map +1 -0
- package/dist/commands/history.d.ts +3 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +141 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/invite.d.ts +3 -0
- package/dist/commands/invite.d.ts.map +1 -0
- package/dist/commands/invite.js +34 -0
- package/dist/commands/invite.js.map +1 -0
- package/dist/commands/join.d.ts +3 -0
- package/dist/commands/join.d.ts.map +1 -0
- package/dist/commands/join.js +25 -0
- package/dist/commands/join.js.map +1 -0
- package/dist/commands/leave.d.ts +3 -0
- package/dist/commands/leave.d.ts.map +1 -0
- package/dist/commands/leave.js +25 -0
- package/dist/commands/leave.js.map +1 -0
- package/dist/commands/members.d.ts +3 -0
- package/dist/commands/members.d.ts.map +1 -0
- package/dist/commands/members.js +53 -0
- package/dist/commands/members.js.map +1 -0
- package/dist/commands/pin.d.ts +3 -0
- package/dist/commands/pin.d.ts.map +1 -0
- package/dist/commands/pin.js +91 -0
- package/dist/commands/pin.js.map +1 -0
- package/dist/commands/reaction.d.ts +3 -0
- package/dist/commands/reaction.d.ts.map +1 -0
- package/dist/commands/reaction.js +45 -0
- package/dist/commands/reaction.js.map +1 -0
- package/dist/commands/reminder.d.ts +3 -0
- package/dist/commands/reminder.d.ts.map +1 -0
- package/dist/commands/reminder.js +78 -0
- package/dist/commands/reminder.js.map +1 -0
- package/dist/commands/scheduled.d.ts +3 -0
- package/dist/commands/scheduled.d.ts.map +1 -0
- package/dist/commands/scheduled.js +69 -0
- package/dist/commands/scheduled.js.map +1 -0
- package/dist/commands/search.d.ts +3 -0
- package/dist/commands/search.d.ts.map +1 -0
- package/dist/commands/search.js +51 -0
- package/dist/commands/search.js.map +1 -0
- package/dist/commands/send-ephemeral.d.ts +3 -0
- package/dist/commands/send-ephemeral.d.ts.map +1 -0
- package/dist/commands/send-ephemeral.js +36 -0
- package/dist/commands/send-ephemeral.js.map +1 -0
- package/dist/commands/send.d.ts +3 -0
- package/dist/commands/send.d.ts.map +1 -0
- package/dist/commands/send.js +125 -0
- package/dist/commands/send.js.map +1 -0
- package/dist/commands/unread.d.ts +3 -0
- package/dist/commands/unread.d.ts.map +1 -0
- package/dist/commands/unread.js +92 -0
- package/dist/commands/unread.js.map +1 -0
- package/dist/commands/upload.d.ts +3 -0
- package/dist/commands/upload.d.ts.map +1 -0
- package/dist/commands/upload.js +99 -0
- package/dist/commands/upload.js.map +1 -0
- package/dist/commands/users.d.ts +3 -0
- package/dist/commands/users.d.ts.map +1 -0
- package/dist/commands/users.js +138 -0
- package/dist/commands/users.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +76 -0
- package/dist/index.js.map +1 -0
- package/dist/types/commands.d.ts +216 -0
- package/dist/types/commands.d.ts.map +1 -0
- package/dist/types/commands.js +3 -0
- package/dist/types/commands.js.map +1 -0
- package/dist/types/config.d.ts +18 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/slack.d.ts +198 -0
- package/dist/types/slack.d.ts.map +1 -0
- package/dist/types/slack.js +3 -0
- package/dist/types/slack.js.map +1 -0
- package/dist/utils/attachment-downloader.d.ts +22 -0
- package/dist/utils/attachment-downloader.d.ts.map +1 -0
- package/dist/utils/attachment-downloader.js +138 -0
- package/dist/utils/attachment-downloader.js.map +1 -0
- package/dist/utils/channel-formatter.d.ts +13 -0
- package/dist/utils/channel-formatter.d.ts.map +1 -0
- package/dist/utils/channel-formatter.js +43 -0
- package/dist/utils/channel-formatter.js.map +1 -0
- package/dist/utils/channel-resolver.d.ts +27 -0
- package/dist/utils/channel-resolver.d.ts.map +1 -0
- package/dist/utils/channel-resolver.js +76 -0
- package/dist/utils/channel-resolver.js.map +1 -0
- package/dist/utils/client-factory.d.ts +6 -0
- package/dist/utils/client-factory.d.ts.map +1 -0
- package/dist/utils/client-factory.js +13 -0
- package/dist/utils/client-factory.js.map +1 -0
- package/dist/utils/command-support.d.ts +16 -0
- package/dist/utils/command-support.d.ts.map +1 -0
- package/dist/utils/command-support.js +29 -0
- package/dist/utils/command-support.js.map +1 -0
- package/dist/utils/command-wrapper.d.ts +6 -0
- package/dist/utils/command-wrapper.d.ts.map +1 -0
- package/dist/utils/command-wrapper.js +27 -0
- package/dist/utils/command-wrapper.js.map +1 -0
- package/dist/utils/config-helper.d.ts +8 -0
- package/dist/utils/config-helper.d.ts.map +1 -0
- package/dist/utils/config-helper.js +19 -0
- package/dist/utils/config-helper.js.map +1 -0
- package/dist/utils/constants.d.ts +64 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +77 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/date-utils.d.ts +4 -0
- package/dist/utils/date-utils.d.ts.map +1 -0
- package/dist/utils/date-utils.js +24 -0
- package/dist/utils/date-utils.js.map +1 -0
- package/dist/utils/error-utils.d.ts +4 -0
- package/dist/utils/error-utils.d.ts.map +1 -0
- package/dist/utils/error-utils.js +46 -0
- package/dist/utils/error-utils.js.map +1 -0
- package/dist/utils/errors.d.ts +17 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +36 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/format-utils.d.ts +4 -0
- package/dist/utils/format-utils.d.ts.map +1 -0
- package/dist/utils/format-utils.js +24 -0
- package/dist/utils/format-utils.js.map +1 -0
- package/dist/utils/formatters/base-formatter.d.ts +23 -0
- package/dist/utils/formatters/base-formatter.d.ts.map +1 -0
- package/dist/utils/formatters/base-formatter.js +27 -0
- package/dist/utils/formatters/base-formatter.js.map +1 -0
- package/dist/utils/formatters/bookmark-formatters.d.ts +14 -0
- package/dist/utils/formatters/bookmark-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/bookmark-formatters.js +60 -0
- package/dist/utils/formatters/bookmark-formatters.js.map +1 -0
- package/dist/utils/formatters/channel-formatters.d.ts +7 -0
- package/dist/utils/formatters/channel-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/channel-formatters.js +65 -0
- package/dist/utils/formatters/channel-formatters.js.map +1 -0
- package/dist/utils/formatters/channel-info-formatters.d.ts +6 -0
- package/dist/utils/formatters/channel-info-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/channel-info-formatters.js +69 -0
- package/dist/utils/formatters/channel-info-formatters.js.map +1 -0
- package/dist/utils/formatters/channels-list-formatters.d.ts +6 -0
- package/dist/utils/formatters/channels-list-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/channels-list-formatters.js +49 -0
- package/dist/utils/formatters/channels-list-formatters.js.map +1 -0
- package/dist/utils/formatters/history-formatters.d.ts +10 -0
- package/dist/utils/formatters/history-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/history-formatters.js +87 -0
- package/dist/utils/formatters/history-formatters.js.map +1 -0
- package/dist/utils/formatters/members-formatters.d.ts +10 -0
- package/dist/utils/formatters/members-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/members-formatters.js +42 -0
- package/dist/utils/formatters/members-formatters.js.map +1 -0
- package/dist/utils/formatters/message-formatters.d.ts +12 -0
- package/dist/utils/formatters/message-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/message-formatters.js +95 -0
- package/dist/utils/formatters/message-formatters.js.map +1 -0
- package/dist/utils/formatters/reminder-formatters.d.ts +12 -0
- package/dist/utils/formatters/reminder-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/reminder-formatters.js +64 -0
- package/dist/utils/formatters/reminder-formatters.js.map +1 -0
- package/dist/utils/formatters/search-formatters.d.ts +10 -0
- package/dist/utils/formatters/search-formatters.d.ts.map +1 -0
- package/dist/utils/formatters/search-formatters.js +87 -0
- package/dist/utils/formatters/search-formatters.js.map +1 -0
- package/dist/utils/mention-utils.d.ts +17 -0
- package/dist/utils/mention-utils.d.ts.map +1 -0
- package/dist/utils/mention-utils.js +45 -0
- package/dist/utils/mention-utils.js.map +1 -0
- package/dist/utils/option-parsers.d.ts +47 -0
- package/dist/utils/option-parsers.d.ts.map +1 -0
- package/dist/utils/option-parsers.js +75 -0
- package/dist/utils/option-parsers.js.map +1 -0
- package/dist/utils/profile-config.d.ts +19 -0
- package/dist/utils/profile-config.d.ts.map +1 -0
- package/dist/utils/profile-config.js +203 -0
- package/dist/utils/profile-config.js.map +1 -0
- package/dist/utils/schedule-utils.d.ts +3 -0
- package/dist/utils/schedule-utils.d.ts.map +1 -0
- package/dist/utils/schedule-utils.js +34 -0
- package/dist/utils/schedule-utils.js.map +1 -0
- package/dist/utils/slack-api-client.d.ts +3 -0
- package/dist/utils/slack-api-client.d.ts.map +1 -0
- package/dist/utils/slack-api-client.js +22 -0
- package/dist/utils/slack-api-client.js.map +1 -0
- package/dist/utils/slack-client-service.d.ts +66 -0
- package/dist/utils/slack-client-service.d.ts.map +1 -0
- package/dist/utils/slack-client-service.js +181 -0
- package/dist/utils/slack-client-service.js.map +1 -0
- package/dist/utils/slack-operations/base-client.d.ts +18 -0
- package/dist/utils/slack-operations/base-client.d.ts.map +1 -0
- package/dist/utils/slack-operations/base-client.js +52 -0
- package/dist/utils/slack-operations/base-client.js.map +1 -0
- package/dist/utils/slack-operations/canvas-operations.d.ts +10 -0
- package/dist/utils/slack-operations/canvas-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/canvas-operations.js +28 -0
- package/dist/utils/slack-operations/canvas-operations.js.map +1 -0
- package/dist/utils/slack-operations/channel-operations.d.ts +33 -0
- package/dist/utils/slack-operations/channel-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/channel-operations.js +276 -0
- package/dist/utils/slack-operations/channel-operations.js.map +1 -0
- package/dist/utils/slack-operations/file-operations.d.ts +19 -0
- package/dist/utils/slack-operations/file-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/file-operations.js +51 -0
- package/dist/utils/slack-operations/file-operations.js.map +1 -0
- package/dist/utils/slack-operations/index.d.ts +5 -0
- package/dist/utils/slack-operations/index.d.ts.map +1 -0
- package/dist/utils/slack-operations/index.js +12 -0
- package/dist/utils/slack-operations/index.js.map +1 -0
- package/dist/utils/slack-operations/message-history-operations.d.ts +17 -0
- package/dist/utils/slack-operations/message-history-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-history-operations.js +101 -0
- package/dist/utils/slack-operations/message-history-operations.js.map +1 -0
- package/dist/utils/slack-operations/message-operations.d.ts +24 -0
- package/dist/utils/slack-operations/message-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-operations.js +61 -0
- package/dist/utils/slack-operations/message-operations.js.map +1 -0
- package/dist/utils/slack-operations/message-permalink-operations.d.ts +10 -0
- package/dist/utils/slack-operations/message-permalink-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-permalink-operations.js +49 -0
- package/dist/utils/slack-operations/message-permalink-operations.js.map +1 -0
- package/dist/utils/slack-operations/message-user-resolver.d.ts +7 -0
- package/dist/utils/slack-operations/message-user-resolver.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-user-resolver.js +27 -0
- package/dist/utils/slack-operations/message-user-resolver.js.map +1 -0
- package/dist/utils/slack-operations/message-write-operations.d.ts +17 -0
- package/dist/utils/slack-operations/message-write-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/message-write-operations.js +76 -0
- package/dist/utils/slack-operations/message-write-operations.js.map +1 -0
- package/dist/utils/slack-operations/pin-operations.d.ts +11 -0
- package/dist/utils/slack-operations/pin-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/pin-operations.js +34 -0
- package/dist/utils/slack-operations/pin-operations.js.map +1 -0
- package/dist/utils/slack-operations/reaction-operations.d.ts +10 -0
- package/dist/utils/slack-operations/reaction-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/reaction-operations.js +32 -0
- package/dist/utils/slack-operations/reaction-operations.js.map +1 -0
- package/dist/utils/slack-operations/reminder-operations.d.ts +10 -0
- package/dist/utils/slack-operations/reminder-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/reminder-operations.js +32 -0
- package/dist/utils/slack-operations/reminder-operations.js.map +1 -0
- package/dist/utils/slack-operations/search-operations.d.ts +11 -0
- package/dist/utils/slack-operations/search-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/search-operations.js +116 -0
- package/dist/utils/slack-operations/search-operations.js.map +1 -0
- package/dist/utils/slack-operations/star-operations.d.ts +9 -0
- package/dist/utils/slack-operations/star-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/star-operations.js +32 -0
- package/dist/utils/slack-operations/star-operations.js.map +1 -0
- package/dist/utils/slack-operations/user-operations.d.ts +12 -0
- package/dist/utils/slack-operations/user-operations.d.ts.map +1 -0
- package/dist/utils/slack-operations/user-operations.js +69 -0
- package/dist/utils/slack-operations/user-operations.js.map +1 -0
- package/dist/utils/slack-patterns.d.ts +20 -0
- package/dist/utils/slack-patterns.d.ts.map +1 -0
- package/dist/utils/slack-patterns.js +54 -0
- package/dist/utils/slack-patterns.js.map +1 -0
- package/dist/utils/terminal-sanitizer.d.ts +7 -0
- package/dist/utils/terminal-sanitizer.d.ts.map +1 -0
- package/dist/utils/terminal-sanitizer.js +51 -0
- package/dist/utils/terminal-sanitizer.js.map +1 -0
- package/dist/utils/token-crypto-service.d.ts +40 -0
- package/dist/utils/token-crypto-service.d.ts.map +1 -0
- package/dist/utils/token-crypto-service.js +273 -0
- package/dist/utils/token-crypto-service.js.map +1 -0
- package/dist/utils/token-utils.d.ts +7 -0
- package/dist/utils/token-utils.d.ts.map +1 -0
- package/dist/utils/token-utils.js +18 -0
- package/dist/utils/token-utils.js.map +1 -0
- package/dist/utils/update-notifier.d.ts +10 -0
- package/dist/utils/update-notifier.d.ts.map +1 -0
- package/dist/utils/update-notifier.js +147 -0
- package/dist/utils/update-notifier.js.map +1 -0
- package/dist/utils/validators.d.ts +147 -0
- package/dist/utils/validators.d.ts.map +1 -0
- package/dist/utils/validators.js +401 -0
- package/dist/utils/validators.js.map +1 -0
- package/package.json +58 -0
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type CommandAction<T = unknown> = (options: T) => Promise<void> | void;
|
|
2
|
+
export declare function wrapCommand<T = unknown>(action: CommandAction<T>): CommandAction<T>;
|
|
3
|
+
export declare function getProfileName(configManager: {
|
|
4
|
+
getCurrentProfile: () => Promise<string>;
|
|
5
|
+
}, providedProfile?: string): Promise<string>;
|
|
6
|
+
//# sourceMappingURL=command-wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-wrapper.d.ts","sourceRoot":"","sources":["../../src/utils/command-wrapper.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,CAAC,CAAC,GAAG,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAE9E,wBAAgB,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CAcnF;AAED,wBAAsB,cAAc,CAClC,aAAa,EAAE;IAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,EAC3D,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,MAAM,CAAC,CAEjB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.wrapCommand = wrapCommand;
|
|
7
|
+
exports.getProfileName = getProfileName;
|
|
8
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
9
|
+
const error_utils_1 = require("./error-utils");
|
|
10
|
+
function wrapCommand(action) {
|
|
11
|
+
return async (options) => {
|
|
12
|
+
try {
|
|
13
|
+
await action(options);
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error(chalk_1.default.red('✗ Error:'), (0, error_utils_1.extractErrorMessage)(error));
|
|
17
|
+
if (process.env.NODE_ENV === 'development' && error instanceof Error) {
|
|
18
|
+
console.error(chalk_1.default.gray(error.stack));
|
|
19
|
+
}
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
async function getProfileName(configManager, providedProfile) {
|
|
25
|
+
return providedProfile || (await configManager.getCurrentProfile());
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=command-wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-wrapper.js","sourceRoot":"","sources":["../../src/utils/command-wrapper.ts"],"names":[],"mappings":";;;;;AAKA,kCAcC;AAED,wCAKC;AA1BD,kDAA0B;AAC1B,+CAAoD;AAIpD,SAAgB,WAAW,CAAc,MAAwB;IAC/D,OAAO,KAAK,EAAE,OAAU,EAAE,EAAE;QAC1B,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,IAAA,iCAAmB,EAAC,KAAK,CAAC,CAAC,CAAC;YAEjE,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;gBACrE,OAAO,CAAC,KAAK,CAAC,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;YACzC,CAAC;YAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,cAAc,CAClC,aAA2D,EAC3D,eAAwB;IAExB,OAAO,eAAe,IAAI,CAAC,MAAM,aAAa,CAAC,iBAAiB,EAAE,CAAC,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ProfileConfigManager } from './profile-config';
|
|
2
|
+
/**
|
|
3
|
+
* Helper function to get configuration with proper error handling
|
|
4
|
+
*/
|
|
5
|
+
export declare function getConfigOrThrow(profile?: string, configManager?: ProfileConfigManager): Promise<{
|
|
6
|
+
token: string;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=config-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-helper.d.ts","sourceRoot":"","sources":["../../src/utils/config-helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD;;GAEG;AACH,wBAAsB,gBAAgB,CACpC,OAAO,CAAC,EAAE,MAAM,EAChB,aAAa,GAAE,oBAAiD,GAC/D,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,CAU5B"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConfigOrThrow = getConfigOrThrow;
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const errors_1 = require("./errors");
|
|
6
|
+
const profile_config_1 = require("./profile-config");
|
|
7
|
+
/**
|
|
8
|
+
* Helper function to get configuration with proper error handling
|
|
9
|
+
*/
|
|
10
|
+
async function getConfigOrThrow(profile, configManager = new profile_config_1.ProfileConfigManager()) {
|
|
11
|
+
const config = await configManager.getConfig(profile);
|
|
12
|
+
if (!config) {
|
|
13
|
+
const profiles = await configManager.listProfiles();
|
|
14
|
+
const profileName = profile || profiles.find((p) => p.isDefault)?.name || 'default';
|
|
15
|
+
throw new errors_1.ConfigurationError(constants_1.ERROR_MESSAGES.NO_CONFIG(profileName));
|
|
16
|
+
}
|
|
17
|
+
return config;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=config-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-helper.js","sourceRoot":"","sources":["../../src/utils/config-helper.ts"],"names":[],"mappings":";;AAOA,4CAaC;AApBD,2CAA6C;AAC7C,qCAA8C;AAC9C,qDAAwD;AAExD;;GAEG;AACI,KAAK,UAAU,gBAAgB,CACpC,OAAgB,EAChB,gBAAsC,IAAI,qCAAoB,EAAE;IAEhE,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IAEtD,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,QAAQ,GAAG,MAAM,aAAa,CAAC,YAAY,EAAE,CAAC;QACpD,MAAM,WAAW,GAAG,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,IAAI,IAAI,SAAS,CAAC;QACpF,MAAM,IAAI,2BAAkB,CAAC,0BAAc,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export declare const TOKEN_MASK_LENGTH = 4;
|
|
2
|
+
export declare const TOKEN_MIN_LENGTH = 9;
|
|
3
|
+
export declare const DEFAULT_PROFILE_NAME = "default";
|
|
4
|
+
export declare const ERROR_MESSAGES: {
|
|
5
|
+
readonly NO_CONFIG: (profileName: string) => string;
|
|
6
|
+
readonly PROFILE_NOT_FOUND: (profileName: string) => string;
|
|
7
|
+
readonly NO_PROFILES_FOUND: "No profiles found. Use \"slack-cli config set --token <token>\" to create one.";
|
|
8
|
+
readonly INVALID_CONFIG_FORMAT: "Invalid config file format";
|
|
9
|
+
readonly NO_MESSAGE_OR_FILE: "You must specify either --message or --file";
|
|
10
|
+
readonly BOTH_MESSAGE_AND_FILE: "Cannot use both --message and --file";
|
|
11
|
+
readonly INVALID_THREAD_TIMESTAMP: "Invalid thread timestamp format";
|
|
12
|
+
readonly INVALID_SCHEDULE_AT: "Invalid schedule time format. Use Unix timestamp (seconds) or ISO 8601 date-time";
|
|
13
|
+
readonly INVALID_SCHEDULE_AFTER: "--after must be a positive integer (minutes)";
|
|
14
|
+
readonly BOTH_SCHEDULE_OPTIONS: "Cannot use both --at and --after";
|
|
15
|
+
readonly SCHEDULE_TIME_IN_PAST: "Schedule time must be in the future";
|
|
16
|
+
readonly API_ERROR: (error: string) => string;
|
|
17
|
+
readonly CHANNEL_NOT_FOUND: (channel: string) => string;
|
|
18
|
+
readonly FILE_READ_ERROR: (file: string, error: string) => string;
|
|
19
|
+
readonly FILE_NOT_FOUND: (file: string) => string;
|
|
20
|
+
readonly NO_CHANNELS_FOUND: "No channels found";
|
|
21
|
+
readonly ERROR_LISTING_CHANNELS: (error: string) => string;
|
|
22
|
+
};
|
|
23
|
+
export declare const SUCCESS_MESSAGES: {
|
|
24
|
+
readonly TOKEN_SAVED: (profileName: string) => string;
|
|
25
|
+
readonly PROFILE_SWITCHED: (profileName: string) => string;
|
|
26
|
+
readonly PROFILE_CLEARED: (profileName: string) => string;
|
|
27
|
+
readonly MESSAGE_SENT: (channel: string) => string;
|
|
28
|
+
readonly MESSAGE_SCHEDULED: (channel: string, postAtIso: string) => string;
|
|
29
|
+
readonly EPHEMERAL_MESSAGE_SENT: (channel: string) => string;
|
|
30
|
+
};
|
|
31
|
+
export declare const FILE_PERMISSIONS: {
|
|
32
|
+
CONFIG_DIR: number;
|
|
33
|
+
CONFIG_FILE: number;
|
|
34
|
+
};
|
|
35
|
+
export declare const API_LIMITS: {
|
|
36
|
+
MAX_MESSAGE_COUNT: number;
|
|
37
|
+
MIN_MESSAGE_COUNT: number;
|
|
38
|
+
DEFAULT_MESSAGE_COUNT: number;
|
|
39
|
+
DEFAULT_SEARCH_COUNT: number;
|
|
40
|
+
MAX_SEARCH_COUNT: number;
|
|
41
|
+
MIN_SEARCH_COUNT: number;
|
|
42
|
+
MAX_SEARCH_PAGE: number;
|
|
43
|
+
MIN_SEARCH_PAGE: number;
|
|
44
|
+
};
|
|
45
|
+
export declare const RATE_LIMIT: {
|
|
46
|
+
CONCURRENT_REQUESTS: number;
|
|
47
|
+
UNREAD_SCAN_CONCURRENT_REQUESTS: number;
|
|
48
|
+
BATCH_SIZE: number;
|
|
49
|
+
BATCH_DELAY_MS: number;
|
|
50
|
+
RETRY_CONFIG: {
|
|
51
|
+
retries: number;
|
|
52
|
+
factor: number;
|
|
53
|
+
minTimeout: number;
|
|
54
|
+
maxTimeout: number;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
export declare const DEFAULTS: {
|
|
58
|
+
HISTORY_LIMIT: number;
|
|
59
|
+
CHANNELS_LIMIT: number;
|
|
60
|
+
UNREAD_DISPLAY_LIMIT: number;
|
|
61
|
+
UNREAD_MESSAGE_PREVIEW_LIMIT: number;
|
|
62
|
+
};
|
|
63
|
+
export declare const TIME_FORMAT = "YYYY-MM-DD HH:mm:ss";
|
|
64
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,IAAI,CAAC;AACnC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAClC,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C,eAAO,MAAM,cAAc;sCAEA,MAAM;8CAEE,MAAM;;;;;;;;;;gCAepB,MAAM;0CACI,MAAM;qCAGX,MAAM,SAAS,MAAM;oCACtB,MAAM;;6CAIG,MAAM;CAC9B,CAAC;AAEX,eAAO,MAAM,gBAAgB;wCACA,MAAM;6CACD,MAAM;4CACP,MAAM;qCACb,MAAM;0CACD,MAAM,aAAa,MAAM;+CAEpB,MAAM;CAChC,CAAC;AAGX,eAAO,MAAM,gBAAgB;;;CAG5B,CAAC;AAGF,eAAO,MAAM,UAAU;;;;;;;;;CAStB,CAAC;AAGF,eAAO,MAAM,UAAU;;;;;;;;;;;CAWtB,CAAC;AAGF,eAAO,MAAM,QAAQ;;;;;CAKpB,CAAC;AAGF,eAAO,MAAM,WAAW,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TIME_FORMAT = exports.DEFAULTS = exports.RATE_LIMIT = exports.API_LIMITS = exports.FILE_PERMISSIONS = exports.SUCCESS_MESSAGES = exports.ERROR_MESSAGES = exports.DEFAULT_PROFILE_NAME = exports.TOKEN_MIN_LENGTH = exports.TOKEN_MASK_LENGTH = void 0;
|
|
4
|
+
exports.TOKEN_MASK_LENGTH = 4;
|
|
5
|
+
exports.TOKEN_MIN_LENGTH = 9;
|
|
6
|
+
exports.DEFAULT_PROFILE_NAME = 'default';
|
|
7
|
+
exports.ERROR_MESSAGES = {
|
|
8
|
+
// Configuration errors
|
|
9
|
+
NO_CONFIG: (profileName) => `No configuration found for profile "${profileName}". Use "slack-cli config set --token <token> --profile ${profileName}" to set up.`,
|
|
10
|
+
PROFILE_NOT_FOUND: (profileName) => `Profile "${profileName}" not found`,
|
|
11
|
+
NO_PROFILES_FOUND: 'No profiles found. Use "slack-cli config set --token <token>" to create one.',
|
|
12
|
+
INVALID_CONFIG_FORMAT: 'Invalid config file format',
|
|
13
|
+
// Validation errors
|
|
14
|
+
NO_MESSAGE_OR_FILE: 'You must specify either --message or --file',
|
|
15
|
+
BOTH_MESSAGE_AND_FILE: 'Cannot use both --message and --file',
|
|
16
|
+
INVALID_THREAD_TIMESTAMP: 'Invalid thread timestamp format',
|
|
17
|
+
INVALID_SCHEDULE_AT: 'Invalid schedule time format. Use Unix timestamp (seconds) or ISO 8601 date-time',
|
|
18
|
+
INVALID_SCHEDULE_AFTER: '--after must be a positive integer (minutes)',
|
|
19
|
+
BOTH_SCHEDULE_OPTIONS: 'Cannot use both --at and --after',
|
|
20
|
+
SCHEDULE_TIME_IN_PAST: 'Schedule time must be in the future',
|
|
21
|
+
// API errors
|
|
22
|
+
API_ERROR: (error) => `API Error: ${error}`,
|
|
23
|
+
CHANNEL_NOT_FOUND: (channel) => `Channel not found: ${channel}`,
|
|
24
|
+
// File errors
|
|
25
|
+
FILE_READ_ERROR: (file, error) => `Error reading file ${file}: ${error}`,
|
|
26
|
+
FILE_NOT_FOUND: (file) => `File not found: ${file}`,
|
|
27
|
+
// Channels command errors
|
|
28
|
+
NO_CHANNELS_FOUND: 'No channels found',
|
|
29
|
+
ERROR_LISTING_CHANNELS: (error) => `Error listing channels: ${error}`,
|
|
30
|
+
};
|
|
31
|
+
exports.SUCCESS_MESSAGES = {
|
|
32
|
+
TOKEN_SAVED: (profileName) => `Token saved successfully for profile "${profileName}"`,
|
|
33
|
+
PROFILE_SWITCHED: (profileName) => `Switched to profile "${profileName}"`,
|
|
34
|
+
PROFILE_CLEARED: (profileName) => `Profile "${profileName}" cleared successfully`,
|
|
35
|
+
MESSAGE_SENT: (channel) => `Message sent successfully to #${channel}`,
|
|
36
|
+
MESSAGE_SCHEDULED: (channel, postAtIso) => `Message scheduled to #${channel} at ${postAtIso}`,
|
|
37
|
+
EPHEMERAL_MESSAGE_SENT: (channel) => `Ephemeral message sent to #${channel}`,
|
|
38
|
+
};
|
|
39
|
+
// File and system constants
|
|
40
|
+
exports.FILE_PERMISSIONS = {
|
|
41
|
+
CONFIG_DIR: 0o700, // Read/write/execute for owner only
|
|
42
|
+
CONFIG_FILE: 0o600, // Read/write for owner only
|
|
43
|
+
};
|
|
44
|
+
// API limits
|
|
45
|
+
exports.API_LIMITS = {
|
|
46
|
+
MAX_MESSAGE_COUNT: 1000,
|
|
47
|
+
MIN_MESSAGE_COUNT: 1,
|
|
48
|
+
DEFAULT_MESSAGE_COUNT: 10,
|
|
49
|
+
DEFAULT_SEARCH_COUNT: 20,
|
|
50
|
+
MAX_SEARCH_COUNT: 100,
|
|
51
|
+
MIN_SEARCH_COUNT: 1,
|
|
52
|
+
MAX_SEARCH_PAGE: 100,
|
|
53
|
+
MIN_SEARCH_PAGE: 1,
|
|
54
|
+
};
|
|
55
|
+
// API Rate Limiting Configuration
|
|
56
|
+
exports.RATE_LIMIT = {
|
|
57
|
+
CONCURRENT_REQUESTS: 3,
|
|
58
|
+
UNREAD_SCAN_CONCURRENT_REQUESTS: 15,
|
|
59
|
+
BATCH_SIZE: 10,
|
|
60
|
+
BATCH_DELAY_MS: 1000,
|
|
61
|
+
RETRY_CONFIG: {
|
|
62
|
+
retries: 3,
|
|
63
|
+
factor: 2,
|
|
64
|
+
minTimeout: 1000,
|
|
65
|
+
maxTimeout: 30000,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
// Default values
|
|
69
|
+
exports.DEFAULTS = {
|
|
70
|
+
HISTORY_LIMIT: 20,
|
|
71
|
+
CHANNELS_LIMIT: 1000,
|
|
72
|
+
UNREAD_DISPLAY_LIMIT: 50,
|
|
73
|
+
UNREAD_MESSAGE_PREVIEW_LIMIT: 50,
|
|
74
|
+
};
|
|
75
|
+
// Time formats
|
|
76
|
+
exports.TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss';
|
|
77
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,iBAAiB,GAAG,CAAC,CAAC;AACtB,QAAA,gBAAgB,GAAG,CAAC,CAAC;AACrB,QAAA,oBAAoB,GAAG,SAAS,CAAC;AAEjC,QAAA,cAAc,GAAG;IAC5B,uBAAuB;IACvB,SAAS,EAAE,CAAC,WAAmB,EAAE,EAAE,CACjC,uCAAuC,WAAW,0DAA0D,WAAW,cAAc;IACvI,iBAAiB,EAAE,CAAC,WAAmB,EAAE,EAAE,CAAC,YAAY,WAAW,aAAa;IAChF,iBAAiB,EAAE,8EAA8E;IACjG,qBAAqB,EAAE,4BAA4B;IAEnD,oBAAoB;IACpB,kBAAkB,EAAE,6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E,4BAA4B;CACjD,CAAC;AAEF,aAAa;AACA,QAAA,UAAU,GAAG;IACxB,iBAAiB,EAAE,IAAI;IACvB,iBAAiB,EAAE,CAAC;IACpB,qBAAqB,EAAE,EAAE;IACzB,oBAAoB,EAAE,EAAE;IACxB,gBAAgB,EAAE,GAAG;IACrB,gBAAgB,EAAE,CAAC;IACnB,eAAe,EAAE,GAAG;IACpB,eAAe,EAAE,CAAC;CACnB,CAAC;AAEF,kCAAkC;AACrB,QAAA,UAAU,GAAG;IACxB,mBAAmB,EAAE,CAAC;IACtB,+BAA+B,EAAE,EAAE;IACnC,UAAU,EAAE,EAAE;IACd,cAAc,EAAE,IAAI;IACpB,YAAY,EAAE;QACZ,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,CAAC;QACT,UAAU,EAAE,IAAI;QAChB,UAAU,EAAE,KAAK;KAClB;CACF,CAAC;AAEF,iBAAiB;AACJ,QAAA,QAAQ,GAAG;IACtB,aAAa,EAAE,EAAE;IACjB,cAAc,EAAE,IAAI;IACpB,oBAAoB,EAAE,EAAE;IACxB,4BAA4B,EAAE,EAAE;CACjC,CAAC;AAEF,eAAe;AACF,QAAA,WAAW,GAAG,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare function formatUnixTimestamp(timestamp: number): string;
|
|
2
|
+
export declare function formatSlackTimestamp(slackTimestamp: string): string;
|
|
3
|
+
export declare function formatTimestampFixed(slackTimestamp: string): string;
|
|
4
|
+
//# sourceMappingURL=date-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-utils.d.ts","sourceRoot":"","sources":["../../src/utils/date-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAGnE;AAED,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAUnE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatUnixTimestamp = formatUnixTimestamp;
|
|
4
|
+
exports.formatSlackTimestamp = formatSlackTimestamp;
|
|
5
|
+
exports.formatTimestampFixed = formatTimestampFixed;
|
|
6
|
+
function formatUnixTimestamp(timestamp) {
|
|
7
|
+
return new Date(timestamp * 1000).toISOString().split('T')[0];
|
|
8
|
+
}
|
|
9
|
+
function formatSlackTimestamp(slackTimestamp) {
|
|
10
|
+
const timestamp = parseFloat(slackTimestamp);
|
|
11
|
+
return new Date(timestamp * 1000).toLocaleString();
|
|
12
|
+
}
|
|
13
|
+
function formatTimestampFixed(slackTimestamp) {
|
|
14
|
+
const timestamp = parseFloat(slackTimestamp);
|
|
15
|
+
const date = new Date(timestamp * 1000);
|
|
16
|
+
const year = date.getFullYear();
|
|
17
|
+
const month = String(date.getMonth() + 1).padStart(2, '0');
|
|
18
|
+
const day = String(date.getDate()).padStart(2, '0');
|
|
19
|
+
const hours = String(date.getHours()).padStart(2, '0');
|
|
20
|
+
const minutes = String(date.getMinutes()).padStart(2, '0');
|
|
21
|
+
const seconds = String(date.getSeconds()).padStart(2, '0');
|
|
22
|
+
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=date-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"date-utils.js","sourceRoot":"","sources":["../../src/utils/date-utils.ts"],"names":[],"mappings":";;AAAA,kDAEC;AAED,oDAGC;AAED,oDAUC;AAnBD,SAAgB,mBAAmB,CAAC,SAAiB;IACnD,OAAO,IAAI,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,SAAgB,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,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAWpE;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAU7D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAU1D"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSlackErrorCode = getSlackErrorCode;
|
|
4
|
+
exports.getSlackNeededScopes = getSlackNeededScopes;
|
|
5
|
+
exports.extractErrorMessage = extractErrorMessage;
|
|
6
|
+
function getSlackErrorData(error) {
|
|
7
|
+
if (!(error instanceof Error)) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
const data = error.data;
|
|
11
|
+
if (!data || typeof data !== 'object') {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return data;
|
|
15
|
+
}
|
|
16
|
+
function getSlackErrorCode(error) {
|
|
17
|
+
const data = getSlackErrorData(error);
|
|
18
|
+
if (typeof data?.error === 'string' && data.error.length > 0) {
|
|
19
|
+
return data.error;
|
|
20
|
+
}
|
|
21
|
+
if (error instanceof Error && error.message.includes('missing_scope')) {
|
|
22
|
+
return 'missing_scope';
|
|
23
|
+
}
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
function getSlackNeededScopes(error) {
|
|
27
|
+
const data = getSlackErrorData(error);
|
|
28
|
+
if (typeof data?.needed !== 'string' || data.needed.length === 0) {
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
return data.needed
|
|
32
|
+
.split(',')
|
|
33
|
+
.map((scope) => scope.trim())
|
|
34
|
+
.filter((scope) => scope.length > 0);
|
|
35
|
+
}
|
|
36
|
+
function extractErrorMessage(error) {
|
|
37
|
+
if (error instanceof Error) {
|
|
38
|
+
const neededScopes = getSlackNeededScopes(error);
|
|
39
|
+
if (getSlackErrorCode(error) === 'missing_scope' && neededScopes.length > 0) {
|
|
40
|
+
return `${error.message} (needed: ${neededScopes.join(', ')})`;
|
|
41
|
+
}
|
|
42
|
+
return error.message;
|
|
43
|
+
}
|
|
44
|
+
return String(error);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=error-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-utils.js","sourceRoot":"","sources":["../../src/utils/error-utils.ts"],"names":[],"mappings":";;AAkBA,8CAWC;AAED,oDAUC;AAED,kDAUC;AAhDD,SAAS,iBAAiB,CAAC,KAAc;IACvC,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,IAAI,GAAI,KAAoC,CAAC,IAAI,CAAC;IACxD,IAAI,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtC,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,IAAsB,CAAC;AAChC,CAAC;AAED,SAAgB,iBAAiB,CAAC,KAAc;IAC9C,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,OAAO,IAAI,EAAE,KAAK,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7D,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;QACtE,OAAO,eAAe,CAAC;IACzB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAgB,oBAAoB,CAAC,KAAc;IACjD,MAAM,IAAI,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,OAAO,IAAI,EAAE,MAAM,KAAK,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACjE,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,IAAI,CAAC,MAAM;SACf,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;SAC5B,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,MAAM,YAAY,GAAG,oBAAoB,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,iBAAiB,CAAC,KAAK,CAAC,KAAK,eAAe,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC5E,OAAO,GAAG,KAAK,CAAC,OAAO,aAAa,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QACjE,CAAC;QAED,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class SlackCliError extends Error {
|
|
2
|
+
code?: string | undefined;
|
|
3
|
+
constructor(message: string, code?: string | undefined);
|
|
4
|
+
}
|
|
5
|
+
export declare class ConfigurationError extends SlackCliError {
|
|
6
|
+
constructor(message: string);
|
|
7
|
+
}
|
|
8
|
+
export declare class ValidationError extends SlackCliError {
|
|
9
|
+
constructor(message: string);
|
|
10
|
+
}
|
|
11
|
+
export declare class ApiError extends SlackCliError {
|
|
12
|
+
constructor(message: string);
|
|
13
|
+
}
|
|
14
|
+
export declare class FileError extends SlackCliError {
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;IAG7B,IAAI,CAAC,EAAE,MAAM;gBADpB,OAAO,EAAE,MAAM,EACR,IAAI,CAAC,EAAE,MAAM,YAAA;CAKvB;AAED,qBAAa,kBAAmB,SAAQ,aAAa;gBACvC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,eAAgB,SAAQ,aAAa;gBACpC,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,QAAS,SAAQ,aAAa;gBAC7B,OAAO,EAAE,MAAM;CAG5B;AAED,qBAAa,SAAU,SAAQ,aAAa;gBAC9B,OAAO,EAAE,MAAM;CAG5B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FileError = exports.ApiError = exports.ValidationError = exports.ConfigurationError = exports.SlackCliError = void 0;
|
|
4
|
+
class SlackCliError extends Error {
|
|
5
|
+
constructor(message, code) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.code = code;
|
|
8
|
+
this.name = this.constructor.name;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
exports.SlackCliError = SlackCliError;
|
|
12
|
+
class ConfigurationError extends SlackCliError {
|
|
13
|
+
constructor(message) {
|
|
14
|
+
super(message, 'CONFIGURATION_ERROR');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ConfigurationError = ConfigurationError;
|
|
18
|
+
class ValidationError extends SlackCliError {
|
|
19
|
+
constructor(message) {
|
|
20
|
+
super(message, 'VALIDATION_ERROR');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.ValidationError = ValidationError;
|
|
24
|
+
class ApiError extends SlackCliError {
|
|
25
|
+
constructor(message) {
|
|
26
|
+
super(message, 'API_ERROR');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.ApiError = ApiError;
|
|
30
|
+
class FileError extends SlackCliError {
|
|
31
|
+
constructor(message) {
|
|
32
|
+
super(message, 'FILE_ERROR');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
exports.FileError = FileError;
|
|
36
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/utils/errors.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAc,SAAQ,KAAK;IACtC,YACE,OAAe,EACR,IAAa;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QAFR,SAAI,GAAJ,IAAI,CAAS;QAGpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACpC,CAAC;CACF;AARD,sCAQC;AAED,MAAa,kBAAmB,SAAQ,aAAa;IACnD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IACxC,CAAC;CACF;AAJD,gDAIC;AAED,MAAa,eAAgB,SAAQ,aAAa;IAChD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;IACrC,CAAC;CACF;AAJD,0CAIC;AAED,MAAa,QAAS,SAAQ,aAAa;IACzC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;IAC9B,CAAC;CACF;AAJD,4BAIC;AAED,MAAa,SAAU,SAAQ,aAAa;IAC1C,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/B,CAAC;CACF;AAJD,8BAIC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Message } from '../types/slack';
|
|
2
|
+
export declare function formatMessageWithMentions(message: string, users: Map<string, string>): string;
|
|
3
|
+
export declare function resolveUsername(message: Message, users: Map<string, string>): string;
|
|
4
|
+
//# sourceMappingURL=format-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-utils.d.ts","sourceRoot":"","sources":["../../src/utils/format-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAIzC,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAQ7F;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAQpF"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatMessageWithMentions = formatMessageWithMentions;
|
|
4
|
+
exports.resolveUsername = resolveUsername;
|
|
5
|
+
const slack_patterns_1 = require("./slack-patterns");
|
|
6
|
+
const terminal_sanitizer_1 = require("./terminal-sanitizer");
|
|
7
|
+
function formatMessageWithMentions(message, users) {
|
|
8
|
+
const sanitizedMessage = (0, terminal_sanitizer_1.sanitizeTerminalText)(message);
|
|
9
|
+
// Replace <@USERID> mentions with @username
|
|
10
|
+
return sanitizedMessage.replace(slack_patterns_1.USER_MENTION_PATTERN, (match, userId) => {
|
|
11
|
+
const username = (0, terminal_sanitizer_1.sanitizeTerminalText)(users.get(userId) || userId);
|
|
12
|
+
return `@${username}`;
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
function resolveUsername(message, users) {
|
|
16
|
+
if (message.user) {
|
|
17
|
+
return (0, terminal_sanitizer_1.sanitizeTerminalText)(users.get(message.user) || 'Unknown User');
|
|
18
|
+
}
|
|
19
|
+
if (message.bot_id) {
|
|
20
|
+
return 'Bot';
|
|
21
|
+
}
|
|
22
|
+
return 'Unknown';
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=format-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-utils.js","sourceRoot":"","sources":["../../src/utils/format-utils.ts"],"names":[],"mappings":";;AAIA,8DAQC;AAED,0CAQC;AArBD,qDAAwD;AACxD,6DAA4D;AAE5D,SAAgB,yBAAyB,CAAC,OAAe,EAAE,KAA0B;IACnF,MAAM,gBAAgB,GAAG,IAAA,yCAAoB,EAAC,OAAO,CAAC,CAAC;IAEvD,4CAA4C;IAC5C,OAAO,gBAAgB,CAAC,OAAO,CAAC,qCAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QACtE,MAAM,QAAQ,GAAG,IAAA,yCAAoB,EAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,CAAC;QACnE,OAAO,IAAI,QAAQ,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,eAAe,CAAC,OAAgB,EAAE,KAA0B;IAC1E,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,OAAO,IAAA,yCAAoB,EAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,cAAc,CAAC,CAAC;IACzE,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface BaseFormatter<T> {
|
|
2
|
+
format(data: T): void;
|
|
3
|
+
}
|
|
4
|
+
export declare abstract class AbstractFormatter<T> implements BaseFormatter<T> {
|
|
5
|
+
abstract format(data: T): void;
|
|
6
|
+
}
|
|
7
|
+
export declare abstract class JsonFormatter<TInput, TOutput = unknown> extends AbstractFormatter<TInput> {
|
|
8
|
+
protected abstract transform(data: TInput): TOutput;
|
|
9
|
+
format(data: TInput): void;
|
|
10
|
+
}
|
|
11
|
+
export interface FormatterMap<T> {
|
|
12
|
+
table: BaseFormatter<T>;
|
|
13
|
+
simple: BaseFormatter<T>;
|
|
14
|
+
json: BaseFormatter<T>;
|
|
15
|
+
[key: string]: BaseFormatter<T>;
|
|
16
|
+
}
|
|
17
|
+
export declare class FormatterFactory<T> {
|
|
18
|
+
private formatters;
|
|
19
|
+
constructor(formatters: FormatterMap<T>);
|
|
20
|
+
create(format?: string): BaseFormatter<T>;
|
|
21
|
+
}
|
|
22
|
+
export declare function createFormatterFactory<T>(formatters: FormatterMap<T>): FormatterFactory<T>;
|
|
23
|
+
//# sourceMappingURL=base-formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-formatter.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters/base-formatter.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;CACvB;AAED,8BAAsB,iBAAiB,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IACpE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI;CAC/B;AAED,8BAAsB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAE,SAAQ,iBAAiB,CAAC,MAAM,CAAC;IAC9F,SAAS,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAEnD,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;CAG3B;AAED,MAAM,WAAW,YAAY,CAAC,CAAC;IAC7B,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACzB,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,CAAC,CAAC,CAAC,CAAC;CACjC;AAED,qBAAa,gBAAgB,CAAC,CAAC;IACjB,OAAO,CAAC,UAAU;gBAAV,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC;IAE/C,MAAM,CAAC,MAAM,GAAE,MAAgB,GAAG,aAAa,CAAC,CAAC,CAAC;CAGnD;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAE1F"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FormatterFactory = exports.JsonFormatter = exports.AbstractFormatter = void 0;
|
|
4
|
+
exports.createFormatterFactory = createFormatterFactory;
|
|
5
|
+
const terminal_sanitizer_1 = require("../terminal-sanitizer");
|
|
6
|
+
class AbstractFormatter {
|
|
7
|
+
}
|
|
8
|
+
exports.AbstractFormatter = AbstractFormatter;
|
|
9
|
+
class JsonFormatter extends AbstractFormatter {
|
|
10
|
+
format(data) {
|
|
11
|
+
console.log(JSON.stringify((0, terminal_sanitizer_1.sanitizeTerminalData)(this.transform(data)), null, 2));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.JsonFormatter = JsonFormatter;
|
|
15
|
+
class FormatterFactory {
|
|
16
|
+
constructor(formatters) {
|
|
17
|
+
this.formatters = formatters;
|
|
18
|
+
}
|
|
19
|
+
create(format = 'table') {
|
|
20
|
+
return this.formatters[format] || this.formatters.table;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.FormatterFactory = FormatterFactory;
|
|
24
|
+
function createFormatterFactory(formatters) {
|
|
25
|
+
return new FormatterFactory(formatters);
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=base-formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-formatter.js","sourceRoot":"","sources":["../../../src/utils/formatters/base-formatter.ts"],"names":[],"mappings":";;;AAiCA,wDAEC;AAnCD,8DAA6D;AAM7D,MAAsB,iBAAiB;CAEtC;AAFD,8CAEC;AAED,MAAsB,aAAyC,SAAQ,iBAAyB;IAG9F,MAAM,CAAC,IAAY;QACjB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAA,yCAAoB,EAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACnF,CAAC;CACF;AAND,sCAMC;AASD,MAAa,gBAAgB;IAC3B,YAAoB,UAA2B;QAA3B,eAAU,GAAV,UAAU,CAAiB;IAAG,CAAC;IAEnD,MAAM,CAAC,SAAiB,OAAO;QAC7B,OAAO,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;IAC1D,CAAC;CACF;AAND,4CAMC;AAED,SAAgB,sBAAsB,CAAI,UAA2B;IACnE,OAAO,IAAI,gBAAgB,CAAC,UAAU,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface BookmarkItem {
|
|
2
|
+
type: string;
|
|
3
|
+
channel: string;
|
|
4
|
+
message: {
|
|
5
|
+
text: string;
|
|
6
|
+
ts: string;
|
|
7
|
+
};
|
|
8
|
+
date_create: number;
|
|
9
|
+
}
|
|
10
|
+
export interface BookmarkFormatterOptions {
|
|
11
|
+
items: BookmarkItem[];
|
|
12
|
+
}
|
|
13
|
+
export declare function createBookmarkFormatter(format: string): import("./base-formatter").BaseFormatter<BookmarkFormatterOptions>;
|
|
14
|
+
//# sourceMappingURL=bookmark-formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookmark-formatters.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters/bookmark-formatters.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,EAAE,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,YAAY,EAAE,CAAC;CACvB;AAgED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,sEAErD"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createBookmarkFormatter = createBookmarkFormatter;
|
|
4
|
+
const terminal_sanitizer_1 = require("../terminal-sanitizer");
|
|
5
|
+
const base_formatter_1 = require("./base-formatter");
|
|
6
|
+
function formatDate(timestamp) {
|
|
7
|
+
return new Date(timestamp * 1000).toISOString();
|
|
8
|
+
}
|
|
9
|
+
class BookmarkTableFormatter extends base_formatter_1.AbstractFormatter {
|
|
10
|
+
format({ items }) {
|
|
11
|
+
const channelWidth = 16;
|
|
12
|
+
const tsWidth = 20;
|
|
13
|
+
const textWidth = 40;
|
|
14
|
+
const savedAtWidth = 26;
|
|
15
|
+
const header = 'Channel'.padEnd(channelWidth) +
|
|
16
|
+
'Timestamp'.padEnd(tsWidth) +
|
|
17
|
+
'Text'.padEnd(textWidth) +
|
|
18
|
+
'Saved At'.padEnd(savedAtWidth);
|
|
19
|
+
console.log(header);
|
|
20
|
+
console.log('\u2500'.repeat(channelWidth + tsWidth + textWidth + savedAtWidth));
|
|
21
|
+
items.forEach((item) => {
|
|
22
|
+
const channel = (0, terminal_sanitizer_1.sanitizeTerminalText)(item.channel || '').padEnd(channelWidth);
|
|
23
|
+
const ts = (0, terminal_sanitizer_1.sanitizeTerminalText)(item.message?.ts || '').padEnd(tsWidth);
|
|
24
|
+
const text = (0, terminal_sanitizer_1.sanitizeTerminalText)(item.message?.text || '')
|
|
25
|
+
.slice(0, textWidth - 2)
|
|
26
|
+
.padEnd(textWidth);
|
|
27
|
+
const savedAt = formatDate(item.date_create).padEnd(savedAtWidth);
|
|
28
|
+
console.log(`${channel}${ts}${text}${savedAt}`);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
class BookmarkSimpleFormatter extends base_formatter_1.AbstractFormatter {
|
|
33
|
+
format({ items }) {
|
|
34
|
+
items.forEach((item) => {
|
|
35
|
+
const savedAt = formatDate(item.date_create);
|
|
36
|
+
console.log(`${(0, terminal_sanitizer_1.sanitizeTerminalText)(item.channel || '')}\t${(0, terminal_sanitizer_1.sanitizeTerminalText)(item.message?.ts || '')}\t${(0, terminal_sanitizer_1.sanitizeTerminalText)(item.message?.text || '')}\t${savedAt}`);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class BookmarkJsonFormatter extends base_formatter_1.JsonFormatter {
|
|
41
|
+
transform({ items }) {
|
|
42
|
+
return items.map((item) => ({
|
|
43
|
+
type: item.type,
|
|
44
|
+
channel: item.channel,
|
|
45
|
+
timestamp: item.message?.ts,
|
|
46
|
+
text: item.message?.text,
|
|
47
|
+
date_create: item.date_create,
|
|
48
|
+
saved_at: formatDate(item.date_create),
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const bookmarkFormatterFactory = (0, base_formatter_1.createFormatterFactory)({
|
|
53
|
+
table: new BookmarkTableFormatter(),
|
|
54
|
+
simple: new BookmarkSimpleFormatter(),
|
|
55
|
+
json: new BookmarkJsonFormatter(),
|
|
56
|
+
});
|
|
57
|
+
function createBookmarkFormatter(format) {
|
|
58
|
+
return bookmarkFormatterFactory.create(format);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=bookmark-formatters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bookmark-formatters.js","sourceRoot":"","sources":["../../../src/utils/formatters/bookmark-formatters.ts"],"names":[],"mappings":";;AA+EA,0DAEC;AAjFD,8DAA6D;AAC7D,qDAA4F;AAgB5F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AAE,IAAI,uBAAuB,EAAE;IACrC,IAAI,EAAE,IAAI,qBAAqB,EAAE;CAClC,CAAC,CAAC;AAEH,SAAgB,uBAAuB,CAAC,MAAc;IACpD,OAAO,wBAAwB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Channel } from '../../types/slack';
|
|
2
|
+
export interface ChannelFormatterOptions {
|
|
3
|
+
channels: Channel[];
|
|
4
|
+
countOnly?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function createChannelFormatter(format: string, countOnly: boolean): import("./base-formatter").BaseFormatter<ChannelFormatterOptions>;
|
|
7
|
+
//# sourceMappingURL=channel-formatters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-formatters.d.ts","sourceRoot":"","sources":["../../../src/utils/formatters/channel-formatters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAK5C,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAwDD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,qEAKxE"}
|