@prosopo/user-access-policy 3.12.7 → 3.12.9

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 (96) hide show
  1. package/.turbo/turbo-build$colon$cjs.log +45 -41
  2. package/.turbo/turbo-build$colon$tsc.log +14 -14
  3. package/.turbo/turbo-build.log +46 -42
  4. package/CHANGELOG.md +40 -0
  5. package/dist/.export.js +7 -21
  6. package/dist/_virtual/_rolldown/runtime.js +3 -0
  7. package/dist/api/.export.js +2 -9
  8. package/dist/api/accessRulesApiClient.js +1 -1
  9. package/dist/api/delete/.export.js +2 -1
  10. package/dist/api/delete/deleteAllRules.js +22 -24
  11. package/dist/api/delete/deleteRuleGroups.js +39 -51
  12. package/dist/api/delete/deleteRules.js +37 -41
  13. package/dist/api/read/.export.js +2 -1
  14. package/dist/api/read/fetchRules.js +34 -42
  15. package/dist/api/read/findRuleIds.js +35 -48
  16. package/dist/api/read/getMissingIds.js +36 -40
  17. package/dist/api/ruleApiRoutes.js +62 -120
  18. package/dist/api/rulesApiClient.js +51 -87
  19. package/dist/api/write/.export.js +2 -1
  20. package/dist/api/write/insertRules.js +84 -102
  21. package/dist/api/write/rehashRules.js +48 -56
  22. package/dist/cjs/.export.cjs +21 -23
  23. package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
  24. package/dist/cjs/api/.export.cjs +6 -10
  25. package/dist/cjs/api/accessRulesApiClient.cjs +0 -0
  26. package/dist/cjs/api/delete/.export.cjs +0 -1
  27. package/dist/cjs/api/delete/deleteAllRules.cjs +22 -24
  28. package/dist/cjs/api/delete/deleteRuleGroups.cjs +39 -51
  29. package/dist/cjs/api/delete/deleteRules.cjs +41 -42
  30. package/dist/cjs/api/read/.export.cjs +0 -1
  31. package/dist/cjs/api/read/fetchRules.cjs +34 -41
  32. package/dist/cjs/api/read/findRuleIds.cjs +37 -48
  33. package/dist/cjs/api/read/getMissingIds.cjs +36 -39
  34. package/dist/cjs/api/ruleApiRoutes.cjs +69 -125
  35. package/dist/cjs/api/rulesApiClient.cjs +54 -90
  36. package/dist/cjs/api/write/.export.cjs +0 -1
  37. package/dist/cjs/api/write/insertRules.cjs +85 -103
  38. package/dist/cjs/api/write/rehashRules.cjs +48 -56
  39. package/dist/cjs/classifyOs.cjs +46 -26
  40. package/dist/cjs/mongoose/.export.cjs +2 -3
  41. package/dist/cjs/mongoose/mongooseRuleSchema.cjs +97 -36
  42. package/dist/cjs/redis/.export.cjs +4 -5
  43. package/dist/cjs/redis/reader/redisAggregate.cjs +59 -84
  44. package/dist/cjs/redis/reader/redisRulesQuery.cjs +74 -116
  45. package/dist/cjs/redis/reader/redisRulesReader.cjs +322 -503
  46. package/dist/cjs/redis/reader/redisRulesSplitQuery.cjs +94 -72
  47. package/dist/cjs/redis/redisClient.cjs +53 -58
  48. package/dist/cjs/redis/redisRuleIndex.cjs +93 -49
  49. package/dist/cjs/redis/redisRulesStorage.cjs +21 -30
  50. package/dist/cjs/redis/redisRulesWriter.cjs +86 -112
  51. package/dist/cjs/rule.cjs +8 -7
  52. package/dist/cjs/ruleInput/.export.cjs +7 -8
  53. package/dist/cjs/ruleInput/policyInput.cjs +36 -39
  54. package/dist/cjs/ruleInput/ruleInput.cjs +37 -42
  55. package/dist/cjs/ruleInput/userScopeInput.cjs +47 -55
  56. package/dist/cjs/ruleRecord.cjs +15 -22
  57. package/dist/cjs/rulesStorage.cjs +7 -6
  58. package/dist/cjs/transformRule.cjs +36 -70
  59. package/dist/classifyOs.js +48 -29
  60. package/dist/mongoose/.export.js +2 -3
  61. package/dist/mongoose/mongooseRuleSchema.js +99 -38
  62. package/dist/redis/.export.js +3 -5
  63. package/dist/redis/reader/redisAggregate.js +60 -86
  64. package/dist/redis/reader/redisRulesQuery.js +75 -118
  65. package/dist/redis/reader/redisRulesReader.js +312 -487
  66. package/dist/redis/reader/redisRulesSplitQuery.js +96 -75
  67. package/dist/redis/redisClient.js +54 -62
  68. package/dist/redis/redisRuleIndex.js +93 -58
  69. package/dist/redis/redisRulesStorage.js +21 -30
  70. package/dist/redis/redisRulesWriter.js +82 -113
  71. package/dist/rule.js +10 -10
  72. package/dist/ruleInput/.export.js +3 -7
  73. package/dist/ruleInput/policyInput.d.ts +52 -1
  74. package/dist/ruleInput/policyInput.d.ts.map +1 -1
  75. package/dist/ruleInput/policyInput.js +35 -41
  76. package/dist/ruleInput/policyInput.js.map +1 -1
  77. package/dist/ruleInput/ruleInput.d.ts.map +1 -1
  78. package/dist/ruleInput/ruleInput.js +36 -44
  79. package/dist/ruleInput/ruleInput.js.map +1 -1
  80. package/dist/ruleInput/userScopeInput.js +44 -55
  81. package/dist/ruleRecord.js +17 -27
  82. package/dist/rulesStorage.js +9 -8
  83. package/dist/tests/policyInput.unit.test.js +50 -1
  84. package/dist/tests/policyInput.unit.test.js.map +1 -1
  85. package/dist/tests/redis/redisRulesStorage.integration.test.js +22 -3
  86. package/dist/tests/redis/redisRulesStorage.integration.test.js.map +1 -1
  87. package/dist/transformRule.js +34 -73
  88. package/dist/transformRule.js.map +1 -1
  89. package/entries.ts +25 -6
  90. package/package.json +13 -12
  91. package/src/ruleInput/policyInput.ts +45 -2
  92. package/src/ruleInput/ruleInput.ts +10 -3
  93. package/src/tests/policyInput.unit.test.ts +69 -1
  94. package/src/tests/redis/redisRulesStorage.integration.test.ts +191 -148
  95. package/src/transformRule.ts +2 -2
  96. package/tsconfig.tsbuildinfo +1 -1
@@ -1,5 +1,5 @@
1
1
 
2
- > @prosopo/user-access-policy@3.12.7 build:cjs
2
+ > @prosopo/user-access-policy@3.12.9 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
@@ -29,45 +29,49 @@ ViteCommonJSConfig: .
29
29
  '@prosopo/api'
30
30
  ]
31
31
  }
32
- vite v6.4.1 building SSR bundle for production...
32
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
33
+ vite v8.1.5 building ssr environment for production...
33
34
  Bundle build started
34
- transforming...
35
- Build end
36
- ✓ 35 modules transformed.
35
+ 
36
+ ✓ 37 modules transformed.
37
37
  rendering chunks...
38
- dist/cjs/api/delete/.export.cjs  0.01 kB
39
- dist/cjs/api/read/.export.cjs  0.01 kB
40
- dist/cjs/api/write/.export.cjs  0.01 kB
41
- dist/cjs/mongoose/.export.cjs  0.23 kB
42
- dist/cjs/rulesStorage.cjs  0.34 kB
43
- dist/cjs/redis/.export.cjs  0.36 kB
44
- dist/cjs/rule.cjs  0.46 kB
45
- dist/cjs/ruleInput/.export.cjs  0.46 kB
46
- dist/cjs/api/.export.cjs  0.57 kB
47
- dist/cjs/classifyOs.cjs  0.62 kB
48
- dist/cjs/api/delete/deleteAllRules.cjs  0.77 kB
49
- dist/cjs/ruleRecord.cjs  0.84 kB
50
- dist/cjs/api/read/getMissingIds.cjs  1.15 kB
51
- dist/cjs/api/read/fetchRules.cjs  1.22 kB
52
- dist/cjs/redis/redisRulesStorage.cjs  1.35 kB
53
- dist/cjs/.export.cjs  1.37 kB
54
- dist/cjs/api/delete/deleteRules.cjs  1.51 kB
55
- dist/cjs/mongoose/mongooseRuleSchema.cjs  1.52 kB
56
- dist/cjs/api/delete/deleteRuleGroups.cjs  1.57 kB
57
- dist/cjs/api/write/rehashRules.cjs  1.64 kB
58
- dist/cjs/api/read/findRuleIds.cjs  1.65 kB
59
- dist/cjs/redis/redisClient.cjs  2.09 kB
60
- dist/cjs/ruleInput/ruleInput.cjs  2.11 kB
61
- dist/cjs/ruleInput/policyInput.cjs  2.14 kB
62
- dist/cjs/api/rulesApiClient.cjs  2.60 kB
63
- dist/cjs/redis/reader/redisRulesSplitQuery.cjs  2.66 kB
64
- dist/cjs/ruleInput/userScopeInput.cjs  2.67 kB
65
- dist/cjs/redis/reader/redisAggregate.cjs  2.98 kB
66
- dist/cjs/transformRule.cjs  3.05 kB
67
- dist/cjs/redis/redisRuleIndex.cjs  3.07 kB
68
- dist/cjs/api/write/insertRules.cjs  3.38 kB
69
- dist/cjs/redis/redisRulesWriter.cjs  3.68 kB
70
- dist/cjs/api/ruleApiRoutes.cjs  4.55 kB
71
- dist/cjs/redis/reader/redisRulesQuery.cjs  4.60 kB
72
- dist/cjs/redis/reader/redisRulesReader.cjs 17.15 kB
73
- ✓ built in 529ms
38
+ computing gzip size...
39
+ dist/cjs/api/accessRulesApiClient.cjs 0.00 kB │ gzip: 0.02 kB
40
+ dist/cjs/api/delete/.export.cjs 0.00 kB │ gzip: 0.02 kB
41
+ dist/cjs/api/read/.export.cjs 0.00 kB │ gzip: 0.02 kB
42
+ dist/cjs/api/write/.export.cjs 0.00 kB │ gzip: 0.02 kB
43
+ dist/cjs/mongoose/.export.cjs 0.25 kB │ gzip: 0.16 kB
44
+ dist/cjs/rulesStorage.cjs 0.34 kB │ gzip: 0.22 kB
45
+ dist/cjs/redis/.export.cjs 0.40 kB │ gzip: 0.18 kB
46
+ dist/cjs/rule.cjs 0.45 kB │ gzip: 0.26 kB
47
+ dist/cjs/api/.export.cjs 0.53 kB │ gzip: 0.21 kB
48
+ dist/cjs/ruleInput/.export.cjs 0.57 kB │ gzip: 0.20 kB
49
+ dist/cjs/api/delete/deleteAllRules.cjs 0.79 kB │ gzip: 0.41 kB
50
+ dist/cjs/ruleRecord.cjs 0.83 kB │ gzip: 0.35 kB
51
+ dist/cjs/_virtual/_rolldown/runtime.cjs 1.00 kB │ gzip: 0.50 kB
52
+ dist/cjs/api/read/getMissingIds.cjs 1.12 kB │ gzip: 0.51 kB
53
+ dist/cjs/api/read/fetchRules.cjs 1.22 kB │ gzip: 0.54 kB
54
+ dist/cjs/redis/redisRulesStorage.cjs 1.41 kB │ gzip: 0.49 kB
55
+ dist/cjs/api/delete/deleteRuleGroups.cjs 1.43 kB │ gzip: 0.65 kB
56
+ dist/cjs/api/write/rehashRules.cjs 1.48 kB │ gzip: 0.56 kB
57
+ dist/cjs/api/delete/deleteRules.cjs 1.52 kB │ gzip: 0.65 kB
58
+ dist/cjs/mongoose/mongooseRuleSchema.cjs 1.52 kB │ gzip: 0.42 kB
59
+ dist/cjs/.export.cjs 1.55 kB │ gzip: 0.39 kB
60
+ dist/cjs/api/read/findRuleIds.cjs 1.58 kB │ gzip: 0.66 kB
61
+ dist/cjs/redis/redisClient.cjs 1.92 kB │ gzip: 0.72 kB
62
+ dist/cjs/classifyOs.cjs 2.04 kB │ gzip: 1.05 kB
63
+ dist/cjs/ruleInput/policyInput.cjs 2.09 kB │ gzip: 0.79 kB
64
+ dist/cjs/ruleInput/ruleInput.cjs 2.24 kB │ gzip: 0.67 kB
65
+ dist/cjs/ruleInput/userScopeInput.cjs 2.44 kB │ gzip: 0.77 kB
66
+ dist/cjs/api/rulesApiClient.cjs 2.53 kB │ gzip: 0.68 kB
67
+ dist/cjs/redis/reader/redisAggregate.cjs 2.57 kB │ gzip: 1.04 kB
68
+ dist/cjs/transformRule.cjs 2.90 kB │ gzip: 1.03 kB
69
+ dist/cjs/redis/redisRuleIndex.cjs 3.03 kB │ gzip: 0.81 kB
70
+ dist/cjs/api/write/insertRules.cjs 3.12 kB │ gzip: 1.09 kB
71
+ dist/cjs/redis/redisRulesWriter.cjs 3.50 kB │ gzip: 1.15 kB
72
+ dist/cjs/api/ruleApiRoutes.cjs 4.14 kB │ gzip: 1.06 kB
73
+ dist/cjs/redis/reader/redisRulesSplitQuery.cjs 4.27 kB │ gzip: 1.92 kB
74
+ dist/cjs/redis/reader/redisRulesQuery.cjs 4.49 kB │ gzip: 1.51 kB
75
+ dist/cjs/redis/reader/redisRulesReader.cjs 11.61 kB │ gzip: 2.81 kB
76
+
77
+ ✓ built in 114ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/user-access-policy@3.12.7 build:tsc
2
+ > @prosopo/user-access-policy@3.12.9 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 10:22:25 PM - Projects in this build:
5
+ 8:59:16 PM - Projects in this build:
6
6
  * ../../dev/config/tsconfig.json
7
7
  * ../locale/tsconfig.json
8
8
  * ../util/tsconfig.json
@@ -15,27 +15,27 @@
15
15
  * ../api/tsconfig.json
16
16
  * tsconfig.json
17
17
 
18
- 10:22:25 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/tsconfig.tsbuildinfo'
18
+ 8:59:16 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/tsconfig.tsbuildinfo'
19
19
 
20
- 10:22:25 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
20
+ 8:59:16 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
21
21
 
22
- 10:22:26 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
22
+ 8:59:16 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
23
23
 
24
- 10:22:26 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
24
+ 8:59:16 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
25
25
 
26
- 10:22:26 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
26
+ 8:59:16 PM - Project '../util-crypto/tsconfig.json' is up to date because newest input '../util-crypto/src/types.ts' is older than output '../util-crypto/tsconfig.tsbuildinfo'
27
27
 
28
- 10:22:26 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/procaptcha/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
28
+ 8:59:16 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/provider/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
29
29
 
30
- 10:22:26 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
30
+ 8:59:16 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/tests/utils/batches.unit.test.ts' is older than output '../common/tsconfig.tsbuildinfo'
31
31
 
32
- 10:22:26 PM - Project '../api-route/tsconfig.json' is up to date because newest input '../api-route/src/apiRoutes.ts' is older than output '../api-route/tsconfig.tsbuildinfo'
32
+ 8:59:16 PM - Project '../api-route/tsconfig.json' is up to date because newest input '../api-route/src/apiRoutes.ts' is older than output '../api-route/tsconfig.tsbuildinfo'
33
33
 
34
- 10:22:26 PM - Project '../redis-client/tsconfig.json' is up to date because newest input '../redis-client/src/index.ts' is older than output '../redis-client/tsconfig.tsbuildinfo'
34
+ 8:59:16 PM - Project '../redis-client/tsconfig.json' is up to date because newest input '../redis-client/src/index.ts' is older than output '../redis-client/tsconfig.tsbuildinfo'
35
35
 
36
- 10:22:26 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
36
+ 8:59:16 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
37
37
 
38
- 10:22:26 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
38
+ 8:59:16 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
39
39
 
40
- 10:22:26 PM - Building project '/home/runner/work/captcha/captcha/packages/user-access-policy/tsconfig.json'...
40
+ 8:59:16 PM - Building project '/home/runner/work/captcha/captcha/packages/user-access-policy/tsconfig.json'...
41
41
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/user-access-policy@3.12.7 build
2
+ > @prosopo/user-access-policy@3.12.9 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/user-access-policy@3.12.7 build:cross-env
6
+ > @prosopo/user-access-policy@3.12.9 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -25,6 +25,7 @@ ViteEsmConfig: .
25
25
  '@prosopo/common',
26
26
  '@prosopo/locale',
27
27
  '@prosopo/logger',
28
+ The plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the resolve.tsconfigPaths option. You can remove the plugin and set resolve.tsconfigPaths: true in your Vite config instead.
28
29
  '@prosopo/util',
29
30
  '@prosopo/types',
30
31
  '@prosopo/util-crypto',
@@ -33,45 +34,48 @@ ViteEsmConfig: .
33
34
  '@prosopo/api'
34
35
  ]
35
36
  }
36
- vite v6.4.1 building SSR bundle for production...
37
+ vite v8.1.5 building ssr environment for production...
37
38
  Bundle build started
38
- transforming...
39
- Build end
40
- ✓ 35 modules transformed.
39
+ 
40
+ ✓ 37 modules transformed.
41
41
  rendering chunks...
42
- dist/api/delete/.export.js  0.00 kB
43
- dist/api/read/.export.js  0.00 kB
44
- dist/api/write/.export.js  0.00 kB
45
- dist/mongoose/.export.js  0.11 kB
46
- dist/redis/.export.js  0.20 kB
47
- dist/rulesStorage.js  0.23 kB
48
- dist/ruleInput/.export.js  0.27 kB
49
- dist/rule.js  0.32 kB
50
- dist/api/.export.js  0.37 kB
51
- dist/classifyOs.js  0.51 kB
52
- dist/ruleRecord.js  0.62 kB
53
- dist/api/delete/deleteAllRules.js  0.67 kB
54
- dist/.export.js  0.93 kB
55
- dist/api/read/getMissingIds.js  1.01 kB
56
- dist/api/read/fetchRules.js  1.08 kB
57
- dist/redis/redisRulesStorage.js  1.21 kB
58
- dist/mongoose/mongooseRuleSchema.js  1.41 kB
59
- dist/api/delete/deleteRules.js  1.44 kB
60
- dist/api/delete/deleteRuleGroups.js  1.44 kB
61
- dist/api/read/findRuleIds.js  1.54 kB
62
- dist/api/write/rehashRules.js  1.54 kB
63
- dist/ruleInput/ruleInput.js  1.76 kB
64
- dist/redis/redisClient.js  1.90 kB
65
- dist/ruleInput/policyInput.js  1.96 kB
66
- dist/api/rulesApiClient.js  2.36 kB
67
- dist/ruleInput/userScopeInput.js  2.44 kB
68
- dist/redis/reader/redisRulesSplitQuery.js  2.55 kB
69
- dist/redis/redisRuleIndex.js  2.58 kB
70
- dist/transformRule.js  2.76 kB
71
- dist/redis/reader/redisAggregate.js  2.77 kB
72
- dist/api/write/insertRules.js  3.22 kB
73
- dist/redis/redisRulesWriter.js  3.47 kB
74
- dist/api/ruleApiRoutes.js  4.33 kB
75
- dist/redis/reader/redisRulesQuery.js  4.45 kB
76
- dist/redis/reader/redisRulesReader.js 16.17 kB
77
- ✓ built in 562ms
42
+ computing gzip size...
43
+ dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
44
+ dist/api/accessRulesApiClient.js 0.05 kB │ gzip: 0.07 kB
45
+ dist/api/delete/.export.js 0.05 kB │ gzip: 0.07 kB
46
+ dist/api/read/.export.js 0.05 kB │ gzip: 0.07 kB
47
+ dist/api/write/.export.js 0.05 kB │ gzip: 0.07 kB
48
+ dist/mongoose/.export.js 0.14 kB │ gzip: 0.11 kB
49
+ dist/redis/.export.js 0.24 kB │ gzip: 0.14 kB
50
+ dist/rulesStorage.js 0.29 kB │ gzip: 0.19 kB
51
+ dist/ruleInput/.export.js 0.30 kB │ gzip: 0.14 kB
52
+ dist/api/.export.js 0.31 kB │ gzip: 0.16 kB
53
+ dist/rule.js 0.36 kB │ gzip: 0.23 kB
54
+ dist/ruleRecord.js 0.66 kB │ gzip: 0.33 kB
55
+ dist/api/delete/deleteAllRules.js 0.73 kB │ gzip: 0.37 kB
56
+ dist/.export.js 0.91 kB │ gzip: 0.29 kB
57
+ dist/api/read/getMissingIds.js 1.02 kB │ gzip: 0.48 kB
58
+ dist/api/read/fetchRules.js 1.07 kB │ gzip: 0.49 kB
59
+ dist/redis/redisRulesStorage.js 1.22 kB │ gzip: 0.45 kB
60
+ dist/api/delete/deleteRuleGroups.js 1.32 kB │ gzip: 0.61 kB
61
+ dist/api/delete/deleteRules.js 1.36 kB │ gzip: 0.58 kB
62
+ dist/api/read/findRuleIds.js 1.39 kB │ gzip: 0.60 kB
63
+ dist/api/write/rehashRules.js 1.42 kB │ gzip: 0.53 kB
64
+ dist/mongoose/mongooseRuleSchema.js 1.47 kB │ gzip: 0.40 kB
65
+ dist/ruleInput/ruleInput.js 1.76 kB │ gzip: 0.62 kB
66
+ dist/redis/redisClient.js 1.78 kB │ gzip: 0.68 kB
67
+ dist/ruleInput/policyInput.js 1.84 kB │ gzip: 0.73 kB
68
+ dist/classifyOs.js 1.98 kB │ gzip: 1.03 kB
69
+ dist/ruleInput/userScopeInput.js 2.09 kB │ gzip: 0.67 kB
70
+ dist/api/rulesApiClient.js 2.12 kB │ gzip: 0.62 kB
71
+ dist/redis/reader/redisAggregate.js 2.35 kB │ gzip: 0.99 kB
72
+ dist/transformRule.js 2.40 kB │ gzip: 0.94 kB
73
+ dist/redis/redisRuleIndex.js 2.44 kB │ gzip: 0.73 kB
74
+ dist/api/write/insertRules.js 2.87 kB │ gzip: 1.03 kB
75
+ dist/redis/redisRulesWriter.js 3.03 kB │ gzip: 1.07 kB
76
+ dist/api/ruleApiRoutes.js 3.68 kB │ gzip: 0.99 kB
77
+ dist/redis/reader/redisRulesSplitQuery.js 4.18 kB │ gzip: 1.89 kB
78
+ dist/redis/reader/redisRulesQuery.js 4.30 kB │ gzip: 1.47 kB
79
+ dist/redis/reader/redisRulesReader.js 10.19 kB │ gzip: 2.68 kB
80
+
81
+ ✓ built in 102ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,45 @@
1
1
  # @prosopo/user-access-policy
2
2
 
3
+ ## 3.12.9
4
+ ### Patch Changes
5
+
6
+ - e14fce6: chore(deps): bump vite to 6.4.3 and mongoose to 8.24.1, and adjust types for the mongoose 8.24 Document/ObjectId changes
7
+ - Updated dependencies [a58d007]
8
+ - Updated dependencies [2c47bb7]
9
+ - Updated dependencies [0e1171c]
10
+ - Updated dependencies [103318c]
11
+ - Updated dependencies [270a8d8]
12
+ - Updated dependencies [e14fce6]
13
+ - @prosopo/api-route@2.6.53
14
+ - @prosopo/util@3.3.5
15
+ - @prosopo/types@4.10.0
16
+ - @prosopo/api@3.5.20
17
+ - @prosopo/common@3.1.48
18
+ - @prosopo/redis-client@1.0.30
19
+ - @prosopo/logger@2.0.4
20
+
21
+ ## 3.12.8
22
+ ### Patch Changes
23
+
24
+ - c61dfb5: fix(access-policy): reject Block+captchaType at schema level; add follow-up test coverage
25
+
26
+ **Fix.** The `sanitizeAccessPolicy` helper silently strips `captchaType` and `solvedImagesCount` from Block policies at write time, which meant operators writing e.g. `--block --ip X --captchaType image` got a rule that actually blocked EVERY captcha type for that IP — not just image. Same root cause as the Block+deferToVerify request-time 400 bug (see #2885). Rejecting at input surfaces the mismatch loudly with a message that points the operator at Restrict:
27
+
28
+ ```
29
+ Block policies cannot pin a captchaType — Block always applies to every
30
+ captcha type. Use a Restrict policy if you want to narrow the effect to
31
+ one captcha type.
32
+ ```
33
+
34
+ `accessPolicyInput` now has a `superRefine` that rejects Block+captchaType and Block+solvedImagesCount. The read path still accepts the legacy shape (records written before the refinement landed can still be parsed by the reader). The `addUserAccessPolicy` script was updated to only emit those fields for Restrict, so its `--block` path no longer 400s.
35
+
36
+ **Follow-up tests added** — closing the gaps flagged in the previous session:
37
+
38
+ - **Coord threading lands on the puzzle record** (`puzzleTasks.unit.test.ts`) — extends the verify-puzzle-solution suite to encode a real salt with `(158, 42)`, submit, and assert `coords[0][0] === [158, 42]` on the persisted record. Guards against a regression that drops the salt decode or writes `[0, 0]` — the whole point of the puzzle DM threading PR (#2873).
39
+ - **DM deny reason lands on the pow commitment** (`powTasks.unit.test.ts`) — pow's existing "should deny when decision machine returns deny" test only asserted `verified:false`; now also asserts the DM's reason string is persisted on the commitment.
40
+ - **checkForHardBlock wins over DM deny at verify** (`puzzleTasks.unit.test.ts`) — stubs `checkForHardBlock` to match, stubs the DM to also deny with a distinguishable reason, asserts the commitment carries `ACCESS_POLICY_BLOCK` and that the DM was never consulted. Locks in the ordering that the audit trail depends on.
41
+ - **Rule expiry** (`redisRulesStorage.integration.test.ts`) — inserts a rule with a 2 s TTL, waits past expiry, asserts the Redis hash is gone and the RediSearch index no longer counts it. The existing "inserts time limited rule" test only verified the TTL was set, not that expired rules stop matching.
42
+
3
43
  ## 3.12.7
4
44
  ### Patch Changes
5
45
 
package/dist/.export.js CHANGED
@@ -1,24 +1,10 @@
1
- import "./ruleInput/.export.js";
2
- import { makeAccessRuleHash, transformAccessRuleIntoRecord, transformAccessRuleRecordIntoRule } from "./transformRule.js";
3
- import { AccessPolicyType } from "./rule.js";
4
- import { OS_NAMES, classifyOs } from "./classifyOs.js";
1
+ import "./_virtual/_rolldown/runtime.js";
5
2
  import { FilterScopeMatch } from "./rulesStorage.js";
6
- import { getUserScopeRecordFromAccessRuleRecord, userScopeRecordFields } from "./ruleRecord.js";
7
- import { accessRuleInput } from "./ruleInput/ruleInput.js";
3
+ import { AccessPolicyType } from "./rule.js";
8
4
  import { accessPolicyInput, policyScopeInput } from "./ruleInput/policyInput.js";
9
5
  import { userScopeInput } from "./ruleInput/userScopeInput.js";
10
- export {
11
- AccessPolicyType,
12
- FilterScopeMatch,
13
- OS_NAMES,
14
- accessPolicyInput,
15
- accessRuleInput,
16
- classifyOs,
17
- getUserScopeRecordFromAccessRuleRecord,
18
- makeAccessRuleHash,
19
- policyScopeInput,
20
- transformAccessRuleIntoRecord,
21
- transformAccessRuleRecordIntoRule,
22
- userScopeInput,
23
- userScopeRecordFields
24
- };
6
+ import { accessRuleInput } from "./ruleInput/ruleInput.js";
7
+ import { makeAccessRuleHash, transformAccessRuleIntoRecord, transformAccessRuleRecordIntoRule } from "./transformRule.js";
8
+ import { OS_NAMES, classifyOs } from "./classifyOs.js";
9
+ import { getUserScopeRecordFromAccessRuleRecord, userScopeRecordFields } from "./ruleRecord.js";
10
+ export { AccessPolicyType, FilterScopeMatch, OS_NAMES, accessPolicyInput, accessRuleInput, classifyOs, getUserScopeRecordFromAccessRuleRecord, makeAccessRuleHash, policyScopeInput, transformAccessRuleIntoRecord, transformAccessRuleRecordIntoRule, userScopeInput, userScopeRecordFields };
@@ -0,0 +1,3 @@
1
+ import "node:module";
2
+ //#endregion
3
+ export {};
@@ -1,11 +1,4 @@
1
- import "./delete/.export.js";
2
- import "./read/.export.js";
3
- import "./write/.export.js";
1
+ import "../_virtual/_rolldown/runtime.js";
4
2
  import { AccessRuleApiRoutes, accessRuleApiPaths, getExpressApiRuleRateLimits } from "./ruleApiRoutes.js";
5
3
  import { AccessRulesApiClient } from "./rulesApiClient.js";
6
- export {
7
- AccessRuleApiRoutes,
8
- AccessRulesApiClient,
9
- accessRuleApiPaths,
10
- getExpressApiRuleRateLimits
11
- };
4
+ export { AccessRuleApiRoutes, AccessRulesApiClient, accessRuleApiPaths, getExpressApiRuleRateLimits };
@@ -1,2 +1,2 @@
1
+ import "../_virtual/_rolldown/runtime.js";
1
2
  export {};
2
- //# sourceMappingURL=accessRulesApiClient.js.map
@@ -1 +1,2 @@
1
-
1
+ import "../../_virtual/_rolldown/runtime.js";
2
+ export {};
@@ -1,26 +1,24 @@
1
+ import "../../_virtual/_rolldown/runtime.js";
1
2
  import { ApiEndpointResponseStatus } from "@prosopo/api-route";
2
- class DeleteAllRulesEndpoint {
3
- constructor(accessRulesStorage, logger) {
4
- this.accessRulesStorage = accessRulesStorage;
5
- this.logger = logger;
6
- }
7
- getRequestArgsSchema() {
8
- }
9
- async processRequest(logger) {
10
- const log = logger ?? this.logger;
11
- const deletedCount = await this.accessRulesStorage.deleteAllRules();
12
- log.info(() => ({
13
- msg: "Endpoint deleted all access rules",
14
- data: { deletedCount }
15
- }));
16
- return {
17
- status: ApiEndpointResponseStatus.SUCCESS,
18
- data: {
19
- deleted_count: deletedCount
20
- }
21
- };
22
- }
23
- }
24
- export {
25
- DeleteAllRulesEndpoint
3
+ //#region src/api/delete/deleteAllRules.ts
4
+ var DeleteAllRulesEndpoint = class {
5
+ constructor(accessRulesStorage, logger) {
6
+ this.accessRulesStorage = accessRulesStorage;
7
+ this.logger = logger;
8
+ }
9
+ getRequestArgsSchema() {}
10
+ async processRequest(logger) {
11
+ const log = logger ?? this.logger;
12
+ const deletedCount = await this.accessRulesStorage.deleteAllRules();
13
+ log.info(() => ({
14
+ msg: "Endpoint deleted all access rules",
15
+ data: { deletedCount }
16
+ }));
17
+ return {
18
+ status: ApiEndpointResponseStatus.SUCCESS,
19
+ data: { deleted_count: deletedCount }
20
+ };
21
+ }
26
22
  };
23
+ //#endregion
24
+ export { DeleteAllRulesEndpoint };
@@ -1,53 +1,41 @@
1
- import { ApiEndpointResponseStatus } from "@prosopo/api-route";
2
- import { z } from "zod";
1
+ import "../../_virtual/_rolldown/runtime.js";
3
2
  import { FilterScopeMatch } from "../../rulesStorage.js";
4
- class DeleteRuleGroupsEndpoint {
5
- constructor(accessRulesStorage, logger) {
6
- this.accessRulesStorage = accessRulesStorage;
7
- this.logger = logger;
8
- }
9
- getRequestArgsSchema() {
10
- return z.array(
11
- z.object({
12
- clientIds: z.string().array(),
13
- groupId: z.string()
14
- })
15
- );
16
- }
17
- async processRequest(args, logger) {
18
- const log = logger ?? this.logger;
19
- const foundRuleIdPromises = args.flatMap(
20
- (ruleToDelete) => ruleToDelete.clientIds.map(
21
- (clientId) => this.accessRulesStorage.findRuleIds({
22
- policyScope: {
23
- clientId
24
- },
25
- policyScopeMatch: FilterScopeMatch.Exact,
26
- groupId: ruleToDelete.groupId
27
- })
28
- )
29
- );
30
- const foundRuleIds = await Promise.all(foundRuleIdPromises);
31
- const ruleIds = foundRuleIds.flat();
32
- const uniqueRuleIds = [...new Set(ruleIds)];
33
- if (uniqueRuleIds.length > 0) {
34
- await this.accessRulesStorage.deleteRules(uniqueRuleIds);
35
- }
36
- log.info(() => ({
37
- msg: "Endpoint deleted rule groups",
38
- data: {
39
- args,
40
- uniqueRuleIds
41
- }
42
- }));
43
- return {
44
- status: ApiEndpointResponseStatus.SUCCESS,
45
- data: {
46
- deleted_count: uniqueRuleIds.length
47
- }
48
- };
49
- }
50
- }
51
- export {
52
- DeleteRuleGroupsEndpoint
3
+ import { z } from "zod";
4
+ import { ApiEndpointResponseStatus } from "@prosopo/api-route";
5
+ //#region src/api/delete/deleteRuleGroups.ts
6
+ var DeleteRuleGroupsEndpoint = class {
7
+ constructor(accessRulesStorage, logger) {
8
+ this.accessRulesStorage = accessRulesStorage;
9
+ this.logger = logger;
10
+ }
11
+ getRequestArgsSchema() {
12
+ return z.array(z.object({
13
+ clientIds: z.string().array(),
14
+ groupId: z.string()
15
+ }));
16
+ }
17
+ async processRequest(args, logger) {
18
+ const log = logger ?? this.logger;
19
+ const foundRuleIdPromises = args.flatMap((ruleToDelete) => ruleToDelete.clientIds.map((clientId) => this.accessRulesStorage.findRuleIds({
20
+ policyScope: { clientId },
21
+ policyScopeMatch: FilterScopeMatch.Exact,
22
+ groupId: ruleToDelete.groupId
23
+ })));
24
+ const ruleIds = (await Promise.all(foundRuleIdPromises)).flat();
25
+ const uniqueRuleIds = [...new Set(ruleIds)];
26
+ if (uniqueRuleIds.length > 0) await this.accessRulesStorage.deleteRules(uniqueRuleIds);
27
+ log.info(() => ({
28
+ msg: "Endpoint deleted rule groups",
29
+ data: {
30
+ args,
31
+ uniqueRuleIds
32
+ }
33
+ }));
34
+ return {
35
+ status: ApiEndpointResponseStatus.SUCCESS,
36
+ data: { deleted_count: uniqueRuleIds.length }
37
+ };
38
+ }
53
39
  };
40
+ //#endregion
41
+ export { DeleteRuleGroupsEndpoint };
@@ -1,44 +1,40 @@
1
+ import "../../_virtual/_rolldown/runtime.js";
2
+ import { accessRulesFilterInput, getAccessRuleFiltersFromInput } from "../../ruleInput/ruleInput.js";
3
+ import { z } from "zod";
1
4
  import { ApiEndpointResponseStatus } from "@prosopo/api-route";
2
5
  import { executeBatchesSequentially } from "@prosopo/common";
3
- import { z } from "zod";
4
- import { accessRulesFilterInput, getAccessRuleFiltersFromInput } from "../../ruleInput/ruleInput.js";
5
- class DeleteRulesEndpoint {
6
- constructor(accessRulesStorage, logger) {
7
- this.accessRulesStorage = accessRulesStorage;
8
- this.logger = logger;
9
- }
10
- getRequestArgsSchema() {
11
- return z.array(accessRulesFilterInput);
12
- }
13
- async processRequest(args, logger) {
14
- const log = logger ?? this.logger;
15
- let deletedCount = 0;
16
- for (const rulesFilterInput of args) {
17
- const ruleFilters = getAccessRuleFiltersFromInput(rulesFilterInput);
18
- await executeBatchesSequentially(ruleFilters, async (ruleFilter) => {
19
- const ruleIds = await this.accessRulesStorage.findRuleIds(ruleFilter);
20
- const uniqueRuleIds = [...new Set(ruleIds)];
21
- if (uniqueRuleIds.length > 0) {
22
- await this.accessRulesStorage.deleteRules(uniqueRuleIds);
23
- deletedCount += uniqueRuleIds.length;
24
- log.info(() => ({
25
- msg: "Endpoint deleted rules",
26
- data: {
27
- rulesFilterInput,
28
- uniqueRuleIds
29
- }
30
- }));
31
- }
32
- });
33
- }
34
- return {
35
- status: ApiEndpointResponseStatus.SUCCESS,
36
- data: {
37
- deleted_count: deletedCount
38
- }
39
- };
40
- }
41
- }
42
- export {
43
- DeleteRulesEndpoint
6
+ //#region src/api/delete/deleteRules.ts
7
+ var DeleteRulesEndpoint = class {
8
+ constructor(accessRulesStorage, logger) {
9
+ this.accessRulesStorage = accessRulesStorage;
10
+ this.logger = logger;
11
+ }
12
+ getRequestArgsSchema() {
13
+ return z.array(accessRulesFilterInput);
14
+ }
15
+ async processRequest(args, logger) {
16
+ const log = logger ?? this.logger;
17
+ let deletedCount = 0;
18
+ for (const rulesFilterInput of args) await executeBatchesSequentially(getAccessRuleFiltersFromInput(rulesFilterInput), async (ruleFilter) => {
19
+ const ruleIds = await this.accessRulesStorage.findRuleIds(ruleFilter);
20
+ const uniqueRuleIds = [...new Set(ruleIds)];
21
+ if (uniqueRuleIds.length > 0) {
22
+ await this.accessRulesStorage.deleteRules(uniqueRuleIds);
23
+ deletedCount += uniqueRuleIds.length;
24
+ log.info(() => ({
25
+ msg: "Endpoint deleted rules",
26
+ data: {
27
+ rulesFilterInput,
28
+ uniqueRuleIds
29
+ }
30
+ }));
31
+ }
32
+ });
33
+ return {
34
+ status: ApiEndpointResponseStatus.SUCCESS,
35
+ data: { deleted_count: deletedCount }
36
+ };
37
+ }
44
38
  };
39
+ //#endregion
40
+ export { DeleteRulesEndpoint };
@@ -1 +1,2 @@
1
-
1
+ import "../../_virtual/_rolldown/runtime.js";
2
+ export {};