@prosopo/types-database 2.1.7 → 2.1.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ export * from "./types/index.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { IDatabase } from "./mongo.js";
2
+ import type { PoWCaptchaRecord, UserCommitmentRecord } from "./provider.js";
3
+ export interface ICaptchaDatabase extends IDatabase {
4
+ saveCaptchas(imageCaptchaEvents: UserCommitmentRecord[], powCaptchaEvents: PoWCaptchaRecord[]): Promise<void>;
5
+ }
6
+ //# sourceMappingURL=captcha.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captcha.d.ts","sourceRoot":"","sources":["../../src/types/captcha.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAE5E,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IAClD,YAAY,CACX,kBAAkB,EAAE,oBAAoB,EAAE,EAC1C,gBAAgB,EAAE,gBAAgB,EAAE,GAClC,OAAO,CAAC,IAAI,CAAC,CAAC;CACjB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=captcha.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"captcha.js","sourceRoot":"","sources":["../../src/types/captcha.ts"],"names":[],"mappings":""}
@@ -0,0 +1,32 @@
1
+ import type { IUserData, Timestamp } from "@prosopo/types";
2
+ import type mongoose from "mongoose";
3
+ import type { IDatabase } from "./mongo.js";
4
+ import type { ClientRecord, Tables } from "./provider.js";
5
+ export type UserDataRecord = mongoose.Document & IUserData;
6
+ export declare const UserSettingsSchema: mongoose.Schema<any, mongoose.Model<any, any, any, any, any, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, {
7
+ domains: string[];
8
+ captchaType?: string | null | undefined;
9
+ frictionlessThreshold?: number | null | undefined;
10
+ powDifficulty?: number | null | undefined;
11
+ }, mongoose.Document<unknown, {}, mongoose.FlatRecord<{
12
+ domains: string[];
13
+ captchaType?: string | null | undefined;
14
+ frictionlessThreshold?: number | null | undefined;
15
+ powDifficulty?: number | null | undefined;
16
+ }>> & mongoose.FlatRecord<{
17
+ domains: string[];
18
+ captchaType?: string | null | undefined;
19
+ frictionlessThreshold?: number | null | undefined;
20
+ powDifficulty?: number | null | undefined;
21
+ }> & {
22
+ _id: mongoose.Types.ObjectId;
23
+ }>;
24
+ export declare const UserDataSchema: mongoose.Schema<UserDataRecord>;
25
+ export declare enum TableNames {
26
+ emails = "emails"
27
+ }
28
+ export interface IClientDatabase extends IDatabase {
29
+ getTables(): Tables<TableNames>;
30
+ getUpdatedClients(updatedAtTimestamp: Timestamp): Promise<ClientRecord[]>;
31
+ }
32
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,MAAM,cAAc,GAAG,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAAC;AAE3D,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;EAK7B,CAAC;AAEH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,CAczD,CAAC;AAEH,oBAAY,UAAU;IACrB,MAAM,WAAW;CACjB;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IACjD,SAAS,IAAI,MAAM,CAAC,UAAU,CAAC,CAAC;IAChC,iBAAiB,CAAC,kBAAkB,EAAE,SAAS,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC;CAC1E"}
@@ -0,0 +1,27 @@
1
+ import { Schema } from "mongoose";
2
+ export const UserSettingsSchema = new Schema({
3
+ captchaType: String,
4
+ frictionlessThreshold: Number,
5
+ powDifficulty: Number,
6
+ domains: [String],
7
+ });
8
+ export const UserDataSchema = new Schema({
9
+ email: String,
10
+ name: String,
11
+ account: String,
12
+ url: String,
13
+ mnemonic: String,
14
+ createdAt: Number,
15
+ activated: Boolean,
16
+ tier: String,
17
+ settings: {
18
+ type: UserSettingsSchema,
19
+ required: false,
20
+ },
21
+ updatedAtTimestamp: Number,
22
+ });
23
+ export var TableNames;
24
+ (function (TableNames) {
25
+ TableNames["emails"] = "emails";
26
+ })(TableNames || (TableNames = {}));
27
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/types/client.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAMlC,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAC;IAC5C,WAAW,EAAE,MAAM;IACnB,qBAAqB,EAAE,MAAM;IAC7B,aAAa,EAAE,MAAM;IACrB,OAAO,EAAE,CAAC,MAAM,CAAC;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,cAAc,GAAoC,IAAI,MAAM,CAAC;IACzE,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,MAAM;IACf,GAAG,EAAE,MAAM;IACX,QAAQ,EAAE,MAAM;IAChB,SAAS,EAAE,MAAM;IACjB,SAAS,EAAE,OAAO;IAClB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE;QACT,IAAI,EAAE,kBAAkB;QACxB,QAAQ,EAAE,KAAK;KACf;IACD,kBAAkB,EAAE,MAAM;CAC1B,CAAC,CAAC;AAEH,MAAM,CAAN,IAAY,UAEX;AAFD,WAAY,UAAU;IACrB,+BAAiB,CAAA;AAClB,CAAC,EAFW,UAAU,KAAV,UAAU,QAErB"}
@@ -0,0 +1,5 @@
1
+ export * from "./mongo.js";
2
+ export * from "./provider.js";
3
+ export * from "./client.js";
4
+ export * from "./captcha.js";
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,5 @@
1
+ export * from "./mongo.js";
2
+ export * from "./provider.js";
3
+ export * from "./client.js";
4
+ export * from "./captcha.js";
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAaA,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { Logger } from "@prosopo/common";
2
+ import type { Connection } from "mongoose";
3
+ export interface IDatabase {
4
+ url: string;
5
+ dbname: string;
6
+ connection?: Connection;
7
+ logger: Logger;
8
+ getConnection(): Connection;
9
+ connect(): Promise<void>;
10
+ close(): Promise<void>;
11
+ }
12
+ //# sourceMappingURL=mongo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongo.d.ts","sourceRoot":"","sources":["../../src/types/mongo.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,MAAM,WAAW,SAAS;IACzB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IAEf,aAAa,IAAI,UAAU,CAAC;IAE5B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mongo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mongo.js","sourceRoot":"","sources":["../../src/types/mongo.ts"],"names":[],"mappings":""}
@@ -0,0 +1,452 @@
1
+ import { type TranslationKey } from "@prosopo/locale";
2
+ import { type Captcha, type CaptchaResult, type CaptchaSolution, type CaptchaStates, CaptchaStatus, type Commit, type Dataset, type DatasetBase, type DatasetWithIds, type Hash, type IUserData, type PendingCaptchaRequest, type PoWCaptchaUser, type PoWChallengeComponents, type PoWChallengeId, type RequestHeaders, ScheduledTaskNames, type ScheduledTaskResult, ScheduledTaskStatus, type Timestamp } from "@prosopo/types";
3
+ import type { DeleteResult } from "mongodb";
4
+ import type mongoose from "mongoose";
5
+ import { type Document, type Model, type ObjectId } from "mongoose";
6
+ import { type infer as zInfer } from "zod";
7
+ import type { IDatabase } from "./mongo.js";
8
+ export type IUserDataSlim = Pick<IUserData, "account" | "settings">;
9
+ export type ClientRecord = IUserDataSlim & Document;
10
+ 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<{
11
+ _id: unknown;
12
+ }>, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ClientRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<ClientRecord>> & mongoose.FlatRecord<ClientRecord> & Required<{
13
+ _id: unknown;
14
+ }>>;
15
+ export declare enum StoredStatusNames {
16
+ notStored = "notStored",
17
+ userSubmitted = "userSubmitted",
18
+ serverChecked = "serverChecked",
19
+ stored = "stored"
20
+ }
21
+ export type StoredStatus = StoredStatusNames.notStored | StoredStatusNames.userSubmitted | StoredStatusNames.serverChecked | StoredStatusNames.stored;
22
+ export interface StoredCaptcha {
23
+ result: {
24
+ status: CaptchaStatus;
25
+ reason?: TranslationKey;
26
+ error?: string;
27
+ };
28
+ requestedAtTimestamp: Timestamp;
29
+ deadlineTimestamp?: Timestamp;
30
+ ipAddress: bigint;
31
+ headers: RequestHeaders;
32
+ userSubmitted: boolean;
33
+ serverChecked: boolean;
34
+ storedAtTimestamp?: Timestamp;
35
+ lastUpdatedTimestamp?: Timestamp;
36
+ }
37
+ export interface UserCommitment extends Commit, StoredCaptcha {
38
+ userSignature: string;
39
+ }
40
+ export interface PoWCaptchaStored extends PoWCaptchaUser, StoredCaptcha {
41
+ }
42
+ export declare const UserCommitmentSchema: import("zod").ZodObject<{
43
+ userAccount: import("zod").ZodString;
44
+ dappAccount: import("zod").ZodString;
45
+ datasetId: import("zod").ZodString;
46
+ providerAccount: import("zod").ZodString;
47
+ id: import("zod").ZodString;
48
+ result: import("zod").ZodObject<{
49
+ status: import("zod").ZodNativeEnum<typeof CaptchaStatus>;
50
+ reason: import("zod").ZodOptional<import("zod").ZodEnum<[string, ...string[]]>>;
51
+ error: import("zod").ZodOptional<import("zod").ZodString>;
52
+ }, "strip", import("zod").ZodTypeAny, {
53
+ status: CaptchaStatus;
54
+ error?: string | undefined;
55
+ reason?: string | undefined;
56
+ }, {
57
+ status: CaptchaStatus;
58
+ error?: string | undefined;
59
+ reason?: string | undefined;
60
+ }>;
61
+ userSignature: import("zod").ZodString;
62
+ ipAddress: import("zod").ZodBigInt;
63
+ headers: import("zod").ZodObject<{}, "strip", import("zod").ZodString, import("zod").objectOutputType<{}, import("zod").ZodString, "strip">, import("zod").objectInputType<{}, import("zod").ZodString, "strip">>;
64
+ userSubmitted: import("zod").ZodBoolean;
65
+ serverChecked: import("zod").ZodBoolean;
66
+ storedAtTimestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
67
+ requestedAtTimestamp: import("zod").ZodNumber;
68
+ lastUpdatedTimestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
69
+ }, "strip", import("zod").ZodTypeAny, {
70
+ id: string;
71
+ result: {
72
+ status: CaptchaStatus;
73
+ error?: string | undefined;
74
+ reason?: string | undefined;
75
+ };
76
+ userSubmitted: boolean;
77
+ serverChecked: boolean;
78
+ userAccount: string;
79
+ dappAccount: string;
80
+ datasetId: string;
81
+ providerAccount: string;
82
+ userSignature: string;
83
+ ipAddress: bigint;
84
+ headers: {} & {
85
+ [k: string]: string;
86
+ };
87
+ requestedAtTimestamp: number;
88
+ storedAtTimestamp?: number | undefined;
89
+ lastUpdatedTimestamp?: number | undefined;
90
+ }, {
91
+ id: string;
92
+ result: {
93
+ status: CaptchaStatus;
94
+ error?: string | undefined;
95
+ reason?: string | undefined;
96
+ };
97
+ userSubmitted: boolean;
98
+ serverChecked: boolean;
99
+ userAccount: string;
100
+ dappAccount: string;
101
+ datasetId: string;
102
+ providerAccount: string;
103
+ userSignature: string;
104
+ ipAddress: bigint;
105
+ headers: {} & {
106
+ [k: string]: string;
107
+ };
108
+ requestedAtTimestamp: number;
109
+ storedAtTimestamp?: number | undefined;
110
+ lastUpdatedTimestamp?: number | undefined;
111
+ }>;
112
+ export interface SolutionRecord extends CaptchaSolution {
113
+ datasetId: string;
114
+ datasetContentId: string;
115
+ }
116
+ export type Tables<E extends string | number | symbol> = {
117
+ [key in E]: typeof Model<any>;
118
+ };
119
+ export declare const CaptchaRecordSchema: mongoose.Schema<Captcha, mongoose.Model<Captcha, any, any, any, mongoose.Document<unknown, any, Captcha> & Captcha & {
120
+ _id: mongoose.Types.ObjectId;
121
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, Captcha, mongoose.Document<unknown, {}, mongoose.FlatRecord<Captcha>> & mongoose.FlatRecord<Captcha> & {
122
+ _id: mongoose.Types.ObjectId;
123
+ }>;
124
+ export type PoWCaptchaRecord = mongoose.Document & PoWCaptchaStored;
125
+ export type UserCommitmentRecord = mongoose.Document & UserCommitment;
126
+ 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<{
127
+ _id: unknown;
128
+ }>, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, PoWCaptchaRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<PoWCaptchaRecord>> & mongoose.FlatRecord<PoWCaptchaRecord> & Required<{
129
+ _id: unknown;
130
+ }>>;
131
+ 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<{
132
+ _id: unknown;
133
+ }>, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, UserCommitmentRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<UserCommitmentRecord>> & mongoose.FlatRecord<UserCommitmentRecord> & Required<{
134
+ _id: unknown;
135
+ }>>;
136
+ export declare const DatasetRecordSchema: mongoose.Schema<DatasetWithIds, mongoose.Model<DatasetWithIds, any, any, any, mongoose.Document<unknown, any, DatasetWithIds> & DatasetWithIds & {
137
+ _id: mongoose.Types.ObjectId;
138
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, DatasetWithIds, mongoose.Document<unknown, {}, mongoose.FlatRecord<DatasetWithIds>> & mongoose.FlatRecord<DatasetWithIds> & {
139
+ _id: mongoose.Types.ObjectId;
140
+ }>;
141
+ export declare const SolutionRecordSchema: mongoose.Schema<SolutionRecord, mongoose.Model<SolutionRecord, any, any, any, mongoose.Document<unknown, any, SolutionRecord> & SolutionRecord & {
142
+ _id: mongoose.Types.ObjectId;
143
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, SolutionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<SolutionRecord>> & mongoose.FlatRecord<SolutionRecord> & {
144
+ _id: mongoose.Types.ObjectId;
145
+ }>;
146
+ export declare const UserSolutionSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<{
147
+ captchaId: import("zod").ZodString;
148
+ captchaContentId: import("zod").ZodString;
149
+ solution: import("zod").ZodArray<import("zod").ZodString, "many">;
150
+ salt: import("zod").ZodString;
151
+ }, {
152
+ processed: import("zod").ZodBoolean;
153
+ checked: import("zod").ZodBoolean;
154
+ commitmentId: import("zod").ZodString;
155
+ }>, "strip", import("zod").ZodTypeAny, {
156
+ captchaId: string;
157
+ captchaContentId: string;
158
+ solution: string[];
159
+ salt: string;
160
+ processed: boolean;
161
+ checked: boolean;
162
+ commitmentId: string;
163
+ }, {
164
+ captchaId: string;
165
+ captchaContentId: string;
166
+ solution: string[];
167
+ salt: string;
168
+ processed: boolean;
169
+ checked: boolean;
170
+ commitmentId: string;
171
+ }>;
172
+ export type UserSolutionRecord = mongoose.Document & zInfer<typeof UserSolutionSchema>;
173
+ export declare const UserSolutionRecordSchema: mongoose.Schema<UserSolutionRecord, mongoose.Model<UserSolutionRecord, any, any, any, mongoose.Document<unknown, any, UserSolutionRecord> & mongoose.Document<unknown, any, any> & {
174
+ captchaId: string;
175
+ captchaContentId: string;
176
+ solution: string[];
177
+ salt: string;
178
+ processed: boolean;
179
+ checked: boolean;
180
+ commitmentId: string;
181
+ } & Required<{
182
+ _id: unknown;
183
+ }>, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, UserSolutionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<UserSolutionRecord>> & mongoose.FlatRecord<UserSolutionRecord> & Required<{
184
+ _id: unknown;
185
+ }>>;
186
+ export declare const UserCommitmentWithSolutionsSchema: import("zod").ZodObject<import("zod").objectUtil.extendShape<{
187
+ userAccount: import("zod").ZodString;
188
+ dappAccount: import("zod").ZodString;
189
+ datasetId: import("zod").ZodString;
190
+ providerAccount: import("zod").ZodString;
191
+ id: import("zod").ZodString;
192
+ result: import("zod").ZodObject<{
193
+ status: import("zod").ZodNativeEnum<typeof CaptchaStatus>;
194
+ reason: import("zod").ZodOptional<import("zod").ZodEnum<[string, ...string[]]>>;
195
+ error: import("zod").ZodOptional<import("zod").ZodString>;
196
+ }, "strip", import("zod").ZodTypeAny, {
197
+ status: CaptchaStatus;
198
+ error?: string | undefined;
199
+ reason?: string | undefined;
200
+ }, {
201
+ status: CaptchaStatus;
202
+ error?: string | undefined;
203
+ reason?: string | undefined;
204
+ }>;
205
+ userSignature: import("zod").ZodString;
206
+ ipAddress: import("zod").ZodBigInt;
207
+ headers: import("zod").ZodObject<{}, "strip", import("zod").ZodString, import("zod").objectOutputType<{}, import("zod").ZodString, "strip">, import("zod").objectInputType<{}, import("zod").ZodString, "strip">>;
208
+ userSubmitted: import("zod").ZodBoolean;
209
+ serverChecked: import("zod").ZodBoolean;
210
+ storedAtTimestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
211
+ requestedAtTimestamp: import("zod").ZodNumber;
212
+ lastUpdatedTimestamp: import("zod").ZodOptional<import("zod").ZodNumber>;
213
+ }, {
214
+ captchas: import("zod").ZodArray<import("zod").ZodObject<import("zod").objectUtil.extendShape<{
215
+ captchaId: import("zod").ZodString;
216
+ captchaContentId: import("zod").ZodString;
217
+ solution: import("zod").ZodArray<import("zod").ZodString, "many">;
218
+ salt: import("zod").ZodString;
219
+ }, {
220
+ processed: import("zod").ZodBoolean;
221
+ checked: import("zod").ZodBoolean;
222
+ commitmentId: import("zod").ZodString;
223
+ }>, "strip", import("zod").ZodTypeAny, {
224
+ captchaId: string;
225
+ captchaContentId: string;
226
+ solution: string[];
227
+ salt: string;
228
+ processed: boolean;
229
+ checked: boolean;
230
+ commitmentId: string;
231
+ }, {
232
+ captchaId: string;
233
+ captchaContentId: string;
234
+ solution: string[];
235
+ salt: string;
236
+ processed: boolean;
237
+ checked: boolean;
238
+ commitmentId: string;
239
+ }>, "many">;
240
+ }>, "strip", import("zod").ZodTypeAny, {
241
+ id: string;
242
+ result: {
243
+ status: CaptchaStatus;
244
+ error?: string | undefined;
245
+ reason?: string | undefined;
246
+ };
247
+ userSubmitted: boolean;
248
+ serverChecked: boolean;
249
+ userAccount: string;
250
+ dappAccount: string;
251
+ datasetId: string;
252
+ providerAccount: string;
253
+ userSignature: string;
254
+ ipAddress: bigint;
255
+ headers: {} & {
256
+ [k: string]: string;
257
+ };
258
+ requestedAtTimestamp: number;
259
+ captchas: {
260
+ captchaId: string;
261
+ captchaContentId: string;
262
+ solution: string[];
263
+ salt: string;
264
+ processed: boolean;
265
+ checked: boolean;
266
+ commitmentId: string;
267
+ }[];
268
+ storedAtTimestamp?: number | undefined;
269
+ lastUpdatedTimestamp?: number | undefined;
270
+ }, {
271
+ id: string;
272
+ result: {
273
+ status: CaptchaStatus;
274
+ error?: string | undefined;
275
+ reason?: string | undefined;
276
+ };
277
+ userSubmitted: boolean;
278
+ serverChecked: boolean;
279
+ userAccount: string;
280
+ dappAccount: string;
281
+ datasetId: string;
282
+ providerAccount: string;
283
+ userSignature: string;
284
+ ipAddress: bigint;
285
+ headers: {} & {
286
+ [k: string]: string;
287
+ };
288
+ requestedAtTimestamp: number;
289
+ captchas: {
290
+ captchaId: string;
291
+ captchaContentId: string;
292
+ solution: string[];
293
+ salt: string;
294
+ processed: boolean;
295
+ checked: boolean;
296
+ commitmentId: string;
297
+ }[];
298
+ storedAtTimestamp?: number | undefined;
299
+ lastUpdatedTimestamp?: number | undefined;
300
+ }>;
301
+ export type UserCommitmentWithSolutions = zInfer<typeof UserCommitmentWithSolutionsSchema>;
302
+ export declare const PendingRecordSchema: mongoose.Schema<PendingCaptchaRequest, mongoose.Model<PendingCaptchaRequest, any, any, any, mongoose.Document<unknown, any, PendingCaptchaRequest> & PendingCaptchaRequest & {
303
+ _id: mongoose.Types.ObjectId;
304
+ }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, PendingCaptchaRequest, mongoose.Document<unknown, {}, mongoose.FlatRecord<PendingCaptchaRequest>> & mongoose.FlatRecord<PendingCaptchaRequest> & {
305
+ _id: mongoose.Types.ObjectId;
306
+ }>;
307
+ export declare const ScheduledTaskSchema: import("zod").ZodObject<{
308
+ processName: import("zod").ZodNativeEnum<typeof ScheduledTaskNames>;
309
+ datetime: import("zod").ZodNumber;
310
+ updated: import("zod").ZodOptional<import("zod").ZodNumber>;
311
+ status: import("zod").ZodNativeEnum<typeof ScheduledTaskStatus>;
312
+ result: import("zod").ZodOptional<import("zod").ZodObject<{
313
+ data: import("zod").ZodOptional<import("zod").ZodAny>;
314
+ error: import("zod").ZodOptional<import("zod").ZodAny>;
315
+ }, "strip", import("zod").ZodTypeAny, {
316
+ error?: any;
317
+ data?: any;
318
+ }, {
319
+ error?: any;
320
+ data?: any;
321
+ }>>;
322
+ }, "strip", import("zod").ZodTypeAny, {
323
+ status: ScheduledTaskStatus;
324
+ processName: ScheduledTaskNames;
325
+ datetime: number;
326
+ result?: {
327
+ error?: any;
328
+ data?: any;
329
+ } | undefined;
330
+ updated?: number | undefined;
331
+ }, {
332
+ status: ScheduledTaskStatus;
333
+ processName: ScheduledTaskNames;
334
+ datetime: number;
335
+ result?: {
336
+ error?: any;
337
+ data?: any;
338
+ } | undefined;
339
+ updated?: number | undefined;
340
+ }>;
341
+ export type ScheduledTask = zInfer<typeof ScheduledTaskSchema>;
342
+ export type ScheduledTaskRecord = mongoose.Document & ScheduledTask;
343
+ export declare const ScheduledTaskRecordSchema: mongoose.Schema<ScheduledTaskRecord, mongoose.Model<ScheduledTaskRecord, any, any, any, mongoose.Document<unknown, any, ScheduledTaskRecord> & mongoose.Document<unknown, any, any> & {
344
+ status: ScheduledTaskStatus;
345
+ processName: ScheduledTaskNames;
346
+ datetime: number;
347
+ result?: {
348
+ error?: any;
349
+ data?: any;
350
+ } | undefined;
351
+ updated?: number | undefined;
352
+ } & Required<{
353
+ _id: unknown;
354
+ }>, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, ScheduledTaskRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<ScheduledTaskRecord>> & mongoose.FlatRecord<ScheduledTaskRecord> & Required<{
355
+ _id: unknown;
356
+ }>>;
357
+ export type Session = {
358
+ sessionId: string;
359
+ createdAt: Date;
360
+ };
361
+ export type SessionRecord = mongoose.Document & Session;
362
+ 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<{
363
+ _id: unknown;
364
+ }>, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, SessionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<SessionRecord>> & mongoose.FlatRecord<SessionRecord> & Required<{
365
+ _id: unknown;
366
+ }>>;
367
+ type BlockRule = {
368
+ global: boolean;
369
+ type: BlockRuleType;
370
+ hardBlock: boolean;
371
+ };
372
+ export declare enum BlockRuleType {
373
+ ipAddress = "ipAddress",
374
+ userAccount = "userAccount"
375
+ }
376
+ export interface IPAddressBlockRule extends BlockRule {
377
+ ip: number;
378
+ dappAccount?: string;
379
+ }
380
+ export interface UserAccountBlockRule extends BlockRule {
381
+ dappAccount: string;
382
+ userAccount: string;
383
+ }
384
+ export type IPBlockRuleRecord = mongoose.Document & IPAddressBlockRule;
385
+ export type UserAccountBlockRuleRecord = mongoose.Document & UserAccountBlockRule;
386
+ export type IPBlockRuleMongo = Omit<IPBlockRuleRecord, "ip"> & {
387
+ ip: number;
388
+ };
389
+ export declare const IPBlockRuleRecordSchema: mongoose.Schema<IPBlockRuleRecord, mongoose.Model<IPBlockRuleRecord, any, any, any, mongoose.Document<unknown, any, IPBlockRuleRecord> & mongoose.Document<unknown, any, any> & IPAddressBlockRule & Required<{
390
+ _id: unknown;
391
+ }>, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, IPBlockRuleRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<IPBlockRuleRecord>> & mongoose.FlatRecord<IPBlockRuleRecord> & Required<{
392
+ _id: unknown;
393
+ }>>;
394
+ export declare const UserAccountBlockRuleSchema: mongoose.Schema<UserAccountBlockRuleRecord, mongoose.Model<UserAccountBlockRuleRecord, any, any, any, mongoose.Document<unknown, any, UserAccountBlockRuleRecord> & mongoose.Document<unknown, any, any> & UserAccountBlockRule & Required<{
395
+ _id: unknown;
396
+ }>, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, UserAccountBlockRuleRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<UserAccountBlockRuleRecord>> & mongoose.FlatRecord<UserAccountBlockRuleRecord> & Required<{
397
+ _id: unknown;
398
+ }>>;
399
+ export interface IProviderDatabase extends IDatabase {
400
+ tables: Tables<any>;
401
+ storeDataset(dataset: Dataset): Promise<void>;
402
+ getSolutions(datasetId: string): Promise<SolutionRecord[]>;
403
+ getDataset(datasetId: string): Promise<DatasetWithIds>;
404
+ getRandomCaptcha(solved: boolean, datasetId: Hash | string, size?: number): Promise<Captcha[] | undefined>;
405
+ getCaptchaById(captchaId: string[]): Promise<Captcha[] | undefined>;
406
+ updateCaptcha(captcha: Captcha, datasetId: string): Promise<void>;
407
+ removeCaptchas(captchaIds: string[]): Promise<void>;
408
+ getDatasetDetails(datasetId: Hash | string | Uint8Array): Promise<DatasetBase>;
409
+ storeDappUserSolution(captchas: CaptchaSolution[], commit: UserCommitment): Promise<void>;
410
+ storeDappUserPending(userAccount: string, requestHash: string, salt: string, deadlineTimestamp: number, requestedAtTimestamp: number, ipAddress: bigint, headers: RequestHeaders): Promise<void>;
411
+ getDappUserPending(requestHash: string): Promise<PendingCaptchaRequest>;
412
+ updateDappUserPendingStatus(requestHash: string): Promise<void>;
413
+ getAllCaptchasByDatasetId(datasetId: string, captchaState?: CaptchaStates): Promise<Captcha[] | undefined>;
414
+ getAllDappUserSolutions(captchaId: string[]): Promise<UserSolutionRecord[] | undefined>;
415
+ getDatasetIdWithSolvedCaptchasOfSizeN(solvedCaptchaCount: number): Promise<string>;
416
+ getRandomSolvedCaptchasFromSingleDataset(datasetId: string, size: number): Promise<CaptchaSolution[]>;
417
+ getDappUserSolutionById(commitmentId: string): Promise<UserSolutionRecord | undefined>;
418
+ getDappUserCommitmentById(commitmentId: string): Promise<UserCommitment | undefined>;
419
+ getDappUserCommitmentByAccount(userAccount: string, dappAccount: string): Promise<UserCommitmentRecord[]>;
420
+ approveDappUserCommitment(commitmentId: string): Promise<void>;
421
+ disapproveDappUserCommitment(commitmentId: string, reason?: TranslationKey): Promise<void>;
422
+ removeProcessedDappUserSolutions(commitmentIds: Hash[]): Promise<DeleteResult | undefined>;
423
+ removeProcessedDappUserCommitments(commitmentIds: Hash[]): Promise<DeleteResult | undefined>;
424
+ getProcessedDappUserSolutions(): Promise<UserSolutionRecord[]>;
425
+ getProcessedDappUserCommitments(): Promise<UserCommitmentRecord[]>;
426
+ getCheckedDappUserCommitments(): Promise<UserCommitmentRecord[]>;
427
+ getUnstoredDappUserCommitments(limit?: number, skip?: number): Promise<UserCommitmentRecord[]>;
428
+ markDappUserCommitmentsStored(commitmentIds: Hash[]): Promise<void>;
429
+ markDappUserCommitmentsChecked(commitmentIds: Hash[]): Promise<void>;
430
+ getUnstoredDappUserPoWCommitments(limit?: number, skip?: number): Promise<PoWCaptchaRecord[]>;
431
+ markDappUserPoWCommitmentsChecked(challengeIds: string[]): Promise<void>;
432
+ markDappUserPoWCommitmentsStored(challengeIds: string[]): Promise<void>;
433
+ flagProcessedDappUserSolutions(captchaIds: Hash[]): Promise<void>;
434
+ flagProcessedDappUserCommitments(commitmentIds: Hash[]): Promise<void>;
435
+ getLastScheduledTaskStatus(task: ScheduledTaskNames, status?: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
436
+ getScheduledTaskStatus(taskId: ObjectId, status: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
437
+ createScheduledTaskStatus(task: ScheduledTaskNames, status: ScheduledTaskStatus): Promise<ObjectId>;
438
+ updateScheduledTaskStatus(taskId: ObjectId, status: ScheduledTaskStatus, result?: ScheduledTaskResult): Promise<void>;
439
+ storePowCaptchaRecord(challenge: PoWChallengeId, components: PoWChallengeComponents, difficulty: number, providerSignature: string, ipAddress: bigint, headers: RequestHeaders, serverChecked?: boolean, userSubmitted?: boolean, userSignature?: string): Promise<void>;
440
+ getPowCaptchaRecordByChallenge(challenge: string): Promise<PoWCaptchaRecord | null>;
441
+ updatePowCaptchaRecord(challenge: PoWChallengeId, result: CaptchaResult, serverChecked: boolean, userSubmitted: boolean, userSignature?: string): Promise<void>;
442
+ updateClientRecords(clientRecords: ClientRecord[]): Promise<void>;
443
+ getClientRecord(account: string): Promise<ClientRecord | undefined>;
444
+ storeSessionRecord(sessionRecord: Session): Promise<void>;
445
+ checkAndRemoveSession(sessionId: string): Promise<Session | undefined>;
446
+ getIPBlockRuleRecord(ipAddress: bigint, dappAccount?: string): Promise<IPBlockRuleMongo | undefined>;
447
+ storeIPBlockRuleRecords(rules: IPAddressBlockRule[]): Promise<void>;
448
+ getUserBlockRuleRecord(userAccount: string, dappAccount: string): Promise<UserAccountBlockRuleRecord | undefined>;
449
+ storeUserBlockRuleRecords(rules: UserAccountBlockRule[]): Promise<void>;
450
+ }
451
+ export {};
452
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/types/provider.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,KAAK,cAAc,EAAyB,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EACN,KAAK,OAAO,EACZ,KAAK,aAAa,EAClB,KAAK,eAAe,EAEpB,KAAK,a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jB,mBAAmB,CAAC,aAAa,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElE,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,SAAS,CAAC,CAAC;IAEpE,kBAAkB,CAAC,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE1D,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAEvE,oBAAoB,CACnB,SAAS,EAAE,MAAM,EACjB,WAAW,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC,CAAC;IAEzC,uBAAuB,CAAC,KAAK,EAAE,kBAAkB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpE,sBAAsB,CACrB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAAC;IAEnD,yBAAyB,CAAC,KAAK,EAAE,oBAAoB,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE"}
@@ -0,0 +1,204 @@
1
+ import { TranslationKeysSchema } from "@prosopo/locale";
2
+ import { CaptchaSolutionSchema, CaptchaStatus, ScheduledTaskNames, ScheduledTaskStatus, TimestampSchema, } from "@prosopo/types";
3
+ import { Schema } from "mongoose";
4
+ import { any, array, bigint, boolean, nativeEnum, object, string, } from "zod";
5
+ import { UserSettingsSchema } from "./client.js";
6
+ const ONE_WEEK = 60 * 60 * 24 * 7;
7
+ const ONE_MONTH = ONE_WEEK * 4;
8
+ export const ClientRecordSchema = new Schema({
9
+ account: String,
10
+ settings: UserSettingsSchema,
11
+ });
12
+ export var StoredStatusNames;
13
+ (function (StoredStatusNames) {
14
+ StoredStatusNames["notStored"] = "notStored";
15
+ StoredStatusNames["userSubmitted"] = "userSubmitted";
16
+ StoredStatusNames["serverChecked"] = "serverChecked";
17
+ StoredStatusNames["stored"] = "stored";
18
+ })(StoredStatusNames || (StoredStatusNames = {}));
19
+ const CaptchaResultSchema = object({
20
+ status: nativeEnum(CaptchaStatus),
21
+ reason: TranslationKeysSchema.optional(),
22
+ error: string().optional(),
23
+ });
24
+ export const UserCommitmentSchema = object({
25
+ userAccount: string(),
26
+ dappAccount: string(),
27
+ datasetId: string(),
28
+ providerAccount: string(),
29
+ id: string(),
30
+ result: CaptchaResultSchema,
31
+ userSignature: string(),
32
+ ipAddress: bigint(),
33
+ headers: object({}).catchall(string()),
34
+ userSubmitted: boolean(),
35
+ serverChecked: boolean(),
36
+ storedAtTimestamp: TimestampSchema.optional(),
37
+ requestedAtTimestamp: TimestampSchema,
38
+ lastUpdatedTimestamp: TimestampSchema.optional(),
39
+ });
40
+ export const CaptchaRecordSchema = new Schema({
41
+ captchaId: { type: String, required: true },
42
+ captchaContentId: { type: String, required: true },
43
+ assetURI: { type: String, required: false },
44
+ datasetId: { type: String, required: true },
45
+ datasetContentId: { type: String, required: true },
46
+ solved: { type: Boolean, required: true },
47
+ target: { type: String, required: true },
48
+ salt: { type: String, required: true },
49
+ items: {
50
+ type: [
51
+ new Schema({
52
+ hash: { type: String, required: true },
53
+ data: { type: String, required: true },
54
+ type: { type: String, required: true },
55
+ }, { _id: false }),
56
+ ],
57
+ required: true,
58
+ },
59
+ });
60
+ CaptchaRecordSchema.index({ captchaId: 1 });
61
+ export const PoWCaptchaRecordSchema = new Schema({
62
+ challenge: { type: String, required: true },
63
+ dappAccount: { type: String, required: true },
64
+ userAccount: { type: String, required: true },
65
+ requestedAtTimestamp: { type: Number, required: true },
66
+ lastUpdatedTimestamp: { type: Number, required: false },
67
+ result: {
68
+ status: { type: String, enum: CaptchaStatus, required: true },
69
+ reason: {
70
+ type: String,
71
+ enum: TranslationKeysSchema.options,
72
+ required: false,
73
+ },
74
+ error: { type: String, required: false },
75
+ },
76
+ difficulty: { type: Number, required: true },
77
+ ipAddress: { type: BigInt, required: true },
78
+ headers: { type: Object, required: true },
79
+ userSignature: { type: String, required: false },
80
+ userSubmitted: { type: Boolean, required: true },
81
+ serverChecked: { type: Boolean, required: true },
82
+ storedAtTimestamp: { type: Number, required: false },
83
+ }, { expireAfterSeconds: ONE_MONTH });
84
+ PoWCaptchaRecordSchema.index({ captchaId: 1 });
85
+ export const UserCommitmentRecordSchema = new Schema({
86
+ userAccount: { type: String, required: true },
87
+ dappAccount: { type: String, required: true },
88
+ providerAccount: { type: String, required: true },
89
+ datasetId: { type: String, required: true },
90
+ id: { type: String, required: true },
91
+ result: {
92
+ status: { type: String, enum: CaptchaStatus, required: true },
93
+ reason: {
94
+ type: String,
95
+ enum: TranslationKeysSchema.options,
96
+ required: false,
97
+ },
98
+ error: { type: String, required: false },
99
+ },
100
+ ipAddress: { type: BigInt, required: true },
101
+ headers: { type: Object, required: true },
102
+ userSignature: { type: String, required: true },
103
+ userSubmitted: { type: Boolean, required: true },
104
+ serverChecked: { type: Boolean, required: true },
105
+ storedAtTimestamp: { type: Number, required: false },
106
+ requestedAtTimestamp: { type: Number, required: true },
107
+ lastUpdatedTimestamp: { type: Number, required: false },
108
+ });
109
+ UserCommitmentRecordSchema.index({ id: -1 });
110
+ export const DatasetRecordSchema = new Schema({
111
+ contentTree: { type: [[String]], required: true },
112
+ datasetContentId: { type: String, required: true },
113
+ datasetId: { type: String, required: true },
114
+ format: { type: String, required: true },
115
+ solutionTree: { type: [[String]], required: true },
116
+ });
117
+ DatasetRecordSchema.index({ datasetId: 1 });
118
+ export const SolutionRecordSchema = new Schema({
119
+ captchaId: { type: String, required: true },
120
+ captchaContentId: { type: String, required: true },
121
+ datasetId: { type: String, required: true },
122
+ datasetContentId: { type: String, required: true },
123
+ salt: { type: String, required: true },
124
+ solution: { type: [String], required: true },
125
+ });
126
+ SolutionRecordSchema.index({ captchaId: 1 });
127
+ export const UserSolutionSchema = CaptchaSolutionSchema.extend({
128
+ processed: boolean(),
129
+ checked: boolean(),
130
+ commitmentId: string(),
131
+ });
132
+ export const UserSolutionRecordSchema = new Schema({
133
+ captchaId: { type: String, required: true },
134
+ captchaContentId: { type: String, required: true },
135
+ salt: { type: String, required: true },
136
+ solution: [{ type: String, required: true }],
137
+ processed: { type: Boolean, required: true },
138
+ checked: { type: Boolean, required: true },
139
+ commitmentId: { type: String, required: true },
140
+ }, { _id: false });
141
+ UserSolutionRecordSchema.index({ captchaId: 1 });
142
+ export const UserCommitmentWithSolutionsSchema = UserCommitmentSchema.extend({
143
+ captchas: array(UserSolutionSchema),
144
+ });
145
+ export const PendingRecordSchema = new Schema({
146
+ accountId: { type: String, required: true },
147
+ pending: { type: Boolean, required: true },
148
+ salt: { type: String, required: true },
149
+ requestHash: { type: String, required: true },
150
+ deadlineTimestamp: { type: Number, required: true },
151
+ requestedAtTimestamp: { type: Number, required: true },
152
+ ipAddress: { type: BigInt, required: true },
153
+ headers: { type: Object, required: true },
154
+ }, { expireAfterSeconds: ONE_WEEK });
155
+ PendingRecordSchema.index({ requestHash: -1 });
156
+ export const ScheduledTaskSchema = object({
157
+ processName: nativeEnum(ScheduledTaskNames),
158
+ datetime: TimestampSchema,
159
+ updated: TimestampSchema.optional(),
160
+ status: nativeEnum(ScheduledTaskStatus),
161
+ result: object({
162
+ data: any().optional(),
163
+ error: any().optional(),
164
+ }).optional(),
165
+ });
166
+ export const ScheduledTaskRecordSchema = new Schema({
167
+ processName: { type: String, enum: ScheduledTaskNames, required: true },
168
+ datetime: { type: Number, required: true },
169
+ updated: { type: Number, required: false },
170
+ status: { type: String, enum: ScheduledTaskStatus, required: true },
171
+ result: {
172
+ type: new Schema({
173
+ error: { type: String, required: false },
174
+ data: { type: Object, required: false },
175
+ }, { _id: false }),
176
+ required: false,
177
+ },
178
+ }, { expireAfterSeconds: ONE_WEEK });
179
+ export const SessionRecordSchema = new Schema({
180
+ sessionId: { type: String, required: true, unique: true },
181
+ createdAt: { type: Date, required: true },
182
+ });
183
+ export var BlockRuleType;
184
+ (function (BlockRuleType) {
185
+ BlockRuleType["ipAddress"] = "ipAddress";
186
+ BlockRuleType["userAccount"] = "userAccount";
187
+ })(BlockRuleType || (BlockRuleType = {}));
188
+ export const IPBlockRuleRecordSchema = new Schema({
189
+ ip: { type: Number, required: true, unique: true },
190
+ global: { type: Boolean, required: true },
191
+ type: { type: String, enum: BlockRuleType, required: true },
192
+ dappAccount: { type: String, required: false },
193
+ hardBlock: { type: Boolean, required: false },
194
+ });
195
+ IPBlockRuleRecordSchema.index({ ip: 1 }, { unique: true });
196
+ export const UserAccountBlockRuleSchema = new Schema({
197
+ dappAccount: { type: String, required: true },
198
+ userAccount: { type: String, required: true },
199
+ global: { type: Boolean, required: true },
200
+ hardBlock: { type: Boolean, required: false },
201
+ type: { type: String, enum: BlockRuleType, required: true },
202
+ });
203
+ UserAccountBlockRuleSchema.index({ dappAccount: 1, userAccount: 1 }, { unique: true });
204
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/types/provider.ts"],"names":[],"mappings":"AAcA,OAAO,EAAuB,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EAIN,qBAAqB,EAErB,aAAa,EAab,kBAAkB,EAElB,mBAAmB,EAEnB,eAAe,GACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAA4C,MAAM,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAEN,GAAG,EACH,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAU,EACV,MAAM,EACN,MAAM,GAEN,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAOjD,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AAClC,MAAM,SAAS,GAAG,QAAQ,GAAG,CAAC,CAAC;AAE/B,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,MAAM,CAAe;IAC1D,OAAO,E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EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE;CAC7C,CAAC,CAAC;AAEH,uBAAuB,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;AAE3D,MAAM,CAAC,MAAM,0BAA0B,GACtC,IAAI,MAAM,CAA6B;IACtC,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC7C,WAAW,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE;IAC7C,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;IACzC,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE;IAC7C,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,EAAE;CAC3D,CAAC,CAAC;AAEJ,0BAA0B,CAAC,KAAK,CAC/B,EAAE,WAAW,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC,EAAE,EAClC,EAAE,MAAM,EAAE,IAAI,EAAE,CAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/types-database",
3
- "version": "2.1.7",
3
+ "version": "2.1.9",
4
4
  "description": "Types for prosopo database",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -31,14 +31,14 @@
31
31
  },
32
32
  "homepage": "https://github.com/prosopo/captcha#readme",
33
33
  "dependencies": {
34
- "@prosopo/common": "2.1.7",
35
- "@prosopo/types": "2.1.7",
34
+ "@prosopo/common": "2.1.9",
35
+ "@prosopo/types": "2.1.9",
36
36
  "mongodb": "6.9.0",
37
37
  "mongoose": "8.6.2",
38
38
  "zod": "3.23.8"
39
39
  },
40
40
  "devDependencies": {
41
- "@prosopo/config": "2.1.7",
41
+ "@prosopo/config": "2.1.9",
42
42
  "@vitest/coverage-v8": "2.1.1",
43
43
  "concurrently": "9.0.1",
44
44
  "npm-run-all": "4.1.5",