@twin.org/web 0.0.2-next.4 → 0.0.2-next.5

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.
@@ -20,13 +20,13 @@ class FetchError extends core.BaseError {
20
20
  * @param message The message as a code.
21
21
  * @param httpStatus The http status code.
22
22
  * @param properties Any additional information for the error.
23
- * @param inner The inner error if we have wrapped another error.
23
+ * @param cause The cause of the error if we have wrapped another error.
24
24
  */
25
- constructor(source, message, httpStatus, properties, inner) {
25
+ constructor(source, message, httpStatus, properties, cause) {
26
26
  super(FetchError.CLASS_NAME, source, message, {
27
27
  httpStatus,
28
28
  ...properties
29
- }, inner);
29
+ }, cause);
30
30
  }
31
31
  }
32
32
 
@@ -521,11 +521,20 @@ class FetchHelper {
521
521
  }
522
522
  }, options?.timeoutMs);
523
523
  }
524
+ let finalBody;
525
+ if (method === HttpMethod.POST || method === HttpMethod.PUT) {
526
+ if (core.Is.string(body)) {
527
+ finalBody = body;
528
+ }
529
+ else if (core.Is.uint8Array(body)) {
530
+ finalBody = new Uint8Array(body);
531
+ }
532
+ }
524
533
  try {
525
534
  const requestOptions = {
526
535
  method,
527
536
  headers: options?.headers,
528
- body: method === HttpMethod.POST || method === HttpMethod.PUT ? body : undefined,
537
+ body: finalBody,
529
538
  signal: controller ? controller.signal : undefined
530
539
  };
531
540
  if (core.Is.boolean(options?.includeCredentials)) {
@@ -18,13 +18,13 @@ class FetchError extends BaseError {
18
18
  * @param message The message as a code.
19
19
  * @param httpStatus The http status code.
20
20
  * @param properties Any additional information for the error.
21
- * @param inner The inner error if we have wrapped another error.
21
+ * @param cause The cause of the error if we have wrapped another error.
22
22
  */
23
- constructor(source, message, httpStatus, properties, inner) {
23
+ constructor(source, message, httpStatus, properties, cause) {
24
24
  super(FetchError.CLASS_NAME, source, message, {
25
25
  httpStatus,
26
26
  ...properties
27
- }, inner);
27
+ }, cause);
28
28
  }
29
29
  }
30
30
 
@@ -519,11 +519,20 @@ class FetchHelper {
519
519
  }
520
520
  }, options?.timeoutMs);
521
521
  }
522
+ let finalBody;
523
+ if (method === HttpMethod.POST || method === HttpMethod.PUT) {
524
+ if (Is.string(body)) {
525
+ finalBody = body;
526
+ }
527
+ else if (Is.uint8Array(body)) {
528
+ finalBody = new Uint8Array(body);
529
+ }
530
+ }
522
531
  try {
523
532
  const requestOptions = {
524
533
  method,
525
534
  headers: options?.headers,
526
- body: method === HttpMethod.POST || method === HttpMethod.PUT ? body : undefined,
535
+ body: finalBody,
527
536
  signal: controller ? controller.signal : undefined
528
537
  };
529
538
  if (Is.boolean(options?.includeCredentials)) {
@@ -14,9 +14,9 @@ export declare class FetchError extends BaseError {
14
14
  * @param message The message as a code.
15
15
  * @param httpStatus The http status code.
16
16
  * @param properties Any additional information for the error.
17
- * @param inner The inner error if we have wrapped another error.
17
+ * @param cause The cause of the error if we have wrapped another error.
18
18
  */
19
19
  constructor(source: string, message: string, httpStatus: HttpStatusCode, properties?: {
20
20
  [id: string]: unknown;
21
- }, inner?: unknown);
21
+ }, cause?: unknown);
22
22
  }
package/docs/changelog.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @twin.org/web - Changelog
2
2
 
3
+ ## [0.0.2-next.5](https://github.com/twinfoundation/framework/compare/web-v0.0.2-next.4...web-v0.0.2-next.5) (2025-08-19)
4
+
5
+
6
+ ### Features
7
+
8
+ * use cause instead of inner for errors ([1f4acc4](https://github.com/twinfoundation/framework/commit/1f4acc4d7a6b71a134d9547da9bf40de1e1e49da))
9
+
10
+
11
+ ### Dependencies
12
+
13
+ * The following workspace dependencies were updated
14
+ * dependencies
15
+ * @twin.org/core bumped from 0.0.2-next.4 to 0.0.2-next.5
16
+ * @twin.org/crypto bumped from 0.0.2-next.4 to 0.0.2-next.5
17
+ * @twin.org/nameof bumped from 0.0.2-next.4 to 0.0.2-next.5
18
+ * devDependencies
19
+ * @twin.org/nameof-transformer bumped from 0.0.2-next.4 to 0.0.2-next.5
20
+ * @twin.org/nameof-vitest-plugin bumped from 0.0.2-next.4 to 0.0.2-next.5
21
+
3
22
  ## [0.0.2-next.4](https://github.com/twinfoundation/framework/compare/web-v0.0.2-next.3...web-v0.0.2-next.4) (2025-08-15)
4
23
 
5
24
 
@@ -10,7 +10,7 @@ Class to represent errors from fetch.
10
10
 
11
11
  ### Constructor
12
12
 
13
- > **new FetchError**(`source`, `message`, `httpStatus`, `properties?`, `inner?`): `FetchError`
13
+ > **new FetchError**(`source`, `message`, `httpStatus`, `properties?`, `cause?`): `FetchError`
14
14
 
15
15
  Create a new instance of FetchError.
16
16
 
@@ -38,11 +38,11 @@ The http status code.
38
38
 
39
39
  Any additional information for the error.
40
40
 
41
- ##### inner?
41
+ ##### cause?
42
42
 
43
43
  `unknown`
44
44
 
45
- The inner error if we have wrapped another error.
45
+ The cause of the error if we have wrapped another error.
46
46
 
47
47
  #### Returns
48
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@twin.org/web",
3
- "version": "0.0.2-next.4",
3
+ "version": "0.0.2-next.5",
4
4
  "description": "Contains classes for use with web operations",
5
5
  "repository": {
6
6
  "type": "git",
@@ -14,10 +14,10 @@
14
14
  "node": ">=20.0.0"
15
15
  },
16
16
  "dependencies": {
17
- "@twin.org/core": "0.0.2-next.4",
18
- "@twin.org/crypto": "0.0.2-next.4",
19
- "@twin.org/nameof": "0.0.2-next.4",
20
- "jose": "6.0.11"
17
+ "@twin.org/core": "0.0.2-next.5",
18
+ "@twin.org/crypto": "0.0.2-next.5",
19
+ "@twin.org/nameof": "0.0.2-next.5",
20
+ "jose": "6.0.12"
21
21
  },
22
22
  "main": "./dist/cjs/index.cjs",
23
23
  "module": "./dist/esm/index.mjs",