Skip to content

Commit ecb0a82

Browse files
committed
refactor: drop utils and use records only
1 parent 944ecfb commit ecb0a82

File tree

4 files changed

+10
-17
lines changed

4 files changed

+10
-17
lines changed

src/notebooks/deepnote/integrations/integrationDetector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { logger } from '../../../platform/logging';
44
import { IDeepnoteNotebookManager } from '../../types';
55
import {
66
DATAFRAME_SQL_INTEGRATION_ID,
7+
DEEPNOTE_TO_INTEGRATION_TYPE,
78
IntegrationStatus,
8-
IntegrationWithStatus,
9-
mapDeepnoteIntegrationType
9+
IntegrationWithStatus
1010
} from '../../../platform/notebooks/deepnote/integrationTypes';
1111
import { IIntegrationDetector, IIntegrationStorage } from './types';
1212

@@ -56,7 +56,7 @@ export class IntegrationDetector implements IIntegrationDetector {
5656
const config = await this.integrationStorage.getIntegrationConfig(integrationId);
5757

5858
// Map the Deepnote integration type to our IntegrationType
59-
const integrationType = mapDeepnoteIntegrationType(projectIntegration.type);
59+
const integrationType = DEEPNOTE_TO_INTEGRATION_TYPE[projectIntegration.type];
6060

6161
const status: IntegrationWithStatus = {
6262
config: config || null,

src/notebooks/deepnote/integrations/integrationWebview.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import { LocalizedMessages, SharedMessages } from '../../../messageTypes';
88
import { IDeepnoteNotebookManager } from '../../types';
99
import { IIntegrationStorage, IIntegrationWebviewProvider } from './types';
1010
import {
11+
INTEGRATION_TYPE_TO_DEEPNOTE,
1112
IntegrationConfig,
1213
IntegrationStatus,
13-
IntegrationWithStatus,
14-
mapToDeepnoteIntegrationType
14+
IntegrationWithStatus
1515
} from '../../../platform/notebooks/deepnote/integrationTypes';
1616

1717
/**
@@ -321,7 +321,7 @@ export class IntegrationWebviewProvider implements IIntegrationWebviewProvider {
321321
}
322322

323323
// Map to Deepnote integration type
324-
const deepnoteType = mapToDeepnoteIntegrationType(type);
324+
const deepnoteType = INTEGRATION_TYPE_TO_DEEPNOTE[type];
325325
if (!deepnoteType) {
326326
logger.warn(`IntegrationWebviewProvider: Cannot map type ${type} for integration ${id}, skipping`);
327327
return null;

src/notebooks/deepnote/sqlCellStatusBarProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import { IIntegrationStorage } from './integrations/types';
2424
import { Commands } from '../../platform/common/constants';
2525
import {
2626
DATAFRAME_SQL_INTEGRATION_ID,
27+
DEEPNOTE_TO_INTEGRATION_TYPE,
2728
IntegrationType,
2829
mapDeepnoteIntegrationType
2930
} from '../../platform/notebooks/deepnote/integrationTypes';
@@ -334,7 +335,7 @@ export class SqlCellStatusBarProvider implements NotebookCellStatusBarItemProvid
334335
continue;
335336
}
336337

337-
const integrationType = mapDeepnoteIntegrationType(projectIntegration.type);
338+
const integrationType = DEEPNOTE_TO_INTEGRATION_TYPE[projectIntegration.type];
338339
const typeLabel = integrationType ? this.getIntegrationTypeLabel(integrationType) : projectIntegration.type;
339340

340341
const item: LocalQuickPickItem = {

src/platform/notebooks/deepnote/integrationTypes.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,19 @@ export enum IntegrationType {
1515
/**
1616
* Map Deepnote integration type strings to our IntegrationType enum
1717
*/
18-
const DEEPNOTE_TO_INTEGRATION_TYPE: Record<string, IntegrationType> = {
18+
export const DEEPNOTE_TO_INTEGRATION_TYPE: Record<string, IntegrationType> = {
1919
pgsql: IntegrationType.Postgres,
2020
'big-query': IntegrationType.BigQuery
2121
};
2222

23-
export function mapDeepnoteIntegrationType(deepnoteType: string): IntegrationType | undefined {
24-
return DEEPNOTE_TO_INTEGRATION_TYPE[deepnoteType];
25-
}
26-
2723
/**
2824
* Map our IntegrationType enum to Deepnote integration type strings
2925
*/
30-
const INTEGRATION_TYPE_TO_DEEPNOTE: Record<IntegrationType, string> = {
26+
export const INTEGRATION_TYPE_TO_DEEPNOTE: Record<IntegrationType, string> = {
3127
[IntegrationType.Postgres]: 'pgsql',
3228
[IntegrationType.BigQuery]: 'big-query'
3329
};
3430

35-
export function mapToDeepnoteIntegrationType(type: IntegrationType): string {
36-
return INTEGRATION_TYPE_TO_DEEPNOTE[type];
37-
}
38-
3931
/**
4032
* Base interface for all integration configurations
4133
*/

0 commit comments

Comments
 (0)