@syngrisi/syngrisi
Version:
Syngrisi - Visual Testing Tool
1,928 lines (1,899 loc) • 48 kB
JavaScript
"use strict";
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/server/lib/startup/createTestsUsers.ts
var createTestsUsers_exports = {};
__export(createTestsUsers_exports, {
createTestsUsers: () => createTestsUsers
});
module.exports = __toCommonJS(createTestsUsers_exports);
// src/server/models/Check.model.ts
var import_mongoose = __toESM(require("mongoose"));
// src/server/models/plugins/paginate.plugin.ts
var paginate = (schema) => {
schema.statics.paginate = async function(filter, options) {
let sort;
if (options.sortBy) {
const sortingCriteria = [];
options.sortBy.split(",").forEach((sortOption) => {
const [key, order] = sortOption.split(":");
sortingCriteria.push((order === "desc" ? "-" : "") + key);
});
sort = sortingCriteria.join(" ");
} else {
sort = { _id: -1 };
}
const limit = options.limit && parseInt(options.limit.toString(), 10) >= 0 ? parseInt(options.limit.toString(), 10) : 10;
const page = options.page && parseInt(options.page.toString(), 10) > 0 ? parseInt(options.page.toString(), 10) : 1;
const skip = (page - 1) * limit;
const countPromise = this.countDocuments(filter).exec();
let docsPromise = this.find(filter).sort(sort).skip(skip).limit(limit);
if (options.populate) {
options.populate.split(",").forEach((populateOption) => {
docsPromise = docsPromise.populate(
populateOption.split(".").reverse().reduce((a, b) => ({ path: b, populate: a }))
);
});
}
docsPromise = docsPromise.exec();
return Promise.all([countPromise, docsPromise]).then((values) => {
const [totalResults, results] = values;
const totalPages = Math.ceil(totalResults / limit);
const result = {
results,
page,
limit,
totalPages,
totalResults,
timestamp: Number(Date.now() + String(process.hrtime()[1]).slice(3, 6))
};
return Promise.resolve(result);
});
};
};
var paginate_plugin_default = paginate;
// src/server/models/plugins/toJSON.plugin.ts
var deleteAtPath = (obj, path3, index) => {
if (index === path3.length - 1) {
delete obj[path3[index]];
return;
}
deleteAtPath(obj[path3[index]], path3, index + 1);
};
var toJSON = (schema) => {
let transform;
if (schema.options.toJSON && schema.options.toJSON.transform) {
transform = schema.options.toJSON.transform;
}
schema.options.toJSON = Object.assign(schema.options.toJSON || {}, {
transform(doc, ret, options) {
Object.keys(schema.paths).forEach((path3) => {
if (schema.paths[path3].options && schema.paths[path3].options.private) {
deleteAtPath(ret, path3.split("."), 0);
}
});
ret.id = ret._id.toString();
delete ret.__v;
delete ret.createdAt;
delete ret.updatedAt;
if (transform) {
return transform(doc, ret, options);
}
}
});
};
var toJSON_plugin_default = toJSON;
// src/server/models/plugins/paginateDistinct.plugin.ts
var import_bson = require("bson");
var paginateDistinct = (schema) => {
schema.statics.paginateDistinct = async function(filter, options) {
let sort;
if (options.sortBy) {
options.sortBy.split(",").forEach((sortOption) => {
const [key, order] = sortOption.split(":");
sort[key] = order === "desc" ? -1 : 1;
});
} else {
sort = { _id: -1 };
}
let limit = options.limit && parseInt(options.limit.toString(), 10) >= 0 ? parseInt(options.limit.toString(), 10) : 10;
limit = limit === 0 ? 9007199254740991 : limit;
const page = options.page && parseInt(options.page.toString(), 10) > 0 ? parseInt(options.page.toString(), 10) : 1;
const skip = (page - 1) * limit;
const groupAggregateObj = { $group: { _id: `$${options.field}` } };
const documentsCount = (await this.aggregate([groupAggregateObj]).exec()).length;
const aggregateArr = [
{ $match: import_bson.EJSON.parse(filter.filter || "{}") },
groupAggregateObj,
{ $sort: sort },
{ $skip: skip },
{ $limit: limit }
];
const aggregatedDocs = (await this.aggregate(aggregateArr)).filter((x) => x._id).map((x) => {
if (x[options.field]) {
return x[options.field][0];
}
return { name: x._id };
});
return Promise.all([documentsCount, aggregatedDocs]).then((values) => {
const [totalResults, results] = values;
const totalPages = Math.ceil(totalResults / limit);
const result = {
results,
page,
limit,
totalPages,
totalResults,
timestamp: (/* @__PURE__ */ new Date()).getTime()
};
return Promise.resolve(result);
});
};
};
var paginateDistinct_plugin_default = paginateDistinct;
// src/server/models/Check.model.ts
var CheckSchema = new import_mongoose.Schema({
name: {
type: String,
required: [true, 'CheckSchema: The "name" field must be required']
},
test: {
type: import_mongoose.Schema.Types.ObjectId,
ref: "VRSTest",
required: [true, 'CheckSchema: The "test" field must be required']
},
suite: {
type: import_mongoose.Schema.Types.ObjectId,
ref: "VRSSuite",
required: [true, 'CheckSchema: The "suite" field must be required']
},
app: {
type: import_mongoose.Schema.Types.ObjectId,
ref: "VRSApp",
required: [true, 'CheckSchema: The "app" field must be required']
},
branch: {
type: String
},
realBaselineId: {
type: import_mongoose.Schema.Types.ObjectId,
ref: "VRSBaseline"
},
baselineId: {
type: import_mongoose.Schema.Types.ObjectId,
ref: "VRSSnapshot"
},
actualSnapshotId: {
type: import_mongoose.Schema.Types.ObjectId,
ref: "VRSSnapshot"
},
diffId: {
type: import_mongoose.Schema.Types.ObjectId,
ref: "VRSSnapshot"
},
createdDate: {
type: Date,
required: true,
default: Date.now
},
updatedDate: {
type: Date
},
status: {
type: [{
type: String,
enum: {
values: ["new", "pending", "approved", "running", "passed", "failed", "aborted"],
message: "status is required"
}
}],
default: ["new"]
},
browserName: {
type: String
},
browserVersion: {
type: String
},
browserFullVersion: {
type: String
},
viewport: {
type: String
},
os: {
type: String
},
domDump: {
type: String
},
result: {
type: String,
default: "{}"
},
run: {
type: import_mongoose.Schema.Types.ObjectId
},
markedAs: {
type: String,
enum: ["bug", "accepted"]
},
markedDate: {
type: Date
},
markedById: {
type: import_mongoose.Schema.Types.ObjectId,
ref: "VRSUser"
},
markedByUsername: {
type: String
},
markedBugComment: {
type: String
},
creatorId: {
type: import_mongoose.Schema.Types.ObjectId,
ref: "VRSUser"
},
creatorUsername: {
type: String
},
failReasons: {
type: [String]
},
vOffset: {
type: String
},
topStablePixels: {
type: String
},
meta: {
type: Object
}
});
CheckSchema.plugin(toJSON_plugin_default);
CheckSchema.plugin(paginate_plugin_default);
var Check = import_mongoose.default.model("VRSCheck", CheckSchema);
// src/server/models/Log.model.ts
var import_mongoose2 = __toESM(require("mongoose"));
var LogSchema = new import_mongoose2.Schema({
timestamp: {
type: Date
},
level: {
type: String
},
message: {
type: String
},
meta: {
type: Object
},
hostname: {
type: Object
}
});
LogSchema.plugin(toJSON_plugin_default);
LogSchema.plugin(paginate_plugin_default);
var Log = import_mongoose2.default.model("VRSLog", LogSchema);
// src/server/models/App.model.ts
var import_mongoose3 = __toESM(require("mongoose"));
var AppSchema = new import_mongoose3.Schema({
name: {
type: String,
default: "Others",
unique: true,
required: [true, 'AppSchema: The "name" field must be required']
},
description: {
type: String
},
version: {
type: String
},
updatedDate: {
type: Date
},
createdDate: {
type: Date
},
meta: {
type: Object
}
});
AppSchema.plugin(paginate_plugin_default);
AppSchema.plugin(toJSON_plugin_default);
var App = import_mongoose3.default.model("VRSApp", AppSchema);
// src/server/models/Snapshot.model.ts
var import_mongoose4 = __toESM(require("mongoose"));
var SnapshotSchema = new import_mongoose4.Schema({
name: {
type: String,
required: [true, 'SnapshotSchema: The "name" field must be required']
},
path: {
type: String
},
filename: {
type: String
},
imghash: {
type: String,
required: [true, 'SnapshotSchema: The "imghash" field must be required']
},
createdDate: {
type: Date,
default: Date.now
},
vOffset: {
type: Number
},
hOffset: {
type: Number
}
});
SnapshotSchema.plugin(toJSON_plugin_default);
SnapshotSchema.plugin(paginate_plugin_default);
var Snapshot = import_mongoose4.default.model("VRSSnapshot", SnapshotSchema);
// src/server/models/AppSettings.model.ts
var import_mongoose5 = __toESM(require("mongoose"));
var AppSettingsSchema = new import_mongoose5.Schema({
name: {
type: String,
unique: true,
required: [true, 'AppSettingsSchema: The "name" field must be required']
},
label: {
type: String,
required: [true, 'AppSettingsSchema: The "label" field must be required']
},
description: {
type: String
},
type: {
type: String,
required: [true, 'AppSettingsSchema: The "type" field must be required']
},
value: {
type: import_mongoose5.Schema.Types.Mixed,
required: [true, 'AppSettingsSchema: The "value" field must be required']
},
env_variable: {
type: String
},
enabled: {
type: Boolean
}
});
AppSettingsSchema.plugin(toJSON_plugin_default);
var AppSettings = import_mongoose5.default.model("VRSAppSettings", AppSettingsSchema);
// src/server/models/Suite.model.ts
var import_mongoose6 = __toESM(require("mongoose"));
var SuiteSchema = new import_mongoose6.Schema({
name: {
type: String,
default: "Others",
unique: true,
required: [true, 'SuiteSchema: The "name" field must be required']
},
tags: {
type: [String]
},
app: {
type: import_mongoose6.Schema.Types.ObjectId,
ref: "VRSApp",
required: [true, 'SuiteSchema: The "app" field must be required']
},
description: {
type: String
},
updatedDate: {
type: Date,
default: Date.now
},
createdDate: {
type: Date
},
meta: {
type: Object
}
});
SuiteSchema.plugin(paginate_plugin_default);
SuiteSchema.plugin(toJSON_plugin_default);
var Suite = import_mongoose6.default.model("VRSSuite", SuiteSchema);
// src/server/models/Run.model.ts
var import_mongoose7 = __toESM(require("mongoose"));
var RunSchema = new import_mongoose7.Schema({
name: {
type: String,
required: [true, 'RunSchema: The "name" field must be required']
},
app: {
type: import_mongoose7.Schema.Types.ObjectId,
ref: "VRSApp",
required: [true, 'RunSchema: The "app" field must be required']
},
ident: {
type: String,
unique: true,
required: [true, 'RunSchema: The "ident" field must be required']
},
description: {
type: String
},
updatedDate: {
type: Date,
default: Date.now
},
createdDate: {
type: Date
},
parameters: {
type: [String]
},
meta: {
type: Object
}
});
RunSchema.plugin(paginate_plugin_default);
RunSchema.plugin(toJSON_plugin_default);
var Run = import_mongoose7.default.model("VRSRun", RunSchema);
// src/server/models/User.model.ts
var import_mongoose8 = __toESM(require("mongoose"));
var import_passport_local_mongoose = __toESM(require("passport-local-mongoose"));
var UserSchema = new import_mongoose8.Schema({
username: {
type: String,
unique: true,
required: [true, 'UserSchema: The "username" field must be required']
},
firstName: {
type: String,
required: [true, 'UserSchema: The "firstName" field must be required']
},
lastName: {
type: String,
required: [true, 'UserSchema: The "lastName" field must be required']
},
role: {
type: String,
enum: ["admin", "reviewer", "user"],
required: [true, 'UserSchema: The "role" field must be required']
},
password: {
type: String
},
token: {
type: String
},
apiKey: {
type: String
},
createdDate: {
type: Date
},
updatedDate: {
type: Date
},
expiration: {
type: Date
},
meta: {
type: Object
}
});
UserSchema.statics.isEmailTaken = async function(username, excludeUserId) {
const user = await this.findOne({ username, _id: { $ne: excludeUserId } });
return !!user;
};
UserSchema.plugin(toJSON_plugin_default);
UserSchema.plugin(paginate_plugin_default);
UserSchema.plugin(import_passport_local_mongoose.default, { hashField: "password" });
var User = import_mongoose8.default.model("VRSUser", UserSchema);
var User_model_default = User;
// src/server/models/Baseline.model.ts
var import_mongoose9 = __toESM(require("mongoose"));
var BaselineSchema = new import_mongoose9.Schema({
snapshootId: {
type: import_mongoose9.Schema.Types.ObjectId
},
name: {
type: String,
required: [true, 'VRSBaselineSchema: The "name" field must be required']
},
app: {
type: import_mongoose9.Schema.Types.ObjectId,
ref: "VRSApp",
required: [true, 'VRSBaselineSchema: The "app" field must be required']
},
branch: {
type: String
},
browserName: {
type: String
},
browserVersion: {
type: String
},
browserFullVersion: {
type: String
},
viewport: {
type: String
},
os: {
type: String
},
markedAs: {
type: String,
enum: ["bug", "accepted"]
},
lastMarkedDate: {
type: Date
},
createdDate: {
type: Date
},
updatedDate: {
type: Date
},
markedById: {
type: import_mongoose9.Schema.Types.ObjectId,
ref: "VRSUser"
},
markedByUsername: {
type: String
},
ignoreRegions: {
type: String
},
boundRegions: {
type: String
},
matchType: {
type: String,
enum: ["antialiasing", "nothing", "colors"]
},
meta: {
type: Object
}
});
BaselineSchema.plugin(toJSON_plugin_default);
BaselineSchema.plugin(paginate_plugin_default);
var Baseline = import_mongoose9.default.model("VRSBaseline", BaselineSchema);
// src/server/models/Test.model.ts
var import_mongoose10 = __toESM(require("mongoose"));
var TestSchema = new import_mongoose10.Schema(
{
name: {
type: String,
required: "TestSchema: the test name is empty"
},
description: {
type: String
},
status: {
type: String
},
browserName: {
type: String
},
browserVersion: {
type: String
},
branch: {
type: String
},
tags: {
type: [String]
},
viewport: {
type: String
},
calculatedViewport: {
type: String
},
os: {
type: String
},
app: {
type: import_mongoose10.Schema.Types.ObjectId,
ref: "VRSApp",
required: [true, 'TestSchema: The "app" field must be required']
},
blinking: {
type: Number,
default: 0
},
updatedDate: {
type: Date
},
startDate: {
type: Date
},
checks: [
{
type: import_mongoose10.default.Schema.Types.ObjectId,
ref: "VRSCheck"
}
],
suite: {
type: import_mongoose10.Schema.Types.ObjectId,
ref: "VRSSuite"
},
run: {
type: import_mongoose10.Schema.Types.ObjectId,
ref: "VRSRun"
},
markedAs: {
type: String,
enum: ["Bug", "Accepted", "Unaccepted", "Partially"]
},
creatorId: {
type: import_mongoose10.Schema.Types.ObjectId,
ref: "VRSUser"
},
creatorUsername: {
type: String
},
meta: {
type: Object
}
},
{ strictQuery: true }
);
TestSchema.plugin(toJSON_plugin_default);
TestSchema.plugin(paginate_plugin_default);
TestSchema.plugin(paginateDistinct_plugin_default);
var Test = import_mongoose10.default.model("VRSTest", TestSchema);
// src/seeds/testUsers.json
var testUsers_default = [
{
PASSWORD_: "Test-123",
API_KEY_: "GV640BD-9CG4RDB-NY8WH76-NJB5599",
username: "testreviewer@test.com",
firstName: "Test",
lastName: "Reviewer",
role: "reviewer",
password: "152046e9cd34cdcd6cea5e66a9ec3fd262f61056b51e4a82d4fe8d6dacaa71fa8419e4b16bc11dfad9d2d90a8b8f4eb79b8e0dc93bededa7d8524521b122392dde0b4e9ca3bccb23b9bade5eb991d78d98246c009e983af42274f9d701c313ef8c47f23fea7701063a19be77f7d31c7cd537ee8f3bc31e861a81cc88bb2f47424e2903d06c99cf053e3be21d191075c92eaee48e1f964ace6357d7f5fea5412e56b26331f9e67354e3f0e0937f826011ddb0058a6c59021c9b7880b5c0ecdbaef1f8491e78288a00ff5ab5fa3e58528794f1bd84f097e8dccc8a8c3a15f760389d9b57f5313c63f68688ad44b53727d1c6e2078824e3c042ccfc6351772737807f46b7e24e30d8c48c1a1a55a3eb0d465d657004e17060afe4b354a4f3946b3dce8c105a2d521cd2c63161af0c039d41c212165c6133fe3b24d8ccdc82045450ce8e189d03ec7bb948bd0ad22140089d6f63352833b56232d7cad498efb65fb609077b6de73beb8e946fe54d7b417cefef0a07e26cbf33a7c58323f414aeaa4b83118e19bffdb3eb6d4f5150f1901b340c16e71c2683d7c6faede630396c4c92ba12485c6c8e00ecb3be785604ce41fdf42315cf02ad7f96eff2b018b415b1550f50756ace62965cadd4080a3e4bd8e3d70042bb3a5f0ba8ab357bfad9290af6a93236f294b3e7547295227b8d5b33cca35393d4b76e750805249b81b2a186aa",
apiKey: "9aa20a336f91ea6c9657c3391934227059d4c28d2c7924813176ac4f6633d9c65baee77ca6f34c0d13e574ec285b54fd23c10b26abefec7df981e2884f91a84c",
createdDate: "2022-09-19T15:23:09.360+04:00",
updatedDate: null,
salt: "09067fc22c1b821db81bc83c33f217cd8a54cb8f370d1da4a12d8be867a66b93"
},
{
PASSWORD_: "Test-123",
API_KEY_: "NTSAEXR-CZ1MFWD-KY0Q3MG-HY6SKD1",
username: "testuser@test.com",
firstName: "Test",
lastName: "User",
role: "user",
password: "60271a5363308e14af295c0ce34818ce32781296d10908f941d8c9589dced5b193f6e1a1962c4e5e718c00974497baa5a3fd6a797bf2cc91e7f76018711c1a7a35809c04fa92b256987f0835601b789609311c862f4c91220741fc30bd79aff25c0b0565834ca16cd313e45fc1b5846f25cabab695680edd739a85b479fbf51c2f860fd427003b10e5bec0b7bf776bfed7b6dbe33a3ca666e69995f4160ddc54e00075b1844807529f0fd8bf650eab71bf6732fd91018cfaedf950d94fd75cfe2b758c3610fb5ab1b863e119073637b33aeaf781e33ed1c73a050f8b8e540761f205d5b19347039599d647a25f1ba7d1422bf3029f9a35b8eb8633db09afd807d18a6ff22d55862e7aa401538eb705fca451fee132324bc05aff3eab10d6031a5e21ff4c6e3a6cb03c32730e1e8b550ebab0ca39942277782b32f9399a14c2876a2a01acecd70f819cce77407b1fee231d5674dd6dc8d9c56a38e9f50e4271e2d9725d830b6f187009726179cb6d1d67c614461bb294003b23f7979f16dbcc71ad9ab9285d7aa4a5550d15915d34ac50dee6fa7f2b90113a3cbf83a92811df0dee1f97c92328273cb8556136219569286666a1bc49c86c9e0e8175cf564168ada14e9f14c174f45789cc68667cecfda6f5d343f79d12ac4c0934f189dab0c8b6c29d01488a8dd0f37dcbba34ec45a9be8c52230189804beecf52603ce22ec95d",
apiKey: "c45d0a87c4eea0f6ace90f1f780761f3e4daa9f11b5bc3732cb9014ad269a4bafa73c7ae6af891dd0fcc3e7ecaee40ca6236948ede1a3eb9c84757cd18c06bc3",
createdDate: "2022-09-19T15:22:23.631+04:00",
updatedDate: null,
salt: "c23b0eafe172a9d1fad3651f02ae256a2f6932faac09fd1f4385c1f406c8c83f"
},
{
PASSWORD_: "Test-123",
API_KEY_: "3APH5SM-X9G4T6G-H3ZZNQ2-55G4REB",
username: "testadmin@test.com",
firstName: "Test",
lastName: "Admin",
role: "admin",
password: "5046e8420581be0c726c1cade6b6e15fe7cb0c34dad070d3a3030ed12d79d7a56b1217916522cd8813f578d8b24571dab848f22e774abb1db70f4fb725249694afa25c3733decd78fa4d5ab875ec0de43cbbe511ea6b059482f721f96d437622374f715ea316e2f03dc40d7217b1951f6022bdff89b17357b24706306ad38115db2aab3f8a609d172f734cabd7ca5eddcaa772d4cca8b6338c86edd639b91e9fdac3b17be22b3c010eac7c9cac128b675b87ec39fa5b8fea0593137df01eca1678d197d4ed536eb209b83c477a7cd62e9e8e06b8459ebefcd267fc38d7705313303d3b038e31996b66e54415494db34544c617f03740feecc3427f7a92ebcc50e10f45f38a01c6ccbc182bf5b5c48b7eb33432f86d14d6972afcdafa5aab2d82a1b49a559c63a5a719e4fbdaa8eaad0c80cb3bec83f16854b4280b13f1976b24b7ca52d18118eec3546038b8e682aa3005f091927f64905122e41f95e9b729afbd833771e1b802dd962bbda3d5ccd0c8966da7cd902db6a3283d1a631195cdc2efa032ddfb69d924ccb3a4808b21b424dee46abc7f07edfbe2c9e9092d1d6f0da828ca98734909ed8d40802f5403d5e9070c356c594b4758759400b263601237192c6de2fd321fa9e480f2261cac7b3cd3ac2b41289a79f90efa17b890d7ff3f391654e62a7bbc557b9dc03824acdbcdb760e8209c74d29d827fc3c75de5468c",
apiKey: "db6e323f7f559a62aa8cd3838b1cdd3c95acc0b064bfd21f6810b2aa6c147ae8e45ebbc49f7e720d31f0bd18d71ab05eaeedd343d1f345c35d18fbf685db91cb",
createdDate: "2022-09-19T15:19:19.825+04:00",
updatedDate: null,
salt: "a7e22101f6886dbdf07fc01d92e633d8b323f5d868a6d1214c7f9a12f266a2b2"
}
];
// src/server/lib/logger.ts
var import_winston = __toESM(require("winston"));
var import_winston_mongodb = require("winston-mongodb");
var import_chalk = require("chalk");
// src/server/utils/formatISOToDateTime.ts
function formatISOToDateTime(isoDateString) {
const date = new Date(isoDateString);
return `${date.toISOString().slice(0, 10)} ${date.toTimeString().slice(0, 8)}`;
}
var formatISOToDateTime_default = formatISOToDateTime;
// src/server/config.ts
var import_fs = __toESM(require("fs"));
var import_dotenv2 = __toESM(require("dotenv"));
// package.json
var version = "2.2.26-alpha.0";
// src/server/config.ts
var import_crypto2 = __toESM(require("crypto"));
// src/server/envConfig.ts
var import_envalid = require("envalid");
var import_crypto = __toESM(require("crypto"));
var import_path = __toESM(require("path"));
var import_dotenv = __toESM(require("dotenv"));
import_dotenv.default.config();
if (!process.env.NODE_ENV) {
process.env.NODE_ENV = "production";
}
var env = (0, import_envalid.cleanEnv)(process.env, {
NODE_ENV: (0, import_envalid.str)({ choices: ["development", "production", "test"] }),
SYNGRISI_DB_URI: (0, import_envalid.str)({ default: "mongodb://127.0.0.1:27017/SyngrisiDb" }),
SYNGRISI_APP_PORT: (0, import_envalid.port)({ default: 3e3 }),
SYNGRISI_IMAGES_PATH: (0, import_envalid.str)({ default: import_path.default.join(process.cwd(), "./.snapshots-images") }),
SYNGRISI_TMP_DIR: (0, import_envalid.str)({ default: import_path.default.join(process.cwd(), ".tmp") }),
SYNGRISI_HTTP_LOG: (0, import_envalid.bool)({ default: false }),
SYNGRISI_COVERAGE: (0, import_envalid.bool)({ default: false }),
SYNGRISI_HOSTNAME: (0, import_envalid.host)({ default: "localhost" }),
SYNGRISI_AUTH: (0, import_envalid.bool)({ default: true }),
SYNGRISI_TEST_MODE: (0, import_envalid.bool)({ default: false }),
SYNGRISI_DISABLE_FIRST_RUN: (0, import_envalid.bool)({ default: false }),
MONGODB_ROOT_USERNAME: (0, import_envalid.str)({ default: "" }),
MONGODB_ROOT_PASSWORD: (0, import_envalid.str)({ default: "" }),
LOGLEVEL: (0, import_envalid.str)({ choices: ["error", "warn", "info", "verbose", "debug", "silly"], default: "debug" }),
SYNGRISI_PAGINATION_SIZE: (0, import_envalid.num)({ default: 50 }),
SYNGRISI_DISABLE_DEV_CORS: (0, import_envalid.bool)({ default: true, devDefault: true }),
SYNGRISI_SESSION_STORE_KEY: (0, import_envalid.str)({ default: import_crypto.default.randomBytes(64).toString("hex") }),
SYNGRISI_LOG_LEVEL: (0, import_envalid.str)({ default: "debug" }),
// trunk features
SYNGRISI_TRUNK_FEATURE_AI_SEVERITY: (0, import_envalid.bool)({ default: false }),
SYNGRISI_AI_KEY: (0, import_envalid.str)({ default: "" }),
OPENAI_API_BASE_URL: (0, import_envalid.str)({ default: "https://api.openai.com/v1" }),
OPENAI_API_KEY: (0, import_envalid.str)({ default: "" })
});
// src/server/data/devices.json
var devices_default = [
{
os: "ios",
os_version: "16",
device: "iPhone 14 Pro Max",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPhone 14 Pro",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPhone 14 Plus",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPhone 14",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPhone 12 Pro Max",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPhone 12 Pro",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPhone 12 Mini",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPhone 11 Pro Max",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone XS",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone 13 Pro Max",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone 13 Pro",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone 13 Mini",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone 13",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone 11 Pro",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone 11",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPhone XS",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPhone 12 Pro Max",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPhone 12 Pro",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPhone 12 Mini",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPhone 12",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPhone 11 Pro Max",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPhone 11",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPhone XS",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPhone 11 Pro Max",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPhone 11 Pro",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPhone 11",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPhone XS",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPhone XS Max",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone XR",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPhone XR",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPhone X",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone 8",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPhone 8",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPhone 8",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPhone 8",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPhone 8 Plus",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPhone 8 Plus",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPhone 7",
realMobile: true
},
{
os: "ios",
os_version: "10",
device: "iPhone 7",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPhone 6S",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPhone 6S",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPhone 6S Plus",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPhone 6",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPhone SE 2022",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPhone SE 2020",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPhone SE",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPad Air 4",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPad 9th",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPad Pro 12.9 2022",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPad Pro 12.9 2020",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPad Pro 11 2022",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPad 10th",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPad Air 5",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPad Pro 12.9 2021",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPad Pro 12.9 2020",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPad Pro 11 2021",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPad Pro 12.9 2020",
realMobile: true
},
{
os: "ios",
os_version: "16",
device: "iPad 8th",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPad Pro 12.9 2018",
realMobile: true
},
{
os: "ios",
os_version: "15",
device: "iPad Mini 2021",
realMobile: true
},
{
os: "ios",
os_version: "14",
device: "iPad 8th",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPad Pro 12.9 2018",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPad Pro 11 2020",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPad Mini 2019",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPad Air 2019",
realMobile: true
},
{
os: "ios",
os_version: "13",
device: "iPad 7th",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPad Pro 12.9 2018",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPad Pro 11 2018",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPad Mini 2019",
realMobile: true
},
{
os: "ios",
os_version: "12",
device: "iPad Air 2019",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPad Pro 9.7 2016",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPad Pro 12.9 2017",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPad Mini 4",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPad 6th",
realMobile: true
},
{
os: "ios",
os_version: "11",
device: "iPad 5th",
realMobile: true
},
{
os: "android",
os_version: "12.0",
device: "Samsung Galaxy S22 Ultra",
realMobile: true
},
{
os: "android",
os_version: "12.0",
device: "Samsung Galaxy S22 Plus",
realMobile: true
},
{
os: "android",
os_version: "12.0",
device: "Samsung Galaxy S22",
realMobile: true
},
{
os: "android",
os_version: "12.0",
device: "Samsung Galaxy S21",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Samsung Galaxy S21 Ultra",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Samsung Galaxy S21",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Samsung Galaxy S21 Plus",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Samsung Galaxy S20",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Samsung Galaxy S20 Plus",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Samsung Galaxy S20 Ultra",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Samsung Galaxy M52",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Samsung Galaxy M32",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Samsung Galaxy A52",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Samsung Galaxy Note 20 Ultra",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Samsung Galaxy Note 20",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Samsung Galaxy A51",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Samsung Galaxy A11",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Samsung Galaxy S9 Plus",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Samsung Galaxy S10e",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Samsung Galaxy S10 Plus",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Samsung Galaxy S10",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Samsung Galaxy Note 10 Plus",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Samsung Galaxy Note 10",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Samsung Galaxy A10",
realMobile: true
},
{
os: "android",
os_version: "8.1",
device: "Samsung Galaxy Note 9",
realMobile: true
},
{
os: "android",
os_version: "8.1",
device: "Samsung Galaxy J7 Prime",
realMobile: true
},
{
os: "android",
os_version: "8.0",
device: "Samsung Galaxy S9 Plus",
realMobile: true
},
{
os: "android",
os_version: "8.0",
device: "Samsung Galaxy S9",
realMobile: true
},
{
os: "android",
os_version: "7.1",
device: "Samsung Galaxy Note 8",
realMobile: true
},
{
os: "android",
os_version: "7.1",
device: "Samsung Galaxy A8",
realMobile: true
},
{
os: "android",
os_version: "7.0",
device: "Samsung Galaxy S8 Plus",
realMobile: true
},
{
os: "android",
os_version: "7.0",
device: "Samsung Galaxy S8",
realMobile: true
},
{
os: "android",
os_version: "6.0",
device: "Samsung Galaxy S7",
realMobile: true
},
{
os: "android",
os_version: "5.0",
device: "Samsung Galaxy S6",
realMobile: true
},
{
os: "android",
os_version: "13.0",
device: "Google Pixel 7 Pro",
realMobile: true
},
{
os: "android",
os_version: "13.0",
device: "Google Pixel 7",
realMobile: true
},
{
os: "android",
os_version: "13.0",
device: "Google Pixel 6 Pro",
realMobile: true
},
{
os: "android",
os_version: "12.0",
device: "Google Pixel 6 Pro",
realMobile: true
},
{
os: "android",
os_version: "12.0",
device: "Google Pixel 6",
realMobile: true
},
{
os: "android",
os_version: "12.0",
device: "Google Pixel 5",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Google Pixel 5",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Google Pixel 4",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Google Pixel 4 XL",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Google Pixel 4",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Google Pixel 3",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Google Pixel 3a XL",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Google Pixel 3a",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Google Pixel 3 XL",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Google Pixel 3",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Google Pixel 2",
realMobile: true
},
{
os: "android",
os_version: "8.0",
device: "Google Pixel 2",
realMobile: true
},
{
os: "android",
os_version: "7.1",
device: "Google Pixel",
realMobile: true
},
{
os: "android",
os_version: "6.0",
device: "Google Nexus 6",
realMobile: true
},
{
os: "android",
os_version: "4.4",
device: "Google Nexus 5",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "OnePlus 9",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "OnePlus 8",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "OnePlus 7T",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "OnePlus 7",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "OnePlus 6T",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Xiaomi Redmi Note 11",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Xiaomi Redmi Note 9",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Xiaomi Redmi Note 8",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Xiaomi Redmi Note 7",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Vivo Y21",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Vivo V21",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Vivo Y50",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Oppo Reno 6",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Oppo A96",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Oppo Reno 3 Pro",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Motorola Moto G71 5G",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Motorola Moto G9 Play",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Motorola Moto G7 Play",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Huawei P30",
realMobile: true
},
{
os: "android",
os_version: "12.0",
device: "Samsung Galaxy Tab S8",
realMobile: true
},
{
os: "android",
os_version: "11.0",
device: "Samsung Galaxy Tab S7",
realMobile: true
},
{
os: "android",
os_version: "10.0",
device: "Samsung Galaxy Tab S7",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Samsung Galaxy Tab S6",
realMobile: true
},
{
os: "android",
os_version: "9.0",
device: "Samsung Galaxy Tab S5e",
realMobile: true
},
{
os: "android",
os_version: "8.1",
device: "Samsung Galaxy Tab S4",
realMobile: true
}
];
// src/server/config.ts
var customDevicesPath = "./server/data/custom_devices.json";
var logsFolder = "./logs";
import_dotenv2.default.config();
var config = {
version,
// this isn't used
getDevices: async () => {
if (import_fs.default.existsSync(customDevicesPath)) {
return [...devices_default, ...(await import(customDevicesPath)).default];
}
return devices_default;
},
defaultImagesPath: env.SYNGRISI_IMAGES_PATH,
connectionString: env.SYNGRISI_DB_URI || "mongodb://127.0.0.1:27017/SyngrisiDb",
host: env.SYNGRISI_HOSTNAME,
port: env.SYNGRISI_APP_PORT || 3e3,
backupsFolder: "./backups",
enableHttpLogger: env.SYNGRISI_HTTP_LOG,
httpLoggerFilePath: `${logsFolder}/http.log`,
storeSessionKey: env.SYNGRISI_SESSION_STORE_KEY || import_crypto2.default.randomBytes(64).toString("hex"),
codeCoverage: env.SYNGRISI_COVERAGE,
disableCors: env.SYNGRISI_DISABLE_DEV_CORS,
fileUploadMaxSize: 50 * 1024 * 1024,
testMode: env.SYNGRISI_TEST_MODE,
jsonLimit: "50mb",
tmpDir: env.SYNGRISI_TMP_DIR,
helmet: {
crossOriginEmbedderPolicy: false,
crossOriginResourcePolicy: false,
crossOriginOpenerPolicy: false,
contentSecurityPolicy: {
directives: {
// frameAncestors: ["'self'", "vscode-webview:", "vscode-resource:", "https:", "http:"],
// frameSrc: ["'self'", "vscode-webview:", "https:", "http:"],
// scriptSrc: ["'self'", "'unsafe-inline'"],
// styleSrc: ["'self'", "'unsafe-inline'"]
defaultSrc: ["'self'", "*", "'unsafe-inline'", "'unsafe-eval'", "data:", "blob:"],
frameAncestors: ["'self'", "*"],
frameSrc: ["'self'", "*"],
scriptSrc: ["'self'", "*", "'unsafe-inline'", "'unsafe-eval'"],
styleSrc: ["'self'", "*", "'unsafe-inline'"],
imgSrc: ["'self'", "*", "data:", "blob:"],
fontSrc: ["'self'", "*", "data:"],
connectSrc: ["'self'", "*"]
}
}
}
};
if (!import_fs.default.existsSync(config.defaultImagesPath)) {
import_fs.default.mkdirSync(config.defaultImagesPath, { recursive: true });
}
if (!import_fs.default.existsSync(logsFolder)) {
import_fs.default.mkdirSync(logsFolder, { recursive: true });
}
// src/server/lib/logger.ts
var import_path2 = __toESM(require("path"));
// src/server/utils/ApiError.ts
var ApiError = class extends Error {
constructor(statusCode, message, isOperational = true, stack = "") {
super(message);
this.statusCode = statusCode;
this.isOperational = isOperational;
if (stack) {
this.stack = stack;
} else {
Error.captureStackTrace(this, this.constructor);
}
}
};
var ApiError_default = ApiError;
// src/server/utils/deserializeIfJSON.ts
var import_bson2 = require("bson");
// src/server/lib/logger.ts
var logLevel = env.SYNGRISI_LOG_LEVEL;
function getScriptLine() {
const stack = new Error().stack;
if (stack) {
const stackLines = stack.split("\n");
let loggerLineIndex = -1;
for (let i = 0; i < stackLines.length; i++) {
if (stackLines[i].includes("lib/logger")) {
loggerLineIndex = i;
}
}
const targetLineIndex = loggerLineIndex + 1;
if (targetLineIndex >= 0 && targetLineIndex < stackLines.length) {
const targetLine = stackLines[targetLineIndex];
const match = targetLine.match(/at\s+(?:.+\s+\()?(.+):(\d+):(\d+)\)?/);
if (match) {
const scriptPath = match[1];
const relativePath = import_path2.default.relative(process.cwd(), scriptPath);
const lineNumber = match[2];
return `${relativePath}:${lineNumber}`;
}
}
}
return "unknown";
}
function createWinstonLogger(opts) {
return import_winston.default.createLogger({
transports: [
new import_winston.default.transports.Console({
level: logLevel || "silly",
format: import_winston.default.format.combine(
import_winston.default.format.colorize(),
import_winston.default.format.timestamp(),
import_winston.default.format.ms(),
import_winston.default.format.metadata(),
import_winston.default.format.printf((info) => {
const user = info.metadata.user ? (0, import_chalk.blue)(` <${info.metadata.user}>`) : "";
const ref = info.metadata.ref ? (0, import_chalk.gray)(` ${info.metadata.ref}`) : "";
const msgType = info.metadata.msgType ? ` ${info.metadata.msgType}` : "";
const itemType = info.metadata.itemType ? (0, import_chalk.magenta)(` ${info.metadata.itemType}`) : "";
const scope = info.metadata.scope ? (0, import_chalk.magenta)(` [${info.metadata.scope}] `) : (0, import_chalk.magenta)(` [${getScriptLine()}] `);
const msg = typeof info.message === "object" ? `
${JSON.stringify(info.message, null, 2)}` : info.message;
return `${info.level} ${scope}${formatISOToDateTime_default(info.metadata.timestamp)} ${info.metadata.ms}${user}${ref}${msgType}${itemType} '${msg}'`;
}),
import_winston.default.format.padLevels()
)
}),
new import_winston.default.transports.MongoDB({
level: logLevel || "debug",
format: import_winston.default.format.combine(
import_winston.default.format.timestamp(),
import_winston.default.format.json(),
import_winston.default.format.metadata()
),
options: {
useUnifiedTopology: true
},
db: opts.dbConnectionString,
collection: "vrslogs"
})
]
});
}
var Logger = class _Logger {
constructor(opts = { dbConnectionString: config.connectionString }) {
this.winstonLogger = createWinstonLogger(opts);
}
static mergeMeta(objects) {
return objects.reduce((acc, obj) => {
return { ...acc, ...obj };
}, {});
}
log(severity, msg, meta) {
const mergedMeta = _Logger.mergeMeta(meta);
if (!mergedMeta.scope) {
mergedMeta.scope = getScriptLine();
}
const formattedMsg = typeof msg === "object" ? JSON.stringify(msg, null, 2) : msg;
this.winstonLogger.log(severity, formattedMsg, mergedMeta);
}
error(msg, ...meta) {
let message = String(msg);
let code = 0;
if (msg instanceof Object) {
message = JSON.stringify(msg);
}
if (msg instanceof Error) {
message = msg.stack;
}
if (msg instanceof ApiError_default) {
code = msg.statusCode;
}
this.log("error", `${code !== 0 ? "[" + code + "]" : ""}${message}
stacktrace: ${new Error().stack}`, meta);
}
warn(msg, ...meta) {
this.log("warn", `${msg}
stacktrace: ${new Error().stack}`, meta);
}
info(msg, ...meta) {
this.log("info", msg, meta);
}
verbose(msg, ...meta) {
this.log("verbose", msg, meta);
}
debug(msg, ...meta) {
this.log("debug", msg, meta);
}
silly(msg, ...meta) {
this.log("silly", msg, meta);
}
};
var logger_default = new Logger();
// src/server/lib/startup/createTestsUsers.ts
var logOpts = {
scope: "on_start",
msgType: "SETUP"
};
async function createTestsUsers() {
logger_default.debug("creating tests users", logOpts);
try {
await User_model_default.insertMany(testUsers_default);
} catch (e) {
console.warn(e);
}
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createTestsUsers
});
//# sourceMappingURL=createTestsUsers.js.map