@scayle/storefront-nuxt 7.71.2 → 7.72.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 +18 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/module.d.mts +2 -2
- package/dist/module.d.ts +2 -2
- package/dist/module.json +1 -1
- package/dist/module.mjs +40 -6
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.d.ts +1 -1
- package/dist/runtime/composables/storefront/useOrder.d.ts +1 -1
- package/dist/runtime/composables/storefront/useOrderConfirmation.d.ts +1 -1
- package/dist/runtime/nitro/plugins/configValidation.d.ts +2 -0
- package/dist/runtime/nitro/plugins/configValidation.mjs +17 -0
- package/dist/runtime/utils/zodSchema.d.ts +1170 -0
- package/dist/runtime/utils/zodSchema.mjs +113 -0
- package/dist/shared/{storefront-nuxt.b9f5584c.d.mts → storefront-nuxt.20d8641a.d.mts} +2 -1
- package/dist/shared/{storefront-nuxt.b9f5584c.d.ts → storefront-nuxt.20d8641a.d.ts} +2 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.72.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
- @scayle/storefront-core@7.52.0
|
|
9
|
+
|
|
10
|
+
## 7.72.0
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- Introduced a new feature that validates runtime configurations using Zod schemas upon server startup.
|
|
15
|
+
The server will exit if validation fails.
|
|
16
|
+
- We now log a warning when an RPC method from `@scayle/storefront-nuxt` is overridden by an RPC custom implementation.
|
|
17
|
+
|
|
18
|
+
If the override is intentional, we provide a new config option called `rpcMethodOverrides` to silence this warning.
|
|
19
|
+
In the future, the warning will become an error message if the RPC is not explicitly marked as an override.
|
|
20
|
+
|
|
3
21
|
## 7.71.2
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as AdditionalShopConfig, A as AppKeys, B as BapiConfig, b as CacheConfig, j as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, k as ModulePublicRuntimeConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, g as ShopConfig, h as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, i as StorefrontConfig } from './shared/storefront-nuxt.
|
|
1
|
+
export { f as AdditionalShopConfig, A as AppKeys, B as BapiConfig, b as CacheConfig, j as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, k as ModulePublicRuntimeConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, g as ShopConfig, h as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, i as StorefrontConfig } from './shared/storefront-nuxt.20d8641a.mjs';
|
|
2
2
|
export { rpcCall } from './rpc.mjs';
|
|
3
3
|
export * from '@scayle/storefront-core';
|
|
4
4
|
export { LogLevel } from '@scayle/storefront-core';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as AdditionalShopConfig, A as AppKeys, B as BapiConfig, b as CacheConfig, j as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, k as ModulePublicRuntimeConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, g as ShopConfig, h as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, i as StorefrontConfig } from './shared/storefront-nuxt.
|
|
1
|
+
export { f as AdditionalShopConfig, A as AppKeys, B as BapiConfig, b as CacheConfig, j as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, k as ModulePublicRuntimeConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, g as ShopConfig, h as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, i as StorefrontConfig } from './shared/storefront-nuxt.20d8641a.js';
|
|
2
2
|
export { rpcCall } from './rpc.js';
|
|
3
3
|
export * from '@scayle/storefront-core';
|
|
4
4
|
export { LogLevel } from '@scayle/storefront-core';
|
package/dist/module.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { M as ModuleOptions } from './shared/storefront-nuxt.
|
|
3
|
-
export { f as AdditionalShopConfig, A as AppKeys, B as BapiConfig, b as CacheConfig, j as CheckoutEvent, C as CheckoutShopConfig, k as ModulePublicRuntimeConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, g as ShopConfig, h as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, i as StorefrontConfig } from './shared/storefront-nuxt.
|
|
2
|
+
import { M as ModuleOptions } from './shared/storefront-nuxt.20d8641a.mjs';
|
|
3
|
+
export { f as AdditionalShopConfig, A as AppKeys, B as BapiConfig, b as CacheConfig, j as CheckoutEvent, C as CheckoutShopConfig, k as ModulePublicRuntimeConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, g as ShopConfig, h as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, i as StorefrontConfig } from './shared/storefront-nuxt.20d8641a.mjs';
|
|
4
4
|
export { LogLevel } from '@scayle/storefront-core';
|
|
5
5
|
import '@scayle/unstorage-compression-driver';
|
|
6
6
|
import 'unstorage';
|
package/dist/module.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { M as ModuleOptions } from './shared/storefront-nuxt.
|
|
3
|
-
export { f as AdditionalShopConfig, A as AppKeys, B as BapiConfig, b as CacheConfig, j as CheckoutEvent, C as CheckoutShopConfig, k as ModulePublicRuntimeConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, g as ShopConfig, h as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, i as StorefrontConfig } from './shared/storefront-nuxt.
|
|
2
|
+
import { M as ModuleOptions } from './shared/storefront-nuxt.20d8641a.js';
|
|
3
|
+
export { f as AdditionalShopConfig, A as AppKeys, B as BapiConfig, b as CacheConfig, j as CheckoutEvent, C as CheckoutShopConfig, k as ModulePublicRuntimeConfig, O as OauthConfig, P as PublicShopConfig, e as RedirectsConfig, R as RedisConfig, a as SessionConfig, g as ShopConfig, h as ShopConfigIndexed, d as StorageConfig, c as StorageEntity, S as StorageProvider, i as StorefrontConfig } from './shared/storefront-nuxt.20d8641a.js';
|
|
4
4
|
export { LogLevel } from '@scayle/storefront-core';
|
|
5
5
|
import '@scayle/unstorage-compression-driver';
|
|
6
6
|
import 'unstorage';
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { rpcMethods } from '@scayle/storefront-core';
|
|
|
4
4
|
import { defu } from 'defu';
|
|
5
5
|
import { genImport, genSafeVariableName } from 'knitwork';
|
|
6
6
|
import { builtinDrivers } from 'unstorage';
|
|
7
|
+
import { createConsola } from 'consola';
|
|
7
8
|
import 'h3';
|
|
8
9
|
|
|
9
10
|
const convertShopsToList = (stores) => {
|
|
@@ -60,7 +61,17 @@ export default {
|
|
|
60
61
|
}`;
|
|
61
62
|
}
|
|
62
63
|
const PACKAGE_NAME = "@scayle/storefront-nuxt";
|
|
63
|
-
const PACKAGE_VERSION = "7.
|
|
64
|
+
const PACKAGE_VERSION = "7.72.0";
|
|
65
|
+
const logger = createConsola({
|
|
66
|
+
fancy: true,
|
|
67
|
+
formatOptions: {
|
|
68
|
+
colors: true
|
|
69
|
+
},
|
|
70
|
+
level: 1,
|
|
71
|
+
defaults: {
|
|
72
|
+
tag: PACKAGE_NAME
|
|
73
|
+
}
|
|
74
|
+
});
|
|
64
75
|
const module = defineNuxtModule({
|
|
65
76
|
meta: {
|
|
66
77
|
name: PACKAGE_NAME,
|
|
@@ -133,10 +144,30 @@ const module = defineNuxtModule({
|
|
|
133
144
|
handler: resolve("./runtime/server/middleware/bootstrap")
|
|
134
145
|
});
|
|
135
146
|
const apiBasePath = nuxt.options.runtimeConfig.storefront.apiBasePath || "/api";
|
|
136
|
-
const rpcMethodNames =
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
147
|
+
const rpcMethodNames = new Set(Object.keys(rpcMethods));
|
|
148
|
+
const overridenRPCMethodNames = new Set(options.rpcMethodOverrides);
|
|
149
|
+
for (const rpcMethodName of options.rpcMethodNames ?? []) {
|
|
150
|
+
if (rpcMethodNames.has(rpcMethodName) && !overridenRPCMethodNames.has(rpcMethodName)) {
|
|
151
|
+
logger.warn(`
|
|
152
|
+
Overriding RPC method '${rpcMethodName}' from '@scayle/storefront-nuxt' with a local custom implementation.
|
|
153
|
+
|
|
154
|
+
Should this be done on purpose, please be aware that this can lead to unexpected issues since the '@scayle/storefront-nuxt' package also uses this RPC method internally.
|
|
155
|
+
To silence this warning, you can add '${rpcMethodName}' to 'rpcMethodOverrides' in the '@scayle/storefront-nuxt' config.
|
|
156
|
+
|
|
157
|
+
In the future this will become an error where overrides need to be explicitly defined as an override.
|
|
158
|
+
`);
|
|
159
|
+
} else {
|
|
160
|
+
overridenRPCMethodNames.delete(rpcMethodName);
|
|
161
|
+
}
|
|
162
|
+
rpcMethodNames.add(rpcMethodName);
|
|
163
|
+
}
|
|
164
|
+
if (overridenRPCMethodNames.size > 0) {
|
|
165
|
+
logger.warn(`
|
|
166
|
+
Specified RPC which were supposed to be overriden but are not. This indicates and outdated config and should be adjusted.
|
|
167
|
+
|
|
168
|
+
Missing RPC Overrides: ${Array.from(overridenRPCMethodNames).map((name) => `'${name}'`).join(", ")}
|
|
169
|
+
`);
|
|
170
|
+
}
|
|
140
171
|
function addRPCServerHandlers(base) {
|
|
141
172
|
rpcMethodNames.forEach((methodName) => {
|
|
142
173
|
addServerHandler({
|
|
@@ -201,6 +232,7 @@ const module = defineNuxtModule({
|
|
|
201
232
|
resolve("./runtime/nitro/plugins/nitroRuntimeStorageConfig")
|
|
202
233
|
);
|
|
203
234
|
addServerPlugin(resolve("./runtime/nitro/plugins/nitroSetXPoweredByHeader"));
|
|
235
|
+
addServerPlugin(resolve("./runtime/nitro/plugins/configValidation"));
|
|
204
236
|
nuxt.hooks.hook("nitro:config", (nitroConfig) => {
|
|
205
237
|
nitroConfig.externals = nitroConfig.externals || {};
|
|
206
238
|
nitroConfig.externals.inline = nitroConfig.externals.inline || [];
|
|
@@ -218,9 +250,11 @@ const module = defineNuxtModule({
|
|
|
218
250
|
"server/middleware/redirects",
|
|
219
251
|
"server/middleware/cache",
|
|
220
252
|
"server/utils/cacheStorage",
|
|
253
|
+
"utils/zodSchema",
|
|
221
254
|
"nitro/plugins/nitroLogger",
|
|
222
255
|
"nitro/plugins/nitroRuntimeStorageConfig",
|
|
223
|
-
"nitro/plugins/nitroSetXPoweredByHeader"
|
|
256
|
+
"nitro/plugins/nitroSetXPoweredByHeader",
|
|
257
|
+
"nitro/plugins/configValidation"
|
|
224
258
|
];
|
|
225
259
|
runtimePaths.forEach((path) => {
|
|
226
260
|
const file = resolve(`./runtime/${path}`);
|
package/dist/rpc.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
|
|
2
2
|
import { NuxtApp } from 'nuxt/app';
|
|
3
|
-
import { P as PublicShopConfig } from './shared/storefront-nuxt.
|
|
3
|
+
import { P as PublicShopConfig } from './shared/storefront-nuxt.20d8641a.mjs';
|
|
4
4
|
import '@nuxt/schema';
|
|
5
5
|
import '@scayle/unstorage-compression-driver';
|
|
6
6
|
import 'unstorage';
|
package/dist/rpc.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RpcMethodName, RpcMethodParameters, RpcMethodReturnType, RpcContext } from '@scayle/storefront-core';
|
|
2
2
|
import { NuxtApp } from 'nuxt/app';
|
|
3
|
-
import { P as PublicShopConfig } from './shared/storefront-nuxt.
|
|
3
|
+
import { P as PublicShopConfig } from './shared/storefront-nuxt.20d8641a.js';
|
|
4
4
|
import '@nuxt/schema';
|
|
5
5
|
import '@scayle/unstorage-compression-driver';
|
|
6
6
|
import 'unstorage';
|
|
@@ -42,7 +42,7 @@ export declare function useOrder<P = {
|
|
|
42
42
|
absoluteWithTax: number;
|
|
43
43
|
relative: number;
|
|
44
44
|
};
|
|
45
|
-
category: "
|
|
45
|
+
category: "voucher" | "sale" | "campaign";
|
|
46
46
|
code?: string | undefined;
|
|
47
47
|
type: "relative" | "absolute";
|
|
48
48
|
}[] | undefined;
|
|
@@ -42,7 +42,7 @@ export declare function useOrderConfirmation<P = {
|
|
|
42
42
|
absoluteWithTax: number;
|
|
43
43
|
relative: number;
|
|
44
44
|
};
|
|
45
|
-
category: "
|
|
45
|
+
category: "voucher" | "sale" | "campaign";
|
|
46
46
|
code?: string | undefined;
|
|
47
47
|
type: "relative" | "absolute";
|
|
48
48
|
}[] | undefined;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineNitroPlugin, useRuntimeConfig } from "#imports";
|
|
2
|
+
import { runtimeConfigSchema } from "../../utils/zodSchema.mjs";
|
|
3
|
+
export default defineNitroPlugin(() => {
|
|
4
|
+
const runtimeConfig = useRuntimeConfig();
|
|
5
|
+
const { success, error } = runtimeConfigSchema.safeParse(runtimeConfig);
|
|
6
|
+
if (!success) {
|
|
7
|
+
error.errors.forEach((e) => {
|
|
8
|
+
console.error("[storefront-nuxt] configValidation:", {
|
|
9
|
+
code: e.code,
|
|
10
|
+
path: e.path.join("."),
|
|
11
|
+
message: e.message
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
throw Error("[storefront-nuxt] configValidation: Runtime config invalid");
|
|
15
|
+
}
|
|
16
|
+
console.log("[storefront-nuxt] configValidation: Runtime config valid");
|
|
17
|
+
});
|