Skip to content

Commit

Permalink
fix(revert): remove slack targets type
Browse files Browse the repository at this point in the history
  • Loading branch information
ekremney committed Feb 5, 2024
1 parent c96391c commit dbd64d4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
8 changes: 3 additions & 5 deletions packages/spacecat-shared-slack-client/src/clients/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -91,7 +89,7 @@ export class ElevatedSlackClient extends BaseSlackClient {
* @param {string} target - The target for the Slack client, see {@link SLACK_TARGETS}.
* @return {ElevatedSlackClient<BaseSlackClient>} 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.
Expand Down
16 changes: 0 additions & 16 deletions packages/spacecat-shared-slack-client/src/constants.js

This file was deleted.

5 changes: 5 additions & 0 deletions packages/spacecat-shared-slack-client/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
6 changes: 5 additions & 1 deletion packages/spacecat-shared-slack-client/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit dbd64d4

Please sign in to comment.