diff --git a/packages/web-api/.gitignore b/packages/web-api/.gitignore index 1eb8f874c..e438be709 100644 --- a/packages/web-api/.gitignore +++ b/packages/web-api/.gitignore @@ -8,3 +8,6 @@ package-lock.json # coverage /.nyc_output /coverage + +# test fixtures +test/integration/**/dist diff --git a/packages/web-api/package.json b/packages/web-api/package.json index f8ad1c73a..91bef3913 100644 --- a/packages/web-api/package.json +++ b/packages/web-api/package.json @@ -39,7 +39,8 @@ "lint": "eslint --fix --ext .ts src", "mocha": "mocha --config .mocharc.json src/*.spec.js", "test": "npm run lint && npm run test:types && npm run test:integration && npm run test:unit", - "test:integration": "npm run build && node test/integration/commonjs-project/index.js && node test/integration/esm-project/index.mjs", + "test:integration": "npm run build && node test/integration/commonjs-project/index.js && node test/integration/esm-project/index.mjs && npm run test:integration:ts", + "test:integration:ts": "cd test/integration/ts-4.7-project && npm i && npm run build", "test:unit": "npm run build && c8 npm run mocha", "test:types": "tsd", "ref-docs:model": "api-extractor run", diff --git a/packages/web-api/src/types/request/index.ts b/packages/web-api/src/types/request/index.ts index a7dc909aa..275877ce4 100644 --- a/packages/web-api/src/types/request/index.ts +++ b/packages/web-api/src/types/request/index.ts @@ -1,42 +1,42 @@ -export type * from './workflows'; -export type * from './views'; -export type * from './users'; -export type * from './tooling'; -export type * from './search'; -export type * from './usergroups'; -export type * from './team'; -export type * from './stars'; -export type * from './rtm'; -export type * from './reminders'; -export type * from './reactions'; -export type * from './pins'; -export type * from './openid'; -export type * from './oauth'; -export type * from './migration'; -export type * from './files'; -export type * from './emoji'; -export type * from './dnd'; -export type * from './dialog'; -export type * from './conversations'; -export type * from './chat'; -export type * from './canvas'; -export type * from './calls'; -export type * from './bots'; -export type * from './bookmarks'; -export type * from './auth'; -export type * from './apps'; -export type * from './api'; -export type * from './admin/analytics'; -export type * from './admin/apps'; -export type * from './admin/auth'; -export type * from './admin/barriers'; -export type * from './admin/conversations'; -export type * from './admin/emoji'; -export type * from './admin/functions'; -export type * from './functions'; -export type * from './admin/inviteRequests'; -export type * from './admin/roles'; -export type * from './admin/teams'; -export type * from './admin/usergroups'; -export type * from './admin/users'; -export type * from './admin/workflows'; +export type { WorkflowsStepCompletedArguments, WorkflowsStepFailedArguments, WorkflowsUpdateStepArguments } from './workflows'; +export type { ViewsUpdateArguments, ViewsOpenArguments, ViewsPushArguments, ViewsPublishArguments } from './views'; +export type { UsersConversationsArguments, UsersDiscoverableContactsLookupArguments, UsersInfoArguments, UsersListArguments, UsersIdentityArguments, UsersSetPhotoArguments, UsersProfileGetArguments, UsersProfileSetArguments, UsersDeletePhotoArguments, UsersGetPresenceArguments, UsersSetPresenceArguments, UsersLookupByEmailArguments } from './users'; +export type { ToolingTokensRotateArguments } from './tooling'; +export type { SearchAllArguments, SearchFilesArguments, SearchMessagesArguments } from './search'; +export type { UsergroupsCreateArguments, UsergroupsDisableArguments, UsergroupsEnableArguments, UsergroupsListArguments, UsergroupsUpdateArguments, UsergroupsUsersListArguments, UsergroupsUsersUpdateArguments } from './usergroups'; +export type { TeamAccessLogsArguments, TeamBillableInfoArguments, TeamBillingInfoArguments, TeamExternalTeamsDisconnectArguments, TeamExternalTeamsListArguments, TeamInfoArguments, TeamIntegrationLogsArguments, TeamPreferencesListArguments, TeamProfileGetArguments } from './team'; +export type { StarsAddRemoveArguments, StarsListArguments } from './stars'; +export type { RTMConnectArguments, RTMStartArguments } from './rtm'; +export type { RemindersAddArguments, RemindersInfoArguments, RemindersListArguments, RemindersDeleteArguments, RemindersCompleteArguments } from './reminders'; +export type { ReactionsAddArguments, ReactionsGetArguments, ReactionsListArguments, ReactionsRemoveArguments } from './reactions'; +export type { PinsAddArguments, PinsListArguments, PinsRemoveArguments } from './pins'; +export type { OpenIDConnectTokenArguments, OpenIDConnectUserInfoArguments } from './openid'; +export type { OAuthAccessArguments, OAuthV2AccessArguments, OAuthV2ExchangeArguments } from './oauth'; +export type { MigrationExchangeArguments } from './migration'; +export type { FilesDeleteArguments, FilesInfoArguments, FilesListArguments, FilesRevokePublicURLArguments, FilesSharedPublicURLArguments, FilesUploadArguments, FilesUploadV2Arguments, FilesCompleteUploadExternalArguments, FilesGetUploadURLExternalArguments, FilesCommentsDeleteArguments, FilesRemoteUpdateArguments, FilesRemoteRemoveArguments, FilesRemoteShareArguments, FilesRemoteListArguments, FilesRemoteInfoArguments, FilesRemoteAddArguments } from './files'; +export type { EmojiListArguments } from './emoji'; +export type { DndEndDndArguments, DndEndSnoozeArguments, DndInfoArguments, DndSetSnoozeArguments, DndTeamInfoArguments } from './dnd'; +export type { DialogOpenArguments } from './dialog'; +export type { ConversationsAcceptSharedInviteArguments, ConversationsApproveSharedInviteArguments, ConversationsArchiveArguments, ConversationsCloseArguments, ConversationsCreateArguments, ConversationsDeclineSharedInviteArguments, ConversationsExternalInvitePermissionsSetArguments, ConversationsHistoryArguments, ConversationsInfoArguments, ConversationsInviteArguments, ConversationsInviteSharedArguments, ConversationsJoinArguments, ConversationsKickArguments, ConversationsLeaveArguments, ConversationsListArguments, ConversationsListConnectInvitesArguments, ConversationsMarkArguments, ConversationsMembersArguments, ConversationsOpenArguments, ConversationsRenameArguments, ConversationsRepliesArguments, ConversationsSetPurposeArguments, ConversationsSetTopicArguments, ConversationsUnarchiveArguments } from './conversations'; +export type { ChatDeleteArguments, ChatDeleteScheduledMessageArguments, ChatGetPermalinkArguments, ChatMeMessageArguments, ChatPostEphemeralArguments, ChatPostMessageArguments, ChatScheduleMessageArguments, ChatScheduledMessagesListArguments, ChatUnfurlArguments, ChatUpdateArguments } from './chat'; +export type { CanvasesAccessDeleteArguments, CanvasesAccessSetArguments, CanvasesCreateArguments, CanvasesDeleteArguments, CanvasesEditArguments, CanvasesSectionsLookupArguments, ConversationsCanvasesCreateArguments } from './canvas'; +export type { CallsAddArguments, CallsEndArguments, CallsInfoArguments, CallsUpdateArguments, CallsParticipantsAddArguments, CallsParticipantsRemoveArguments } from './calls'; +export type { BotsInfoArguments } from './bots'; +export type { BookmarksAddArguments, BookmarksEditArguments, BookmarksListArguments, BookmarksRemoveArguments } from './bookmarks'; +export type { AuthRevokeArguments, AuthTestArguments, AuthTeamsListArguments } from './auth'; +export type { AppsConnectionsOpenArguments, AppsEventAuthorizationsListArguments, AppsManifestCreateArguments, AppsManifestDeleteArguments, AppsManifestExportArguments, AppsManifestUpdateArguments, AppsManifestValidateArguments, AppsUninstallArguments } from './apps'; +export type { APITestArguments } from './api'; +export type { AdminAnalyticsGetFileArguments } from './admin/analytics'; +export type { AdminAppsActivitiesListArguments, AdminAppsApproveArguments, AdminAppsApprovedListArguments, AdminAppsClearResolutionArguments, AdminAppsConfigLookupArguments, AdminAppsConfigSetArguments, AdminAppsRequestsCancelArguments, AdminAppsRequestsListArguments, AdminAppsRestrictArguments, AdminAppsRestrictedListArguments, AdminAppsUninstallArguments } from './admin/apps'; +export type { AdminAuthPolicyAssignEntitiesArguments, AdminAuthPolicyGetEntitiesArguments, AdminAuthPolicyRemoveEntitiesArguments } from './admin/auth'; +export type { AdminBarriersCreateArguments, AdminBarriersDeleteArguments, AdminBarriersListArguments, AdminBarriersUpdateArguments } from './admin/barriers'; +export type { AdminConversationsArchiveArguments, AdminConversationsBulkArchiveArguments, AdminConversationsBulkDeleteArguments, AdminConversationsBulkMoveArguments, AdminConversationsConvertToPrivateArguments, AdminConversationsConvertToPublicArguments, AdminConversationsCreateArguments, AdminConversationsDeleteArguments, AdminConversationsDisconnectSharedArguments, AdminConversationsEKMListOriginalConnectedChannelInfoArguments, AdminConversationsGetConversationPrefsArguments, AdminConversationsGetCustomRetentionArguments, AdminConversationsGetTeamsArguments, AdminConversationsInviteArguments, AdminConversationsLookupArguments, AdminConversationsRemoveCustomRetentionArguments, AdminConversationsRenameArguments, AdminConversationsRestrictAccessAddGroupArguments, AdminConversationsRestrictAccessListGroupsArguments, AdminConversationsRestrictAccessRemoveGroupArguments, AdminConversationsSearchArguments, AdminConversationsSetConversationPrefsArguments, AdminConversationsSetCustomRetentionArguments, AdminConversationsSetTeamsArguments, AdminConversationsUnarchiveArguments } from './admin/conversations'; +export type { AdminEmojiAddArguments, AdminEmojiAddAliasArguments, AdminEmojiListArguments, AdminEmojiRemoveArguments, AdminEmojiRenameArguments } from './admin/emoji'; +export type { AdminFunctionsListArguments, AdminFunctionsPermissionsLookupArguments, AdminFunctionsPermissionsSetArguments } from './admin/functions'; +export type { FunctionsCompleteErrorArguments, FunctionsCompleteSuccessArguments } from './functions'; +export type { AdminInviteRequestsApproveArguments, AdminInviteRequestsApprovedListArguments, AdminInviteRequestsDeniedListArguments, AdminInviteRequestsDenyArguments, AdminInviteRequestsListArguments } from './admin/inviteRequests'; +export type { AdminRolesAddAssignmentsArguments, AdminRolesListAssignmentsArguments, AdminRolesRemoveAssignmentsArguments } from './admin/roles'; +export type { AdminTeamsAdminsListArguments, AdminTeamsCreateArguments, AdminTeamsListArguments, AdminTeamsOwnersListArguments, AdminTeamsSettingsInfoArguments, AdminTeamsSettingsSetDefaultChannelsArguments, AdminTeamsSettingsSetDescriptionArguments, AdminTeamsSettingsSetDiscoverabilityArguments, AdminTeamsSettingsSetIconArguments, AdminTeamsSettingsSetNameArguments } from './admin/teams'; +export type { AdminUsergroupsAddChannelsArguments, AdminUsergroupsAddTeamsArguments, AdminUsergroupsListChannelsArguments, AdminUsergroupsRemoveChannelsArguments } from './admin/usergroups'; +export type { AdminUsersAssignArguments, AdminUsersInviteArguments, AdminUsersListArguments, AdminUsersRemoveArguments, AdminUsersSessionListArguments, AdminUsersSessionClearSettingsArguments, AdminUsersSessionGetSettingsArguments, AdminUsersSessionInvalidateArguments, AdminUsersSessionResetArguments, AdminUsersSessionResetBulkArguments, AdminUsersSessionSetSettingsArguments, AdminUsersSetAdminArguments, AdminUsersSetExpirationArguments, AdminUsersSetOwnerArguments, AdminUsersSetRegularArguments, AdminUsersUnsupportedVersionsExportArguments } from './admin/users'; +export type { AdminWorkflowsCollaboratorsAddArguments, AdminWorkflowsCollaboratorsRemoveArguments, AdminWorkflowsPermissionsLookupArguments, AdminWorkflowsSearchArguments, AdminWorkflowsUnpublishArguments } from './admin/workflows'; diff --git a/packages/web-api/test/integration/ts-4.7-project/index.ts b/packages/web-api/test/integration/ts-4.7-project/index.ts new file mode 100644 index 000000000..4088bc259 --- /dev/null +++ b/packages/web-api/test/integration/ts-4.7-project/index.ts @@ -0,0 +1,2 @@ +import { WebClient } from '../../../src/index'; +new WebClient('invalid-token'); diff --git a/packages/web-api/test/integration/ts-4.7-project/package.json b/packages/web-api/test/integration/ts-4.7-project/package.json new file mode 100644 index 000000000..8a350186e --- /dev/null +++ b/packages/web-api/test/integration/ts-4.7-project/package.json @@ -0,0 +1,15 @@ +{ + "name": "ts-47-project", + "version": "1.0.0", + "description": "", + "scripts": { + "build": "shx rm -rf ./dist && tsc" + }, + "devDependencies": { + "shx": "0.3.2", + "typescript": "4.7.2" + }, + "keywords": [], + "author": "", + "license": "ISC" +} diff --git a/packages/web-api/test/integration/ts-4.7-project/tsconfig.json b/packages/web-api/test/integration/ts-4.7-project/tsconfig.json new file mode 100644 index 000000000..214a96b05 --- /dev/null +++ b/packages/web-api/test/integration/ts-4.7-project/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "target": "es2017", + "module": "commonjs", + "declaration": true, + "declarationMap": true, + "sourceMap": true, + "outDir": "dist", + + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, + + "moduleResolution": "node", + "baseUrl": ".", + "esModuleInterop" : true, + "resolveJsonModule": true + }, + "include": [ + "index.ts" + ] +}