@prosopo/types 3.5.11 → 3.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/api/api.js +1 -2
  3. package/dist/api/index.js +6 -4
  4. package/dist/api/ipapi.js +1 -2
  5. package/dist/api/params.js +46 -44
  6. package/dist/cjs/client/index.cjs +1 -0
  7. package/dist/cjs/client/settings.cjs +7 -1
  8. package/dist/cjs/config/config.cjs +5 -1
  9. package/dist/cjs/index.cjs +1 -0
  10. package/dist/cjs/provider/scheduler.cjs +1 -0
  11. package/dist/client/captchaType/captchaType.js +11 -9
  12. package/dist/client/captchaType/captchaTypeSpec.js +3 -2
  13. package/dist/client/index.js +30 -5
  14. package/dist/client/settings.d.ts +21 -2
  15. package/dist/client/settings.d.ts.map +1 -1
  16. package/dist/client/settings.js +89 -66
  17. package/dist/client/user.js +31 -18
  18. package/dist/config/config.d.ts +22 -0
  19. package/dist/config/config.d.ts.map +1 -1
  20. package/dist/config/config.js +185 -166
  21. package/dist/config/frictionless.js +17 -23
  22. package/dist/config/index.js +37 -5
  23. package/dist/config/network.js +9 -7
  24. package/dist/config/timeouts.js +19 -10
  25. package/dist/datasets/assets.js +1 -2
  26. package/dist/datasets/captcha.d.ts +14 -14
  27. package/dist/datasets/captcha.js +122 -94
  28. package/dist/datasets/dataset.d.ts +18 -18
  29. package/dist/datasets/dataset.js +28 -23
  30. package/dist/datasets/index.js +36 -5
  31. package/dist/datasets/merkle.js +1 -2
  32. package/dist/index.js +149 -10
  33. package/dist/keyring/index.js +2 -3
  34. package/dist/keyring/keyring/types.js +1 -2
  35. package/dist/keyring/pair/types.js +1 -2
  36. package/dist/procaptcha/api.js +1 -2
  37. package/dist/procaptcha/client.js +1 -2
  38. package/dist/procaptcha/collector.js +1 -2
  39. package/dist/procaptcha/index.js +19 -8
  40. package/dist/procaptcha/manager.js +7 -4
  41. package/dist/procaptcha/props.js +1 -2
  42. package/dist/procaptcha/token.js +77 -62
  43. package/dist/procaptcha/utils.js +1 -2
  44. package/dist/procaptcha-bundle/index.js +1 -2
  45. package/dist/procaptcha-frictionless/index.js +1 -2
  46. package/dist/procaptcha-frictionless/props.js +1 -2
  47. package/dist/provider/accounts.js +1 -2
  48. package/dist/provider/api.d.ts +29 -3
  49. package/dist/provider/api.d.ts.map +1 -1
  50. package/dist/provider/api.js +245 -176
  51. package/dist/provider/detection.js +1 -2
  52. package/dist/provider/index.js +33 -5
  53. package/dist/provider/scheduler.d.ts +2 -1
  54. package/dist/provider/scheduler.d.ts.map +1 -1
  55. package/dist/provider/scheduler.js +19 -15
  56. package/package.json +7 -7
  57. package/dist/api/api.js.map +0 -1
  58. package/dist/api/index.js.map +0 -1
  59. package/dist/api/ipapi.js.map +0 -1
  60. package/dist/api/params.js.map +0 -1
  61. package/dist/client/captchaType/captchaType.js.map +0 -1
  62. package/dist/client/captchaType/captchaTypeSpec.js.map +0 -1
  63. package/dist/client/index.js.map +0 -1
  64. package/dist/client/settings.js.map +0 -1
  65. package/dist/client/user.js.map +0 -1
  66. package/dist/config/config.js.map +0 -1
  67. package/dist/config/enumMap.js +0 -6
  68. package/dist/config/enumMap.js.map +0 -1
  69. package/dist/config/frictionless.js.map +0 -1
  70. package/dist/config/index.js.map +0 -1
  71. package/dist/config/network.js.map +0 -1
  72. package/dist/config/timeouts.js.map +0 -1
  73. package/dist/datasets/assets.js.map +0 -1
  74. package/dist/datasets/captcha.js.map +0 -1
  75. package/dist/datasets/dataset.js.map +0 -1
  76. package/dist/datasets/index.js.map +0 -1
  77. package/dist/datasets/merkle.js.map +0 -1
  78. package/dist/index.js.map +0 -1
  79. package/dist/keyring/index.js.map +0 -1
  80. package/dist/keyring/keyring/types.js.map +0 -1
  81. package/dist/keyring/pair/types.js.map +0 -1
  82. package/dist/procaptcha/api.js.map +0 -1
  83. package/dist/procaptcha/client.js.map +0 -1
  84. package/dist/procaptcha/collector.js.map +0 -1
  85. package/dist/procaptcha/index.js.map +0 -1
  86. package/dist/procaptcha/manager.js.map +0 -1
  87. package/dist/procaptcha/props.js.map +0 -1
  88. package/dist/procaptcha/token.js.map +0 -1
  89. package/dist/procaptcha/utils.js.map +0 -1
  90. package/dist/procaptcha-bundle/index.js.map +0 -1
  91. package/dist/procaptcha-frictionless/index.js.map +0 -1
  92. package/dist/procaptcha-frictionless/props.js.map +0 -1
  93. package/dist/provider/accounts.js.map +0 -1
  94. package/dist/provider/api.js.map +0 -1
  95. package/dist/provider/detection.js.map +0 -1
  96. package/dist/provider/index.js.map +0 -1
  97. package/dist/provider/scheduler.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # @prosopo/types
2
2
 
3
+ ## 3.6.3
4
+ ### Patch Changes
5
+
6
+ - 93d92a7: little bump for publish all
7
+ - Updated dependencies [93d92a7]
8
+ - @prosopo/locale@3.1.25
9
+ - @prosopo/util@3.2.3
10
+ - @prosopo/util-crypto@13.5.27
11
+
12
+ ## 3.6.2
13
+ ### Patch Changes
14
+
15
+ - 8ee8434: bump node engines to 24 and npm version to 11
16
+ - cfee479: make @prosopo/config a dev dep
17
+ - Updated dependencies [8ee8434]
18
+ - Updated dependencies [cfee479]
19
+ - @prosopo/util-crypto@13.5.26
20
+ - @prosopo/locale@3.1.24
21
+ - @prosopo/util@3.2.2
22
+
23
+ ## 3.6.1
24
+ ### Patch Changes
25
+
26
+ - e926831: mega mini bump for all to trigger publish all
27
+ - Updated dependencies [e926831]
28
+ - @prosopo/config@3.1.23
29
+ - @prosopo/locale@3.1.23
30
+ - @prosopo/util@3.2.1
31
+ - @prosopo/util-crypto@13.5.25
32
+
33
+ ## 3.6.0
34
+ ### Minor Changes
35
+
36
+ - bb5f41c: Context awareness
37
+
38
+ ### Patch Changes
39
+
40
+ - 15ae7cf: Change slider defaults
41
+ - 8ce9205: Change engine requirements
42
+ - b6e98b2: Run npm audit
43
+ - Updated dependencies [bb5f41c]
44
+ - Updated dependencies [8ce9205]
45
+ - Updated dependencies [df79c03]
46
+ - Updated dependencies [b6e98b2]
47
+ - @prosopo/util@3.2.0
48
+ - @prosopo/util-crypto@13.5.24
49
+ - @prosopo/locale@3.1.22
50
+ - @prosopo/config@3.1.22
51
+
3
52
  ## 3.5.11
4
53
  ### Patch Changes
5
54
 
package/dist/api/api.js CHANGED
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=api.js.map
1
+
package/dist/api/index.js CHANGED
@@ -1,4 +1,6 @@
1
- export * from "./api.js";
2
- export * from "./params.js";
3
- export * from "./ipapi.js";
4
- //# sourceMappingURL=index.js.map
1
+ import "./api.js";
2
+ import { ApiParams } from "./params.js";
3
+ import "./ipapi.js";
4
+ export {
5
+ ApiParams
6
+ };
package/dist/api/ipapi.js CHANGED
@@ -1,2 +1 @@
1
- export {};
2
- //# sourceMappingURL=ipapi.js.map
1
+
@@ -1,44 +1,46 @@
1
- export var ApiParams;
2
- (function (ApiParams) {
3
- ApiParams["datasetId"] = "datasetId";
4
- ApiParams["user"] = "user";
5
- ApiParams["dapp"] = "dapp";
6
- ApiParams["provider"] = "provider";
7
- ApiParams["blockNumber"] = "blockNumber";
8
- ApiParams["requestHash"] = "requestHash";
9
- ApiParams["captchas"] = "captchas";
10
- ApiParams["commitmentId"] = "commitmentId";
11
- ApiParams["proof"] = "proof";
12
- ApiParams["dappSignature"] = "dappSignature";
13
- ApiParams["dappUserSignature"] = "dappUserSignature";
14
- ApiParams["providerUrl"] = "providerUrl";
15
- ApiParams["procaptchaResponse"] = "procaptcha-response";
16
- ApiParams["verifiedTimeout"] = "verifiedTimeout";
17
- ApiParams["maxVerifiedTime"] = "maxVerifiedTime";
18
- ApiParams["verified"] = "verified";
19
- ApiParams["status"] = "status";
20
- ApiParams["challenge"] = "challenge";
21
- ApiParams["difficulty"] = "difficulty";
22
- ApiParams["nonce"] = "nonce";
23
- ApiParams["timeouts"] = "timeouts";
24
- ApiParams["token"] = "token";
25
- ApiParams["secret"] = "secret";
26
- ApiParams["timestamp"] = "timestamp";
27
- ApiParams["signature"] = "signature";
28
- ApiParams["error"] = "error";
29
- ApiParams["siteKey"] = "siteKey";
30
- ApiParams["captchaType"] = "captchaType";
31
- ApiParams["sessionId"] = "sessionId";
32
- ApiParams["settings"] = "settings";
33
- ApiParams["domains"] = "domains";
34
- ApiParams["frictionlessThreshold"] = "frictionlessThreshold";
35
- ApiParams["powDifficulty"] = "powDifficulty";
36
- ApiParams["score"] = "score";
37
- ApiParams["tier"] = "tier";
38
- ApiParams["detectorKey"] = "detectorKey";
39
- ApiParams["ip"] = "ip";
40
- ApiParams["expirationInSeconds"] = "expirationInSeconds";
41
- ApiParams["enabled"] = "enabled";
42
- ApiParams["headHash"] = "headHash";
43
- })(ApiParams || (ApiParams = {}));
44
- //# sourceMappingURL=params.js.map
1
+ var ApiParams = /* @__PURE__ */ ((ApiParams2) => {
2
+ ApiParams2["datasetId"] = "datasetId";
3
+ ApiParams2["user"] = "user";
4
+ ApiParams2["dapp"] = "dapp";
5
+ ApiParams2["provider"] = "provider";
6
+ ApiParams2["blockNumber"] = "blockNumber";
7
+ ApiParams2["requestHash"] = "requestHash";
8
+ ApiParams2["captchas"] = "captchas";
9
+ ApiParams2["commitmentId"] = "commitmentId";
10
+ ApiParams2["proof"] = "proof";
11
+ ApiParams2["dappSignature"] = "dappSignature";
12
+ ApiParams2["dappUserSignature"] = "dappUserSignature";
13
+ ApiParams2["providerUrl"] = "providerUrl";
14
+ ApiParams2["procaptchaResponse"] = "procaptcha-response";
15
+ ApiParams2["verifiedTimeout"] = "verifiedTimeout";
16
+ ApiParams2["maxVerifiedTime"] = "maxVerifiedTime";
17
+ ApiParams2["verified"] = "verified";
18
+ ApiParams2["status"] = "status";
19
+ ApiParams2["challenge"] = "challenge";
20
+ ApiParams2["difficulty"] = "difficulty";
21
+ ApiParams2["nonce"] = "nonce";
22
+ ApiParams2["timeouts"] = "timeouts";
23
+ ApiParams2["token"] = "token";
24
+ ApiParams2["secret"] = "secret";
25
+ ApiParams2["timestamp"] = "timestamp";
26
+ ApiParams2["signature"] = "signature";
27
+ ApiParams2["error"] = "error";
28
+ ApiParams2["siteKey"] = "siteKey";
29
+ ApiParams2["captchaType"] = "captchaType";
30
+ ApiParams2["sessionId"] = "sessionId";
31
+ ApiParams2["settings"] = "settings";
32
+ ApiParams2["domains"] = "domains";
33
+ ApiParams2["frictionlessThreshold"] = "frictionlessThreshold";
34
+ ApiParams2["powDifficulty"] = "powDifficulty";
35
+ ApiParams2["score"] = "score";
36
+ ApiParams2["tier"] = "tier";
37
+ ApiParams2["detectorKey"] = "detectorKey";
38
+ ApiParams2["ip"] = "ip";
39
+ ApiParams2["expirationInSeconds"] = "expirationInSeconds";
40
+ ApiParams2["enabled"] = "enabled";
41
+ ApiParams2["headHash"] = "headHash";
42
+ return ApiParams2;
43
+ })(ApiParams || {});
44
+ export {
45
+ ApiParams
46
+ };
@@ -15,6 +15,7 @@ exports.abuseScoreThresholdDefault = settings.abuseScoreThresholdDefault;
15
15
  exports.abuseScoreThresholdExceedActionDefault = settings.abuseScoreThresholdExceedActionDefault;
16
16
  exports.captchaTypeDefault = settings.captchaTypeDefault;
17
17
  exports.cityChangeActionDefault = settings.cityChangeActionDefault;
18
+ exports.contextAwareThresholdDefault = settings.contextAwareThresholdDefault;
18
19
  exports.countryChangeActionDefault = settings.countryChangeActionDefault;
19
20
  exports.distanceExceedActionDefault = settings.distanceExceedActionDefault;
20
21
  exports.distanceThresholdKmDefault = settings.distanceThresholdKmDefault;
@@ -8,6 +8,7 @@ const domainsDefault = [];
8
8
  const frictionlessThresholdDefault = 0.5;
9
9
  const powDifficultyDefault = 4;
10
10
  const imageThresholdDefault = 0.8;
11
+ const contextAwareThresholdDefault = 0.7;
11
12
  var IPValidationAction = /* @__PURE__ */ ((IPValidationAction2) => {
12
13
  IPValidationAction2["Allow"] = "allow";
13
14
  IPValidationAction2["Reject"] = "reject";
@@ -68,7 +69,11 @@ const ClientSettingsSchema = z.object({
68
69
  powDifficulty: z.number().optional().default(powDifficultyDefault),
69
70
  imageThreshold: z.number().optional().default(imageThresholdDefault),
70
71
  ipValidationRules: IPValidationRulesSchema.optional(),
71
- disallowWebView: z.boolean().optional().default(false)
72
+ disallowWebView: z.boolean().optional().default(false).optional(),
73
+ contextAware: z.z.object({
74
+ enabled: z.boolean().optional().default(false),
75
+ threshold: z.number().optional().default(contextAwareThresholdDefault)
76
+ }).optional()
72
77
  });
73
78
  exports.ClientSettingsSchema = ClientSettingsSchema;
74
79
  exports.IPValidationAction = IPValidationAction;
@@ -78,6 +83,7 @@ exports.abuseScoreThresholdDefault = abuseScoreThresholdDefault;
78
83
  exports.abuseScoreThresholdExceedActionDefault = abuseScoreThresholdExceedActionDefault;
79
84
  exports.captchaTypeDefault = captchaTypeDefault;
80
85
  exports.cityChangeActionDefault = cityChangeActionDefault;
86
+ exports.contextAwareThresholdDefault = contextAwareThresholdDefault;
81
87
  exports.countryChangeActionDefault = countryChangeActionDefault;
82
88
  exports.distanceExceedActionDefault = distanceExceedActionDefault;
83
89
  exports.distanceThresholdKmDefault = distanceThresholdKmDefault;
@@ -162,7 +162,8 @@ const ProcaptchaConfigSchema = ProsopoClientConfigSchema.and(
162
162
  mode: Mode.optional().default(
163
163
  "visible"
164
164
  /* visible */
165
- )
165
+ ),
166
+ contextAware: z.boolean().optional().default(false)
166
167
  })
167
168
  );
168
169
  const IpApiServiceSpec = z.object({
@@ -188,6 +189,9 @@ const ProsopoConfigSchema = ProsopoBasicConfigSchema.merge(
188
189
  }).optional(),
189
190
  clientListScheduler: z.object({
190
191
  schedule: z.string().optional()
192
+ }).optional(),
193
+ clientEntropyScheduler: z.object({
194
+ schedule: z.string().optional()
191
195
  }).optional()
192
196
  }).optional(),
193
197
  server: ProsopoApiConfigSchema.optional(),
@@ -36,6 +36,7 @@ exports.abuseScoreThresholdDefault = settings.abuseScoreThresholdDefault;
36
36
  exports.abuseScoreThresholdExceedActionDefault = settings.abuseScoreThresholdExceedActionDefault;
37
37
  exports.captchaTypeDefault = settings.captchaTypeDefault;
38
38
  exports.cityChangeActionDefault = settings.cityChangeActionDefault;
39
+ exports.contextAwareThresholdDefault = settings.contextAwareThresholdDefault;
39
40
  exports.countryChangeActionDefault = settings.countryChangeActionDefault;
40
41
  exports.distanceExceedActionDefault = settings.distanceExceedActionDefault;
41
42
  exports.distanceThresholdKmDefault = settings.distanceThresholdKmDefault;
@@ -5,6 +5,7 @@ var ScheduledTaskNames = /* @__PURE__ */ ((ScheduledTaskNames2) => {
5
5
  ScheduledTaskNames2["CalculateSolution"] = "CalculateSolution";
6
6
  ScheduledTaskNames2["StoreCommitmentsExternal"] = "StoreCommitmentsExternal";
7
7
  ScheduledTaskNames2["GetClientList"] = "GetClientList";
8
+ ScheduledTaskNames2["SetClientEntropy"] = "SetClientEntropy";
8
9
  return ScheduledTaskNames2;
9
10
  })(ScheduledTaskNames || {});
10
11
  var ScheduledTaskStatus = /* @__PURE__ */ ((ScheduledTaskStatus2) => {
@@ -1,11 +1,13 @@
1
1
  import { z } from "zod";
2
- var CaptchaType;
3
- (function (CaptchaType) {
4
- CaptchaType["image"] = "image";
5
- CaptchaType["pow"] = "pow";
6
- CaptchaType["frictionless"] = "frictionless";
7
- CaptchaType["invisible"] = "invisible";
8
- })(CaptchaType || (CaptchaType = {}));
2
+ var CaptchaType = /* @__PURE__ */ ((CaptchaType2) => {
3
+ CaptchaType2["image"] = "image";
4
+ CaptchaType2["pow"] = "pow";
5
+ CaptchaType2["frictionless"] = "frictionless";
6
+ CaptchaType2["invisible"] = "invisible";
7
+ return CaptchaType2;
8
+ })(CaptchaType || {});
9
9
  const CaptchaTypeSchema = z.nativeEnum(CaptchaType);
10
- export { CaptchaType, CaptchaTypeSchema };
11
- //# sourceMappingURL=captchaType.js.map
10
+ export {
11
+ CaptchaType,
12
+ CaptchaTypeSchema
13
+ };
@@ -1,5 +1,6 @@
1
1
  import { nativeEnum } from "zod";
2
2
  import { CaptchaType } from "./captchaType.js";
3
3
  const CaptchaTypeSpec = nativeEnum(CaptchaType);
4
- export { CaptchaTypeSpec };
5
- //# sourceMappingURL=captchaTypeSpec.js.map
4
+ export {
5
+ CaptchaTypeSpec
6
+ };
@@ -1,5 +1,30 @@
1
- export * from "./user.js";
2
- export * from "./settings.js";
3
- export * from "./captchaType/captchaType.js";
4
- export * from "./captchaType/captchaTypeSpec.js";
5
- //# sourceMappingURL=index.js.map
1
+ import { Tier, TierMonthlyLimits, TierSchema } from "./user.js";
2
+ import { ClientSettingsSchema, IPValidationAction, IPValidationActionSchema, IPValidationRulesSchema, abuseScoreThresholdDefault, abuseScoreThresholdExceedActionDefault, captchaTypeDefault, cityChangeActionDefault, contextAwareThresholdDefault, countryChangeActionDefault, distanceExceedActionDefault, distanceThresholdKmDefault, domainsDefault, frictionlessThresholdDefault, imageThresholdDefault, ispChangeActionDefault, powDifficultyDefault, requireAllConditionsDefault } from "./settings.js";
3
+ import { CaptchaType, CaptchaTypeSchema } from "./captchaType/captchaType.js";
4
+ import { CaptchaTypeSpec } from "./captchaType/captchaTypeSpec.js";
5
+ export {
6
+ CaptchaType,
7
+ CaptchaTypeSchema,
8
+ CaptchaTypeSpec,
9
+ ClientSettingsSchema,
10
+ IPValidationAction,
11
+ IPValidationActionSchema,
12
+ IPValidationRulesSchema,
13
+ Tier,
14
+ TierMonthlyLimits,
15
+ TierSchema,
16
+ abuseScoreThresholdDefault,
17
+ abuseScoreThresholdExceedActionDefault,
18
+ captchaTypeDefault,
19
+ cityChangeActionDefault,
20
+ contextAwareThresholdDefault,
21
+ countryChangeActionDefault,
22
+ distanceExceedActionDefault,
23
+ distanceThresholdKmDefault,
24
+ domainsDefault,
25
+ frictionlessThresholdDefault,
26
+ imageThresholdDefault,
27
+ ispChangeActionDefault,
28
+ powDifficultyDefault,
29
+ requireAllConditionsDefault
30
+ };
@@ -5,6 +5,7 @@ export declare const domainsDefault: string[];
5
5
  export declare const frictionlessThresholdDefault = 0.5;
6
6
  export declare const powDifficultyDefault = 4;
7
7
  export declare const imageThresholdDefault = 0.8;
8
+ export declare const contextAwareThresholdDefault = 0.7;
8
9
  export declare enum IPValidationAction {
9
10
  Allow = "allow",
10
11
  Reject = "reject",
@@ -314,14 +315,23 @@ export declare const ClientSettingsSchema: z.ZodObject<{
314
315
  }> | undefined;
315
316
  forceConsistentIp?: boolean | undefined;
316
317
  }>>;
317
- disallowWebView: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
318
+ disallowWebView: z.ZodOptional<z.ZodDefault<z.ZodOptional<z.ZodBoolean>>>;
319
+ contextAware: z.ZodOptional<z.ZodObject<{
320
+ enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
321
+ threshold: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
322
+ }, "strip", z.ZodTypeAny, {
323
+ enabled: boolean;
324
+ threshold: number;
325
+ }, {
326
+ enabled?: boolean | undefined;
327
+ threshold?: number | undefined;
328
+ }>>;
318
329
  }, "strip", z.ZodTypeAny, {
319
330
  captchaType: CaptchaType;
320
331
  domains: string[];
321
332
  frictionlessThreshold: number;
322
333
  powDifficulty: number;
323
334
  imageThreshold: number;
324
- disallowWebView: boolean;
325
335
  ipValidationRules?: {
326
336
  actions: {
327
337
  countryChangeAction: IPValidationAction;
@@ -347,6 +357,11 @@ export declare const ClientSettingsSchema: z.ZodObject<{
347
357
  requireAllConditions?: boolean | undefined;
348
358
  }> | undefined;
349
359
  } | undefined;
360
+ disallowWebView?: boolean | undefined;
361
+ contextAware?: {
362
+ enabled: boolean;
363
+ threshold: number;
364
+ } | undefined;
350
365
  }, {
351
366
  captchaType?: CaptchaType | undefined;
352
367
  domains?: string[] | undefined;
@@ -379,6 +394,10 @@ export declare const ClientSettingsSchema: z.ZodObject<{
379
394
  forceConsistentIp?: boolean | undefined;
380
395
  } | undefined;
381
396
  disallowWebView?: boolean | undefined;
397
+ contextAware?: {
398
+ enabled?: boolean | undefined;
399
+ threshold?: number | undefined;
400
+ } | undefined;
382
401
  }>;
383
402
  export type IUserSettings = output<typeof ClientSettingsSchema>;
384
403
  export type IIPValidationRules = output<typeof IPValidationRulesSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/client/settings.ts"],"names":[],"mappings":"AAaA,OAAO,EAAkC,KAAK,MAAM,EAAU,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAG3D,eAAO,MAAM,kBAAkB,2BAA2B,CAAC;AAC3D,eAAO,MAAM,cAAc,EAAE,MAAM,EAAO,CAAC;AAC3C,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAChD,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAGzC,oBAAY,kBAAkB;IAC7B,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,IAAI,SAAS;CACb;AAED,MAAM,MAAM,mBAAmB,GAAG;IACjC,GAAG,EAAE,OAAO,CAAC;IACb,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,wBAAwB,4CAAmC,CAAC;AAGzE,eAAO,MAAM,0BAA0B,2BAA2B,CAAC;AACnE,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;AAChE,eAAO,MAAM,sBAAsB,2BAA2B,CAAC;AAC/D,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAC/C,eAAO,MAAM,0BAA0B,QAAQ,CAAC;AAChD,eAAO,MAAM,2BAA2B,4BAA4B,CAAC;AACrE,eAAO,MAAM,sCAAsC,4BAA4B,CAAC;AAChF,eAAO,MAAM,2BAA2B,QAAQ,CAAC;AAEjD,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYtB,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;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string, array } from "zod";
2
2
  import { CaptchaType } from "./captchaType/captchaType.js";
3
3
  import { CaptchaTypeSpec } from "./captchaType/captchaTypeSpec.js";
4
- export const captchaTypeDefault = CaptchaType.frictionless;
5
- export const domainsDefault = [];
6
- export const frictionlessThresholdDefault = 0.5;
7
- export const powDifficultyDefault = 4;
8
- export const imageThresholdDefault = 0.8;
9
- export var IPValidationAction;
10
- (function (IPValidationAction) {
11
- IPValidationAction["Allow"] = "allow";
12
- IPValidationAction["Reject"] = "reject";
13
- IPValidationAction["Flag"] = "flag";
14
- })(IPValidationAction || (IPValidationAction = {}));
15
- export const IPValidationActionSchema = z.nativeEnum(IPValidationAction);
16
- export const countryChangeActionDefault = IPValidationAction.Allow;
17
- export const cityChangeActionDefault = IPValidationAction.Allow;
18
- export const ispChangeActionDefault = IPValidationAction.Allow;
19
- export const distanceThresholdKmDefault = 1000;
20
- export const abuseScoreThresholdDefault = 0.005;
21
- export const distanceExceedActionDefault = IPValidationAction.Reject;
22
- export const abuseScoreThresholdExceedActionDefault = IPValidationAction.Reject;
23
- export const requireAllConditionsDefault = false;
4
+ const captchaTypeDefault = CaptchaType.frictionless;
5
+ const domainsDefault = [];
6
+ const frictionlessThresholdDefault = 0.5;
7
+ const powDifficultyDefault = 4;
8
+ const imageThresholdDefault = 0.8;
9
+ const contextAwareThresholdDefault = 0.7;
10
+ var IPValidationAction = /* @__PURE__ */ ((IPValidationAction2) => {
11
+ IPValidationAction2["Allow"] = "allow";
12
+ IPValidationAction2["Reject"] = "reject";
13
+ IPValidationAction2["Flag"] = "flag";
14
+ return IPValidationAction2;
15
+ })(IPValidationAction || {});
16
+ const IPValidationActionSchema = z.nativeEnum(IPValidationAction);
17
+ const countryChangeActionDefault = "allow";
18
+ const cityChangeActionDefault = "allow";
19
+ const ispChangeActionDefault = "allow";
20
+ const distanceThresholdKmDefault = 1e3;
21
+ const abuseScoreThresholdDefault = 5e-3;
22
+ const distanceExceedActionDefault = "reject";
23
+ const abuseScoreThresholdExceedActionDefault = "reject";
24
+ const requireAllConditionsDefault = false;
24
25
  const IPValidationSchema = object({
25
- actions: object({
26
- countryChangeAction: IPValidationActionSchema.optional(),
27
- cityChangeAction: IPValidationActionSchema.optional(),
28
- ispChangeAction: IPValidationActionSchema.optional(),
29
- distanceExceedAction: IPValidationActionSchema.optional(),
30
- abuseScoreExceedAction: IPValidationActionSchema.optional(),
31
- }).partial(),
32
- distanceThresholdKm: number().positive().optional(),
33
- abuseScoreThreshold: number().positive().optional(),
34
- requireAllConditions: boolean().optional(),
26
+ actions: object({
27
+ countryChangeAction: IPValidationActionSchema.optional(),
28
+ cityChangeAction: IPValidationActionSchema.optional(),
29
+ ispChangeAction: IPValidationActionSchema.optional(),
30
+ distanceExceedAction: IPValidationActionSchema.optional(),
31
+ abuseScoreExceedAction: IPValidationActionSchema.optional()
32
+ }).partial(),
33
+ // all optional, so you can just override what you need
34
+ distanceThresholdKm: number().positive().optional(),
35
+ abuseScoreThreshold: number().positive().optional(),
36
+ requireAllConditions: boolean().optional()
35
37
  });
36
- export const IPValidationRulesSchema = object({
37
- actions: object({
38
- countryChangeAction: IPValidationActionSchema.optional().default(countryChangeActionDefault),
39
- cityChangeAction: IPValidationActionSchema.optional().default(cityChangeActionDefault),
40
- ispChangeAction: IPValidationActionSchema.optional().default(ispChangeActionDefault),
41
- distanceExceedAction: IPValidationActionSchema.optional().default(distanceExceedActionDefault),
42
- abuseScoreExceedAction: IPValidationActionSchema.optional().default(abuseScoreThresholdExceedActionDefault),
43
- }),
44
- distanceThresholdKm: number()
45
- .positive()
46
- .optional()
47
- .default(distanceThresholdKmDefault),
48
- abuseScoreThreshold: number()
49
- .positive()
50
- .optional()
51
- .default(abuseScoreThresholdDefault),
52
- requireAllConditions: z
53
- .boolean()
54
- .optional()
55
- .default(requireAllConditionsDefault),
56
- countryOverrides: z.record(string(), IPValidationSchema).optional(),
57
- forceConsistentIp: boolean().optional().default(false),
38
+ const IPValidationRulesSchema = object({
39
+ actions: object({
40
+ countryChangeAction: IPValidationActionSchema.optional().default(
41
+ countryChangeActionDefault
42
+ ),
43
+ cityChangeAction: IPValidationActionSchema.optional().default(
44
+ cityChangeActionDefault
45
+ ),
46
+ ispChangeAction: IPValidationActionSchema.optional().default(
47
+ ispChangeActionDefault
48
+ ),
49
+ distanceExceedAction: IPValidationActionSchema.optional().default(
50
+ distanceExceedActionDefault
51
+ ),
52
+ abuseScoreExceedAction: IPValidationActionSchema.optional().default(
53
+ abuseScoreThresholdExceedActionDefault
54
+ )
55
+ }),
56
+ distanceThresholdKm: number().positive().optional().default(distanceThresholdKmDefault),
57
+ abuseScoreThreshold: number().positive().optional().default(abuseScoreThresholdDefault),
58
+ requireAllConditions: z.boolean().optional().default(requireAllConditionsDefault),
59
+ // overrides are now lightweight, not recursive
60
+ countryOverrides: z.record(string(), IPValidationSchema).optional(),
61
+ forceConsistentIp: boolean().optional().default(false)
58
62
  });
59
- export const ClientSettingsSchema = object({
60
- captchaType: CaptchaTypeSpec.optional().default(captchaTypeDefault),
61
- domains: array(string())
62
- .optional()
63
- .default([...domainsDefault]),
64
- frictionlessThreshold: number()
65
- .optional()
66
- .default(frictionlessThresholdDefault),
67
- powDifficulty: number().optional().default(powDifficultyDefault),
68
- imageThreshold: number().optional().default(imageThresholdDefault),
69
- ipValidationRules: IPValidationRulesSchema.optional(),
70
- disallowWebView: boolean().optional().default(false),
63
+ const ClientSettingsSchema = object({
64
+ captchaType: CaptchaTypeSpec.optional().default(captchaTypeDefault),
65
+ domains: array(string()).optional().default([...domainsDefault]),
66
+ frictionlessThreshold: number().optional().default(frictionlessThresholdDefault),
67
+ powDifficulty: number().optional().default(powDifficultyDefault),
68
+ imageThreshold: number().optional().default(imageThresholdDefault),
69
+ ipValidationRules: IPValidationRulesSchema.optional(),
70
+ disallowWebView: boolean().optional().default(false).optional(),
71
+ contextAware: z.object({
72
+ enabled: boolean().optional().default(false),
73
+ threshold: number().optional().default(contextAwareThresholdDefault)
74
+ }).optional()
71
75
  });
72
- //# sourceMappingURL=settings.js.map
76
+ export {
77
+ ClientSettingsSchema,
78
+ IPValidationAction,
79
+ IPValidationActionSchema,
80
+ IPValidationRulesSchema,
81
+ abuseScoreThresholdDefault,
82
+ abuseScoreThresholdExceedActionDefault,
83
+ captchaTypeDefault,
84
+ cityChangeActionDefault,
85
+ contextAwareThresholdDefault,
86
+ countryChangeActionDefault,
87
+ distanceExceedActionDefault,
88
+ distanceThresholdKmDefault,
89
+ domainsDefault,
90
+ frictionlessThresholdDefault,
91
+ imageThresholdDefault,
92
+ ispChangeActionDefault,
93
+ powDifficultyDefault,
94
+ requireAllConditionsDefault
95
+ };
@@ -1,20 +1,33 @@
1
1
  import { z } from "zod";
2
- export var Tier;
3
- (function (Tier) {
4
- Tier["Free"] = "free";
5
- Tier["Professional"] = "professional";
6
- Tier["Enterprise"] = "enterprise";
7
- })(Tier || (Tier = {}));
8
- export const TierSchema = z.nativeEnum(Tier);
9
- export const TierMonthlyLimits = {
10
- [Tier.Free]: {
11
- verificationRequests: 100000,
12
- },
13
- [Tier.Professional]: {
14
- verificationRequests: 1000000,
15
- },
16
- [Tier.Enterprise]: {
17
- verificationRequests: "Unlimited",
18
- },
2
+ var Tier = /* @__PURE__ */ ((Tier2) => {
3
+ Tier2["Free"] = "free";
4
+ Tier2["Professional"] = "professional";
5
+ Tier2["Enterprise"] = "enterprise";
6
+ return Tier2;
7
+ })(Tier || {});
8
+ const TierSchema = z.nativeEnum(Tier);
9
+ const TierMonthlyLimits = {
10
+ [
11
+ "free"
12
+ /* Free */
13
+ ]: {
14
+ verificationRequests: 1e5
15
+ },
16
+ [
17
+ "professional"
18
+ /* Professional */
19
+ ]: {
20
+ verificationRequests: 1e6
21
+ },
22
+ [
23
+ "enterprise"
24
+ /* Enterprise */
25
+ ]: {
26
+ verificationRequests: "Unlimited"
27
+ }
28
+ };
29
+ export {
30
+ Tier,
31
+ TierMonthlyLimits,
32
+ TierSchema
19
33
  };
20
- //# sourceMappingURL=user.js.map