@prosopo/types-database 2.1.6 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/types-database",
3
- "version": "2.1.6",
3
+ "version": "2.1.7",
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.6",
35
- "@prosopo/types": "2.1.6",
34
+ "@prosopo/common": "2.1.7",
35
+ "@prosopo/types": "2.1.7",
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.6",
41
+ "@prosopo/config": "2.1.7",
42
42
  "@vitest/coverage-v8": "2.1.1",
43
43
  "concurrently": "9.0.1",
44
44
  "npm-run-all": "4.1.5",
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- require("./types/index.cjs");
4
- const provider = require("./types/provider.cjs");
5
- const client = require("./types/client.cjs");
6
- exports.CaptchaRecordSchema = provider.CaptchaRecordSchema;
7
- exports.ClientRecordSchema = provider.ClientRecordSchema;
8
- exports.DatasetRecordSchema = provider.DatasetRecordSchema;
9
- exports.PendingRecordSchema = provider.PendingRecordSchema;
10
- exports.PoWCaptchaRecordSchema = provider.PoWCaptchaRecordSchema;
11
- exports.ScheduledTaskRecordSchema = provider.ScheduledTaskRecordSchema;
12
- exports.ScheduledTaskSchema = provider.ScheduledTaskSchema;
13
- exports.SessionRecordSchema = provider.SessionRecordSchema;
14
- exports.SolutionRecordSchema = provider.SolutionRecordSchema;
15
- exports.StoredStatusNames = provider.StoredStatusNames;
16
- exports.UserCommitmentRecordSchema = provider.UserCommitmentRecordSchema;
17
- exports.UserCommitmentSchema = provider.UserCommitmentSchema;
18
- exports.UserCommitmentWithSolutionsSchema = provider.UserCommitmentWithSolutionsSchema;
19
- exports.UserSolutionRecordSchema = provider.UserSolutionRecordSchema;
20
- exports.UserSolutionSchema = provider.UserSolutionSchema;
21
- exports.TableNames = client.TableNames;
22
- exports.UserDataSchema = client.UserDataSchema;
23
- exports.UserSettingsSchema = client.UserSettingsSchema;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const mongoose = require("mongoose");
4
- const UserSettingsSchema = new mongoose.Schema({
5
- captchaType: String,
6
- frictionlessThreshold: Number,
7
- powDifficulty: Number,
8
- domains: [String]
9
- });
10
- const UserDataSchema = new mongoose.Schema({
11
- email: String,
12
- name: String,
13
- account: String,
14
- url: String,
15
- mnemonic: String,
16
- createdAt: Number,
17
- activated: Boolean,
18
- tier: String,
19
- settings: {
20
- type: UserSettingsSchema,
21
- required: false
22
- },
23
- updatedAtTimestamp: Number
24
- });
25
- var TableNames = /* @__PURE__ */ ((TableNames2) => {
26
- TableNames2["emails"] = "emails";
27
- return TableNames2;
28
- })(TableNames || {});
29
- exports.TableNames = TableNames;
30
- exports.UserDataSchema = UserDataSchema;
31
- exports.UserSettingsSchema = UserSettingsSchema;
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- require("./mongo.cjs");
4
- const provider = require("./provider.cjs");
5
- const client = require("./client.cjs");
6
- require("./captcha.cjs");
7
- exports.CaptchaRecordSchema = provider.CaptchaRecordSchema;
8
- exports.ClientRecordSchema = provider.ClientRecordSchema;
9
- exports.DatasetRecordSchema = provider.DatasetRecordSchema;
10
- exports.PendingRecordSchema = provider.PendingRecordSchema;
11
- exports.PoWCaptchaRecordSchema = provider.PoWCaptchaRecordSchema;
12
- exports.ScheduledTaskRecordSchema = provider.ScheduledTaskRecordSchema;
13
- exports.ScheduledTaskSchema = provider.ScheduledTaskSchema;
14
- exports.SessionRecordSchema = provider.SessionRecordSchema;
15
- exports.SolutionRecordSchema = provider.SolutionRecordSchema;
16
- exports.StoredStatusNames = provider.StoredStatusNames;
17
- exports.UserCommitmentRecordSchema = provider.UserCommitmentRecordSchema;
18
- exports.UserCommitmentSchema = provider.UserCommitmentSchema;
19
- exports.UserCommitmentWithSolutionsSchema = provider.UserCommitmentWithSolutionsSchema;
20
- exports.UserSolutionRecordSchema = provider.UserSolutionRecordSchema;
21
- exports.UserSolutionSchema = provider.UserSolutionSchema;
22
- exports.TableNames = client.TableNames;
23
- exports.UserDataSchema = client.UserDataSchema;
24
- exports.UserSettingsSchema = client.UserSettingsSchema;
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,219 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const locale = require("@prosopo/locale");
4
- const types = require("@prosopo/types");
5
- const mongoose = require("mongoose");
6
- const zod = require("zod");
7
- const client = require("./client.cjs");
8
- const ONE_WEEK = 60 * 60 * 24 * 7;
9
- const ONE_MONTH = ONE_WEEK * 4;
10
- const ClientRecordSchema = new mongoose.Schema({
11
- account: String,
12
- settings: client.UserSettingsSchema
13
- });
14
- var StoredStatusNames = /* @__PURE__ */ ((StoredStatusNames2) => {
15
- StoredStatusNames2["notStored"] = "notStored";
16
- StoredStatusNames2["userSubmitted"] = "userSubmitted";
17
- StoredStatusNames2["serverChecked"] = "serverChecked";
18
- StoredStatusNames2["stored"] = "stored";
19
- return StoredStatusNames2;
20
- })(StoredStatusNames || {});
21
- const CaptchaResultSchema = zod.object({
22
- status: zod.nativeEnum(types.CaptchaStatus),
23
- reason: locale.TranslationKeysSchema.optional(),
24
- error: zod.string().optional()
25
- });
26
- const UserCommitmentSchema = zod.object({
27
- userAccount: zod.string(),
28
- dappAccount: zod.string(),
29
- datasetId: zod.string(),
30
- providerAccount: zod.string(),
31
- id: zod.string(),
32
- result: CaptchaResultSchema,
33
- userSignature: zod.string(),
34
- ipAddress: zod.string(),
35
- headers: zod.object({}).catchall(zod.string()),
36
- userSubmitted: zod.boolean(),
37
- serverChecked: zod.boolean(),
38
- storedAtTimestamp: types.TimestampSchema.optional(),
39
- requestedAtTimestamp: types.TimestampSchema,
40
- lastUpdatedTimestamp: types.TimestampSchema.optional()
41
- });
42
- const CaptchaRecordSchema = new mongoose.Schema({
43
- captchaId: { type: String, required: true },
44
- captchaContentId: { type: String, required: true },
45
- assetURI: { type: String, required: false },
46
- datasetId: { type: String, required: true },
47
- datasetContentId: { type: String, required: true },
48
- solved: { type: Boolean, required: true },
49
- target: { type: String, required: true },
50
- salt: { type: String, required: true },
51
- items: {
52
- type: [
53
- new mongoose.Schema(
54
- {
55
- hash: { type: String, required: true },
56
- data: { type: String, required: true },
57
- type: { type: String, required: true }
58
- },
59
- { _id: false }
60
- )
61
- ],
62
- required: true
63
- }
64
- });
65
- CaptchaRecordSchema.index({ captchaId: 1 });
66
- const PoWCaptchaRecordSchema = new mongoose.Schema(
67
- {
68
- challenge: { type: String, required: true },
69
- dappAccount: { type: String, required: true },
70
- userAccount: { type: String, required: true },
71
- requestedAtTimestamp: { type: Number, required: true },
72
- lastUpdatedTimestamp: { type: Number, required: false },
73
- result: {
74
- status: { type: String, enum: types.CaptchaStatus, required: true },
75
- reason: {
76
- type: String,
77
- enum: locale.TranslationKeysSchema.options,
78
- required: false
79
- },
80
- error: { type: String, required: false }
81
- },
82
- difficulty: { type: Number, required: true },
83
- ipAddress: { type: String, required: true },
84
- headers: { type: Object, required: true },
85
- userSignature: { type: String, required: false },
86
- userSubmitted: { type: Boolean, required: true },
87
- serverChecked: { type: Boolean, required: true },
88
- storedAtTimestamp: { type: Number, required: false }
89
- },
90
- { expireAfterSeconds: ONE_MONTH }
91
- );
92
- PoWCaptchaRecordSchema.index({ captchaId: 1 });
93
- const UserCommitmentRecordSchema = new mongoose.Schema({
94
- userAccount: { type: String, required: true },
95
- dappAccount: { type: String, required: true },
96
- providerAccount: { type: String, required: true },
97
- datasetId: { type: String, required: true },
98
- id: { type: String, required: true },
99
- result: {
100
- status: { type: String, enum: types.CaptchaStatus, required: true },
101
- reason: {
102
- type: String,
103
- enum: locale.TranslationKeysSchema.options,
104
- required: false
105
- },
106
- error: { type: String, required: false }
107
- },
108
- ipAddress: { type: String, required: true },
109
- headers: { type: Object, required: true },
110
- userSignature: { type: String, required: true },
111
- userSubmitted: { type: Boolean, required: true },
112
- serverChecked: { type: Boolean, required: true },
113
- storedAtTimestamp: { type: Number, required: false },
114
- requestedAtTimestamp: { type: Number, required: true },
115
- lastUpdatedTimestamp: { type: Number, required: false }
116
- });
117
- UserCommitmentRecordSchema.index({ id: -1 });
118
- const DatasetRecordSchema = new mongoose.Schema({
119
- contentTree: { type: [[String]], required: true },
120
- datasetContentId: { type: String, required: true },
121
- datasetId: { type: String, required: true },
122
- format: { type: String, required: true },
123
- solutionTree: { type: [[String]], required: true }
124
- });
125
- DatasetRecordSchema.index({ datasetId: 1 });
126
- const SolutionRecordSchema = new mongoose.Schema({
127
- captchaId: { type: String, required: true },
128
- captchaContentId: { type: String, required: true },
129
- datasetId: { type: String, required: true },
130
- datasetContentId: { type: String, required: true },
131
- salt: { type: String, required: true },
132
- solution: { type: [String], required: true }
133
- });
134
- SolutionRecordSchema.index({ captchaId: 1 });
135
- const UserSolutionSchema = types.CaptchaSolutionSchema.extend({
136
- processed: zod.boolean(),
137
- checked: zod.boolean(),
138
- commitmentId: zod.string()
139
- });
140
- const UserSolutionRecordSchema = new mongoose.Schema(
141
- {
142
- captchaId: { type: String, required: true },
143
- captchaContentId: { type: String, required: true },
144
- salt: { type: String, required: true },
145
- solution: [{ type: String, required: true }],
146
- processed: { type: Boolean, required: true },
147
- checked: { type: Boolean, required: true },
148
- commitmentId: { type: String, required: true }
149
- },
150
- { _id: false }
151
- );
152
- UserSolutionRecordSchema.index({ captchaId: 1 });
153
- const UserCommitmentWithSolutionsSchema = UserCommitmentSchema.extend({
154
- captchas: zod.array(UserSolutionSchema)
155
- });
156
- const PendingRecordSchema = new mongoose.Schema(
157
- {
158
- accountId: { type: String, required: true },
159
- pending: { type: Boolean, required: true },
160
- salt: { type: String, required: true },
161
- requestHash: { type: String, required: true },
162
- deadlineTimestamp: { type: Number, required: true },
163
- // unix timestamp
164
- requestedAtTimestamp: { type: Number, required: true },
165
- // unix timestamp
166
- ipAddress: { type: String, required: true },
167
- headers: { type: Object, required: true }
168
- },
169
- { expireAfterSeconds: ONE_WEEK }
170
- );
171
- PendingRecordSchema.index({ requestHash: -1 });
172
- const ScheduledTaskSchema = zod.object({
173
- processName: zod.nativeEnum(types.ScheduledTaskNames),
174
- datetime: types.TimestampSchema,
175
- updated: types.TimestampSchema.optional(),
176
- status: zod.nativeEnum(types.ScheduledTaskStatus),
177
- result: zod.object({
178
- data: zod.any().optional(),
179
- error: zod.any().optional()
180
- }).optional()
181
- });
182
- const ScheduledTaskRecordSchema = new mongoose.Schema(
183
- {
184
- processName: { type: String, enum: types.ScheduledTaskNames, required: true },
185
- datetime: { type: Number, required: true },
186
- updated: { type: Number, required: false },
187
- status: { type: String, enum: types.ScheduledTaskStatus, required: true },
188
- result: {
189
- type: new mongoose.Schema(
190
- {
191
- error: { type: String, required: false },
192
- data: { type: Object, required: false }
193
- },
194
- { _id: false }
195
- ),
196
- required: false
197
- }
198
- },
199
- { expireAfterSeconds: ONE_WEEK }
200
- );
201
- const SessionRecordSchema = new mongoose.Schema({
202
- sessionId: { type: String, required: true, unique: true },
203
- createdAt: { type: Date, required: true }
204
- });
205
- exports.CaptchaRecordSchema = CaptchaRecordSchema;
206
- exports.ClientRecordSchema = ClientRecordSchema;
207
- exports.DatasetRecordSchema = DatasetRecordSchema;
208
- exports.PendingRecordSchema = PendingRecordSchema;
209
- exports.PoWCaptchaRecordSchema = PoWCaptchaRecordSchema;
210
- exports.ScheduledTaskRecordSchema = ScheduledTaskRecordSchema;
211
- exports.ScheduledTaskSchema = ScheduledTaskSchema;
212
- exports.SessionRecordSchema = SessionRecordSchema;
213
- exports.SolutionRecordSchema = SolutionRecordSchema;
214
- exports.StoredStatusNames = StoredStatusNames;
215
- exports.UserCommitmentRecordSchema = UserCommitmentRecordSchema;
216
- exports.UserCommitmentSchema = UserCommitmentSchema;
217
- exports.UserCommitmentWithSolutionsSchema = UserCommitmentWithSolutionsSchema;
218
- exports.UserSolutionRecordSchema = UserSolutionRecordSchema;
219
- exports.UserSolutionSchema = UserSolutionSchema;
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./types/index.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,cAAc,kBAAkB,CAAC"}
@@ -1,6 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=captcha.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"captcha.js","sourceRoot":"","sources":["../../src/types/captcha.ts"],"names":[],"mappings":""}
@@ -1,32 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,27 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,5 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,5 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,12 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=mongo.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mongo.js","sourceRoot":"","sources":["../../src/types/mongo.ts"],"names":[],"mappings":""}
@@ -1,414 +0,0 @@
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: string;
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").ZodString;
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: string;
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: string;
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").ZodString;
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: string;
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: string;
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 interface SessionRecord {
358
- sessionId: string;
359
- createdAt: Date;
360
- }
361
- export declare const SessionRecordSchema: mongoose.Schema<SessionRecord, mongoose.Model<SessionRecord, any, any, any, mongoose.Document<unknown, any, SessionRecord> & SessionRecord & {
362
- _id: mongoose.Types.ObjectId;
363
- }, any>, {}, {}, {}, {}, mongoose.DefaultSchemaOptions, SessionRecord, mongoose.Document<unknown, {}, mongoose.FlatRecord<SessionRecord>> & mongoose.FlatRecord<SessionRecord> & {
364
- _id: mongoose.Types.ObjectId;
365
- }>;
366
- export interface IProviderDatabase extends IDatabase {
367
- tables: Tables<any>;
368
- storeDataset(dataset: Dataset): Promise<void>;
369
- getSolutions(datasetId: string): Promise<SolutionRecord[]>;
370
- getDataset(datasetId: string): Promise<DatasetWithIds>;
371
- getRandomCaptcha(solved: boolean, datasetId: Hash | string, size?: number): Promise<Captcha[] | undefined>;
372
- getCaptchaById(captchaId: string[]): Promise<Captcha[] | undefined>;
373
- updateCaptcha(captcha: Captcha, datasetId: string): Promise<void>;
374
- removeCaptchas(captchaIds: string[]): Promise<void>;
375
- getDatasetDetails(datasetId: Hash | string | Uint8Array): Promise<DatasetBase>;
376
- storeDappUserSolution(captchas: CaptchaSolution[], commit: UserCommitment): Promise<void>;
377
- storeDappUserPending(userAccount: string, requestHash: string, salt: string, deadlineTimestamp: number, requestedAtTimestamp: number, ipAddress: string, headers: RequestHeaders): Promise<void>;
378
- getDappUserPending(requestHash: string): Promise<PendingCaptchaRequest>;
379
- updateDappUserPendingStatus(requestHash: string): Promise<void>;
380
- getAllCaptchasByDatasetId(datasetId: string, captchaState?: CaptchaStates): Promise<Captcha[] | undefined>;
381
- getAllDappUserSolutions(captchaId: string[]): Promise<UserSolutionRecord[] | undefined>;
382
- getDatasetIdWithSolvedCaptchasOfSizeN(solvedCaptchaCount: number): Promise<string>;
383
- getRandomSolvedCaptchasFromSingleDataset(datasetId: string, size: number): Promise<CaptchaSolution[]>;
384
- getDappUserSolutionById(commitmentId: string): Promise<UserSolutionRecord | undefined>;
385
- getDappUserCommitmentById(commitmentId: string): Promise<UserCommitment | undefined>;
386
- getDappUserCommitmentByAccount(userAccount: string, dappAccount: string): Promise<UserCommitmentRecord[]>;
387
- approveDappUserCommitment(commitmentId: string): Promise<void>;
388
- disapproveDappUserCommitment(commitmentId: string, reason?: TranslationKey): Promise<void>;
389
- removeProcessedDappUserSolutions(commitmentIds: Hash[]): Promise<DeleteResult | undefined>;
390
- removeProcessedDappUserCommitments(commitmentIds: Hash[]): Promise<DeleteResult | undefined>;
391
- getProcessedDappUserSolutions(): Promise<UserSolutionRecord[]>;
392
- getProcessedDappUserCommitments(): Promise<UserCommitmentRecord[]>;
393
- getCheckedDappUserCommitments(): Promise<UserCommitmentRecord[]>;
394
- getUnstoredDappUserCommitments(): Promise<UserCommitmentRecord[]>;
395
- markDappUserCommitmentsStored(commitmentIds: Hash[]): Promise<void>;
396
- markDappUserCommitmentsChecked(commitmentIds: Hash[]): Promise<void>;
397
- getUnstoredDappUserPoWCommitments(): Promise<PoWCaptchaRecord[]>;
398
- markDappUserPoWCommitmentsChecked(challengeIds: string[]): Promise<void>;
399
- markDappUserPoWCommitmentsStored(challengeIds: string[]): Promise<void>;
400
- flagProcessedDappUserSolutions(captchaIds: Hash[]): Promise<void>;
401
- flagProcessedDappUserCommitments(commitmentIds: Hash[]): Promise<void>;
402
- getLastScheduledTaskStatus(task: ScheduledTaskNames, status?: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
403
- getScheduledTaskStatus(taskId: ObjectId, status: ScheduledTaskStatus): Promise<ScheduledTaskRecord | undefined>;
404
- createScheduledTaskStatus(task: ScheduledTaskNames, status: ScheduledTaskStatus): Promise<ObjectId>;
405
- updateScheduledTaskStatus(taskId: ObjectId, status: ScheduledTaskStatus, result?: ScheduledTaskResult): Promise<void>;
406
- storePowCaptchaRecord(challenge: PoWChallengeId, components: PoWChallengeComponents, difficulty: number, providerSignature: string, ipAddress: string, headers: RequestHeaders, serverChecked?: boolean, userSubmitted?: boolean, userSignature?: string): Promise<void>;
407
- getPowCaptchaRecordByChallenge(challenge: string): Promise<PoWCaptchaRecord | null>;
408
- updatePowCaptchaRecord(challenge: PoWChallengeId, result: CaptchaResult, serverChecked: boolean, userSubmitted: boolean, userSignature?: string): Promise<void>;
409
- updateClientRecords(clientRecords: ClientRecord[]): Promise<void>;
410
- getClientRecord(account: string): Promise<ClientRecord | undefined>;
411
- storeSessionRecord(sessionRecord: SessionRecord): Promise<void>;
412
- checkAndRemoveSession(sessionId: string): Promise<SessionRecord | undefined>;
413
- }
414
- //# sourceMappingURL=provider.d.ts.map
@@ -1 +0,0 @@
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,aAAa,EAClB,aAAa,EACb,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,WAAW,EAChB,KAAK,cAAc,EACnB,KAAK,IAAI,EACT,KAAK,SAAS,EAEd,KAAK,qBAAqB,EAC1B,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,KAAK,SAAS,EAEd,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAU,MAAM,UAAU,CAAC;AAC5E,OAAO,EAQN,KAAK,KAAK,IAAI,MAAM,EACpB,MAAM,KAAK,CAAC;AAEb,OAAO,KAAK,EAAE,SAAS,EAAE,MA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CAC7E"}
@@ -1,183 +0,0 @@
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, 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: string(),
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: String, 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: String, 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: String, 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
- //# sourceMappingURL=provider.js.map
@@ -1 +0,0 @@
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,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,EAAE,MAAM;IACf,QAAQ,EAAE,kBAAkB;CAC5B,CAAC,CAAC;AAEH,MAAM,CAAN,IAAY,iBAKX;AALD,WAAY,iBAAiB;IAC5B,4CAAuB,CAAA;IACvB,oDAA+B,CAAA;IAC/B,oDAA+B,CAAA;IAC/B,sCAAiB,CAAA;AAClB,CAAC,EALW,iBAAiB,KAAjB,iBAAiB,QAK5B;AA8BD,MAAM,mBAAmB,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,UAAU,CAAC,aAAa,CAAC;IACjC,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