@prosopo/scripts 3.1.194 → 3.1.196
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.
- package/.turbo/turbo-build$colon$cjs.log +3 -6
- package/.turbo/turbo-build$colon$tsc.log +31 -34
- package/.turbo/turbo-build.log +6 -11
- package/CHANGELOG.md +76 -0
- package/LICENSE +201 -0
- package/README.md +16 -15
- package/dist/cjs/setup/setup.cjs +0 -1
- package/dist/setup/setup.d.ts.map +1 -1
- package/dist/setup/setup.js +1 -2
- package/dist/setup/setup.js.map +1 -1
- package/dist/setup/setup.sites.test.d.ts +2 -0
- package/dist/setup/setup.sites.test.d.ts.map +1 -0
- package/dist/setup/setup.sites.test.js +92 -0
- package/dist/setup/setup.sites.test.js.map +1 -0
- package/dist/workspace/dist/index.js +2 -1
- package/dist/workspace/dist/workspaceGlobs.js +21 -0
- package/package.json +72 -72
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
> @prosopo/scripts@3.1.194 build:cjs
|
|
3
|
-
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
|
-
|
|
1
|
+
$ NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
5
2
|
ViteCommonJSConfig: flux
|
|
6
3
|
{
|
|
7
4
|
tsConfigPaths: [
|
|
@@ -39,6 +36,7 @@ ViteCommonJSConfig: flux
|
|
|
39
36
|
'@prosopo/types',
|
|
40
37
|
'@prosopo/locale',
|
|
41
38
|
'@prosopo/util',
|
|
39
|
+
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
42
40
|
'@prosopo/util-crypto',
|
|
43
41
|
'@prosopo/common',
|
|
44
42
|
'@prosopo/logger',
|
|
@@ -61,7 +59,6 @@ ViteCommonJSConfig: flux
|
|
|
61
59
|
'@prosopo/web-bot-auth'
|
|
62
60
|
]
|
|
63
61
|
}
|
|
64
|
-
[33mThe plugin "vite-tsconfig-paths" is detected. Vite now supports tsconfig paths resolution natively via the [1mresolve.tsconfigPaths[22m option. You can remove the plugin and set [1mresolve.tsconfigPaths: true[22m in your Vite config instead.[39m
|
|
65
62
|
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
66
63
|
Bundle build started
|
|
67
64
|
[2K
|
|
@@ -79,6 +76,6 @@ dist/cjs/util/exec.cjs 1.07 kB │ gzip: 0.47 kB
|
|
|
79
76
|
dist/cjs/util/updateEnv.cjs 2.66 kB │ gzip: 0.93 kB
|
|
80
77
|
dist/cjs/cli/index.cjs 3.33 kB │ gzip: 1.19 kB
|
|
81
78
|
dist/cjs/scripts/setVersion.cjs 5.33 kB │ gzip: 1.65 kB
|
|
82
|
-
dist/cjs/setup/setup.cjs 5.
|
|
79
|
+
dist/cjs/setup/setup.cjs 5.52 kB │ gzip: 1.77 kB
|
|
83
80
|
|
|
84
81
|
[32m✓ built in 34ms[39m
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> tsc --build --verbose
|
|
4
|
-
|
|
5
|
-
8:26:17 PM - Projects in this build:
|
|
1
|
+
$ tsc --build --verbose
|
|
2
|
+
1:38:29 PM - Projects in this build:
|
|
6
3
|
* ../config/tsconfig.json
|
|
7
4
|
* ../../packages/util/tsconfig.json
|
|
8
5
|
* ../../packages/locale/tsconfig.json
|
|
@@ -32,61 +29,61 @@
|
|
|
32
29
|
* ../../packages/cli/tsconfig.json
|
|
33
30
|
* tsconfig.json
|
|
34
31
|
|
|
35
|
-
|
|
32
|
+
1:38:29 PM - Project '../config/tsconfig.json' is up to date because newest input '../config/src/webpack/webpack.config.ts' is older than output '../config/tsconfig.tsbuildinfo'
|
|
36
33
|
|
|
37
|
-
|
|
34
|
+
1:38:29 PM - Project '../../packages/util/tsconfig.json' is up to date because newest input '../../packages/util/src/url.ts' is older than output '../../packages/util/tsconfig.tsbuildinfo'
|
|
38
35
|
|
|
39
|
-
|
|
36
|
+
1:38:29 PM - Project '../../packages/locale/tsconfig.json' is up to date because newest input '../../packages/locale/src/translationKey.ts' is older than output '../../packages/locale/tsconfig.tsbuildinfo'
|
|
40
37
|
|
|
41
|
-
|
|
38
|
+
1:38:29 PM - Project '../../packages/util-crypto/tsconfig.json' is up to date because newest input '../../packages/util-crypto/src/types.ts' is older than output '../../packages/util-crypto/tsconfig.tsbuildinfo'
|
|
42
39
|
|
|
43
|
-
|
|
40
|
+
1:38:29 PM - Project '../../packages/types/tsconfig.json' is up to date because newest input '../../packages/types/src/types.test-d.ts' is older than output '../../packages/types/tsconfig.tsbuildinfo'
|
|
44
41
|
|
|
45
|
-
|
|
42
|
+
1:38:29 PM - Project '../../packages/api/tsconfig.json' is up to date because newest input '../../packages/api/src/tests/apiHarness.ts' is older than output '../../packages/api/tsconfig.tsbuildinfo'
|
|
46
43
|
|
|
47
|
-
|
|
44
|
+
1:38:29 PM - Project '../../packages/logger/tsconfig.json' is up to date because newest input '../../packages/logger/src/index.ts' is older than output '../../packages/logger/tsconfig.tsbuildinfo'
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
1:38:29 PM - Project '../../packages/common/tsconfig.json' is up to date because newest input '../../packages/common/src/index.ts' is older than output '../../packages/common/tsconfig.tsbuildinfo'
|
|
50
47
|
|
|
51
|
-
|
|
48
|
+
1:38:29 PM - Project '../../packages/dotenv/tsconfig.json' is up to date because newest input '../../packages/dotenv/src/env.ts' is older than output '../../packages/dotenv/tsconfig.tsbuildinfo'
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
1:38:29 PM - Project '../../packages/ipinfo/tsconfig.json' is up to date because newest input '../../packages/ipinfo/src/IpInfoService.ts' is older than output '../../packages/ipinfo/tsconfig.tsbuildinfo'
|
|
54
51
|
|
|
55
|
-
|
|
52
|
+
1:38:29 PM - Project '../../packages/api-route/tsconfig.json' is up to date because newest input '../../packages/api-route/src/apiRoutes.ts' is older than output '../../packages/api-route/tsconfig.tsbuildinfo'
|
|
56
53
|
|
|
57
|
-
|
|
54
|
+
1:38:29 PM - Project '../../packages/redis-client/tsconfig.json' is up to date because newest input '../../packages/redis-client/src/index.ts' is older than output '../../packages/redis-client/tsconfig.tsbuildinfo'
|
|
58
55
|
|
|
59
|
-
|
|
56
|
+
1:38:29 PM - Project '../../packages/user-access-policy/tsconfig.json' is up to date because newest input '../../packages/user-access-policy/src/ruleRecord.ts' is older than output '../../packages/user-access-policy/tsconfig.tsbuildinfo'
|
|
60
57
|
|
|
61
|
-
|
|
58
|
+
1:38:29 PM - Project '../../packages/types-database/tsconfig.json' is up to date because newest input '../../packages/types-database/src/index.ts' is older than output '../../packages/types-database/tsconfig.tsbuildinfo'
|
|
62
59
|
|
|
63
|
-
|
|
60
|
+
1:38:29 PM - Project '../../packages/database/tsconfig.json' is up to date because newest input '../../packages/database/src/tests/unit/captchaLabel.unit.test.ts' is older than output '../../packages/database/tsconfig.tsbuildinfo'
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
1:38:29 PM - Project '../../packages/keyring/tsconfig.json' is up to date because newest input '../../packages/keyring/src/pair/decode.ts' is older than output '../../packages/keyring/tsconfig.tsbuildinfo'
|
|
66
63
|
|
|
67
|
-
|
|
64
|
+
1:38:29 PM - Project '../../packages/types-env/tsconfig.json' is up to date because newest input '../../packages/types-env/src/tests/typesEnv.test-d.ts' is older than output '../../packages/types-env/tsconfig.tsbuildinfo'
|
|
68
65
|
|
|
69
|
-
|
|
66
|
+
1:38:29 PM - Project '../../packages/env/tsconfig.json' is up to date because newest input '../../packages/env/src/env.ts' is older than output '../../packages/env/tsconfig.tsbuildinfo'
|
|
70
67
|
|
|
71
|
-
|
|
68
|
+
1:38:29 PM - Project '../../packages/api-express-router/tsconfig.json' is up to date because newest input '../../packages/api-express-router/src/errorHandler.ts' is older than output '../../packages/api-express-router/tsconfig.tsbuildinfo'
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
1:38:29 PM - Project '../../packages/captcha-severity/tsconfig.json' is up to date because newest input '../../packages/captcha-severity/src/index.test.ts' is older than output '../../packages/captcha-severity/tsconfig.tsbuildinfo'
|
|
74
71
|
|
|
75
|
-
|
|
72
|
+
1:38:29 PM - Project '../../packages/datasets/tsconfig.json' is up to date because newest input '../../packages/datasets/src/index.ts' is older than output '../../packages/datasets/tsconfig.tsbuildinfo'
|
|
76
73
|
|
|
77
|
-
|
|
74
|
+
1:38:29 PM - Project '../../packages/load-balancer/tsconfig.json' is up to date because newest input '../../packages/load-balancer/src/developmentProviderUrl.ts' is older than output '../../packages/load-balancer/tsconfig.tsbuildinfo'
|
|
78
75
|
|
|
79
|
-
|
|
76
|
+
1:38:29 PM - Project '../../packages/puzzle-assets/tsconfig.json' is up to date because newest input '../../packages/puzzle-assets/src/background.ts' is older than output '../../packages/puzzle-assets/tsconfig.tsbuildinfo'
|
|
80
77
|
|
|
81
|
-
|
|
78
|
+
1:38:29 PM - Project '../../packages/web-bot-auth/tsconfig.json' is up to date because newest input '../../packages/web-bot-auth/src/verify.ts' is older than output '../../packages/web-bot-auth/tsconfig.tsbuildinfo'
|
|
82
79
|
|
|
83
|
-
|
|
80
|
+
1:38:29 PM - Project '../../packages/provider/tsconfig.json' is up to date because newest input '../../packages/provider/src/util.ts' is older than output '../../packages/provider/tsconfig.tsbuildinfo'
|
|
84
81
|
|
|
85
|
-
|
|
82
|
+
1:38:29 PM - Project '../workspace/tsconfig.json' is up to date because newest input '../workspace/src/index.ts' is older than output '../workspace/tsconfig.tsbuildinfo'
|
|
86
83
|
|
|
87
|
-
|
|
84
|
+
1:38:29 PM - Project '../../packages/cli/tsconfig.json' is up to date because newest input '../../packages/cli/src/tests/bundle/bundle.integration.test.ts' is older than output '../../packages/cli/tsconfig.tsbuildinfo'
|
|
88
85
|
|
|
89
|
-
|
|
86
|
+
1:38:29 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
90
87
|
|
|
91
|
-
|
|
88
|
+
1:38:29 PM - Building project '/home/runner/work/captcha/captcha/dev/scripts/tsconfig.json'...
|
|
92
89
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
> @prosopo/scripts@3.1.194 build:cross-env
|
|
7
|
-
> vite build --config vite.esm.config.ts --mode production
|
|
8
|
-
|
|
1
|
+
$ pnpm run build:cross-env --mode ${NODE_ENV:-development}
|
|
2
|
+
$ vite build --config vite.esm.config.ts --mode production
|
|
9
3
|
ViteEsmConfig: .
|
|
10
4
|
{
|
|
11
5
|
tsConfigPaths: [
|
|
@@ -69,7 +63,7 @@ ViteEsmConfig: .
|
|
|
69
63
|
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
70
64
|
Bundle build started
|
|
71
65
|
[2K
|
|
72
|
-
✓
|
|
66
|
+
✓ 16 modules transformed.
|
|
73
67
|
rendering chunks...
|
|
74
68
|
computing gzip size...
|
|
75
69
|
dist/workspace/dist/_virtual/_rolldown/runtime.js 0.03 kB │ gzip: 0.05 kB
|
|
@@ -81,11 +75,12 @@ dist/util/fluxLogDappDetails.js 0.46 kB │ gzip: 0.31 kB
|
|
|
81
75
|
dist/index.js 0.59 kB │ gzip: 0.23 kB
|
|
82
76
|
dist/setup/site.js 0.76 kB │ gzip: 0.41 kB
|
|
83
77
|
dist/util/exec.js 1.01 kB │ gzip: 0.46 kB
|
|
84
|
-
dist/workspace/dist/
|
|
78
|
+
dist/workspace/dist/workspaceGlobs.js 1.17 kB │ gzip: 0.58 kB
|
|
79
|
+
dist/workspace/dist/index.js 1.47 kB │ gzip: 0.33 kB
|
|
85
80
|
dist/util/updateEnv.js 2.07 kB │ gzip: 0.80 kB
|
|
86
81
|
dist/cli/index.js 2.76 kB │ gzip: 1.04 kB
|
|
82
|
+
dist/setup/setup.js 4.70 kB │ gzip: 1.63 kB
|
|
87
83
|
dist/workspace/dist/projectInfo.js 4.71 kB │ gzip: 1.52 kB
|
|
88
84
|
dist/scripts/setVersion.js 4.73 kB │ gzip: 1.58 kB
|
|
89
|
-
dist/setup/setup.js 4.84 kB │ gzip: 1.69 kB
|
|
90
85
|
|
|
91
86
|
[32m✓ built in 37ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,81 @@
|
|
|
1
1
|
# @prosopo/scripts
|
|
2
2
|
|
|
3
|
+
## 3.1.196
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- Updated dependencies [1c13037]
|
|
7
|
+
- Updated dependencies [f961dab]
|
|
8
|
+
- Updated dependencies [a17e8eb]
|
|
9
|
+
- Updated dependencies [7d57d2a]
|
|
10
|
+
- Updated dependencies [4669e64]
|
|
11
|
+
- Updated dependencies [2118584]
|
|
12
|
+
- Updated dependencies [1ce9482]
|
|
13
|
+
- Updated dependencies [dcb691b]
|
|
14
|
+
- Updated dependencies [80b7780]
|
|
15
|
+
- Updated dependencies [dd4c27c]
|
|
16
|
+
- @prosopo/types@5.13.0
|
|
17
|
+
- @prosopo/provider@5.15.0
|
|
18
|
+
- @prosopo/workspace@3.2.2
|
|
19
|
+
- @prosopo/util@3.3.14
|
|
20
|
+
- @prosopo/cli@3.8.26
|
|
21
|
+
- @prosopo/locale@3.7.0
|
|
22
|
+
- @prosopo/common@3.1.62
|
|
23
|
+
- @prosopo/datasets@3.2.1
|
|
24
|
+
- @prosopo/env@3.6.69
|
|
25
|
+
- @prosopo/keyring@2.10.1
|
|
26
|
+
- @prosopo/types-env@2.11.15
|
|
27
|
+
- @prosopo/dotenv@3.0.60
|
|
28
|
+
- @prosopo/logger@2.1.3
|
|
29
|
+
- @prosopo/util-crypto@13.6.0
|
|
30
|
+
|
|
31
|
+
## 3.1.195
|
|
32
|
+
### Patch Changes
|
|
33
|
+
|
|
34
|
+
- e8b5f98: `npm run setup` no longer rewrites the site key in the demo HTML files. It used to rewrite every `data-sitekey` once for each captcha type, so every demo page ended up with the last key registered (puzzle), and the PoW and frictionless demos served puzzle challenges. The demos already read their keys from the `PROSOPO_SITE_KEY_*` env vars at build time, and setup still writes those.
|
|
35
|
+
- Updated dependencies [ede4352]
|
|
36
|
+
- Updated dependencies [478bc6f]
|
|
37
|
+
- Updated dependencies [97d65fa]
|
|
38
|
+
- Updated dependencies [08daf16]
|
|
39
|
+
- Updated dependencies [1144e04]
|
|
40
|
+
- Updated dependencies [fc79e06]
|
|
41
|
+
- Updated dependencies [382f96b]
|
|
42
|
+
- Updated dependencies [de6bb08]
|
|
43
|
+
- Updated dependencies [2145922]
|
|
44
|
+
- Updated dependencies [b017dfb]
|
|
45
|
+
- Updated dependencies [8ed0eb8]
|
|
46
|
+
- Updated dependencies [e62661c]
|
|
47
|
+
- Updated dependencies [9ed0afd]
|
|
48
|
+
- Updated dependencies [3fe7b19]
|
|
49
|
+
- Updated dependencies [b1becee]
|
|
50
|
+
- Updated dependencies [3e1053b]
|
|
51
|
+
- Updated dependencies [df06006]
|
|
52
|
+
- Updated dependencies [06784d0]
|
|
53
|
+
- Updated dependencies [06784d0]
|
|
54
|
+
- Updated dependencies [8d7ba8c]
|
|
55
|
+
- Updated dependencies [995e954]
|
|
56
|
+
- Updated dependencies [97a799e]
|
|
57
|
+
- Updated dependencies [9fc1e8a]
|
|
58
|
+
- Updated dependencies [7e9cd1e]
|
|
59
|
+
- Updated dependencies [f7cfa1c]
|
|
60
|
+
- Updated dependencies [4461043]
|
|
61
|
+
- Updated dependencies [92edebd]
|
|
62
|
+
- Updated dependencies [54a07f3]
|
|
63
|
+
- Updated dependencies [b75e9b7]
|
|
64
|
+
- Updated dependencies [6d5b7f5]
|
|
65
|
+
- @prosopo/util-crypto@13.6.0
|
|
66
|
+
- @prosopo/keyring@2.10.0
|
|
67
|
+
- @prosopo/types@5.12.0
|
|
68
|
+
- @prosopo/provider@5.14.0
|
|
69
|
+
- @prosopo/cli@3.8.25
|
|
70
|
+
- @prosopo/datasets@3.2.0
|
|
71
|
+
- @prosopo/util@3.3.13
|
|
72
|
+
- @prosopo/locale@3.6.2
|
|
73
|
+
- @prosopo/common@3.1.61
|
|
74
|
+
- @prosopo/env@3.6.68
|
|
75
|
+
- @prosopo/types-env@2.11.14
|
|
76
|
+
- @prosopo/logger@2.1.2
|
|
77
|
+
- @prosopo/dotenv@3.0.59
|
|
78
|
+
|
|
3
79
|
## 3.1.194
|
|
4
80
|
### Patch Changes
|
|
5
81
|
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2022 PROSOPO LIMITED
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ Scripts and configuration for setting up a Prosopo development environment.
|
|
|
7
7
|
- A unix-style environment (Linux, MacOS, WSL2)
|
|
8
8
|
- [Docker](https://docs.docker.com/get-docker/)
|
|
9
9
|
- [Node.js](https://nodejs.org/en/download/)
|
|
10
|
+
- [pnpm](https://pnpm.io/installation) 11 (`corepack enable`)
|
|
10
11
|
|
|
11
12
|
## Dev Setup
|
|
12
13
|
|
|
@@ -15,8 +16,8 @@ Scripts and configuration for setting up a Prosopo development environment.
|
|
|
15
16
|
```bash
|
|
16
17
|
git clone https://github.com/prosopo/captcha
|
|
17
18
|
cd captcha
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
pnpm install
|
|
20
|
+
pnpm run build:all
|
|
20
21
|
docker compose --file docker/docker-compose.development.yml up -d
|
|
21
22
|
cp demos/client-example-server/env.development demos/client-example-server/.env.development
|
|
22
23
|
cp demos/client-example/env.development demos/client-example/.env.development
|
|
@@ -24,20 +25,20 @@ cp dev/scripts/env.development .env.development
|
|
|
24
25
|
cp dev/scripts/env.development dev/scripts/.env.development
|
|
25
26
|
cp dev/scripts/env.development packages/cli/.env.development
|
|
26
27
|
cp dev/scripts/env.development packages/procaptcha-bundle/.env.development
|
|
27
|
-
|
|
28
|
+
pnpm run setup:all
|
|
28
29
|
```
|
|
29
30
|
|
|
30
31
|
Then start services in separate terminals:
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
34
|
# Terminal 1 - Example server
|
|
34
|
-
|
|
35
|
+
pnpm run start:server
|
|
35
36
|
|
|
36
37
|
# Terminal 2 - Provider API
|
|
37
|
-
|
|
38
|
+
pnpm run start:provider
|
|
38
39
|
|
|
39
40
|
# Terminal 3 - Demo app
|
|
40
|
-
|
|
41
|
+
pnpm run start:demo
|
|
41
42
|
```
|
|
42
43
|
|
|
43
44
|
### Step by Step
|
|
@@ -51,13 +52,13 @@ docker compose --file ./docker/docker-compose.development.yml up -d
|
|
|
51
52
|
#### 2. Install Dependencies
|
|
52
53
|
|
|
53
54
|
```bash
|
|
54
|
-
|
|
55
|
+
pnpm install
|
|
55
56
|
```
|
|
56
57
|
|
|
57
58
|
#### 3. Build All Packages
|
|
58
59
|
|
|
59
60
|
```bash
|
|
60
|
-
|
|
61
|
+
pnpm run build:all
|
|
61
62
|
```
|
|
62
63
|
|
|
63
64
|
#### 4. Configure Environment
|
|
@@ -69,19 +70,19 @@ Copy the template env files. You can use `./dev/scripts/env.development` as a ba
|
|
|
69
70
|
Registers a provider, loads a dataset, and registers site keys:
|
|
70
71
|
|
|
71
72
|
```bash
|
|
72
|
-
|
|
73
|
+
pnpm run setup:all
|
|
73
74
|
```
|
|
74
75
|
|
|
75
76
|
#### 6. Start Services
|
|
76
77
|
|
|
77
78
|
```bash
|
|
78
|
-
|
|
79
|
+
pnpm run start:provider
|
|
79
80
|
```
|
|
80
81
|
|
|
81
82
|
## Testing
|
|
82
83
|
|
|
83
84
|
```bash
|
|
84
|
-
|
|
85
|
+
pnpm run test
|
|
85
86
|
```
|
|
86
87
|
|
|
87
88
|
## CLI
|
|
@@ -90,14 +91,14 @@ The dev scripts CLI provides development utilities:
|
|
|
90
91
|
|
|
91
92
|
```bash
|
|
92
93
|
# Run the setup (register provider, load dataset, register site keys)
|
|
93
|
-
|
|
94
|
+
pnpm run setup
|
|
94
95
|
|
|
95
96
|
# Create env files from templates
|
|
96
|
-
|
|
97
|
+
pnpm --filter @prosopo/scripts run cli create_env_files
|
|
97
98
|
|
|
98
99
|
# Encode/decode Procaptcha tokens
|
|
99
|
-
|
|
100
|
+
pnpm --filter @prosopo/scripts run cli token
|
|
100
101
|
|
|
101
102
|
# Display version
|
|
102
|
-
|
|
103
|
+
pnpm --filter @prosopo/scripts run cli --version
|
|
103
104
|
```
|
package/dist/cjs/setup/setup.cjs
CHANGED
|
@@ -110,7 +110,6 @@ async function setup(provider, sites) {
|
|
|
110
110
|
env.logger.info(() => ({ msg: `Registering ${siteKey.secret} siteKey ... ${siteKey.pair?.address}` }));
|
|
111
111
|
await require_site.registerSiteKey(env, siteKey.pair.address, siteKey.settings);
|
|
112
112
|
env.logger.debug(() => ({ msg: "Updating env files with PROSOPO_SITE_KEY" }));
|
|
113
|
-
await require_updateEnv.updateDemoHTMLFiles([/data-sitekey="(\w{48})"/, /siteKey:\s*'(\w{48})'/], siteKey.pair.address, env.logger);
|
|
114
113
|
const envVarNames = siteKey.settings.captchaType === "image" ? ["PROSOPO_SITE_KEY", `PROSOPO_SITE_KEY_${siteKey.settings.captchaType.toUpperCase()}`] : [`PROSOPO_SITE_KEY_${siteKey.settings.captchaType.toUpperCase()}`];
|
|
115
114
|
await require_updateEnv.updateEnvFiles(envVarNames, siteKey.pair.address, env.logger);
|
|
116
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/setup/setup.ts"],"names":[],"mappings":"AAsFA,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBAW/D;AAED,wBAAsB,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/setup/setup.ts"],"names":[],"mappings":"AAsFA,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBAW/D;AAED,wBAAsB,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,iBAyF5D"}
|
package/dist/setup/setup.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { updateEnvFiles } from "../util/updateEnv.js";
|
|
2
2
|
import "../util/index.js";
|
|
3
3
|
import { setupProvider } from "./provider.js";
|
|
4
4
|
import { registerSiteKey } from "./site.js";
|
|
@@ -104,7 +104,6 @@ async function setup(provider, sites) {
|
|
|
104
104
|
env.logger.info(() => ({ msg: `Registering ${siteKey.secret} siteKey ... ${siteKey.pair?.address}` }));
|
|
105
105
|
await registerSiteKey(env, siteKey.pair.address, siteKey.settings);
|
|
106
106
|
env.logger.debug(() => ({ msg: "Updating env files with PROSOPO_SITE_KEY" }));
|
|
107
|
-
await updateDemoHTMLFiles([/data-sitekey="(\w{48})"/, /siteKey:\s*'(\w{48})'/], siteKey.pair.address, env.logger);
|
|
108
107
|
await updateEnvFiles(siteKey.settings.captchaType === "image" ? ["PROSOPO_SITE_KEY", `PROSOPO_SITE_KEY_${siteKey.settings.captchaType.toUpperCase()}`] : [`PROSOPO_SITE_KEY_${siteKey.settings.captchaType.toUpperCase()}`], siteKey.pair.address, env.logger);
|
|
109
108
|
}
|
|
110
109
|
process.exit();
|
package/dist/setup/setup.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/setup/setup.ts"],"names":[],"mappings":"AAcA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/setup/setup.ts"],"names":[],"mappings":"AAcA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACN,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,GACP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM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
|
|
1
|
+
{"version":3,"file":"setup.sites.test.d.ts","sourceRoot":"","sources":["../../src/setup/setup.sites.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { CaptchaType, } from "@prosopo/types";
|
|
2
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
const pairFor = (address) => ({ address });
|
|
4
|
+
const sites = [
|
|
5
|
+
{
|
|
6
|
+
address: "5Esjpa4ogV3CnkueyiXet7LL5z5mhvEyi5XJnDGbD2kjzD8W",
|
|
7
|
+
secret: "pow",
|
|
8
|
+
settings: { captchaType: CaptchaType.pow },
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
address: "5CQ3QeyY82R8h8VWFKTic3FMB3WsbSJExZgbaUqfVJtAFPnb",
|
|
12
|
+
secret: "puzzle",
|
|
13
|
+
settings: { captchaType: CaptchaType.puzzle },
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
const addressBySecret = {
|
|
17
|
+
provider: "5EjTA28bKSbFPPyMbUjNtArxyqjwq38r1BapVmLZShaqEedV",
|
|
18
|
+
pow: "5Esjpa4ogV3CnkueyiXet7LL5z5mhvEyi5XJnDGbD2kjzD8W",
|
|
19
|
+
puzzle: "5CQ3QeyY82R8h8VWFKTic3FMB3WsbSJExZgbaUqfVJtAFPnb",
|
|
20
|
+
};
|
|
21
|
+
vi.mock("@prosopo/cli", () => ({
|
|
22
|
+
defaultConfig: () => ({
|
|
23
|
+
account: { secret: "provider" },
|
|
24
|
+
authAccount: { secret: "provider" },
|
|
25
|
+
}),
|
|
26
|
+
getSecret: () => "provider",
|
|
27
|
+
}));
|
|
28
|
+
vi.mock("@prosopo/env", () => ({
|
|
29
|
+
ProviderEnvironment: class {
|
|
30
|
+
constructor() {
|
|
31
|
+
this.logger = {
|
|
32
|
+
info: () => undefined,
|
|
33
|
+
debug: () => undefined,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
isReady() {
|
|
37
|
+
return Promise.resolve();
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
}));
|
|
41
|
+
vi.mock("@prosopo/keyring", () => ({
|
|
42
|
+
generateMnemonic: () => Promise.resolve(["", ""]),
|
|
43
|
+
getDefaultSiteKeys: () => sites,
|
|
44
|
+
getPair: (secret) => pairFor(addressBySecret[secret ?? ""] ?? ""),
|
|
45
|
+
}));
|
|
46
|
+
vi.mock("./provider.js", () => ({
|
|
47
|
+
setupProvider: () => Promise.resolve(),
|
|
48
|
+
}));
|
|
49
|
+
const registerSiteKey = vi.fn((_env, _siteKey) => Promise.resolve());
|
|
50
|
+
vi.mock("./site.js", () => ({
|
|
51
|
+
registerSiteKey: (env, siteKey) => registerSiteKey(env, siteKey),
|
|
52
|
+
}));
|
|
53
|
+
const updateDemoHTMLFiles = vi.fn((_matchers, _value, _logger) => Promise.resolve());
|
|
54
|
+
const updateEnvFiles = vi.fn((_names, _value, _logger) => Promise.resolve());
|
|
55
|
+
vi.mock("../util/index.js", () => ({
|
|
56
|
+
updateDemoHTMLFiles: (matchers, value, logger) => updateDemoHTMLFiles(matchers, value, logger),
|
|
57
|
+
updateEnvFiles: (names, value, logger) => updateEnvFiles(names, value, logger),
|
|
58
|
+
}));
|
|
59
|
+
const { setup } = await import("./setup.js");
|
|
60
|
+
beforeEach(() => {
|
|
61
|
+
vi.stubEnv("PROSOPO_SITE_KEY", addressBySecret.pow);
|
|
62
|
+
vi.stubEnv("PROSOPO_PROVIDER_ADDRESS", addressBySecret.provider);
|
|
63
|
+
vi.spyOn(process, "exit").mockImplementation((_code) => undefined);
|
|
64
|
+
});
|
|
65
|
+
afterEach(() => {
|
|
66
|
+
vi.unstubAllEnvs();
|
|
67
|
+
vi.restoreAllMocks();
|
|
68
|
+
registerSiteKey.mockClear();
|
|
69
|
+
updateDemoHTMLFiles.mockClear();
|
|
70
|
+
updateEnvFiles.mockClear();
|
|
71
|
+
});
|
|
72
|
+
describe("setup sites", () => {
|
|
73
|
+
it("registers every default site key", async () => {
|
|
74
|
+
await setup(false, true);
|
|
75
|
+
expect(registerSiteKey.mock.calls.map((call) => call[1])).toEqual([
|
|
76
|
+
addressBySecret.pow,
|
|
77
|
+
addressBySecret.puzzle,
|
|
78
|
+
]);
|
|
79
|
+
});
|
|
80
|
+
it("does not rewrite demo HTML, which would stamp the last site key onto every page", async () => {
|
|
81
|
+
await setup(false, true);
|
|
82
|
+
expect(updateDemoHTMLFiles).not.toHaveBeenCalled();
|
|
83
|
+
});
|
|
84
|
+
it("still points each captcha type's env var at its own key", async () => {
|
|
85
|
+
await setup(false, true);
|
|
86
|
+
expect(updateEnvFiles.mock.calls.map((call) => [call[0], call[1]])).toEqual([
|
|
87
|
+
[["PROSOPO_SITE_KEY_POW"], addressBySecret.pow],
|
|
88
|
+
[["PROSOPO_SITE_KEY_PUZZLE"], addressBySecret.puzzle],
|
|
89
|
+
]);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=setup.sites.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.sites.test.js","sourceRoot":"","sources":["../../src/setup/setup.sites.test.ts"],"names":[],"mappings":"AAcA,OAAO,EACN,WAAW,GAIX,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAEzE,MAAM,OAAO,GAAG,CAAC,OAAe,EAAe,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,CAAgB,CAAC;AAE/E,MAAM,KAAK,GAAY;IACtB;QACC,OAAO,EAAE,kDAAkD;QAC3D,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,GAAG,EAAE;KACjC;IACV;QACC,OAAO,EAAE,kDAAkD;QAC3D,MAAM,EAAE,QAAQ;QAChB,QAAQ,EAAE,EAAE,WAAW,EA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CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAC1E;YACC,CAAC,CAAC,sBAAsB,CAAC,EAAE,eAAe,CAAC,GAAG,CAAC;YAC/C,CAAC,CAAC,yBAAyB,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC;SACrD,CACD,CAAC;IACH,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { findWorkspaceRoot, getAccountPkgDir, getApiPkgDir, getCacheDir, getCliPkgDir, getClientBundleExampleDir, getClientExampleServerDir, getCommonPkgDir, getConfigPkgDir, getDatabasePkgDir, getDatasetsFsPkgDir, getDatasetsPkgDir, getDemosDir, getDevDir, getDotEnvPkgDir, getEnvPkgDir, getLocalePkgDir, getNodeModulesDir, getPackagesDir, getProcaptchaBundlePkgDir, getProcaptchaCommonPkgDir, getProcaptchaFrictionlessPkgDir, getProcaptchaPkgDir, getProcaptchaPoWPkgDir, getProcaptchaReactPkgDir, getProviderPkgDir, getRootDir, getScriptsPkgDir, getServerPkgDir, getTestResultsDir, getTypesDatabasePkgDir, getTypesEnvPkgDir, getTypesPkgDir, getUtilPkgDir, getWidgetSkeletonPkgDir } from "./projectInfo.js";
|
|
2
|
-
|
|
2
|
+
import { getWorkspacePatterns } from "./workspaceGlobs.js";
|
|
3
|
+
export { findWorkspaceRoot, getAccountPkgDir, getApiPkgDir, getCacheDir, getCliPkgDir, getClientBundleExampleDir, getClientExampleServerDir, getCommonPkgDir, getConfigPkgDir, getDatabasePkgDir, getDatasetsFsPkgDir, getDatasetsPkgDir, getDemosDir, getDevDir, getDotEnvPkgDir, getEnvPkgDir, getLocalePkgDir, getNodeModulesDir, getPackagesDir, getProcaptchaBundlePkgDir, getProcaptchaCommonPkgDir, getProcaptchaFrictionlessPkgDir, getProcaptchaPkgDir, getProcaptchaPoWPkgDir, getProcaptchaReactPkgDir, getProviderPkgDir, getRootDir, getScriptsPkgDir, getServerPkgDir, getTestResultsDir, getTypesDatabasePkgDir, getTypesEnvPkgDir, getTypesPkgDir, getUtilPkgDir, getWidgetSkeletonPkgDir, getWorkspacePatterns };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import fs from "node:fs";
|
|
3
|
+
import { parse } from "yaml";
|
|
4
|
+
//#region ../workspace/dist/workspaceGlobs.js
|
|
5
|
+
/**
|
|
6
|
+
* Glob patterns for `suffix` inside every member of the pnpm workspace rooted
|
|
7
|
+
* beside `rootPackageJsonPath`, read from its pnpm-workspace.yaml. Excluded
|
|
8
|
+
* members (`!dir`) become negative patterns, so pass the whole list to a
|
|
9
|
+
* single glob call.
|
|
10
|
+
*/
|
|
11
|
+
var getWorkspacePatterns = (rootPackageJsonPath, suffix) => {
|
|
12
|
+
const root = path.dirname(rootPackageJsonPath);
|
|
13
|
+
const workspaceFile = path.join(root, "pnpm-workspace.yaml");
|
|
14
|
+
if (!fs.existsSync(workspaceFile)) throw new Error(`${rootPackageJsonPath} is not a workspace: no ${workspaceFile}`);
|
|
15
|
+
const manifest = parse(fs.readFileSync(workspaceFile, "utf8"));
|
|
16
|
+
const packages = manifest && typeof manifest === "object" && "packages" in manifest ? manifest.packages : void 0;
|
|
17
|
+
if (!Array.isArray(packages) || !packages.every((glob) => typeof glob === "string")) throw new Error(`${workspaceFile} has no list of packages`);
|
|
18
|
+
return packages.map((glob) => glob.startsWith("!") ? `!${root}/${glob.slice(1)}/${suffix}` : `${root}/${glob}/${suffix}`);
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { getWorkspacePatterns };
|
package/package.json
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
2
|
+
"name": "@prosopo/scripts",
|
|
3
|
+
"version": "3.1.196",
|
|
4
|
+
"description": "Dev scripts for working with prosopo packages",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/cjs/index.cjs",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": "^24"
|
|
17
|
+
},
|
|
18
|
+
"author": "Prosopo Limited",
|
|
19
|
+
"license": "Apache-2.0",
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@iarna/toml": "2.2.5",
|
|
22
|
+
"@polkadot/util": "14.0.3",
|
|
23
|
+
"@polkadot/util-crypto": "14.0.3",
|
|
24
|
+
"@prosopo/cli": "3.8.26",
|
|
25
|
+
"@prosopo/common": "3.1.62",
|
|
26
|
+
"@prosopo/logger": "2.1.3",
|
|
27
|
+
"@prosopo/datasets": "3.2.1",
|
|
28
|
+
"@prosopo/dotenv": "3.0.60",
|
|
29
|
+
"@prosopo/env": "3.6.69",
|
|
30
|
+
"@prosopo/keyring": "2.10.1",
|
|
31
|
+
"@prosopo/locale": "3.7.0",
|
|
32
|
+
"@prosopo/provider": "5.15.0",
|
|
33
|
+
"@prosopo/types": "5.13.0",
|
|
34
|
+
"@prosopo/types-env": "2.11.15",
|
|
35
|
+
"@prosopo/util": "3.3.14",
|
|
36
|
+
"@prosopo/util-crypto": "13.6.0",
|
|
37
|
+
"@prosopo/workspace": "3.2.2",
|
|
38
|
+
"dotenv": "16.4.5",
|
|
39
|
+
"fast-glob": "3.3.3",
|
|
40
|
+
"fs-extra": "11.4.0",
|
|
41
|
+
"yargs": "18.1.0"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@prosopo/config": "3.4.3",
|
|
45
|
+
"@types/fs-extra": "11.0.4",
|
|
46
|
+
"@types/node": "22.10.2",
|
|
47
|
+
"@types/yargs": "17.0.33",
|
|
48
|
+
"@vitest/coverage-v8": "4.1.11",
|
|
49
|
+
"concurrently": "9.0.1",
|
|
50
|
+
"del-cli": "6.0.0",
|
|
51
|
+
"npm-run-all": "4.1.5",
|
|
52
|
+
"tslib": "2.7.0",
|
|
53
|
+
"tsx": "4.20.3",
|
|
54
|
+
"typescript": "5.6.2",
|
|
55
|
+
"vite": "8.1.5",
|
|
56
|
+
"vitest": "4.1.11"
|
|
57
|
+
},
|
|
58
|
+
"repository": {
|
|
59
|
+
"type": "git",
|
|
60
|
+
"url": "git+https://github.com/prosopo/captcha.git",
|
|
61
|
+
"directory": "dev/scripts"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"build": "pnpm run build:cross-env --mode ${NODE_ENV:-development}",
|
|
65
|
+
"build:cross-env": "vite build --config vite.esm.config.ts",
|
|
66
|
+
"build:tsc": "tsc --build --verbose",
|
|
67
|
+
"build:cjs": "NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV",
|
|
68
|
+
"typecheck": "tsc --project tsconfig.types.json",
|
|
69
|
+
"test": "NODE_ENV=${NODE_ENV:-test}; pnpm exec vitest run --config ./vite.test.config.ts --mode $NODE_ENV",
|
|
70
|
+
"cli": "node dist/cli/index.js",
|
|
71
|
+
"setup": "node dist/cli/index.js setup"
|
|
72
|
+
}
|
|
73
|
+
}
|