@prosopo/types-database 4.1.5 → 4.8.0

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.
Files changed (42) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +16 -12
  2. package/.turbo/turbo-build$colon$tsc.log +17 -14
  3. package/.turbo/turbo-build.log +17 -13
  4. package/CHANGELOG.md +506 -0
  5. package/dist/cjs/index.cjs +6 -7
  6. package/dist/cjs/types/bannedDomain.cjs +8 -0
  7. package/dist/cjs/types/client.cjs +77 -5
  8. package/dist/cjs/types/index.cjs +6 -7
  9. package/dist/cjs/types/provider.cjs +298 -88
  10. package/dist/cjs/types/spamEmailDomain.cjs +8 -0
  11. package/dist/index.d.ts +0 -1
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +8 -9
  14. package/dist/types/bannedDomain.d.ts +15 -0
  15. package/dist/types/bannedDomain.d.ts.map +1 -0
  16. package/dist/types/bannedDomain.js +8 -0
  17. package/dist/types/bannedDomain.js.map +1 -0
  18. package/dist/types/captcha.d.ts +2 -2
  19. package/dist/types/captcha.d.ts.map +1 -1
  20. package/dist/types/captcha.js.map +1 -1
  21. package/dist/types/client.d.ts +111 -12
  22. package/dist/types/client.d.ts.map +1 -1
  23. package/dist/types/client.js +78 -6
  24. package/dist/types/client.js.map +1 -1
  25. package/dist/types/index.d.ts +2 -0
  26. package/dist/types/index.d.ts.map +1 -1
  27. package/dist/types/index.js +8 -9
  28. package/dist/types/index.js.map +1 -1
  29. package/dist/types/mongo.d.ts +1 -1
  30. package/dist/types/provider.d.ts +59 -463
  31. package/dist/types/provider.d.ts.map +1 -1
  32. package/dist/types/provider.js +300 -90
  33. package/dist/types/provider.js.map +1 -1
  34. package/dist/types/spamEmailDomain.d.ts +15 -0
  35. package/dist/types/spamEmailDomain.d.ts.map +1 -0
  36. package/dist/types/spamEmailDomain.js +8 -0
  37. package/dist/types/spamEmailDomain.js.map +1 -0
  38. package/package.json +9 -7
  39. package/dist/provider/pendingCaptchaRequest.d.ts +0 -14
  40. package/dist/provider/pendingCaptchaRequest.d.ts.map +0 -1
  41. package/dist/provider/pendingCaptchaRequest.js +0 -2
  42. package/dist/provider/pendingCaptchaRequest.js.map +0 -1
@@ -1,13 +1,12 @@
1
1
  import { type TranslationKey } from "@prosopo/locale";
2
- import { CaptchaType, ContextType } from "@prosopo/types";
3
- import { type Captcha, type CaptchaResult, type CaptchaSolution, type CaptchaStates, CaptchaStatus, type Commit, type Dataset, type DatasetBase, type DatasetWithIds, type Hash, type IUserData, type PoWCaptchaUser, type PoWChallengeComponents, type PoWChallengeId, type RequestHeaders, ScheduledTaskNames, type ScheduledTaskResult, ScheduledTaskStatus } from "@prosopo/types";
2
+ import { type ClientContextEntropy, type CompositeIpAddress, ContextType, type DecisionMachineArtifact, DecisionMachineScope, type DetectorKey, IpAddressType, type PendingImageCaptchaRequest, type PoWCaptchaStored, type PuzzleCaptchaStored, type Session, type SimdReadingsStage, type SolutionRecord, type UserCommitment, type UserSolutionSchema } from "@prosopo/types";
3
+ import { type Captcha, type CaptchaResult, type CaptchaSolution, type CaptchaStates, type Dataset, type DatasetBase, type DatasetWithIds, type Hash, type IPInfoResponse, type IUserData, type PoWChallengeComponents, type PoWChallengeId, type RequestHeaders, ScheduledTaskNames, type ScheduledTaskResult, ScheduledTaskStatus } from "@prosopo/types";
4
4
  import type { AccessRulesStorage } from "@prosopo/user-access-policy";
5
5
  import type mongoose from "mongoose";
6
6
  import { type Document, type Model, type ObjectId, Schema } from "mongoose";
7
7
  import { type infer as zInfer } from "zod";
8
- import type { PendingCaptchaRequest } from "../provider/pendingCaptchaRequest.js";
9
8
  import type { IDatabase } from "./mongo.js";
10
- import type { UserAgentInfo } from "./userAgent.js";
9
+ import type { SpamEmailDomainRecord } from "./spamEmailDomain.js";
11
10
  export type IUserDataSlim = Pick<IUserData, "account" | "settings" | "tier">;
12
11
  export type ClientRecord = IUserDataSlim & Document;
13
12
  export declare const ClientRecordSchema: mongoose.Schema<ClientRecord, mongoose.Model<ClientRecord, any, any, any, mongoose.Document<unknown, any, ClientRecord> & IUserDataSlim & mongoose.Document<unknown, any, any> & Required<{
@@ -19,28 +18,6 @@ export declare const ClientRecordSchema: mongoose.Schema<ClientRecord, mongoose.
19
18
  }> & {
20
19
  __v: number;
21
20
  }>;
22
- export declare enum IpAddressType {
23
- v4 = "v4",
24
- v6 = "v6"
25
- }
26
- export interface CompositeIpAddress {
27
- lower: number | bigint;
28
- upper?: number | bigint;
29
- type: IpAddressType;
30
- }
31
- export declare const CompositeIpAddressSchema: import("zod").ZodObject<{
32
- lower: import("zod").ZodBigInt;
33
- upper: import("zod").ZodOptional<import("zod").ZodBigInt>;
34
- type: import("zod").ZodNativeEnum<typeof IpAddressType>;
35
- }, "strip", import("zod").ZodTypeAny, {
36
- type: IpAddressType;
37
- lower: bigint;
38
- upper?: bigint | undefined;
39
- }, {
40
- type: IpAddressType;
41
- lower: bigint;
42
- upper?: bigint | undefined;
43
- }>;
44
21
  export declare const CompositeIpAddressRecordSchemaObj: {
45
22
  lower: {
46
23
  type: typeof Schema.Types.Decimal128;
@@ -58,180 +35,9 @@ export declare const CompositeIpAddressRecordSchemaObj: {
58
35
  required: boolean;
59
36
  };
60
37
  };
61
- export type MongooseCompositeIpAddress = {
62
- lower: {
63
- $numberDecimal: string;
64
- };
65
- upper?: {
66
- $numberDecimal: string;
67
- };
68
- type: IpAddressType;
69
- };
70
- export declare const parseMongooseCompositeIpAddress: (ip: MongooseCompositeIpAddress) => CompositeIpAddress;
71
- export interface BehavioralDataPacked {
72
- c1: unknown[];
73
- c2: unknown[];
74
- c3: unknown[];
75
- d: string;
76
- }
77
- export interface StoredCaptcha {
78
- result: {
79
- status: CaptchaStatus;
80
- reason?: TranslationKey;
81
- error?: string;
82
- };
83
- requestedAtTimestamp: Date;
84
- deadlineTimestamp?: Date;
85
- ipAddress: CompositeIpAddress;
86
- providedIp?: CompositeIpAddress;
87
- headers: RequestHeaders;
88
- ja4: string;
89
- userSubmitted: boolean;
90
- serverChecked: boolean;
91
- geolocation?: string;
92
- vpn?: boolean;
93
- parsedUserAgentInfo?: UserAgentInfo;
94
- storedAtTimestamp?: Date;
95
- lastUpdatedTimestamp?: Date;
96
- sessionId?: string;
97
- coords?: [number, number][][];
98
- mouseEvents?: Array<Record<string, unknown>>;
99
- touchEvents?: Array<Record<string, unknown>>;
100
- clickEvents?: Array<Record<string, unknown>>;
101
- deviceCapability?: string;
102
- behavioralDataPacked?: BehavioralDataPacked;
103
- }
104
- export interface UserCommitment extends Commit, StoredCaptcha {
105
- userSignature: string;
106
- }
107
- export interface PoWCaptchaStored extends Omit<PoWCaptchaUser, "requestedAtTimestamp">, StoredCaptcha {
108
- }
109
- export declare const UserCommitmentSchema: import("zod").ZodObject<{
110
- userAccount: import("zod").ZodString;
111
- dappAccount: import("zod").ZodString;
112
- datasetId: import("zod").ZodString;
113
- providerAccount: import("zod").ZodString;
114
- id: import("zod").ZodString;
115
- result: import("zod").ZodObject<{
116
- status: import("zod").ZodNativeEnum<typeof CaptchaStatus>;
117
- reason: import("zod").ZodOptional<import("zod").ZodEnum<[string, ...string[]]>>;
118
- error: import("zod").ZodOptional<import("zod").ZodString>;
119
- }, "strip", import("zod").ZodTypeAny, {
120
- status: CaptchaStatus;
121
- error?: string | undefined;
122
- reason?: string | undefined;
123
- }, {
124
- status: CaptchaStatus;
125
- error?: string | undefined;
126
- reason?: string | undefined;
127
- }>;
128
- userSignature: import("zod").ZodString;
129
- ipAddress: import("zod").ZodObject<{
130
- lower: import("zod").ZodBigInt;
131
- upper: import("zod").ZodOptional<import("zod").ZodBigInt>;
132
- type: import("zod").ZodNativeEnum<typeof IpAddressType>;
133
- }, "strip", import("zod").ZodTypeAny, {
134
- type: IpAddressType;
135
- lower: bigint;
136
- upper?: bigint | undefined;
137
- }, {
138
- type: IpAddressType;
139
- lower: bigint;
140
- upper?: bigint | undefined;
141
- }>;
142
- providedIp: import("zod").ZodOptional<import("zod").ZodObject<{
143
- lower: import("zod").ZodBigInt;
144
- upper: import("zod").ZodOptional<import("zod").ZodBigInt>;
145
- type: import("zod").ZodNativeEnum<typeof IpAddressType>;
146
- }, "strip", import("zod").ZodTypeAny, {
147
- type: IpAddressType;
148
- lower: bigint;
149
- upper?: bigint | undefined;
150
- }, {
151
- type: IpAddressType;
152
- lower: bigint;
153
- upper?: bigint | undefined;
154
- }>>;
155
- headers: import("zod").ZodObject<{}, "strip", import("zod").ZodString, import("zod").objectOutputType<{}, import("zod").ZodString, "strip">, import("zod").objectInputType<{}, import("zod").ZodString, "strip">>;
156
- ja4: import("zod").ZodString;
157
- userSubmitted: import("zod").ZodBoolean;
158
- serverChecked: import("zod").ZodBoolean;
159
- storedAtTimestamp: import("zod").ZodOptional<import("zod").ZodDate>;
160
- requestedAtTimestamp: import("zod").ZodDate;
161
- lastUpdatedTimestamp: import("zod").ZodOptional<import("zod").ZodDate>;
162
- sessionId: import("zod").ZodOptional<import("zod").ZodString>;
163
- coords: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodNumber, "many">, "many">, "many">>;
164
- }, "strip", import("zod").ZodTypeAny, {
165
- id: string;
166
- result: {
167
- status: CaptchaStatus;
168
- error?: string | undefined;
169
- reason?: string | undefined;
170
- };
171
- requestedAtTimestamp: Date;
172
- userAccount: string;
173
- dappAccount: string;
174
- userSignature: string;
175
- datasetId: string;
176
- providerAccount: string;
177
- ipAddress: {
178
- type: IpAddressType;
179
- lower: bigint;
180
- upper?: bigint | undefined;
181
- };
182
- headers: {} & {
183
- [k: string]: string;
184
- };
185
- ja4: string;
186
- userSubmitted: boolean;
187
- serverChecked: boolean;
188
- providedIp?: {
189
- type: IpAddressType;
190
- lower: bigint;
191
- upper?: bigint | undefined;
192
- } | undefined;
193
- storedAtTimestamp?: Date | undefined;
194
- lastUpdatedTimestamp?: Date | undefined;
195
- sessionId?: string | undefined;
196
- coords?: number[][][] | undefined;
197
- }, {
198
- id: string;
199
- result: {
200
- status: CaptchaStatus;
201
- error?: string | undefined;
202
- reason?: string | undefined;
203
- };
204
- requestedAtTimestamp: Date;
205
- userAccount: string;
206
- dappAccount: string;
207
- userSignature: string;
208
- datasetId: string;
209
- providerAccount: string;
210
- ipAddress: {
211
- type: IpAddressType;
212
- lower: bigint;
213
- upper?: bigint | undefined;
214
- };
215
- headers: {} & {
216
- [k: string]: string;
217
- };
218
- ja4: string;
219
- userSubmitted: boolean;
220
- serverChecked: boolean;
221
- providedIp?: {
222
- type: IpAddressType;
223
- lower: bigint;
224
- upper?: bigint | undefined;
225
- } | undefined;
226
- storedAtTimestamp?: Date | undefined;
227
- lastUpdatedTimestamp?: Date | undefined;
228
- sessionId?: string | undefined;
229
- coords?: number[][][] | undefined;
230
- }>;
231
- export interface SolutionRecord extends CaptchaSolution {
232
- datasetId: string;
233
- datasetContentId: string;
234
- }
38
+ export type PoWCaptchaRecord = mongoose.Document & PoWCaptchaStored;
39
+ export type PuzzleCaptchaRecord = mongoose.Document & PuzzleCaptchaStored;
40
+ export type UserCommitmentRecord = mongoose.Document & UserCommitment;
235
41
  export type Tables<E extends string | number | symbol> = {
236
42
  [key in E]: typeof Model<any>;
237
43
  };
@@ -244,8 +50,6 @@ export declare const CaptchaRecordSchema: mongoose.Schema<Captcha, mongoose.Mode
244
50
  } & {
245
51
  __v: number;
246
52
  }>;
247
- export type PoWCaptchaRecord = mongoose.Document & PoWCaptchaStored;
248
- export type UserCommitmentRecord = mongoose.Document & UserCommitment;
249
53
  export declare const PoWCaptchaRecordSchema: mongoose.Schema<PoWCaptchaRecord, mongoose.Model<PoWCaptchaRecord, any, any, any, mongoose.Document<unknown, any, PoWCaptchaRecord> & mongoose.Document<unknown, any, any> & PoWCaptchaStored & Required<{
250
54
  _id: unknown;
251
55
  }> & {
@@ -255,6 +59,15 @@ export declare const PoWCaptchaRecordSchema: mongoose.Schema<PoWCaptchaRecord, m
255
59
  }> & {
256
60
  __v: number;
257
61
  }>;
62
+ export declare const PuzzleCaptchaRecordSchema: mongoose.Schema<PuzzleCaptchaRecord, mongoose.Model<PuzzleCaptchaRecord, any, any, any, mongoose.Document<unknown, any, PuzzleCaptchaRecord> & mongoose.Document<unknown, any, any> & PuzzleCaptchaStored & Required<{
63
+ _id: unknown;
64
+ }> & {
65
+ __v: number;
66
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, PuzzleCaptchaRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<PuzzleCaptchaRecord>> & mongoose.FlatRecord<PuzzleCaptchaRecord> & Required<{
67
+ _id: unknown;
68
+ }> & {
69
+ __v: number;
70
+ }>;
258
71
  export declare const UserCommitmentRecordSchema: mongoose.Schema<UserCommitmentRecord, mongoose.Model<UserCommitmentRecord, any, any, any, mongoose.Document<unknown, any, UserCommitmentRecord> & mongoose.Document<unknown, any, any> & UserCommitment & Required<{
259
72
  _id: unknown;
260
73
  }> & {
@@ -282,45 +95,16 @@ export declare const SolutionRecordSchema: mongoose.Schema<SolutionRecord, mongo
282
95
  } & {
283
96
  __v: number;
284
97
  }>;
285
- export declare const UserSolutionSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<{
286
- captchaId: import("zod").ZodString;
287
- captchaContentId: import("zod").ZodString;
288
- solution: import("zod").ZodArray<import("zod").ZodString, "many">;
289
- salt: import("zod").ZodString;
290
- }, {
291
- processed: import("zod").ZodBoolean;
292
- checked: import("zod").ZodBoolean;
293
- commitmentId: import("zod").ZodString;
294
- createdAt: import("zod").ZodDate;
295
- }>, "strip", import("zod").ZodTypeAny, {
296
- createdAt: Date;
98
+ export type UserSolutionRecord = mongoose.Document & zInfer<typeof UserSolutionSchema>;
99
+ export declare const UserSolutionRecordSchema: mongoose.Schema<UserSolutionRecord, mongoose.Model<UserSolutionRecord, any, any, any, mongoose.Document<unknown, any, UserSolutionRecord> & mongoose.Document<unknown, any, any> & {
297
100
  captchaId: string;
298
101
  captchaContentId: string;
299
- solution: string[];
300
102
  salt: string;
301
- processed: boolean;
302
- checked: boolean;
303
- commitmentId: string;
304
- }, {
305
- createdAt: Date;
306
- captchaId: string;
307
- captchaContentId: string;
308
103
  solution: string[];
309
- salt: string;
310
- processed: boolean;
311
- checked: boolean;
312
104
  commitmentId: string;
313
- }>;
314
- export type UserSolutionRecord = mongoose.Document & zInfer<typeof UserSolutionSchema>;
315
- export declare const UserSolutionRecordSchema: mongoose.Schema<UserSolutionRecord, mongoose.Model<UserSolutionRecord, any, any, any, mongoose.Document<unknown, any, UserSolutionRecord> & mongoose.Document<unknown, any, any> & {
316
105
  createdAt: Date;
317
- captchaId: string;
318
- captchaContentId: string;
319
- solution: string[];
320
- salt: string;
321
106
  processed: boolean;
322
107
  checked: boolean;
323
- commitmentId: string;
324
108
  } & Required<{
325
109
  _id: unknown;
326
110
  }> & {
@@ -330,189 +114,6 @@ export declare const UserSolutionRecordSchema: mongoose.Schema<UserSolutionRecor
330
114
  }> & {
331
115
  __v: number;
332
116
  }>;
333
- export declare const UserCommitmentWithSolutionsSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<{
334
- userAccount: import("zod").ZodString;
335
- dappAccount: import("zod").ZodString;
336
- datasetId: import("zod").ZodString;
337
- providerAccount: import("zod").ZodString;
338
- id: import("zod").ZodString;
339
- result: import("zod").ZodObject<{
340
- status: import("zod").ZodNativeEnum<typeof CaptchaStatus>;
341
- reason: import("zod").ZodOptional<import("zod").ZodEnum<[string, ...string[]]>>;
342
- error: import("zod").ZodOptional<import("zod").ZodString>;
343
- }, "strip", import("zod").ZodTypeAny, {
344
- status: CaptchaStatus;
345
- error?: string | undefined;
346
- reason?: string | undefined;
347
- }, {
348
- status: CaptchaStatus;
349
- error?: string | undefined;
350
- reason?: string | undefined;
351
- }>;
352
- userSignature: import("zod").ZodString;
353
- ipAddress: import("zod").ZodObject<{
354
- lower: import("zod").ZodBigInt;
355
- upper: import("zod").ZodOptional<import("zod").ZodBigInt>;
356
- type: import("zod").ZodNativeEnum<typeof IpAddressType>;
357
- }, "strip", import("zod").ZodTypeAny, {
358
- type: IpAddressType;
359
- lower: bigint;
360
- upper?: bigint | undefined;
361
- }, {
362
- type: IpAddressType;
363
- lower: bigint;
364
- upper?: bigint | undefined;
365
- }>;
366
- providedIp: import("zod").ZodOptional<import("zod").ZodObject<{
367
- lower: import("zod").ZodBigInt;
368
- upper: import("zod").ZodOptional<import("zod").ZodBigInt>;
369
- type: import("zod").ZodNativeEnum<typeof IpAddressType>;
370
- }, "strip", import("zod").ZodTypeAny, {
371
- type: IpAddressType;
372
- lower: bigint;
373
- upper?: bigint | undefined;
374
- }, {
375
- type: IpAddressType;
376
- lower: bigint;
377
- upper?: bigint | undefined;
378
- }>>;
379
- headers: import("zod").ZodObject<{}, "strip", import("zod").ZodString, import("zod").objectOutputType<{}, import("zod").ZodString, "strip">, import("zod").objectInputType<{}, import("zod").ZodString, "strip">>;
380
- ja4: import("zod").ZodString;
381
- userSubmitted: import("zod").ZodBoolean;
382
- serverChecked: import("zod").ZodBoolean;
383
- storedAtTimestamp: import("zod").ZodOptional<import("zod").ZodDate>;
384
- requestedAtTimestamp: import("zod").ZodDate;
385
- lastUpdatedTimestamp: import("zod").ZodOptional<import("zod").ZodDate>;
386
- sessionId: import("zod").ZodOptional<import("zod").ZodString>;
387
- coords: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodNumber, "many">, "many">, "many">>;
388
- }, {
389
- captchas: import("zod").ZodArray<import("zod").ZodObject<import("zod").objectUtil.extendShape<{
390
- captchaId: import("zod").ZodString;
391
- captchaContentId: import("zod").ZodString;
392
- solution: import("zod").ZodArray<import("zod").ZodString, "many">;
393
- salt: import("zod").ZodString;
394
- }, {
395
- processed: import("zod").ZodBoolean;
396
- checked: import("zod").ZodBoolean;
397
- commitmentId: import("zod").ZodString;
398
- createdAt: import("zod").ZodDate;
399
- }>, "strip", import("zod").ZodTypeAny, {
400
- createdAt: Date;
401
- captchaId: string;
402
- captchaContentId: string;
403
- solution: string[];
404
- salt: string;
405
- processed: boolean;
406
- checked: boolean;
407
- commitmentId: string;
408
- }, {
409
- createdAt: Date;
410
- captchaId: string;
411
- captchaContentId: string;
412
- solution: string[];
413
- salt: string;
414
- processed: boolean;
415
- checked: boolean;
416
- commitmentId: string;
417
- }>, "many">;
418
- }>, "strip", import("zod").ZodTypeAny, {
419
- id: string;
420
- result: {
421
- status: CaptchaStatus;
422
- error?: string | undefined;
423
- reason?: string | undefined;
424
- };
425
- requestedAtTimestamp: Date;
426
- userAccount: string;
427
- dappAccount: string;
428
- userSignature: string;
429
- datasetId: string;
430
- providerAccount: string;
431
- ipAddress: {
432
- type: IpAddressType;
433
- lower: bigint;
434
- upper?: bigint | undefined;
435
- };
436
- headers: {} & {
437
- [k: string]: string;
438
- };
439
- ja4: string;
440
- userSubmitted: boolean;
441
- serverChecked: boolean;
442
- captchas: {
443
- createdAt: Date;
444
- captchaId: string;
445
- captchaContentId: string;
446
- solution: string[];
447
- salt: string;
448
- processed: boolean;
449
- checked: boolean;
450
- commitmentId: string;
451
- }[];
452
- providedIp?: {
453
- type: IpAddressType;
454
- lower: bigint;
455
- upper?: bigint | undefined;
456
- } | undefined;
457
- storedAtTimestamp?: Date | undefined;
458
- lastUpdatedTimestamp?: Date | undefined;
459
- sessionId?: string | undefined;
460
- coords?: number[][][] | undefined;
461
- }, {
462
- id: string;
463
- result: {
464
- status: CaptchaStatus;
465
- error?: string | undefined;
466
- reason?: string | undefined;
467
- };
468
- requestedAtTimestamp: Date;
469
- userAccount: string;
470
- dappAccount: string;
471
- userSignature: string;
472
- datasetId: string;
473
- providerAccount: string;
474
- ipAddress: {
475
- type: IpAddressType;
476
- lower: bigint;
477
- upper?: bigint | undefined;
478
- };
479
- headers: {} & {
480
- [k: string]: string;
481
- };
482
- ja4: string;
483
- userSubmitted: boolean;
484
- serverChecked: boolean;
485
- captchas: {
486
- createdAt: Date;
487
- captchaId: string;
488
- captchaContentId: string;
489
- solution: string[];
490
- salt: string;
491
- processed: boolean;
492
- checked: boolean;
493
- commitmentId: string;
494
- }[];
495
- providedIp?: {
496
- type: IpAddressType;
497
- lower: bigint;
498
- upper?: bigint | undefined;
499
- } | undefined;
500
- storedAtTimestamp?: Date | undefined;
501
- lastUpdatedTimestamp?: Date | undefined;
502
- sessionId?: string | undefined;
503
- coords?: number[][][] | undefined;
504
- }>;
505
- export type UserCommitmentWithSolutions = zInfer<typeof UserCommitmentWithSolutionsSchema>;
506
- export type PendingCaptchaRequestMongoose = PendingCaptchaRequest;
507
- export declare const PendingRecordSchema: mongoose.Schema<PendingCaptchaRequest, mongoose.Model<PendingCaptchaRequest, any, any, any, mongoose.Document<unknown, any, PendingCaptchaRequest> & PendingCaptchaRequest & {
508
- _id: mongoose.Types.ObjectId;
509
- } & {
510
- __v: number;
511
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, PendingCaptchaRequest, mongoose.Document<unknown, {}, mongoose.FlatRecord<PendingCaptchaRequest>> & mongoose.FlatRecord<PendingCaptchaRequest> & {
512
- _id: mongoose.Types.ObjectId;
513
- } & {
514
- __v: number;
515
- }>;
516
117
  export declare const ScheduledTaskSchema: import("zod").ZodObject<{
517
118
  processName: import("zod").ZodNativeEnum<typeof ScheduledTaskNames>;
518
119
  datetime: import("zod").ZodDate;
@@ -567,35 +168,6 @@ export declare const ScheduledTaskRecordSchema: mongoose.Schema<ScheduledTaskRec
567
168
  }> & {
568
169
  __v: number;
569
170
  }>;
570
- export interface ScoreComponents {
571
- baseScore: number;
572
- lScore?: number;
573
- timeout?: number;
574
- accessPolicy?: number;
575
- unverifiedHost?: number;
576
- webView?: number;
577
- }
578
- export type Session = {
579
- sessionId: string;
580
- createdAt: Date;
581
- token: string;
582
- score: number;
583
- threshold: number;
584
- scoreComponents: ScoreComponents;
585
- providerSelectEntropy: number;
586
- ipAddress: CompositeIpAddress;
587
- captchaType: CaptchaType;
588
- solvedImagesCount?: number;
589
- powDifficulty?: number;
590
- storedAtTimestamp?: Date;
591
- lastUpdatedTimestamp?: Date;
592
- deleted?: boolean;
593
- userSitekeyIpHash?: string;
594
- webView: boolean;
595
- iFrame: boolean;
596
- decryptedHeadHash: string;
597
- reason?: string;
598
- };
599
171
  export type SessionRecord = mongoose.Document & Session;
600
172
  export declare const SessionRecordSchema: mongoose.Schema<SessionRecord, mongoose.Model<SessionRecord, any, any, any, mongoose.Document<unknown, any, SessionRecord> & mongoose.Document<unknown, any, any> & Session & Required<{
601
173
  _id: unknown;
@@ -606,11 +178,6 @@ export declare const SessionRecordSchema: mongoose.Schema<SessionRecord, mongoos
606
178
  }> & {
607
179
  __v: number;
608
180
  }>;
609
- export type DetectorKey = {
610
- detectorKey: string;
611
- createdAt: Date;
612
- expiresAt?: Date;
613
- };
614
181
  export type DetectorSchema = mongoose.Document & DetectorKey;
615
182
  export declare const DetectorRecordSchema: mongoose.Schema<DetectorSchema, mongoose.Model<DetectorSchema, any, any, any, mongoose.Document<unknown, any, DetectorSchema> & mongoose.Document<unknown, any, any> & DetectorKey & Required<{
616
183
  _id: unknown;
@@ -621,13 +188,16 @@ export declare const DetectorRecordSchema: mongoose.Schema<DetectorSchema, mongo
621
188
  }> & {
622
189
  __v: number;
623
190
  }>;
624
- export type ClientContextEntropy = {
625
- account: string;
626
- contextType: ContextType;
627
- entropy: string;
628
- createdAt: Date;
629
- updatedAt: Date;
630
- };
191
+ export type DecisionMachineArtifactRecord = mongoose.Document & DecisionMachineArtifact;
192
+ export declare const DecisionMachineArtifactRecordSchema: mongoose.Schema<DecisionMachineArtifactRecord, mongoose.Model<DecisionMachineArtifactRecord, any, any, any, mongoose.Document<unknown, any, DecisionMachineArtifactRecord> & mongoose.Document<unknown, any, any> & DecisionMachineArtifact & Required<{
193
+ _id: unknown;
194
+ }> & {
195
+ __v: number;
196
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, DecisionMachineArtifactRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<DecisionMachineArtifactRecord>> & mongoose.FlatRecord<DecisionMachineArtifactRecord> & Required<{
197
+ _id: unknown;
198
+ }> & {
199
+ __v: number;
200
+ }>;
631
201
  export type ClientContextEntropyRecord = mongoose.Document & ClientContextEntropy;
632
202
  export declare const ClientContextEntropyRecordSchema: mongoose.Schema<ClientContextEntropyRecord, mongoose.Model<ClientContextEntropyRecord, any, any, any, mongoose.Document<unknown, any, ClientContextEntropyRecord> & mongoose.Document<unknown, any, any> & ClientContextEntropy & Required<{
633
203
  _id: unknown;
@@ -651,8 +221,8 @@ export interface IProviderDatabase extends IDatabase {
651
221
  removeCaptchas(captchaIds: string[]): Promise<void>;
652
222
  getDatasetDetails(datasetId: Hash | string | Uint8Array): Promise<DatasetBase>;
653
223
  storeUserImageCaptchaSolution(captchas: CaptchaSolution[], commit: UserCommitment): Promise<void>;
654
- storePendingImageCommitment(userAccount: string, requestHash: string, salt: string, deadlineTimestamp: number, requestedAtTimestamp: number, ipAddress: CompositeIpAddress, threshold: number, sessionId?: string): Promise<void>;
655
- getPendingImageCommitment(requestHash: string): Promise<PendingCaptchaRequest>;
224
+ storePendingImageCommitment(userAccount: string, requestHash: string, salt: string, deadlineTimestamp: Date, requestedAtTimestamp: Date, ipAddress: CompositeIpAddress, threshold: number, sessionId?: string, ipInfo?: IPInfoResponse): Promise<void>;
225
+ getPendingImageCommitment(requestHash: string): Promise<PendingImageCaptchaRequest>;
656
226
  updatePendingImageCommitmentStatus(requestHash: string): Promise<void>;
657
227
  getAllCaptchasByDatasetId(datasetId: string, captchaState?: CaptchaStates): Promise<Captcha[] | undefined>;
658
228
  getAllDappUserSolutions(captchaId: string[]): Promise<UserSolutionRecord[] | undefined>;
@@ -665,38 +235,64 @@ export interface IProviderDatabase extends IDatabase {
665
235
  disapproveDappUserCommitment(commitmentId: string, reason?: TranslationKey, coords?: [number, number][][]): Promise<void>;
666
236
  getCheckedDappUserCommitments(): Promise<UserCommitmentRecord[]>;
667
237
  getUnstoredDappUserCommitments(limit?: number, skip?: number): Promise<UserCommitmentRecord[]>;
668
- markDappUserCommitmentsStored(commitmentIds: Hash[]): Promise<void>;
238
+ markDappUserCommitmentsStored(commitmentIds: Hash[], asOfTimestamp?: Date): Promise<void>;
669
239
  markDappUserCommitmentsChecked(commitmentIds: Hash[]): Promise<void>;
670
240
  updateDappUserCommitment(commitmentId: Hash, updates: Partial<UserCommitment>): Promise<void>;
671
241
  getUnstoredDappUserPoWCommitments(limit?: number, skip?: number): Promise<PoWCaptchaRecord[]>;
672
242
  markDappUserPoWCommitmentsChecked(challengeIds: string[]): Promise<void>;
673
- markDappUserPoWCommitmentsStored(challengeIds: string[]): Promise<void>;
243
+ markDappUserPoWCommitmentsStored(challengeIds: string[], asOfTimestamp?: Date): Promise<void>;
674
244
  flagProcessedDappUserSolutions(captchaIds: Hash[]): Promise<void>;
675
245
  flagProcessedDappUserCommitments(commitmentIds: Hash[]): Promise<void>;
676
246
  getLastScheduledTaskStatus(task: ScheduledTaskNames, status?: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
677
247
  getScheduledTaskStatus(taskId: ObjectId, status: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
678
248
  createScheduledTaskStatus(task: ScheduledTaskNames, status: ScheduledTaskStatus): Promise<ObjectId>;
679
249
  updateScheduledTaskStatus(taskId: ObjectId, status: ScheduledTaskStatus, result?: ScheduledTaskResult): Promise<void>;
680
- storePowCaptchaRecord(challenge: PoWChallengeId, components: PoWChallengeComponents, difficulty: number, providerSignature: string, ipAddress: CompositeIpAddress, headers: RequestHeaders, ja4: string, sessionId?: string, serverChecked?: boolean, userSubmitted?: boolean, userSignature?: string): Promise<void>;
250
+ storePowCaptchaRecord(challenge: PoWChallengeId, components: PoWChallengeComponents, difficulty: number, providerSignature: string, ipAddress: CompositeIpAddress, headers: RequestHeaders, ja4: string, sessionId?: string, serverChecked?: boolean, userSubmitted?: boolean, userSignature?: string, ipInfo?: IPInfoResponse): Promise<void>;
681
251
  getPowCaptchaRecordByChallenge(challenge: string): Promise<PoWCaptchaRecord | null>;
682
252
  updatePowCaptchaRecordResult(challenge: PoWChallengeId, result: CaptchaResult, serverChecked: boolean, userSubmitted: boolean, userSignature?: string, coords?: [number, number][][]): Promise<void>;
683
253
  updatePowCaptchaRecord(challenge: PoWChallengeId, updates: Partial<PoWCaptchaRecord>): Promise<void>;
254
+ storePuzzleCaptchaRecord(challenge: PoWChallengeId, components: PoWChallengeComponents, targetX: number, targetY: number, originX: number, originY: number, tolerance: number, providerSignature: string, ipAddress: CompositeIpAddress, headers: RequestHeaders, ja4: string, sessionId?: string, ipInfo?: IPInfoResponse): Promise<void>;
255
+ getPuzzleCaptchaRecordByChallenge(challenge: string): Promise<PuzzleCaptchaRecord | null>;
256
+ updatePuzzleCaptchaRecordResult(challenge: PoWChallengeId, result: CaptchaResult, serverChecked: boolean, userSubmitted: boolean, userSignature?: string, coords?: [number, number][][], lastUpdatedTimestamp?: Date): Promise<void>;
257
+ updatePuzzleCaptchaRecord(challenge: PoWChallengeId, updates: Partial<PuzzleCaptchaRecord>): Promise<void>;
684
258
  updateClientRecords(clientRecords: ClientRecord[]): Promise<void>;
259
+ removeClientRecords(accounts: string[]): Promise<void>;
685
260
  getAllClientRecords(): Promise<ClientRecord[]>;
686
261
  getClientRecord(account: string): Promise<ClientRecord | undefined>;
687
262
  storeSessionRecord(sessionRecord: Session): Promise<void>;
688
263
  getSessionRecordBySessionId(sessionId: string): Promise<Session | undefined>;
689
264
  getSessionRecordByToken(token: string): Promise<Session | undefined>;
690
265
  checkAndRemoveSession(sessionId: string): Promise<Session | undefined>;
266
+ updateSessionRecord(sessionId: string, updates: Partial<Session>, streamToCentral?: boolean): Promise<void>;
267
+ recordSessionSimdReadingsIfAbsent(sessionId: string, readings: NonNullable<Session["simdReadings"]>, stage: SimdReadingsStage): Promise<void>;
691
268
  getSessionByuserSitekeyIpHash(userSitekeyIpHash: string): Promise<SessionRecord | undefined>;
692
269
  getUnstoredSessionRecords(limit: number, skip: number): Promise<SessionRecord[]>;
693
- markSessionRecordsStored(sessionIds: string[]): Promise<void>;
270
+ markSessionRecordsStored(sessionIds: string[], asOfTimestamp?: Date): Promise<void>;
694
271
  getUserAccessRulesStorage(): AccessRulesStorage;
695
272
  storeDetectorKey(detectorKey: string): Promise<void>;
696
273
  getDetectorKeys(): Promise<string[]>;
697
274
  removeDetectorKey(detectorKey: string, expirationInSeconds?: number): Promise<void>;
275
+ upsertDecisionMachineArtifact(artifact: DecisionMachineArtifact): Promise<void>;
276
+ getDecisionMachineArtifact(scope: DecisionMachineScope, dappAccount?: string): Promise<DecisionMachineArtifact | undefined>;
277
+ getAllDecisionMachineArtifacts(): Promise<(DecisionMachineArtifact & {
278
+ _id: string;
279
+ })[]>;
280
+ getDecisionMachineArtifactById(id: string): Promise<(DecisionMachineArtifact & {
281
+ _id: string;
282
+ }) | undefined>;
283
+ removeDecisionMachineArtifact(id: string): Promise<boolean>;
284
+ removeAllDecisionMachineArtifacts(): Promise<number>;
698
285
  setClientContextEntropy(account: string, contextType: ContextType, entropy: string): Promise<void>;
699
286
  getClientContextEntropy(account: string, contextType: ContextType): Promise<string | undefined>;
700
287
  sampleContextEntropy(sampleSize: number, siteKey: string, contextType: ContextType): Promise<string[]>;
288
+ getSpamEmailDomain(domain: string): Promise<SpamEmailDomainRecord | null>;
289
+ bulkUpdateSpamEmailDomains(domains: Array<{
290
+ filter: {
291
+ domain: string;
292
+ };
293
+ update: {
294
+ domain: string;
295
+ };
296
+ }>, upsert: boolean): Promise<void>;
701
297
  }
702
298
  //# sourceMappingURL=provider.d.ts.map