mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
Merge branch 'hotfix-release'
This commit is contained in:
@@ -11,7 +11,7 @@ const handleSelect = require('../utils/select');
|
||||
const handlePopulate = require('../utils/populate');
|
||||
|
||||
module.exports = {
|
||||
create: async function({ projectId }, data, recurring) {
|
||||
create: async function ({ projectId }, data, recurring) {
|
||||
try {
|
||||
if (!data.monitors || data.monitors.length === 0) {
|
||||
const error = new Error(
|
||||
@@ -33,16 +33,6 @@ module.exports = {
|
||||
monitorId: monitor,
|
||||
}));
|
||||
|
||||
if (
|
||||
!data.monitorDuringEvent &&
|
||||
data.monitors &&
|
||||
data.monitors.length > 0
|
||||
) {
|
||||
await MonitorService.markMonitorsAsShouldNotMonitor(
|
||||
data.monitors.map(i => i.monitorId)
|
||||
);
|
||||
}
|
||||
|
||||
data.projectId = projectId;
|
||||
if (data && data.name) {
|
||||
data.slug = getSlug(data.name);
|
||||
@@ -86,6 +76,27 @@ module.exports = {
|
||||
const currentTime = moment();
|
||||
const startTime = moment(scheduledEvent.startDate);
|
||||
if (startTime <= currentTime) {
|
||||
//set monitoring state of the monitor
|
||||
if (!data.monitorDuringEvent) {
|
||||
if (
|
||||
data.monitors &&
|
||||
data.monitors.length > 0
|
||||
) {
|
||||
await MonitorService.markMonitorsAsShouldNotMonitor(
|
||||
data.monitors.map(i => i.monitorId)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
data.monitors &&
|
||||
data.monitors.length > 0
|
||||
) {
|
||||
await MonitorService.markMonitorsAsShouldMonitor(
|
||||
data.monitors.map(i => i.monitorId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await ScheduledEventNoteService.create({
|
||||
content: 'This scheduled event has started',
|
||||
scheduledEventId: scheduledEvent._id,
|
||||
@@ -97,6 +108,21 @@ module.exports = {
|
||||
//Create event end note immediately if end time equal to create time
|
||||
const endTime = moment(scheduledEvent.endDate);
|
||||
if (endTime <= currentTime) {
|
||||
// revert monitor to monitoring state
|
||||
if (!data.monitorDuringEvent) {
|
||||
for (const monitor of data.monitors) {
|
||||
// handle this in the background
|
||||
MonitorService.updateOneBy(
|
||||
{
|
||||
_id: monitor.monitorId,
|
||||
},
|
||||
{
|
||||
shouldNotMonitor: false,
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
await ScheduledEventNoteService.create({
|
||||
content: 'This scheduled event has ended',
|
||||
scheduledEventId: scheduledEvent._id,
|
||||
@@ -122,7 +148,7 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
updateOneBy: async function(query, data) {
|
||||
updateOneBy: async function (query, data) {
|
||||
if (!query) {
|
||||
query = {};
|
||||
}
|
||||
@@ -212,7 +238,7 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
updateBy: async function(query, data) {
|
||||
updateBy: async function (query, data) {
|
||||
try {
|
||||
if (!query) {
|
||||
query = {};
|
||||
@@ -248,7 +274,7 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
deleteBy: async function(query, userId) {
|
||||
deleteBy: async function (query, userId) {
|
||||
try {
|
||||
const scheduledEvent = await ScheduledEventModel.findOneAndUpdate(
|
||||
query,
|
||||
@@ -288,7 +314,7 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
findBy: async function({ query, limit, skip, populate, select }) {
|
||||
findBy: async function ({ query, limit, skip, populate, select }) {
|
||||
try {
|
||||
if (!skip) skip = 0;
|
||||
|
||||
@@ -325,7 +351,7 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
findOneBy: async function({ query, select, populate }) {
|
||||
findOneBy: async function ({ query, select, populate }) {
|
||||
try {
|
||||
if (!query) {
|
||||
query = {};
|
||||
@@ -364,7 +390,7 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
getSubProjectScheduledEvents: async function(subProjectIds) {
|
||||
getSubProjectScheduledEvents: async function (subProjectIds) {
|
||||
const populate = [
|
||||
{ path: 'resolvedBy', select: 'name' },
|
||||
{ path: 'projectId', select: 'name slug' },
|
||||
@@ -400,7 +426,7 @@ module.exports = {
|
||||
return subProjectScheduledEvents;
|
||||
},
|
||||
|
||||
getSubProjectOngoingScheduledEvents: async function(subProjectIds, query) {
|
||||
getSubProjectOngoingScheduledEvents: async function (subProjectIds, query) {
|
||||
const populate = [
|
||||
{ path: 'resolvedBy', select: 'name' },
|
||||
{ path: 'projectId', select: 'name slug' },
|
||||
@@ -436,7 +462,7 @@ module.exports = {
|
||||
return subProjectOngoingScheduledEvents;
|
||||
},
|
||||
|
||||
countBy: async function(query) {
|
||||
countBy: async function (query) {
|
||||
try {
|
||||
if (!query) {
|
||||
query = {};
|
||||
@@ -450,7 +476,7 @@ module.exports = {
|
||||
}
|
||||
},
|
||||
|
||||
hardDeleteBy: async function(query) {
|
||||
hardDeleteBy: async function (query) {
|
||||
try {
|
||||
await ScheduledEventModel.deleteMany(query);
|
||||
return 'Event(s) removed successfully!';
|
||||
@@ -466,7 +492,7 @@ module.exports = {
|
||||
* @param {string} monitorId the id of the monitor
|
||||
* @param {string} userId the id of the user
|
||||
*/
|
||||
removeMonitor: async function(monitorId, userId) {
|
||||
removeMonitor: async function (monitorId, userId) {
|
||||
try {
|
||||
const populate = [
|
||||
{ path: 'resolvedBy', select: 'name' },
|
||||
@@ -548,7 +574,7 @@ module.exports = {
|
||||
* @param {object} query query parameter to use for db manipulation
|
||||
* @param {object} data data to be used to update the schedule
|
||||
*/
|
||||
resolveScheduledEvent: async function(query, data) {
|
||||
resolveScheduledEvent: async function (query, data) {
|
||||
try {
|
||||
const _this = this;
|
||||
data.resolved = true;
|
||||
@@ -664,7 +690,7 @@ module.exports = {
|
||||
/**
|
||||
* @description Create Started note for all schedule events
|
||||
*/
|
||||
createScheduledEventStartedNote: async function() {
|
||||
createScheduledEventStartedNote: async function () {
|
||||
try {
|
||||
const currentTime = moment();
|
||||
|
||||
@@ -684,6 +710,22 @@ module.exports = {
|
||||
scheduledEventList.map(async scheduledEvent => {
|
||||
const scheduledEventId = scheduledEvent._id;
|
||||
|
||||
// set monitoring status of the monitor
|
||||
if (!scheduledEvent.monitorDuringEvent) {
|
||||
if(scheduledEvent.monitors && scheduledEvent.monitors.length > 0){
|
||||
await MonitorService.markMonitorsAsShouldNotMonitor(
|
||||
scheduledEvent.monitors.map(i => i.monitorId._id || i.monitorId,)
|
||||
);
|
||||
}
|
||||
|
||||
} else {
|
||||
if(scheduledEvent.monitors && scheduledEvent.monitors.length > 0){
|
||||
await MonitorService.markMonitorsAsShouldMonitor(
|
||||
scheduledEvent.monitors.map(i => i.monitorId._id || i.monitorId,)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const scheduledEventNoteCount = await ScheduledEventNoteService.countBy(
|
||||
{
|
||||
scheduledEventId,
|
||||
@@ -710,7 +752,7 @@ module.exports = {
|
||||
|
||||
/**
|
||||
* @description Create Ended note for all schedule events
|
||||
*/ createScheduledEventEndedNote: async function() {
|
||||
*/ createScheduledEventEndedNote: async function () {
|
||||
try {
|
||||
const currentTime = moment();
|
||||
|
||||
@@ -728,6 +770,15 @@ module.exports = {
|
||||
scheduledEventList.map(async scheduledEvent => {
|
||||
const scheduledEventId = scheduledEvent._id;
|
||||
|
||||
// revert monitor back to monitoring state
|
||||
if (scheduledEvent && !scheduledEvent.monitorDuringEvent) {
|
||||
if(scheduledEvent.monitors && scheduledEvent.monitors.length > 0){
|
||||
await MonitorService.markMonitorsAsShouldMonitor(
|
||||
scheduledEvent.monitors.map(i => i.monitorId._id || i.monitorId,)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const scheduledEventNoteListCount = await ScheduledEventNoteService.countBy(
|
||||
{
|
||||
scheduledEventId,
|
||||
|
||||
@@ -29,6 +29,8 @@ spec:
|
||||
value: 'production'
|
||||
- name: BACKEND_URL
|
||||
value: {{ template "fyipe.backendHost" . }}
|
||||
- name: MONGO_URL
|
||||
value: {{ template "fyipe.mongodbConnectionString" . }}
|
||||
{{- if .Values.saas.isSaasService }}
|
||||
- name: IS_SAAS_SERVICE
|
||||
value: 'true'
|
||||
|
||||
18
init-script/scripts/3.0.6666.js
Normal file
18
init-script/scripts/3.0.6666.js
Normal file
@@ -0,0 +1,18 @@
|
||||
const { updateMany } = require('../util/db');
|
||||
|
||||
const monitorCollection = 'monitors';
|
||||
|
||||
// we need to run this once
|
||||
// at the moment this should fix issue with the incident creation on the monitor
|
||||
// no scheduled event is currently active or to be run in the future
|
||||
async function run() {
|
||||
await updateMany(
|
||||
monitorCollection,
|
||||
{ deleted: false },
|
||||
{ shouldNotMonitor: false }
|
||||
);
|
||||
|
||||
return `Script completed`;
|
||||
}
|
||||
|
||||
module.exports = run;
|
||||
@@ -1,5 +1,6 @@
|
||||
SKIP_PREFLIGHT_CHECK=true
|
||||
PUBLIC_URL=/status-page
|
||||
MONGO_URL=mongodb://localhost:27017/fyipedb
|
||||
REACT_APP_BACKEND_PROTOCOL=http
|
||||
STATUSPAGE_CERT=LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUZBakNDQStxZ0F3SUJBZ0lKQU1pUWhGTDUydDBUTUEwR0NTcUdTSWIzRFFFQkN3VUFNSUdYTVFzd0NRWUQKVlFRR0V3SlZVekVQTUEwR0ExVUVDQXdHUW05emRHOXVNUll3RkFZRFZRUUhEQTFOWVhOellXTm9kWE5sZEhSegpNUll3RkFZRFZRUUtEQTFJWVdOclpYSmlZWGtnU1c1ak1SRXdEd1lEVlFRTERBaFRiMlowZDJGeVpURVNNQkFHCkExVUVBd3dKWm5scGNHVXVZMjl0TVNBd0hnWUpLb1pJaHZjTkFRa0JGaEZxZFdSbFFHaGhZMnRsY21KaGVTNXAKYnpBZUZ3MHlNVEF6TVRBeU1qQXdNRGhhRncweU16QTJNVE15TWpBd01EaGFNSUdYTVFzd0NRWURWUVFHRXdKVgpVekVQTUEwR0ExVUVDQXdHUW05emRHOXVNUll3RkFZRFZRUUhEQTFOWVhOellXTm9kWE5sZEhSek1SWXdGQVlEClZRUUtEQ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PV0plcFVSRXhsdUtjUWVyZzMxUVZYOEMwWEJmZ2VxUUNhTlpxdmNQYwo2MjR4d0dWUVdCODF4ZW1Kc2pENjNIemdPbzVRZkltYllvdzdCbEJzMFM0eWg3d1QzK3NnSVVMUnZhSG5mMGZoCm5zV2YvQjlKRXJFTjRSTXZ4OTMrZ0xiN1g3TWpIZ1U3ZGNQT2xKTUNnWUE2eE1WbzQ1TVRxcFlnS2pWTjNPTW8KczBLYjB4VkIySU1kYkkzc3JMNmhCekNVOUhQajBMUVVwV2QvRFlNZERHSWFOZ1Azbmo2Nk9pS0xXUmE1RDlOWQpweFBlR0drT0tEK2xqUXFjVzdMdEgxcmlPOTEvV2pFNldoUXhNQ29rL0pReFdDZUVLQWVEUVhmVHdId1lleWpNCjl4Y1FDL2NKTnMxbHZ5VWlzbDREU3dLQmdRQ0V5eXdMOFd4eFpmL0huVXhiUFBCdkVObGt5MXJod1ZjVS8zMGgKeGQ0TE9yOHVyQTJvQ2VGcVJmc05HYUtiSllVT056SU1ZcThhS2VyQk5JVG9US0hKTnhlWi9OakJHajNzOVNvdgpIQmlOaVpiV0dqVXI2ZVhaM21ZYTRaUGtQZmxZV2x6UjVJLytwR0RDNFhDSVhaa2F6eEl5KzA5eUlMOS9MZVU3CmZPTG14d0tCZ1FEWmFpTmdlTzk0cG9vZ092UkI1RkVKblFmcGwvMGdvbDNSYXUvQU0yTW93NTdmUjlNb1I0cFUKVFFDV0NwRy8vZHlZYXBTU201MnBNYTlEWEE1a2ZEOW1MclVHWk96S0drUW9Ka2h3dnJYbi9qY0NKY0JBYnBHagpJT01sK3QxMHdBL2xOZ3UwbEhJMHVKTFBOaHFEQ1ZHU21kVTVVWDUrdjFEenk1UklzbFFwSmc9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=
|
||||
@@ -10,8 +10,32 @@ const fetch = require('node-fetch');
|
||||
const { spawn } = require('child_process');
|
||||
const axios = require('axios');
|
||||
|
||||
// mongodb
|
||||
const MongoClient = require('mongodb').MongoClient;
|
||||
const mongoUrl =
|
||||
process.env['MONGO_URL'] || 'mongodb://localhost:27017/fyipedb';
|
||||
|
||||
const { NODE_ENV } = process.env;
|
||||
|
||||
function getMongoClient() {
|
||||
return new MongoClient(mongoUrl, {
|
||||
useNewUrlParser: true,
|
||||
useUnifiedTopology: true,
|
||||
});
|
||||
}
|
||||
|
||||
// setup mongodb connection
|
||||
const client = getMongoClient();
|
||||
(async function() {
|
||||
try {
|
||||
console.log('connecting to db');
|
||||
await client.connect();
|
||||
console.log('connected to db');
|
||||
} catch (error) {
|
||||
console.log('connection error: ', error);
|
||||
}
|
||||
})();
|
||||
|
||||
if (!NODE_ENV || NODE_ENV === 'development') {
|
||||
// Load env vars from /statuspage/.env
|
||||
require('dotenv').config();
|
||||
@@ -82,6 +106,33 @@ app.use('/.well-known/acme-challenge/:token', async function(req, res) {
|
||||
res.send(response.data);
|
||||
});
|
||||
|
||||
// fetch details about a domain from the db
|
||||
async function handleCustomDomain(client, collection, domain) {
|
||||
const statusPage = await client
|
||||
.db('fyipedb')
|
||||
.collection(collection)
|
||||
.findOne({
|
||||
domains: { $elemMatch: { domain } },
|
||||
});
|
||||
|
||||
let domainObj = {};
|
||||
statusPage &&
|
||||
statusPage.domains &&
|
||||
statusPage.domains.forEach(eachDomain => {
|
||||
if (eachDomain.domain === domain) {
|
||||
domainObj = eachDomain;
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
cert: domainObj.cert,
|
||||
privateKey: domainObj.privateKey,
|
||||
autoProvisioning: domainObj.autoProvisioning,
|
||||
enableHttps: domainObj.enableHttps,
|
||||
domain: domainObj.domain,
|
||||
};
|
||||
}
|
||||
|
||||
app.use('/', async function(req, res, next) {
|
||||
const host = req.hostname;
|
||||
if (
|
||||
@@ -94,20 +145,22 @@ app.use('/', async function(req, res, next) {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${apiHost}/statusPage/tlsCredential?domain=${host}`
|
||||
).then(res => res.json());
|
||||
const response = await handleCustomDomain(client, 'statuspages', host);
|
||||
|
||||
const { enableHttps } = response;
|
||||
if (enableHttps) {
|
||||
if (!req.secure) {
|
||||
res.writeHead(301, { Location: `https://${host}${req.url}` });
|
||||
res.writeHead(301, {
|
||||
Location: `https://${host}${req.url}`,
|
||||
});
|
||||
return res.end();
|
||||
}
|
||||
return next();
|
||||
} else {
|
||||
if (req.secure) {
|
||||
res.writeHead(301, { Location: `http://${host}${req.url}` });
|
||||
res.writeHead(301, {
|
||||
Location: `http://${host}${req.url}`,
|
||||
});
|
||||
return res.end();
|
||||
}
|
||||
return next();
|
||||
@@ -228,9 +281,11 @@ function createDir(dirPath) {
|
||||
path.resolve(process.cwd(), 'src', 'credentials', 'private.key')
|
||||
),
|
||||
SNICallback: async function(domain, cb) {
|
||||
const res = await fetch(
|
||||
`${apiHost}/statusPage/tlsCredential?domain=${domain}`
|
||||
).then(res => res.json());
|
||||
const res = await handleCustomDomain(
|
||||
client,
|
||||
'statuspages',
|
||||
domain
|
||||
);
|
||||
|
||||
let certPath, privateKeyPath;
|
||||
if (res) {
|
||||
|
||||
127
status-page/package-lock.json
generated
127
status-page/package-lock.json
generated
@@ -18,6 +18,7 @@
|
||||
"markdown-to-jsx": "^7.1.3",
|
||||
"mocha": "^9.0.1",
|
||||
"moment": "^2.29.1",
|
||||
"mongodb": "^4.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"puppeteer": "^5.5.0",
|
||||
@@ -5457,6 +5458,17 @@
|
||||
"node-int64": "^0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/bson": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-4.4.1.tgz",
|
||||
"integrity": "sha512-Uu4OCZa0jouQJCKOk1EmmyqtdWAP5HVLru4lQxTwzJzxT+sJ13lVpEZU/MATDxtHiekWMAL84oQY3Xn1LpJVSg==",
|
||||
"dependencies": {
|
||||
"buffer": "^5.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
}
|
||||
},
|
||||
"node_modules/buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
@@ -7785,6 +7797,14 @@
|
||||
"node": ">=0.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/denque": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz",
|
||||
"integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ==",
|
||||
"engines": {
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/depcheck": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/depcheck/-/depcheck-1.4.1.tgz",
|
||||
@@ -15031,6 +15051,12 @@
|
||||
"readable-stream": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/memory-pager": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
||||
"optional": true
|
||||
},
|
||||
"node_modules/merge-descriptors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||
@@ -15426,6 +15452,30 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/mongodb": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.0.0.tgz",
|
||||
"integrity": "sha512-ZsqdUyeSeuP2rfWvHpihvQ3MRDXuzsKHmhr1/vtM37JWj6M4yZvIXYFp8OJ85dYI6FvB9KQ1x0Cy6DQinrjUwA==",
|
||||
"dependencies": {
|
||||
"bson": "^4.4.0",
|
||||
"denque": "^1.5.0",
|
||||
"mongodb-connection-string-url": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.9.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"saslprep": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mongodb-connection-string-url": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-1.0.1.tgz",
|
||||
"integrity": "sha512-sXi8w9nwbMrErWbOK+8nofHz531rboasDbYAMS+sQ+W+2YnHN980RlMr+t5SDL6uKEU/kw/wG6jcjCTLiJltoA==",
|
||||
"dependencies": {
|
||||
"whatwg-url": "^8.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/move-concurrently": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
|
||||
@@ -22144,6 +22194,18 @@
|
||||
"resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-10.0.0.tgz",
|
||||
"integrity": "sha512-vTxrZz4dX5W86M6oVWVdOVe72ZiPs41Oi7Z6Km4W5Turyz28mrXSJhhEBZoRtzJWIv3833WKVwLSDWWkEfupMg=="
|
||||
},
|
||||
"node_modules/saslprep": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
|
||||
"integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"sparse-bitfield": "^3.0.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/sass": {
|
||||
"version": "1.35.1",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.35.1.tgz",
|
||||
@@ -23082,6 +23144,15 @@
|
||||
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
|
||||
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA=="
|
||||
},
|
||||
"node_modules/sparse-bitfield": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
||||
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
|
||||
"optional": true,
|
||||
"dependencies": {
|
||||
"memory-pager": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/spdx-correct": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
|
||||
@@ -31042,6 +31113,14 @@
|
||||
"node-int64": "^0.4.0"
|
||||
}
|
||||
},
|
||||
"bson": {
|
||||
"version": "4.4.1",
|
||||
"resolved": "https://registry.npmjs.org/bson/-/bson-4.4.1.tgz",
|
||||
"integrity": "sha512-Uu4OCZa0jouQJCKOk1EmmyqtdWAP5HVLru4lQxTwzJzxT+sJ13lVpEZU/MATDxtHiekWMAL84oQY3Xn1LpJVSg==",
|
||||
"requires": {
|
||||
"buffer": "^5.6.0"
|
||||
}
|
||||
},
|
||||
"buffer": {
|
||||
"version": "5.7.1",
|
||||
"resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz",
|
||||
@@ -32840,6 +32919,11 @@
|
||||
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
|
||||
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
|
||||
},
|
||||
"denque": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/denque/-/denque-1.5.0.tgz",
|
||||
"integrity": "sha512-CYiCSgIF1p6EUByQPlGkKnP1M9g0ZV3qMIrqMqZqdwazygIA/YP2vrbcyl1h/WppKJTdl1F85cXIle+394iDAQ=="
|
||||
},
|
||||
"depcheck": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/depcheck/-/depcheck-1.4.1.tgz",
|
||||
@@ -38263,6 +38347,12 @@
|
||||
"readable-stream": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"memory-pager": {
|
||||
"version": "1.5.0",
|
||||
"resolved": "https://registry.npmjs.org/memory-pager/-/memory-pager-1.5.0.tgz",
|
||||
"integrity": "sha512-ZS4Bp4r/Zoeq6+NLJpP+0Zzm0pR8whtGPf1XExKLJBAczGMnSi3It14OiNCStjQjM6NU1okjQGSxgEZN8eBYKg==",
|
||||
"optional": true
|
||||
},
|
||||
"merge-descriptors": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
|
||||
@@ -38568,6 +38658,25 @@
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.29.1.tgz",
|
||||
"integrity": "sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ=="
|
||||
},
|
||||
"mongodb": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-4.0.0.tgz",
|
||||
"integrity": "sha512-ZsqdUyeSeuP2rfWvHpihvQ3MRDXuzsKHmhr1/vtM37JWj6M4yZvIXYFp8OJ85dYI6FvB9KQ1x0Cy6DQinrjUwA==",
|
||||
"requires": {
|
||||
"bson": "^4.4.0",
|
||||
"denque": "^1.5.0",
|
||||
"mongodb-connection-string-url": "^1.0.0",
|
||||
"saslprep": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"mongodb-connection-string-url": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/mongodb-connection-string-url/-/mongodb-connection-string-url-1.0.1.tgz",
|
||||
"integrity": "sha512-sXi8w9nwbMrErWbOK+8nofHz531rboasDbYAMS+sQ+W+2YnHN980RlMr+t5SDL6uKEU/kw/wG6jcjCTLiJltoA==",
|
||||
"requires": {
|
||||
"whatwg-url": "^8.4.0"
|
||||
}
|
||||
},
|
||||
"move-concurrently": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
|
||||
@@ -43656,6 +43765,15 @@
|
||||
"resolved": "https://registry.npmjs.org/sanitize.css/-/sanitize.css-10.0.0.tgz",
|
||||
"integrity": "sha512-vTxrZz4dX5W86M6oVWVdOVe72ZiPs41Oi7Z6Km4W5Turyz28mrXSJhhEBZoRtzJWIv3833WKVwLSDWWkEfupMg=="
|
||||
},
|
||||
"saslprep": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/saslprep/-/saslprep-1.0.3.tgz",
|
||||
"integrity": "sha512-/MY/PEMbk2SuY5sScONwhUDsV2p77Znkb/q3nSVstq/yQzYJOH/Azh29p9oJLsl3LnQwSvZDKagDGBsBwSooag==",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"sparse-bitfield": "^3.0.3"
|
||||
}
|
||||
},
|
||||
"sass": {
|
||||
"version": "1.35.1",
|
||||
"resolved": "https://registry.npmjs.org/sass/-/sass-1.35.1.tgz",
|
||||
@@ -44419,6 +44537,15 @@
|
||||
"resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
|
||||
"integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA=="
|
||||
},
|
||||
"sparse-bitfield": {
|
||||
"version": "3.0.3",
|
||||
"resolved": "https://registry.npmjs.org/sparse-bitfield/-/sparse-bitfield-3.0.3.tgz",
|
||||
"integrity": "sha1-/0rm5oZWBWuks+eSqzM004JzyhE=",
|
||||
"optional": true,
|
||||
"requires": {
|
||||
"memory-pager": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"spdx-correct": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.1.1.tgz",
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"markdown-to-jsx": "^7.1.3",
|
||||
"mocha": "^9.0.1",
|
||||
"moment": "^2.29.1",
|
||||
"mongodb": "^4.0.0",
|
||||
"node-fetch": "^2.6.1",
|
||||
"prop-types": "^15.6.2",
|
||||
"puppeteer": "^5.5.0",
|
||||
|
||||
Reference in New Issue
Block a user