@prosopo/api 3.5.19 → 3.5.21
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 +14 -14
- package/.turbo/turbo-build$colon$tsc.log +9 -9
- package/.turbo/turbo-build.log +16 -13
- package/CHANGELOG.md +14 -0
- package/dist/_virtual/_rolldown/runtime.js +3 -0
- package/dist/api/HttpClientBase.js +68 -81
- package/dist/api/HttpError.js +11 -11
- package/dist/api/ProviderApi.js +304 -430
- package/dist/api/apiClient.js +9 -9
- package/dist/api/index.js +3 -9
- package/dist/cjs/api/HttpClientBase.cjs +69 -81
- package/dist/cjs/api/HttpError.cjs +11 -11
- package/dist/cjs/api/ProviderApi.cjs +305 -430
- package/dist/cjs/api/apiClient.cjs +10 -10
- package/dist/cjs/api/index.cjs +9 -11
- package/dist/cjs/index.cjs +9 -11
- package/dist/index.js +4 -10
- package/dist/tests/api.test-d.d.ts +2 -0
- package/dist/tests/api.test-d.d.ts.map +1 -0
- package/dist/tests/api.test-d.js +66 -0
- package/dist/tests/api.test-d.js.map +1 -0
- package/dist/tests/apiHarness.d.ts +25 -0
- package/dist/tests/apiHarness.d.ts.map +1 -0
- package/dist/tests/apiHarness.js +87 -0
- package/dist/tests/apiHarness.js.map +1 -0
- package/dist/tests/httpClientBase.unit.test.d.ts +2 -0
- package/dist/tests/httpClientBase.unit.test.d.ts.map +1 -0
- package/dist/tests/httpClientBase.unit.test.js +257 -0
- package/dist/tests/httpClientBase.unit.test.js.map +1 -0
- package/dist/tests/providerApi.unit.test.d.ts +2 -0
- package/dist/tests/providerApi.unit.test.d.ts.map +1 -0
- package/dist/tests/providerApi.unit.test.js +536 -0
- package/dist/tests/providerApi.unit.test.js.map +1 -0
- package/package.json +10 -7
- package/vite.test.config.ts +19 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/api@3.5.
|
|
2
|
+
> @prosopo/api@3.5.21 build:cjs
|
|
3
3
|
> NODE_ENV=${NODE_ENV:-development}; vite build --config vite.cjs.config.ts --mode $NODE_ENV
|
|
4
4
|
|
|
5
5
|
ViteCommonJSConfig: .
|
|
@@ -19,18 +19,18 @@ ViteCommonJSConfig: .
|
|
|
19
19
|
'@prosopo/util-crypto'
|
|
20
20
|
]
|
|
21
21
|
}
|
|
22
|
-
[
|
|
22
|
+
[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
|
|
23
|
+
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
23
24
|
Bundle build started
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
[32m✓[39m 6 modules transformed.
|
|
27
|
-
[33mEntry module "src/api/HttpClientBase.ts" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.[39m
|
|
28
|
-
[33mEntry module "src/api/ProviderApi.ts" is using named and default exports together. Consumers of your bundle will have to use `..default` to access the default export, which may not be what you want. Use `output.exports: "named"` to disable this warning.[39m
|
|
25
|
+
[2K
|
|
26
|
+
✓ 7 modules transformed.
|
|
29
27
|
rendering chunks...
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
computing gzip size...
|
|
29
|
+
dist/cjs/api/HttpError.cjs 0.33 kB │ gzip: 0.21 kB
|
|
30
|
+
dist/cjs/api/apiClient.cjs 0.39 kB │ gzip: 0.24 kB
|
|
31
|
+
dist/cjs/api/index.cjs 0.52 kB │ gzip: 0.18 kB
|
|
32
|
+
dist/cjs/index.cjs 0.61 kB │ gzip: 0.24 kB
|
|
33
|
+
dist/cjs/api/HttpClientBase.cjs 2.29 kB │ gzip: 0.61 kB
|
|
34
|
+
dist/cjs/api/ProviderApi.cjs 13.81 kB │ gzip: 2.26 kB
|
|
35
|
+
|
|
36
|
+
[32m✓ built in 72ms[39m
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/api@3.5.
|
|
2
|
+
> @prosopo/api@3.5.21 build:tsc
|
|
3
3
|
> tsc --build --verbose
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
12:36:02 PM - Projects in this build:
|
|
6
6
|
* ../../dev/config/tsconfig.json
|
|
7
7
|
* ../locale/tsconfig.json
|
|
8
8
|
* ../util/tsconfig.json
|
|
@@ -10,17 +10,17 @@
|
|
|
10
10
|
* ../types/tsconfig.json
|
|
11
11
|
* tsconfig.json
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
12:36:02 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/webpack/index.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
12:36:02 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
12:36:02 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
12:36:02 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'
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
12:36:02 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/provider/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
12:36:02 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
12:36:02 PM - Building project '/home/runner/work/captcha/captcha/packages/api/tsconfig.json'...
|
|
26
26
|
|
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
|
|
2
|
-
> @prosopo/api@3.5.
|
|
2
|
+
> @prosopo/api@3.5.21 build
|
|
3
3
|
> npm run build:cross-env -- --mode ${NODE_ENV:-development}
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
> @prosopo/api@3.5.
|
|
6
|
+
> @prosopo/api@3.5.21 build:cross-env
|
|
7
7
|
> vite build --config vite.esm.config.ts --mode production
|
|
8
8
|
|
|
9
9
|
ViteEsmConfig: .
|
|
@@ -23,16 +23,19 @@ ViteEsmConfig: .
|
|
|
23
23
|
'@prosopo/util-crypto'
|
|
24
24
|
]
|
|
25
25
|
}
|
|
26
|
-
[
|
|
26
|
+
[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
|
|
27
|
+
[36mvite v8.1.5 [32mbuilding ssr environment for production...[36m[39m
|
|
27
28
|
Bundle build started
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
[32m✓[39m 6 modules transformed.
|
|
29
|
+
[2K
|
|
30
|
+
✓ 7 modules transformed.
|
|
31
31
|
rendering chunks...
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
32
|
+
computing gzip size...
|
|
33
|
+
dist/_virtual/_rolldown/runtime.js 0.04 kB │ gzip: 0.06 kB
|
|
34
|
+
dist/api/index.js 0.30 kB │ gzip: 0.15 kB
|
|
35
|
+
dist/api/HttpError.js 0.32 kB │ gzip: 0.21 kB
|
|
36
|
+
dist/api/apiClient.js 0.35 kB │ gzip: 0.23 kB
|
|
37
|
+
dist/index.js 0.36 kB │ gzip: 0.18 kB
|
|
38
|
+
dist/api/HttpClientBase.js 2.19 kB │ gzip: 0.60 kB
|
|
39
|
+
dist/api/ProviderApi.js 12.18 kB │ gzip: 2.27 kB
|
|
40
|
+
|
|
41
|
+
[32m✓ built in 73ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @prosopo/api
|
|
2
2
|
|
|
3
|
+
## 3.5.21
|
|
4
|
+
### Patch Changes
|
|
5
|
+
|
|
6
|
+
- 1e0cf14: Add unit and type tests for the provider API client: transport behaviour (JSON error bodies vs transport errors, 400 handling, parse failures, header merging), the in-flight challenge de-duplication, every client and admin endpoint's path, body and headers, and the frictionless honeypot meta header. 128 tests, 100% statement, branch, function and line coverage. No behaviour changes.
|
|
7
|
+
|
|
8
|
+
## 3.5.20
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 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
|
|
12
|
+
- Updated dependencies [103318c]
|
|
13
|
+
- Updated dependencies [270a8d8]
|
|
14
|
+
- Updated dependencies [e14fce6]
|
|
15
|
+
- @prosopo/types@4.10.0
|
|
16
|
+
|
|
3
17
|
## 3.5.19
|
|
4
18
|
### Patch Changes
|
|
5
19
|
|
|
@@ -1,83 +1,70 @@
|
|
|
1
1
|
import { HttpError } from "./HttpError.js";
|
|
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
|
-
throw error;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
errorHandler(error) {
|
|
72
|
-
if (error instanceof HttpError) {
|
|
73
|
-
console.error("HTTP error:", error);
|
|
74
|
-
} else {
|
|
75
|
-
console.error("API request error:", error);
|
|
76
|
-
}
|
|
77
|
-
return Promise.reject(error);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
export {
|
|
81
|
-
HttpClientBase,
|
|
82
|
-
HttpClientBase as default
|
|
2
|
+
//#region src/api/HttpClientBase.ts
|
|
3
|
+
var HttpClientBase = class {
|
|
4
|
+
constructor(baseURL, prefix = "") {
|
|
5
|
+
this.baseURL = baseURL + prefix;
|
|
6
|
+
}
|
|
7
|
+
async fetch(input, init) {
|
|
8
|
+
try {
|
|
9
|
+
const response = await fetch(this.baseURL + input, init);
|
|
10
|
+
if (!response.ok && response.status !== 400 && !response.headers.get("content-type")?.includes("application/json")) throw new HttpError(response.status, response.statusText, response.url);
|
|
11
|
+
return this.responseHandler(response);
|
|
12
|
+
} catch (error) {
|
|
13
|
+
return this.errorHandler(error);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
async post(input, body, init) {
|
|
17
|
+
const headers = {
|
|
18
|
+
"Content-Type": "application/json",
|
|
19
|
+
...init?.headers || {}
|
|
20
|
+
};
|
|
21
|
+
try {
|
|
22
|
+
const response = await fetch(this.baseURL + input, {
|
|
23
|
+
method: "POST",
|
|
24
|
+
body: JSON.stringify(body),
|
|
25
|
+
...init,
|
|
26
|
+
headers
|
|
27
|
+
});
|
|
28
|
+
if (!response.ok && response.status !== 400 && !response.headers.get("content-type")?.includes("application/json")) throw new HttpError(response.status, response.statusText, response.url);
|
|
29
|
+
return this.responseHandler(response);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
return this.errorHandler(error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
async postWithHeaders(input, body, init) {
|
|
35
|
+
const headers = {
|
|
36
|
+
"Content-Type": "application/json",
|
|
37
|
+
...init?.headers || {}
|
|
38
|
+
};
|
|
39
|
+
try {
|
|
40
|
+
const response = await fetch(this.baseURL + input, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
body: JSON.stringify(body),
|
|
43
|
+
...init,
|
|
44
|
+
headers
|
|
45
|
+
});
|
|
46
|
+
if (!response.ok && response.status !== 400 && !response.headers.get("content-type")?.includes("application/json")) throw new HttpError(response.status, response.statusText, response.url);
|
|
47
|
+
return {
|
|
48
|
+
data: await this.responseHandler(response),
|
|
49
|
+
headers: response.headers
|
|
50
|
+
};
|
|
51
|
+
} catch (error) {
|
|
52
|
+
return this.errorHandler(error);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async responseHandler(response) {
|
|
56
|
+
try {
|
|
57
|
+
return await response.json();
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error("Error parsing JSON:", error);
|
|
60
|
+
throw error;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
errorHandler(error) {
|
|
64
|
+
if (error instanceof HttpError) console.error("HTTP error:", error);
|
|
65
|
+
else console.error("API request error:", error);
|
|
66
|
+
return Promise.reject(error);
|
|
67
|
+
}
|
|
83
68
|
};
|
|
69
|
+
//#endregion
|
|
70
|
+
export { HttpClientBase, HttpClientBase as default };
|
package/dist/api/HttpError.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
export {
|
|
11
|
-
HttpError
|
|
1
|
+
//#region src/api/HttpError.ts
|
|
2
|
+
var HttpError = class extends Error {
|
|
3
|
+
constructor(status, statusText, url) {
|
|
4
|
+
super(`HTTP error! status: ${status} (${statusText}) for URL: ${url}`);
|
|
5
|
+
this.status = status;
|
|
6
|
+
this.statusText = statusText;
|
|
7
|
+
this.url = url;
|
|
8
|
+
this.name = "HttpError";
|
|
9
|
+
}
|
|
12
10
|
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { HttpError };
|