@prosopo/procaptcha-frictionless 2.12.14 → 2.12.15

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.12.14 build:cjs
2
+ > @prosopo/procaptcha-frictionless@2.12.15 build:cjs
3
3
  > NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
4
4
 
5
5
  ViteCommonJSConfig: .
@@ -61,6 +61,6 @@ rendering chunks...
61
61
  dist/cjs/index.cjs 0.24 kB
62
62
  dist/cjs/sessionInvalidatedRecovery.cjs 0.85 kB
63
63
  dist/cjs/detectorLoader.cjs 1.37 kB
64
- dist/cjs/customDetectBot.cjs 4.26 kB
64
+ dist/cjs/customDetectBot.cjs 4.58 kB
65
65
  dist/cjs/ProcaptchaFrictionless.cjs 9.11 kB
66
- ✓ built in 188ms
66
+ ✓ built in 125ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.12.14 build:tsc
2
+ > @prosopo/procaptcha-frictionless@2.12.15 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 10:19:08 PM - Projects in this build:
5
+ 9:22:28 AM - Projects in this build:
6
6
  * ../../dev/config/tsconfig.json
7
7
  * ../locale/tsconfig.json
8
8
  * ../util/tsconfig.json
@@ -26,49 +26,49 @@
26
26
  * ../procaptcha-react/tsconfig.json
27
27
  * tsconfig.json
28
28
 
29
- 10:19:08 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'
29
+ 9:22:28 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/tsconfig.tsbuildinfo'
30
30
 
31
- 10:19:08 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
31
+ 9:22:28 AM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
32
32
 
33
- 10:19:08 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
33
+ 9:22:28 AM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
34
34
 
35
- 10:19:08 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'
35
+ 9:22:28 AM - 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'
36
36
 
37
- 10:19:08 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/provider/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
37
+ 9:22:28 AM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/keyring/keyring/types.ts' is older than output '../types/tsconfig.tsbuildinfo'
38
38
 
39
- 10:19:08 PM - Project '../detector/tsconfig.json' is up to date because newest input '../detector/src/index.js' is older than output '../detector/tsconfig.tsbuildinfo'
39
+ 9:22:28 AM - Project '../detector/tsconfig.json' is up to date because newest input '../detector/src/index.js' is older than output '../detector/tsconfig.tsbuildinfo'
40
40
 
41
- 10:19:09 PM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
41
+ 9:22:28 AM - Project '../api/tsconfig.json' is up to date because newest input '../api/src/index.ts' is older than output '../api/tsconfig.tsbuildinfo'
42
42
 
43
- 10:19:09 PM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
43
+ 9:22:28 AM - Project '../logger/tsconfig.json' is up to date because newest input '../logger/src/index.ts' is older than output '../logger/tsconfig.tsbuildinfo'
44
44
 
45
- 10:19:09 PM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/utils/batches.ts' is older than output '../common/tsconfig.tsbuildinfo'
45
+ 9:22:28 AM - Project '../common/tsconfig.json' is up to date because newest input '../common/src/error.ts' is older than output '../common/tsconfig.tsbuildinfo'
46
46
 
47
- 10:19:09 PM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
47
+ 9:22:28 AM - Project '../fingerprintjs/tsconfig.json' is up to date because newest input '../fingerprintjs/src/utils/browser.ts' is older than output '../fingerprintjs/tsconfig.tsbuildinfo'
48
48
 
49
- 10:19:09 PM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
49
+ 9:22:28 AM - Project '../fingerprint/tsconfig.json' is up to date because newest input '../fingerprint/src/index.ts' is older than output '../fingerprint/tsconfig.tsbuildinfo'
50
50
 
51
- 10:19:09 PM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/balancer.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
51
+ 9:22:28 AM - Project '../load-balancer/tsconfig.json' is up to date because newest input '../load-balancer/src/index.ts' is older than output '../load-balancer/tsconfig.tsbuildinfo'
52
52
 
53
- 10:19:09 PM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/webComponent/createWidget.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
53
+ 9:22:28 AM - Project '../widget-skeleton/tsconfig.json' is up to date because newest input '../widget-skeleton/src/constants.ts' is older than output '../widget-skeleton/tsconfig.tsbuildinfo'
54
54
 
55
- 10:19:09 PM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/index.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
55
+ 9:22:28 AM - Project '../keyring/tsconfig.json' is up to date because newest input '../keyring/src/keyring/keyring.ts' is older than output '../keyring/tsconfig.tsbuildinfo'
56
56
 
57
- 10:19:09 PM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/index.ts' is older than output '../account/tsconfig.tsbuildinfo'
57
+ 9:22:28 AM - Project '../account/tsconfig.json' is up to date because newest input '../account/src/index.ts' is older than output '../account/tsconfig.tsbuildinfo'
58
58
 
59
- 10:19:09 PM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/tests/defaultEvents.test.ts' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
59
+ 9:22:28 AM - Project '../procaptcha-common/tsconfig.json' is up to date because newest input '../procaptcha-common/src/reactComponents/Honeypot.tsx' is older than output '../procaptcha-common/tsconfig.tsbuildinfo'
60
60
 
61
- 10:19:09 PM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/index.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
61
+ 9:22:28 AM - Project '../procaptcha-pow/tsconfig.json' is up to date because newest input '../procaptcha-pow/src/index.ts' is older than output '../procaptcha-pow/tsconfig.tsbuildinfo'
62
62
 
63
- 10:19:09 PM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/index.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
63
+ 9:22:28 AM - Project '../procaptcha-puzzle/tsconfig.json' is up to date because newest input '../procaptcha-puzzle/src/index.ts' is older than output '../procaptcha-puzzle/tsconfig.tsbuildinfo'
64
64
 
65
- 10:19:09 PM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/mocks/data/captchas.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
65
+ 9:22:28 AM - Project '../datasets/tsconfig.json' is up to date because newest input '../datasets/src/tests/dataset.unit.test.ts' is older than output '../datasets/tsconfig.tsbuildinfo'
66
66
 
67
- 10:19:09 PM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/index.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
67
+ 9:22:28 AM - Project '../procaptcha/tsconfig.json' is up to date because newest input '../procaptcha/src/index.ts' is older than output '../procaptcha/tsconfig.tsbuildinfo'
68
68
 
69
- 10:19:09 PM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/index.ts' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
69
+ 9:22:28 AM - Project '../procaptcha-react/tsconfig.json' is up to date because newest input '../procaptcha-react/src/index.ts' is older than output '../procaptcha-react/tsconfig.tsbuildinfo'
70
70
 
71
- 10:19:09 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
71
+ 9:22:28 AM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
72
72
 
73
- 10:19:09 PM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
73
+ 9:22:28 AM - Building project '/home/runner/work/captcha/captcha/packages/procaptcha-frictionless/tsconfig.json'...
74
74
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/procaptcha-frictionless@2.12.14 build
2
+ > @prosopo/procaptcha-frictionless@2.12.15 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/procaptcha-frictionless@2.12.14 build:cross-env
6
+ > @prosopo/procaptcha-frictionless@2.12.15 build:cross-env
7
7
  > vite build --config vite.esm.config.ts --mode production
8
8
 
9
9
  ViteEsmConfig: .
@@ -64,6 +64,6 @@ rendering chunks...
64
64
  dist/index.js 0.11 kB
65
65
  dist/detectorLoader.js 0.11 kB
66
66
  dist/sessionInvalidatedRecovery.js 0.71 kB
67
- dist/customDetectBot.js 4.08 kB
67
+ dist/customDetectBot.js 4.37 kB
68
68
  dist/ProcaptchaFrictionless.js 7.67 kB
69
- ✓ built in 203ms
69
+ ✓ built in 192ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @prosopo/procaptcha-frictionless
2
2
 
3
+ ## 2.12.15
4
+ ### Patch Changes
5
+
6
+ - d0f3a52: perf(frictionless): fire provider-pin `/healthz` in parallel with `detect()` instead of serial after
7
+
8
+ `customDetectBot` was resolving the provider pin (`getProcaptchaRandomActiveProvider`, which hits `/healthz` on the load-balancer DNS endpoint) only after `detect()` returned — so the healthz round-trip was fully serial with the detector suite's ~seconds of worker + fingerprint work. On the network waterfall this showed up as `index-*.js → blob → blob → healthz → frictionless`, with `healthz` blocking the `frictionless` POST from firing.
9
+
10
+ Fire the pin resolution fire-and-forget at the very top of `customDetectBot`, before the `ExtensionLoader` / `DetectorLoader` dynamic imports even start. `getProcaptchaRandomActiveProvider` is memoised via `pinPromiseCache` keyed on `(env, ipMode)`, so:
11
+
12
+ - catcher's internal `randomProviderSelectorFn` (called during `detect()`) hits the in-flight promise instead of firing its own healthz
13
+ - the awaited `getProcaptchaRandomActiveProvider(...)` after `detect()` reuses the resolved promise
14
+
15
+ Both cache keys are prewarmed — one for catcher's selector (no `ipMode`) and one matching the dapp's `data-ipv4`/`data-ipv6` if set. Same-key when the dapp is dual-stack (the common case), which is one healthz request total instead of two.
16
+
17
+ Net effect: the healthz round-trip (~100–200 ms on cold DNS/TLS) now overlaps with detector work instead of following it. The `frictionless` POST becomes the next hop on the wire immediately after the workers post their scores back.
18
+
3
19
  ## 2.12.14
4
20
  ### Patch Changes
5
21
 
@@ -58,6 +58,17 @@ const withTimeout = async (promise, ms) => {
58
58
  }
59
59
  };
60
60
  const customDetectBot = async (config, container, restartFn, retryContext) => {
61
+ const ipMode = procaptchaCommon.pickIpMode(config);
62
+ void procaptchaCommon.getProcaptchaRandomActiveProvider(config.defaultEnvironment).catch(
63
+ () => void 0
64
+ );
65
+ if (ipMode !== void 0) {
66
+ void procaptchaCommon.getProcaptchaRandomActiveProvider(
67
+ config.defaultEnvironment,
68
+ ipMode,
69
+ retryContext
70
+ ).catch(() => void 0);
71
+ }
61
72
  const [ExtClass, detect] = await Promise.all([
62
73
  procaptchaCommon.ExtensionLoader(config.web2),
63
74
  detectorLoader.DetectorLoader()
@@ -76,7 +87,7 @@ const customDetectBot = async (config, container, restartFn, retryContext) => {
76
87
  }
77
88
  const provider = await procaptchaCommon.getProcaptchaRandomActiveProvider(
78
89
  config.defaultEnvironment,
79
- procaptchaCommon.pickIpMode(config),
90
+ ipMode,
80
91
  retryContext
81
92
  );
82
93
  const providerApi = new api.ProviderApi(
@@ -1 +1 @@
1
- {"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACX,oBAAoB,EAGpB,MAAM,gBAAgB,CAAC;AA2ExB,eAAO,MAAM,WAAW,GAAU,CAAC,WACzB,OAAO,CAAC,CAAC,CAAC,MACf,MAAM,KACR,OAAO,CAAC,CAAC,CAoBX,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,oBA0GtB,CAAC;AAEF,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"customDetectBot.d.ts","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EACX,oBAAoB,EAGpB,MAAM,gBAAgB,CAAC;AA2ExB,eAAO,MAAM,WAAW,GAAU,CAAC,WACzB,OAAO,CAAC,CAAC,CAAC,MACf,MAAM,KACR,OAAO,CAAC,CAAC,CAoBX,CAAC;AAEF,QAAA,MAAM,eAAe,EAAE,oBAyItB,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { ProviderApi } from "@prosopo/api";
2
2
  import { ProsopoEnvError } from "@prosopo/common";
3
- import { ExtensionLoader, getProcaptchaRandomActiveProvider, pickIpMode } from "@prosopo/procaptcha-common";
3
+ import { pickIpMode, getProcaptchaRandomActiveProvider, ExtensionLoader } from "@prosopo/procaptcha-common";
4
4
  import { DetectorLoader } from "./detectorLoader.js";
5
5
  const sanitiseHref = (href) => {
6
6
  try {
@@ -56,6 +56,17 @@ const withTimeout = async (promise, ms) => {
56
56
  }
57
57
  };
58
58
  const customDetectBot = async (config, container, restartFn, retryContext) => {
59
+ const ipMode = pickIpMode(config);
60
+ void getProcaptchaRandomActiveProvider(config.defaultEnvironment).catch(
61
+ () => void 0
62
+ );
63
+ if (ipMode !== void 0) {
64
+ void getProcaptchaRandomActiveProvider(
65
+ config.defaultEnvironment,
66
+ ipMode,
67
+ retryContext
68
+ ).catch(() => void 0);
69
+ }
59
70
  const [ExtClass, detect] = await Promise.all([
60
71
  ExtensionLoader(config.web2),
61
72
  DetectorLoader()
@@ -74,7 +85,7 @@ const customDetectBot = async (config, container, restartFn, retryContext) => {
74
85
  }
75
86
  const provider = await getProcaptchaRandomActiveProvider(
76
87
  config.defaultEnvironment,
77
- pickIpMode(config),
88
+ ipMode,
78
89
  retryContext
79
90
  );
80
91
  const providerApi = new ProviderApi(
@@ -1 +1 @@
1
- {"version":3,"file":"customDetectBot.js","sourceRoot":"","sources":["../src/customDetectBot.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EACN,eAAe,EACf,iCAAiC,EACjC,UAAU,GACV,MAAM,4BAA4B,CAAC;AAOpC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAqBrD,MAAM,YAAY,GAAG,CAAC,IAAY,EAAsB,EAAE;IACzD,IAAI,CAAC;QACJ,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC;QACxB,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM;YAAE,OAAO,SAAS,CAAC;QACvD,OAAO,GAAG,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,QAAQ,IAAI,EAAE,EAAE,CAAC;IACzC,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC,CAAC;AAOF,M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json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prosopo/procaptcha-frictionless",
3
- "version": "2.12.14",
3
+ "version": "2.12.15",
4
4
  "author": "PROSOPO LIMITED <info@prosopo.io>",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -129,6 +129,34 @@ const customDetectBot: BotDetectionFunction = async (
129
129
  restartFn: () => void,
130
130
  retryContext?: ProviderSelectRetryContext,
131
131
  ): Promise<BotDetectionFunctionResult> => {
132
+ // Kick off the provider-pin resolution (which hits `/healthz` on the
133
+ // load-balancer DNS endpoint) in parallel with the module loaders and
134
+ // the whole `detect()` flow. `getProcaptchaRandomActiveProvider` is
135
+ // memoised via `pinPromiseCache` keyed on `(env, ipMode)`, so the
136
+ // in-flight promise is reused when catcher's internal provider selector
137
+ // and the awaited `getProcaptchaRandomActiveProvider(...)` below reach
138
+ // for it — no duplicate healthz request. Before this ordering change
139
+ // the healthz round-trip was fully serial with `detect()`, adding
140
+ // ~100–200ms to the frictionless critical path on cold DNS/TLS.
141
+ //
142
+ // We warm both cache keys because the catcher-internal selector call
143
+ // (line ~145 below) passes no ipMode, while the awaited call further
144
+ // down passes `pickIpMode(config)`. Same key when the dapp opts into
145
+ // neither ipv4 nor ipv6 (dual stack — the common case); different
146
+ // keys when the dapp is pinned to a single stack. Fire-and-forget on
147
+ // both — the real synchronisation happens at the awaits below.
148
+ const ipMode = pickIpMode(config);
149
+ void getProcaptchaRandomActiveProvider(config.defaultEnvironment).catch(
150
+ () => undefined,
151
+ );
152
+ if (ipMode !== undefined) {
153
+ void getProcaptchaRandomActiveProvider(
154
+ config.defaultEnvironment,
155
+ ipMode,
156
+ retryContext,
157
+ ).catch(() => undefined);
158
+ }
159
+
132
160
  const [ExtClass, detect] = await Promise.all([
133
161
  ExtensionLoader(config.web2),
134
162
  DetectorLoader(),
@@ -161,9 +189,12 @@ const customDetectBot: BotDetectionFunction = async (
161
189
  // same one. `pickIpMode(config)` honours the dapp's data-ipv4 / data-ipv6
162
190
  // preference so frictionless and the subsequent captcha hops stay on the
163
191
  // same stack.
192
+ //
193
+ // This await usually hits the in-flight/resolved promise warmed at the
194
+ // top of this function — see the prefetch call there.
164
195
  const provider = await getProcaptchaRandomActiveProvider(
165
196
  config.defaultEnvironment,
166
- pickIpMode(config),
197
+ ipMode,
167
198
  retryContext,
168
199
  );
169
200