@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/.turbo/turbo-build$colon$cjs.log +12 -9
- package/.turbo/turbo-build$colon$tsc.log +26 -26
- package/.turbo/turbo-build.log +13 -10
- package/CHANGELOG.md +30 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/api.js +80 -76
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/api.cjs +84 -78
- package/dist/cjs/db.cjs +82 -82
- package/dist/cjs/start.cjs +27 -22
- package/dist/db.js +80 -79
- package/dist/start.js +22 -17
- package/package.json +15 -15
- package/tsconfig.tsbuildinfo +1 -1
package/dist/cjs/db.cjs
CHANGED
|
@@ -1,84 +1,84 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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({
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
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;
|
package/dist/cjs/start.cjs
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
|
|
25
|
-
|
|
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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({
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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 {
|
|
5
|
+
import { LogLevel, getLogger } from "@prosopo/logger";
|
|
4
6
|
import cors from "cors";
|
|
5
7
|
import express from "express";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
+
//#region src/start.ts
|
|
9
|
+
var logger = getLogger(LogLevel.enum.info, "prosopo:provider-mock:start.ts");
|
|
8
10
|
async function startApi() {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
24
|
-
|
|
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.
|
|
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.
|
|
30
|
-
"@prosopo/common": "3.1.
|
|
31
|
-
"@prosopo/logger": "2.0.
|
|
32
|
-
"@prosopo/database": "3.15.
|
|
33
|
-
"@prosopo/dotenv": "3.0.
|
|
34
|
-
"@prosopo/locale": "3.2.
|
|
35
|
-
"@prosopo/provider": "4.15.
|
|
36
|
-
"@prosopo/types": "4.
|
|
37
|
-
"@prosopo/types-database": "4.11.
|
|
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.
|
|
40
|
+
"mongoose": "8.24.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
|
-
"@prosopo/config": "3.3.
|
|
43
|
+
"@prosopo/config": "3.3.5",
|
|
44
44
|
"@types/node": "22.10.2",
|
|
45
|
-
"@vitest/coverage-v8": "
|
|
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": "
|
|
53
|
-
"vitest": "
|
|
52
|
+
"vite": "8.1.5",
|
|
53
|
+
"vitest": "4.1.10"
|
|
54
54
|
},
|
|
55
55
|
"repository": {
|
|
56
56
|
"type": "git",
|