@scayle/storefront-nuxt 8.62.9 → 8.63.0
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/CHANGELOG.md +59 -0
- package/README.md +37 -0
- package/dist/module.d.mts +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/JSONReporter.d.ts +4 -0
- package/dist/runtime/JSONReporter.js +11 -1
- package/dist/runtime/api/rpcHandler.d.ts +4 -1
- package/dist/runtime/api/rpcHandler.js +1 -1
- package/dist/runtime/error/handler.d.ts +18 -8
- package/dist/runtime/error/handler.js +17 -24
- package/dist/runtime/utils/zodSchema.d.ts +2 -0
- package/dist/test/factories.d.mts +3 -3
- package/package.json +9 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 8.63.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added the OpenTelemetry trace context to server-side JSON logs. With `storefront.log.json` enabled, a log line written while an OpenTelemetry span is active, for example during a request traced by `@scayle/nuxt-opentelemetry`, now carries top-level `trace_id` and `span_id` fields, so log backends can link each line to its trace. This covers the Storefront logger (`useLog`, `event.context.$log`, and the `log` of the RPC context) and `console` output on the server. The field names follow the OpenTelemetry convention for trace context in non-OTLP log formats, the same fields the JSON logs of Storefront Application V3 carry.
|
|
8
|
+
|
|
9
|
+
Lines written outside a span, or while the active span has an invalid span context, keep their previous shape. Logs without `storefront.log.json` and browser logs are unchanged.
|
|
10
|
+
|
|
11
|
+
- Stopped RPC error responses from exposing the message of the error an RPC method threw. The RPC handler copied that message into the `statusMessage` and `message` of the response. For a failed Storefront API call, the message holds the full request URL, which can include the basket or wishlist key and the query parameters, so that URL reached the browser.
|
|
12
|
+
|
|
13
|
+
The response now depends on the thrown error:
|
|
14
|
+
|
|
15
|
+
- An `H3Error`, for example from `createError({ statusCode: 404 })`, is sent with its own `statusCode`, `statusMessage`, and `data`. Before, it became a `500`.
|
|
16
|
+
- A `FetchError` from `ofetch` keeps the status code of the failed request, with the standard reason phrase of that code as `statusMessage` and `message`, for example `NOT FOUND`.
|
|
17
|
+
- Any other error, including a `FetchError` from `@scayle/storefront-api`, becomes a `500` with `INTERNAL SERVER ERROR` as `statusMessage` and `message`.
|
|
18
|
+
|
|
19
|
+
The server log and the `storefront:rpc:error` hook still receive the original error, and the response error carries it as `cause`. Error tracking that reads the `statusMessage` of an RPC error, like `trackError` in the Storefront Application, now receives the reason phrase.
|
|
20
|
+
|
|
21
|
+
If a custom RPC method has a message meant for the client, throw it as an `H3Error` and put the details into `data`, or return an `ErrorResponse`:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { createError } from 'h3'
|
|
25
|
+
|
|
26
|
+
throw createError({
|
|
27
|
+
statusCode: 409,
|
|
28
|
+
statusMessage: 'Conflict',
|
|
29
|
+
data: { reason: 'item-unavailable' },
|
|
30
|
+
})
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Patch Changes
|
|
34
|
+
|
|
35
|
+
- Updated dependency `@vercel/nft@1.11.0` to `@vercel/nft@1.11.1`
|
|
36
|
+
|
|
37
|
+
**Dependencies**
|
|
38
|
+
|
|
39
|
+
**@scayle/storefront-core v8.63.0**
|
|
40
|
+
|
|
41
|
+
- Minor
|
|
42
|
+
- Added the RPC methods `updateBasketItems` and `updateWishlistItems`. They apply a list of add, update and remove operations to the basket (add and remove for the wishlist) in one Storefront API request, for example for a reorder or a bundle. Before, mixing adds, updates and removes needed one call per operation.
|
|
43
|
+
|
|
44
|
+
`updateBasketItems` is not the plural of `updateBasketItem`. That method sets the quantity of one existing item, while this one takes a list of operations of mixed types.
|
|
45
|
+
|
|
46
|
+
Both methods return the basket or wishlist after all operations plus one result per operation, in the order you sent the operations. A failed operation does not fail the call, so read `results` for the outcome of each one. An empty list returns `400`, and a request the Storefront API rejects returns a `Response` with its status only. After a `500` the operations may be partly applied, so fetch the basket or wishlist before you retry. The operation rules and the `pricePromotionKey` handling are the ones of `bulkUpdateItems` in `@scayle/storefront-api`.
|
|
47
|
+
|
|
48
|
+
The methods do not update the state of `useBasket` and `useWishlist`, so call their `refresh()` afterwards or use the returned basket or wishlist.
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
const { basket, results } = await rpc('updateBasketItems', {
|
|
52
|
+
operations: [
|
|
53
|
+
{ action: 'add', variantId: 338316, quantity: 2 },
|
|
54
|
+
{ action: 'update', key: 'aec0f393', quantity: 3 },
|
|
55
|
+
{ action: 'remove', key: 'b12d4e8a' },
|
|
56
|
+
],
|
|
57
|
+
})
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`@scayle/storefront-core` now requires `@scayle/storefront-api` 19.9.0 or later, the first version with `bulkUpdateItems`.
|
|
61
|
+
|
|
3
62
|
## 8.62.9
|
|
4
63
|
|
|
5
64
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -40,6 +40,43 @@ Visit the [Quickstart Guide](https://scayle.dev/en/core-documentation/storefront
|
|
|
40
40
|
|
|
41
41
|
Visit the [Docs](https://scayle.dev) to learn more about our system requirements.
|
|
42
42
|
|
|
43
|
+
## JSON logs
|
|
44
|
+
|
|
45
|
+
Set `storefront.log.json` to `true` in the public runtime config, or `NUXT_PUBLIC_STOREFRONT_LOG_JSON=true` in the
|
|
46
|
+
environment, to write server-side logs as one JSON object per line. This covers the Storefront logger (`useLog`,
|
|
47
|
+
`event.context.$log`, and the `log` of the RPC context) and all `console` output on the server. Browser logs keep
|
|
48
|
+
their format.
|
|
49
|
+
|
|
50
|
+
Each line carries:
|
|
51
|
+
|
|
52
|
+
- `timestamp`: ISO 8601 string of the log entry's date.
|
|
53
|
+
- `message`: the formatted message, prefixed with the log space (for example `[storefront-nuxt.sfc]`), including
|
|
54
|
+
stack traces and causes of logged errors.
|
|
55
|
+
- `severity`: the consola log type, for example `info`, `warn`, `error`, or `debug`.
|
|
56
|
+
- `trace_id` and `span_id`: lowercase hex ids of the OpenTelemetry span that was active when the log was written,
|
|
57
|
+
for example the request span of [`@scayle/nuxt-opentelemetry`](https://www.npmjs.com/package/@scayle/nuxt-opentelemetry).
|
|
58
|
+
Omitted when no span is active, for example during startup or when the OpenTelemetry SDK is not initialized, and
|
|
59
|
+
when the active span has an invalid span context. The field names follow the OpenTelemetry
|
|
60
|
+
[trace context in non-OTLP log formats](https://opentelemetry.io/docs/specs/otel/compatibility/logging_trace_context/)
|
|
61
|
+
convention, so log backends can link each line to its trace.
|
|
62
|
+
|
|
63
|
+
Consola collapses an identical message that is logged more than five times in a row, each within a second of the
|
|
64
|
+
previous one, into one line ending in `(repeated N times)`. That line carries the `trace_id` and `span_id` of the log
|
|
65
|
+
call that writes it, which can belong to a different request than the repeated messages.
|
|
66
|
+
|
|
67
|
+
For example, `event.context.$log.info('Basket updated')` in a server route handler writes this line during a traced
|
|
68
|
+
request, spread over several lines here for reading:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"timestamp": "2026-11-06T12:00:00.000Z",
|
|
73
|
+
"message": "[storefront-nuxt] Basket updated",
|
|
74
|
+
"severity": "info",
|
|
75
|
+
"trace_id": "0af7651916cd43dd8448eb211c80319c",
|
|
76
|
+
"span_id": "b7ad6b7169203331"
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
43
80
|
## What is SCAYLE?
|
|
44
81
|
|
|
45
82
|
[SCAYLE](https://scayle.com) is a full-featured e-commerce software solution that comes with flexible APIs.
|
package/dist/module.d.mts
CHANGED
|
@@ -54,12 +54,12 @@ declare module '@nuxt/schema' {
|
|
|
54
54
|
declare const _default: _nuxt_schema.NuxtModule<{
|
|
55
55
|
rpcDir?: string | undefined;
|
|
56
56
|
rpcMethodNames?: string[] | undefined;
|
|
57
|
-
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
57
|
+
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "updateBasketItems" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "updateWishlistItems" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
58
58
|
apiBasePath?: string | undefined;
|
|
59
59
|
}, {
|
|
60
60
|
rpcDir?: string | undefined;
|
|
61
61
|
rpcMethodNames?: string[] | undefined;
|
|
62
|
-
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
62
|
+
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "updateBasketItems" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "updateWishlistItems" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
63
63
|
apiBasePath?: string | undefined;
|
|
64
64
|
}, false>;
|
|
65
65
|
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -3,6 +3,10 @@ import type { LogObject, ConsolaReporter, FormatOptions, ConsolaOptions } from '
|
|
|
3
3
|
* This custom Consola reporter formats log objects in a JSON string.
|
|
4
4
|
* It is a modified version of the built-in BasicReporter
|
|
5
5
|
* https://github.com/unjs/consola/blob/main/src/reporters/basic.ts
|
|
6
|
+
*
|
|
7
|
+
* Each line carries `timestamp`, `message` and `severity`. A line written while
|
|
8
|
+
* an OpenTelemetry span is active also carries the span's `trace_id` and
|
|
9
|
+
* `span_id`, so log backends can link it to its trace.
|
|
6
10
|
*/
|
|
7
11
|
export declare class JSONReporter implements ConsolaReporter {
|
|
8
12
|
formatStack(stack: string, message: string, opts: FormatOptions): string;
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { formatWithOptions } from "node:util";
|
|
2
2
|
import { sep } from "node:path";
|
|
3
|
+
import { isSpanContextValid, trace } from "@opentelemetry/api";
|
|
3
4
|
function parseStack(stack, message) {
|
|
4
5
|
const cwd = process.cwd() + sep;
|
|
5
6
|
const lines = stack.split("\n").splice(message.split("\n").length).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
|
|
6
7
|
return lines;
|
|
7
8
|
}
|
|
9
|
+
function getActiveSpanContext() {
|
|
10
|
+
const spanContext = trace.getActiveSpan()?.spanContext();
|
|
11
|
+
return spanContext && isSpanContextValid(spanContext) ? spanContext : void 0;
|
|
12
|
+
}
|
|
8
13
|
export class JSONReporter {
|
|
9
14
|
formatStack(stack, message, opts) {
|
|
10
15
|
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
@@ -39,10 +44,15 @@ ${stack}${causedError}`;
|
|
|
39
44
|
}
|
|
40
45
|
formatLogObj(logObj, opts) {
|
|
41
46
|
const message = this.formatArgs(logObj.args, opts);
|
|
47
|
+
const spanContext = getActiveSpanContext();
|
|
42
48
|
return JSON.stringify({
|
|
43
49
|
timestamp: logObj.date.toISOString(),
|
|
44
50
|
message,
|
|
45
|
-
severity: logObj.type
|
|
51
|
+
severity: logObj.type,
|
|
52
|
+
...spanContext && {
|
|
53
|
+
trace_id: spanContext.traceId,
|
|
54
|
+
span_id: spanContext.spanId
|
|
55
|
+
}
|
|
46
56
|
});
|
|
47
57
|
}
|
|
48
58
|
log(logObj, ctx) {
|
|
@@ -48,7 +48,10 @@ declare const _default: import("h3").EventHandler<import("h3").EventHandlerReque
|
|
|
48
48
|
type: undefined;
|
|
49
49
|
} | import("@scayle/storefront-api").ShopConfiguration | {
|
|
50
50
|
user?: import("@scayle/storefront-core").ShopUser;
|
|
51
|
-
} | import("@scayle/storefront-api").Wishlist | Response |
|
|
51
|
+
} | import("@scayle/storefront-api").Wishlist | Response | {
|
|
52
|
+
wishlist: import("@scayle/storefront-api").Wishlist;
|
|
53
|
+
results: import("@scayle/storefront-api").WishlistBulkResult[];
|
|
54
|
+
} | import("@scayle/storefront-core").ShopUserAddress[] | {
|
|
52
55
|
accessToken: string | undefined;
|
|
53
56
|
checkoutJwt: string;
|
|
54
57
|
} | import("@scayle/storefront-api").VariantDetail[] | import("@scayle/storefront-api").NavigationAllEndpointResponseData | import("@scayle/storefront-api").NavigationTree | import("@scayle/storefront-api").PromotionsEndpointResponseData | {
|
|
@@ -107,7 +107,7 @@ export default defineEventHandler(async (event) => {
|
|
|
107
107
|
$rpcContext,
|
|
108
108
|
e
|
|
109
109
|
);
|
|
110
|
-
result =
|
|
110
|
+
result = resolveError(e);
|
|
111
111
|
if (e instanceof Error) {
|
|
112
112
|
span.recordException(e);
|
|
113
113
|
if (e.cause && e.cause instanceof Error) {
|
|
@@ -1,13 +1,23 @@
|
|
|
1
|
+
import type { H3Error } from 'h3';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
+
* Converts an error thrown by an RPC method into the `H3Error` the RPC handler
|
|
4
|
+
* responds with.
|
|
3
5
|
*
|
|
4
|
-
*
|
|
6
|
+
* The response body reaches the browser, so only an `H3Error` keeps its own
|
|
7
|
+
* `statusMessage`, `message`, and `data`. An RPC method throws one on purpose
|
|
8
|
+
* to tell the client something. Any other error can carry internal details,
|
|
9
|
+
* like the message of a `FetchError` from `@scayle/storefront-api`, which
|
|
10
|
+
* holds the Storefront API request URL including any basket or wishlist key.
|
|
11
|
+
* For those, the response carries the standard reason phrase of the status
|
|
12
|
+
* code as `statusMessage` and `message` instead. The original error stays
|
|
13
|
+
* available as `cause` for server-side tracing.
|
|
5
14
|
*
|
|
6
|
-
* @
|
|
15
|
+
* @param error The error the RPC method threw.
|
|
16
|
+
*
|
|
17
|
+
* @returns The error itself if it is an `H3Error`. For a `FetchError` from
|
|
18
|
+
* `ofetch`, an `H3Error` with the HTTP status of the failed request, or `500`
|
|
19
|
+
* if the request got no response. For any other error, an `H3Error` with
|
|
20
|
+
* status `500`.
|
|
7
21
|
*/
|
|
8
|
-
declare const resolveError: (error:
|
|
9
|
-
statusCode: 100 | 101 | 102 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 506 | 507 | 508 | 510 | 511 | 306 | 505;
|
|
10
|
-
statusMessage: string;
|
|
11
|
-
name: string;
|
|
12
|
-
};
|
|
22
|
+
declare const resolveError: (error: unknown) => H3Error;
|
|
13
23
|
export { resolveError };
|
|
@@ -1,30 +1,23 @@
|
|
|
1
|
+
import { createError, isError } from "h3";
|
|
1
2
|
import { HttpStatusCode, HttpStatusMessage } from "@scayle/storefront-core";
|
|
2
3
|
import { FetchError } from "ofetch";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
return {
|
|
7
|
-
statusCode: error.status ?? HttpStatusCode.INTERNAL_SERVER_ERROR,
|
|
8
|
-
statusMessage: error.statusText ?? HttpStatusMessage.INTERNAL_SERVER_ERROR,
|
|
9
|
-
url
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
if (error instanceof Error) {
|
|
13
|
-
return {
|
|
14
|
-
statusCode: HttpStatusCode.INTERNAL_SERVER_ERROR,
|
|
15
|
-
statusMessage: error.message ?? HttpStatusMessage.INTERNAL_SERVER_ERROR
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
statusCode: HttpStatusCode.INTERNAL_SERVER_ERROR,
|
|
20
|
-
statusMessage: HttpStatusMessage.INTERNAL_SERVER_ERROR
|
|
21
|
-
};
|
|
4
|
+
const getReasonPhrase = (statusCode) => {
|
|
5
|
+
const [key] = Object.entries(HttpStatusCode).find(([_, code]) => code === statusCode) ?? [];
|
|
6
|
+
return key ? HttpStatusMessage[key] : void 0;
|
|
22
7
|
};
|
|
23
8
|
const resolveError = (error) => {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
9
|
+
if (isError(error)) {
|
|
10
|
+
return error;
|
|
11
|
+
}
|
|
12
|
+
const statusCode = error instanceof FetchError ? error.status ?? HttpStatusCode.INTERNAL_SERVER_ERROR : HttpStatusCode.INTERNAL_SERVER_ERROR;
|
|
13
|
+
const reasonPhrase = getReasonPhrase(statusCode);
|
|
14
|
+
return createError({
|
|
15
|
+
statusCode,
|
|
16
|
+
statusMessage: reasonPhrase,
|
|
17
|
+
// Nitro sends `message` in the response body, so it must not come from
|
|
18
|
+
// `error`.
|
|
19
|
+
message: reasonPhrase,
|
|
20
|
+
cause: error
|
|
21
|
+
});
|
|
29
22
|
};
|
|
30
23
|
export { resolveError };
|
|
@@ -1256,6 +1256,7 @@ declare const ModuleOptionSchema: z.ZodMiniObject<{
|
|
|
1256
1256
|
updateBasketItem: "updateBasketItem";
|
|
1257
1257
|
getApplicablePromotionsByCode: "getApplicablePromotionsByCode";
|
|
1258
1258
|
updatePromotions: "updatePromotions";
|
|
1259
|
+
updateBasketItems: "updateBasketItems";
|
|
1259
1260
|
getBrands: "getBrands";
|
|
1260
1261
|
getBrandById: "getBrandById";
|
|
1261
1262
|
getRootCategories: "getRootCategories";
|
|
@@ -1276,6 +1277,7 @@ declare const ModuleOptionSchema: z.ZodMiniObject<{
|
|
|
1276
1277
|
getWishlist: "getWishlist";
|
|
1277
1278
|
addItemToWishlist: "addItemToWishlist";
|
|
1278
1279
|
removeItemFromWishlist: "removeItemFromWishlist";
|
|
1280
|
+
updateWishlistItems: "updateWishlistItems";
|
|
1279
1281
|
clearWishlist: "clearWishlist";
|
|
1280
1282
|
getOrderById: "getOrderById";
|
|
1281
1283
|
getOrderCustomData: "getOrderCustomData";
|
|
@@ -15,17 +15,17 @@ declare const moduleRuntimeOptionsFactory: Factory<StorefrontRuntimeConfigType,
|
|
|
15
15
|
declare const moduleOptionsFactory: Factory<{
|
|
16
16
|
rpcDir?: string | undefined;
|
|
17
17
|
rpcMethodNames?: string[] | undefined;
|
|
18
|
-
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
18
|
+
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "updateBasketItems" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "updateWishlistItems" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
19
19
|
apiBasePath?: string | undefined;
|
|
20
20
|
}, any, {
|
|
21
21
|
rpcDir?: string | undefined;
|
|
22
22
|
rpcMethodNames?: string[] | undefined;
|
|
23
|
-
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
23
|
+
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "updateBasketItems" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "updateWishlistItems" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
24
24
|
apiBasePath?: string | undefined;
|
|
25
25
|
}, fishery.DeepPartialObject<{
|
|
26
26
|
rpcDir?: string | undefined;
|
|
27
27
|
rpcMethodNames?: string[] | undefined;
|
|
28
|
-
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
28
|
+
rpcMethodOverrides?: ("getProductById" | "getProductsByIds" | "getProductsByReferenceKeys" | "getProductsCount" | "fetchAllFiltersForCategory" | "getFilters" | "getProductsByCategory" | "oauthForgetPassword" | "oauthGuestLogin" | "oauthLogin" | "oauthRegister" | "oauthRevokeToken" | "refreshAccessToken" | "updatePasswordByHash" | "addItemToBasket" | "addItemsToBasket" | "getBasket" | "removeItemFromBasket" | "clearBasket" | "mergeBaskets" | "updateBasketItem" | "getApplicablePromotionsByCode" | "updatePromotions" | "updateBasketItems" | "getBrands" | "getBrandById" | "getRootCategories" | "getCategoryByPath" | "getCategoriesByPath" | "getCategoryById" | "getCategoryTree" | "getCampaign" | "getCampaignKey" | "getOrderDataByCbd" | "getSearchSuggestions" | "resolveSearch" | "getShopConfiguration" | "getUser" | "fetchUser" | "refreshUser" | "getAccessToken" | "getWishlist" | "addItemToWishlist" | "removeItemFromWishlist" | "updateWishlistItems" | "clearWishlist" | "getOrderById" | "getOrderCustomData" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
29
29
|
apiBasePath?: string | undefined;
|
|
30
30
|
}>>;
|
|
31
31
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.63.0",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"peerDependencies": {
|
|
70
70
|
"@nuxt/kit": ">=3.15.0 || >=4.2.0",
|
|
71
|
-
"@scayle/storefront-api": "^19.
|
|
71
|
+
"@scayle/storefront-api": "^19.9.0",
|
|
72
72
|
"fishery": "^2.2.2",
|
|
73
73
|
"h3": "^1.10.0",
|
|
74
74
|
"nitropack": "^2.9.7",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"dependencies": {
|
|
80
80
|
"@opentelemetry/api": "^1.9.1",
|
|
81
81
|
"@scayle/h3-session": "0.7.2",
|
|
82
|
-
"@scayle/storefront-core": "8.
|
|
82
|
+
"@scayle/storefront-core": "8.63.0",
|
|
83
83
|
"@scayle/unstorage-compression-driver": "1.6.0",
|
|
84
|
-
"@vercel/nft": "1.11.
|
|
84
|
+
"@vercel/nft": "1.11.1",
|
|
85
85
|
"@vueuse/core": "15.0.0",
|
|
86
86
|
"consola": "^3.4.2",
|
|
87
87
|
"core-js": "^3.49.0",
|
|
@@ -107,25 +107,27 @@
|
|
|
107
107
|
"@nuxt/module-builder": "1.0.3",
|
|
108
108
|
"@nuxt/schema": "^3.21.10",
|
|
109
109
|
"@nuxt/test-utils": "4.0.3",
|
|
110
|
+
"@opentelemetry/context-async-hooks": "^2.8.0",
|
|
111
|
+
"@opentelemetry/sdk-trace-base": "^2.8.0",
|
|
110
112
|
"@scayle/eslint-config-storefront": "^5.1.0",
|
|
111
113
|
"@scayle/eslint-plugin-vue-composable": "^1.1.0",
|
|
112
114
|
"@scayle/unstorage-scayle-kv-driver": "^3.0.0",
|
|
113
115
|
"@scayle/vitest-config-storefront": "1.0.0",
|
|
114
116
|
"@types/node": "^24",
|
|
115
|
-
"@vitest/coverage-v8": "5.0
|
|
117
|
+
"@vitest/coverage-v8": "5.1.0",
|
|
116
118
|
"eslint": "10.14.0",
|
|
117
119
|
"eslint-formatter-gitlab": "7.2.0",
|
|
118
120
|
"fishery": "2.4.0",
|
|
119
121
|
"h3": "1.15.11",
|
|
120
122
|
"happy-dom": "21.0.4",
|
|
121
123
|
"nitro-test-utils": "0.11.2",
|
|
122
|
-
"nitropack": "2.13.
|
|
124
|
+
"nitropack": "2.13.6",
|
|
123
125
|
"node-mocks-http": "1.18.1",
|
|
124
126
|
"nuxt": "^3.21.10",
|
|
125
127
|
"publint": "0.3.25",
|
|
126
128
|
"typescript": "6.0.3",
|
|
127
129
|
"unbuild": "3.6.1",
|
|
128
|
-
"vitest": "5.0
|
|
130
|
+
"vitest": "5.1.0",
|
|
129
131
|
"vue-tsc": "3.3.14"
|
|
130
132
|
},
|
|
131
133
|
"scripts": {
|