@riavzon/bot-detector 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.mjs CHANGED
@@ -506,7 +506,7 @@ async function updateBannedIP(cookie, ipAddress, country, user_agent, info) {
506
506
  //#endregion
507
507
  //#region src/botDetector/db/updateIsBot.ts
508
508
  async function updateIsBot(isBot, cookie) {
509
- const params = [isBot, cookie];
509
+ const params = [isBot ? 1 : 0, cookie];
510
510
  const db = getDb();
511
511
  const log = getLogger().child({
512
512
  service: "BOT DETECTOR",
@@ -562,7 +562,7 @@ async function updateVisitor(u) {
562
562
  browserVersion,
563
563
  os,
564
564
  Number(activity_score) || 0
565
- ].map((value) => value === void 0 ? null : value);
565
+ ].map((value) => value === void 0 ? null : typeof value === "boolean" ? value ? 1 : 0 : value);
566
566
  const ex = (col) => excluded(db, col);
567
567
  const upsert = onUpsert(db, "canary_id");
568
568
  try {
@@ -907,10 +907,10 @@ async function configuration(config) {
907
907
  if (!globalBatchQueue) {
908
908
  globalBatchQueue = new BatchQueue();
909
909
  process.on("SIGTERM", () => {
910
- globalBatchQueue?.shutdown();
910
+ globalBatchQueue?.shutdown().then(() => process.exit(0));
911
911
  });
912
912
  process.on("SIGINT", () => {
913
- globalBatchQueue?.shutdown();
913
+ globalBatchQueue?.shutdown().then(() => process.exit(0));
914
914
  });
915
915
  }
916
916
  };
@@ -3224,8 +3224,8 @@ async function updateVisitors(data, cookie, visitor_id) {
3224
3224
  data.as,
3225
3225
  data.device_type,
3226
3226
  data.browser,
3227
- data.proxy,
3228
- data.hosting,
3227
+ data.proxy ? 1 : 0,
3228
+ data.hosting ? 1 : 0,
3229
3229
  data.deviceVendor,
3230
3230
  data.deviceModel,
3231
3231
  data.browserType,