@prosopo/types-database 3.3.13 → 4.0.5

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.
@@ -1 +0,0 @@
1
- {"version":3,"file":"mongo.js","sourceRoot":"","sources":["../../src/types/mongo.ts"],"names":[],"mappings":""}
@@ -1,667 +0,0 @@
1
- import { type TranslationKey } from "@prosopo/locale";
2
- import { CaptchaType } 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";
4
- import type { AccessRulesStorage } from "@prosopo/user-access-policy";
5
- import type mongoose from "mongoose";
6
- import { type Document, type Model, type ObjectId, Schema } from "mongoose";
7
- import { type infer as zInfer } from "zod";
8
- import type { PendingCaptchaRequest } from "../provider/pendingCaptchaRequest.js";
9
- import type { IDatabase } from "./mongo.js";
10
- import type { UserAgentInfo } from "./userAgent.js";
11
- export type IUserDataSlim = Pick<IUserData, "account" | "settings" | "tier">;
12
- export type ClientRecord = IUserDataSlim & Document;
13
- 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<{
14
- _id: unknown;
15
- }> & {
16
- __v: number;
17
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ClientRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<ClientRecord>> & mongoose.FlatRecord<ClientRecord> & Required<{
18
- _id: unknown;
19
- }> & {
20
- __v: number;
21
- }>;
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
- export declare const CompositeIpAddressRecordSchemaObj: {
45
- lower: {
46
- type: typeof Schema.Types.Decimal128;
47
- required: boolean;
48
- set: (value: bigint | string | number) => string | number;
49
- };
50
- upper: {
51
- type: typeof Schema.Types.Decimal128;
52
- required: boolean;
53
- set: (value: bigint | string | number) => string | number;
54
- };
55
- type: {
56
- type: StringConstructor;
57
- enum: typeof IpAddressType;
58
- required: boolean;
59
- };
60
- };
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 StoredCaptcha {
72
- result: {
73
- status: CaptchaStatus;
74
- reason?: TranslationKey;
75
- error?: string;
76
- };
77
- requestedAtTimestamp: Date;
78
- deadlineTimestamp?: Date;
79
- ipAddress: CompositeIpAddress;
80
- providedIp?: CompositeIpAddress;
81
- headers: RequestHeaders;
82
- ja4: string;
83
- userSubmitted: boolean;
84
- serverChecked: boolean;
85
- geolocation?: string;
86
- vpn?: boolean;
87
- parsedUserAgentInfo?: UserAgentInfo;
88
- storedAtTimestamp?: Date;
89
- lastUpdatedTimestamp?: Date;
90
- sessionId?: string;
91
- coords?: [number, number][][];
92
- }
93
- export interface UserCommitment extends Commit, StoredCaptcha {
94
- userSignature: string;
95
- }
96
- export interface PoWCaptchaStored extends Omit<PoWCaptchaUser, "requestedAtTimestamp">, StoredCaptcha {
97
- }
98
- export declare const UserCommitmentSchema: import("zod").ZodObject<{
99
- userAccount: import("zod").ZodString;
100
- dappAccount: import("zod").ZodString;
101
- datasetId: import("zod").ZodString;
102
- providerAccount: import("zod").ZodString;
103
- id: import("zod").ZodString;
104
- result: import("zod").ZodObject<{
105
- status: import("zod").ZodNativeEnum<typeof CaptchaStatus>;
106
- reason: import("zod").ZodOptional<import("zod").ZodEnum<[string, ...string[]]>>;
107
- error: import("zod").ZodOptional<import("zod").ZodString>;
108
- }, "strip", import("zod").ZodTypeAny, {
109
- status: CaptchaStatus;
110
- error?: string | undefined;
111
- reason?: string | undefined;
112
- }, {
113
- status: CaptchaStatus;
114
- error?: string | undefined;
115
- reason?: string | undefined;
116
- }>;
117
- userSignature: import("zod").ZodString;
118
- ipAddress: import("zod").ZodObject<{
119
- lower: import("zod").ZodBigInt;
120
- upper: import("zod").ZodOptional<import("zod").ZodBigInt>;
121
- type: import("zod").ZodNativeEnum<typeof IpAddressType>;
122
- }, "strip", import("zod").ZodTypeAny, {
123
- type: IpAddressType;
124
- lower: bigint;
125
- upper?: bigint | undefined;
126
- }, {
127
- type: IpAddressType;
128
- lower: bigint;
129
- upper?: bigint | undefined;
130
- }>;
131
- providedIp: import("zod").ZodOptional<import("zod").ZodObject<{
132
- lower: import("zod").ZodBigInt;
133
- upper: import("zod").ZodOptional<import("zod").ZodBigInt>;
134
- type: import("zod").ZodNativeEnum<typeof IpAddressType>;
135
- }, "strip", import("zod").ZodTypeAny, {
136
- type: IpAddressType;
137
- lower: bigint;
138
- upper?: bigint | undefined;
139
- }, {
140
- type: IpAddressType;
141
- lower: bigint;
142
- upper?: bigint | undefined;
143
- }>>;
144
- headers: import("zod").ZodObject<{}, "strip", import("zod").ZodString, import("zod").objectOutputType<{}, import("zod").ZodString, "strip">, import("zod").objectInputType<{}, import("zod").ZodString, "strip">>;
145
- ja4: import("zod").ZodString;
146
- userSubmitted: import("zod").ZodBoolean;
147
- serverChecked: import("zod").ZodBoolean;
148
- storedAtTimestamp: import("zod").ZodOptional<import("zod").ZodDate>;
149
- requestedAtTimestamp: import("zod").ZodDate;
150
- lastUpdatedTimestamp: import("zod").ZodOptional<import("zod").ZodDate>;
151
- sessionId: import("zod").ZodOptional<import("zod").ZodString>;
152
- coords: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodNumber, "many">, "many">, "many">>;
153
- }, "strip", import("zod").ZodTypeAny, {
154
- id: string;
155
- result: {
156
- status: CaptchaStatus;
157
- error?: string | undefined;
158
- reason?: string | undefined;
159
- };
160
- requestedAtTimestamp: Date;
161
- userAccount: string;
162
- dappAccount: string;
163
- userSignature: string;
164
- datasetId: string;
165
- providerAccount: string;
166
- ipAddress: {
167
- type: IpAddressType;
168
- lower: bigint;
169
- upper?: bigint | undefined;
170
- };
171
- headers: {} & {
172
- [k: string]: string;
173
- };
174
- ja4: string;
175
- userSubmitted: boolean;
176
- serverChecked: boolean;
177
- providedIp?: {
178
- type: IpAddressType;
179
- lower: bigint;
180
- upper?: bigint | undefined;
181
- } | undefined;
182
- storedAtTimestamp?: Date | undefined;
183
- lastUpdatedTimestamp?: Date | undefined;
184
- sessionId?: string | undefined;
185
- coords?: number[][][] | undefined;
186
- }, {
187
- id: string;
188
- result: {
189
- status: CaptchaStatus;
190
- error?: string | undefined;
191
- reason?: string | undefined;
192
- };
193
- requestedAtTimestamp: Date;
194
- userAccount: string;
195
- dappAccount: string;
196
- userSignature: string;
197
- datasetId: string;
198
- providerAccount: string;
199
- ipAddress: {
200
- type: IpAddressType;
201
- lower: bigint;
202
- upper?: bigint | undefined;
203
- };
204
- headers: {} & {
205
- [k: string]: string;
206
- };
207
- ja4: string;
208
- userSubmitted: boolean;
209
- serverChecked: boolean;
210
- providedIp?: {
211
- type: IpAddressType;
212
- lower: bigint;
213
- upper?: bigint | undefined;
214
- } | undefined;
215
- storedAtTimestamp?: Date | undefined;
216
- lastUpdatedTimestamp?: Date | undefined;
217
- sessionId?: string | undefined;
218
- coords?: number[][][] | undefined;
219
- }>;
220
- export interface SolutionRecord extends CaptchaSolution {
221
- datasetId: string;
222
- datasetContentId: string;
223
- }
224
- export type Tables<E extends string | number | symbol> = {
225
- [key in E]: typeof Model<any>;
226
- };
227
- export declare const CaptchaRecordSchema: mongoose.Schema<Captcha, mongoose.Model<Captcha, any, any, any, mongoose.Document<unknown, any, Captcha> & Captcha & {
228
- _id: mongoose.Types.ObjectId;
229
- } & {
230
- __v: number;
231
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, Captcha, mongoose.Document<unknown, {}, mongoose.FlatRecord<Captcha>> & mongoose.FlatRecord<Captcha> & {
232
- _id: mongoose.Types.ObjectId;
233
- } & {
234
- __v: number;
235
- }>;
236
- export type PoWCaptchaRecord = mongoose.Document & PoWCaptchaStored;
237
- export type UserCommitmentRecord = mongoose.Document & UserCommitment;
238
- 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<{
239
- _id: unknown;
240
- }> & {
241
- __v: number;
242
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, PoWCaptchaRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<PoWCaptchaRecord>> & mongoose.FlatRecord<PoWCaptchaRecord> & Required<{
243
- _id: unknown;
244
- }> & {
245
- __v: number;
246
- }>;
247
- 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<{
248
- _id: unknown;
249
- }> & {
250
- __v: number;
251
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, UserCommitmentRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<UserCommitmentRecord>> & mongoose.FlatRecord<UserCommitmentRecord> & Required<{
252
- _id: unknown;
253
- }> & {
254
- __v: number;
255
- }>;
256
- export declare const DatasetRecordSchema: mongoose.Schema<DatasetWithIds, mongoose.Model<DatasetWithIds, any, any, any, mongoose.Document<unknown, any, DatasetWithIds> & DatasetWithIds & {
257
- _id: mongoose.Types.ObjectId;
258
- } & {
259
- __v: number;
260
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, DatasetWithIds, mongoose.Document<unknown, {}, mongoose.FlatRecord<DatasetWithIds>> & mongoose.FlatRecord<DatasetWithIds> & {
261
- _id: mongoose.Types.ObjectId;
262
- } & {
263
- __v: number;
264
- }>;
265
- export declare const SolutionRecordSchema: mongoose.Schema<SolutionRecord, mongoose.Model<SolutionRecord, any, any, any, mongoose.Document<unknown, any, SolutionRecord> & SolutionRecord & {
266
- _id: mongoose.Types.ObjectId;
267
- } & {
268
- __v: number;
269
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, SolutionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<SolutionRecord>> & mongoose.FlatRecord<SolutionRecord> & {
270
- _id: mongoose.Types.ObjectId;
271
- } & {
272
- __v: number;
273
- }>;
274
- export declare const UserSolutionSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<{
275
- captchaId: import("zod").ZodString;
276
- captchaContentId: import("zod").ZodString;
277
- solution: import("zod").ZodArray<import("zod").ZodString, "many">;
278
- salt: import("zod").ZodString;
279
- }, {
280
- processed: import("zod").ZodBoolean;
281
- checked: import("zod").ZodBoolean;
282
- commitmentId: import("zod").ZodString;
283
- createdAt: import("zod").ZodDate;
284
- }>, "strip", import("zod").ZodTypeAny, {
285
- createdAt: Date;
286
- captchaId: string;
287
- captchaContentId: string;
288
- solution: string[];
289
- salt: string;
290
- processed: boolean;
291
- checked: boolean;
292
- commitmentId: string;
293
- }, {
294
- createdAt: Date;
295
- captchaId: string;
296
- captchaContentId: string;
297
- solution: string[];
298
- salt: string;
299
- processed: boolean;
300
- checked: boolean;
301
- commitmentId: string;
302
- }>;
303
- export type UserSolutionRecord = mongoose.Document & zInfer<typeof UserSolutionSchema>;
304
- export declare const UserSolutionRecordSchema: mongoose.Schema<UserSolutionRecord, mongoose.Model<UserSolutionRecord, any, any, any, mongoose.Document<unknown, any, UserSolutionRecord> & mongoose.Document<unknown, any, any> & {
305
- createdAt: Date;
306
- captchaId: string;
307
- captchaContentId: string;
308
- solution: string[];
309
- salt: string;
310
- processed: boolean;
311
- checked: boolean;
312
- commitmentId: string;
313
- } & Required<{
314
- _id: unknown;
315
- }> & {
316
- __v: number;
317
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, UserSolutionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<UserSolutionRecord>> & mongoose.FlatRecord<UserSolutionRecord> & Required<{
318
- _id: unknown;
319
- }> & {
320
- __v: number;
321
- }>;
322
- export declare const UserCommitmentWithSolutionsSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<{
323
- userAccount: import("zod").ZodString;
324
- dappAccount: import("zod").ZodString;
325
- datasetId: import("zod").ZodString;
326
- providerAccount: import("zod").ZodString;
327
- id: import("zod").ZodString;
328
- result: import("zod").ZodObject<{
329
- status: import("zod").ZodNativeEnum<typeof CaptchaStatus>;
330
- reason: import("zod").ZodOptional<import("zod").ZodEnum<[string, ...string[]]>>;
331
- error: import("zod").ZodOptional<import("zod").ZodString>;
332
- }, "strip", import("zod").ZodTypeAny, {
333
- status: CaptchaStatus;
334
- error?: string | undefined;
335
- reason?: string | undefined;
336
- }, {
337
- status: CaptchaStatus;
338
- error?: string | undefined;
339
- reason?: string | undefined;
340
- }>;
341
- userSignature: import("zod").ZodString;
342
- ipAddress: import("zod").ZodObject<{
343
- lower: import("zod").ZodBigInt;
344
- upper: import("zod").ZodOptional<import("zod").ZodBigInt>;
345
- type: import("zod").ZodNativeEnum<typeof IpAddressType>;
346
- }, "strip", import("zod").ZodTypeAny, {
347
- type: IpAddressType;
348
- lower: bigint;
349
- upper?: bigint | undefined;
350
- }, {
351
- type: IpAddressType;
352
- lower: bigint;
353
- upper?: bigint | undefined;
354
- }>;
355
- providedIp: import("zod").ZodOptional<import("zod").ZodObject<{
356
- lower: import("zod").ZodBigInt;
357
- upper: import("zod").ZodOptional<import("zod").ZodBigInt>;
358
- type: import("zod").ZodNativeEnum<typeof IpAddressType>;
359
- }, "strip", import("zod").ZodTypeAny, {
360
- type: IpAddressType;
361
- lower: bigint;
362
- upper?: bigint | undefined;
363
- }, {
364
- type: IpAddressType;
365
- lower: bigint;
366
- upper?: bigint | undefined;
367
- }>>;
368
- headers: import("zod").ZodObject<{}, "strip", import("zod").ZodString, import("zod").objectOutputType<{}, import("zod").ZodString, "strip">, import("zod").objectInputType<{}, import("zod").ZodString, "strip">>;
369
- ja4: import("zod").ZodString;
370
- userSubmitted: import("zod").ZodBoolean;
371
- serverChecked: import("zod").ZodBoolean;
372
- storedAtTimestamp: import("zod").ZodOptional<import("zod").ZodDate>;
373
- requestedAtTimestamp: import("zod").ZodDate;
374
- lastUpdatedTimestamp: import("zod").ZodOptional<import("zod").ZodDate>;
375
- sessionId: import("zod").ZodOptional<import("zod").ZodString>;
376
- coords: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodArray<import("zod").ZodNumber, "many">, "many">, "many">>;
377
- }, {
378
- captchas: import("zod").ZodArray<import("zod").ZodObject<import("zod").objectUtil.extendShape<{
379
- captchaId: import("zod").ZodString;
380
- captchaContentId: import("zod").ZodString;
381
- solution: import("zod").ZodArray<import("zod").ZodString, "many">;
382
- salt: import("zod").ZodString;
383
- }, {
384
- processed: import("zod").ZodBoolean;
385
- checked: import("zod").ZodBoolean;
386
- commitmentId: import("zod").ZodString;
387
- createdAt: import("zod").ZodDate;
388
- }>, "strip", import("zod").ZodTypeAny, {
389
- createdAt: Date;
390
- captchaId: string;
391
- captchaContentId: string;
392
- solution: string[];
393
- salt: string;
394
- processed: boolean;
395
- checked: boolean;
396
- commitmentId: string;
397
- }, {
398
- createdAt: Date;
399
- captchaId: string;
400
- captchaContentId: string;
401
- solution: string[];
402
- salt: string;
403
- processed: boolean;
404
- checked: boolean;
405
- commitmentId: string;
406
- }>, "many">;
407
- }>, "strip", import("zod").ZodTypeAny, {
408
- id: string;
409
- result: {
410
- status: CaptchaStatus;
411
- error?: string | undefined;
412
- reason?: string | undefined;
413
- };
414
- requestedAtTimestamp: Date;
415
- userAccount: string;
416
- dappAccount: string;
417
- userSignature: string;
418
- datasetId: string;
419
- providerAccount: string;
420
- ipAddress: {
421
- type: IpAddressType;
422
- lower: bigint;
423
- upper?: bigint | undefined;
424
- };
425
- headers: {} & {
426
- [k: string]: string;
427
- };
428
- ja4: string;
429
- userSubmitted: boolean;
430
- serverChecked: boolean;
431
- captchas: {
432
- createdAt: Date;
433
- captchaId: string;
434
- captchaContentId: string;
435
- solution: string[];
436
- salt: string;
437
- processed: boolean;
438
- checked: boolean;
439
- commitmentId: string;
440
- }[];
441
- providedIp?: {
442
- type: IpAddressType;
443
- lower: bigint;
444
- upper?: bigint | undefined;
445
- } | undefined;
446
- storedAtTimestamp?: Date | undefined;
447
- lastUpdatedTimestamp?: Date | undefined;
448
- sessionId?: string | undefined;
449
- coords?: number[][][] | undefined;
450
- }, {
451
- id: string;
452
- result: {
453
- status: CaptchaStatus;
454
- error?: string | undefined;
455
- reason?: string | undefined;
456
- };
457
- requestedAtTimestamp: Date;
458
- userAccount: string;
459
- dappAccount: string;
460
- userSignature: string;
461
- datasetId: string;
462
- providerAccount: string;
463
- ipAddress: {
464
- type: IpAddressType;
465
- lower: bigint;
466
- upper?: bigint | undefined;
467
- };
468
- headers: {} & {
469
- [k: string]: string;
470
- };
471
- ja4: string;
472
- userSubmitted: boolean;
473
- serverChecked: boolean;
474
- captchas: {
475
- createdAt: Date;
476
- captchaId: string;
477
- captchaContentId: string;
478
- solution: string[];
479
- salt: string;
480
- processed: boolean;
481
- checked: boolean;
482
- commitmentId: string;
483
- }[];
484
- providedIp?: {
485
- type: IpAddressType;
486
- lower: bigint;
487
- upper?: bigint | undefined;
488
- } | undefined;
489
- storedAtTimestamp?: Date | undefined;
490
- lastUpdatedTimestamp?: Date | undefined;
491
- sessionId?: string | undefined;
492
- coords?: number[][][] | undefined;
493
- }>;
494
- export type UserCommitmentWithSolutions = zInfer<typeof UserCommitmentWithSolutionsSchema>;
495
- export type PendingCaptchaRequestMongoose = PendingCaptchaRequest;
496
- export declare const PendingRecordSchema: mongoose.Schema<PendingCaptchaRequest, mongoose.Model<PendingCaptchaRequest, any, any, any, mongoose.Document<unknown, any, PendingCaptchaRequest> & PendingCaptchaRequest & {
497
- _id: mongoose.Types.ObjectId;
498
- } & {
499
- __v: number;
500
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, PendingCaptchaRequest, mongoose.Document<unknown, {}, mongoose.FlatRecord<PendingCaptchaRequest>> & mongoose.FlatRecord<PendingCaptchaRequest> & {
501
- _id: mongoose.Types.ObjectId;
502
- } & {
503
- __v: number;
504
- }>;
505
- export declare const ScheduledTaskSchema: import("zod").ZodObject<{
506
- processName: import("zod").ZodNativeEnum<typeof ScheduledTaskNames>;
507
- datetime: import("zod").ZodDate;
508
- updated: import("zod").ZodOptional<import("zod").ZodDate>;
509
- status: import("zod").ZodNativeEnum<typeof ScheduledTaskStatus>;
510
- result: import("zod").ZodOptional<import("zod").ZodObject<{
511
- data: import("zod").ZodOptional<import("zod").ZodAny>;
512
- error: import("zod").ZodOptional<import("zod").ZodAny>;
513
- }, "strip", import("zod").ZodTypeAny, {
514
- data?: any;
515
- error?: any;
516
- }, {
517
- data?: any;
518
- error?: any;
519
- }>>;
520
- }, "strip", import("zod").ZodTypeAny, {
521
- status: ScheduledTaskStatus;
522
- processName: ScheduledTaskNames;
523
- datetime: Date;
524
- result?: {
525
- data?: any;
526
- error?: any;
527
- } | undefined;
528
- updated?: Date | undefined;
529
- }, {
530
- status: ScheduledTaskStatus;
531
- processName: ScheduledTaskNames;
532
- datetime: Date;
533
- result?: {
534
- data?: any;
535
- error?: any;
536
- } | undefined;
537
- updated?: Date | undefined;
538
- }>;
539
- export type ScheduledTask = zInfer<typeof ScheduledTaskSchema>;
540
- export type ScheduledTaskRecord = mongoose.Document & ScheduledTask;
541
- export declare const ScheduledTaskRecordSchema: mongoose.Schema<ScheduledTaskRecord, mongoose.Model<ScheduledTaskRecord, any, any, any, mongoose.Document<unknown, any, ScheduledTaskRecord> & mongoose.Document<unknown, any, any> & {
542
- status: ScheduledTaskStatus;
543
- processName: ScheduledTaskNames;
544
- datetime: Date;
545
- result?: {
546
- data?: any;
547
- error?: any;
548
- } | undefined;
549
- updated?: Date | undefined;
550
- } & Required<{
551
- _id: unknown;
552
- }> & {
553
- __v: number;
554
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ScheduledTaskRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<ScheduledTaskRecord>> & mongoose.FlatRecord<ScheduledTaskRecord> & Required<{
555
- _id: unknown;
556
- }> & {
557
- __v: number;
558
- }>;
559
- export interface ScoreComponents {
560
- baseScore: number;
561
- lScore?: number;
562
- timeout?: number;
563
- accessPolicy?: number;
564
- unverifiedHost?: number;
565
- webView?: number;
566
- }
567
- export type Session = {
568
- sessionId: string;
569
- createdAt: Date;
570
- token: string;
571
- score: number;
572
- threshold: number;
573
- scoreComponents: ScoreComponents;
574
- providerSelectEntropy: number;
575
- ipAddress: CompositeIpAddress;
576
- captchaType: CaptchaType;
577
- solvedImagesCount?: number;
578
- powDifficulty?: number;
579
- storedAtTimestamp?: Date;
580
- lastUpdatedTimestamp?: Date;
581
- deleted?: boolean;
582
- webView: boolean;
583
- iFrame: boolean;
584
- decryptedHeadHash: string;
585
- };
586
- export type SessionRecord = mongoose.Document & Session;
587
- 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<{
588
- _id: unknown;
589
- }> & {
590
- __v: number;
591
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, SessionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<SessionRecord>> & mongoose.FlatRecord<SessionRecord> & Required<{
592
- _id: unknown;
593
- }> & {
594
- __v: number;
595
- }>;
596
- export type DetectorKey = {
597
- detectorKey: string;
598
- createdAt: Date;
599
- expiresAt?: Date;
600
- };
601
- export type DetectorSchema = mongoose.Document & DetectorKey;
602
- 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<{
603
- _id: unknown;
604
- }> & {
605
- __v: number;
606
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, DetectorSchema, mongoose.Document<unknown, {}, mongoose.FlatRecord<DetectorSchema>> & mongoose.FlatRecord<DetectorSchema> & Required<{
607
- _id: unknown;
608
- }> & {
609
- __v: number;
610
- }>;
611
- export interface IProviderDatabase extends IDatabase {
612
- tables: Tables<any>;
613
- ensureIndexes(): Promise<void>;
614
- storeDataset(dataset: Dataset): Promise<void>;
615
- getSolutions(datasetId: string): Promise<SolutionRecord[]>;
616
- getSolutionByCaptchaId(captchaId: string): Promise<SolutionRecord | null>;
617
- getDataset(datasetId: string): Promise<DatasetWithIds>;
618
- getRandomCaptcha(solved: boolean, datasetId: Hash | string, size?: number): Promise<Captcha[] | undefined>;
619
- getCaptchaById(captchaId: string[]): Promise<Captcha[] | undefined>;
620
- updateCaptcha(captcha: Captcha, datasetId: string): Promise<void>;
621
- removeCaptchas(captchaIds: string[]): Promise<void>;
622
- getDatasetDetails(datasetId: Hash | string | Uint8Array): Promise<DatasetBase>;
623
- storeUserImageCaptchaSolution(captchas: CaptchaSolution[], commit: UserCommitment): Promise<void>;
624
- storePendingImageCommitment(userAccount: string, requestHash: string, salt: string, deadlineTimestamp: number, requestedAtTimestamp: number, ipAddress: CompositeIpAddress, threshold: number, sessionId?: string): Promise<void>;
625
- getPendingImageCommitment(requestHash: string): Promise<PendingCaptchaRequest>;
626
- updatePendingImageCommitmentStatus(requestHash: string): Promise<void>;
627
- getAllCaptchasByDatasetId(datasetId: string, captchaState?: CaptchaStates): Promise<Captcha[] | undefined>;
628
- getAllDappUserSolutions(captchaId: string[]): Promise<UserSolutionRecord[] | undefined>;
629
- getDatasetIdWithSolvedCaptchasOfSizeN(solvedCaptchaCount: number): Promise<string>;
630
- getRandomSolvedCaptchasFromSingleDataset(datasetId: string, size: number): Promise<CaptchaSolution[]>;
631
- getDappUserSolutionById(commitmentId: string): Promise<UserSolutionRecord | undefined>;
632
- getDappUserCommitmentById(commitmentId: string): Promise<UserCommitment | undefined>;
633
- getDappUserCommitmentByAccount(userAccount: string, dappAccount: string): Promise<UserCommitmentRecord[]>;
634
- approveDappUserCommitment(commitmentId: string, coords?: [number, number][][]): Promise<void>;
635
- disapproveDappUserCommitment(commitmentId: string, reason?: TranslationKey, coords?: [number, number][][]): Promise<void>;
636
- getCheckedDappUserCommitments(): Promise<UserCommitmentRecord[]>;
637
- getUnstoredDappUserCommitments(limit?: number, skip?: number): Promise<UserCommitmentRecord[]>;
638
- markDappUserCommitmentsStored(commitmentIds: Hash[]): Promise<void>;
639
- markDappUserCommitmentsChecked(commitmentIds: Hash[]): Promise<void>;
640
- updateDappUserCommitment(commitmentId: Hash, updates: Partial<UserCommitment>): Promise<void>;
641
- getUnstoredDappUserPoWCommitments(limit?: number, skip?: number): Promise<PoWCaptchaRecord[]>;
642
- markDappUserPoWCommitmentsChecked(challengeIds: string[]): Promise<void>;
643
- markDappUserPoWCommitmentsStored(challengeIds: string[]): Promise<void>;
644
- flagProcessedDappUserSolutions(captchaIds: Hash[]): Promise<void>;
645
- flagProcessedDappUserCommitments(commitmentIds: Hash[]): Promise<void>;
646
- getLastScheduledTaskStatus(task: ScheduledTaskNames, status?: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
647
- getScheduledTaskStatus(taskId: ObjectId, status: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
648
- createScheduledTaskStatus(task: ScheduledTaskNames, status: ScheduledTaskStatus): Promise<ObjectId>;
649
- updateScheduledTaskStatus(taskId: ObjectId, status: ScheduledTaskStatus, result?: ScheduledTaskResult): Promise<void>;
650
- 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>;
651
- getPowCaptchaRecordByChallenge(challenge: string): Promise<PoWCaptchaRecord | null>;
652
- updatePowCaptchaRecordResult(challenge: PoWChallengeId, result: CaptchaResult, serverChecked: boolean, userSubmitted: boolean, userSignature?: string): Promise<void>;
653
- updatePowCaptchaRecord(challenge: PoWChallengeId, updates: Partial<PoWCaptchaRecord>): Promise<void>;
654
- updateClientRecords(clientRecords: ClientRecord[]): Promise<void>;
655
- getClientRecord(account: string): Promise<ClientRecord | undefined>;
656
- storeSessionRecord(sessionRecord: Session): Promise<void>;
657
- getSessionRecordBySessionId(sessionId: string): Promise<Session | undefined>;
658
- getSessionRecordByToken(token: string): Promise<Session | undefined>;
659
- checkAndRemoveSession(sessionId: string): Promise<Session | undefined>;
660
- getUnstoredSessionRecords(limit: number, skip: number): Promise<SessionRecord[]>;
661
- markSessionRecordsStored(sessionIds: string[]): Promise<void>;
662
- getUserAccessRulesStorage(): AccessRulesStorage;
663
- storeDetectorKey(detectorKey: string): Promise<void>;
664
- getDetectorKeys(): Promise<string[]>;
665
- removeDetectorKey(detectorKey: string, expirationInSeconds?: number): Promise<void>;
666
- }
667
- //# sourceMappingURL=provider.d.ts.map