@prosopo/provider-mock 2.7.18 → 2.7.19

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.
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const common = require("@prosopo/common");
4
+ const provider = require("@prosopo/provider");
5
+ const types = require("@prosopo/types");
6
+ const express = require("express");
7
+ const db = require("./db.cjs");
8
+ function prosopoRouter() {
9
+ const router = express.Router();
10
+ const db$1 = new db.JA4Database(
11
+ process.env.MONGO_URL || "mongodb://localhost:27017",
12
+ process.env.MONGO_DBNAME || "client",
13
+ process.env.MONGO_AUTH_SOURCE || "admin"
14
+ );
15
+ router.post(
16
+ types.ClientApiPaths.VerifyImageCaptchaSolutionDapp,
17
+ async (req, res, next) => {
18
+ let body;
19
+ try {
20
+ body = types.VerifySolutionBody.parse(req.body);
21
+ } catch (err) {
22
+ return next(
23
+ new common.ProsopoApiError("CAPTCHA.PARSE_ERROR", {
24
+ context: { error: err, code: 400 },
25
+ logLevel: "info"
26
+ })
27
+ );
28
+ }
29
+ try {
30
+ const { token } = body;
31
+ const { user, dapp, commitmentId } = types.decodeProcaptchaOutput(token);
32
+ const testCommitmentId = "0x123456789test";
33
+ const testAccount = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
34
+ const testDapp = "5C4hrfjw9DjXZTzV3MwzrrAr9P1MJhSrvWGWqi1eSuyUpnhM";
35
+ let statusMessage = "API.USER_NOT_VERIFIED";
36
+ let approved = false;
37
+ if (user && user === testAccount || commitmentId && commitmentId === testCommitmentId || dapp && dapp === testDapp) {
38
+ approved = true;
39
+ statusMessage = "API.USER_VERIFIED";
40
+ return res.json({
41
+ status: req.t(statusMessage),
42
+ verified: approved,
43
+ commitmentId: testCommitmentId
44
+ });
45
+ }
46
+ return res.json({
47
+ status: req.t(statusMessage),
48
+ verified: false
49
+ });
50
+ } catch (err) {
51
+ return next(
52
+ new common.ProsopoApiError("API.UNKNOWN", {
53
+ context: { error: err, code: 500 }
54
+ })
55
+ );
56
+ }
57
+ }
58
+ );
59
+ router.get("/test", async (req, res) => {
60
+ try {
61
+ const logger = common.getLogger("info", module);
62
+ const ja4PlusFingerprint = await provider.getJA4(req.headers, logger);
63
+ await db$1.connect();
64
+ await db$1.addOrUpdateJA4Record({
65
+ ja4_fingerprint: ja4PlusFingerprint.ja4PlusFingerprint,
66
+ user_agent_string: req.headers["user-agent"] || ""
67
+ });
68
+ await db$1.close();
69
+ return res.json({
70
+ ja4: ja4PlusFingerprint.ja4PlusFingerprint,
71
+ ua: req.headers["user-agent"]
72
+ });
73
+ } catch (e) {
74
+ console.error("Error parsing ClientHello:", e);
75
+ return res.status(500).send("Error parsing ClientHello.");
76
+ }
77
+ });
78
+ return router;
79
+ }
80
+ exports.prosopoRouter = prosopoRouter;
@@ -0,0 +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
28
+ });
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
+ }
84
+ exports.JA4Database = JA4Database;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ const apiExpressRouter = require("@prosopo/api-express-router");
3
+ const common = require("@prosopo/common");
4
+ const locale = require("@prosopo/locale");
5
+ const cors = require("cors");
6
+ const express = require("express");
7
+ const api = require("./api.cjs");
8
+ const logger = common.getLogger(common.LogLevel.enum.info, "prosopo:provider-mock:start.ts");
9
+ 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
+ });
22
+ }
23
+ startApi().catch((error) => {
24
+ logger.error(() => ({ err: error, msg: "Failed to start API" }));
25
+ process.exit(1);
26
+ });
package/dist/db.js CHANGED
@@ -1,79 +1,84 @@
1
1
  import { ProsopoDBError } from "@prosopo/common";
2
2
  import { MongoDatabase } from "@prosopo/database";
3
3
  import { Schema } from "mongoose";
4
- var TableNames;
5
- (function (TableNames) {
6
- TableNames["ja4"] = "ja4";
7
- })(TableNames || (TableNames = {}));
4
+ var TableNames = /* @__PURE__ */ ((TableNames2) => {
5
+ TableNames2["ja4"] = "ja4";
6
+ return TableNames2;
7
+ })(TableNames || {});
8
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,
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
26
26
  });
27
27
  JA4Schema.index({ ja4_fingerprint: 1, user_agent_string: 1 }, { unique: true });
28
28
  const DATA_TABLES = [
29
- {
30
- collectionName: TableNames.ja4,
31
- modelName: TableNames.ja4,
32
- schema: JA4Schema,
33
- },
29
+ {
30
+ collectionName: "ja4",
31
+ modelName: "ja4",
32
+ schema: JA4Schema
33
+ }
34
34
  ];
35
- export class JA4Database extends MongoDatabase {
36
- constructor(url, dbname, authSource, logger) {
37
- super(url, dbname, authSource, logger);
38
- this.tables = {};
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
+ });
39
54
  }
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
- async addOrUpdateJA4Record(ja4Record) {
67
- const existingRecord = await this.getJA4RecordByFingerprintAndUserAgent(ja4Record.ja4_fingerprint, ja4Record.user_agent_string ? ja4Record.user_agent_string : "");
68
- if (existingRecord) {
69
- existingRecord.observation_count =
70
- (existingRecord.observation_count || 0) + 1;
71
- await existingRecord.save();
72
- return existingRecord;
73
- }
74
- const newRecord = new this.tables.ja4(ja4Record);
75
- await newRecord.save();
76
- return newRecord;
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;
77
76
  }
77
+ const newRecord = new this.tables.ja4(ja4Record);
78
+ await newRecord.save();
79
+ return newRecord;
80
+ }
78
81
  }
79
- //# sourceMappingURL=db.js.map
82
+ export {
83
+ JA4Database
84
+ };
package/dist/start.js CHANGED
@@ -1,26 +1,25 @@
1
1
  import { handleErrors } from "@prosopo/api-express-router";
2
- import { LogLevel, getLogger } from "@prosopo/common";
2
+ import { getLogger, LogLevel } from "@prosopo/common";
3
3
  import { i18nMiddleware } from "@prosopo/locale";
4
4
  import cors from "cors";
5
5
  import express from "express";
6
6
  import { prosopoRouter } from "./api.js";
7
7
  const logger = getLogger(LogLevel.enum.info, "prosopo:provider-mock:start.ts");
8
8
  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
- });
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
+ });
21
21
  }
22
22
  startApi().catch((error) => {
23
- logger.error(() => ({ err: error, msg: "Failed to start API" }));
24
- process.exit(1);
23
+ logger.error(() => ({ err: error, msg: "Failed to start API" }));
24
+ process.exit(1);
25
25
  });
26
- //# sourceMappingURL=start.js.map
package/package.json CHANGED
@@ -1,35 +1,45 @@
1
1
  {
2
2
  "name": "@prosopo/provider-mock",
3
- "version": "2.7.18",
3
+ "version": "2.7.19",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
- "main": "./dist/index.js",
7
6
  "type": "module",
7
+ "main": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/cjs/index.cjs"
14
+ }
15
+ },
8
16
  "engines": {
9
17
  "node": "20",
10
18
  "npm": "10.8.2"
11
19
  },
12
20
  "scripts": {
13
- "test": "echo \"No test specified\"",
14
- "clean": "tsc --build --clean",
15
- "build": "tsc --build --verbose",
16
- "build:cjs": "echo 'no cjs build'",
21
+ "build": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.esm.config.ts --mode $NODE_ENV",
22
+ "build:tsc": "tsc --build --verbose",
23
+ "build:cjs": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
24
+ "typecheck": "tsc --build --declaration --emitDeclarationOnly",
25
+ "test": "echo no tests",
17
26
  "bundle": "NODE_ENV=${NODE_ENV:-production}; vite build --config vite.config.ts --mode $NODE_ENV"
18
27
  },
19
28
  "dependencies": {
20
- "@prosopo/api-express-router": "3.0.3",
21
- "@prosopo/common": "3.0.2",
22
- "@prosopo/provider": "3.2.0",
23
- "@prosopo/types": "3.0.3",
29
+ "@prosopo/api-express-router": "3.0.4",
30
+ "@prosopo/common": "3.1.0",
31
+ "@prosopo/provider": "3.2.1",
32
+ "@prosopo/types": "3.0.4",
24
33
  "@typegoose/auto-increment": "4.13.0",
25
34
  "axios": "1.10.0",
26
35
  "cors": "2.8.5",
27
36
  "esbuild": "0.25.6",
28
37
  "express": "4.21.2",
29
38
  "mongodb": "6.9.0",
39
+ "read-tls-client-hello": "1.1.0",
40
+ "@prosopo/config": "3.1.1",
30
41
  "mongoose": "8.13.0",
31
42
  "openpgp": "5.11.3",
32
- "read-tls-client-hello": "1.1.0",
33
43
  "webpack-dev-server": "5.2.2"
34
44
  },
35
45
  "devDependencies": {
@@ -0,0 +1,23 @@
1
+ import path from "node:path";
2
+ // Copyright 2021-2025 Prosopo (UK) Ltd.
3
+ //
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // you may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ //
8
+ // http://www.apache.org/licenses/LICENSE-2.0
9
+ //
10
+ // Unless required by applicable law or agreed to in writing, software
11
+ // distributed under the License is distributed on an "AS IS" BASIS,
12
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ // See the License for the specific language governing permissions and
14
+ // limitations under the License.
15
+ import { ViteCommonJSConfig } from "@prosopo/config";
16
+
17
+ export default function () {
18
+ return ViteCommonJSConfig(
19
+ path.basename("."),
20
+ path.resolve("./tsconfig.json"),
21
+ "src/start.ts",
22
+ );
23
+ }
@@ -0,0 +1,24 @@
1
+ // Copyright 2021-2025 Prosopo (UK) Ltd.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ import path from "node:path";
16
+ import { ViteEsmConfig } from "@prosopo/config";
17
+
18
+ export default function () {
19
+ return ViteEsmConfig(
20
+ path.basename("."),
21
+ path.resolve("./tsconfig.json"),
22
+ "src/start.ts",
23
+ );
24
+ }
package/dist/api.d.ts DELETED
@@ -1,3 +0,0 @@
1
- import { type Router } from "express";
2
- export declare function prosopoRouter(): Router;
3
- //# sourceMappingURL=api.d.ts.map
package/dist/api.d.ts.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAsBA,OAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,SAAS,CAAC;AAQ/C,wBAAgB,aAAa,IAAI,MAAM,CAqFtC"}
package/dist/api.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EACN,cAAc,EACd,kBAAkB,EAClB,sBAAsB,GACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,OAAwB,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE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G,EAAE,kBAAkB,CAAC,kBAAkB;gBAC1C,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC;aAC7B,CAAC,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,CAAC,CAAC,CAAC;YAC/C,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QAC3D,CAAC;IACF,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AACf,CAAC"}
package/dist/db.d.ts DELETED
@@ -1,38 +0,0 @@
1
- import { type Logger } from "@prosopo/common";
2
- import { MongoDatabase } from "@prosopo/database";
3
- import type { Tables } from "@prosopo/types-database";
4
- import type mongoose from "mongoose";
5
- declare enum TableNames {
6
- ja4 = "ja4"
7
- }
8
- type JA4Data = {
9
- application?: string;
10
- library?: string;
11
- device?: string;
12
- os?: string;
13
- user_agent_string: string;
14
- certificate_authority?: string;
15
- observation_count?: number;
16
- verified?: boolean;
17
- notes?: string;
18
- ja4_fingerprint: string;
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;
26
- };
27
- type JA4Record = JA4Data & mongoose.Document;
28
- export declare class JA4Database extends MongoDatabase {
29
- tables: Tables<TableNames>;
30
- constructor(url: string, dbname?: string, authSource?: string, logger?: Logger);
31
- connect(): Promise<void>;
32
- getTables(): Tables<TableNames>;
33
- getJA4Records(): Promise<JA4Record[]>;
34
- getJA4RecordByFingerprintAndUserAgent(ja4Fingerprint: string, userAgentString: string): Promise<JA4Record | null>;
35
- addOrUpdateJA4Record(ja4Record: JA4Data): Promise<JA4Record | null>;
36
- }
37
- export {};
38
- //# sourceMappingURL=db.d.ts.map
package/dist/db.d.ts.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,CAAC,MAAM;aACnB,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED,KAAK,CAAC,aAAa;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAY,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,qCAAqC,CAC1C,cAAsB,EACtB,eAAuB;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAY;YACzC,eAAe,EAAE,cAAc;YAC/B,iBAAiB,EAAE,eAAe;SAClC,CAAC,CAAC;IACJ,CAAC;IAID,KAAK,CAAC,oBAAoB,CAAC,SAAkB;QAC5C,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,qCAAqC,CACtE,SAAS,CAAC,eAAe,EACzB,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,CAC9D,CAAC;QACF,IAAI,cAAc,EAAE,CAAC;YACpB,cAAc,CAAC,iBAAiB;gBAC/B,CAAC,cAAc,CAAC,iBAAiB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;YAC7C,MAAM,cAAc,CAAC,IAAI,EAAE,CAAC;YAC5B,OAAO,cAAc,CAAC;QACvB,CAAC;QACD,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QACjD,MAAM,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,OAAO,SAAS,CAAC;IAClB,CAAC;CACD"}
package/dist/start.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=start.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":""}
package/dist/start.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"start.js","sourceRoot":"","sources":["../src/start.ts"],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