Skip to content

Commit

Permalink
More package size reductions (#2242)
Browse files Browse the repository at this point in the history
* made all non-public and public string enums const

* removed const from some enums that cannot be const

* more enums that can't be const

* changefile
  • Loading branch information
noahdarveau-MSFT committed Mar 29, 2024
1 parent d65dd53 commit e67f1ed
Show file tree
Hide file tree
Showing 23 changed files with 51 additions and 44 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "Made more enums const to reduce package size",
"packageName": "@microsoft/teams-js",
"email": "noahdarveau@microsoft.com",
"dependentChangeType": "patch"
}
2 changes: 1 addition & 1 deletion packages/teams-js/src/internal/nestedAppAuth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const tryPolyfillWithNestedAppAuthBridgeLogger = nestedAppAuthLogger.extend('try
* @property {string} Request - Event name for a nested app authentication request.
* @property {string} Response - Event name for a nested app authentication response.
*/
export enum NestedAppAuthMessageEventNames {
export const enum NestedAppAuthMessageEventNames {
Request = 'NestedAppAuthRequest',
Response = 'NestedAppAuthResponse',
}
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/internal/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export function isFollowingApiVersionTagFormat(apiVersionTag: string): boolean {
* @internal
* Limited to Microsoft-internal use
*/
export enum ApiVersionNumber {
export const enum ApiVersionNumber {
V_1 = 'v1',
V_2 = 'v2',
V_3 = 'v3',
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/internal/videoEffectsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ function pipeVideoSourceToGenerator(
* @hidden
* Error messages during video frame transformation.
*/
enum VideoFrameTransformErrors {
const enum VideoFrameTransformErrors {
TimestampIsNull = 'timestamp of the original video frame is null',
UnsupportedVideoFramePixelFormat = 'Unsupported video frame pixel format',
}
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/private/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* @internal
* Limited to Microsoft-internal use
*/
export enum ExternalAppErrorCode {
export const enum ExternalAppErrorCode {
INTERNAL_ERROR = 'INTERNAL_ERROR', // Generic error
}
6 changes: 3 additions & 3 deletions packages/teams-js/src/private/externalAppAuthentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export namespace externalAppAuthentication {
* @internal
* Limited to Microsoft-internal use
*/
export enum OriginalRequestType {
export const enum OriginalRequestType {
ActionExecuteInvokeRequest = 'ActionExecuteInvokeRequest',
QueryMessageExtensionRequest = 'QueryMessageExtensionRequest',
}
Expand All @@ -142,7 +142,7 @@ export namespace externalAppAuthentication {
* @internal
* Limited to Microsoft-internal use
*/
export enum InvokeResponseType {
export const enum InvokeResponseType {
ActionExecuteInvokeResponse = 'ActionExecuteInvokeResponse',
QueryMessageExtensionResponse = 'QueryMessageExtensionResponse',
}
Expand Down Expand Up @@ -259,7 +259,7 @@ export namespace externalAppAuthentication {
* @internal
* Limited to Microsoft-internal use
*/
export enum InvokeErrorCode {
export const enum InvokeErrorCode {
INTERNAL_ERROR = 'INTERNAL_ERROR', // Generic error
}

Expand Down
4 changes: 2 additions & 2 deletions packages/teams-js/src/private/externalAppCardActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export namespace externalAppCardActions {
* @internal
* Limited to Microsoft-internal use
*/
export enum ActionOpenUrlType {
export const enum ActionOpenUrlType {
DeepLinkDialog = 'DeepLinkDialog',
DeepLinkOther = 'DeepLinkOther',
DeepLinkStageView = 'DeepLinkStageView',
Expand All @@ -49,7 +49,7 @@ export namespace externalAppCardActions {
* @internal
* Limited to Microsoft-internal use
*/
export enum ActionOpenUrlErrorCode {
export const enum ActionOpenUrlErrorCode {
INTERNAL_ERROR = 'INTERNAL_ERROR', // Generic error
INVALID_LINK = 'INVALID_LINK', // Deep link is invalid
NOT_SUPPORTED = 'NOT_SUPPORTED', // Deep link is not supported
Expand Down
12 changes: 6 additions & 6 deletions packages/teams-js/src/private/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export namespace files {
* @internal
* Limited to Microsoft-internal use
*/
export enum CloudStorageProvider {
export const enum CloudStorageProvider {
Dropbox = 'DROPBOX',
Box = 'BOX',
Sharefile = 'SHAREFILE',
Expand Down Expand Up @@ -66,7 +66,7 @@ export namespace files {
* @internal
* Limited to Microsoft-internal use
*/
export enum CloudStorageProviderType {
export const enum CloudStorageProviderType {
Sharepoint = 0,
WopiIntegration,
Google,
Expand Down Expand Up @@ -289,7 +289,7 @@ export namespace files {
* @internal
* Limited to Microsoft-internal use
*/
export enum SpecialDocumentLibraryType {
export const enum SpecialDocumentLibraryType {
ClassMaterials = 'classMaterials',
}

Expand All @@ -301,7 +301,7 @@ export namespace files {
* @internal
* Limited to Microsoft-internal use
*/
export enum DocumentLibraryAccessType {
export const enum DocumentLibraryAccessType {
Readonly = 'readonly',
}

Expand Down Expand Up @@ -345,7 +345,7 @@ export namespace files {
* @internal
* Limited to Microsoft-internal use
*/
export enum FileDownloadStatus {
export const enum FileDownloadStatus {
Downloaded = 'Downloaded',
Downloading = 'Downloading',
Failed = 'Failed',
Expand Down Expand Up @@ -450,7 +450,7 @@ export namespace files {
* @internal
* Limited to Microsoft-internal use
*/
export enum CloudStorageProviderFileAction {
export const enum CloudStorageProviderFileAction {
Download = 'DOWNLOAD',
Upload = 'UPLOAD',
Delete = 'DELETE',
Expand Down
6 changes: 3 additions & 3 deletions packages/teams-js/src/private/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface ThreadMember {
* @internal
* Limited to Microsoft-internal use
*/
export enum NotificationTypes {
export const enum NotificationTypes {
fileDownloadStart = 'fileDownloadStart',
fileDownloadComplete = 'fileDownloadComplete',
}
Expand All @@ -59,7 +59,7 @@ export interface ShowNotificationParameters {
* @internal
* Limited to Microsoft-internal use
*/
export enum ViewerActionTypes {
export const enum ViewerActionTypes {
view = 'view',
edit = 'edit',
editNew = 'editNew',
Expand All @@ -70,7 +70,7 @@ export enum ViewerActionTypes {
*
* User setting changes that can be subscribed to
*/
export enum UserSettingTypes {
export const enum UserSettingTypes {
/**
* @hidden
* Use this key to subscribe to changes in user's file open preference
Expand Down
4 changes: 2 additions & 2 deletions packages/teams-js/src/private/remoteCamera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export namespace remoteCamera {
* @internal
* Limited to Microsoft-internal use
*/
export enum ErrorReason {
export const enum ErrorReason {
CommandResetError,
CommandZoomInError,
CommandZoomOutError,
Expand Down Expand Up @@ -200,7 +200,7 @@ export namespace remoteCamera {
* @internal
* Limited to Microsoft-internal use
*/
export enum SessionTerminatedReason {
export const enum SessionTerminatedReason {
None,
ControlDenied,
ControlNoResponse,
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/private/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { TeamInstanceParameters, UserJoinedTeamsInformation } from './interfaces
const teamsTelemetryVersionNumber: ApiVersionNumber = ApiVersionNumber.V_1;

export namespace teams {
export enum ChannelType {
export const enum ChannelType {
Regular = 0,
Private = 1,
Shared = 2,
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/private/videoEffectsEx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export namespace videoEffectsEx {
* @internal
* Limited to Microsoft-internal use
*/
export enum ErrorLevel {
export const enum ErrorLevel {
Fatal = 'fatal',
Warn = 'warn',
}
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/public/authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ export namespace authentication {
* @internal
* Limited to Microsoft-internal use
*/
export enum DataResidency {
export const enum DataResidency {
/**
* Public
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/public/call.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const callTelemetryVersionNumber: ApiVersionNumber = ApiVersionNumber.V_2;
*/
export namespace call {
/** Modalities that can be associated with a call. */
export enum CallModalities {
export const enum CallModalities {
/** Indicates that the modality is unknown or undefined. */
Unknown = 'unknown',
/** Indicates that the call includes audio. */
Expand Down
6 changes: 3 additions & 3 deletions packages/teams-js/src/public/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export enum HostClientType {
}

/** HostName indicates the possible hosts for your application. */
export enum HostName {
export const enum HostName {
/**
* Office.com and Office Windows App
*/
Expand Down Expand Up @@ -132,7 +132,7 @@ export enum UserTeamRole {
/**
* Dialog module dimension enum
*/
export enum DialogDimension {
export const enum DialogDimension {
/** Represents a large-sized dialog box, which is typically used for displaying large amounts of content or complex workflows that require more space. */
Large = 'large',
/** Represents a medium-sized dialog box, which is typically used for displaying moderate amounts of content or workflows that require less space. */
Expand All @@ -153,7 +153,7 @@ import { HostVersionsInfo } from './interfaces';
/**
* The type of the channel with which the content is associated.
*/
export enum ChannelType {
export const enum ChannelType {
/** The default channel type. Type of channel is used for general collaboration and communication within a team. */
Regular = 'Regular',
/** Type of channel is used for sensitive or confidential communication within a team and is only accessible to members of the channel. */
Expand Down
8 changes: 4 additions & 4 deletions packages/teams-js/src/public/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export interface LocaleInfo {
/**
* Allowed user file open preferences
*/
export enum FileOpenPreference {
export const enum FileOpenPreference {
/** Indicates that the user should be prompted to open the file in inline. */
Inline = 'inline',
/** Indicates that the user should be prompted to open the file in the native desktop application associated with the file type. */
Expand All @@ -200,7 +200,7 @@ export enum FileOpenPreference {
*
* @beta
*/
export enum ActionObjectType {
export const enum ActionObjectType {
/** Represents content within a Microsoft 365 application. */
M365Content = 'm365content',
}
Expand Down Expand Up @@ -250,7 +250,7 @@ export interface SecondaryId {
* See [commonly accessed resources](https://learn.microsoft.com/graph/api/resources/onedrive?view=graph-rest-1.0#commonly-accessed-resources).
* @beta
*/
export enum SecondaryM365ContentIdName {
export const enum SecondaryM365ContentIdName {
/** OneDrive ID */
DriveId = 'driveId',
/** Teams Group ID */
Expand Down Expand Up @@ -1054,7 +1054,7 @@ export enum ErrorCode {
}

/** @hidden */
export enum DevicePermission {
export const enum DevicePermission {
GeoLocation = 'geolocation',
Media = 'media',
}
Expand Down
4 changes: 2 additions & 2 deletions packages/teams-js/src/public/liveShareHost.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export namespace liveShare {
* Used in Live Share for its role verification feature.
* For more information, visit https://learn.microsoft.com/microsoftteams/platform/apps-in-teams-meetings/teams-live-share-capabilities?tabs=javascript#role-verification-for-live-data-structures
*/
export enum UserMeetingRole {
export const enum UserMeetingRole {
/**
* Guest role.
*/
Expand All @@ -46,7 +46,7 @@ export namespace liveShare {
* State of the current Live Share session's Fluid container.
* This is used internally by the `LiveShareClient` when joining a Live Share session.
*/
export enum ContainerState {
export const enum ContainerState {
/**
* The call to `LiveShareHost.setContainerId()` successfully created the container mapping
* for the current Live Share session.
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/public/marketplace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export namespace marketplace {
* Represents the persona creating the cart.
* @beta
*/
export enum Intent {
export const enum Intent {
/**
* @hidden
* The cart is created by admin of an organization in Teams Admin Center.
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/public/media.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export namespace media {
/**
* Enum for file formats supported
*/
export enum FileFormat {
export const enum FileFormat {
/** Base64 encoding */
Base64 = 'base64',
/** File id */
Expand Down
10 changes: 5 additions & 5 deletions packages/teams-js/src/public/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ export namespace meeting {
*
* @beta
*/
export enum MeetingReactionType {
export const enum MeetingReactionType {
like = 'like',
heart = 'heart',
laugh = 'laugh',
Expand All @@ -426,7 +426,7 @@ export namespace meeting {
* @remarks
* Teams has several types of meetings to account for different user scenarios and requirements.
*/
export enum MeetingType {
export const enum MeetingType {
/**
* Used when the meeting type is not known.
*
Expand Down Expand Up @@ -481,7 +481,7 @@ export namespace meeting {
* @hidden
* Hide from docs.
*/
export enum CallType {
export const enum CallType {
/**
* Represents a call between two people.
*
Expand All @@ -502,7 +502,7 @@ export namespace meeting {
/**
* Represents the protocol option for sharing app content to the meeting stage.
*/
export enum SharingProtocol {
export const enum SharingProtocol {
/**
* The default protocol for sharing app content to stage. To learn more, visit https://aka.ms/teamsjs/shareAppContentToStage
*/
Expand Down Expand Up @@ -977,7 +977,7 @@ export namespace meeting {
}

/** The source of the join button click. */
export enum EventActionSource {
export const enum EventActionSource {
/**
* Source is calendar grid context menu.
*/
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/public/menus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export namespace menus {
* @hidden
* Represents information about type of list to display in Navigation Bar Menu.
*/
export enum MenuListType {
export const enum MenuListType {
dropDown = 'dropDown',
popOver = 'popOver',
}
Expand Down
2 changes: 1 addition & 1 deletion packages/teams-js/src/public/stageView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export namespace stageView {
/**
* The open mode for stage content.
*/
export enum StageViewOpenMode {
export const enum StageViewOpenMode {
/**
* Open the content in a modal.
*/
Expand Down
Loading

0 comments on commit e67f1ed

Please sign in to comment.