Skip to content

Commit

Permalink
Fixing mattermost redux build for the webapp (mattermost#961)
Browse files Browse the repository at this point in the history
* Fixing mattermost redux build for the webapp

* fixing imports

* Removing from ignoring the rollup.config.js and the tsconfig.json

* Fixing .npmignore

* Reverting npmignore

* Trying something

* Removing unnecesary stuff

* Not removing typescript files

* Trying renaming types directory

* Revert "Trying renaming types directory"

This reverts commit ef7fcff.

* Removing relative references to types

* Fixing import types

* Fixing types import
  • Loading branch information
jespino authored Oct 31, 2019
1 parent 1c2faee commit 6631402
Show file tree
Hide file tree
Showing 24 changed files with 150 additions and 146 deletions.
5 changes: 1 addition & 4 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,10 @@ PULL_REQUEST_TEMPLATE.md
.npmignore
.npminstall
.tmp
src
.circleci
jest.config.js
babel.config.js
rollup.config.js
tsconfig.json
.editorconfig
.eslintignore
mattermost-redux.iml
.eslintrc.json
.eslintrc.json
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@
"source-map-support": "0.5.12",
"typescript": "3.6.3"
}
}
}
16 changes: 9 additions & 7 deletions src/actions/bots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import {Client4} from 'client';
import {BotTypes} from 'action_types';
import {bindClientFunc} from './helpers';

import {ActionFunc} from 'types/actions';

const BOTS_PER_PAGE_DEFAULT = 20;

export function createBot(bot) {
export function createBot(bot): ActionFunc {
return bindClientFunc({
clientFunc: Client4.createBot,
onSuccess: BotTypes.RECEIVED_BOT_ACCOUNT,
Expand All @@ -17,7 +19,7 @@ export function createBot(bot) {
});
}

export function patchBot(botUserId, botPatch) {
export function patchBot(botUserId, botPatch): ActionFunc {
return bindClientFunc({
clientFunc: Client4.patchBot,
onSuccess: BotTypes.RECEIVED_BOT_ACCOUNT,
Expand All @@ -28,7 +30,7 @@ export function patchBot(botUserId, botPatch) {
});
}

export function loadBot(botUserId) {
export function loadBot(botUserId): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getBot,
onSuccess: BotTypes.RECEIVED_BOT_ACCOUNT,
Expand All @@ -38,7 +40,7 @@ export function loadBot(botUserId) {
});
}

export function loadBots(page = 0, perPage = BOTS_PER_PAGE_DEFAULT) {
export function loadBots(page = 0, perPage = BOTS_PER_PAGE_DEFAULT): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getBotsIncludeDeleted,
onSuccess: BotTypes.RECEIVED_BOT_ACCOUNTS,
Expand All @@ -49,7 +51,7 @@ export function loadBots(page = 0, perPage = BOTS_PER_PAGE_DEFAULT) {
});
}

export function disableBot(botUserId) {
export function disableBot(botUserId): ActionFunc {
return bindClientFunc({
clientFunc: Client4.disableBot,
onSuccess: BotTypes.RECEIVED_BOT_ACCOUNT,
Expand All @@ -59,7 +61,7 @@ export function disableBot(botUserId) {
});
}

export function enableBot(botUserId) {
export function enableBot(botUserId): ActionFunc {
return bindClientFunc({
clientFunc: Client4.enableBot,
onSuccess: BotTypes.RECEIVED_BOT_ACCOUNT,
Expand All @@ -69,7 +71,7 @@ export function enableBot(botUserId) {
});
}

export function assignBot(botUserId, newOwnerId) {
export function assignBot(botUserId, newOwnerId): ActionFunc {
return bindClientFunc({
clientFunc: Client4.assignBot,
onSuccess: BotTypes.RECEIVED_BOT_ACCOUNT,
Expand Down
8 changes: 4 additions & 4 deletions src/actions/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
import {Client4} from 'client';
import {FileTypes} from 'action_types';

import {Action, batchActions, DispatchFunc, GetStateFunc} from 'types/actions';
import {Action, batchActions, DispatchFunc, GetStateFunc, ActionFunc} from 'types/actions';

import {logError} from './errors';
import {bindClientFunc, forceLogoutIfNecessary} from './helpers';

export function getFilesForPost(postId: string) {
export function getFilesForPost(postId: string): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
let files;

Expand All @@ -30,7 +30,7 @@ export function getFilesForPost(postId: string) {
};
}

export function uploadFile(channelId: string, rootId: string, clientIds: Array<string>, fileFormData: File, formBoundary: string) {
export function uploadFile(channelId: string, rootId: string, clientIds: Array<string>, fileFormData: File, formBoundary: string): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
dispatch({type: FileTypes.UPLOAD_FILES_REQUEST, data: {}}, getState);

Expand Down Expand Up @@ -75,7 +75,7 @@ export function uploadFile(channelId: string, rootId: string, clientIds: Array<s
};
}

export function getFilePublicLink(fileId: string) {
export function getFilePublicLink(fileId: string): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getFilePublicLink,
onSuccess: FileTypes.RECEIVED_FILE_PUBLIC_LINK,
Expand Down
58 changes: 29 additions & 29 deletions src/actions/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import {getCurrentUserId} from 'selectors/entities/users';
import {getCurrentChannelId} from 'selectors/entities/channels';
import {getCurrentTeamId} from 'selectors/entities/teams';

import {batchActions, DispatchFunc, GetStateFunc} from 'types/actions';
import {batchActions, DispatchFunc, GetStateFunc, ActionFunc} from 'types/actions';

import {Command, DialogSubmission, IncomingWebhook, OAuthApp, OutgoingWebhook} from 'types/integrations';

import {logError} from './errors';
import {bindClientFunc, forceLogoutIfNecessary} from './helpers';
export function createIncomingHook(hook: IncomingWebhook) {
export function createIncomingHook(hook: IncomingWebhook): ActionFunc {
return bindClientFunc({
clientFunc: Client4.createIncomingWebhook,
onRequest: IntegrationTypes.CREATE_INCOMING_HOOK_REQUEST,
Expand All @@ -25,7 +25,7 @@ export function createIncomingHook(hook: IncomingWebhook) {
});
}

export function getIncomingHook(hookId: string) {
export function getIncomingHook(hookId: string): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getIncomingWebhook,
onRequest: IntegrationTypes.GET_INCOMING_HOOKS_REQUEST,
Expand All @@ -37,7 +37,7 @@ export function getIncomingHook(hookId: string) {
});
}

export function getIncomingHooks(teamId = '', page = 0, perPage: number = General.PAGE_SIZE_DEFAULT) {
export function getIncomingHooks(teamId = '', page = 0, perPage: number = General.PAGE_SIZE_DEFAULT): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getIncomingWebhooks,
onRequest: IntegrationTypes.GET_INCOMING_HOOKS_REQUEST,
Expand All @@ -51,7 +51,7 @@ export function getIncomingHooks(teamId = '', page = 0, perPage: number = Genera
});
}

export function removeIncomingHook(hookId: string) {
export function removeIncomingHook(hookId: string): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
dispatch({type: IntegrationTypes.DELETE_INCOMING_HOOK_REQUEST, data: {}}, getState);

Expand Down Expand Up @@ -81,7 +81,7 @@ export function removeIncomingHook(hookId: string) {
};
}

export function updateIncomingHook(hook: IncomingWebhook) {
export function updateIncomingHook(hook: IncomingWebhook): ActionFunc {
return bindClientFunc({
clientFunc: Client4.updateIncomingWebhook,
onRequest: IntegrationTypes.UPDATE_INCOMING_HOOK_REQUEST,
Expand All @@ -93,7 +93,7 @@ export function updateIncomingHook(hook: IncomingWebhook) {
});
}

export function createOutgoingHook(hook: OutgoingWebhook) {
export function createOutgoingHook(hook: OutgoingWebhook): ActionFunc {
return bindClientFunc({
clientFunc: Client4.createOutgoingWebhook,
onRequest: IntegrationTypes.CREATE_OUTGOING_HOOK_REQUEST,
Expand All @@ -105,7 +105,7 @@ export function createOutgoingHook(hook: OutgoingWebhook) {
});
}

export function getOutgoingHook(hookId: string) {
export function getOutgoingHook(hookId: string): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getOutgoingWebhook,
onRequest: IntegrationTypes.GET_OUTGOING_HOOKS_REQUEST,
Expand All @@ -117,7 +117,7 @@ export function getOutgoingHook(hookId: string) {
});
}

export function getOutgoingHooks(channelId = '', teamId = '', page = 0, perPage: number = General.PAGE_SIZE_DEFAULT) {
export function getOutgoingHooks(channelId = '', teamId = '', page = 0, perPage: number = General.PAGE_SIZE_DEFAULT): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getOutgoingWebhooks,
onRequest: IntegrationTypes.GET_OUTGOING_HOOKS_REQUEST,
Expand All @@ -132,7 +132,7 @@ export function getOutgoingHooks(channelId = '', teamId = '', page = 0, perPage:
});
}

export function removeOutgoingHook(hookId: string) {
export function removeOutgoingHook(hookId: string): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
dispatch({type: IntegrationTypes.DELETE_OUTGOING_HOOK_REQUEST, data: {}}, getState);

Expand Down Expand Up @@ -162,7 +162,7 @@ export function removeOutgoingHook(hookId: string) {
};
}

export function updateOutgoingHook(hook: OutgoingWebhook) {
export function updateOutgoingHook(hook: OutgoingWebhook): ActionFunc {
return bindClientFunc({
clientFunc: Client4.updateOutgoingWebhook,
onRequest: IntegrationTypes.UPDATE_OUTGOING_HOOK_REQUEST,
Expand All @@ -174,7 +174,7 @@ export function updateOutgoingHook(hook: OutgoingWebhook) {
});
}

export function regenOutgoingHookToken(hookId: string) {
export function regenOutgoingHookToken(hookId: string): ActionFunc {
return bindClientFunc({
clientFunc: Client4.regenOutgoingHookToken,
onRequest: IntegrationTypes.UPDATE_OUTGOING_HOOK_REQUEST,
Expand All @@ -186,7 +186,7 @@ export function regenOutgoingHookToken(hookId: string) {
});
}

export function getCommands(teamId: string) {
export function getCommands(teamId: string): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getCommandsList,
onRequest: IntegrationTypes.GET_COMMANDS_REQUEST,
Expand All @@ -198,7 +198,7 @@ export function getCommands(teamId: string) {
});
}

export function getAutocompleteCommands(teamId: string, page = 0, perPage: number = General.PAGE_SIZE_DEFAULT) {
export function getAutocompleteCommands(teamId: string, page = 0, perPage: number = General.PAGE_SIZE_DEFAULT): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getAutocompleteCommandsList,
onRequest: IntegrationTypes.GET_AUTOCOMPLETE_COMMANDS_REQUEST,
Expand All @@ -212,7 +212,7 @@ export function getAutocompleteCommands(teamId: string, page = 0, perPage: numbe
});
}

export function getCustomTeamCommands(teamId: string) {
export function getCustomTeamCommands(teamId: string): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getCustomTeamCommands,
onRequest: IntegrationTypes.GET_CUSTOM_TEAM_COMMANDS_REQUEST,
Expand All @@ -224,7 +224,7 @@ export function getCustomTeamCommands(teamId: string) {
});
}

export function addCommand(command: Command) {
export function addCommand(command: Command): ActionFunc {
return bindClientFunc({
clientFunc: Client4.addCommand,
onRequest: IntegrationTypes.ADD_COMMAND_REQUEST,
Expand All @@ -236,7 +236,7 @@ export function addCommand(command: Command) {
});
}

export function editCommand(command: Command) {
export function editCommand(command: Command): ActionFunc {
return bindClientFunc({
clientFunc: Client4.editCommand,
onRequest: IntegrationTypes.EDIT_COMMAND_REQUEST,
Expand All @@ -248,7 +248,7 @@ export function editCommand(command: Command) {
});
}

export function executeCommand(command: Command, args: Array<string>) {
export function executeCommand(command: Command, args: Array<string>): ActionFunc {
return bindClientFunc({
clientFunc: Client4.executeCommand,
onRequest: IntegrationTypes.EXECUTE_COMMAND_REQUEST,
Expand All @@ -261,7 +261,7 @@ export function executeCommand(command: Command, args: Array<string>) {
});
}

export function regenCommandToken(id: string) {
export function regenCommandToken(id: string): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
dispatch({type: IntegrationTypes.REGEN_COMMAND_TOKEN_REQUEST, data: {}}, getState);

Expand Down Expand Up @@ -295,7 +295,7 @@ export function regenCommandToken(id: string) {
};
}

export function deleteCommand(id: string) {
export function deleteCommand(id: string): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
dispatch({type: IntegrationTypes.DELETE_COMMAND_REQUEST, data: {}}, getState);

Expand Down Expand Up @@ -325,7 +325,7 @@ export function deleteCommand(id: string) {
};
}

export function addOAuthApp(app: OAuthApp) {
export function addOAuthApp(app: OAuthApp): ActionFunc {
return bindClientFunc({
clientFunc: Client4.createOAuthApp,
onRequest: IntegrationTypes.ADD_OAUTH_APP_REQUEST,
Expand All @@ -337,7 +337,7 @@ export function addOAuthApp(app: OAuthApp) {
});
}

export function editOAuthApp(app: OAuthApp) {
export function editOAuthApp(app: OAuthApp): ActionFunc {
return bindClientFunc({
clientFunc: Client4.editOAuthApp,
onRequest: IntegrationTypes.UPDATE_OAUTH_APP_REQUEST,
Expand All @@ -349,7 +349,7 @@ export function editOAuthApp(app: OAuthApp) {
});
}

export function getOAuthApps(page = 0, perPage: number = General.PAGE_SIZE_DEFAULT) {
export function getOAuthApps(page = 0, perPage: number = General.PAGE_SIZE_DEFAULT): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getOAuthApps,
onRequest: IntegrationTypes.GET_OAUTH_APPS_REQUEST,
Expand All @@ -362,7 +362,7 @@ export function getOAuthApps(page = 0, perPage: number = General.PAGE_SIZE_DEFAU
});
}

export function getOAuthApp(appId: string) {
export function getOAuthApp(appId: string): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getOAuthApp,
onRequest: IntegrationTypes.GET_OAUTH_APP_REQUEST,
Expand All @@ -374,7 +374,7 @@ export function getOAuthApp(appId: string) {
});
}

export function getAuthorizedOAuthApps() {
export function getAuthorizedOAuthApps(): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
dispatch({type: IntegrationTypes.GET_AUTHORIZED_OAUTH_APPS_REQUEST, data: {}});

Expand All @@ -401,7 +401,7 @@ export function getAuthorizedOAuthApps() {
};
}

export function deauthorizeOAuthApp(clientId: string) {
export function deauthorizeOAuthApp(clientId: string): ActionFunc {
return bindClientFunc({
clientFunc: Client4.deauthorizeOAuthApp,
onRequest: IntegrationTypes.DEAUTHORIZE_OAUTH_APP_REQUEST,
Expand All @@ -411,7 +411,7 @@ export function deauthorizeOAuthApp(clientId: string) {
});
}

export function deleteOAuthApp(id: string) {
export function deleteOAuthApp(id: string): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
dispatch({type: IntegrationTypes.DELETE_OAUTH_APP_REQUEST, data: {}}, getState);

Expand Down Expand Up @@ -441,7 +441,7 @@ export function deleteOAuthApp(id: string) {
};
}

export function regenOAuthAppSecret(appId: string) {
export function regenOAuthAppSecret(appId: string): ActionFunc {
return bindClientFunc({
clientFunc: Client4.regenOAuthAppSecret,
onRequest: IntegrationTypes.UPDATE_OAUTH_APP_REQUEST,
Expand All @@ -453,7 +453,7 @@ export function regenOAuthAppSecret(appId: string) {
});
}

export function submitInteractiveDialog(submission: DialogSubmission) {
export function submitInteractiveDialog(submission: DialogSubmission): ActionFunc {
return async (dispatch: DispatchFunc, getState: GetStateFunc) => {
dispatch({type: IntegrationTypes.SUBMIT_INTERACTIVE_DIALOG_REQUEST, data: {}});

Expand Down
4 changes: 3 additions & 1 deletion src/actions/plugins.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {bindClientFunc} from './helpers';

import {PluginTypes} from 'action_types';

export function getMarketplacePlugins(filter) {
import {ActionFunc} from 'types/actions';

export function getMarketplacePlugins(filter): ActionFunc {
return bindClientFunc({
clientFunc: Client4.getMarketplacePlugins,
onSuccess: PluginTypes.RECEIVED_MARKETPLACE_PLUGINS,
Expand Down
Loading

0 comments on commit 6631402

Please sign in to comment.