@prosopo/provider-mock 2.8.135 → 2.8.137

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/cjs/db.cjs CHANGED
@@ -1,84 +1,84 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const common = require("@prosopo/common");
4
- const database = require("@prosopo/database");
5
- const mongoose = require("mongoose");
6
- var TableNames = /* @__PURE__ */ ((TableNames2) => {
7
- TableNames2["ja4"] = "ja4";
8
- return TableNames2;
9
- })(TableNames || {});
10
- const JA4Schema = new mongoose.Schema({
11
- application: String,
12
- library: String,
13
- device: String,
14
- os: String,
15
- user_agent_string: String,
16
- certificate_authority: String,
17
- observation_count: { type: Number, default: 1 },
18
- verified: { type: Boolean, default: false },
19
- notes: { type: String, default: "" },
20
- ja4_fingerprint: { type: String, required: true },
21
- ja4_fingerprint_string: String,
22
- ja4s_fingerprint: String,
23
- ja4h_fingerprint: String,
24
- ja4x_fingerprint: String,
25
- ja4t_fingerprint: String,
26
- ja4ts_fingerprint: String,
27
- ja4tscan_fingerprint: String
1
+ let _prosopo_common = require("@prosopo/common");
2
+ let _prosopo_database = require("@prosopo/database");
3
+ //#region src/db.ts
4
+ var JA4Schema = new (require("mongoose")).Schema({
5
+ application: String,
6
+ library: String,
7
+ device: String,
8
+ os: String,
9
+ user_agent_string: String,
10
+ certificate_authority: String,
11
+ observation_count: {
12
+ type: Number,
13
+ default: 1
14
+ },
15
+ verified: {
16
+ type: Boolean,
17
+ default: false
18
+ },
19
+ notes: {
20
+ type: String,
21
+ default: ""
22
+ },
23
+ ja4_fingerprint: {
24
+ type: String,
25
+ required: true
26
+ },
27
+ ja4_fingerprint_string: String,
28
+ ja4s_fingerprint: String,
29
+ ja4h_fingerprint: String,
30
+ ja4x_fingerprint: String,
31
+ ja4t_fingerprint: String,
32
+ ja4ts_fingerprint: String,
33
+ ja4tscan_fingerprint: String
28
34
  });
29
- JA4Schema.index({ ja4_fingerprint: 1, user_agent_string: 1 }, { unique: true });
30
- const DATA_TABLES = [
31
- {
32
- collectionName: "ja4",
33
- modelName: "ja4",
34
- schema: JA4Schema
35
- }
36
- ];
37
- class JA4Database extends database.MongoDatabase {
38
- constructor(url, dbname, authSource, logger) {
39
- super(url, dbname, authSource, logger);
40
- this.tables = {};
41
- }
42
- async connect() {
43
- await super.connect();
44
- DATA_TABLES.map(({ collectionName, modelName, schema }) => {
45
- if (this.connection) {
46
- this.tables[collectionName] = this.connection.model(modelName, schema);
47
- }
48
- });
49
- }
50
- getTables() {
51
- if (!this.tables) {
52
- throw new common.ProsopoDBError("DATABASE.TABLES_UNDEFINED", {
53
- context: { failedFuncName: this.getTables.name },
54
- logger: this.logger
55
- });
56
- }
57
- return this.tables;
58
- }
59
- async getJA4Records() {
60
- return this.tables.ja4.find({});
61
- }
62
- async getJA4RecordByFingerprintAndUserAgent(ja4Fingerprint, userAgentString) {
63
- return this.tables.ja4.findOne({
64
- ja4_fingerprint: ja4Fingerprint,
65
- user_agent_string: userAgentString
66
- });
67
- }
68
- // add a ja4 record or update an existing one if the user agent string and ja4 fingerprint match, incrementing the observation count
69
- async addOrUpdateJA4Record(ja4Record) {
70
- const existingRecord = await this.getJA4RecordByFingerprintAndUserAgent(
71
- ja4Record.ja4_fingerprint,
72
- ja4Record.user_agent_string ? ja4Record.user_agent_string : ""
73
- );
74
- if (existingRecord) {
75
- existingRecord.observation_count = (existingRecord.observation_count || 0) + 1;
76
- await existingRecord.save();
77
- return existingRecord;
78
- }
79
- const newRecord = new this.tables.ja4(ja4Record);
80
- await newRecord.save();
81
- return newRecord;
82
- }
83
- }
35
+ JA4Schema.index({
36
+ ja4_fingerprint: 1,
37
+ user_agent_string: 1
38
+ }, { unique: true });
39
+ var DATA_TABLES = [{
40
+ collectionName: "ja4",
41
+ modelName: "ja4",
42
+ schema: JA4Schema
43
+ }];
44
+ var JA4Database = class extends _prosopo_database.MongoDatabase {
45
+ constructor(url, dbname, authSource, logger) {
46
+ super(url, dbname, authSource, logger);
47
+ this.tables = {};
48
+ }
49
+ async connect() {
50
+ await super.connect();
51
+ DATA_TABLES.map(({ collectionName, modelName, schema }) => {
52
+ if (this.connection) this.tables[collectionName] = this.connection.model(modelName, schema);
53
+ });
54
+ }
55
+ getTables() {
56
+ if (!this.tables) throw new _prosopo_common.ProsopoDBError("DATABASE.TABLES_UNDEFINED", {
57
+ context: { failedFuncName: this.getTables.name },
58
+ logger: this.logger
59
+ });
60
+ return this.tables;
61
+ }
62
+ async getJA4Records() {
63
+ return this.tables.ja4.find({});
64
+ }
65
+ async getJA4RecordByFingerprintAndUserAgent(ja4Fingerprint, userAgentString) {
66
+ return this.tables.ja4.findOne({
67
+ ja4_fingerprint: ja4Fingerprint,
68
+ user_agent_string: userAgentString
69
+ });
70
+ }
71
+ async addOrUpdateJA4Record(ja4Record) {
72
+ const existingRecord = await this.getJA4RecordByFingerprintAndUserAgent(ja4Record.ja4_fingerprint, ja4Record.user_agent_string ? ja4Record.user_agent_string : "");
73
+ if (existingRecord) {
74
+ existingRecord.observation_count = (existingRecord.observation_count || 0) + 1;
75
+ await existingRecord.save();
76
+ return existingRecord;
77
+ }
78
+ const newRecord = new this.tables.ja4(ja4Record);
79
+ await newRecord.save();
80
+ return newRecord;
81
+ }
82
+ };
83
+ //#endregion
84
84
  exports.JA4Database = JA4Database;
@@ -1,26 +1,31 @@
1
- "use strict";
2
- const apiExpressRouter = require("@prosopo/api-express-router");
3
- const locale = require("@prosopo/locale");
4
- const logger$1 = require("@prosopo/logger");
5
- const cors = require("cors");
6
- const express = require("express");
7
- const api = require("./api.cjs");
8
- const logger = logger$1.getLogger(logger$1.LogLevel.enum.info, "prosopo:provider-mock:start.ts");
1
+ const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
2
+ const require_api = require("./api.cjs");
3
+ let _prosopo_api_express_router = require("@prosopo/api-express-router");
4
+ let _prosopo_locale = require("@prosopo/locale");
5
+ let _prosopo_logger = require("@prosopo/logger");
6
+ let cors = require("cors");
7
+ cors = require_runtime.__toESM(cors, 1);
8
+ let express = require("express");
9
+ express = require_runtime.__toESM(express, 1);
10
+ //#region src/start.ts
11
+ var logger = (0, _prosopo_logger.getLogger)(_prosopo_logger.LogLevel.enum.info, "prosopo:provider-mock:start.ts");
9
12
  async function startApi() {
10
- const apiApp = express();
11
- const apiPort = "9229";
12
- apiApp.use(cors());
13
- apiApp.use(express.json());
14
- apiApp.use(await locale.i18nMiddleware({}));
15
- apiApp.use(api.prosopoRouter());
16
- apiApp.use(apiExpressRouter.handleErrors);
17
- apiApp.listen(apiPort, () => {
18
- logger.info(() => ({
19
- msg: `Prosopo app listening at http://localhost:${apiPort}`
20
- }));
21
- });
13
+ const apiApp = (0, express.default)();
14
+ const apiPort = "9229";
15
+ apiApp.use((0, cors.default)());
16
+ apiApp.use(express.default.json());
17
+ apiApp.use(await (0, _prosopo_locale.i18nMiddleware)({}));
18
+ apiApp.use(require_api.prosopoRouter());
19
+ apiApp.use(_prosopo_api_express_router.handleErrors);
20
+ apiApp.listen(apiPort, () => {
21
+ logger.info(() => ({ msg: `Prosopo app listening at http://localhost:${apiPort}` }));
22
+ });
22
23
  }
23
24
  startApi().catch((error) => {
24
- logger.error(() => ({ err: error, msg: "Failed to start API" }));
25
- process.exit(1);
25
+ logger.error(() => ({
26
+ err: error,
27
+ msg: "Failed to start API"
28
+ }));
29
+ process.exit(1);
26
30
  });
31
+ //#endregion
package/dist/db.js CHANGED
@@ -1,84 +1,85 @@
1
1
  import { ProsopoDBError } from "@prosopo/common";
2
2
  import { MongoDatabase } from "@prosopo/database";
3
3
  import { Schema } from "mongoose";
4
- var TableNames = /* @__PURE__ */ ((TableNames2) => {
5
- TableNames2["ja4"] = "ja4";
6
- return TableNames2;
7
- })(TableNames || {});
8
- const JA4Schema = new Schema({
9
- application: String,
10
- library: String,
11
- device: String,
12
- os: String,
13
- user_agent_string: String,
14
- certificate_authority: String,
15
- observation_count: { type: Number, default: 1 },
16
- verified: { type: Boolean, default: false },
17
- notes: { type: String, default: "" },
18
- ja4_fingerprint: { type: String, required: true },
19
- ja4_fingerprint_string: String,
20
- ja4s_fingerprint: String,
21
- ja4h_fingerprint: String,
22
- ja4x_fingerprint: String,
23
- ja4t_fingerprint: String,
24
- ja4ts_fingerprint: String,
25
- ja4tscan_fingerprint: String
4
+ //#region src/db.ts
5
+ var JA4Schema = new Schema({
6
+ application: String,
7
+ library: String,
8
+ device: String,
9
+ os: String,
10
+ user_agent_string: String,
11
+ certificate_authority: String,
12
+ observation_count: {
13
+ type: Number,
14
+ default: 1
15
+ },
16
+ verified: {
17
+ type: Boolean,
18
+ default: false
19
+ },
20
+ notes: {
21
+ type: String,
22
+ default: ""
23
+ },
24
+ ja4_fingerprint: {
25
+ type: String,
26
+ required: true
27
+ },
28
+ ja4_fingerprint_string: String,
29
+ ja4s_fingerprint: String,
30
+ ja4h_fingerprint: String,
31
+ ja4x_fingerprint: String,
32
+ ja4t_fingerprint: String,
33
+ ja4ts_fingerprint: String,
34
+ ja4tscan_fingerprint: String
26
35
  });
27
- JA4Schema.index({ ja4_fingerprint: 1, user_agent_string: 1 }, { unique: true });
28
- const DATA_TABLES = [
29
- {
30
- collectionName: "ja4",
31
- modelName: "ja4",
32
- schema: JA4Schema
33
- }
34
- ];
35
- class JA4Database extends MongoDatabase {
36
- constructor(url, dbname, authSource, logger) {
37
- super(url, dbname, authSource, logger);
38
- this.tables = {};
39
- }
40
- async connect() {
41
- await super.connect();
42
- DATA_TABLES.map(({ collectionName, modelName, schema }) => {
43
- if (this.connection) {
44
- this.tables[collectionName] = this.connection.model(modelName, schema);
45
- }
46
- });
47
- }
48
- getTables() {
49
- if (!this.tables) {
50
- throw new ProsopoDBError("DATABASE.TABLES_UNDEFINED", {
51
- context: { failedFuncName: this.getTables.name },
52
- logger: this.logger
53
- });
54
- }
55
- return this.tables;
56
- }
57
- async getJA4Records() {
58
- return this.tables.ja4.find({});
59
- }
60
- async getJA4RecordByFingerprintAndUserAgent(ja4Fingerprint, userAgentString) {
61
- return this.tables.ja4.findOne({
62
- ja4_fingerprint: ja4Fingerprint,
63
- user_agent_string: userAgentString
64
- });
65
- }
66
- // add a ja4 record or update an existing one if the user agent string and ja4 fingerprint match, incrementing the observation count
67
- async addOrUpdateJA4Record(ja4Record) {
68
- const existingRecord = await this.getJA4RecordByFingerprintAndUserAgent(
69
- ja4Record.ja4_fingerprint,
70
- ja4Record.user_agent_string ? ja4Record.user_agent_string : ""
71
- );
72
- if (existingRecord) {
73
- existingRecord.observation_count = (existingRecord.observation_count || 0) + 1;
74
- await existingRecord.save();
75
- return existingRecord;
76
- }
77
- const newRecord = new this.tables.ja4(ja4Record);
78
- await newRecord.save();
79
- return newRecord;
80
- }
81
- }
82
- export {
83
- JA4Database
36
+ JA4Schema.index({
37
+ ja4_fingerprint: 1,
38
+ user_agent_string: 1
39
+ }, { unique: true });
40
+ var DATA_TABLES = [{
41
+ collectionName: "ja4",
42
+ modelName: "ja4",
43
+ schema: JA4Schema
44
+ }];
45
+ var JA4Database = class extends MongoDatabase {
46
+ constructor(url, dbname, authSource, logger) {
47
+ super(url, dbname, authSource, logger);
48
+ this.tables = {};
49
+ }
50
+ async connect() {
51
+ await super.connect();
52
+ DATA_TABLES.map(({ collectionName, modelName, schema }) => {
53
+ if (this.connection) this.tables[collectionName] = this.connection.model(modelName, schema);
54
+ });
55
+ }
56
+ getTables() {
57
+ if (!this.tables) throw new ProsopoDBError("DATABASE.TABLES_UNDEFINED", {
58
+ context: { failedFuncName: this.getTables.name },
59
+ logger: this.logger
60
+ });
61
+ return this.tables;
62
+ }
63
+ async getJA4Records() {
64
+ return this.tables.ja4.find({});
65
+ }
66
+ async getJA4RecordByFingerprintAndUserAgent(ja4Fingerprint, userAgentString) {
67
+ return this.tables.ja4.findOne({
68
+ ja4_fingerprint: ja4Fingerprint,
69
+ user_agent_string: userAgentString
70
+ });
71
+ }
72
+ async addOrUpdateJA4Record(ja4Record) {
73
+ const existingRecord = await this.getJA4RecordByFingerprintAndUserAgent(ja4Record.ja4_fingerprint, ja4Record.user_agent_string ? ja4Record.user_agent_string : "");
74
+ if (existingRecord) {
75
+ existingRecord.observation_count = (existingRecord.observation_count || 0) + 1;
76
+ await existingRecord.save();
77
+ return existingRecord;
78
+ }
79
+ const newRecord = new this.tables.ja4(ja4Record);
80
+ await newRecord.save();
81
+ return newRecord;
82
+ }
84
83
  };
84
+ //#endregion
85
+ export { JA4Database };
package/dist/start.js CHANGED
@@ -1,25 +1,30 @@
1
+ import "./_virtual/_rolldown/runtime.js";
2
+ import { prosopoRouter } from "./api.js";
1
3
  import { handleErrors } from "@prosopo/api-express-router";
2
4
  import { i18nMiddleware } from "@prosopo/locale";
3
- import { getLogger, LogLevel } from "@prosopo/logger";
5
+ import { LogLevel, getLogger } from "@prosopo/logger";
4
6
  import cors from "cors";
5
7
  import express from "express";
6
- import { prosopoRouter } from "./api.js";
7
- const logger = getLogger(LogLevel.enum.info, "prosopo:provider-mock:start.ts");
8
+ //#region src/start.ts
9
+ var logger = getLogger(LogLevel.enum.info, "prosopo:provider-mock:start.ts");
8
10
  async function startApi() {
9
- const apiApp = express();
10
- const apiPort = "9229";
11
- apiApp.use(cors());
12
- apiApp.use(express.json());
13
- apiApp.use(await i18nMiddleware({}));
14
- apiApp.use(prosopoRouter());
15
- apiApp.use(handleErrors);
16
- apiApp.listen(apiPort, () => {
17
- logger.info(() => ({
18
- msg: `Prosopo app listening at http://localhost:${apiPort}`
19
- }));
20
- });
11
+ const apiApp = express();
12
+ const apiPort = "9229";
13
+ apiApp.use(cors());
14
+ apiApp.use(express.json());
15
+ apiApp.use(await i18nMiddleware({}));
16
+ apiApp.use(prosopoRouter());
17
+ apiApp.use(handleErrors);
18
+ apiApp.listen(apiPort, () => {
19
+ logger.info(() => ({ msg: `Prosopo app listening at http://localhost:${apiPort}` }));
20
+ });
21
21
  }
22
22
  startApi().catch((error) => {
23
- logger.error(() => ({ err: error, msg: "Failed to start API" }));
24
- process.exit(1);
23
+ logger.error(() => ({
24
+ err: error,
25
+ msg: "Failed to start API"
26
+ }));
27
+ process.exit(1);
25
28
  });
29
+ //#endregion
30
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/provider-mock",
3
- "version": "2.8.135",
3
+ "version": "2.8.137",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -26,31 +26,31 @@
26
26
  "bundle": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.config.ts --mode $NODE_ENV"
27
27
  },
28
28
  "dependencies": {
29
- "@prosopo/api-express-router": "3.1.49",
30
- "@prosopo/common": "3.1.47",
31
- "@prosopo/logger": "2.0.3",
32
- "@prosopo/database": "3.15.18",
33
- "@prosopo/dotenv": "3.0.49",
34
- "@prosopo/locale": "3.2.7",
35
- "@prosopo/provider": "4.15.13",
36
- "@prosopo/types": "4.9.12",
37
- "@prosopo/types-database": "4.11.15",
29
+ "@prosopo/api-express-router": "3.1.51",
30
+ "@prosopo/common": "3.1.48",
31
+ "@prosopo/logger": "2.0.4",
32
+ "@prosopo/database": "3.15.20",
33
+ "@prosopo/dotenv": "3.0.50",
34
+ "@prosopo/locale": "3.2.8",
35
+ "@prosopo/provider": "4.15.15",
36
+ "@prosopo/types": "4.10.0",
37
+ "@prosopo/types-database": "4.11.17",
38
38
  "cors": "2.8.5",
39
39
  "express": "4.21.2",
40
- "mongoose": "8.13.0"
40
+ "mongoose": "8.24.1"
41
41
  },
42
42
  "devDependencies": {
43
- "@prosopo/config": "3.3.4",
43
+ "@prosopo/config": "3.3.5",
44
44
  "@types/node": "22.10.2",
45
- "@vitest/coverage-v8": "3.2.4",
45
+ "@vitest/coverage-v8": "4.1.10",
46
46
  "concurrently": "9.0.1",
47
47
  "del-cli": "6.0.0",
48
48
  "npm-run-all": "4.1.5",
49
49
  "tslib": "2.7.0",
50
50
  "tsx": "4.20.3",
51
51
  "typescript": "5.6.2",
52
- "vite": "6.4.1",
53
- "vitest": "3.2.4"
52
+ "vite": "8.1.5",
53
+ "vitest": "4.1.10"
54
54
  },
55
55
  "repository": {
56
56
  "type": "git",