@prosopo/types-database 5.17.0 → 5.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -39,10 +39,10 @@ dist/cjs/types/mongo.cjs 0.00 kB │ gzip: 0.02 kB
39
39
  dist/cjs/types/userAgent.cjs 0.00 kB │ gzip: 0.02 kB
40
40
  dist/cjs/types/bannedDomain.cjs 0.23 kB │ gzip: 0.16 kB
41
41
  dist/cjs/types/spamEmailDomain.cjs 0.25 kB │ gzip: 0.17 kB
42
- dist/cjs/types/captcha.cjs 1.49 kB │ gzip: 0.31 kB
42
+ dist/cjs/types/captcha.cjs 1.88 kB │ gzip: 0.40 kB
43
43
  dist/cjs/types/index.cjs 2.92 kB │ gzip: 0.53 kB
44
44
  dist/cjs/index.cjs 3.03 kB │ gzip: 0.59 kB
45
- dist/cjs/types/client.cjs 10.97 kB │ gzip: 2.12 kB
46
- dist/cjs/types/provider.cjs 34.21 kB │ gzip: 5.45 kB
45
+ dist/cjs/types/client.cjs 11.42 kB │ gzip: 2.17 kB
46
+ dist/cjs/types/provider.cjs 34.89 kB │ gzip: 5.52 kB
47
47
 
48
- ✓ built in 54ms
48
+ ✓ built in 41ms
@@ -40,10 +40,10 @@ dist/esm/types/userAgent.js 0.01 kB │ gzip: 0.03 kB
40
40
  dist/esm/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
41
41
  dist/esm/types/bannedDomain.js 0.22 kB │ gzip: 0.17 kB
42
42
  dist/esm/types/spamEmailDomain.js 0.23 kB │ gzip: 0.17 kB
43
- dist/esm/types/captcha.js 1.24 kB │ gzip: 0.30 kB
43
+ dist/esm/types/captcha.js 1.63 kB │ gzip: 0.39 kB
44
44
  dist/esm/types/index.js 1.95 kB │ gzip: 0.42 kB
45
45
  dist/esm/index.js 2.03 kB │ gzip: 0.45 kB
46
- dist/esm/types/client.js 10.71 kB │ gzip: 2.16 kB
47
- dist/esm/types/provider.js 32.83 kB │ gzip: 5.43 kB
46
+ dist/esm/types/client.js 11.21 kB │ gzip: 2.21 kB
47
+ dist/esm/types/provider.js 33.58 kB │ gzip: 5.50 kB
48
48
 
49
- ✓ built in 51ms
49
+ ✓ built in 41ms
@@ -1,5 +1,5 @@
1
1
  $ tsc --build --verbose
2
- 4:56:44 PM - Projects in this build:
2
+ 10:07:07 AM - Projects in this build:
3
3
  * ../../dev/config/tsconfig.json
4
4
  * ../util/tsconfig.json
5
5
  * ../locale/tsconfig.json
@@ -13,29 +13,29 @@ $ tsc --build --verbose
13
13
  * ../user-access-policy/tsconfig.json
14
14
  * tsconfig.json
15
15
 
16
- 4:56:44 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/webpack/webpack.config.ts' is older than output '../../dev/config/dist/tsc/tsconfig.tsbuildinfo'
16
+ 10:07:07 AM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/webpack/webpack.config.ts' is older than output '../../dev/config/dist/tsc/tsconfig.tsbuildinfo'
17
17
 
18
- 4:56:44 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/dist/tsc/tsconfig.tsbuildinfo'
18
+ 10:07:07 AM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/dist/tsc/tsconfig.tsbuildinfo'
19
19
 
20
- 4:56:44 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/dist/tsc/tsconfig.tsbuildinfo'
20
+ 10:07:07 AM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/dist/tsc/tsconfig.tsbuildinfo'
21
21
 
22
- 4:56:44 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/dist/tsc/tsconfig.tsbuildinfo'
22
+ 10:07:07 AM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/dist/tsc/tsconfig.tsbuildinfo'
23
23
 
24
- 4:56:44 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/types.test-d.ts' is older than output '../types/dist/tsc/tsconfig.tsbuildinfo'
24
+ 10:07:07 AM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/types.test-d.ts' is older than output '../types/dist/tsc/tsconfig.tsbuildinfo'
25
25
 
26
- 4:56:44 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/tests/errorSites.unit.test.ts' is older than output '../common/dist/tsc/tsconfig.tsbuildinfo'
26
+ 10:07:07 AM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/dist/tsc/tsconfig.tsbuildinfo'
27
27
 
28
- 4:56:44 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/logger.ts' is older than output '../logger/dist/tsc/tsconfig.tsbuildinfo'
28
+ 10:07:07 AM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/dist/tsc/tsconfig.tsbuildinfo'
29
29
 
30
- 4:56:45 PM - Project '../api-route/tsconfig.json' is up to date because newest input '../api-route/src/apiRoutes.ts' is older than output '../api-route/dist/tsc/tsconfig.tsbuildinfo'
30
+ 10:07:07 AM - Project '../api-route/tsconfig.json' is up to date because newest input '../api-route/src/apiRoutes.ts' is older than output '../api-route/dist/tsc/tsconfig.tsbuildinfo'
31
31
 
32
- 4:56:45 PM - Project '../redis-client/tsconfig.json' is up to date because newest input '../redis-client/src/tests/redisIndex.integration.test.ts' is older than output '../redis-client/dist/tsc/tsconfig.tsbuildinfo'
32
+ 10:07:07 AM - Project '../redis-client/tsconfig.json' is up to date because newest input '../redis-client/src/index.ts' is older than output '../redis-client/dist/tsc/tsconfig.tsbuildinfo'
33
33
 
34
- 4:56:45 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/dist/tsc/tsconfig.tsbuildinfo'
34
+ 10:07:07 AM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/tests/apiHarness.ts' is older than output '../api/dist/tsc/tsconfig.tsbuildinfo'
35
35
 
36
- 4:56:45 PM - Project '../user-access-policy/tsconfig.json' is up to date because newest input '../user-access-policy/src/transformRule.ts' is older than output '../user-access-policy/dist/tsc/tsconfig.tsbuildinfo'
36
+ 10:07:07 AM - Project '../user-access-policy/tsconfig.json' is up to date because newest input '../user-access-policy/src/transformRule.ts' is older than output '../user-access-policy/dist/tsc/tsconfig.tsbuildinfo'
37
37
 
38
- 4:56:45 PM - Project 'tsconfig.json' is out of date because output file 'dist/tsc/tsconfig.tsbuildinfo' does not exist
38
+ 10:07:07 AM - Project 'tsconfig.json' is out of date because output file 'dist/tsc/tsconfig.tsbuildinfo' does not exist
39
39
 
40
- 4:56:45 PM - Building project '/home/runner/work/captcha/captcha/packages/types-database/tsconfig.json'...
40
+ 10:07:07 AM - Building project '/home/runner/work/captcha/captcha/packages/types-database/tsconfig.json'...
41
41
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,78 @@
1
1
  # @prosopo/types-database
2
2
 
3
+ ## 5.18.1
4
+ ### Patch Changes
5
+
6
+ - e1cb7f4: Icon order challenges can now be redrawn exactly, the way puzzle challenges already can.
7
+
8
+ - The provider saves what it needs to redraw each icon order challenge on its record: the render seed, the frame geometry and the render settings (`render`).
9
+ - `@prosopo/icon-order-assets/browser` is a new entry that rebuilds a challenge from those inputs without `sharp`, so the portal can show the image a visitor was served. It returns the frame and the target strip as SVG plus the grain to lay over the frame. Rasterised the same way, the frame matches the served one byte for byte.
10
+ - `@prosopo/puzzle-assets/browser` also exports `hslToRgb` and the `Prng` type, which the new entry uses.
11
+
12
+ The seed regenerates the answer too, so like the puzzle seeds it is never sent to a client.
13
+ - 6b96e77: Name the captcha-type sets, and serve or verify each type from one table.
14
+
15
+ `@prosopo/types` now exports three named sets in place of the unions that were
16
+ spelled out by hand across the codebase:
17
+
18
+ - `ChallengeCaptchaType`: pow, image, puzzle, icon-order and audio. Anything a
19
+ user can be asked to solve.
20
+ - `ConcreteCaptchaType`: the same minus audio. What a session can be minted
21
+ as (moved here from the provider).
22
+ - `InteractiveCaptchaType`: image, puzzle and icon-order. What a PoW solve can
23
+ escalate into.
24
+
25
+ Each has a constant array, a schema and an `is…` guard.
26
+ `DecisionMachineCaptchaTypeSchema` and `DecisionMachineCaptchaType` stay as
27
+ aliases.
28
+
29
+ The provider serves a chosen type through one `sendChallenge` table, used by
30
+ the configured-type short-circuit and the access-policy handler. The server
31
+ verifies through one table keyed on `ChallengeCaptchaType`. A new type that is
32
+ missing from either table is a compile error.
33
+
34
+ Behaviour changes:
35
+
36
+ - An access rule that pins icon-order now serves icon-order. Before, the
37
+ access-policy handler only knew image, pow and puzzle, so the rule was
38
+ ignored and the request fell through to the decision machine.
39
+ - A blocked session is recorded against the type the request would have been
40
+ served instead of always `image`. Per-type session counts already exclude
41
+ blocked sessions, so traffic figures do not move.
42
+
43
+ Sessions also store `challengeParams`, the type-specific knobs grouped under
44
+ the type the session was minted as. It is written alongside the existing flat
45
+ fields, which stay the source of truth, so no reader or backfill changes are
46
+ needed.
47
+ - Updated dependencies [e1cb7f4]
48
+ - Updated dependencies [7caad4c]
49
+ - Updated dependencies [6b96e77]
50
+ - @prosopo/types@5.27.0
51
+ - @prosopo/common@3.3.2
52
+ - @prosopo/user-access-policy@3.15.19
53
+ - @prosopo/locale@3.14.2
54
+ - @prosopo/logger@2.1.10
55
+
56
+ ## 5.18.0
57
+ ### Minor Changes
58
+
59
+ - d9520ea: The traffic filter's `abuser` category, its exceptions, the DNS-path signal and the IP validation rules now use the IP lookup's reputation score.
60
+
61
+ - The IP lookup carries `reputationScore` and `reputationBand`. An address without a score never meets a threshold.
62
+ - New settings: `trafficFilter.reputationScoreThreshold`, exception `minReputationScore`, and `ipValidationRules.reputationScoreThreshold`.
63
+ - `abuserScoreThreshold`, `minAbuserScore` and `ipValidationRules.abuseScoreThreshold` are deprecated. Stored records still parse, and an exception that has only `minAbuserScore` keeps its current behaviour until it is updated.
64
+
65
+ ### Patch Changes
66
+
67
+ - a85559d: Records copied to the central captcha store no longer carry the provider's `storedAtTimestamp`. The central store's `storedAtTimestamp` TTL index is now one year; provider stores keep four weeks.
68
+ - Updated dependencies [d9520ea]
69
+ - Updated dependencies [1ba238e]
70
+ - @prosopo/types@5.26.0
71
+ - @prosopo/user-access-policy@3.15.18
72
+ - @prosopo/common@3.3.2
73
+ - @prosopo/locale@3.14.1
74
+ - @prosopo/logger@2.1.9
75
+
3
76
  ## 5.17.0
4
77
  ### Minor Changes
5
78
 
@@ -2,16 +2,26 @@ const require_provider = require("./provider.cjs");
2
2
  let mongoose = require("mongoose");
3
3
  //#region src/types/captcha.ts
4
4
  var StoredSessionRecordSchema = require_provider.SessionRecordSchema;
5
+ var storedAtTimestamp = {
6
+ type: Date,
7
+ required: false,
8
+ expires: 3600 * 24 * 365
9
+ };
5
10
  var StoredUserCommitmentRecordSchema = new mongoose.Schema({ ...require_provider.UserCommitmentRecordSchema.obj });
6
11
  StoredUserCommitmentRecordSchema.index({ sessionId: 1 });
12
+ StoredUserCommitmentRecordSchema.add({ storedAtTimestamp });
7
13
  var StoredPoWCaptchaRecordSchema = new mongoose.Schema({ ...require_provider.PoWCaptchaRecordSchema.obj });
8
14
  StoredPoWCaptchaRecordSchema.index({ sessionId: 1 });
15
+ StoredPoWCaptchaRecordSchema.add({ storedAtTimestamp });
9
16
  var StoredPuzzleCaptchaRecordSchema = new mongoose.Schema({ ...require_provider.PuzzleCaptchaRecordSchema.obj });
10
17
  StoredPuzzleCaptchaRecordSchema.index({ sessionId: 1 });
18
+ StoredPuzzleCaptchaRecordSchema.add({ storedAtTimestamp });
11
19
  var StoredAudioCaptchaRecordSchema = new mongoose.Schema({ ...require_provider.AudioCaptchaRecordSchema.obj });
12
20
  StoredAudioCaptchaRecordSchema.index({ sessionId: 1 });
21
+ StoredAudioCaptchaRecordSchema.add({ storedAtTimestamp });
13
22
  var StoredIconOrderCaptchaRecordSchema = new mongoose.Schema({ ...require_provider.IconOrderCaptchaRecordSchema.obj });
14
23
  StoredIconOrderCaptchaRecordSchema.index({ sessionId: 1 });
24
+ StoredIconOrderCaptchaRecordSchema.add({ storedAtTimestamp });
15
25
  //#endregion
16
26
  exports.StoredAudioCaptchaRecordSchema = StoredAudioCaptchaRecordSchema;
17
27
  exports.StoredIconOrderCaptchaRecordSchema = StoredIconOrderCaptchaRecordSchema;
@@ -39,6 +39,12 @@ var IPValidationRulesSchema = new mongoose.Schema({
39
39
  min: 0,
40
40
  default: _prosopo_types.abuseScoreThresholdDefault
41
41
  },
42
+ reputationScoreThreshold: {
43
+ type: Number,
44
+ min: 0,
45
+ max: 1,
46
+ default: _prosopo_types.ipValidationReputationScoreThresholdDefault
47
+ },
42
48
  requireAllConditions: {
43
49
  type: Boolean,
44
50
  default: _prosopo_types.requireAllConditionsDefault
@@ -65,6 +71,11 @@ var IPValidationRulesSchema = new mongoose.Schema({
65
71
  type: Number,
66
72
  min: 0
67
73
  },
74
+ reputationScoreThreshold: {
75
+ type: Number,
76
+ min: 0,
77
+ max: 1
78
+ },
68
79
  requireAllConditions: { type: Boolean }
69
80
  }),
70
81
  default: void 0
@@ -220,6 +231,12 @@ var TrafficCategoryExceptionSchema = TrafficCategoryActionSchema.clone().add({
220
231
  max: 1,
221
232
  required: false
222
233
  },
234
+ minReputationScore: {
235
+ type: Number,
236
+ min: 0,
237
+ max: 1,
238
+ required: false
239
+ },
223
240
  mobile: {
224
241
  type: Boolean,
225
242
  required: false
@@ -430,6 +447,12 @@ var UserSettingsSchema = new mongoose.Schema({
430
447
  max: 1,
431
448
  default: _prosopo_types.trafficFilterAbuserScoreThresholdDefault
432
449
  },
450
+ reputationScoreThreshold: {
451
+ type: Number,
452
+ min: 0,
453
+ max: 1,
454
+ default: _prosopo_types.trafficFilterReputationScoreThresholdDefault
455
+ },
433
456
  datacenter: {
434
457
  type: TrafficCategoryPolicySchema,
435
458
  required: false
@@ -700,6 +700,55 @@ var IconOrderCaptchaRecordSchema = new mongoose.Schema({
700
700
  iconOrderEvents: {
701
701
  type: [pointerEventSchema()],
702
702
  required: false
703
+ },
704
+ render: {
705
+ type: new mongoose.Schema({
706
+ geometry: {
707
+ width: {
708
+ type: Number,
709
+ required: true
710
+ },
711
+ height: {
712
+ type: Number,
713
+ required: true
714
+ },
715
+ iconSize: {
716
+ type: Number,
717
+ required: true
718
+ }
719
+ },
720
+ settings: {
721
+ targetCount: {
722
+ type: Number,
723
+ required: true
724
+ },
725
+ decoyCount: {
726
+ type: Number,
727
+ required: true
728
+ },
729
+ strokeWidth: {
730
+ type: Number,
731
+ required: true
732
+ },
733
+ iconOpacity: {
734
+ type: Number,
735
+ required: true
736
+ },
737
+ haloOpacity: {
738
+ type: Number,
739
+ required: true
740
+ },
741
+ backgroundClutter: {
742
+ type: Number,
743
+ required: true
744
+ }
745
+ },
746
+ seed: {
747
+ type: String,
748
+ required: true
749
+ }
750
+ }, { _id: false }),
751
+ required: false
703
752
  }
704
753
  });
705
754
  var indexInteractiveCaptchaRecord = (schema) => {
@@ -1242,6 +1291,10 @@ var SessionRecordSchema = new mongoose.Schema({
1242
1291
  type: Number,
1243
1292
  required: false
1244
1293
  },
1294
+ challengeParams: {
1295
+ type: mongoose.Schema.Types.Mixed,
1296
+ required: false
1297
+ },
1245
1298
  puzzleTolerance: {
1246
1299
  type: Number,
1247
1300
  required: false
@@ -1657,13 +1710,7 @@ var DecisionMachineArtifactRecordSchema = new mongoose.Schema({
1657
1710
  },
1658
1711
  captchaType: {
1659
1712
  type: String,
1660
- enum: [
1661
- _prosopo_types.CaptchaType.pow,
1662
- _prosopo_types.CaptchaType.image,
1663
- _prosopo_types.CaptchaType.puzzle,
1664
- _prosopo_types.CaptchaType.iconOrder,
1665
- _prosopo_types.CaptchaType.audio
1666
- ],
1713
+ enum: _prosopo_types.CHALLENGE_CAPTCHA_TYPES,
1667
1714
  required: false
1668
1715
  },
1669
1716
  createdAt: {
@@ -2,15 +2,25 @@ import { AudioCaptchaRecordSchema, IconOrderCaptchaRecordSchema, PoWCaptchaRecor
2
2
  import { Schema } from "mongoose";
3
3
  //#region src/types/captcha.ts
4
4
  var StoredSessionRecordSchema = SessionRecordSchema;
5
+ var storedAtTimestamp = {
6
+ type: Date,
7
+ required: false,
8
+ expires: 3600 * 24 * 365
9
+ };
5
10
  var StoredUserCommitmentRecordSchema = new Schema({ ...UserCommitmentRecordSchema.obj });
6
11
  StoredUserCommitmentRecordSchema.index({ sessionId: 1 });
12
+ StoredUserCommitmentRecordSchema.add({ storedAtTimestamp });
7
13
  var StoredPoWCaptchaRecordSchema = new Schema({ ...PoWCaptchaRecordSchema.obj });
8
14
  StoredPoWCaptchaRecordSchema.index({ sessionId: 1 });
15
+ StoredPoWCaptchaRecordSchema.add({ storedAtTimestamp });
9
16
  var StoredPuzzleCaptchaRecordSchema = new Schema({ ...PuzzleCaptchaRecordSchema.obj });
10
17
  StoredPuzzleCaptchaRecordSchema.index({ sessionId: 1 });
18
+ StoredPuzzleCaptchaRecordSchema.add({ storedAtTimestamp });
11
19
  var StoredAudioCaptchaRecordSchema = new Schema({ ...AudioCaptchaRecordSchema.obj });
12
20
  StoredAudioCaptchaRecordSchema.index({ sessionId: 1 });
21
+ StoredAudioCaptchaRecordSchema.add({ storedAtTimestamp });
13
22
  var StoredIconOrderCaptchaRecordSchema = new Schema({ ...IconOrderCaptchaRecordSchema.obj });
14
23
  StoredIconOrderCaptchaRecordSchema.index({ sessionId: 1 });
24
+ StoredIconOrderCaptchaRecordSchema.add({ storedAtTimestamp });
15
25
  //#endregion
16
26
  export { StoredAudioCaptchaRecordSchema, StoredIconOrderCaptchaRecordSchema, StoredPoWCaptchaRecordSchema, StoredPuzzleCaptchaRecordSchema, StoredSessionRecordSchema, StoredUserCommitmentRecordSchema };
@@ -1,4 +1,4 @@
1
- import { CaptchaType, DEFAULT_POW_CAPTCHA_SOLUTION_TIMEOUT, DEFAULT_POW_CAPTCHA_VERIFIED_TIMEOUT, MAX_PAD_BYTES, TrafficFilterAction, abuseScoreThresholdDefault, abuseScoreThresholdExceedActionDefault, captchaTypeDefault, cityChangeActionDefault, countryChangeActionDefault, distanceExceedActionDefault, distanceThresholdKmDefault, domainsDefault, frictionlessThresholdDefault, frictionlessTypesDefault, imageMaxRoundsDefault, imageMinRoundsDefault, imageThresholdDefault, ispChangeActionDefault, powDifficultyDefault, puzzleMaxDifficultyMax, requireAllConditionsDefault, trafficFilterAbuserScoreThresholdDefault } from "@prosopo/types";
1
+ import { CaptchaType, DEFAULT_POW_CAPTCHA_SOLUTION_TIMEOUT, DEFAULT_POW_CAPTCHA_VERIFIED_TIMEOUT, MAX_PAD_BYTES, TrafficFilterAction, abuseScoreThresholdDefault, abuseScoreThresholdExceedActionDefault, captchaTypeDefault, cityChangeActionDefault, countryChangeActionDefault, distanceExceedActionDefault, distanceThresholdKmDefault, domainsDefault, frictionlessThresholdDefault, frictionlessTypesDefault, imageMaxRoundsDefault, imageMinRoundsDefault, imageThresholdDefault, ipValidationReputationScoreThresholdDefault, ispChangeActionDefault, powDifficultyDefault, puzzleMaxDifficultyMax, requireAllConditionsDefault, trafficFilterAbuserScoreThresholdDefault, trafficFilterReputationScoreThresholdDefault } from "@prosopo/types";
2
2
  import { Schema } from "mongoose";
3
3
  //#region src/types/client.ts
4
4
  var IPValidationRulesSchema = new Schema({
@@ -39,6 +39,12 @@ var IPValidationRulesSchema = new Schema({
39
39
  min: 0,
40
40
  default: abuseScoreThresholdDefault
41
41
  },
42
+ reputationScoreThreshold: {
43
+ type: Number,
44
+ min: 0,
45
+ max: 1,
46
+ default: ipValidationReputationScoreThresholdDefault
47
+ },
42
48
  requireAllConditions: {
43
49
  type: Boolean,
44
50
  default: requireAllConditionsDefault
@@ -65,6 +71,11 @@ var IPValidationRulesSchema = new Schema({
65
71
  type: Number,
66
72
  min: 0
67
73
  },
74
+ reputationScoreThreshold: {
75
+ type: Number,
76
+ min: 0,
77
+ max: 1
78
+ },
68
79
  requireAllConditions: { type: Boolean }
69
80
  }),
70
81
  default: void 0
@@ -220,6 +231,12 @@ var TrafficCategoryExceptionSchema = TrafficCategoryActionSchema.clone().add({
220
231
  max: 1,
221
232
  required: false
222
233
  },
234
+ minReputationScore: {
235
+ type: Number,
236
+ min: 0,
237
+ max: 1,
238
+ required: false
239
+ },
223
240
  mobile: {
224
241
  type: Boolean,
225
242
  required: false
@@ -430,6 +447,12 @@ var UserSettingsSchema = new Schema({
430
447
  max: 1,
431
448
  default: trafficFilterAbuserScoreThresholdDefault
432
449
  },
450
+ reputationScoreThreshold: {
451
+ type: Number,
452
+ min: 0,
453
+ max: 1,
454
+ default: trafficFilterReputationScoreThresholdDefault
455
+ },
433
456
  datacenter: {
434
457
  type: TrafficCategoryPolicySchema,
435
458
  required: false
@@ -1,6 +1,6 @@
1
1
  import { UserSettingsSchema } from "./client.js";
2
2
  import { translationKeys } from "@prosopo/locale";
3
- import { CaptchaLabel, CaptchaStatus, CaptchaType, ContextType, DecisionMachineKind, DecisionMachineLanguage, DecisionMachineRuntime, DecisionMachineScope, InputMethod, IpAddressType, ModeEnum, ScheduledTaskNames, ScheduledTaskStatus, Tier } from "@prosopo/types";
3
+ import { CHALLENGE_CAPTCHA_TYPES, CaptchaLabel, CaptchaStatus, CaptchaType, ContextType, DecisionMachineKind, DecisionMachineLanguage, DecisionMachineRuntime, DecisionMachineScope, InputMethod, IpAddressType, ModeEnum, ScheduledTaskNames, ScheduledTaskStatus, Tier } from "@prosopo/types";
4
4
  import { Long } from "bson";
5
5
  import { Schema } from "mongoose";
6
6
  import { any, date, nativeEnum, object } from "zod";
@@ -700,6 +700,55 @@ var IconOrderCaptchaRecordSchema = new Schema({
700
700
  iconOrderEvents: {
701
701
  type: [pointerEventSchema()],
702
702
  required: false
703
+ },
704
+ render: {
705
+ type: new Schema({
706
+ geometry: {
707
+ width: {
708
+ type: Number,
709
+ required: true
710
+ },
711
+ height: {
712
+ type: Number,
713
+ required: true
714
+ },
715
+ iconSize: {
716
+ type: Number,
717
+ required: true
718
+ }
719
+ },
720
+ settings: {
721
+ targetCount: {
722
+ type: Number,
723
+ required: true
724
+ },
725
+ decoyCount: {
726
+ type: Number,
727
+ required: true
728
+ },
729
+ strokeWidth: {
730
+ type: Number,
731
+ required: true
732
+ },
733
+ iconOpacity: {
734
+ type: Number,
735
+ required: true
736
+ },
737
+ haloOpacity: {
738
+ type: Number,
739
+ required: true
740
+ },
741
+ backgroundClutter: {
742
+ type: Number,
743
+ required: true
744
+ }
745
+ },
746
+ seed: {
747
+ type: String,
748
+ required: true
749
+ }
750
+ }, { _id: false }),
751
+ required: false
703
752
  }
704
753
  });
705
754
  var indexInteractiveCaptchaRecord = (schema) => {
@@ -1242,6 +1291,10 @@ var SessionRecordSchema = new Schema({
1242
1291
  type: Number,
1243
1292
  required: false
1244
1293
  },
1294
+ challengeParams: {
1295
+ type: Schema.Types.Mixed,
1296
+ required: false
1297
+ },
1245
1298
  puzzleTolerance: {
1246
1299
  type: Number,
1247
1300
  required: false
@@ -1657,13 +1710,7 @@ var DecisionMachineArtifactRecordSchema = new Schema({
1657
1710
  },
1658
1711
  captchaType: {
1659
1712
  type: String,
1660
- enum: [
1661
- CaptchaType.pow,
1662
- CaptchaType.image,
1663
- CaptchaType.puzzle,
1664
- CaptchaType.iconOrder,
1665
- CaptchaType.audio
1666
- ],
1713
+ enum: CHALLENGE_CAPTCHA_TYPES,
1667
1714
  required: false
1668
1715
  },
1669
1716
  createdAt: {
@@ -1 +1 @@
1
- {"version":3,"file":"captcha.d.ts","sourceRoot":"","sources":["../../../src/types/captcha.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACN,KAAK,kBAAkB,EAEvB,KAAK,sBAAsB,EAE3B,KAAK,gBAAgB,EAErB,KAAK,m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KAClD,CAAC,CAAC;CACH;AAED,MAAM,WAAW,iBAChB,SAAQ,OAAO,CAAC,cAAc,GAAG,UAAU,CAAC;CAAG"}
@@ -1,24 +1,31 @@
1
1
  import { Schema } from "mongoose";
2
2
  import { AudioCaptchaRecordSchema, IconOrderCaptchaRecordSchema, PoWCaptchaRecordSchema, PuzzleCaptchaRecordSchema, SessionRecordSchema, UserCommitmentRecordSchema, } from "./provider.js";
3
3
  export const StoredSessionRecordSchema = SessionRecordSchema;
4
+ const ONE_YEAR = 60 * 60 * 24 * 365;
5
+ const storedAtTimestamp = { type: Date, required: false, expires: ONE_YEAR };
4
6
  export const StoredUserCommitmentRecordSchema = new Schema({
5
7
  ...UserCommitmentRecordSchema.obj,
6
8
  });
7
9
  StoredUserCommitmentRecordSchema.index({ sessionId: 1 });
10
+ StoredUserCommitmentRecordSchema.add({ storedAtTimestamp });
8
11
  export const StoredPoWCaptchaRecordSchema = new Schema({
9
12
  ...PoWCaptchaRecordSchema.obj,
10
13
  });
11
14
  StoredPoWCaptchaRecordSchema.index({ sessionId: 1 });
15
+ StoredPoWCaptchaRecordSchema.add({ storedAtTimestamp });
12
16
  export const StoredPuzzleCaptchaRecordSchema = new Schema({
13
17
  ...PuzzleCaptchaRecordSchema.obj,
14
18
  });
15
19
  StoredPuzzleCaptchaRecordSchema.index({ sessionId: 1 });
20
+ StoredPuzzleCaptchaRecordSchema.add({ storedAtTimestamp });
16
21
  export const StoredAudioCaptchaRecordSchema = new Schema({
17
22
  ...AudioCaptchaRecordSchema.obj,
18
23
  });
19
24
  StoredAudioCaptchaRecordSchema.index({ sessionId: 1 });
25
+ StoredAudioCaptchaRecordSchema.add({ storedAtTimestamp });
20
26
  export const StoredIconOrderCaptchaRecordSchema = new Schema({
21
27
  ...IconOrderCaptchaRecordSchema.obj,
22
28
  });
23
29
  StoredIconOrderCaptchaRecordSchema.index({ sessionId: 1 });
30
+ StoredIconOrderCaptchaRecordSchema.add({ storedAtTimestamp });
24
31
  //# sourceM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