@prosopo/database 3.0.13 → 3.4.13

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.
@@ -4,7 +4,8 @@ const common = require("@prosopo/common");
4
4
  const typesDatabase = require("@prosopo/types-database");
5
5
  require("../base/index.cjs");
6
6
  const mongo = require("../base/mongo.cjs");
7
- const logger = common.getLogger("info", module);
7
+ var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
8
+ const logger = common.getLogger("info", typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === "SCRIPT" && _documentCurrentScript.src || new URL("databases/captcha.cjs", document.baseURI).href);
8
9
  var TableNames = /* @__PURE__ */ ((TableNames2) => {
9
10
  TableNames2["frictionlessToken"] = "frictionlessToken";
10
11
  TableNames2["session"] = "session";
@@ -32,6 +33,7 @@ const CAPTCHA_TABLES = [
32
33
  class CaptchaDatabase extends mongo.MongoDatabase {
33
34
  constructor(url, dbname, authSource, logger2) {
34
35
  super(url, dbname, authSource, logger2);
36
+ this.indexesEnsured = false;
35
37
  this.tables = {};
36
38
  }
37
39
  async connect() {
@@ -51,12 +53,43 @@ class CaptchaDatabase extends mongo.MongoDatabase {
51
53
  }
52
54
  return this.tables;
53
55
  }
56
+ async ensureIndexes() {
57
+ const indexPromises = [];
58
+ if (!this.indexesEnsured) {
59
+ CAPTCHA_TABLES.map(({ collectionName }) => {
60
+ indexPromises.push(
61
+ new Promise((resolve) => {
62
+ if (this.connected) {
63
+ this.tables[collectionName].collection.dropIndexes().then(() => {
64
+ this.tables[collectionName].ensureIndexes().then(() => {
65
+ resolve();
66
+ }).catch((err) => {
67
+ this.logger.warn(() => ({
68
+ err,
69
+ msg: `Error creating indexes for collection ${collectionName}`
70
+ }));
71
+ resolve();
72
+ });
73
+ });
74
+ } else {
75
+ this.logger.info(() => ({
76
+ msg: `Skipping index creation for collection ${collectionName} as not connected`
77
+ }));
78
+ resolve();
79
+ }
80
+ })
81
+ );
82
+ });
83
+ }
84
+ await Promise.all(indexPromises);
85
+ this.indexesEnsured = true;
86
+ }
54
87
  async saveCaptchas(sessionEvents, imageCaptchaEvents, powCaptchaEvents) {
55
88
  await this.connect();
56
89
  if (sessionEvents.length) {
57
90
  const result = await this.tables.session.bulkWrite(
58
- sessionEvents.map((document) => {
59
- const { _id, ...safeDoc } = document;
91
+ sessionEvents.map((document2) => {
92
+ const { _id, ...safeDoc } = document2;
60
93
  return {
61
94
  insertOne: {
62
95
  document: safeDoc
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const is = require("@polkadot/util/is");
4
4
  const common = require("@prosopo/common");
5
+ const redisClient = require("@prosopo/redis-client");
5
6
  const types = require("@prosopo/types");
6
7
  const typesDatabase = require("@prosopo/types-database");
7
- const userAccessPolicy = require("@prosopo/user-access-policy");
8
- const redis = require("redis");
8
+ const redis = require("@prosopo/user-access-policy/redis");
9
9
  const mongo = require("../base/mongo.cjs");
10
10
  var TableNames = /* @__PURE__ */ ((TableNames2) => {
11
11
  TableNames2["captcha"] = "captcha";
@@ -17,7 +17,6 @@ var TableNames = /* @__PURE__ */ ((TableNames2) => {
17
17
  TableNames2["scheduler"] = "scheduler";
18
18
  TableNames2["powcaptcha"] = "powcaptcha";
19
19
  TableNames2["client"] = "client";
20
- TableNames2["frictionlessToken"] = "frictionlessToken";
21
20
  TableNames2["session"] = "session";
22
21
  TableNames2["detector"] = "detector";
23
22
  return TableNames2;
@@ -68,11 +67,6 @@ const PROVIDER_TABLES = [
68
67
  modelName: "Client",
69
68
  schema: typesDatabase.ClientRecordSchema
70
69
  },
71
- {
72
- collectionName: "frictionlessToken",
73
- modelName: "FrictionlessToken",
74
- schema: typesDatabase.FrictionlessTokenRecordSchema
75
- },
76
70
  {
77
71
  collectionName: "session",
78
72
  modelName: "Session",
@@ -94,7 +88,10 @@ class ProviderDatabase extends mongo.MongoDatabase {
94
88
  );
95
89
  this.options = options;
96
90
  this.tables = {};
91
+ this.indexesEnsured = false;
97
92
  this.tables = {};
93
+ this.redisAccessRulesConnection = null;
94
+ this.redisConnection = null;
98
95
  this.userAccessRulesStorage = null;
99
96
  }
100
97
  async connect() {
@@ -103,27 +100,24 @@ class ProviderDatabase extends mongo.MongoDatabase {
103
100
  await this.setupRedis();
104
101
  }
105
102
  async setupRedis() {
106
- const redisClient = await this.createRedisClient();
107
- await userAccessPolicy.createRedisAccessRulesIndex(
108
- redisClient,
109
- this.options.redis?.indexName
103
+ this.redisConnection = redisClient.connectToRedis({
104
+ url: this.options.redis?.url,
105
+ password: this.options.redis?.password,
106
+ logger: this.logger
107
+ });
108
+ this.redisAccessRulesConnection = redisClient.setupRedisIndex(
109
+ this.redisConnection,
110
+ {
111
+ ...redis.accessRulesRedisIndex,
112
+ name: this.options.redis?.indexName || redis.accessRulesRedisIndex.name
113
+ },
114
+ this.logger
110
115
  );
111
- this.userAccessRulesStorage = userAccessPolicy.createRedisAccessRulesStorage(
112
- redisClient,
116
+ this.userAccessRulesStorage = redis.createRedisAccessRulesStorage(
117
+ this.redisAccessRulesConnection,
113
118
  this.logger
114
119
  );
115
120
  }
116
- async createRedisClient() {
117
- return await redis.createClient({
118
- url: this.options.redis?.url,
119
- password: this.options.redis?.password
120
- }).on("error", (error) => {
121
- this.logger.error(() => ({
122
- err: error,
123
- msg: "Redis client error"
124
- }));
125
- }).connect();
126
- }
127
121
  loadTables() {
128
122
  const tables = {};
129
123
  PROVIDER_TABLES.map(({ collectionName, modelName, schema }) => {
@@ -142,6 +136,56 @@ class ProviderDatabase extends mongo.MongoDatabase {
142
136
  }
143
137
  return this.tables;
144
138
  }
139
+ getRedisAccessRulesConnection() {
140
+ if (null === this.redisAccessRulesConnection) {
141
+ throw new common.ProsopoDBError(
142
+ "DATABASE.REDIS_ACCESS_RULES_CONNECTION_UNDEFINED"
143
+ );
144
+ }
145
+ return this.redisAccessRulesConnection;
146
+ }
147
+ getRedisConnection() {
148
+ if (null === this.redisConnection) {
149
+ throw new common.ProsopoDBError(
150
+ "DATABASE.REDIS_ACCESS_RULES_CONNECTION_UNDEFINED"
151
+ );
152
+ }
153
+ return this.redisConnection;
154
+ }
155
+ async ensureIndexes() {
156
+ const indexPromises = [];
157
+ if (!this.indexesEnsured) {
158
+ PROVIDER_TABLES.map(({ collectionName }) => {
159
+ indexPromises.push(
160
+ new Promise((resolve) => {
161
+ if (this.connected) {
162
+ this.tables[collectionName].collection.dropIndexes().then(() => {
163
+ this.tables[collectionName].ensureIndexes().then(() => {
164
+ this.logger.info(() => ({
165
+ msg: `Indexes ensured for collection ${collectionName}`
166
+ }));
167
+ resolve();
168
+ }).catch((err) => {
169
+ this.logger.warn(() => ({
170
+ err,
171
+ msg: `Error creating indexes for collection ${collectionName}`
172
+ }));
173
+ resolve();
174
+ });
175
+ });
176
+ } else {
177
+ this.logger.info(() => ({
178
+ msg: `Skipping index creation for collection ${collectionName} as not connected`
179
+ }));
180
+ resolve();
181
+ }
182
+ })
183
+ );
184
+ });
185
+ }
186
+ await Promise.all(indexPromises);
187
+ this.indexesEnsured = true;
188
+ }
145
189
  getUserAccessRulesStorage() {
146
190
  if (null === this.userAccessRulesStorage) {
147
191
  throw new common.ProsopoDBError("DATABASE.USER_ACCESS_RULES_STORAGE_UNDEFINED");
@@ -398,7 +442,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
398
442
  async storeUserImageCaptchaSolution(captchas, commit) {
399
443
  const commitmentRecord = typesDatabase.UserCommitmentSchema.parse({
400
444
  ...commit,
401
- lastUpdatedTimestamp: Date.now()
445
+ lastUpdatedTimestamp: /* @__PURE__ */ new Date()
402
446
  });
403
447
  if (captchas.length) {
404
448
  const filter = {
@@ -438,18 +482,20 @@ class ProviderDatabase extends mongo.MongoDatabase {
438
482
  * @param ipAddress
439
483
  * @param headers
440
484
  * @param ja4
441
- * @param frictionlessTokenId
485
+ * @param sessionId
442
486
  * @param serverChecked
443
487
  * @param userSubmitted
444
488
  * @param storedStatus
445
489
  * @param userSignature
446
490
  * @returns {Promise<void>} A promise that resolves when the record is added.
447
491
  */
448
- async storePowCaptchaRecord(challenge, components, difficulty, providerSignature, ipAddress, headers, ja4, frictionlessTokenId, serverChecked = false, userSubmitted = false, storedStatus = types.StoredStatusNames.notStored, userSignature) {
492
+ async storePowCaptchaRecord(challenge, components, difficulty, providerSignature, ipAddress, headers, ja4, sessionId, serverChecked = false, userSubmitted = false, storedStatus = types.StoredStatusNames.notStored, userSignature) {
449
493
  const tables = this.getTables();
450
494
  const powCaptchaRecord = {
451
495
  challenge,
452
- ...components,
496
+ userAccount: components.userAccount,
497
+ dappAccount: components.dappAccount,
498
+ requestedAtTimestamp: new Date(components.requestedAtTimestamp),
453
499
  ipAddress,
454
500
  headers,
455
501
  ja4,
@@ -459,8 +505,8 @@ class ProviderDatabase extends mongo.MongoDatabase {
459
505
  difficulty,
460
506
  providerSignature,
461
507
  userSignature,
462
- lastUpdatedTimestamp: Date.now(),
463
- frictionlessTokenId
508
+ lastUpdatedTimestamp: /* @__PURE__ */ new Date(),
509
+ sessionId
464
510
  };
465
511
  try {
466
512
  await tables.powcaptcha.create(powCaptchaRecord);
@@ -539,9 +585,9 @@ class ProviderDatabase extends mongo.MongoDatabase {
539
585
  * @param userSignature
540
586
  * @returns {Promise<void>} A promise that resolves when the record is updated.
541
587
  */
542
- async updatePowCaptchaRecord(challenge, result, serverChecked = false, userSubmitted = false, userSignature) {
588
+ async updatePowCaptchaRecordResult(challenge, result, serverChecked = false, userSubmitted = false, userSignature) {
543
589
  const tables = this.getTables();
544
- const timestamp = Date.now();
590
+ const timestamp = /* @__PURE__ */ new Date();
545
591
  const update = {
546
592
  result,
547
593
  serverChecked,
@@ -593,6 +639,14 @@ class ProviderDatabase extends mongo.MongoDatabase {
593
639
  throw err;
594
640
  }
595
641
  }
642
+ async updatePowCaptchaRecord(challenge, updates) {
643
+ const tables = this.getTables();
644
+ await tables.powcaptcha.updateOne(
645
+ { challenge },
646
+ { $set: updates },
647
+ { upsert: false }
648
+ );
649
+ }
596
650
  /** @description Get serverChecked Dapp User image captcha commitments from the commitments table
597
651
  */
598
652
  async getCheckedDappUserCommitments() {
@@ -634,7 +688,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
634
688
  */
635
689
  async markDappUserCommitmentsStored(commitmentIds) {
636
690
  const updateDoc = {
637
- storedAtTimestamp: Date.now()
691
+ storedAtTimestamp: /* @__PURE__ */ new Date()
638
692
  };
639
693
  await this.tables?.commitment.updateMany(
640
694
  { id: { $in: commitmentIds } },
@@ -647,7 +701,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
647
701
  async markDappUserCommitmentsChecked(commitmentIds) {
648
702
  const updateDoc = {
649
703
  [types.StoredStatusNames.serverChecked]: true,
650
- lastUpdatedTimestamp: Date.now()
704
+ lastUpdatedTimestamp: /* @__PURE__ */ new Date()
651
705
  };
652
706
  await this.tables?.commitment.updateMany(
653
707
  { id: { $in: commitmentIds } },
@@ -655,6 +709,12 @@ class ProviderDatabase extends mongo.MongoDatabase {
655
709
  { upsert: false }
656
710
  );
657
711
  }
712
+ /** @description Update an image captcha commitment
713
+ */
714
+ async updateDappUserCommitment(commitmentId, updates) {
715
+ const filter = { id: commitmentId };
716
+ await this.tables?.commitment.updateOne(filter, updates);
717
+ }
658
718
  /**
659
719
  * @description Get Dapp User PoW captcha commitments that have not been counted towards the client's total
660
720
  * @param {number} limit Maximum number of records to return
@@ -705,7 +765,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
705
765
  */
706
766
  async markDappUserPoWCommitmentsStored(challenges) {
707
767
  const updateDoc = {
708
- storedAtTimestamp: Date.now()
768
+ storedAtTimestamp: /* @__PURE__ */ new Date()
709
769
  };
710
770
  await this.tables?.powcaptcha.updateMany(
711
771
  { challenge: { $in: challenges } },
@@ -718,7 +778,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
718
778
  async markDappUserPoWCommitmentsChecked(challenges) {
719
779
  const updateDoc = {
720
780
  [types.StoredStatusNames.serverChecked]: true,
721
- lastUpdatedTimestamp: Date.now()
781
+ lastUpdatedTimestamp: /* @__PURE__ */ new Date()
722
782
  };
723
783
  await this.tables?.powcaptcha.updateMany(
724
784
  { challenge: { $in: challenges } },
@@ -728,46 +788,6 @@ class ProviderDatabase extends mongo.MongoDatabase {
728
788
  { upsert: false }
729
789
  );
730
790
  }
731
- /**
732
- * Store a new frictionless token record
733
- */
734
- async storeFrictionlessTokenRecord(tokenRecord) {
735
- const doc = await this.tables.frictionlessToken.create(
736
- tokenRecord
737
- );
738
- return doc._id;
739
- }
740
- /** Update a frictionless token record */
741
- async updateFrictionlessTokenRecord(tokenId, updates) {
742
- const filter = { _id: tokenId };
743
- await this.tables.frictionlessToken.updateOne(filter, updates);
744
- }
745
- /** Get a frictionless token record */
746
- async getFrictionlessTokenRecordByTokenId(tokenId) {
747
- const filter = { _id: tokenId };
748
- const doc = await this.tables.frictionlessToken.findOne(
749
- filter
750
- );
751
- return doc ? doc : void 0;
752
- }
753
- /** Get many frictionless token records */
754
- async getFrictionlessTokenRecordsByTokenIds(tokenId) {
755
- const filter = {
756
- _id: { $in: tokenId }
757
- };
758
- return this.tables.frictionlessToken.find(filter);
759
- }
760
- /**
761
- * Check if a frictionless token record exists.
762
- * Used to ensure that a token is not used more than once.
763
- */
764
- async getFrictionlessTokenRecordByToken(token) {
765
- const filter = { token };
766
- const record = await this.tables.frictionlessToken.findOne(
767
- filter
768
- );
769
- return record || void 0;
770
- }
771
791
  /**
772
792
  * Store a new session record
773
793
  */
@@ -784,6 +804,23 @@ class ProviderDatabase extends mongo.MongoDatabase {
784
804
  });
785
805
  }
786
806
  }
807
+ /**
808
+ * Get a session record by sessionId
809
+ */
810
+ async getSessionRecordBySessionId(sessionId) {
811
+ const filter = { sessionId };
812
+ const doc = await this.tables.session.findOne(filter).lean();
813
+ return doc || void 0;
814
+ }
815
+ /**
816
+ * Get a session record by token
817
+ * Used to ensure that a token is not used more than once.
818
+ */
819
+ async getSessionRecordByToken(token) {
820
+ const filter = { token };
821
+ const record = await this.tables.session.findOne(filter).lean();
822
+ return record || void 0;
823
+ }
787
824
  /**
788
825
  * Check if a session exists and mark it as removed
789
826
  * @returns The session record if it existed, undefined otherwise
@@ -799,7 +836,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
799
836
  try {
800
837
  const session = await this.tables.session.findOneAndUpdate(filter, {
801
838
  deleted: true,
802
- lastUpdatedTimestamp: Date.now()
839
+ lastUpdatedTimestamp: /* @__PURE__ */ new Date()
803
840
  }).lean();
804
841
  return session || void 0;
805
842
  } catch (err) {
@@ -856,7 +893,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
856
893
  /** Mark a list of session records as stored */
857
894
  async markSessionRecordsStored(sessionIds) {
858
895
  const updateDoc = {
859
- storedAtTimestamp: Date.now()
896
+ storedAtTimestamp: /* @__PURE__ */ new Date()
860
897
  };
861
898
  await this.tables?.session.updateMany(
862
899
  { sessionId: { $in: sessionIds } },
@@ -867,7 +904,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
867
904
  /**
868
905
  * @description Store a Dapp User's pending record
869
906
  */
870
- async storePendingImageCommitment(userAccount, requestHash, salt, deadlineTimestamp, requestedAtTimestamp, ipAddress, threshold, frictionlessTokenId) {
907
+ async storePendingImageCommitment(userAccount, requestHash, salt, deadlineTimestamp, requestedAtTimestamp, ipAddress, threshold, sessionId) {
871
908
  if (!is.isHex(requestHash)) {
872
909
  throw new common.ProsopoDBError("DATABASE.INVALID_HASH", {
873
910
  context: {
@@ -884,7 +921,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
884
921
  deadlineTimestamp,
885
922
  requestedAtTimestamp: new Date(requestedAtTimestamp),
886
923
  ipAddress,
887
- frictionlessTokenId,
924
+ sessionId,
888
925
  threshold
889
926
  };
890
927
  await this.tables?.pending.updateOne(
@@ -1080,13 +1117,15 @@ class ProviderDatabase extends mongo.MongoDatabase {
1080
1117
  /**
1081
1118
  * @description Approve a dapp user's solution
1082
1119
  * @param {string[]} commitmentId
1120
+ * @param coords
1083
1121
  */
1084
- async approveDappUserCommitment(commitmentId) {
1122
+ async approveDappUserCommitment(commitmentId, coords) {
1085
1123
  try {
1086
1124
  const result = { status: types.CaptchaStatus.approved };
1087
1125
  const updateDoc = {
1088
1126
  result,
1089
- lastUpdatedTimestamp: Date.now()
1127
+ lastUpdatedTimestamp: /* @__PURE__ */ new Date(),
1128
+ ...coords ? { coords } : {}
1090
1129
  };
1091
1130
  const filter = { id: commitmentId };
1092
1131
  await this.tables?.commitment?.findOneAndUpdate(filter, { $set: updateDoc }, { upsert: false }).lean();
@@ -1099,13 +1138,15 @@ class ProviderDatabase extends mongo.MongoDatabase {
1099
1138
  /**
1100
1139
  * @description Disapprove a dapp user's solution
1101
1140
  * @param {string} commitmentId
1141
+ * @param coords
1102
1142
  * @param reason
1103
1143
  */
1104
- async disapproveDappUserCommitment(commitmentId, reason) {
1144
+ async disapproveDappUserCommitment(commitmentId, reason, coords) {
1105
1145
  try {
1106
1146
  const updateDoc = {
1107
1147
  result: { status: types.CaptchaStatus.disapproved, reason },
1108
- lastUpdatedTimestamp: Date.now()
1148
+ lastUpdatedTimestamp: /* @__PURE__ */ new Date(),
1149
+ ...coords ? { coords } : {}
1109
1150
  };
1110
1151
  const filter = { id: commitmentId };
1111
1152
  await this.tables?.commitment?.findOneAndUpdate(filter, { $set: updateDoc }, { upsert: false }).lean();
@@ -1179,7 +1220,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
1179
1220
  * @description Create the status of a scheduled task
1180
1221
  */
1181
1222
  async createScheduledTaskStatus(taskName, status) {
1182
- const now = (/* @__PURE__ */ new Date()).getTime();
1223
+ const now = /* @__PURE__ */ new Date();
1183
1224
  const doc = typesDatabase.ScheduledTaskSchema.parse({
1184
1225
  processName: taskName,
1185
1226
  datetime: now,
@@ -1194,7 +1235,7 @@ class ProviderDatabase extends mongo.MongoDatabase {
1194
1235
  async updateScheduledTaskStatus(taskId, status, result) {
1195
1236
  const update = {
1196
1237
  status,
1197
- updated: (/* @__PURE__ */ new Date()).getTime(),
1238
+ updated: /* @__PURE__ */ new Date(),
1198
1239
  ...result && { result }
1199
1240
  };
1200
1241
  const filter = { _id: taskId };
@@ -1257,10 +1298,16 @@ class ProviderDatabase extends mongo.MongoDatabase {
1257
1298
  createdAt: /* @__PURE__ */ new Date()
1258
1299
  });
1259
1300
  }
1260
- /** @description Remove a detector key */
1261
- async removeDetectorKey(detectorKey) {
1301
+ /**
1302
+ * @description Remove a detector key
1303
+ * @param detectorKey The detector key to remove
1304
+ * @param expirationInSeconds Optional expiration time in seconds (default is 10 minutes)
1305
+ * */
1306
+ async removeDetectorKey(detectorKey, expirationInSeconds) {
1262
1307
  const filter = { detectorKey };
1263
- const expiresAt = new Date(Date.now() + 10 * 60 * 1e3);
1308
+ const expiresAt = new Date(
1309
+ Date.now() + (expirationInSeconds || 10 * 60) * 1e3
1310
+ );
1264
1311
  await this.tables?.detector.updateOne(filter, {
1265
1312
  $set: { expiresAt }
1266
1313
  });
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const makeDir = require("make-dir");
3
4
  require("./base/index.cjs");
4
5
  const index = require("./databases/index.cjs");
5
6
  const mongo = require("./base/mongo.cjs");
@@ -7,6 +8,7 @@ const mongoMemory = require("./base/mongoMemory.cjs");
7
8
  const provider = require("./databases/provider.cjs");
8
9
  const captcha = require("./databases/captcha.cjs");
9
10
  const client = require("./databases/client.cjs");
11
+ console.debug(makeDir);
10
12
  exports.Databases = index.Databases;
11
13
  exports.MongoDatabase = mongo.MongoDatabase;
12
14
  exports.MongoMemoryDatabase = mongoMemory.MongoMemoryDatabase;
@@ -0,0 +1,25 @@
1
+ import { type Logger } from "@prosopo/common";
2
+ import { type CaptchaProperties, type ICaptchaDatabase, type PoWCaptchaRecord, type StoredSession, type Tables, type UserCommitmentRecord } from "@prosopo/types-database";
3
+ import type { RootFilterQuery } from "mongoose";
4
+ import { MongoDatabase } from "../base/index.js";
5
+ declare enum TableNames {
6
+ frictionlessToken = "frictionlessToken",
7
+ session = "session",
8
+ commitment = "commitment",
9
+ powcaptcha = "powcaptcha"
10
+ }
11
+ export declare class CaptchaDatabase extends MongoDatabase implements ICaptchaDatabase {
12
+ tables: Tables<TableNames>;
13
+ private indexesEnsured;
14
+ constructor(url: string, dbname?: string, authSource?: string, logger?: Logger);
15
+ connect(): Promise<void>;
16
+ getTables(): Tables<TableNames>;
17
+ ensureIndexes(): Promise<void>;
18
+ saveCaptchas(sessionEvents: StoredSession[], imageCaptchaEvents: UserCommitmentRecord[], powCaptchaEvents: PoWCaptchaRecord[]): Promise<void>;
19
+ getCaptchas(filter?: RootFilterQuery<CaptchaProperties>, limit?: number): Promise<{
20
+ userCommitmentRecords: UserCommitmentRecord[];
21
+ powCaptchaRecords: PoWCaptchaRecord[];
22
+ }>;
23
+ }
24
+ export {};
25
+ //# sourceMappingURL=captcha.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captcha.d.ts","sourceRoot":"","sources":["../../src/databases/captcha.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,MAAM,EAA6B,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACN,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EAErB,KAAK,aAAa,EAGlB,KAAK,MAAM,EACX,KAAK,oBAAoB,EACzB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAIjD,aAAK,UAAU;IACd,iBAAiB,sBAAsB;IACvC,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,UAAU,eAAe;CACzB;AAoBD,qBAAa,eAAgB,SAAQ,aAAc,YAAW,gBAAgB;IAC7E,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3B,OAAO,CAAC,cAAc,CAAS;gBAG9B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,MAAM;IAMD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAUvC,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC;IAUzB,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC;IAmC9B,YAAY,CACjB,aAAa,EAAE,aAAa,EAAE,EAC9B,kBAAkB,EAAE,oBAAoB,EAAE,EAC1C,gBAAgB,EAAE,gBAAgB,EAAE;IA2E/B,WAAW,CAChB,MAAM,GAAE,eAAe,CAAC,iBAAiB,CAAM,EAC/C,KAAK,SAAM,GACT,OAAO,CAAC;QACV,qBAAqB,EAAE,oBAAoB,EAAE,CAAC;QAC9C,iBAAiB,EAAE,gBAAgB,EAAE,CAAC;KACtC,CAAC;CAgCF"}
@@ -30,6 +30,7 @@ const CAPTCHA_TABLES = [
30
30
  class CaptchaDatabase extends MongoDatabase {
31
31
  constructor(url, dbname, authSource, logger2) {
32
32
  super(url, dbname, authSource, logger2);
33
+ this.indexesEnsured = false;
33
34
  this.tables = {};
34
35
  }
35
36
  async connect() {
@@ -49,6 +50,37 @@ class CaptchaDatabase extends MongoDatabase {
49
50
  }
50
51
  return this.tables;
51
52
  }
53
+ async ensureIndexes() {
54
+ const indexPromises = [];
55
+ if (!this.indexesEnsured) {
56
+ CAPTCHA_TABLES.map(({ collectionName }) => {
57
+ indexPromises.push(
58
+ new Promise((resolve) => {
59
+ if (this.connected) {
60
+ this.tables[collectionName].collection.dropIndexes().then(() => {
61
+ this.tables[collectionName].ensureIndexes().then(() => {
62
+ resolve();
63
+ }).catch((err) => {
64
+ this.logger.warn(() => ({
65
+ err,
66
+ msg: `Error creating indexes for collection ${collectionName}`
67
+ }));
68
+ resolve();
69
+ });
70
+ });
71
+ } else {
72
+ this.logger.info(() => ({
73
+ msg: `Skipping index creation for collection ${collectionName} as not connected`
74
+ }));
75
+ resolve();
76
+ }
77
+ })
78
+ );
79
+ });
80
+ }
81
+ await Promise.all(indexPromises);
82
+ this.indexesEnsured = true;
83
+ }
52
84
  async saveCaptchas(sessionEvents, imageCaptchaEvents, powCaptchaEvents) {
53
85
  await this.connect();
54
86
  if (sessionEvents.length) {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captcha.js","sourceRoot":"","sources":["../../src/databases/captcha.ts"],"names":[],"mappings":"AAcA,OAAO,EAAe,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAIN,4BAA4B,EAE5B,yBAAyB,EACzB,gCAAgC,GAGhC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAElD,IAAK,UAKJ;AALD,WAAK,UAAU;IACd,qDAAuC,CAAA;IACvC,iCAAmB,CAAA;IACnB,uCAAyB,CAAA;IACzB,uCAAyB,CAAA;AAC1B,CAAC,EALI,UAAU,KAAV,UAAU,QAKd;AAED,MAAM,cAAc,GAAG;IACtB;QACC,cAAc,EAAE,UAAU,CAAC,OAAO;QAClC,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,yBAAyB;KACjC;IACD;QACC,cAAc,EAAE,UAAU,CAAC,UAAU;QACrC,SAAS,EAAE,YAAY;QACvB,MAAM,EAAE,4BAA4B;KACpC;IACD;QACC,cAAc,EAAE,UAAU,CAAC,UAAU;QACrC,SAAS,EAAE,gBAAgB;QAC3B,MAAM,EAAE,gCAAgC;KACxC;CACD,CAAC;AAEF,MAAM,OAAO,eAAgB,SAAQ,aAAa;IAIjD,YACC,GAAW,EACX,MAAe,EACf,UAAmB,EACnB,MAAe;QAEf,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QARhC,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C,KAAK,EAAE,CAAC;QACpB,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,12 @@
1
+ import { type Logger } from "@prosopo/common";
2
+ import type { Timestamp } from "@prosopo/types";
3
+ import { type ClientRecord, type IClientDatabase, TableNames, type Tables } from "@prosopo/types-database";
4
+ import { MongoDatabase } from "../base/index.js";
5
+ export declare class ClientDatabase extends MongoDatabase implements IClientDatabase {
6
+ tables: Tables<TableNames>;
7
+ constructor(url: string, dbname?: string, authSource?: string, logger?: Logger);
8
+ connect(): Promise<void>;
9
+ getTables(): Tables<TableNames>;
10
+ getUpdatedClients(updatedAtTimestamp: Timestamp): Promise<ClientRecord[]>;
11
+ }
12
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/databases/client.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,MAAM,EAAkB,MAAM,iBAAiB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAEN,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,UAAU,EACV,KAAK,MAAM,EACX,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAUjD,qBAAa,cAAe,SAAQ,aAAc,YAAW,eAAe;IAC3E,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;gBAG1B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,MAAM;IAMD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IASvC,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC;IAUzB,iBAAiB,CACtB,kBAAkB,EAAE,SAAS,GAC3B,OAAO,CAAC,YAAY,EAAE,CAAC;CA6B1B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRo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ACtB,kBAA6B;QAE7B,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QAErB,MAAM,gBAAgB,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ;aACjD,IAAI,CACJ;YACC,GAAG,EAAE;gBACJ,EAAE,iBAAiB,EAAE,EAAE,GAAG,EAAE,kBAAkB,EAAE,EAAE;gBAClD,EAAE,iBAAiB,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE;aACzC;YACD,cAAc,EAAE,QAAQ;SACxB,EACD,EAAE,eAAe,EAAE,CAAC,EAAE,gBAAgB,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,CAC5D;aACA,IAAI,EAAE;aACN,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CACjB,OAAO,CAAC,GAAG,CACV,CAAC,MAAM,EAAE,EAAE,CACV,CAAC;YACA,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO;YAC7B,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,QAAQ;YAC/B,IAAI,EAAE,MAAM,CAAC,IAAI;SACjB,CAAiB,CACnB,CACD,CAAC;QAEH,MAAM,IAAI,CAAC,KAAK,EAAE,CAAC;QACnB,OAAO,gBAAgB,CAAC;IACzB,CAAC;CACD"}
@@ -0,0 +1,16 @@
1
+ import { MongoDatabase } from "../base/mongo.js";
2
+ import { MongoMemoryDatabase } from "../base/mongoMemory.js";
3
+ import { CaptchaDatabase } from "./captcha.js";
4
+ import { ClientDatabase } from "./client.js";
5
+ import { ProviderDatabase } from "./provider.js";
6
+ export * from "./captcha.js";
7
+ export * from "./client.js";
8
+ export { ProviderDatabase } from "./provider.js";
9
+ export declare const Databases: {
10
+ mongo: typeof MongoDatabase;
11
+ provider: typeof ProviderDatabase;
12
+ client: typeof ClientDatabase;
13
+ captcha: typeof CaptchaDatabase;
14
+ mongoMemory: typeof MongoMemoryDatabase;
15
+ };
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/databases/index.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,eAAO,MAAM,SAAS;;;;;;CAMrB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/databases/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,aAAa;IAC3C,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,gBAAgB;IACjD,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,cAAc;IAC7C,CAAC,aAAa,CAAC,MAAM,CAAC,OAAO,CAAC,EAA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