@prosopo/api 3.5.18 → 3.5.20

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/api@3.5.18 build:cjs
2
+ > @prosopo/api@3.5.20 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
- vite v6.4.1 building SSR bundle for production...
22
+ 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.
23
+ vite v8.1.5 building ssr environment for production...
23
24
  Bundle build started
24
- transforming...
25
- Build end
26
- ✓ 6 modules transformed.
27
- Entry 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.
28
- Entry 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.
25
+ 
26
+ ✓ 7 modules transformed.
29
27
  rendering chunks...
30
- dist/cjs/api/HttpError.cjs  0.38 kB
31
- dist/cjs/api/apiClient.cjs  0.42 kB
32
- dist/cjs/api/index.cjs  0.54 kB
33
- dist/cjs/index.cjs  0.58 kB
34
- dist/cjs/api/HttpClientBase.cjs  2.90 kB
35
- dist/cjs/api/ProviderApi.cjs 14.42 kB
36
- ✓ built in 223ms
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
+ ✓ built in 65ms
@@ -1,8 +1,8 @@
1
1
 
2
- > @prosopo/api@3.5.18 build:tsc
2
+ > @prosopo/api@3.5.20 build:tsc
3
3
  > tsc --build --verbose
4
4
 
5
- 12:17:05 PM - Projects in this build:
5
+ 8:58:56 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
- 12:17:05 PM - Project '../../dev/config/tsconfig.json' is up to date because newest input '../../dev/config/src/index.ts' is older than output '../../dev/config/tsconfig.tsbuildinfo'
13
+ 8:58:57 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'
14
14
 
15
- 12:17:05 PM - Project '../locale/tsconfig.json' is up to date because newest input '../locale/src/translationKey.ts' is older than output '../locale/tsconfig.tsbuildinfo'
15
+ 8:58:57 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
- 12:17:06 PM - Project '../util/tsconfig.json' is up to date because newest input '../util/src/url.ts' is older than output '../util/tsconfig.tsbuildinfo'
17
+ 8:58:57 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
- 12:17:06 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'
19
+ 8:58:57 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
- 12:17:06 PM - Project '../types/tsconfig.json' is up to date because newest input '../types/src/provider/api.ts' is older than output '../types/tsconfig.tsbuildinfo'
21
+ 8:58:57 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
- 12:17:06 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
23
+ 8:58:57 PM - Project 'tsconfig.json' is out of date because output file 'tsconfig.tsbuildinfo' does not exist
24
24
 
25
- 12:17:06 PM - Building project '/home/runner/work/captcha/captcha/packages/api/tsconfig.json'...
25
+ 8:58:57 PM - Building project '/home/runner/work/captcha/captcha/packages/api/tsconfig.json'...
26
26
 
@@ -1,9 +1,9 @@
1
1
 
2
- > @prosopo/api@3.5.18 build
2
+ > @prosopo/api@3.5.20 build
3
3
  > npm run build:cross-env -- --mode ${NODE_ENV:-development}
4
4
 
5
5
 
6
- > @prosopo/api@3.5.18 build:cross-env
6
+ > @prosopo/api@3.5.20 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
- vite v6.4.1 building SSR bundle for production...
26
+ 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.
27
+ vite v8.1.5 building ssr environment for production...
27
28
  Bundle build started
28
- transforming...
29
- Build end
30
- ✓ 6 modules transformed.
29
+ 
30
+ ✓ 7 modules transformed.
31
31
  rendering chunks...
32
- dist/api/HttpError.js  0.29 kB
33
- dist/api/apiClient.js  0.31 kB
34
- dist/api/index.js  0.33 kB
35
- dist/index.js  0.37 kB
36
- dist/api/HttpClientBase.js  2.71 kB
37
- dist/api/ProviderApi.js 13.87 kB
38
- ✓ built in 232ms
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
+ ✓ built in 71ms
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @prosopo/api
2
2
 
3
+ ## 3.5.20
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 [103318c]
8
+ - Updated dependencies [270a8d8]
9
+ - Updated dependencies [e14fce6]
10
+ - @prosopo/types@4.10.0
11
+
12
+ ## 3.5.19
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies [a0cb39e]
16
+ - @prosopo/types@4.9.12
17
+
3
18
  ## 3.5.18
4
19
  ### Patch Changes
5
20
 
@@ -0,0 +1,3 @@
1
+ import "node:module";
2
+ //#endregion
3
+ export {};
@@ -1,83 +1,70 @@
1
1
  import { HttpError } from "./HttpError.js";
2
- class HttpClientBase {
3
- constructor(baseURL, prefix = "") {
4
- this.baseURL = baseURL + prefix;
5
- }
6
- async fetch(input, init) {
7
- try {
8
- const response = await fetch(this.baseURL + input, init);
9
- if (!response.ok && // Only throw an error if the response is not JSON and not a 400 error
10
- response.status !== 400 && !response.headers.get("content-type")?.includes("application/json")) {
11
- throw new HttpError(response.status, response.statusText, response.url);
12
- }
13
- return this.responseHandler(response);
14
- } catch (error) {
15
- return this.errorHandler(error);
16
- }
17
- }
18
- async post(input, body, init) {
19
- const headers = {
20
- "Content-Type": "application/json",
21
- ...init?.headers || {}
22
- };
23
- try {
24
- const response = await fetch(this.baseURL + input, {
25
- method: "POST",
26
- body: JSON.stringify(body),
27
- ...init,
28
- headers
29
- });
30
- if (!response.ok && // Only throw an error if the response is not JSON and not a 400 error
31
- response.status !== 400 && !response.headers.get("content-type")?.includes("application/json")) {
32
- throw new HttpError(response.status, response.statusText, response.url);
33
- }
34
- return this.responseHandler(response);
35
- } catch (error) {
36
- return this.errorHandler(error);
37
- }
38
- }
39
- // Like `post`, but also surfaces the response Headers so callers can read
40
- // values delivered out-of-band (e.g. the honeypot meta header). The body
41
- // is still parsed as JSON.
42
- async postWithHeaders(input, body, init) {
43
- const headers = {
44
- "Content-Type": "application/json",
45
- ...init?.headers || {}
46
- };
47
- try {
48
- const response = await fetch(this.baseURL + input, {
49
- method: "POST",
50
- body: JSON.stringify(body),
51
- ...init,
52
- headers
53
- });
54
- if (!response.ok && response.status !== 400 && !response.headers.get("content-type")?.includes("application/json")) {
55
- throw new HttpError(response.status, response.statusText, response.url);
56
- }
57
- const data = await this.responseHandler(response);
58
- return { data, headers: response.headers };
59
- } catch (error) {
60
- return this.errorHandler(error);
61
- }
62
- }
63
- async responseHandler(response) {
64
- try {
65
- return await response.json();
66
- } catch (error) {
67
- console.error("Error parsing JSON:", error);
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 };
@@ -1,12 +1,12 @@
1
- class HttpError extends Error {
2
- constructor(status, statusText, url) {
3
- super(`HTTP error! status: ${status} (${statusText}) for URL: ${url}`);
4
- this.status = status;
5
- this.statusText = statusText;
6
- this.url = url;
7
- this.name = "HttpError";
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 };