Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion configs/testing-library-compass/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ export class MockDataService
| 'instance'
>
{
constructor(private connectionOptions: ConnectionInfo['connectionOptions']) {
private connectionOptions: ConnectionInfo['connectionOptions'];
constructor(connectionOptions: ConnectionInfo['connectionOptions']) {
super();
this.connectionOptions = connectionOptions;
this.setMaxListeners(0);
}
getConnectionString() {
Expand Down
3 changes: 2 additions & 1 deletion configs/tsconfig-compass/tsconfig.common.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"removeComments": false,
"moduleResolution": "node16",
"module": "node16"
"module": "node16",
"erasableSyntaxOnly": true
}
}
3 changes: 2 additions & 1 deletion configs/tsconfig-compass/tsconfig.react.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"removeComments": false,
"moduleResolution": "node16",
"module": "node16"
"module": "node16",
"erasableSyntaxOnly": true
}
}
23 changes: 17 additions & 6 deletions packages/atlas-service/src/atlas-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,24 @@ function getAutomationAgentClusterId(
}

export class AtlasService {
private readonly authService: AtlasAuthService;
private readonly preferences: PreferencesAccess;
private readonly logger: Logger;
private readonly options?: AtlasServiceOptions;
private readonly defaultConfigOverride?: AtlasServiceConfig;
constructor(
private readonly authService: AtlasAuthService,
private readonly preferences: PreferencesAccess,
private readonly logger: Logger,
private readonly options?: AtlasServiceOptions,
private readonly defaultConfigOverride?: AtlasServiceConfig
) {}
authService: AtlasAuthService,
preferences: PreferencesAccess,
logger: Logger,
options?: AtlasServiceOptions,
defaultConfigOverride?: AtlasServiceConfig
) {
this.authService = authService;
this.preferences = preferences;
this.logger = logger;
this.options = options;
this.defaultConfigOverride = defaultConfigOverride;
}
// Config value is dynamic to make sure that process.env overrides are taken
// into account in runtime
get config(): AtlasServiceConfig {
Expand Down
1 change: 1 addition & 0 deletions packages/atlas-service/src/store/atlas-signin-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type AtlasSignInThunkAction<
A extends AnyAction = AnyAction
> = ThunkAction<R, AtlasSignInState, { atlasAuthService: AtlasAuthService }, A>;

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export const enum AtlasSignInActions {
RestoringStart = 'atlas-service/atlas-signin/StartRestoring',
RestoringFailed = 'atlas-service/atlas-signin/RestoringFailed',
Expand Down
1 change: 1 addition & 0 deletions packages/compass-aggregations/src/modules/aggregation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const WriteOperation = {
Overwrite: 'overwriting',
} as const;

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ActionTypes {
RunAggregation = 'compass-aggeregations/runAggregation',
AggregationStarted = 'compass-aggregations/aggregationStarted',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import type { RestorePipelineAction } from './saved-pipeline';
import { RESTORE_PIPELINE } from './saved-pipeline';
import { isAction } from '../utils/is-action';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ActionTypes {
AutoPreviewToggled = 'compass-aggregations/autoPreviewToggled',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export function pickCollectionStats(collection: Collection): CollectionStats {
};
}

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
enum CollectionStatsActions {
CollectionStatsFetched = 'compass-aggregations/collection-stats/CollectionStatsFetched',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type CollectionInfo = Pick<Collection, 'name' | 'type'>;

type CollectionType = CollectionInfo['type'];

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ActionTypes {
CollectionsFetch = 'compass-aggregations/collectionsFetched',
CollectionFieldsFetched = 'compass-aggregations/collectionFieldsFetched',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ActionTypes as ConfirmNewPipelineActions } from './is-new-pipeline-conf
import { getPipelineFromBuilderState } from './pipeline-builder/builder-helpers';
import { isAction } from '../utils/is-action';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ActionTypes {
CountStarted = 'compass-aggregations/countStarted',
CountFinished = 'compass-aggregations/countFinished',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export const INITIAL_STATE: CreateViewState = {
pipeline: [],
};

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
enum CreateViewActionTypes {
Open = 'aggregations/create-view/Open',
Close = 'aggregations/create-view/Close',
Expand Down
1 change: 1 addition & 0 deletions packages/compass-aggregations/src/modules/focus-mode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { PipelineBuilderThunkAction } from '.';
import { isAction } from '../utils/is-action';
import { addStage, pipelineFromStore } from './pipeline-builder/stage-editor';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
enum ActionTypes {
FocusModeEnabled = 'compass-aggregations/focusModeEnabled',
FocusModeDisabled = 'compass-aggregations/focusModeDisabled',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { AnyAction } from 'redux';
import { isAction } from '../utils/is-action';
import { DEFAULT_MAX_TIME_MS } from '../constants';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ActionTypes {
CollapseToggled = 'aggregations/input-documents/CollapseToggled',
DocumentsFetchStarted = 'aggregations/input-documents/DocumentsFetchStarted',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type Stage from './pipeline-builder/stage';
import type { Document } from 'bson';
import type { PipelineParserError } from './pipeline-builder/pipeline-parser/utils';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ActionTypes {
NewPipelineConfirmed = 'compass-aggregations/is-new-pipeline-confirm/newPipelineConfirmed',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export const initialState: AIPipelineState = {
isAggregationGeneratedFromQuery: false,
};

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export const enum AIPipelineActionTypes {
AIPipelineStarted = 'compass-aggregations/pipeline-builder/pipeline-ai/AIPipelineStarted',
AIPipelineCancelled = 'compass-aggregations/pipeline-builder/pipeline-ai/AIPipelineCancelled',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type {

export type PipelineMode = 'builder-ui' | 'as-text';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ActionTypes {
PipelineModeToggled = 'compass-aggregations/pipelineModeToggled',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ function getKeyName(node: t.ObjectProperty['key']): string | null {
: null;
}

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export const enum StageAssertionErrorCodes {
InvalidStage,
NotObjectExpression,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ type ErrorLoc = {
};

export class PipelineParserError extends SyntaxError {
constructor(message: string, public loc?: ErrorLoc, public code?: number) {
loc?: ErrorLoc;
code?: number;
constructor(message: string, loc?: ErrorLoc, code?: number) {
super(message);
this.loc = loc;
this.code = code;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,12 @@ export function createPreviewAggregation(
export class PipelinePreviewManager {
private queue = new Map<number, AbortController>();
private lastPipeline = new Map<number, Document[]>();
constructor(
private dataService: DataService,
private preferences: PreferencesAccess
) {}
private dataService: DataService;
private preferences: PreferencesAccess;
constructor(dataService: DataService, preferences: PreferencesAccess) {
this.dataService = dataService;
this.preferences = preferences;
}

/**
* Request aggregation results with a default debounce
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import type {
PipelineGeneratedFromQueryAction,
} from './pipeline-ai';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export const enum StageEditorActionTypes {
StagePreviewFetch = 'compass-aggregations/pipeline-builder/stage-editor/StagePreviewFetch',
StagePreviewFetchSkipped = 'compass-aggregations/pipeline-builder/stage-editor/StagePreviewFetchSkipped',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type {
} from './pipeline-ai';
import { getDestinationNamespaceFromStage } from '../../utils/stage';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
const enum OutputStageActionTypes {
FetchStarted = 'compass-aggregations/pipeline-builder/text-editor-output-stage/FetchStarted',
FetchSucceded = 'compass-aggregations/pipeline-builder/text-editor-output-stage/FetchSucceded',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import type {
PipelineGeneratedFromQueryAction,
} from './pipeline-ai';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export const enum EditorActionTypes {
EditorPreviewFetch = 'compass-aggregations/pipeline-builder/text-editor-pipeline/TextEditorPreviewFetch',
EditorPreviewFetchSkipped = 'compass-aggregations/pipeline-builder/text-editor-pipeline/EditorPreviewFetchSkipped',
Expand Down
2 changes: 2 additions & 0 deletions packages/compass-aggregations/src/modules/search-indexes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { PipelineBuilderThunkAction } from '.';
import type { SearchIndex } from 'mongodb-data-service';
import { isAction } from '../utils/is-action';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
enum SearchIndexesStatuses {
INITIAL = 'INITIAL',
LOADING = 'LOADING',
Expand All @@ -12,6 +13,7 @@ enum SearchIndexesStatuses {

export type SearchIndexesStatus = keyof typeof SearchIndexesStatuses;

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ActionTypes {
FetchIndexesStarted = 'compass-aggregations/search-indexes/FetchIndexesStarted',
FetchIndexesFinished = 'compass-aggregations/search-indexes/FetchIndexesFinished',
Expand Down
1 change: 1 addition & 0 deletions packages/compass-aggregations/src/modules/side-panel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { type PipelineBuilderThunkAction } from '.';
import { getPipelineFromBuilderState } from './pipeline-builder/builder-helpers';
import type { AnyAction } from 'redux';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
enum ActionTypes {
SidePanelToggled = 'compass-aggregations/sidePanelToggled',
}
Expand Down
1 change: 1 addition & 0 deletions packages/compass-aggregations/src/modules/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { isAction } from '../utils/is-action';

export type Workspace = 'builder' | 'results';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ActionTypes {
WorkspaceChanged = 'compass-aggregations/workspaceChanged',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { MockDataSchemaResponse } from '@mongodb-js/compass-generative-ai';
import type { FakerArg } from './script-generation-utils';
import type { MongoDBFieldType } from '../../schema-analysis-types';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum MockDataGeneratorStep {
SCHEMA_CONFIRMATION = 'SCHEMA_CONFIRMATION',
SCHEMA_EDITOR = 'SCHEMA_EDITOR',
Expand Down Expand Up @@ -49,6 +50,7 @@ export interface FakerFieldMapping {

export type FakerSchema = Record<string, FakerFieldMapping>;

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum DataGenerationStep {
INSTALL_FAKERJS = 'install fakerjs',
CREATE_JS_FILE = 'create js file',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export type CollectionState = {
fakerSchemaGeneration: MockDataGeneratorState;
};

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum CollectionActions {
CollectionMetadataFetched = 'compass-collection/CollectionMetadataFetched',
SchemaAnalysisStarted = 'compass-collection/SchemaAnalysisStarted',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@ export class GuideCueService extends EventTarget {

private _activeGroupId: GroupName | null = null;
private _activeCue: Cue | null = null;
private readonly _storage: GuideCueStorage;

constructor(private readonly _storage: GuideCueStorage) {
constructor(_storage: GuideCueStorage) {
super();
this._storage = _storage;
}

addCue(cue: Omit<Cue, 'isVisited'>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ export interface GuideCueStorage {
}

export class CompassGuideCueStorage implements GuideCueStorage {
private readonly storage: Pick<Storage, 'getItem' | 'setItem'>;
private readonly key: string;
constructor(
private readonly storage: Pick<
Storage,
'getItem' | 'setItem'
> = globalThis.localStorage,
private readonly key: string = GUIDE_CUE_KEY
) {}
storage: Pick<Storage, 'getItem' | 'setItem'> = globalThis.localStorage,
key: string = GUIDE_CUE_KEY
) {
this.storage = storage;
this.key = key;
}

get data(): GuideCueData {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useRef } from 'react';
import { css, cx } from '@leafygreen-ui/emotion';
import { palette } from '@leafygreen-ui/palette';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
enum ResizeDirection {
TOP = 'TOP',
RIGHT = 'RIGHT',
Expand Down
1 change: 1 addition & 0 deletions packages/compass-components/src/hooks/use-focus-hover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { mergeProps } from '@react-aria/utils';
import type React from 'react';
import { useEffect, useMemo, useRef, useState } from 'react';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum FocusState {
NoFocus = 'NoFocus',
FocusVisible = 'FocusVisible',
Expand Down
1 change: 1 addition & 0 deletions packages/compass-components/src/hooks/use-theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import LeafyGreenProvider, {
useDarkMode as useLeafyGreenDarkMode,
} from '@leafygreen-ui/leafygreen-provider';

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
enum Theme {
Light = 'Light',
Dark = 'Dark',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ interface EventForwarder<T extends string> {
export class ConnectionScopedAppRegistryImpl<T extends string>
implements EventForwarder<T>
{
private readonly appRegistryEmitter: AppRegistry['emit'];
private readonly connectionInfoRef: ConnectionInfoRef;
constructor(
private readonly appRegistryEmitter: AppRegistry['emit'],
private readonly connectionInfoRef: ConnectionInfoRef
) {}
appRegistryEmitter: AppRegistry['emit'],
connectionInfoRef: ConnectionInfoRef
) {
this.appRegistryEmitter = appRegistryEmitter;
this.connectionInfoRef = connectionInfoRef;
}

/**
* @deprecated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ export type ConnectionsThunkAction<
A extends AnyAction = AnyAction
> = ThunkAction<R, State, ThunkExtraArg, A>;

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export const enum ActionTypes {
// Actions related to getting connections from the persistent store (like disk
// or cloud backend)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export type AnalysisProcessState = {
relationsInferred: number;
};

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum AnalysisProcessActionTypes {
ANALYZING_COLLECTIONS_START = 'data-modeling/analysis-stats/ANALYZING_COLLECTIONS_START',
NAMESPACE_SAMPLE_FETCHED = 'data-modeling/analysis-stats/NAMESPACE_SAMPLE_FETCHED',
Expand Down
1 change: 1 addition & 0 deletions packages/compass-data-modeling/src/store/diagram.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export type DiagramState =
})
| null; // null when no diagram is currently open

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum DiagramActionTypes {
OPEN_DIAGRAM = 'data-modeling/diagram/OPEN_DIAGRAM',
DELETE_DIAGRAM = 'data-modeling/diagram/DELETE_DIAGRAM',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type ExportDiagramState = {
exportFormat?: ExportDiagramFormat;
};

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum ExportDiagramActionTypes {
MODAL_OPENED = 'data-modeling/export-diagram/MODAL_OPENED',
MODAL_CLOSED = 'data-modeling/export-diagram/MODAL_CLOSED',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type GenerateDiagramWizardState = {
error: Error | null;
};

// @ts-expect-error TODO(COMPASS-10124): replace enums with const kv objects
export enum GenerateDiagramWizardActionTypes {
CREATE_NEW_DIAGRAM = 'data-modeling/generate-diagram-wizard/CREATE_NEW_DIAGRAM',
CANCEL_CREATE_NEW_DIAGRAM = 'data-modeling/generate-diagram-wizard/CANCEL_CREATE_NEW_DIAGRAM',
Expand Down
Loading
Loading