diff --git a/packages/spacecat-shared-slack-client/src/clients/index.d.ts b/packages/spacecat-shared-slack-client/src/clients/index.d.ts index 5fdab05f..b76f2fb6 100644 --- a/packages/spacecat-shared-slack-client/src/clients/index.d.ts +++ b/packages/spacecat-shared-slack-client/src/clients/index.d.ts @@ -12,10 +12,8 @@ // eslint-disable-next-line max-classes-per-file import type { UniversalContext } from '@adobe/helix-universal'; -import type { SlackChannel } from '../models'; -import { SLACK_TARGETS } from '../constants.js'; -type SLACK_TARGET = typeof SLACK_TARGETS[keyof typeof SLACK_TARGETS]; +import type { SlackChannel } from '../models'; /** * Represents a Slack client that can be used to interact with the Slack API. @@ -44,7 +42,7 @@ export class BaseSlackClient { * @param {string} target - The target for the Slack client, see {@link SLACK_TARGETS}. * @return {BaseSlackClient} The basic Slack client. */ - static createFrom(context: UniversalContext, target: SLACK_TARGET): BaseSlackClient; + static createFrom(context: UniversalContext, target: string): BaseSlackClient; /** * Asynchronous method to create a RUM backlink. @@ -91,7 +89,7 @@ export class ElevatedSlackClient extends BaseSlackClient { * @param {string} target - The target for the Slack client, see {@link SLACK_TARGETS}. * @return {ElevatedSlackClient} The elevated Slack client. */ - static createFrom(context: UniversalContext, target: SLACK_TARGET): ElevatedSlackClient; + static createFrom(context: UniversalContext, target: string): ElevatedSlackClient; /** * Creates a new Slack channel. The channel can be public or private. diff --git a/packages/spacecat-shared-slack-client/src/constants.js b/packages/spacecat-shared-slack-client/src/constants.js deleted file mode 100644 index 83f20aef..00000000 --- a/packages/spacecat-shared-slack-client/src/constants.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2024 Adobe. All rights reserved. - * This file is licensed to you under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. You may obtain a copy - * of the License at http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software distributed under - * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS - * OF ANY KIND, either express or implied. See the License for the specific language - * governing permissions and limitations under the License. - */ - -export const SLACK_TARGETS = { - WORKSPACE_INTERNAL: 'WORKSPACE_INTERNAL', - WORKSPACE_EXTERNAL: 'WORKSPACE_EXTERNAL', -}; diff --git a/packages/spacecat-shared-slack-client/src/index.d.ts b/packages/spacecat-shared-slack-client/src/index.d.ts index 96c5afd4..2a95ef91 100644 --- a/packages/spacecat-shared-slack-client/src/index.d.ts +++ b/packages/spacecat-shared-slack-client/src/index.d.ts @@ -13,6 +13,11 @@ import type { BaseSlackClient, ElevatedSlackClient } from './clients'; import type { SlackChannel, SlackUser } from './models'; +export declare const SLACK_TARGETS: { + WORKSPACE_INTERNAL: string; + WORKSPACE_EXTERNAL: string; +}; + /** * The possible statuses for a user invites and channel creations. */ diff --git a/packages/spacecat-shared-slack-client/src/index.js b/packages/spacecat-shared-slack-client/src/index.js index ca126c41..c4cd6c7d 100644 --- a/packages/spacecat-shared-slack-client/src/index.js +++ b/packages/spacecat-shared-slack-client/src/index.js @@ -12,7 +12,11 @@ import BaseSlackClient from './clients/base-slack-client.js'; import ElevatedSlackClient, { SLACK_STATUSES } from './clients/elevated-slack-client.js'; -import { SLACK_TARGETS } from './constants.js'; + +const SLACK_TARGETS = { + WORKSPACE_INTERNAL: 'WORKSPACE_INTERNAL', + WORKSPACE_EXTERNAL: 'WORKSPACE_EXTERNAL', +}; export { SLACK_STATUSES,