@scayle/storefront-nuxt 8.44.1 → 8.45.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 +85 -0
- package/dist/module.d.mts +11 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +63 -39
- package/dist/runtime/context.d.ts +3 -2
- package/dist/runtime/context.js +2 -1
- package/dist/runtime/server/middleware/bootstrap-utils.d.ts +5 -4
- package/dist/runtime/server/middleware/bootstrap.js +3 -2
- package/dist/runtime/types/module.d.ts +5 -87
- package/dist/runtime/utils/zodSchema.d.ts +440 -29
- package/dist/runtime/utils/zodSchema.js +69 -18
- package/dist/test/factories.d.mts +20 -3
- package/dist/test/factories.mjs +10 -2
- package/package.json +17 -16
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as z from "zod/mini";
|
|
2
|
+
import {
|
|
3
|
+
rpcMethods
|
|
4
|
+
} from "@scayle/storefront-core";
|
|
2
5
|
import { builtinDrivers } from "unstorage";
|
|
3
6
|
export const RedirectsSchema = z.object({
|
|
4
7
|
enabled: z.boolean(),
|
|
@@ -7,11 +10,11 @@ export const RedirectsSchema = z.object({
|
|
|
7
10
|
});
|
|
8
11
|
const SessionSchema = z.object({
|
|
9
12
|
/**
|
|
10
|
-
* The sameSite policy to use for the session cookie
|
|
13
|
+
* The `sameSite` policy to use for the session cookie
|
|
11
14
|
*/
|
|
12
15
|
sameSite: z.optional(z.enum(["lax", "strict", "none"])),
|
|
13
16
|
/**
|
|
14
|
-
* The default maxAge (in seconds) set on the session cookie and default TTL for session store
|
|
17
|
+
* The default `maxAge` (in seconds) set on the session cookie and default TTL for session store
|
|
15
18
|
*/
|
|
16
19
|
maxAge: z.optional(z.number()),
|
|
17
20
|
/**
|
|
@@ -104,7 +107,9 @@ const ShopConfigSchema = z.object({
|
|
|
104
107
|
isEnabled: z.optional(z.boolean()),
|
|
105
108
|
sessionConfig: z.optional(SessionSchema),
|
|
106
109
|
sapi: z.optional(SapiSchema),
|
|
107
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* @deprecated The `storage` option within `shopConfig` is deprecated. Consider using nuxt storage configuration instead.
|
|
112
|
+
*/
|
|
108
113
|
storage: z.optional(z.object({
|
|
109
114
|
session: z.optional(StorageSchema),
|
|
110
115
|
cache: z.optional(StorageSchema)
|
|
@@ -119,39 +124,63 @@ const CacheSchema = z.object({
|
|
|
119
124
|
enabled: z.optional(z.boolean())
|
|
120
125
|
});
|
|
121
126
|
const ShopSelectorSchema = z.enum(["path", "domain", "path_or_default"]);
|
|
122
|
-
const
|
|
127
|
+
const StorefrontRuntimeConfigSchema = z.object({
|
|
128
|
+
/**
|
|
129
|
+
* Determines how the application identifies and switches between different shops.
|
|
130
|
+
* It influences how the `domain` and `path` properties are used within the `shops` configuration.
|
|
131
|
+
*
|
|
132
|
+
* @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#path-and-domain
|
|
133
|
+
*/
|
|
134
|
+
shopSelector: ShopSelectorSchema,
|
|
135
|
+
/**
|
|
136
|
+
* Controls how the application handles URL redirects by leveraging the Storefront API,
|
|
137
|
+
* which is synchronized with the SCAYLE Panel. When enabled,
|
|
138
|
+
* the Storefront Core intercepts requests and checks for potential
|
|
139
|
+
* redirects via the Storefront API. If a match is found, a 30x HTTP response
|
|
140
|
+
* is returned with the target in the `Location` header and the appropriate
|
|
141
|
+
* status code.
|
|
142
|
+
*
|
|
143
|
+
* @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/redirects
|
|
144
|
+
*/
|
|
145
|
+
redirects: z.optional(RedirectsSchema),
|
|
146
|
+
/**
|
|
147
|
+
* Configures the available shops in the Storefront Application. Each shop represents a specific region or language,
|
|
148
|
+
* with each shop identified by its unique shop ID from the SCAYLE tenant.
|
|
149
|
+
*
|
|
150
|
+
* @see https://scayle.dev/en/storefront-guide/developer-guide/basic-setup/introduction#shops
|
|
151
|
+
*/
|
|
152
|
+
shops: z.record(z.string(), ShopConfigSchema),
|
|
123
153
|
session: z.optional(SessionSchema),
|
|
124
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* @deprecated The `storage` option within `storefront` is deprecated. Consider using nuxt storage configuration instead.
|
|
156
|
+
*/
|
|
125
157
|
storage: z.optional(z.object({
|
|
126
158
|
session: z.optional(StorageSchema),
|
|
127
159
|
cache: z.optional(StorageSchema)
|
|
128
160
|
})),
|
|
129
161
|
oauth: OAuthSchema,
|
|
130
162
|
appKeys: AppKeysSchema,
|
|
131
|
-
apiBasePath: z.optional(z.string()),
|
|
132
163
|
cache: z.optional(CacheSchema),
|
|
133
164
|
publicShopData: z.optional(z.array(z.string())),
|
|
134
165
|
idp: z.optional(IdpSchema),
|
|
135
166
|
sapi: SapiSchema,
|
|
136
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* Collection of feature flags regarding legacy features and functionalities.
|
|
169
|
+
*/
|
|
137
170
|
legacy: z.optional(LegacySchema),
|
|
138
|
-
/**
|
|
171
|
+
/**
|
|
172
|
+
* @hidden
|
|
173
|
+
* Undocumented property intended for internal usage only
|
|
174
|
+
*/
|
|
139
175
|
internalAccessHeader: z.optional(z.string())
|
|
140
176
|
});
|
|
141
|
-
const ModuleOptionSchema = z.object(
|
|
142
|
-
{
|
|
143
|
-
shopSelector: ShopSelectorSchema,
|
|
144
|
-
redirects: z.optional(RedirectsSchema),
|
|
145
|
-
shops: z.record(z.string(), ShopConfigSchema)
|
|
146
|
-
}
|
|
147
|
-
);
|
|
148
177
|
const logLevel = z.enum([
|
|
149
178
|
"debug",
|
|
150
179
|
"info",
|
|
151
180
|
"warn",
|
|
152
181
|
"error"
|
|
153
182
|
]);
|
|
154
|
-
const
|
|
183
|
+
const StorefrontPublicRuntimeConfigSchema = z.object({
|
|
155
184
|
log: z.object({
|
|
156
185
|
name: z.string(),
|
|
157
186
|
level: logLevel,
|
|
@@ -164,8 +193,30 @@ const PublicRuntimeConfigSchema = z.object({
|
|
|
164
193
|
}))
|
|
165
194
|
});
|
|
166
195
|
export const RuntimeConfigSchema = z.object({
|
|
167
|
-
storefront:
|
|
196
|
+
storefront: StorefrontRuntimeConfigSchema,
|
|
168
197
|
public: z.object({
|
|
169
|
-
storefront:
|
|
198
|
+
storefront: StorefrontPublicRuntimeConfigSchema
|
|
170
199
|
})
|
|
171
200
|
});
|
|
201
|
+
const AvailableRpcMethods = z.enum(
|
|
202
|
+
Object.keys(rpcMethods)
|
|
203
|
+
);
|
|
204
|
+
const ModuleOptionSchema = z.object({
|
|
205
|
+
/**
|
|
206
|
+
* The RPC directory where the custom application RPCs are defined.
|
|
207
|
+
* The directory should have an `index.ts` file where all RPCs are exported using their name.
|
|
208
|
+
* By default this will be `./rpcMethods`.
|
|
209
|
+
*/
|
|
210
|
+
rpcDir: z.optional(z.string()),
|
|
211
|
+
/**
|
|
212
|
+
* The RPC method names which are exported from the `rpcDir`.
|
|
213
|
+
* Usually this can just be `Object.keys(rpcMethodsDir)`.
|
|
214
|
+
*/
|
|
215
|
+
rpcMethodNames: z.optional(z.array(z.string())),
|
|
216
|
+
/** Specify explicitly overridden RPC methods that are provided by the Storefront Core package. */
|
|
217
|
+
rpcMethodOverrides: z.optional(z.array(AvailableRpcMethods)),
|
|
218
|
+
/**
|
|
219
|
+
* The base path for API routes.
|
|
220
|
+
*/
|
|
221
|
+
apiBasePath: z.optional(z.string())
|
|
222
|
+
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as fishery from 'fishery';
|
|
2
2
|
import { Factory } from 'fishery';
|
|
3
|
-
import {
|
|
3
|
+
import { StorefrontRuntimeConfigType } from '../../dist/runtime/utils/zodSchema.js';
|
|
4
|
+
import { ShopConfig } from '../../dist/runtime/types/module.js';
|
|
4
5
|
import * as hookable from 'hookable';
|
|
5
6
|
import * as _scayle_storefront_core from '@scayle/storefront-core';
|
|
6
7
|
import { RpcContext, StorefrontAPIClient, Log, RuntimeConfiguration, ContextWithoutSession, ContextWithSession } from '@scayle/storefront-core';
|
|
@@ -10,7 +11,23 @@ export * from '@scayle/storefront-core/test/factories';
|
|
|
10
11
|
interface ModuleOptionsFactoryParams {
|
|
11
12
|
shops: ShopConfig[];
|
|
12
13
|
}
|
|
13
|
-
declare const
|
|
14
|
+
declare const moduleRuntimeOptionsFactory: Factory<StorefrontRuntimeConfigType, ModuleOptionsFactoryParams, StorefrontRuntimeConfigType, fishery.DeepPartialObject<StorefrontRuntimeConfigType>>;
|
|
15
|
+
declare const moduleOptionsFactory: Factory<{
|
|
16
|
+
rpcDir?: string | undefined;
|
|
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" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
19
|
+
apiBasePath?: string | undefined;
|
|
20
|
+
}, any, {
|
|
21
|
+
rpcDir?: string | undefined;
|
|
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" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
24
|
+
apiBasePath?: string | undefined;
|
|
25
|
+
}, fishery.DeepPartialObject<{
|
|
26
|
+
rpcDir?: string | undefined;
|
|
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" | "getShopUserAddresses" | "updateShopUser" | "updatePassword" | "getCheckoutToken" | "getVariantById" | "fetchAllNavigationTrees" | "fetchNavigationTreeById" | "fetchNavigationTreeByName" | "getPromotions" | "getCurrentPromotions" | "getPromotionsByIds" | "getExternalIdpRedirect" | "handleIDPLoginCallback")[] | undefined;
|
|
29
|
+
apiBasePath?: string | undefined;
|
|
30
|
+
}>>;
|
|
14
31
|
|
|
15
32
|
declare const shopConfigFactory: Factory<ShopConfig, any, ShopConfig, fishery.DeepPartialObject<ShopConfig>>;
|
|
16
33
|
|
|
@@ -99,4 +116,4 @@ declare const rpcContextFactory: Factory<RpcContext, RpcContextFactoryParams, Rp
|
|
|
99
116
|
|
|
100
117
|
declare const routeFactory: Factory<RouteLocationNormalizedLoadedGeneric, any, RouteLocationNormalizedLoadedGeneric, fishery.DeepPartialObject<RouteLocationNormalizedLoadedGeneric>>;
|
|
101
118
|
|
|
102
|
-
export { moduleOptionsFactory, routeFactory, rpcContextFactory, shopConfigFactory };
|
|
119
|
+
export { moduleOptionsFactory, moduleRuntimeOptionsFactory, routeFactory, rpcContextFactory, shopConfigFactory };
|
package/dist/test/factories.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { Factory } from 'fishery';
|
|
|
2
2
|
import { HashAlgorithm, Log, StorefrontAPIClient } from '@scayle/storefront-core';
|
|
3
3
|
export * from '@scayle/storefront-core/test/factories';
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const moduleRuntimeOptionsFactory = Factory.define(({ transientParams }) => {
|
|
6
6
|
return {
|
|
7
7
|
sapi: {
|
|
8
8
|
host: "sapiHost",
|
|
@@ -27,6 +27,14 @@ const moduleOptionsFactory = Factory.define(({ transientParams }) => {
|
|
|
27
27
|
}, {})
|
|
28
28
|
};
|
|
29
29
|
});
|
|
30
|
+
const moduleOptionsFactory = Factory.define(() => {
|
|
31
|
+
return {
|
|
32
|
+
rpcDir: void 0,
|
|
33
|
+
rpcMethodNames: void 0,
|
|
34
|
+
rpcMethodOverrides: void 0,
|
|
35
|
+
apiBasePath: "/api"
|
|
36
|
+
};
|
|
37
|
+
});
|
|
30
38
|
|
|
31
39
|
const shopConfigFactory = Factory.define(() => {
|
|
32
40
|
return {
|
|
@@ -112,4 +120,4 @@ const routeFactory = Factory.define(
|
|
|
112
120
|
})
|
|
113
121
|
);
|
|
114
122
|
|
|
115
|
-
export { moduleOptionsFactory, routeFactory, rpcContextFactory, shopConfigFactory };
|
|
123
|
+
export { moduleOptionsFactory, moduleRuntimeOptionsFactory, routeFactory, rpcContextFactory, shopConfigFactory };
|
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.45.0",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@opentelemetry/api": "^1.9.0",
|
|
76
76
|
"@scayle/h3-session": "0.6.1",
|
|
77
|
-
"@vercel/nft": "0.30.
|
|
77
|
+
"@vercel/nft": "0.30.2",
|
|
78
78
|
"@vueuse/core": "13.9.0",
|
|
79
79
|
"consola": "^3.2.3",
|
|
80
80
|
"core-js": "^3.37.1",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"utility-types": "^3.11.0",
|
|
91
91
|
"vue-router": "^4.4.0",
|
|
92
92
|
"zod": "^4.0.0",
|
|
93
|
-
"@scayle/storefront-core": "8.
|
|
93
|
+
"@scayle/storefront-core": "8.45.0",
|
|
94
94
|
"@scayle/unstorage-compression-driver": "1.2.1"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
@@ -98,33 +98,34 @@
|
|
|
98
98
|
"@eslint/eslintrc": "3.3.1",
|
|
99
99
|
"@nuxt/eslint": "1.9.0",
|
|
100
100
|
"@nuxt/eslint-config": "1.9.0",
|
|
101
|
-
"@nuxt/kit": "3.19.
|
|
101
|
+
"@nuxt/kit": "3.19.3",
|
|
102
102
|
"@nuxt/module-builder": "1.0.2",
|
|
103
|
-
"@nuxt/schema": "3.19.
|
|
103
|
+
"@nuxt/schema": "3.19.3",
|
|
104
104
|
"@nuxt/test-utils": "3.19.2",
|
|
105
|
-
"@types/node": "22.18.
|
|
105
|
+
"@types/node": "22.18.10",
|
|
106
106
|
"@vitest/coverage-v8": "3.2.4",
|
|
107
107
|
"dprint": "0.50.2",
|
|
108
108
|
"eslint-formatter-gitlab": "6.0.1",
|
|
109
|
-
"eslint": "9.
|
|
109
|
+
"eslint": "9.37.0",
|
|
110
110
|
"fishery": "2.3.1",
|
|
111
111
|
"h3": "1.15.4",
|
|
112
|
-
"nitro-test-utils": "0.9.
|
|
113
|
-
"nitropack": "2.12.
|
|
112
|
+
"nitro-test-utils": "0.9.4",
|
|
113
|
+
"nitropack": "2.12.7",
|
|
114
114
|
"node-mocks-http": "1.17.2",
|
|
115
|
-
"nuxt": "3.19.
|
|
116
|
-
"publint": "0.3.
|
|
117
|
-
"typescript": "5.9.
|
|
115
|
+
"nuxt": "3.19.3",
|
|
116
|
+
"publint": "0.3.14",
|
|
117
|
+
"typescript": "5.9.3",
|
|
118
118
|
"unbuild": "3.6.1",
|
|
119
119
|
"vitest": "3.2.4",
|
|
120
|
-
"vue-tsc": "3.
|
|
121
|
-
"
|
|
120
|
+
"vue-tsc": "3.1.1",
|
|
121
|
+
"happy-dom": "20.0.2",
|
|
122
|
+
"@scayle/eslint-config-storefront": "4.7.10",
|
|
122
123
|
"@scayle/eslint-plugin-vue-composable": "0.2.1",
|
|
123
124
|
"@scayle/vitest-config-storefront": "1.0.0",
|
|
124
|
-
"@scayle/unstorage-scayle-kv-driver": "2.0.
|
|
125
|
+
"@scayle/unstorage-scayle-kv-driver": "2.0.5"
|
|
125
126
|
},
|
|
126
127
|
"volta": {
|
|
127
|
-
"node": "22.
|
|
128
|
+
"node": "22.20.0"
|
|
128
129
|
},
|
|
129
130
|
"scripts": {
|
|
130
131
|
"build": "nuxt-module-build build",
|