Skip to content

Commit

Permalink
RavenDB-22581 npm update
Browse files Browse the repository at this point in the history
  • Loading branch information
ml054 committed Jul 10, 2024
1 parent 710a891 commit 894a300
Show file tree
Hide file tree
Showing 135 changed files with 384 additions and 291 deletions.
9 changes: 4 additions & 5 deletions src/Raven.Studio/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions src/Raven.Studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@
"@types/knockout.validation": "^0.0.42",
"@types/leaflet": "^1.7.11",
"@types/leaflet.markercluster": "^1.5.1",
"@types/lodash": "^4.14.182",
"@types/node-forge": "^1.3.11",
"@types/prismjs": "^1.26.0",
"@types/rbush": "^2.0.1",
Expand Down Expand Up @@ -96,7 +95,7 @@
"terser-webpack-plugin": "^5.3.3",
"ts-jest": "^29.1.5",
"ts-loader": "^9.5.1",
"typescript": "^5.4.5",
"typescript": "^5.5.3",
"webfonts-loader": "^8.0.0",
"webpack": "^5.92.1",
"webpack-bundle-analyzer": "^4.10.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class saveCompareExchangeItemCommand extends commandBase {
Object: this.valueData
};

if (!_.isUndefined(this.metadata)) {
if (this.metadata !== undefined) {
payload["@metadata"] = this.metadata;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class startReshardingCommand extends commandBase {

constructor(db: database | string, range: Range, targetShard: number) {
super();
this.databaseName = (_.isString(db) ? db : db.name);
this.databaseName = typeof db === "string" ? db : db.name;
this.range = range;
this.targetShard = targetShard;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class recordTransactionsCommand extends commandBase {
};

return this.post<operationIdDto>(url, JSON.stringify(payload), this.db, { dataType: undefined })
.done(() => this.reportSuccess("Transaction Commands Recoding was started for database: " + (_.isString(this.db) ? this.db : this.db.name)))
.done(() => this.reportSuccess("Transaction Commands Recoding was started for database: " + (typeof this.db === "string" ? this.db : this.db.name)))
.fail((response: JQueryXHR) => this.reportError("Failed to start recording transaction commands", response.responseText, response.statusText));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class saveConflictSolverConfigurationCommand extends commandBase {

constructor(db: database | string, configuration: Raven.Client.ServerWide.ConflictSolver) {
super();
this.databaseName = (_.isString(db) ? db : db.name);
this.databaseName = typeof db === "string" ? db : db.name;
this.configuration = configuration;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class delayBackupCommand extends commandBase {
super();
this.duration = duration;
this.taskId = taskId;
this.databaseName = (_.isString(db) ? db : db.name);
this.databaseName = (typeof db === "string" ? db : db.name);
}

execute(): JQueryPromise<Raven.Client.Documents.Operations.Backups.StartBackupOperationResult> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class getPeriodicBackupConfigurationCommand extends commandBase {

constructor( db: database | string, taskId: number) {
super();
this.databaseName = (_.isString(db) ? db : db.name);
this.databaseName = (typeof db === "string" ? db : db.name);
this.taskId = taskId;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class saveSubscriptionTaskCommand extends commandBase {

constructor( db: database | string, payload: Raven.Client.Documents.Subscriptions.SubscriptionCreationOptions, taskId?: number) {
super();
this.databaseName = (_.isString(db) ? db : db.name);
this.databaseName = (typeof db === "string" ? db : db.name);
this.taskId = taskId;
this.payload = payload;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class getDatabaseRecordCommand extends commandBase {

constructor(db: database | string, reportRefreshProgress = false) {
super();
this.databaseName = (_.isString(db) ? db : db.name);
this.databaseName = (typeof db === "string" ? db : db.name);
this.reportRefreshProgress = reportRefreshProgress;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class saveDatabaseLockModeCommand extends commandBase {

execute(): JQueryPromise<void> {
const payload: Raven.Client.ServerWide.Operations.SetDatabasesLockOperation.Parameters = {
DatabaseNames: this.dbs.map(x => (_.isString(x) ? x : x.name)),
DatabaseNames: this.dbs.map(x => (typeof x === "string" ? x : x.name)),
Mode: this.lockMode
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import endpoints = require("endpoints");

class getSetupLocalNodeIpsCommand extends commandBase {

execute(): JQueryPromise<Array<string>> {
execute(): JQueryPromise<string[]> {
const url = endpoints.global.setup.setupIps;

return this.query<Array<string>>(url, null, null, x => _.flatMap(x.NetworkInterfaces.map((i: any) => i.Addresses)))
return this.query<string[]>(url, null, null, x => x.NetworkInterfaces.flatMap((i: any) => i.Addresses))
.fail((response: JQueryXHR) => this.reportError("Failed to get the setup nodes ips", response.responseText, response.statusText));
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Raven.Studio/typescript/common/appUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class appUrl {
}

static forDebugAdvancedRecordTransactionCommands(databaseToHighlight: string = undefined): string {
const dbPart = _.isUndefined(databaseToHighlight) ? "" : "?highlight=" + encodeURIComponent(databaseToHighlight);
const dbPart = databaseToHighlight === undefined ? "" : "?highlight=" + encodeURIComponent(databaseToHighlight);
return "#admin/settings/debug/advanced/recordTransactionCommands" + dbPart;
}

Expand All @@ -154,7 +154,7 @@ class appUrl {
}

static forTrafficWatch(initialFilter: string = undefined): string {
const filter = _.isUndefined(initialFilter) ? "" : "?filter=" + encodeURIComponent(initialFilter);
const filter = initialFilter === undefined ? "" : "?filter=" + encodeURIComponent(initialFilter);
return "#admin/settings/trafficWatch" + filter;
}

Expand Down Expand Up @@ -514,7 +514,7 @@ class appUrl {

static forDatabaseQuery(db: database | string): string {
if (db) {
return appUrl.baseUrl + "/databases/" + (_.isString(db) ? db : db.name);
return appUrl.baseUrl + "/databases/" + (typeof db === "string" ? db : db.name);
}

return this.baseUrl;
Expand Down Expand Up @@ -666,7 +666,7 @@ class appUrl {
}

static forEssentialStatsRawData(db: database | string): string {
return window.location.protocol + "//" + window.location.host + "/databases/" + (_.isString(db) ? db : db.name) + "/stats/essential";
return window.location.protocol + "//" + window.location.host + "/databases/" + (typeof db === "string" ? db : db.name) + "/stats/essential";
}

static forIndexesRawData(db: database): string {
Expand Down Expand Up @@ -747,7 +747,7 @@ class appUrl {
return "";
}

return "&database=" + encodeURIComponent(_.isString(db) ? db : db.name);
return "&database=" + encodeURIComponent(typeof db === "string" ? db : db.name);
}

private static getEncodedIndexNamePart(indexName?: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ class aceEditorBindingHandler {

if ('rules' in code && ko.isObservable(code.rules)) {
const rules = ko.unwrap<KnockoutValidationRule[]>(code.rules);
if (_.some(rules, x => x.rule === "aceValidation")) {
if (rules.some(x => x.rule === "aceValidation")) {
const firstError = annotations.find(x => x.type === "error");

if (firstError) {
Expand Down
10 changes: 6 additions & 4 deletions src/Raven.Studio/typescript/common/changeVectorUtils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
/// <reference path="../../typings/tsd.d.ts" />

import { sortBy } from "common/typeUtils";

class changeVectorUtils {

static shouldUseLongFormat(changeVectors: string[]) {
const parsedVectors = _.flatMap(changeVectors, x => changeVectorUtils.parse(x));
const parsedVectors = changeVectors.flatMap(x => changeVectorUtils.parse(x));

const byTag = _.groupBy(parsedVectors, x => x.tag);
const byTag = _.groupBy(parsedVectors, (x: { tag: string}) => x.tag);

return _.some(byTag, forTag => forTag.map(x => x.dbId).length > 1);
return byTag.some((forTag: any) => forTag.map((x: typeof parsedVectors[0]) => x.dbId).length > 1);
}

private static parse(input: string) {
Expand All @@ -18,7 +20,7 @@ class changeVectorUtils {
let tokens = input.split(",")
.map(cvEntry => changeVectorUtils.parseChangeVectorEntry(cvEntry));

tokens = _.sortBy(tokens, x => x.tag);
tokens = sortBy(tokens, x => x.tag);

return tokens;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Raven.Studio/typescript/common/colorsManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class colorsManager {
const sourceKeys = Object.keys(source);
const targetKeys = Object.keys(target);

const onlyInTarget = _.without(targetKeys, ...sourceKeys);
const onlyInSource = _.without(sourceKeys, ...targetKeys);
const onlyInTarget = targetKeys.filter(x => !sourceKeys.includes(x));
const onlyInSource = sourceKeys.filter(x => !targetKeys.includes(x));

if (onlyInSource.length) {
console.warn("Found missing color definitions (in TS file): " + onlyInSource.join(", ") + ", at path: /" + path.join("/"));
Expand Down
2 changes: 1 addition & 1 deletion src/Raven.Studio/typescript/common/downloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class downloader {
Object.keys(object).forEach(key => {
const value = object[key];

if (_.isArray(value)) {
if (Array.isArray(value)) {
value.forEach(v => addField(key, v));
} else {
addField(key, value);
Expand Down
9 changes: 5 additions & 4 deletions src/Raven.Studio/typescript/common/generalUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pluralizeHelpers = require("common/helpers/text/pluralizeHelpers");
import moment = require("moment");
import { MouseEvent } from "react";
import { isBoolean } from "common/typeUtils";

type SelectionState = "AllSelected" | "SomeSelected" | "Empty";

Expand Down Expand Up @@ -493,9 +494,9 @@ class genUtils {

if (stripNullAndEmptyValues) {
return JSON.stringify(obj, (key, val) => {
const isNull = _.isNull(val);
const isEmptyObj = _.isEqual(val, {});
const isEmptyArray = _.isEqual(val, []);
const isNull = val === null;
const isEmptyObj = val instanceof Object && Object.keys(val).length === 0;
const isEmptyArray = Array.isArray(val) && val.length === 0;

return isNull || isEmptyObj || isEmptyArray ? undefined : val;

Expand Down Expand Up @@ -563,7 +564,7 @@ class genUtils {
internalCallback: (result: { isValid: boolean, message: string } | boolean) => void) => {
func(val, params, (currentValue, result) => {
if (currentValue === val) {
if (_.isBoolean(result)) {
if (isBoolean(result)) {
internalCallback(result);
} else if (result) {
internalCallback({ isValid: false, message: result});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ class collectionsTracker {
}

private collectionsLoaded(collectionsStats: collectionsStats) {
const collections = collectionsStats.collections;

_.remove(collections, c => !c.documentCount());
const collections = collectionsStats.collections.filter(x => !x.documentCount());

collections.sort((a, b) => this.sortAlphaNumericCollection(a.name, b.name));

const allDocsCollection = collection.createAllDocumentsCollection(collectionsStats.numberOfDocuments());
Expand All @@ -69,7 +68,7 @@ class collectionsTracker {
}

getCollectionColorIndex(collectionName: string) {
return (_.findIndex(collectionsTracker.default.collections(), x => x.name === collectionName) + 5) % 6;
return (collectionsTracker.default.collections().findIndex( x => x.name === collectionName) + 5) % 6;
// 6 is the number of classes that I have defined in etl.less for colors...
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class documentPropertyProvider {

private needsToFetchValue(doc: document, column: textColumn<document>): boolean {
const valueAccessor = column.valueAccessor;
if (_.isFunction(valueAccessor)) {
if (typeof valueAccessor === "function") {
if (column instanceof customColumn) {
return !column.tryGuessRequiredProperties().every(p => this.hasEntireValue(doc, p));
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference path="../../../../typings/tsd.d.ts" />

import colorsManager = require("common/colorsManager");
import { sortBy } from "common/typeUtils";

class graphHelper {

Expand Down Expand Up @@ -224,7 +225,7 @@ class graphHelper {

const mapping = new Map<number, number>();

_.sortBy(items.map((item, idx) => ({ idx: idx, value: item.x })), x => x.value).forEach((v, k) => {
sortBy(items.map((item, idx) => ({ idx: idx, value: item.x })), x => x.value).forEach((v, k) => {
mapping.set(k, v.idx);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class rangeAggregator {

// 1. Find appropriate start position for the new element

this.ptrStart = _.sortedIndexBy<workData>(this.workData, { pointInTime: startTime } as workData, x => x.pointInTime);
this.ptrStart = _.sortedIndexBy<workData>(this.workData, { pointInTime: startTime } as workData, (x: workData) => x.pointInTime);

let previousValue = (this.ptrStart === 0) ? this.workData[0].numberOfItems : this.workData[this.ptrStart - 1].numberOfItems;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class viewHelpers {
const deferred = $.Deferred<void>();

const validationGroup = (context as any)();
const keys = _.keys(validationGroup);
const keys = Object.keys(validationGroup);

const asyncValidations: Array<KnockoutObservable<boolean>> = [];

Expand All @@ -69,7 +69,7 @@ class viewHelpers {
}
});

if (asyncValidations.length === 0 || _.every(asyncValidations, x => !x())) {
if (asyncValidations.length === 0 || asyncValidations.every(x => !x())) {
cb();
deferred.resolve();
return deferred.promise();
Expand All @@ -80,7 +80,7 @@ class viewHelpers {
let subscriptions: KnockoutSubscription[] = [];

const onUpdate = () => {
if (_.every(asyncValidations, x => !x())) {
if (asyncValidations.every(x => !x())) {
// all validators completed its work, clean up and call callback
subscriptions.forEach(x => x.dispose());
cb();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import database = require("models/resources/database");
import pluralizeHelpers = require("common/helpers/text/pluralizeHelpers");
import moment = require("moment");
import groupedVirtualNotification from "common/notifications/models/groupedVirtualNotification";
import { sumBy } from "common/typeUtils";

class virtualBulkInsert extends groupedVirtualNotification<virtualBulkOperationItem> {

Expand Down Expand Up @@ -51,7 +52,7 @@ class virtualBulkInsert extends groupedVirtualNotification<virtualBulkOperationI
this.operations.unshift(item);
}

const totalItemsCount = _.sumBy(this.operations(), x => x.totalItemsProcessed);
const totalItemsCount = sumBy(this.operations(), x => x.totalItemsProcessed);
this.message(pluralizeHelpers.pluralize(this.operations().length, "bulk insert", "bulk inserts")
+ " to database " + this.database.name
+ " completed successfully. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ import complexFieldsAlertDetails
import cpuCreditsBalanceDetails
from "viewmodels/common/notificationCenter/detailViewer/alerts/cpuCreditsBalanceDetails";
import groupedVirtualNotification from "common/notifications/models/groupedVirtualNotification";
import { sortBy } from "common/typeUtils";
interface detailsProvider {
supportsDetailsFor(notification: abstractNotification): boolean;
showDetailsFor(notification: abstractNotification, notificationCenter: notificationCenter): JQueryPromise<void> | void;
Expand Down Expand Up @@ -212,7 +213,7 @@ class notificationCenter {

const mergedNotifications = globalNotifications.concat(databaseNotifications);

return _.sortBy(mergedNotifications, x => -1 * x.displayDate().unix());
return sortBy(mergedNotifications, x => -1 * x.displayDate().unix());
});

this.visibleNotifications = ko.pureComputed(() => {
Expand Down
Loading

0 comments on commit 894a300

Please sign in to comment.