@venizia/ardor-kernel 0.5.0-1 → 0.5.0-3

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
  import { getError } from '@venizia/ignis-inversion';
2
- import { HttpResponseReader } from '@venizia/ignis-kernel/repository';
2
+ import { HttpResponseReader } from '@venizia/ignis-helpers/core';
3
3
  import { HeaderConstants, RequestCountData, RequestTypes, } from '../../common/index.js';
4
4
  /** A list body that carries its rows and its total: `{ data, count }`. Null and primitives are not one. */
5
5
  const isCountedBody = (value) => {
@@ -111,30 +111,11 @@ export class NetworkResponseReader {
111
111
  * the server's code and args, its `extra` with the `requestId` added, and `details.cause`.
112
112
  * `message` is the server's text, not a log line, because react-admin shows it to the user.
113
113
  */
114
- static async toError(opts) {
115
- const { response } = opts;
116
- const server = await HttpResponseReader.readError({
117
- response,
114
+ static toError(opts) {
115
+ return HttpResponseReader.toApplicationError({
116
+ response: opts.response,
118
117
  rootKey: NetworkResponseReader.ERROR_ROOT_KEY,
119
118
  });
120
- // A relaying server's `extra.requestId` names the request it made upstream; keep it, nearest first.
121
- const extra = { ...server.extra };
122
- if (server.requestId) {
123
- const upstreamRequestId = extra.requestId;
124
- extra.requestId = server.requestId;
125
- if (upstreamRequestId !== undefined && upstreamRequestId !== server.requestId) {
126
- const known = Array.isArray(extra.upstreamRequestIds) ? extra.upstreamRequestIds : [];
127
- extra.upstreamRequestIds = [upstreamRequestId, ...known];
128
- }
129
- }
130
- return getError({
131
- statusCode: response.status,
132
- message: server.normalized?.text ?? server.message ?? `HTTP ${response.status}`,
133
- messageCode: server.normalized?.code,
134
- messageArgs: server.normalized?.args,
135
- extra: Object.keys(extra).length > 0 ? extra : undefined,
136
- cause: server.details?.cause,
137
- });
138
119
  }
139
120
  /** The total from `Content-Range`, or the page's own row count when the header is absent or malformed. */
140
121
  static resolveTotal(opts) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@venizia/ardor-kernel",
3
- "version": "0.5.0-1",
3
+ "version": "0.5.0-3",
4
4
  "description": "ARDOR kernel - the isomorphic core of the ARDOR frontend framework: application base on IGNIS inversion, service and provider bases, request/auth constants, binding keys, the network request service, runtime config and the HTTP repository (from IGNIS). No React and no react-admin.",
5
5
  "keywords": [
6
6
  "ardor",
@@ -71,13 +71,13 @@
71
71
  },
72
72
  "devDependencies": {
73
73
  "@size-limit/preset-small-lib": "^14.2.0",
74
- "@types/bun": "^1.4.3",
75
- "@venizia/dev-configs": "^0.5.0-1",
76
- "@venizia/ignis-connectors": "^0.5.0-1",
74
+ "@types/bun": "^1.4.5",
75
+ "@venizia/dev-configs": "^0.5.0-2",
76
+ "@venizia/ignis-connectors": "^0.5.0-3",
77
77
  "@venizia/ignis-filter": "^0.5.0-0",
78
- "@venizia/ignis-helpers": "^0.5.0-0",
78
+ "@venizia/ignis-helpers": "^0.5.0-1",
79
79
  "@venizia/ignis-inversion": "^0.5.0-0",
80
- "@venizia/ignis-kernel": "^0.5.0-0",
80
+ "@venizia/ignis-kernel": "^0.5.0-2",
81
81
  "eslint": "^10.13.0",
82
82
  "oxlint": "1.89.0",
83
83
  "oxlint-tsgolint": "7.0.2004",
@@ -87,11 +87,11 @@
87
87
  "typescript": "^6.0.3"
88
88
  },
89
89
  "peerDependencies": {
90
- "@venizia/ignis-connectors": "^0.5.0-1",
90
+ "@venizia/ignis-connectors": "^0.5.0-3",
91
91
  "@venizia/ignis-filter": "^0.5.0-0",
92
- "@venizia/ignis-helpers": "^0.5.0-0",
92
+ "@venizia/ignis-helpers": "^0.5.0-1",
93
93
  "@venizia/ignis-inversion": "^0.5.0-0",
94
- "@venizia/ignis-kernel": "^0.5.0-0",
94
+ "@venizia/ignis-kernel": "^0.5.0-2",
95
95
  "reflect-metadata": ">=0.2.2"
96
96
  },
97
97
  "peerDependenciesMeta": {