mirror of
https://github.com/garraflavatra/rolens.git
synced 2025-07-19 14:14:05 +00:00
Squashed commit of the following: commit93b2d67cef
Author: Romein van Buren <romein@vburen.nl> Date: Sat Jul 1 20:07:33 2023 +0200 Add filter functionality commit30b65a198f
Author: Romein van Buren <romein@vburen.nl> Date: Sat Jul 1 19:27:20 2023 +0200 Renamed `form-row` class to `formrow` commit21afb01ea1
Author: Romein van Buren <romein@vburen.nl> Date: Sat Jul 1 19:26:04 2023 +0200 Hide object types in object grid commit037d5432a4
Author: Romein van Buren <romein@vburen.nl> Date: Sat Jul 1 19:21:54 2023 +0200 Make auto reload interval input smaller commit49d5022027
Author: Romein van Buren <romein@vburen.nl> Date: Sat Jul 1 15:08:00 2023 +0200 Implement logs autoreload commit1f8984766b
Author: Romein van Buren <romein@vburen.nl> Date: Sat Jul 1 15:04:00 2023 +0200 Return on error commit9c85259964
Author: Romein van Buren <romein@vburen.nl> Date: Sat Jul 1 15:03:37 2023 +0200 Add log error handling commit7a98a63866
Author: Romein van Buren <romein@vburen.nl> Date: Sat Jul 1 14:46:39 2023 +0200 Update log tab icon commitf30827ae2e
Author: Romein van Buren <romein@vburen.nl> Date: Sat Jul 1 14:41:59 2023 +0200 Add host log panel
47 lines
1.5 KiB
JavaScript
47 lines
1.5 KiB
JavaScript
import { ObjectId } from 'bson';
|
|
import aggregationStages from './aggregation-stages.json';
|
|
import atomicUpdateOperators from './atomic-update-operators.json';
|
|
import locales from './locales.json';
|
|
import logComponents from './log-components.json';
|
|
import logLevels from './loglevels.json';
|
|
|
|
export { aggregationStages, atomicUpdateOperators, locales, logComponents, logLevels };
|
|
|
|
// Calculate the min and max values of (un)signed integers with n bits
|
|
export const intMin = bits => Math.pow(2, bits - 1) * -1;
|
|
export const intMax = bits => Math.pow(2, bits - 1) - 1;
|
|
export const uintMax = bits => Math.pow(2, bits) - 1;
|
|
|
|
// Boundaries for some ubiquitous integer types
|
|
export const int32 = [ intMin(32), intMax(32) ];
|
|
export const int64 = [ intMin(64), intMax(64) ];
|
|
export const uint64 = [ 0, uintMax(64) ];
|
|
|
|
// Input types
|
|
export const numericInputTypes = [ 'int', 'long', 'uint64', 'double', 'decimal' ];
|
|
export const inputTypes = [ 'string', 'objectid', 'bool', 'date', ...numericInputTypes ];
|
|
|
|
export function isBsonBuiltin(value) {
|
|
return (
|
|
(typeof value === 'object') &&
|
|
(value !== null) &&
|
|
(typeof value._bsontype === 'string') &&
|
|
(typeof value.inspect === 'function')
|
|
);
|
|
}
|
|
|
|
export function canBeObjectId(value) {
|
|
try {
|
|
new ObjectId(value);
|
|
return true;
|
|
}
|
|
catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
export function aggregationStageDocumentationURL(stageName) {
|
|
const url = `https://www.mongodb.com/docs/manual/reference/operator/aggregation/${stageName.replace('$', '')}/`;
|
|
return url;
|
|
}
|