Compare commits

..

2 Commits

Author SHA1 Message Date
Steve Faulkner
26210bcdc5 Merge branch 'master' into fail-safe-nuget-publish 2021-03-04 18:14:03 -06:00
Steve Faulkner
d62134d228 Allow publishing same nuget package versions 2021-03-04 13:46:32 -06:00
44 changed files with 636 additions and 26872 deletions

View File

@@ -11,9 +11,13 @@ src/Common/CosmosClient.test.ts
src/Common/CosmosClient.ts src/Common/CosmosClient.ts
src/Common/DataAccessUtilityBase.test.ts src/Common/DataAccessUtilityBase.test.ts
src/Common/DataAccessUtilityBase.ts src/Common/DataAccessUtilityBase.ts
src/Common/DeleteFeedback.ts
src/Common/DocumentClientUtilityBase.ts
src/Common/EditableUtility.ts src/Common/EditableUtility.ts
src/Common/HashMap.test.ts src/Common/HashMap.test.ts
src/Common/HashMap.ts src/Common/HashMap.ts
src/Common/HeadersUtility.test.ts
src/Common/HeadersUtility.ts
src/Common/IteratorUtilities.test.ts src/Common/IteratorUtilities.test.ts
src/Common/IteratorUtilities.ts src/Common/IteratorUtilities.ts
src/Common/Logger.test.ts src/Common/Logger.test.ts
@@ -26,6 +30,7 @@ src/Common/ObjectCache.test.ts
src/Common/ObjectCache.ts src/Common/ObjectCache.ts
src/Common/QueriesClient.ts src/Common/QueriesClient.ts
src/Common/Splitter.ts src/Common/Splitter.ts
src/Common/ThemeUtility.ts
src/Common/UrlUtility.ts src/Common/UrlUtility.ts
src/Config.ts src/Config.ts
src/Contracts/ActionContracts.ts src/Contracts/ActionContracts.ts
@@ -53,6 +58,8 @@ src/Explorer/ComponentRegisterer.test.ts
src/Explorer/ComponentRegisterer.ts src/Explorer/ComponentRegisterer.ts
src/Explorer/ContextMenuButtonFactory.ts src/Explorer/ContextMenuButtonFactory.ts
src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts src/Explorer/Controls/CollapsiblePanel/CollapsiblePanelComponent.ts
src/Explorer/Controls/CommandButton/CommandButton.test.ts
src/Explorer/Controls/CommandButton/CommandButton.ts
src/Explorer/Controls/DiffEditor/DiffEditorComponent.ts src/Explorer/Controls/DiffEditor/DiffEditorComponent.ts
src/Explorer/Controls/DynamicList/DynamicList.test.ts src/Explorer/Controls/DynamicList/DynamicList.test.ts
src/Explorer/Controls/DynamicList/DynamicListComponent.ts src/Explorer/Controls/DynamicList/DynamicListComponent.ts
@@ -88,6 +95,8 @@ src/Explorer/Graph/GraphExplorerComponent/D3ForceGraph.ts
src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts src/Explorer/Graph/GraphExplorerComponent/EdgeInfoCache.ts
src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts src/Explorer/Graph/GraphExplorerComponent/GraphData.test.ts
src/Explorer/Graph/GraphExplorerComponent/GraphData.ts src/Explorer/Graph/GraphExplorerComponent/GraphData.ts
src/Explorer/Graph/GraphExplorerComponent/GraphUtil.test.ts
src/Explorer/Graph/GraphExplorerComponent/GraphUtil.ts
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts src/Explorer/Graph/GraphExplorerComponent/GremlinClient.test.ts
src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts src/Explorer/Graph/GraphExplorerComponent/GremlinClient.ts
src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts src/Explorer/Graph/GraphExplorerComponent/GremlinSimpleClient.test.ts
@@ -115,6 +124,7 @@ src/Explorer/Notebook/NotebookComponent/types.ts
src/Explorer/Notebook/NotebookContainerClient.ts src/Explorer/Notebook/NotebookContainerClient.ts
src/Explorer/Notebook/NotebookContentClient.ts src/Explorer/Notebook/NotebookContentClient.ts
src/Explorer/Notebook/NotebookContentItem.ts src/Explorer/Notebook/NotebookContentItem.ts
src/Explorer/Notebook/NotebookUtil.ts
src/Explorer/OpenActions.test.ts src/Explorer/OpenActions.test.ts
src/Explorer/OpenActions.ts src/Explorer/OpenActions.ts
src/Explorer/OpenActionsStubs.ts src/Explorer/OpenActionsStubs.ts
@@ -160,6 +170,7 @@ src/Explorer/Tables/DataTable/DataTableBuilder.ts
src/Explorer/Tables/DataTable/DataTableContextMenu.ts src/Explorer/Tables/DataTable/DataTableContextMenu.ts
src/Explorer/Tables/DataTable/DataTableOperationManager.ts src/Explorer/Tables/DataTable/DataTableOperationManager.ts
src/Explorer/Tables/DataTable/DataTableOperations.ts src/Explorer/Tables/DataTable/DataTableOperations.ts
src/Explorer/Tables/DataTable/DataTableUtilities.ts
src/Explorer/Tables/DataTable/DataTableViewModel.ts src/Explorer/Tables/DataTable/DataTableViewModel.ts
src/Explorer/Tables/DataTable/TableCommands.ts src/Explorer/Tables/DataTable/TableCommands.ts
src/Explorer/Tables/DataTable/TableEntityCache.ts src/Explorer/Tables/DataTable/TableEntityCache.ts
@@ -168,6 +179,8 @@ src/Explorer/Tables/Entities.ts
src/Explorer/Tables/QueryBuilder/ClauseGroup.ts src/Explorer/Tables/QueryBuilder/ClauseGroup.ts
src/Explorer/Tables/QueryBuilder/ClauseGroupViewModel.ts src/Explorer/Tables/QueryBuilder/ClauseGroupViewModel.ts
src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts src/Explorer/Tables/QueryBuilder/CustomTimestampHelper.ts
src/Explorer/Tables/QueryBuilder/DateTimeUtilities.test.ts
src/Explorer/Tables/QueryBuilder/DateTimeUtilities.ts
src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts src/Explorer/Tables/QueryBuilder/QueryBuilderViewModel.ts
src/Explorer/Tables/QueryBuilder/QueryClauseViewModel.ts src/Explorer/Tables/QueryBuilder/QueryClauseViewModel.ts
src/Explorer/Tables/QueryBuilder/QueryViewModel.ts src/Explorer/Tables/QueryBuilder/QueryViewModel.ts
@@ -260,15 +273,25 @@ src/Terminal/NotebookAppContracts.d.ts
src/Terminal/index.ts src/Terminal/index.ts
src/TokenProviders/PortalTokenProvider.ts src/TokenProviders/PortalTokenProvider.ts
src/TokenProviders/TokenProviderFactory.ts src/TokenProviders/TokenProviderFactory.ts
src/Utils/AuthorizationUtils.test.ts
src/Utils/AuthorizationUtils.ts
src/Utils/AutoPilotUtils.test.ts
src/Utils/AutoPilotUtils.ts
src/Utils/DatabaseAccountUtils.test.ts src/Utils/DatabaseAccountUtils.test.ts
src/Utils/DatabaseAccountUtils.ts src/Utils/DatabaseAccountUtils.ts
src/Utils/JunoUtils.ts
src/Utils/MessageValidation.ts
src/Utils/NotebookConfigurationUtils.ts src/Utils/NotebookConfigurationUtils.ts
src/Utils/PricingUtils.test.ts src/Utils/PricingUtils.test.ts
src/Utils/QueryUtils.test.ts src/Utils/QueryUtils.test.ts
src/Utils/QueryUtils.ts src/Utils/QueryUtils.ts
src/Utils/StringUtils.test.ts
src/Utils/StringUtils.ts
src/applyExplorerBindings.ts src/applyExplorerBindings.ts
src/global.d.ts src/global.d.ts
src/quickstart.ts
src/setupTests.ts src/setupTests.ts
src/workers/upload/definitions.ts
src/workers/upload/index.ts src/workers/upload/index.ts
src/Explorer/Controls/AccessibleElement/AccessibleElement.tsx src/Explorer/Controls/AccessibleElement/AccessibleElement.tsx
src/Explorer/Controls/Accordion/AccordionComponent.tsx src/Explorer/Controls/Accordion/AccordionComponent.tsx

View File

@@ -166,7 +166,9 @@ jobs:
matrix: matrix:
test-file: test-file:
- ./test/cassandra/container.spec.ts - ./test/cassandra/container.spec.ts
- ./test/mongo/container.spec.ts
- ./test/mongo/mongoIndexPolicy.spec.ts - ./test/mongo/mongoIndexPolicy.spec.ts
- ./test/mongo/openMongoAccount.spec.ts
- ./test/notebooks/uploadAndOpenNotebook.spec.ts - ./test/notebooks/uploadAndOpenNotebook.spec.ts
- ./test/selfServe/selfServeExample.spec.ts - ./test/selfServe/selfServeExample.spec.ts
- ./test/sql/container.spec.ts - ./test/sql/container.spec.ts
@@ -192,6 +194,7 @@ jobs:
path: failed-* path: failed-*
cleanupaccounts: cleanupaccounts:
name: "Cleanup Test Database Accounts" name: "Cleanup Test Database Accounts"
needs: [lint, format, compile, unittest]
runs-on: ubuntu-latest runs-on: ubuntu-latest
env: env:
NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }} NOTEBOOKS_TEST_RUNNER_CLIENT_ID: ${{ secrets.NOTEBOOKS_TEST_RUNNER_CLIENT_ID }}

26372
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -77,7 +77,6 @@
"knockout": "3.5.1", "knockout": "3.5.1",
"mkdirp": "1.0.4", "mkdirp": "1.0.4",
"monaco-editor": "0.18.1", "monaco-editor": "0.18.1",
"ms": "2.1.3",
"msal": "1.4.4", "msal": "1.4.4",
"object.entries": "1.1.0", "object.entries": "1.1.0",
"office-ui-fabric-react": "7.134.1", "office-ui-fabric-react": "7.134.1",

View File

@@ -1,5 +1,28 @@
import * as Constants from "./Constants";
import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility"; import { LocalStorageUtility, StorageKey } from "../Shared/StorageUtility";
// x-ms-resource-quota: databases = 100; collections = 5000; users = 500000; permissions = 2000000;
export function getQuota(responseHeaders: any): any {
return responseHeaders && responseHeaders[Constants.HttpHeaders.resourceQuota]
? parseStringIntoObject(responseHeaders[Constants.HttpHeaders.resourceQuota])
: null;
}
export function shouldEnableCrossPartitionKey(): boolean { export function shouldEnableCrossPartitionKey(): boolean {
return LocalStorageUtility.getEntryString(StorageKey.IsCrossPartitionQueryEnabled) === "true"; return LocalStorageUtility.getEntryString(StorageKey.IsCrossPartitionQueryEnabled) === "true";
} }
function parseStringIntoObject(resourceString: string) {
var entityObject: any = {};
if (resourceString) {
var entitiesArray: string[] = resourceString.split(";");
for (var i: any = 0; i < entitiesArray.length; i++) {
var entity: string[] = entitiesArray[i].split("=");
entityObject[entity[0]] = entity[1];
}
}
return entityObject;
}

View File

@@ -2,7 +2,8 @@
* Copyright (C) Microsoft Corporation. All rights reserved. * Copyright (C) Microsoft Corporation. All rights reserved.
*----------------------------------------------------------*/ *----------------------------------------------------------*/
export function getMonacoTheme(theme: string): string { export default class ThemeUtility {
public static getMonacoTheme(theme: string): string {
switch (theme) { switch (theme) {
case "default": case "default":
case "hc-white": case "hc-white":
@@ -15,3 +16,4 @@ export function getMonacoTheme(theme: string): string {
return "vs"; return "vs";
} }
} }
}

View File

@@ -1,4 +1,4 @@
import * as StringUtils from "../../../Utils/StringUtils"; import { StringUtils } from "../../../Utils/StringUtils";
import { KeyCodes } from "../../../Common/Constants"; import { KeyCodes } from "../../../Common/Constants";
import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor"; import * as TelemetryProcessor from "../../../Shared/Telemetry/TelemetryProcessor";
import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants"; import { Action, ActionModifiers } from "../../../Shared/Telemetry/TelemetryConstants";

View File

@@ -4,7 +4,7 @@
import * as React from "react"; import * as React from "react";
import * as DataModels from "../../../Contracts/DataModels"; import * as DataModels from "../../../Contracts/DataModels";
import * as StringUtils from "../../../Utils/StringUtils"; import { StringUtils } from "../../../Utils/StringUtils";
import { userContext } from "../../../UserContext"; import { userContext } from "../../../UserContext";
import { TerminalQueryParams } from "../../../Common/Constants"; import { TerminalQueryParams } from "../../../Common/Constants";
import { handleError } from "../../../Common/ErrorHandlingUtils"; import { handleError } from "../../../Common/ErrorHandlingUtils";

View File

@@ -47,8 +47,8 @@ export interface GalleryViewerComponentProps {
} }
export enum GalleryTab { export enum GalleryTab {
PublicGallery,
OfficialSamples, OfficialSamples,
PublicGallery,
Favorites, Favorites,
Published, Published,
} }
@@ -151,14 +151,15 @@ export class GalleryViewerComponent extends React.Component<GalleryViewerCompone
public render(): JSX.Element { public render(): JSX.Element {
this.traceViewGallery(); this.traceViewGallery();
const tabs: GalleryTabInfo[] = [ const tabs: GalleryTabInfo[] = [this.createSamplesTab(GalleryTab.OfficialSamples, this.state.sampleNotebooks)];
tabs.push(
this.createPublicGalleryTab( this.createPublicGalleryTab(
GalleryTab.PublicGallery, GalleryTab.PublicGallery,
this.state.publicNotebooks, this.state.publicNotebooks,
this.state.isCodeOfConductAccepted this.state.isCodeOfConductAccepted
), )
this.createSamplesTab(GalleryTab.OfficialSamples, this.state.sampleNotebooks), );
];
if (this.props.container) { if (this.props.container) {
tabs.push(this.createFavoritesTab(GalleryTab.Favorites, this.state.favoriteNotebooks)); tabs.push(this.createFavoritesTab(GalleryTab.Favorites, this.state.favoriteNotebooks));
@@ -200,13 +201,6 @@ export class GalleryViewerComponent extends React.Component<GalleryViewerCompone
} }
switch (this.state.selectedTab) { switch (this.state.selectedTab) {
case GalleryTab.PublicGallery:
if (!this.viewPublicGalleryTraced) {
this.resetViewGalleryTabTracedFlags();
this.viewPublicGalleryTraced = true;
trace(Action.NotebooksGalleryViewPublicGallery);
}
break;
case GalleryTab.OfficialSamples: case GalleryTab.OfficialSamples:
if (!this.viewOfficialSamplesTraced) { if (!this.viewOfficialSamplesTraced) {
this.resetViewGalleryTabTracedFlags(); this.resetViewGalleryTabTracedFlags();
@@ -214,6 +208,13 @@ export class GalleryViewerComponent extends React.Component<GalleryViewerCompone
trace(Action.NotebooksGalleryViewOfficialSamples); trace(Action.NotebooksGalleryViewOfficialSamples);
} }
break; break;
case GalleryTab.PublicGallery:
if (!this.viewPublicGalleryTraced) {
this.resetViewGalleryTabTracedFlags();
this.viewPublicGalleryTraced = true;
trace(Action.NotebooksGalleryViewPublicGallery);
}
break;
case GalleryTab.Favorites: case GalleryTab.Favorites:
if (!this.viewFavoritesTraced) { if (!this.viewFavoritesTraced) {
this.resetViewGalleryTabTracedFlags(); this.resetViewGalleryTabTracedFlags();
@@ -443,14 +444,14 @@ export class GalleryViewerComponent extends React.Component<GalleryViewerCompone
private loadTabContent(tab: GalleryTab, searchText: string, sortBy: SortBy, offline: boolean): void { private loadTabContent(tab: GalleryTab, searchText: string, sortBy: SortBy, offline: boolean): void {
switch (tab) { switch (tab) {
case GalleryTab.PublicGallery:
this.loadPublicNotebooks(searchText, sortBy, offline);
break;
case GalleryTab.OfficialSamples: case GalleryTab.OfficialSamples:
this.loadSampleNotebooks(searchText, sortBy, offline); this.loadSampleNotebooks(searchText, sortBy, offline);
break; break;
case GalleryTab.PublicGallery:
this.loadPublicNotebooks(searchText, sortBy, offline);
break;
case GalleryTab.Favorites: case GalleryTab.Favorites:
this.loadFavoriteNotebooks(searchText, sortBy, offline); this.loadFavoriteNotebooks(searchText, sortBy, offline);
break; break;

View File

@@ -8,6 +8,90 @@ exports[`GalleryViewerComponent renders 1`] = `
onLinkClick={[Function]} onLinkClick={[Function]}
selectedKey="OfficialSamples" selectedKey="OfficialSamples"
> >
<PivotItem
headerText="Official samples"
itemKey="OfficialSamples"
key="OfficialSamples"
style={
Object {
"marginTop": 20,
}
}
>
<Stack
tokens={
Object {
"childrenGap": 10,
}
}
>
<Stack
horizontal={true}
tokens={
Object {
"childrenGap": 20,
"padding": 10,
}
}
>
<StackItem
grow={true}
>
<StyledSearchBoxBase
onChange={[Function]}
placeholder="Search"
/>
</StackItem>
<StackItem>
<StyledLabelBase>
Sort by
</StyledLabelBase>
</StackItem>
<StackItem
styles={
Object {
"root": Object {
"minWidth": 200,
},
}
}
>
<StyledWithResponsiveMode
onChange={[Function]}
options={
Array [
Object {
"key": 0,
"text": "Most viewed",
},
Object {
"key": 1,
"text": "Most downloaded",
},
Object {
"key": 3,
"text": "Most recent",
},
Object {
"key": 2,
"text": "Most favorited",
},
]
}
selectedKey={0}
/>
</StackItem>
<StackItem>
<InfoComponent />
</StackItem>
</Stack>
<StackItem>
<StyledSpinnerBase
size={3}
/>
</StackItem>
</Stack>
</PivotItem>
<PivotItem <PivotItem
headerText="Public gallery" headerText="Public gallery"
itemKey="PublicGallery" itemKey="PublicGallery"
@@ -96,90 +180,6 @@ exports[`GalleryViewerComponent renders 1`] = `
</Stack> </Stack>
</div> </div>
</PivotItem> </PivotItem>
<PivotItem
headerText="Official samples"
itemKey="OfficialSamples"
key="OfficialSamples"
style={
Object {
"marginTop": 20,
}
}
>
<Stack
tokens={
Object {
"childrenGap": 10,
}
}
>
<Stack
horizontal={true}
tokens={
Object {
"childrenGap": 20,
"padding": 10,
}
}
>
<StackItem
grow={true}
>
<StyledSearchBoxBase
onChange={[Function]}
placeholder="Search"
/>
</StackItem>
<StackItem>
<StyledLabelBase>
Sort by
</StyledLabelBase>
</StackItem>
<StackItem
styles={
Object {
"root": Object {
"minWidth": 200,
},
}
}
>
<StyledWithResponsiveMode
onChange={[Function]}
options={
Array [
Object {
"key": 0,
"text": "Most viewed",
},
Object {
"key": 1,
"text": "Most downloaded",
},
Object {
"key": 3,
"text": "Most recent",
},
Object {
"key": 2,
"text": "Most favorited",
},
]
}
selectedKey={0}
/>
</StackItem>
<StackItem>
<InfoComponent />
</StackItem>
</Stack>
<StackItem>
<StyledSpinnerBase
size={3}
/>
</StackItem>
</Stack>
</PivotItem>
</StyledPivotBase> </StyledPivotBase>
</div> </div>
`; `;

View File

@@ -49,7 +49,7 @@ import { LoadQueryPane } from "./Panes/LoadQueryPane";
import * as Logger from "../Common/Logger"; import * as Logger from "../Common/Logger";
import { sendMessage, sendCachedDataMessage } from "../Common/MessageHandler"; import { sendMessage, sendCachedDataMessage } from "../Common/MessageHandler";
import { NotebookContentItem, NotebookContentItemType } from "./Notebook/NotebookContentItem"; import { NotebookContentItem, NotebookContentItemType } from "./Notebook/NotebookContentItem";
import * as NotebookUtil from "./Notebook/NotebookUtil"; import { NotebookUtil } from "./Notebook/NotebookUtil";
import { NotebookWorkspaceManager } from "../NotebookWorkspaceManager/NotebookWorkspaceManager"; import { NotebookWorkspaceManager } from "../NotebookWorkspaceManager/NotebookWorkspaceManager";
import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils"; import * as NotificationConsoleUtils from "../Utils/NotificationConsoleUtils";
import { QueriesClient } from "../Common/QueriesClient"; import { QueriesClient } from "../Common/QueriesClient";
@@ -2327,7 +2327,7 @@ export default class Explorer {
account: userContext.databaseAccount, account: userContext.databaseAccount,
container: this, container: this,
junoClient: this.notebookManager?.junoClient, junoClient: this.notebookManager?.junoClient,
selectedTab: selectedTab || GalleryTab.PublicGallery, selectedTab: selectedTab || GalleryTab.OfficialSamples,
notebookUrl, notebookUrl,
galleryItem, galleryItem,
isFavorite, isFavorite,

View File

@@ -5,7 +5,7 @@
import * as React from "react"; import * as React from "react";
import { NeighborVertexBasicInfo, EditedEdges, GraphNewEdgeData, PossibleVertex } from "./GraphExplorer"; import { NeighborVertexBasicInfo, EditedEdges, GraphNewEdgeData, PossibleVertex } from "./GraphExplorer";
import * as GraphUtil from "./GraphUtil"; import { GraphUtil } from "./GraphUtil";
import * as InputTypeaheadComponent from "../../Controls/InputTypeahead/InputTypeaheadComponent"; import * as InputTypeaheadComponent from "../../Controls/InputTypeahead/InputTypeaheadComponent";
import DeleteIcon from "../../../../images/delete.svg"; import DeleteIcon from "../../../../images/delete.svg";
import AddPropertyIcon from "../../../../images/Add-property.svg"; import AddPropertyIcon from "../../../../images/Add-property.svg";

View File

@@ -9,7 +9,7 @@ import { GraphVizComponentProps } from "./GraphVizComponent";
import * as GraphData from "./GraphData"; import * as GraphData from "./GraphData";
import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent"; import { ConsoleDataType } from "../../Menus/NotificationConsole/NotificationConsoleComponent";
import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils"; import * as NotificationConsoleUtils from "../../../Utils/NotificationConsoleUtils";
import * as GraphUtil from "./GraphUtil"; import { GraphUtil } from "./GraphUtil";
import * as DataModels from "../../../Contracts/DataModels"; import * as DataModels from "../../../Contracts/DataModels";
import * as ViewModels from "../../../Contracts/ViewModels"; import * as ViewModels from "../../../Contracts/ViewModels";
import * as GremlinClient from "./GremlinClient"; import * as GremlinClient from "./GremlinClient";

View File

@@ -1,4 +1,4 @@
import * as GraphUtil from "./GraphUtil"; import { GraphUtil } from "./GraphUtil";
import { GraphData, GremlinVertex, GremlinEdge } from "./GraphData"; import { GraphData, GremlinVertex, GremlinEdge } from "./GraphData";
import * as sinon from "sinon"; import * as sinon from "sinon";
import { GraphExplorer } from "./GraphExplorer"; import { GraphExplorer } from "./GraphExplorer";
@@ -69,7 +69,7 @@ describe("Process Gremlin vertex", () => {
describe("getLimitedArrayString()", () => { describe("getLimitedArrayString()", () => {
const expectedEmptyResult = { result: "", consumedCount: 0 }; const expectedEmptyResult = { result: "", consumedCount: 0 };
it("should handle null array", () => { it("should handle null array", () => {
expect(GraphUtil.getLimitedArrayString(undefined, 10)).toEqual(expectedEmptyResult); expect(GraphUtil.getLimitedArrayString(null, 10)).toEqual(expectedEmptyResult);
}); });
it("should handle empty array", () => { it("should handle empty array", () => {

View File

@@ -7,13 +7,8 @@ interface JoinArrayMaxCharOutput {
consumedCount: number; // Number of items consumed consumedCount: number; // Number of items consumed
} }
interface EdgePropertyType { export class GraphUtil {
id: string; public static getNeighborTitle(neighbor: NeighborVertexBasicInfo): string {
outV?: string;
inV?: string;
}
export function getNeighborTitle(neighbor: NeighborVertexBasicInfo): string {
return `edge id: ${neighbor.edgeId}, vertex id: ${neighbor.id}`; return `edge id: ${neighbor.edgeId}, vertex id: ${neighbor.id}`;
} }
@@ -23,17 +18,17 @@ export function getNeighborTitle(neighbor: NeighborVertexBasicInfo): string {
* @param graphData * @param graphData
* @param newNodes (optional) object describing new nodes encountered * @param newNodes (optional) object describing new nodes encountered
*/ */
export function createEdgesfromNode( public static createEdgesfromNode(
vertex: GraphData.GremlinVertex, vertex: GraphData.GremlinVertex,
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>, graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>,
newNodes?: { [id: string]: boolean } newNodes?: { [id: string]: boolean }
): void { ): void {
if (Object.prototype.hasOwnProperty.call(vertex, "outE")) { if (vertex.hasOwnProperty("outE")) {
const outE = vertex.outE; let outE = vertex.outE;
for (const label in outE) { for (var label in outE) {
$.each(outE[label], (index: number, edge: EdgePropertyType) => { $.each(outE[label], (index: number, edge: any) => {
// We create our own edge. No need to fetch // We create our own edge. No need to fetch
const e = { let e = {
id: edge.id, id: edge.id,
label: label, label: label,
inV: edge.inV, inV: edge.inV,
@@ -47,12 +42,12 @@ export function createEdgesfromNode(
}); });
} }
} }
if (Object.prototype.hasOwnProperty.call(vertex, "inE")) { if (vertex.hasOwnProperty("inE")) {
const inE = vertex.inE; let inE = vertex.inE;
for (const label in inE) { for (var label in inE) {
$.each(inE[label], (index: number, edge: EdgePropertyType) => { $.each(inE[label], (index: number, edge: any) => {
// We create our own edge. No need to fetch // We create our own edge. No need to fetch
const e = { let e = {
id: edge.id, id: edge.id,
label: label, label: label,
inV: vertex.id, inV: vertex.id,
@@ -75,7 +70,7 @@ export function createEdgesfromNode(
* @param maxSize * @param maxSize
* @return * @return
*/ */
export function getLimitedArrayString(array: string[], maxSize: number): JoinArrayMaxCharOutput { public static getLimitedArrayString(array: string[], maxSize: number): JoinArrayMaxCharOutput {
if (!array || array.length === 0 || array[0].length + 2 > maxSize) { if (!array || array.length === 0 || array[0].length + 2 > maxSize) {
return { result: "", consumedCount: 0 }; return { result: "", consumedCount: 0 };
} }
@@ -98,7 +93,7 @@ export function getLimitedArrayString(array: string[], maxSize: number): JoinArr
}; };
} }
export function createFetchEdgePairQuery( public static createFetchEdgePairQuery(
outE: boolean, outE: boolean,
pkid: string, pkid: string,
excludedEdgeIds: string[], excludedEdgeIds: string[],
@@ -109,8 +104,8 @@ export function createFetchEdgePairQuery(
let gremlinQuery: string; let gremlinQuery: string;
if (excludedEdgeIds.length > 0) { if (excludedEdgeIds.length > 0) {
// build a string up to max char // build a string up to max char
const joined = getLimitedArrayString(excludedEdgeIds, withoutStepArgMaxLenght); const joined = GraphUtil.getLimitedArrayString(excludedEdgeIds, withoutStepArgMaxLenght);
const hasWithoutStep = joined.result ? `.has(id, without(${joined.result}))` : ""; const hasWithoutStep = !!joined.result ? `.has(id, without(${joined.result}))` : "";
if (joined.consumedCount === excludedEdgeIds.length) { if (joined.consumedCount === excludedEdgeIds.length) {
gremlinQuery = `g.V(${pkid}).${outE ? "outE" : "inE"}()${hasWithoutStep}.limit(${pageSize}).as('e').${ gremlinQuery = `g.V(${pkid}).${outE ? "outE" : "inE"}()${hasWithoutStep}.limit(${pageSize}).as('e').${
@@ -133,7 +128,7 @@ export function createFetchEdgePairQuery(
/** /**
* Trim graph * Trim graph
*/ */
export function trimGraph( public static trimGraph(
currentRoot: GraphData.GremlinVertex, currentRoot: GraphData.GremlinVertex,
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge> graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>
) { ) {
@@ -146,14 +141,14 @@ export function trimGraph(
}); });
} }
export function addRootChildToGraph( public static addRootChildToGraph(
root: GraphData.GremlinVertex, root: GraphData.GremlinVertex,
child: GraphData.GremlinVertex, child: GraphData.GremlinVertex,
graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge> graphData: GraphData.GraphData<GraphData.GremlinVertex, GraphData.GremlinEdge>
) { ) {
child._ancestorsId = (root._ancestorsId || []).concat([root.id]); child._ancestorsId = (root._ancestorsId || []).concat([root.id]);
graphData.addVertex(child); graphData.addVertex(child);
createEdgesfromNode(child, graphData); GraphUtil.createEdgesfromNode(child, graphData);
graphData.addNeighborInfo(child); graphData.addNeighborInfo(child);
} }
@@ -161,23 +156,23 @@ export function addRootChildToGraph(
* TODO Perform minimal substitution to prevent breaking gremlin query and allow \"" for now. * TODO Perform minimal substitution to prevent breaking gremlin query and allow \"" for now.
* @param value * @param value
*/ */
export function escapeDoubleQuotes(value: string): string { public static escapeDoubleQuotes(value: string): string {
return value === undefined ? value : value.replace(/"/g, '\\"'); return value == null ? value : value.replace(/"/g, '\\"');
} }
/** /**
* Surround with double-quotes if val is a string. * Surround with double-quotes if val is a string.
* @param val * @param val
*/ */
export function getQuotedPropValue(ip: ViewModels.InputPropertyValue): string { public static getQuotedPropValue(ip: ViewModels.InputPropertyValue): string {
switch (ip.type) { switch (ip.type) {
case "number": case "number":
case "boolean": case "boolean":
return `${ip.value}`; return `${ip.value}`;
case "null": case "null":
return undefined; return null;
default: default:
return `"${escapeDoubleQuotes(ip.value as string)}"`; return `"${GraphUtil.escapeDoubleQuotes(ip.value as string)}"`;
} }
} }
@@ -185,6 +180,7 @@ export function getQuotedPropValue(ip: ViewModels.InputPropertyValue): string {
* TODO Perform minimal substitution to prevent breaking gremlin query and allow \' for now. * TODO Perform minimal substitution to prevent breaking gremlin query and allow \' for now.
* @param value * @param value
*/ */
export function escapeSingleQuotes(value: string): string { public static escapeSingleQuotes(value: string): string {
return value === undefined ? value : value.replace(/'/g, "\\'"); return value == null ? value : value.replace(/'/g, "\\'");
}
} }

View File

@@ -5,7 +5,7 @@
import * as React from "react"; import * as React from "react";
import { GraphHighlightedNodeData, NeighborVertexBasicInfo } from "./GraphExplorer"; import { GraphHighlightedNodeData, NeighborVertexBasicInfo } from "./GraphExplorer";
import * as GraphUtil from "./GraphUtil"; import { GraphUtil } from "./GraphUtil";
import { AccessibleElement } from "../../Controls/AccessibleElement/AccessibleElement"; import { AccessibleElement } from "../../Controls/AccessibleElement/AccessibleElement";
export interface ReadOnlyNeighborsComponentProps { export interface ReadOnlyNeighborsComponentProps {

View File

@@ -2,7 +2,7 @@ import * as React from "react";
import { NotebookComponent } from "./NotebookComponent"; import { NotebookComponent } from "./NotebookComponent";
import { NotebookClientV2 } from "../NotebookClientV2"; import { NotebookClientV2 } from "../NotebookClientV2";
import * as NotebookUtil from "../NotebookUtil"; import { NotebookUtil } from "../NotebookUtil";
// Vendor modules // Vendor modules
import { import {

View File

@@ -1,4 +1,4 @@
import * as StringUtils from "../../../../../Utils/StringUtils"; import { StringUtils } from "../../../../../Utils/StringUtils";
import { actions, AppState, ContentRef, selectors } from "@nteract/core"; import { actions, AppState, ContentRef, selectors } from "@nteract/core";
import { IMonacoProps as MonacoEditorProps } from "@nteract/monaco-editor"; import { IMonacoProps as MonacoEditorProps } from "@nteract/monaco-editor";
import * as React from "react"; import * as React from "react";

View File

@@ -8,7 +8,7 @@ import * as sinon from "sinon";
import { CdbAppState, makeCdbRecord } from "./types"; import { CdbAppState, makeCdbRecord } from "./types";
import { launchWebSocketKernelEpic } from "./epics"; import { launchWebSocketKernelEpic } from "./epics";
import * as NotebookUtil from "../NotebookUtil"; import { NotebookUtil } from "../NotebookUtil";
import { sessions } from "rx-jupyter"; import { sessions } from "rx-jupyter";

View File

@@ -43,7 +43,7 @@ import { Action as TelemetryAction, ActionModifiers } from "../../../Shared/Tele
import { CdbAppState } from "./types"; import { CdbAppState } from "./types";
import { decryptJWTToken } from "../../../Utils/AuthorizationUtils"; import { decryptJWTToken } from "../../../Utils/AuthorizationUtils";
import * as TextFile from "./contents/file/text-file"; import * as TextFile from "./contents/file/text-file";
import * as NotebookUtil from "../NotebookUtil"; import { NotebookUtil } from "../NotebookUtil";
import { FileSystemUtil } from "../FileSystemUtil"; import { FileSystemUtil } from "../FileSystemUtil";
import * as cdbActions from "../NotebookComponent/actions"; import * as cdbActions from "../NotebookComponent/actions";
import { Areas } from "../../../Common/Constants"; import { Areas } from "../../../Common/Constants";

View File

@@ -1,8 +1,8 @@
import * as DataModels from "../../Contracts/DataModels"; import * as DataModels from "../../Contracts/DataModels";
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem"; import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
import * as StringUtils from "../../Utils/StringUtils"; import { StringUtils } from "../../Utils/StringUtils";
import { FileSystemUtil } from "./FileSystemUtil"; import { FileSystemUtil } from "./FileSystemUtil";
import * as NotebookUtil from "./NotebookUtil"; import { NotebookUtil } from "./NotebookUtil";
import { ServerConfig, IContent, IContentProvider, FileType, IEmptyContent } from "@nteract/core"; import { ServerConfig, IContent, IContentProvider, FileType, IEmptyContent } from "@nteract/core";
import { AjaxResponse } from "rxjs/ajax"; import { AjaxResponse } from "rxjs/ajax";

View File

@@ -1,4 +1,4 @@
import * as NotebookUtil from "./NotebookUtil"; import { NotebookUtil } from "./NotebookUtil";
import * as GitHubUtils from "../../Utils/GitHubUtils"; import * as GitHubUtils from "../../Utils/GitHubUtils";
import { import {
ImmutableNotebook, ImmutableNotebook,

View File

@@ -1,17 +1,18 @@
import path from "path"; import path from "path";
import { ImmutableNotebook, ImmutableCodeCell } from "@nteract/commutable"; import { ImmutableNotebook, ImmutableCodeCell } from "@nteract/commutable";
import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem"; import { NotebookContentItem, NotebookContentItemType } from "./NotebookContentItem";
import * as StringUtils from "../../Utils/StringUtils"; import { StringUtils } from "../../Utils/StringUtils";
import * as GitHubUtils from "../../Utils/GitHubUtils"; import * as GitHubUtils from "../../Utils/GitHubUtils";
// Must match rx-jupyter' FileType // Must match rx-jupyter' FileType
export type FileType = "directory" | "file" | "notebook"; export type FileType = "directory" | "file" | "notebook";
// Utilities for notebooks // Utilities for notebooks
export class NotebookUtil {
/** /**
* It's a notebook file if the filename ends with .ipynb. * It's a notebook file if the filename ends with .ipynb.
*/ */
export function isNotebookFile(notebookPath: string): boolean { public static isNotebookFile(notebookPath: string): boolean {
const fileName = getName(notebookPath); const fileName = NotebookUtil.getName(notebookPath);
return !!fileName && StringUtils.endsWith(fileName, ".ipynb"); return !!fileName && StringUtils.endsWith(fileName, ".ipynb");
} }
@@ -20,12 +21,12 @@ export function isNotebookFile(notebookPath: string): boolean {
* @param name * @param name
* @param path * @param path
*/ */
export function createNotebookContentItem(name: string, path: string, type: FileType): NotebookContentItem { public static createNotebookContentItem(name: string, path: string, type: FileType): NotebookContentItem {
return { return {
name, name,
path, path,
type: getType(type), type: NotebookUtil.getType(type),
timestamp: getCurrentTimestamp(), timestamp: NotebookUtil.getCurrentTimestamp(),
}; };
} }
@@ -33,7 +34,7 @@ export function createNotebookContentItem(name: string, path: string, type: File
* Convert rx-jupyter type to our type * Convert rx-jupyter type to our type
* @param type * @param type
*/ */
export function getType(type: FileType): NotebookContentItemType { public static getType(type: FileType): NotebookContentItemType {
switch (type) { switch (type) {
case "directory": case "directory":
return NotebookContentItemType.Directory; return NotebookContentItemType.Directory;
@@ -46,7 +47,7 @@ export function getType(type: FileType): NotebookContentItemType {
} }
} }
export function getCurrentTimestamp(): number { public static getCurrentTimestamp(): number {
return new Date().getTime(); return new Date().getTime();
} }
@@ -57,7 +58,7 @@ export function getCurrentTimestamp(): number {
* @param filepath * @param filepath
* @param notebook * @param notebook
*/ */
export function extractNewKernel(filepath: string | null, notebook: ImmutableNotebook) { public static extractNewKernel(filepath: string | null, notebook: ImmutableNotebook) {
const cwd = (filepath && path.dirname(filepath)) || "/"; const cwd = (filepath && path.dirname(filepath)) || "/";
const kernelSpecName = const kernelSpecName =
@@ -69,7 +70,7 @@ export function extractNewKernel(filepath: string | null, notebook: ImmutableNot
}; };
} }
export function getFilePath(path: string, fileName: string): string { public static getFilePath(path: string, fileName: string): string {
const contentInfo = GitHubUtils.fromContentUri(path); const contentInfo = GitHubUtils.fromContentUri(path);
if (contentInfo) { if (contentInfo) {
let path = fileName; let path = fileName;
@@ -82,8 +83,8 @@ export function getFilePath(path: string, fileName: string): string {
return `${path}/${fileName}`; return `${path}/${fileName}`;
} }
export function getParentPath(filepath: string): undefined | string { public static getParentPath(filepath: string): undefined | string {
const basename = getName(filepath); const basename = NotebookUtil.getName(filepath);
if (basename) { if (basename) {
const contentInfo = GitHubUtils.fromContentUri(filepath); const contentInfo = GitHubUtils.fromContentUri(filepath);
if (contentInfo) { if (contentInfo) {
@@ -109,7 +110,7 @@ export function getParentPath(filepath: string): undefined | string {
return undefined; return undefined;
} }
export function getName(path: string): undefined | string { public static getName(path: string): undefined | string {
let relativePath: string = path; let relativePath: string = path;
const contentInfo = GitHubUtils.fromContentUri(path); const contentInfo = GitHubUtils.fromContentUri(path);
if (contentInfo) { if (contentInfo) {
@@ -119,7 +120,7 @@ export function getName(path: string): undefined | string {
return relativePath.split("/").pop(); return relativePath.split("/").pop();
} }
export function replaceName(path: string, newName: string): string { public static replaceName(path: string, newName: string): string {
const contentInfo = GitHubUtils.fromContentUri(path); const contentInfo = GitHubUtils.fromContentUri(path);
if (contentInfo) { if (contentInfo) {
const contentName = contentInfo.path.split("/").pop(); const contentName = contentInfo.path.split("/").pop();
@@ -140,7 +141,7 @@ export function replaceName(path: string, newName: string): string {
return `${basePath}${newName}`; return `${basePath}${newName}`;
} }
export function findFirstCodeCellWithDisplay(notebookObject: ImmutableNotebook): number { public static findFirstCodeCellWithDisplay(notebookObject: ImmutableNotebook): number {
let codeCellIndex = 0; let codeCellIndex = 0;
for (let i = 0; i < notebookObject.cellOrder.size; i++) { for (let i = 0; i < notebookObject.cellOrder.size; i++) {
const cellId = notebookObject.cellOrder.get(i); const cellId = notebookObject.cellOrder.get(i);
@@ -159,3 +160,4 @@ export function findFirstCodeCellWithDisplay(notebookObject: ImmutableNotebook):
} }
throw new Error("Output does not exist for any of the cells."); throw new Error("Output does not exist for any of the cells.");
} }
}

View File

@@ -6,7 +6,7 @@ import { IPinnedRepo, JunoClient } from "../../Juno/JunoClient";
import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants"; import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstants";
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
import * as GitHubUtils from "../../Utils/GitHubUtils"; import * as GitHubUtils from "../../Utils/GitHubUtils";
import * as JunoUtils from "../../Utils/JunoUtils"; import { JunoUtils } from "../../Utils/JunoUtils";
import { AuthorizeAccessComponent } from "../Controls/GitHub/AuthorizeAccessComponent"; import { AuthorizeAccessComponent } from "../Controls/GitHub/AuthorizeAccessComponent";
import { GitHubReposComponent, GitHubReposComponentProps, RepoListItem } from "../Controls/GitHub/GitHubReposComponent"; import { GitHubReposComponent, GitHubReposComponentProps, RepoListItem } from "../Controls/GitHub/GitHubReposComponent";
import { GitHubReposComponentAdapter } from "../Controls/GitHub/GitHubReposComponentAdapter"; import { GitHubReposComponentAdapter } from "../Controls/GitHub/GitHubReposComponentAdapter";

View File

@@ -5,7 +5,7 @@ import { FileSystemUtil } from "../Notebook/FileSystemUtil";
import "./PublishNotebookPaneComponent.less"; import "./PublishNotebookPaneComponent.less";
import Html2Canvas from "html2canvas"; import Html2Canvas from "html2canvas";
import { ImmutableNotebook } from "@nteract/commutable/src"; import { ImmutableNotebook } from "@nteract/commutable/src";
import * as NotebookUtil from "../Notebook/NotebookUtil"; import { NotebookUtil } from "../Notebook/NotebookUtil";
export interface PublishNotebookPaneProps { export interface PublishNotebookPaneProps {
notebookName: string; notebookName: string;

View File

@@ -37,6 +37,23 @@ export function containItems<T>(items: T[]): boolean {
return items && items.length > 0; return items && items.length > 0;
} }
// export function setTargetIcon(idToIconHandlerMap: CloudHub.Common.IToolbarElementIdIconMap, $sourceElement: JQuery, toIconState: IconState): void {
// if (idToIconHandlerMap) {
// var iconId: string = $sourceElement.attr("id");
// var iconHandler = idToIconHandlerMap[iconId];
// switch (toIconState) {
// case IconState.default:
// iconHandler.observable(iconHandler.default);
// break;
// case IconState.hoverState:
// iconHandler.observable(iconHandler.hoverState);
// break;
// default:
// window.console.log("error");
// }
// }
// }
export function addCssClass($sourceElement: JQuery, cssClassName: string): void { export function addCssClass($sourceElement: JQuery, cssClassName: string): void {
if (!$sourceElement.hasClass(cssClassName)) { if (!$sourceElement.hasClass(cssClassName)) {
$sourceElement.addClass(cssClassName); $sourceElement.addClass(cssClassName);
@@ -61,9 +78,8 @@ export function getPropertyIntersectionFromTableEntities(
entities: Entities.ITableEntity[], entities: Entities.ITableEntity[],
isCassandraApi: boolean isCassandraApi: boolean
): string[] { ): string[] {
const headerUnion: string[] = []; var headerUnion: string[] = [];
entities && entities &&
// eslint-disable-next-line @typescript-eslint/no-explicit-any
entities.forEach((row: any) => { entities.forEach((row: any) => {
const keys = Object.keys(row); const keys = Object.keys(row);
keys && keys &&

View File

@@ -2,26 +2,26 @@ const epochTicks = 621355968000000000;
const ticksPerMillisecond = 10000; const ticksPerMillisecond = 10000;
export function getLocalDateTime(dateTime: string): string { export function getLocalDateTime(dateTime: string): string {
const dateTimeObject: Date = new Date(dateTime); var dateTimeObject: Date = new Date(dateTime);
const year: number = dateTimeObject.getFullYear(); var year: number = dateTimeObject.getFullYear();
const month: string = ensureDoubleDigits(dateTimeObject.getMonth() + 1); // Month ranges from 0 to 11 var month: string = ensureDoubleDigits(dateTimeObject.getMonth() + 1); // Month ranges from 0 to 11
const day: string = ensureDoubleDigits(dateTimeObject.getDate()); var day: string = ensureDoubleDigits(dateTimeObject.getDate());
const hours: string = ensureDoubleDigits(dateTimeObject.getHours()); var hours: string = ensureDoubleDigits(dateTimeObject.getHours());
const minutes: string = ensureDoubleDigits(dateTimeObject.getMinutes()); var minutes: string = ensureDoubleDigits(dateTimeObject.getMinutes());
const seconds: string = ensureDoubleDigits(dateTimeObject.getSeconds()); var seconds: string = ensureDoubleDigits(dateTimeObject.getSeconds());
const milliseconds: string = ensureTripleDigits(dateTimeObject.getMilliseconds()); var milliseconds: string = ensureTripleDigits(dateTimeObject.getMilliseconds());
const localDateTime = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${milliseconds}`; var localDateTime: string = `${year}-${month}-${day}T${hours}:${minutes}:${seconds}.${milliseconds}`;
return localDateTime; return localDateTime;
} }
export function getUTCDateTime(dateTime: string): string { export function getUTCDateTime(dateTime: string): string {
const dateTimeObject = new Date(dateTime); var dateTimeObject: Date = new Date(dateTime);
return dateTimeObject.toISOString(); return dateTimeObject.toISOString();
} }
export function ensureDoubleDigits(num: number): string { export function ensureDoubleDigits(num: number): string {
let doubleDigitsString: string = num.toString(); var doubleDigitsString: string = num.toString();
if (num < 10) { if (num < 10) {
doubleDigitsString = `0${doubleDigitsString}`; doubleDigitsString = `0${doubleDigitsString}`;
} else if (num > 99) { } else if (num > 99) {
@@ -31,7 +31,7 @@ export function ensureDoubleDigits(num: number): string {
} }
export function ensureTripleDigits(num: number): string { export function ensureTripleDigits(num: number): string {
let tripleDigitsString: string = num.toString(); var tripleDigitsString: string = num.toString();
if (num < 10) { if (num < 10) {
tripleDigitsString = `00${tripleDigitsString}`; tripleDigitsString = `00${tripleDigitsString}`;
} else if (num < 100) { } else if (num < 100) {
@@ -51,17 +51,17 @@ export function convertJSDateToUnix(dateTime: string): number {
} }
export function convertTicksToJSDate(ticks: string): Date { export function convertTicksToJSDate(ticks: string): Date {
const ticksJSBased = Number(ticks) - epochTicks; var ticksJSBased = Number(ticks) - epochTicks;
const timeInMillisecond = ticksJSBased / ticksPerMillisecond; var timeInMillisecond = ticksJSBased / ticksPerMillisecond;
return new Date(timeInMillisecond); return new Date(timeInMillisecond);
} }
export function convertJSDateToTicksWithPadding(dateTime: string): string { export function convertJSDateToTicksWithPadding(dateTime: string): string {
const ticks = epochTicks + new Date(dateTime).getTime() * ticksPerMillisecond; var ticks = epochTicks + new Date(dateTime).getTime() * ticksPerMillisecond;
return padDateTicksWithZeros(ticks.toString()); return padDateTicksWithZeros(ticks.toString());
} }
function padDateTicksWithZeros(value: string): string { function padDateTicksWithZeros(value: string): string {
const s = "0000000000000000000" + value; var s = "0000000000000000000" + value;
return s.substr(s.length - 20); return s.substr(s.length - 20);
} }

View File

@@ -7,7 +7,7 @@ import { Action, ActionModifiers } from "../../Shared/Telemetry/TelemetryConstan
import { RouteHandler } from "../../RouteHandlers/RouteHandler"; import { RouteHandler } from "../../RouteHandlers/RouteHandler";
import { WaitsForTemplateViewModel } from "../WaitsForTemplateViewModel"; import { WaitsForTemplateViewModel } from "../WaitsForTemplateViewModel";
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";
import * as ThemeUtility from "../../Common/ThemeUtility"; import ThemeUtility from "../../Common/ThemeUtility";
import Explorer from "../Explorer"; import Explorer from "../Explorer";
import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent"; import { CommandButtonComponentProps } from "../Controls/CommandButton/CommandButtonComponent";

View File

@@ -17,7 +17,7 @@ import NewNotebookIcon from "../../../images/notebook/Notebook-new.svg";
import FileIcon from "../../../images/notebook/file-cosmos.svg"; import FileIcon from "../../../images/notebook/file-cosmos.svg";
import PublishIcon from "../../../images/notebook/publish_content.svg"; import PublishIcon from "../../../images/notebook/publish_content.svg";
import { ArrayHashMap } from "../../Common/ArrayHashMap"; import { ArrayHashMap } from "../../Common/ArrayHashMap";
import * as NotebookUtil from "../Notebook/NotebookUtil"; import { NotebookUtil } from "../Notebook/NotebookUtil";
import _ from "underscore"; import _ from "underscore";
import { IPinnedRepo } from "../../Juno/JunoClient"; import { IPinnedRepo } from "../../Juno/JunoClient";
import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor"; import * as TelemetryProcessor from "../../Shared/Telemetry/TelemetryProcessor";

View File

@@ -26,7 +26,7 @@ const onInit = async () => {
const props: GalleryAndNotebookViewerComponentProps = { const props: GalleryAndNotebookViewerComponentProps = {
junoClient: new JunoClient(), junoClient: new JunoClient(),
selectedTab: galleryViewerProps.selectedTab || GalleryTab.PublicGallery, selectedTab: galleryViewerProps.selectedTab || GalleryTab.OfficialSamples,
sortBy: galleryViewerProps.sortBy || SortBy.MostViewed, sortBy: galleryViewerProps.sortBy || SortBy.MostViewed,
searchText: galleryViewerProps.searchText, searchText: galleryViewerProps.searchText,
}; };

View File

@@ -2,7 +2,7 @@ import { Octokit } from "@octokit/rest";
import { HttpStatusCodes } from "../Common/Constants"; import { HttpStatusCodes } from "../Common/Constants";
import * as Logger from "../Common/Logger"; import * as Logger from "../Common/Logger";
import UrlUtility from "../Common/UrlUtility"; import UrlUtility from "../Common/UrlUtility";
import * as NotebookUtil from "../Explorer/Notebook/NotebookUtil"; import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
import { getErrorMessage } from "../Common/ErrorHandlingUtils"; import { getErrorMessage } from "../Common/ErrorHandlingUtils";
export interface IGitHubPageInfo { export interface IGitHubPageInfo {

View File

@@ -5,7 +5,7 @@ import { AjaxResponse } from "rxjs/ajax";
import * as Base64Utils from "../Utils/Base64Utils"; import * as Base64Utils from "../Utils/Base64Utils";
import { HttpStatusCodes } from "../Common/Constants"; import { HttpStatusCodes } from "../Common/Constants";
import * as Logger from "../Common/Logger"; import * as Logger from "../Common/Logger";
import * as NotebookUtil from "../Explorer/Notebook/NotebookUtil"; import { NotebookUtil } from "../Explorer/Notebook/NotebookUtil";
import { GitHubClient, IGitHubFile, IGitHubResponse } from "./GitHubClient"; import { GitHubClient, IGitHubFile, IGitHubResponse } from "./GitHubClient";
import * as GitHubUtils from "../Utils/GitHubUtils"; import * as GitHubUtils from "../Utils/GitHubUtils";
import UrlUtility from "../Common/UrlUtility"; import UrlUtility from "../Common/UrlUtility";

View File

@@ -1,7 +1,9 @@
import * as Constants from "../Common/Constants"; import * as Constants from "../Common/Constants";
import * as AuthorizationUtils from "./AuthorizationUtils"; import * as AuthorizationUtils from "./AuthorizationUtils";
import { AuthType } from "../AuthType"; import { AuthType } from "../AuthType";
import Explorer from "../Explorer/Explorer";
import { updateUserContext } from "../UserContext"; import { updateUserContext } from "../UserContext";
import { Platform, updateConfigContext } from "../ConfigContext";
jest.mock("../Explorer/Explorer"); jest.mock("../Explorer/Explorer");
describe("AuthorizationUtils", () => { describe("AuthorizationUtils", () => {
@@ -32,6 +34,10 @@ describe("AuthorizationUtils", () => {
expect(() => AuthorizationUtils.decryptJWTToken(undefined)).toThrowError(); expect(() => AuthorizationUtils.decryptJWTToken(undefined)).toThrowError();
}); });
it("should throw an error if token is null", () => {
expect(() => AuthorizationUtils.decryptJWTToken(null)).toThrowError();
});
it("should throw an error if token is empty", () => { it("should throw an error if token is empty", () => {
expect(() => AuthorizationUtils.decryptJWTToken("")).toThrowError(); expect(() => AuthorizationUtils.decryptJWTToken("")).toThrowError();
}); });

View File

@@ -1,6 +1,7 @@
import { AuthType } from "../AuthType"; import { AuthType } from "../AuthType";
import * as Constants from "../Common/Constants"; import * as Constants from "../Common/Constants";
import * as Logger from "../Common/Logger"; import * as Logger from "../Common/Logger";
import { configContext, Platform } from "../ConfigContext";
import * as ViewModels from "../Contracts/ViewModels"; import * as ViewModels from "../Contracts/ViewModels";
import { userContext } from "../UserContext"; import { userContext } from "../UserContext";

View File

@@ -474,10 +474,10 @@ export function getNotebookViewerProps(search: string): NotebookViewerProps {
export function getTabTitle(tab: GalleryTab): string { export function getTabTitle(tab: GalleryTab): string {
switch (tab) { switch (tab) {
case GalleryTab.PublicGallery:
return GalleryViewerComponent.PublicGalleryTitle;
case GalleryTab.OfficialSamples: case GalleryTab.OfficialSamples:
return GalleryViewerComponent.OfficialSamplesTitle; return GalleryViewerComponent.OfficialSamplesTitle;
case GalleryTab.PublicGallery:
return GalleryViewerComponent.PublicGalleryTitle;
case GalleryTab.Favorites: case GalleryTab.Favorites:
return GalleryViewerComponent.FavoritesTitle; return GalleryViewerComponent.FavoritesTitle;
case GalleryTab.Published: case GalleryTab.Published:

View File

@@ -1,6 +1,6 @@
import { RepoListItem } from "../Explorer/Controls/GitHub/GitHubReposComponent"; import { RepoListItem } from "../Explorer/Controls/GitHub/GitHubReposComponent";
import { IPinnedRepo } from "../Juno/JunoClient"; import { IPinnedRepo } from "../Juno/JunoClient";
import * as JunoUtils from "./JunoUtils"; import { JunoUtils } from "./JunoUtils";
import { IGitHubRepo } from "../GitHub/GitHubClient"; import { IGitHubRepo } from "../GitHub/GitHubClient";
const gitHubRepo: IGitHubRepo = { const gitHubRepo: IGitHubRepo = {

View File

@@ -2,7 +2,8 @@ import { RepoListItem } from "../Explorer/Controls/GitHub/GitHubReposComponent";
import { IGitHubRepo } from "../GitHub/GitHubClient"; import { IGitHubRepo } from "../GitHub/GitHubClient";
import { IPinnedRepo } from "../Juno/JunoClient"; import { IPinnedRepo } from "../Juno/JunoClient";
export function toPinnedRepo(item: RepoListItem): IPinnedRepo { export class JunoUtils {
public static toPinnedRepo(item: RepoListItem): IPinnedRepo {
return { return {
owner: item.repo.owner, owner: item.repo.owner,
name: item.repo.name, name: item.repo.name,
@@ -11,10 +12,11 @@ export function toPinnedRepo(item: RepoListItem): IPinnedRepo {
}; };
} }
export function toGitHubRepo(pinnedRepo: IPinnedRepo): IGitHubRepo { public static toGitHubRepo(pinnedRepo: IPinnedRepo): IGitHubRepo {
return { return {
owner: pinnedRepo.owner, owner: pinnedRepo.owner,
name: pinnedRepo.name, name: pinnedRepo.name,
private: pinnedRepo.private, private: pinnedRepo.private,
}; };
} }
}

View File

@@ -1,4 +1,4 @@
import * as StringUtils from "./StringUtils"; import { StringUtils } from "./StringUtils";
describe("StringUtils", () => { describe("StringUtils", () => {
describe("stripSpacesFromString()", () => { describe("stripSpacesFromString()", () => {
@@ -12,9 +12,9 @@ describe("StringUtils", () => {
expect(transformedString).toBe("abc"); expect(transformedString).toBe("abc");
}); });
it("should return undefined if input is undefined", () => { it("should return null if input is null", () => {
const transformedString: string = StringUtils.stripSpacesFromString(undefined); const transformedString: string = StringUtils.stripSpacesFromString(null);
expect(transformedString).toBeUndefined(); expect(transformedString).toBeNull();
}); });
it("should return undefined if input is undefiend", () => { it("should return undefined if input is undefiend", () => {

View File

@@ -1,5 +1,6 @@
export function stripSpacesFromString(inputString: string): string { export class StringUtils {
if (inputString === undefined || typeof inputString !== "string") { public static stripSpacesFromString(inputString: string): string {
if (inputString == null || typeof inputString !== "string") {
return inputString; return inputString;
} }
return inputString.replace(/ /g, ""); return inputString.replace(/ /g, "");
@@ -10,10 +11,11 @@ export function stripSpacesFromString(inputString: string): string {
* @param stringToTest * @param stringToTest
* @param suffix * @param suffix
*/ */
export function endsWith(stringToTest: string, suffix: string): boolean { public static endsWith(stringToTest: string, suffix: string): boolean {
return stringToTest.indexOf(suffix, stringToTest.length - suffix.length) !== -1; return stringToTest.indexOf(suffix, stringToTest.length - suffix.length) !== -1;
} }
export function startsWith(stringToTest: string, prefix: string): boolean { public static startsWith(stringToTest: string, prefix: string): boolean {
return stringToTest.indexOf(prefix) === 0; return stringToTest.indexOf(prefix) === 0;
} }
}

View File

@@ -4,7 +4,7 @@ import { createDatabase, onClickSaveButton } from "../utils/shared";
import { generateUniqueName } from "../utils/shared"; import { generateUniqueName } from "../utils/shared";
import { ApiKind } from "../../src/Contracts/DataModels"; import { ApiKind } from "../../src/Contracts/DataModels";
const LOADING_STATE_DELAY = 5000; const LOADING_STATE_DELAY = 3000;
jest.setTimeout(300000); jest.setTimeout(300000);
describe("MongoDB Index policy tests", () => { describe("MongoDB Index policy tests", () => {
@@ -20,12 +20,21 @@ describe("MongoDB Index policy tests", () => {
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
await frame.waitFor(LOADING_STATE_DELAY); await frame.waitFor(LOADING_STATE_DELAY);
await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true }); await frame.waitForSelector('div[class="splashScreen"] > div[class="title"]', { visible: true });
const dbId = await createDatabase(frame); let databases = await frame.$$(`div[class="databaseHeader main1 nodeItem "] > div[class="treeNodeHeader "]`);
if (databases.length === 0) {
await createDatabase(frame);
await frame.waitFor(25000); await frame.waitFor(25000);
databases = await frame.$$(`div[class="databaseHeader main1 nodeItem "] > div[class="treeNodeHeader "]`);
}
const selectedDbId = (await frame.evaluate((element) => element.innerText, databases[0]))
.replace(/[\u{0080}-\u{FFFF}]/gu, "")
.trim();
// click on database // click on database
await frame.waitForSelector(`div[data-test="${dbId}"]`); await frame.waitForSelector(`div[data-test="${selectedDbId}"]`);
await frame.waitFor(LOADING_STATE_DELAY); await frame.waitFor(LOADING_STATE_DELAY);
await frame.click(`div[data-test="${dbId}"]`); await frame.click(`div[data-test="${selectedDbId}"]`);
await frame.waitFor(LOADING_STATE_DELAY); await frame.waitFor(LOADING_STATE_DELAY);
// click on scale & setting // click on scale & setting
@@ -74,7 +83,6 @@ describe("MongoDB Index policy tests", () => {
let singleFieldIndexInserted = false, let singleFieldIndexInserted = false,
wildCardIndexInserted = false; wildCardIndexInserted = false;
await frame.waitFor("div[data-automationid='DetailsRowCell'] > span"), { visible: true }; await frame.waitFor("div[data-automationid='DetailsRowCell'] > span"), { visible: true };
await frame.waitFor(20000);
const elements = await frame.$$("div[data-automationid='DetailsRowCell'] > span"); const elements = await frame.$$("div[data-automationid='DetailsRowCell'] > span");
for (let i = 0; i < elements.length; i++) { for (let i = 0; i < elements.length; i++) {
@@ -106,7 +114,7 @@ describe("MongoDB Index policy tests", () => {
} catch (error) { } catch (error) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any // eslint-disable-next-line @typescript-eslint/no-explicit-any
const testName = (expect as any).getState().currentTestName; const testName = (expect as any).getState().currentTestName;
await page.screenshot({ path: `failed-${testName}.jpg` }); await page.screenshot({ path: `Test Failed ${testName}.jpg` });
throw error; throw error;
} }
}); });

View File

@@ -0,0 +1,21 @@
import { Frame } from "puppeteer";
import { ApiKind } from "../../src/Contracts/DataModels";
import { getTestExplorerFrame } from "../testExplorer/TestExplorerUtils";
jest.setTimeout(300000);
let frame: Frame;
describe("Mongo", () => {
it("Account opens", async () => {
try {
frame = await getTestExplorerFrame(ApiKind.MongoDB);
await frame.waitForSelector(".accordion");
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const testName = (expect as any).getState().currentTestName;
await page.screenshot({ path: `Test Failed ${testName}.jpg` });
throw error;
}
});
});

View File

@@ -3,14 +3,6 @@ import "expect-puppeteer";
import { Frame } from "puppeteer"; import { Frame } from "puppeteer";
import { generateDatabaseName, generateUniqueName } from "../utils/shared"; import { generateDatabaseName, generateUniqueName } from "../utils/shared";
import { CosmosClient, PermissionMode } from "@azure/cosmos"; import { CosmosClient, PermissionMode } from "@azure/cosmos";
import { CosmosDBManagementClient } from "@azure/arm-cosmosdb";
import * as msRestNodeAuth from "@azure/ms-rest-nodeauth";
const clientId = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_ID"];
const secret = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET"];
const tenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
const subscriptionId = "69e02f2d-f059-4409-9eac-97e8a276ae2c";
const resourceGroupName = "runners";
jest.setTimeout(300000); jest.setTimeout(300000);
const RETRY_DELAY = 5000; const RETRY_DELAY = 5000;
@@ -18,16 +10,11 @@ const CREATE_DELAY = 10000;
describe("Collection Add and Delete SQL spec", () => { describe("Collection Add and Delete SQL spec", () => {
it("creates a collection", async () => { it("creates a collection", async () => {
const credentials = await msRestNodeAuth.loginWithServicePrincipalSecret(clientId, secret, tenantId);
const armClient = new CosmosDBManagementClient(credentials, subscriptionId);
const account = await armClient.databaseAccounts.get(resourceGroupName, "portal-sql-runner");
const keys = await armClient.databaseAccounts.listKeys(resourceGroupName, "portal-sql-runner");
const dbId = generateDatabaseName(); const dbId = generateDatabaseName();
const collectionId = generateUniqueName("col"); const collectionId = generateUniqueName("col");
const client = new CosmosClient({ const connectionString = process.env.PORTAL_RUNNER_CONNECTION_STRING;
endpoint: account.documentEndpoint, const client = new CosmosClient(connectionString);
key: keys.primaryMasterKey, const endpoint = /AccountEndpoint=(.*);/.exec(connectionString)[1];
});
const { database } = await client.databases.createIfNotExists({ id: dbId }); const { database } = await client.databases.createIfNotExists({ id: dbId });
const { container } = await database.containers.createIfNotExists({ id: collectionId }); const { container } = await database.containers.createIfNotExists({ id: collectionId });
const { user } = await database.users.upsert({ id: "testUser" }); const { user } = await database.users.upsert({ id: "testUser" });
@@ -36,7 +23,7 @@ describe("Collection Add and Delete SQL spec", () => {
permissionMode: PermissionMode.All, permissionMode: PermissionMode.All,
resource: container.url, resource: container.url,
}); });
const resourceTokenConnectionString = `AccountEndpoint=${account.documentEndpoint};DatabaseId=${database.id};CollectionId=${container.id};${containerPermission._token}`; const resourceTokenConnectionString = `AccountEndpoint=${endpoint};DatabaseId=${database.id};CollectionId=${container.id};${containerPermission._token}`;
try { try {
await page.goto(process.env.DATA_EXPLORER_ENDPOINT); await page.goto(process.env.DATA_EXPLORER_ENDPOINT);
await page.waitFor("div > p.switchConnectTypeText", { visible: true }); await page.waitFor("div > p.switchConnectTypeText", { visible: true });

View File

@@ -30,7 +30,7 @@ export function generateDatabaseName(baseName = "db", length = 1): string {
return `${baseName}${crypto.randomBytes(length).toString("hex")}-${Date.now()}`; return `${baseName}${crypto.randomBytes(length).toString("hex")}-${Date.now()}`;
} }
export async function createDatabase(frame: Frame): Promise<string> { export async function createDatabase(frame: Frame) {
const dbId = generateDatabaseName(); const dbId = generateDatabaseName();
const collectionId = generateUniqueName("col"); const collectionId = generateUniqueName("col");
const shardKey = "partitionKey"; const shardKey = "partitionKey";
@@ -67,10 +67,9 @@ export async function createDatabase(frame: Frame): Promise<string> {
// click submit // click submit
await frame.waitFor("#submitBtnAddCollection"); await frame.waitFor("#submitBtnAddCollection");
await frame.click("#submitBtnAddCollection"); await frame.click("#submitBtnAddCollection");
return dbId;
} }
export async function onClickSaveButton(frame: Frame): Promise<void> { export async function onClickSaveButton(frame: Frame) {
await frame.waitFor(`button[data-test="Save"]`), { visible: true }; await frame.waitFor(`button[data-test="Save"]`), { visible: true };
await frame.waitFor(LOADING_STATE_DELAY); await frame.waitFor(LOADING_STATE_DELAY);
await frame.click(`button[data-test="Save"]`); await frame.click(`button[data-test="Save"]`);

View File

@@ -1,7 +1,5 @@
const msRestNodeAuth = require("@azure/ms-rest-nodeauth"); const msRestNodeAuth = require("@azure/ms-rest-nodeauth");
const { CosmosDBManagementClient } = require("@azure/arm-cosmosdb"); const { CosmosDBManagementClient } = require("@azure/arm-cosmosdb");
const ms = require("ms");
const { time } = require("console");
const clientId = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_ID"]; const clientId = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_ID"];
const secret = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET"]; const secret = process.env["NOTEBOOKS_TEST_RUNNER_CLIENT_SECRET"];
@@ -9,7 +7,7 @@ const tenantId = "72f988bf-86f1-41af-91ab-2d7cd011db47";
const subscriptionId = "69e02f2d-f059-4409-9eac-97e8a276ae2c"; const subscriptionId = "69e02f2d-f059-4409-9eac-97e8a276ae2c";
const resourceGroupName = "runners"; const resourceGroupName = "runners";
const sixtyMinutesAgo = new Date(Date.now() - 1000 * 60 * 60).getTime(); const twentyMinutesAgo = new Date(Date.now() - 1000 * 60 * 20);
// Deletes all SQL and Mongo databases created more than 20 minutes ago in the test runner accounts // Deletes all SQL and Mongo databases created more than 20 minutes ago in the test runner accounts
async function main() { async function main() {
@@ -20,23 +18,23 @@ async function main() {
if (account.kind === "MongoDB") { if (account.kind === "MongoDB") {
const mongoDatabases = await client.mongoDBResources.listMongoDBDatabases(resourceGroupName, account.name); const mongoDatabases = await client.mongoDBResources.listMongoDBDatabases(resourceGroupName, account.name);
for (const database of mongoDatabases) { for (const database of mongoDatabases) {
const timestamp = Number(database.name.split("-")[1]); const timestamp = database.name.split("-")[1];
if (timestamp && timestamp < sixtyMinutesAgo) { if (!timestamp || new Date(timestamp) < twentyMinutesAgo) {
await client.mongoDBResources.deleteMongoDBDatabase(resourceGroupName, account.name, database.name); await client.mongoDBResources.deleteMongoDBDatabase(resourceGroupName, account.name, database.name);
console.log(`DELETED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - timestamp)}`); console.log(`DELETED: ${account.name} | ${database.name} | Timestamp: ${Date.now()}`);
} else { } else {
console.log(`SKIPPED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - timestamp)}`); console.log(`SKIPPED: ${account.name} | ${database.name} | Timestamp: ${Date.now()}`);
} }
} }
} else if (account.kind === "GlobalDocumentDB") { } else if (account.kind === "GlobalDocumentDB") {
const sqlDatabases = await client.sqlResources.listSqlDatabases(resourceGroupName, account.name); const sqlDatabases = await client.sqlResources.listSqlDatabases(resourceGroupName, account.name);
for (const database of sqlDatabases) { for (const database of sqlDatabases) {
const timestamp = Number(database.name.split("-")[1]); const timestamp = database.name.split("-")[1];
if (timestamp && timestamp < sixtyMinutesAgo) { if (!timestamp || new Date(timestamp) < twentyMinutesAgo) {
await client.sqlResources.deleteSqlDatabase(resourceGroupName, account.name, database.name); await client.sqlResources.deleteSqlDatabase(resourceGroupName, account.name, database.name);
console.log(`DELETED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - timestamp)}`); console.log(`DELETED: ${account.name} | ${database.name} | Timestamp: ${Date.now()}`);
} else { } else {
console.log(`SKIPPED: ${account.name} | ${database.name} | Age: ${ms(Date.now() - timestamp)}`); console.log(`SKIPPED: ${account.name} | ${database.name} | Timestamp: ${Date.now()}`);
} }
} }
} }
@@ -49,7 +47,6 @@ main()
process.exit(0); process.exit(0);
}) })
.catch((err) => { .catch((err) => {
console.log(err); console.error(err);
console.log("Cleanup failed! Exiting with success. Cleanup should always fail safe."); process.exit(1);
process.exit(0);
}); });