@scayle/storefront-nuxt 8.33.2 → 8.34.1
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 +28 -0
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/api/rpcHandler.d.ts +37 -1
- package/dist/runtime/cached.d.ts +1 -1
- package/dist/runtime/composables/core/useIDP.d.ts +1 -1
- package/dist/runtime/composables/core/useRpc.d.ts +3 -2
- package/dist/runtime/composables/core/useRpc.js +1 -4
- package/dist/runtime/composables/core/useUser.d.ts +2 -2
- package/dist/runtime/composables/storefront/useBasket.d.ts +4 -4
- package/dist/runtime/composables/storefront/useBasket.js +2 -7
- package/dist/runtime/composables/storefront/useCategoryTree.d.ts +1 -1
- package/dist/runtime/composables/storefront/useCategoryTree.js +1 -3
- package/dist/runtime/composables/storefront/useOrder.d.ts +1 -1
- package/dist/runtime/composables/storefront/useStorefrontSearch.d.ts +3 -1
- package/dist/runtime/composables/storefront/useWishlist.d.ts +2 -2
- package/dist/runtime/composables/storefront/useWishlist.js +1 -5
- package/dist/runtime/context.d.ts +1 -1
- package/dist/runtime/nitro/plugins/configValidation.d.ts +4 -3
- package/dist/runtime/nitro/plugins/configValidation.js +3 -3
- package/dist/runtime/server/middleware/bootstrap-utils.d.ts +1 -1
- package/dist/runtime/server/middleware/bootstrap-utils.js +1 -5
- package/dist/runtime/server/middleware/bootstrap.js +1 -4
- package/dist/runtime/server/utils/cacheStorage.d.ts +1 -1
- package/dist/runtime/utils/rpc.d.ts +2 -2
- package/dist/runtime/utils/rpc.js +1 -3
- package/dist/runtime/utils/zodSchema.d.ts +985 -2470
- package/dist/runtime/utils/zodSchema.js +76 -69
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 8.34.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependency `zod@^3.23.8` to `zod@^4.0.0`
|
|
8
|
+
|
|
9
|
+
**Dependencies**
|
|
10
|
+
|
|
11
|
+
- Updated dependency to @scayle/unstorage-compression-driver@1.0.0
|
|
12
|
+
|
|
13
|
+
**@scayle/storefront-core v8.34.1**
|
|
14
|
+
|
|
15
|
+
- No changes in this release.
|
|
16
|
+
|
|
17
|
+
## 8.34.0
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
**Dependencies**
|
|
22
|
+
|
|
23
|
+
- Updated dependency to @scayle/unstorage-compression-driver@1.0.0
|
|
24
|
+
|
|
25
|
+
**@scayle/storefront-core v8.34.0**
|
|
26
|
+
|
|
27
|
+
- Minor
|
|
28
|
+
- Added export of `Pagination` type.
|
|
29
|
+
- **Breaking:** Improved type safety of the `mergeBaskets` RPC method. The method now returns the correct type `Promise<BasketResponse<Product, Variant> | AddManyItemsBasketResponse<Product, Variant> | undefined>` instead of `any`.
|
|
30
|
+
|
|
3
31
|
## 8.33.2
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -10,5 +10,41 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @returns The result of the RPC call or a `Response` object with an error status.
|
|
12
12
|
*/
|
|
13
|
-
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<
|
|
13
|
+
declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | boolean | void | string[] | import("@scayle/storefront-core").ShopUser | Record<string, string> | Response | import("@scayle/storefront-api").Product | import("@scayle/storefront-api").Product[] | import("@scayle/storefront-core").FetchProductsCountResponse | import("@scayle/storefront-core").FetchFiltersResponse | import("@scayle/storefront-core").FetchProductsByCategoryResponse | {
|
|
14
|
+
basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
|
|
15
|
+
} | {
|
|
16
|
+
fromBasketKey: string;
|
|
17
|
+
toBasketKey: string;
|
|
18
|
+
with?: import("@scayle/storefront-core").BasketWithOptions;
|
|
19
|
+
orderCustomData?: Record<string, unknown>;
|
|
20
|
+
} | {
|
|
21
|
+
readonly type: "success";
|
|
22
|
+
readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
|
|
23
|
+
} | {
|
|
24
|
+
readonly type: "failure";
|
|
25
|
+
readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").Product, import("@scayle/storefront-api").Variant>;
|
|
26
|
+
readonly errors: import("@scayle/storefront-api").AddOrUpdateItemError[];
|
|
27
|
+
} | import("@scayle/storefront-api").BrandsEndpointResponseData | import("@scayle/storefront-api").Brand | {
|
|
28
|
+
path: string;
|
|
29
|
+
children?: number;
|
|
30
|
+
includeHidden?: true;
|
|
31
|
+
includeProductSorting?: boolean;
|
|
32
|
+
properties?: import("@scayle/storefront-api").ProductCategoryPropertyWith;
|
|
33
|
+
} | import("@scayle/storefront-api").Category | {
|
|
34
|
+
categories: import("@scayle/storefront-api").Category[] | import("@scayle/storefront-api").Category;
|
|
35
|
+
activeNode?: import("@scayle/storefront-api").Category;
|
|
36
|
+
} | import("@scayle/storefront-api").Category[] | import("@scayle/storefront-core").Order<Record<string, unknown>, Record<string, unknown>> | import("@scayle/storefront-api").SearchV2SuggestionsEndpointResponseData | import("@scayle/storefront-api").CategorySearchSuggestion | import("@scayle/storefront-api").ProductSearchSuggestion | import("@scayle/storefront-api").NavigationItemSuggestion | {
|
|
37
|
+
type: undefined;
|
|
38
|
+
} | import("@scayle/storefront-api").ShopConfiguration | {
|
|
39
|
+
user?: import("@scayle/storefront-core").ShopUser;
|
|
40
|
+
} | import("@scayle/storefront-api").Wishlist | import("@scayle/storefront-core").ShopUserAddress[] | {
|
|
41
|
+
accessToken: string;
|
|
42
|
+
checkoutJwt: string;
|
|
43
|
+
} | import("@scayle/storefront-api").VariantDetail[] | import("@scayle/storefront-api").NavigationAllEndpointResponseData | import("@scayle/storefront-api").NavigationTree | {
|
|
44
|
+
success: boolean;
|
|
45
|
+
} | {
|
|
46
|
+
result: boolean;
|
|
47
|
+
} | import("@scayle/storefront-api").PromotionsEndpointResponseData | {
|
|
48
|
+
message: string;
|
|
49
|
+
} | null>>;
|
|
14
50
|
export default _default;
|
package/dist/runtime/cached.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { MaybeRefOrGetter } from 'vue';
|
|
2
2
|
import type { RpcMethodParameters } from '@scayle/storefront-core';
|
|
3
|
-
import {
|
|
3
|
+
import type { UseRpcReturn } from '../core/useRpc.js';
|
|
4
4
|
/**
|
|
5
5
|
* The shape of the data returned by the `getExternalIdpRedirect` RPC call.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { useAsyncData } from 'nuxt/app';
|
|
3
|
+
import type { AsyncDataOptions } from 'nuxt/app';
|
|
4
|
+
import type { MaybeRefOrGetter } from 'vue';
|
|
4
5
|
/**
|
|
5
6
|
* Extracts keys from a type `T` as an array of strings.
|
|
6
7
|
*
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { unwrap } from "@scayle/storefront-core/dist/utils/response";
|
|
2
|
-
import {
|
|
3
|
-
useNuxtApp,
|
|
4
|
-
useAsyncData
|
|
5
|
-
} from "nuxt/app";
|
|
2
|
+
import { useNuxtApp, useAsyncData } from "nuxt/app";
|
|
6
3
|
import { useCoreLog } from "../useCoreLog.js";
|
|
7
4
|
import { useCurrentShop } from "./useCurrentShop.js";
|
|
8
5
|
import { toValue, isRef } from "vue";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ShopUser, UpdatePasswordParams } from '@scayle/storefront-core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { UseRpcReturn } from './useRpc.js';
|
|
3
|
+
import type { ComputedRef } from 'vue';
|
|
4
4
|
/**
|
|
5
5
|
* Extended parameters for the `useUser` composable.
|
|
6
6
|
*/
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { generateBasketKey } from '@scayle/storefront-core/dist/utils/keys';
|
|
2
|
-
import type { AddOrUpdateItemType, RpcMethodParameters, BasketResponseData,
|
|
2
|
+
import type { AddOrUpdateItemType, RpcMethodParameters, BasketResponseData, BasketItem, Product, BasketTotalPrice } from '@scayle/storefront-core';
|
|
3
3
|
import { ExistingItemHandling } from '@scayle/storefront-core';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import type { NormalizedRpcResponse, UseRpcReturn } from '../core/useRpc.js';
|
|
5
|
+
import type { MaybeRefOrGetter, ComputedRef, Ref } from 'vue';
|
|
6
6
|
import type { BasketKey, BasketPackageInformation } from '@scayle/storefront-api';
|
|
7
7
|
import type { BasketItemUpdateData } from '@scayle/storefront-core/dist/rpc/methods/index';
|
|
8
8
|
/**
|
|
@@ -30,7 +30,7 @@ type UseBasketBaseReturn = Omit<Awaited<UseRpcReturn<'getBasket'>>, 'data'> & {
|
|
|
30
30
|
mergeBaskets: (args: {
|
|
31
31
|
fromBasketKey: string;
|
|
32
32
|
toBasketKey: string;
|
|
33
|
-
}) =>
|
|
33
|
+
}) => Promise<NormalizedRpcResponse<'mergeBaskets'>>;
|
|
34
34
|
/** @deprecated In a future release `findItem` will be removed. Consider using `findItem` from `@scayle/storefront-basket` */
|
|
35
35
|
findItem: (item: {
|
|
36
36
|
variantId: number;
|
|
@@ -8,14 +8,9 @@ import {
|
|
|
8
8
|
wasAddedWithReducedQuantity
|
|
9
9
|
} from "@scayle/storefront-core/dist/utils/basket";
|
|
10
10
|
import { extendPromise } from "../../utils/promise.js";
|
|
11
|
-
import {
|
|
12
|
-
useRpc
|
|
13
|
-
} from "../core/useRpc.js";
|
|
11
|
+
import { useRpc } from "../core/useRpc.js";
|
|
14
12
|
import { useRpcCall } from "../core/useRpcCall.js";
|
|
15
|
-
import {
|
|
16
|
-
toValue,
|
|
17
|
-
computed
|
|
18
|
-
} from "vue";
|
|
13
|
+
import { toValue, computed } from "vue";
|
|
19
14
|
import { FetchError } from "ofetch";
|
|
20
15
|
export function useBasket({
|
|
21
16
|
params
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { MaybeRefOrGetter } from 'vue';
|
|
2
|
-
import {
|
|
2
|
+
import type { KeysOf, NormalizedRpcResponse, UseRpcOptions, UseRpcReturn } from '../core/useRpc.js';
|
|
3
3
|
import type { RpcMethodParameters } from '@scayle/storefront-core';
|
|
4
4
|
type UseCategoriesBaseReturn<DataT, PickKeys extends KeysOf<DataT>, DefaultT> = Awaited<UseRpcReturn<'getCategoryTree', DataT, PickKeys, DefaultT>> & Promise<Awaited<UseRpcReturn<'getCategoryTree', DataT, PickKeys, DefaultT>>>;
|
|
5
5
|
export declare function useCategoryTree<DataT = NormalizedRpcResponse<'getCategoryTree'>, PickKeys extends KeysOf<DataT> = KeysOf<DataT>, DefaultT = null>({ params, options, }?: Partial<{
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RpcMethodParameters, Order } from '@scayle/storefront-core';
|
|
2
2
|
import type { AsyncDataOptions } from 'nuxt/app';
|
|
3
|
-
import {
|
|
3
|
+
import type { KeysOf, ExtendedAsyncData } from '../core/useRpc.js';
|
|
4
4
|
import type { MaybeRefOrGetter } from 'vue';
|
|
5
5
|
/**
|
|
6
6
|
* Retrieves order data by ID using the `getOrderById` RPC method.
|
|
@@ -27,5 +27,7 @@ export declare function useStorefrontSearch(searchQuery: Ref<string>, { params }
|
|
|
27
27
|
error: Ref<unknown, unknown>;
|
|
28
28
|
resetSearch: () => void;
|
|
29
29
|
getSearchSuggestions: () => Promise<void>;
|
|
30
|
-
resolveSearch: () => Promise<import("@scayle/storefront-api").
|
|
30
|
+
resolveSearch: () => Promise<import("@scayle/storefront-api").CategorySearchSuggestion | import("@scayle/storefront-api").ProductSearchSuggestion | import("@scayle/storefront-api").NavigationItemSuggestion | {
|
|
31
|
+
type: undefined;
|
|
32
|
+
} | null | undefined>;
|
|
31
33
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Product, WishlistItem, RpcMethodParameters } from '@scayle/storefront-core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { UseRpcReturn } from '../core/useRpc.js';
|
|
3
|
+
import type { MaybeRefOrGetter, ComputedRef } from 'vue';
|
|
4
4
|
/**
|
|
5
5
|
* Representation of options for configuring the `useWishlist` composable.
|
|
6
6
|
*/
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { useNuxtApp } from "nuxt/app";
|
|
2
2
|
import { useRpc } from "../core/useRpc.js";
|
|
3
3
|
import { extendPromise } from "../../utils/promise.js";
|
|
4
|
-
import {
|
|
5
|
-
computed,
|
|
6
|
-
toValue,
|
|
7
|
-
toRef
|
|
8
|
-
} from "vue";
|
|
4
|
+
import { computed, toValue, toRef } from "vue";
|
|
9
5
|
import { useRpcCall } from "../core/useRpcCall.js";
|
|
10
6
|
export function useWishlist({
|
|
11
7
|
params
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Session } from '@scayle/h3-session';
|
|
2
2
|
import type { RuntimeConfig } from '@nuxt/schema';
|
|
3
|
-
import {
|
|
3
|
+
import type { H3Event } from 'h3';
|
|
4
4
|
import type { Log, RpcContext, Cache as CacheInterface } from '@scayle/storefront-core';
|
|
5
5
|
import { StorefrontAPIClient } from '@scayle/storefront-core';
|
|
6
6
|
import type { ShopConfig, StorefrontConfig } from '../module.js';
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { RuntimeConfig } from '@nuxt/schema';
|
|
2
|
-
import type {
|
|
2
|
+
import type { z } from 'zod/mini';
|
|
3
3
|
/**
|
|
4
4
|
* List of keys considered sensitive.
|
|
5
5
|
* These keys will have their values redacted in logs.
|
|
6
6
|
*/
|
|
7
7
|
export declare const sensitiveKeys: string[];
|
|
8
|
+
type ZodIssue = z.core.$ZodIssue;
|
|
8
9
|
/**
|
|
9
10
|
* Gets a value from a nested object using a path array.
|
|
10
11
|
*
|
|
@@ -13,7 +14,7 @@ export declare const sensitiveKeys: string[];
|
|
|
13
14
|
*
|
|
14
15
|
* @returns The value at the specified path, stringified.
|
|
15
16
|
*/
|
|
16
|
-
export declare const getValue: (object: Record<string | number, unknown>, pathArray:
|
|
17
|
+
export declare const getValue: (object: Record<string | number, unknown>, pathArray: PropertyKey[]) => string;
|
|
17
18
|
/**
|
|
18
19
|
* Formats Zod errors for display, redacting sensitive values.
|
|
19
20
|
*
|
|
@@ -28,7 +29,7 @@ export declare const getValue: (object: Record<string | number, unknown>, pathAr
|
|
|
28
29
|
*
|
|
29
30
|
* @returns An array of formatted error messages.
|
|
30
31
|
*/
|
|
31
|
-
export declare const formatZodError: (issues: Array<ZodIssue>, runtimeConfig: RuntimeConfig) => (ZodIssue | {
|
|
32
|
+
export declare const formatZodError: (issues: Array<ZodIssue>, runtimeConfig: RuntimeConfig) => (z.core.$ZodIssue | {
|
|
32
33
|
code: string;
|
|
33
34
|
path: string;
|
|
34
35
|
message: string;
|
|
@@ -20,8 +20,8 @@ export const formatZodError = (issues, runtimeConfig) => {
|
|
|
20
20
|
const errorMessages = [];
|
|
21
21
|
issues.forEach((issue) => {
|
|
22
22
|
if (issue.code === "invalid_union") {
|
|
23
|
-
return issue.
|
|
24
|
-
errorMessages.push(...formatZodError(unionError
|
|
23
|
+
return issue.errors.forEach((unionError) => {
|
|
24
|
+
errorMessages.push(...formatZodError(unionError, runtimeConfig));
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
const key = issue.path[issue.path.length - 1];
|
|
@@ -47,7 +47,7 @@ export default defineNitroPlugin(() => {
|
|
|
47
47
|
const runtimeConfig = useRuntimeConfig();
|
|
48
48
|
const { success, error } = RuntimeConfigSchema.safeParse(runtimeConfig);
|
|
49
49
|
if (!success) {
|
|
50
|
-
const errorMessages = formatZodError(error.
|
|
50
|
+
const errorMessages = formatZodError(error.issues, runtimeConfig);
|
|
51
51
|
consola.error("[storefront-nuxt] configValidation:", errorMessages);
|
|
52
52
|
throw Error("[storefront-nuxt] configValidation: Runtime config invalid");
|
|
53
53
|
}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getRequestHeaders,
|
|
3
|
-
getRequestHost,
|
|
4
|
-
getRequestURL
|
|
5
|
-
} from "h3";
|
|
1
|
+
import { getRequestHeaders, getRequestHost, getRequestURL } from "h3";
|
|
6
2
|
import { joinURL } from "ufo";
|
|
7
3
|
export function getBootstrapPath(url, baseUrl) {
|
|
8
4
|
const queryUrl = url.searchParams.get("url");
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { defineEventHandler, getCookie, deleteCookie, getRequestURL } from "h3";
|
|
2
2
|
import { decodeJwt } from "jose";
|
|
3
3
|
import { randomUUID } from "uncrypto";
|
|
4
|
-
import {
|
|
5
|
-
useSession,
|
|
6
|
-
unsignCookie
|
|
7
|
-
} from "@scayle/h3-session";
|
|
4
|
+
import { useSession, unsignCookie } from "@scayle/h3-session";
|
|
8
5
|
import { trace, SpanStatusCode } from "@opentelemetry/api";
|
|
9
6
|
import { joinURL } from "ufo";
|
|
10
7
|
import { buildContext } from "../../context.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Log } from '@scayle/storefront-core';
|
|
2
2
|
import { UnstorageCache } from '@scayle/storefront-core/dist/cache/providers/unstorage';
|
|
3
|
-
import {
|
|
3
|
+
import type { SessionStore } from '@scayle/h3-session';
|
|
4
4
|
import type { SessionConfig } from '../../../index.js';
|
|
5
5
|
export declare const STORAGE_MOUNT_BASE = "storefront";
|
|
6
6
|
export declare const STORAGE_MOUNT_CACHE = "storefront-cache";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { RpcMethods, RpcMethodName, RpcHandler } from '@scayle/storefront-core';
|
|
2
2
|
/**
|
|
3
3
|
* Normalizes a rpc handler function that are not defined with `defineRpcHandler`.
|
|
4
4
|
* Normalization sets the `rpcType` property to `WithParam` or `NoParam` based on the number of parameters the handler function takes.
|
|
@@ -7,4 +7,4 @@ import { type RpcMethods, type RpcMethodName, type RpcHandler } from '@scayle/st
|
|
|
7
7
|
* @param handler - The handler function to normalize.
|
|
8
8
|
* @returns The normalized handler function with an `rpcType` property.
|
|
9
9
|
*/
|
|
10
|
-
export declare const normalizeRpcHandler: <T extends RpcMethods[RpcMethodName], NormalizedHandler = T extends RpcHandler<infer R> ? RpcHandler<R> & Required<Pick<RpcHandler<R>, "rpcType">> : T extends RpcHandler<infer
|
|
10
|
+
export declare const normalizeRpcHandler: <T extends RpcMethods[RpcMethodName], NormalizedHandler = T extends RpcHandler<infer R> ? RpcHandler<R> & Required<Pick<RpcHandler<R>, "rpcType">> : T extends RpcHandler<infer _P, infer R> ? RpcHandler<unknown, R> & Required<Pick<RpcHandler<unknown, R>, "rpcType">> : never>(handler: T) => NormalizedHandler;
|