@prosopo/types-database 4.0.5 → 4.1.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.
Files changed (40) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +45 -0
  2. package/.turbo/turbo-build$colon$tsc.log +41 -0
  3. package/.turbo/turbo-build.log +49 -0
  4. package/CHANGELOG.md +85 -0
  5. package/dist/cjs/index.cjs +1 -1
  6. package/dist/cjs/types/client.cjs +13 -1
  7. package/dist/cjs/types/index.cjs +1 -1
  8. package/dist/cjs/types/provider.cjs +36 -11
  9. package/dist/index.d.ts +3 -0
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +2 -2
  12. package/dist/index.js.map +1 -0
  13. package/dist/provider/pendingCaptchaRequest.d.ts +14 -0
  14. package/dist/provider/pendingCaptchaRequest.d.ts.map +1 -0
  15. package/dist/provider/pendingCaptchaRequest.js +2 -0
  16. package/dist/provider/pendingCaptchaRequest.js.map +1 -0
  17. package/dist/types/captcha.d.ts +18 -0
  18. package/dist/types/captcha.d.ts.map +1 -0
  19. package/dist/types/captcha.js.map +1 -0
  20. package/dist/types/client.d.ts +271 -0
  21. package/dist/types/client.d.ts.map +1 -0
  22. package/dist/types/client.js +15 -3
  23. package/dist/types/client.js.map +1 -0
  24. package/dist/types/index.d.ts +6 -0
  25. package/dist/types/index.d.ts.map +1 -0
  26. package/dist/types/index.js +2 -2
  27. package/dist/types/index.js.map +1 -0
  28. package/dist/types/mongo.d.ts +13 -0
  29. package/dist/types/mongo.d.ts.map +1 -0
  30. package/dist/types/mongo.js.map +1 -0
  31. package/dist/types/provider.d.ts +702 -0
  32. package/dist/types/provider.d.ts.map +1 -0
  33. package/dist/types/provider.js +37 -12
  34. package/dist/types/provider.js.map +1 -0
  35. package/dist/types/userAgent.d.ts +31 -0
  36. package/dist/types/userAgent.d.ts.map +1 -0
  37. package/dist/types/userAgent.js.map +1 -0
  38. package/package.json +8 -7
  39. package/vite.cjs.config.ts +1 -1
  40. package/vite.esm.config.ts +1 -1
@@ -0,0 +1,702 @@
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";
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 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
+ }
235
+ export type Tables<E extends string | number | symbol> = {
236
+ [key in E]: typeof Model<any>;
237
+ };
238
+ export declare const CaptchaRecordSchema: mongoose.Schema<Captcha, mongoose.Model<Captcha, any, any, any, mongoose.Document<unknown, any, Captcha> & Captcha & {
239
+ _id: mongoose.Types.ObjectId;
240
+ } & {
241
+ __v: number;
242
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, Captcha, mongoose.Document<unknown, {}, mongoose.FlatRecord<Captcha>> & mongoose.FlatRecord<Captcha> & {
243
+ _id: mongoose.Types.ObjectId;
244
+ } & {
245
+ __v: number;
246
+ }>;
247
+ export type PoWCaptchaRecord = mongoose.Document & PoWCaptchaStored;
248
+ export type UserCommitmentRecord = mongoose.Document & UserCommitment;
249
+ 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
+ _id: unknown;
251
+ }> & {
252
+ __v: number;
253
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, PoWCaptchaRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<PoWCaptchaRecord>> & mongoose.FlatRecord<PoWCaptchaRecord> & Required<{
254
+ _id: unknown;
255
+ }> & {
256
+ __v: number;
257
+ }>;
258
+ 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
+ _id: unknown;
260
+ }> & {
261
+ __v: number;
262
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, UserCommitmentRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<UserCommitmentRecord>> & mongoose.FlatRecord<UserCommitmentRecord> & Required<{
263
+ _id: unknown;
264
+ }> & {
265
+ __v: number;
266
+ }>;
267
+ export declare const DatasetRecordSchema: mongoose.Schema<DatasetWithIds, mongoose.Model<DatasetWithIds, any, any, any, mongoose.Document<unknown, any, DatasetWithIds> & DatasetWithIds & {
268
+ _id: mongoose.Types.ObjectId;
269
+ } & {
270
+ __v: number;
271
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, DatasetWithIds, mongoose.Document<unknown, {}, mongoose.FlatRecord<DatasetWithIds>> & mongoose.FlatRecord<DatasetWithIds> & {
272
+ _id: mongoose.Types.ObjectId;
273
+ } & {
274
+ __v: number;
275
+ }>;
276
+ export declare const SolutionRecordSchema: mongoose.Schema<SolutionRecord, mongoose.Model<SolutionRecord, any, any, any, mongoose.Document<unknown, any, SolutionRecord> & SolutionRecord & {
277
+ _id: mongoose.Types.ObjectId;
278
+ } & {
279
+ __v: number;
280
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, SolutionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<SolutionRecord>> & mongoose.FlatRecord<SolutionRecord> & {
281
+ _id: mongoose.Types.ObjectId;
282
+ } & {
283
+ __v: number;
284
+ }>;
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;
297
+ captchaId: string;
298
+ captchaContentId: string;
299
+ solution: string[];
300
+ salt: string;
301
+ processed: boolean;
302
+ checked: boolean;
303
+ commitmentId: string;
304
+ }, {
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
+ }>;
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
+ createdAt: Date;
317
+ captchaId: string;
318
+ captchaContentId: string;
319
+ solution: string[];
320
+ salt: string;
321
+ processed: boolean;
322
+ checked: boolean;
323
+ commitmentId: string;
324
+ } & Required<{
325
+ _id: unknown;
326
+ }> & {
327
+ __v: number;
328
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, UserSolutionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<UserSolutionRecord>> & mongoose.FlatRecord<UserSolutionRecord> & Required<{
329
+ _id: unknown;
330
+ }> & {
331
+ __v: number;
332
+ }>;
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
+ export declare const ScheduledTaskSchema: import("zod").ZodObject<{
517
+ processName: import("zod").ZodNativeEnum<typeof ScheduledTaskNames>;
518
+ datetime: import("zod").ZodDate;
519
+ updated: import("zod").ZodOptional<import("zod").ZodDate>;
520
+ status: import("zod").ZodNativeEnum<typeof ScheduledTaskStatus>;
521
+ result: import("zod").ZodOptional<import("zod").ZodObject<{
522
+ data: import("zod").ZodOptional<import("zod").ZodAny>;
523
+ error: import("zod").ZodOptional<import("zod").ZodAny>;
524
+ }, "strip", import("zod").ZodTypeAny, {
525
+ data?: any;
526
+ error?: any;
527
+ }, {
528
+ data?: any;
529
+ error?: any;
530
+ }>>;
531
+ }, "strip", import("zod").ZodTypeAny, {
532
+ status: ScheduledTaskStatus;
533
+ processName: ScheduledTaskNames;
534
+ datetime: Date;
535
+ result?: {
536
+ data?: any;
537
+ error?: any;
538
+ } | undefined;
539
+ updated?: Date | undefined;
540
+ }, {
541
+ status: ScheduledTaskStatus;
542
+ processName: ScheduledTaskNames;
543
+ datetime: Date;
544
+ result?: {
545
+ data?: any;
546
+ error?: any;
547
+ } | undefined;
548
+ updated?: Date | undefined;
549
+ }>;
550
+ export type ScheduledTask = zInfer<typeof ScheduledTaskSchema>;
551
+ export type ScheduledTaskRecord = mongoose.Document & ScheduledTask;
552
+ export declare const ScheduledTaskRecordSchema: mongoose.Schema<ScheduledTaskRecord, mongoose.Model<ScheduledTaskRecord, any, any, any, mongoose.Document<unknown, any, ScheduledTaskRecord> & mongoose.Document<unknown, any, any> & {
553
+ status: ScheduledTaskStatus;
554
+ processName: ScheduledTaskNames;
555
+ datetime: Date;
556
+ result?: {
557
+ data?: any;
558
+ error?: any;
559
+ } | undefined;
560
+ updated?: Date | undefined;
561
+ } & Required<{
562
+ _id: unknown;
563
+ }> & {
564
+ __v: number;
565
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ScheduledTaskRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<ScheduledTaskRecord>> & mongoose.FlatRecord<ScheduledTaskRecord> & Required<{
566
+ _id: unknown;
567
+ }> & {
568
+ __v: number;
569
+ }>;
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
+ export type SessionRecord = mongoose.Document & Session;
600
+ 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
+ _id: unknown;
602
+ }> & {
603
+ __v: number;
604
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, SessionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<SessionRecord>> & mongoose.FlatRecord<SessionRecord> & Required<{
605
+ _id: unknown;
606
+ }> & {
607
+ __v: number;
608
+ }>;
609
+ export type DetectorKey = {
610
+ detectorKey: string;
611
+ createdAt: Date;
612
+ expiresAt?: Date;
613
+ };
614
+ export type DetectorSchema = mongoose.Document & DetectorKey;
615
+ 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
+ _id: unknown;
617
+ }> & {
618
+ __v: number;
619
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, DetectorSchema, mongoose.Document<unknown, {}, mongoose.FlatRecord<DetectorSchema>> & mongoose.FlatRecord<DetectorSchema> & Required<{
620
+ _id: unknown;
621
+ }> & {
622
+ __v: number;
623
+ }>;
624
+ export type ClientContextEntropy = {
625
+ account: string;
626
+ contextType: ContextType;
627
+ entropy: string;
628
+ createdAt: Date;
629
+ updatedAt: Date;
630
+ };
631
+ export type ClientContextEntropyRecord = mongoose.Document & ClientContextEntropy;
632
+ 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
+ _id: unknown;
634
+ }> & {
635
+ __v: number;
636
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ClientContextEntropyRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<ClientContextEntropyRecord>> & mongoose.FlatRecord<ClientContextEntropyRecord> & Required<{
637
+ _id: unknown;
638
+ }> & {
639
+ __v: number;
640
+ }>;
641
+ export interface IProviderDatabase extends IDatabase {
642
+ tables: Tables<any>;
643
+ ensureIndexes(): Promise<void>;
644
+ storeDataset(dataset: Dataset): Promise<void>;
645
+ getSolutions(datasetId: string): Promise<SolutionRecord[]>;
646
+ getSolutionByCaptchaId(captchaId: string): Promise<SolutionRecord | null>;
647
+ getDataset(datasetId: string): Promise<DatasetWithIds>;
648
+ getRandomCaptcha(solved: boolean, datasetId: Hash | string, size?: number): Promise<Captcha[] | undefined>;
649
+ getCaptchaById(captchaId: string[]): Promise<Captcha[] | undefined>;
650
+ updateCaptcha(captcha: Captcha, datasetId: string): Promise<void>;
651
+ removeCaptchas(captchaIds: string[]): Promise<void>;
652
+ getDatasetDetails(datasetId: Hash | string | Uint8Array): Promise<DatasetBase>;
653
+ 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>;
656
+ updatePendingImageCommitmentStatus(requestHash: string): Promise<void>;
657
+ getAllCaptchasByDatasetId(datasetId: string, captchaState?: CaptchaStates): Promise<Captcha[] | undefined>;
658
+ getAllDappUserSolutions(captchaId: string[]): Promise<UserSolutionRecord[] | undefined>;
659
+ getDatasetIdWithSolvedCaptchasOfSizeN(solvedCaptchaCount: number): Promise<string>;
660
+ getRandomSolvedCaptchasFromSingleDataset(datasetId: string, size: number): Promise<CaptchaSolution[]>;
661
+ getDappUserSolutionById(commitmentId: string): Promise<UserSolutionRecord | undefined>;
662
+ getDappUserCommitmentById(commitmentId: string): Promise<UserCommitment | undefined>;
663
+ getDappUserCommitmentByAccount(userAccount: string, dappAccount: string): Promise<UserCommitmentRecord[]>;
664
+ approveDappUserCommitment(commitmentId: string, coords?: [number, number][][]): Promise<void>;
665
+ disapproveDappUserCommitment(commitmentId: string, reason?: TranslationKey, coords?: [number, number][][]): Promise<void>;
666
+ getCheckedDappUserCommitments(): Promise<UserCommitmentRecord[]>;
667
+ getUnstoredDappUserCommitments(limit?: number, skip?: number): Promise<UserCommitmentRecord[]>;
668
+ markDappUserCommitmentsStored(commitmentIds: Hash[]): Promise<void>;
669
+ markDappUserCommitmentsChecked(commitmentIds: Hash[]): Promise<void>;
670
+ updateDappUserCommitment(commitmentId: Hash, updates: Partial<UserCommitment>): Promise<void>;
671
+ getUnstoredDappUserPoWCommitments(limit?: number, skip?: number): Promise<PoWCaptchaRecord[]>;
672
+ markDappUserPoWCommitmentsChecked(challengeIds: string[]): Promise<void>;
673
+ markDappUserPoWCommitmentsStored(challengeIds: string[]): Promise<void>;
674
+ flagProcessedDappUserSolutions(captchaIds: Hash[]): Promise<void>;
675
+ flagProcessedDappUserCommitments(commitmentIds: Hash[]): Promise<void>;
676
+ getLastScheduledTaskStatus(task: ScheduledTaskNames, status?: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
677
+ getScheduledTaskStatus(taskId: ObjectId, status: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
678
+ createScheduledTaskStatus(task: ScheduledTaskNames, status: ScheduledTaskStatus): Promise<ObjectId>;
679
+ 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>;
681
+ getPowCaptchaRecordByChallenge(challenge: string): Promise<PoWCaptchaRecord | null>;
682
+ updatePowCaptchaRecordResult(challenge: PoWChallengeId, result: CaptchaResult, serverChecked: boolean, userSubmitted: boolean, userSignature?: string, coords?: [number, number][][]): Promise<void>;
683
+ updatePowCaptchaRecord(challenge: PoWChallengeId, updates: Partial<PoWCaptchaRecord>): Promise<void>;
684
+ updateClientRecords(clientRecords: ClientRecord[]): Promise<void>;
685
+ getAllClientRecords(): Promise<ClientRecord[]>;
686
+ getClientRecord(account: string): Promise<ClientRecord | undefined>;
687
+ storeSessionRecord(sessionRecord: Session): Promise<void>;
688
+ getSessionRecordBySessionId(sessionId: string): Promise<Session | undefined>;
689
+ getSessionRecordByToken(token: string): Promise<Session | undefined>;
690
+ checkAndRemoveSession(sessionId: string): Promise<Session | undefined>;
691
+ getSessionByuserSitekeyIpHash(userSitekeyIpHash: string): Promise<SessionRecord | undefined>;
692
+ getUnstoredSessionRecords(limit: number, skip: number): Promise<SessionRecord[]>;
693
+ markSessionRecordsStored(sessionIds: string[]): Promise<void>;
694
+ getUserAccessRulesStorage(): AccessRulesStorage;
695
+ storeDetectorKey(detectorKey: string): Promise<void>;
696
+ getDetectorKeys(): Promise<string[]>;
697
+ removeDetectorKey(detectorKey: string, expirationInSeconds?: number): Promise<void>;
698
+ setClientContextEntropy(account: string, contextType: ContextType, entropy: string): Promise<void>;
699
+ getClientContextEntropy(account: string, contextType: ContextType): Promise<string | undefined>;
700
+ sampleContextEntropy(sampleSize: number, siteKey: string, contextType: ContextType): Promise<string[]>;
701
+ }
702
+ //# sourceMappingURL=provider.d.ts.map