@nomalism-com/api 0.45.64 → 0.45.66

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/dist/index.js CHANGED
@@ -134,6 +134,7 @@ import Nomalism from "@nomalism-com/types";
134
134
 
135
135
  // src/lib/apiError.ts
136
136
  import axios from "axios";
137
+ var RAW_ERROR = /* @__PURE__ */ Symbol("rawError");
137
138
  var ApiError = class _ApiError extends Error {
138
139
  constructor(fields, cause) {
139
140
  super(fields.message);
@@ -144,7 +145,7 @@ var ApiError = class _ApiError extends Error {
144
145
  this.method = fields.method;
145
146
  this.url = fields.url;
146
147
  this.data = fields.data;
147
- Object.defineProperty(this, "cause", {
148
+ Object.defineProperty(this, RAW_ERROR, {
148
149
  value: cause,
149
150
  enumerable: false,
150
151
  writable: false,
@@ -153,6 +154,13 @@ var ApiError = class _ApiError extends Error {
153
154
  const captureStackTrace = Error.captureStackTrace;
154
155
  captureStackTrace?.(this, _ApiError);
155
156
  }
157
+ /**
158
+ * The original underlying error (e.g. the raw AxiosError) for deep debugging.
159
+ * Lives on a non-enumerable Symbol slot, so it is never printed by loggers.
160
+ */
161
+ get raw() {
162
+ return this[RAW_ERROR];
163
+ }
156
164
  /** Controls what `JSON.stringify(err)` and most loggers emit — kept compact. */
157
165
  toJSON() {
158
166
  return {
@@ -21,8 +21,8 @@ export interface IApiErrorFields {
21
21
  *
22
22
  * Only small primitives are kept as enumerable fields, so `console.log(err)`,
23
23
  * `JSON.stringify(err)` and `err.stack` stay short. The original axios error is
24
- * preserved on a NON-enumerable `cause` property available for deep debugging,
25
- * but never dumped when the error is logged.
24
+ * preserved on a non-enumerable Symbol slot, reachable via `err.raw` for deep
25
+ * debugging, but never dumped when the error is logged.
26
26
  */
27
27
  export declare class ApiError extends Error {
28
28
  readonly kind: ApiErrorKind;
@@ -37,6 +37,11 @@ export declare class ApiError extends Error {
37
37
  /** The server-provided error payload (response body), when present. */
38
38
  readonly data?: unknown;
39
39
  constructor(fields: IApiErrorFields, cause?: unknown);
40
+ /**
41
+ * The original underlying error (e.g. the raw AxiosError) for deep debugging.
42
+ * Lives on a non-enumerable Symbol slot, so it is never printed by loggers.
43
+ */
44
+ get raw(): unknown;
40
45
  /** Controls what `JSON.stringify(err)` and most loggers emit — kept compact. */
41
46
  toJSON(): IApiErrorFields;
42
47
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nomalism-com/api",
3
3
  "description": "A nomalism API package for performing HTTP requests on API endpoints",
4
- "version": "0.45.64",
4
+ "version": "0.45.66",
5
5
  "author": "Nomalism <it.nomalism@gmail.com> (https://https://nomalism.com/)",
6
6
  "license": "UNLICENSED",
7
7
  "type": "module",
@@ -23,19 +23,19 @@
23
23
  "prepack": "npm run lint && npm run build"
24
24
  },
25
25
  "dependencies": {
26
- "@nomalism-com/types": "^0.45.68",
26
+ "@nomalism-com/types": "^0.45.69",
27
27
  "axios": "^1.17.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@swc/core": "^1.15.40",
31
- "@types/node": "^24.13.1",
30
+ "@swc/core": "^1.15.41",
31
+ "@types/node": "^24.13.2",
32
32
  "@typescript-eslint/eslint-plugin": "^8.61.0",
33
33
  "@typescript-eslint/parser": "^8.61.0",
34
34
  "eslint": "^9.39.4",
35
35
  "eslint-config-prettier": "^10.1.8",
36
36
  "eslint-import-resolver-typescript": "^4.4.5",
37
37
  "eslint-plugin-prettier": "^5.5.6",
38
- "prettier": "^3.8.3",
38
+ "prettier": "^3.8.4",
39
39
  "tsup": "^8.5.1"
40
40
  },
41
41
  "repository": {