@scayle/storefront-nuxt 7.80.0 → 7.82.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 +41 -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 +16 -3
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.d.ts +1 -1
- package/dist/runtime/composables/core/useRpcCall.d.ts +2 -0
- package/dist/runtime/composables/core/useRpcCall.mjs +8 -0
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.mjs +1 -0
- package/dist/runtime/nitro/plugins/cacheRuntimeConfig.d.ts +2 -0
- package/dist/runtime/nitro/plugins/cacheRuntimeConfig.mjs +8 -0
- package/dist/runtime/utils/zodSchema.d.ts +8 -8
- package/dist/runtime/utils/zodSchema.mjs +1 -3
- package/dist/shared/{storefront-nuxt.282cc1d9.d.mts → storefront-nuxt.ed010583.d.mts} +215 -215
- package/dist/shared/{storefront-nuxt.282cc1d9.d.ts → storefront-nuxt.ed010583.d.ts} +215 -215
- package/package.json +28 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,46 @@
|
|
|
1
1
|
# @scayle/storefront-nuxt
|
|
2
2
|
|
|
3
|
+
## 7.82.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Add new `useRpcCall` composable to make imperative RPC calls more ergonomic
|
|
8
|
+
|
|
9
|
+
```vue
|
|
10
|
+
<script lang="ts" setup>
|
|
11
|
+
const getConfig = useRpcCall('getShopConfiguration)
|
|
12
|
+
const getProduct = useRpcCall('getProductById')
|
|
13
|
+
const config = await getConfig()
|
|
14
|
+
const product = await getProduct({ id: 1 })
|
|
15
|
+
</script>
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
- @scayle/storefront-core@7.59.1
|
|
22
|
+
|
|
23
|
+
## 7.81.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- Support enabling or disabling optional server-side plugins
|
|
28
|
+
|
|
29
|
+
Plugins with optional behavior can now be disabled at build time through `env` variables.
|
|
30
|
+
|
|
31
|
+
- `SFC_PLUGIN_CONFIG_VALIDATION_ENABLED` This plugin executes during app startup and validates the runtime config, exiting with an error if a problem is found. It is enabled by default and can be disabled by setting this variable to `false`.
|
|
32
|
+
- `SFC_PLUGIN_POWERED_BY_ENABLED` This plugin sets the `X-Powered-By-Header` on every HTTP response to incude SCAYLE. It is enabled by default and can be disabled by setting this variable to `false`.
|
|
33
|
+
- `SFC_PLUGIN_RUNTIME_PERFORMANCE_ENABLED` This plugin improves performance by computing the runtime configuration at startup rather than for every request. It is enabled by default and can be disabled by setting this variable to `false`.
|
|
34
|
+
|
|
35
|
+
- Add a plugin to cache the runtime config
|
|
36
|
+
|
|
37
|
+
This change adds a Nitro plugin to calculate the runtime config at startup, rather than for every requests. It offers significant performance improvements for large runtime configs.
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- Add import for runtimeConfig plugin
|
|
42
|
+
- Revert type of `publicShopData` to `string[]`
|
|
43
|
+
|
|
3
44
|
## 7.80.0
|
|
4
45
|
|
|
5
46
|
### Minor Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.
|
|
1
|
+
export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.ed010583.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 { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.
|
|
1
|
+
export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, M as ModuleBaseOptions, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.ed010583.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 ModuleBaseOptions } from './shared/storefront-nuxt.
|
|
3
|
-
export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.
|
|
2
|
+
import { M as ModuleBaseOptions } from './shared/storefront-nuxt.ed010583.mjs';
|
|
3
|
+
export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.ed010583.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 ModuleBaseOptions } from './shared/storefront-nuxt.
|
|
3
|
-
export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.
|
|
2
|
+
import { M as ModuleBaseOptions } from './shared/storefront-nuxt.ed010583.js';
|
|
3
|
+
export { d as AdditionalShopConfig, A as AppKeys, B as BapiConfig, h as CheckoutEvent, C as CheckoutShopConfig, i as ModulePublicRuntimeConfig, P as PublicShopConfig, R as RedisConfig, a as SessionConfig, e as ShopConfig, f as ShopConfigIndexed, c as StorageConfig, b as StorageEntity, S as StorageProvider, g as StorefrontConfig } from './shared/storefront-nuxt.ed010583.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
|
@@ -65,7 +65,7 @@ export default {
|
|
|
65
65
|
}`;
|
|
66
66
|
}
|
|
67
67
|
const PACKAGE_NAME = "@scayle/storefront-nuxt";
|
|
68
|
-
const PACKAGE_VERSION = "7.
|
|
68
|
+
const PACKAGE_VERSION = "7.81.0";
|
|
69
69
|
const logger = createConsola({
|
|
70
70
|
fancy: true,
|
|
71
71
|
formatOptions: {
|
|
@@ -241,8 +241,20 @@ Missing RPC Overrides: ${Array.from(overridenRPCMethodNames).map((name) => `'${n
|
|
|
241
241
|
addServerPlugin(
|
|
242
242
|
resolve("./runtime/nitro/plugins/nitroRuntimeStorageConfig")
|
|
243
243
|
);
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
if (yn(process.env.SFC_PLUGIN_CONFIG_VALIDATION_ENABLED, { default: true })) {
|
|
245
|
+
logger.debug("Installing config validation plugin");
|
|
246
|
+
addServerPlugin(resolve("./runtime/nitro/plugins/configValidation"));
|
|
247
|
+
}
|
|
248
|
+
if (yn(process.env.SFC_PLUGIN_POWERED_BY_ENABLED, { default: true })) {
|
|
249
|
+
logger.debug("Installing X-Powered-By plugin");
|
|
250
|
+
addServerPlugin(
|
|
251
|
+
resolve("./runtime/nitro/plugins/nitroSetXPoweredByHeader")
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
if (yn(process.env.SFC_PLUGIN_RUNTIME_PERFORMANCE_ENABLED, { default: true })) {
|
|
255
|
+
logger.debug("Installing runtime performance plugin");
|
|
256
|
+
addServerPlugin(resolve("./runtime/nitro/plugins/cacheRuntimeConfig"));
|
|
257
|
+
}
|
|
246
258
|
nuxt.hooks.hook("nitro:config", (nitroConfig) => {
|
|
247
259
|
nitroConfig.externals = nitroConfig.externals || {};
|
|
248
260
|
nitroConfig.externals.inline = nitroConfig.externals.inline || [];
|
|
@@ -261,6 +273,7 @@ Missing RPC Overrides: ${Array.from(overridenRPCMethodNames).map((name) => `'${n
|
|
|
261
273
|
"server/middleware/cache",
|
|
262
274
|
"server/utils/cacheStorage",
|
|
263
275
|
"utils/zodSchema",
|
|
276
|
+
"nitro/plugins/cacheRuntimeConfig",
|
|
264
277
|
"nitro/plugins/nitroLogger",
|
|
265
278
|
"nitro/plugins/nitroRuntimeStorageConfig",
|
|
266
279
|
"nitro/plugins/nitroSetXPoweredByHeader",
|
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.ed010583.mjs';
|
|
4
4
|
import '@scayle/unstorage-compression-driver';
|
|
5
5
|
import 'unstorage';
|
|
6
6
|
import 'zod';
|
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.ed010583.js';
|
|
4
4
|
import '@scayle/unstorage-compression-driver';
|
|
5
5
|
import 'unstorage';
|
|
6
6
|
import 'zod';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { RpcContext, RpcMethodName, RpcMethodParameters, RpcMethodReturnType } from '@scayle/storefront-core';
|
|
2
|
+
export declare function useRpcCall<N extends RpcMethodName, P extends RpcMethodParameters<N>, TResult extends Exclude<Awaited<RpcMethodReturnType<N>>, Response>, TakesParameters = P extends RpcContext ? undefined : boolean>(method: N): TakesParameters extends undefined ? () => Promise<TResult> : (params: P) => Promise<TResult>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { rpcCall } from "../../rpc/rpcCall.mjs";
|
|
2
|
+
import { useNuxtApp } from "nuxt/app";
|
|
3
|
+
import { useCurrentShop } from "./useCurrentShop.mjs";
|
|
4
|
+
export function useRpcCall(method) {
|
|
5
|
+
const nuxtApp = useNuxtApp();
|
|
6
|
+
const currentShop = useCurrentShop();
|
|
7
|
+
return rpcCall(nuxtApp, method, currentShop.value);
|
|
8
|
+
}
|
|
@@ -4,6 +4,7 @@ export * from './core/useFormatHelpers';
|
|
|
4
4
|
export * from './core/useIDP';
|
|
5
5
|
export * from './core/useLog';
|
|
6
6
|
export * from './core/useRpc';
|
|
7
|
+
export * from './core/useRpcCall';
|
|
7
8
|
export * from './core/useSession';
|
|
8
9
|
export * from './core/useUser';
|
|
9
10
|
export * from './storefront/useBasket';
|
|
@@ -4,6 +4,7 @@ export * from "./core/useFormatHelpers.mjs";
|
|
|
4
4
|
export * from "./core/useIDP.mjs";
|
|
5
5
|
export * from "./core/useLog.mjs";
|
|
6
6
|
export * from "./core/useRpc.mjs";
|
|
7
|
+
export * from "./core/useRpcCall.mjs";
|
|
7
8
|
export * from "./core/useSession.mjs";
|
|
8
9
|
export * from "./core/useUser.mjs";
|
|
9
10
|
export * from "./storefront/useBasket.mjs";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { defineNitroPlugin, useRuntimeConfig } from "#imports";
|
|
2
|
+
export default defineNitroPlugin((nitroApp) => {
|
|
3
|
+
const runtimeConfig = useRuntimeConfig();
|
|
4
|
+
nitroApp.hooks.hook("request", (event) => {
|
|
5
|
+
event.context.nitro = event.context.nitro ?? {};
|
|
6
|
+
event.context.nitro.runtimeConfig = runtimeConfig;
|
|
7
|
+
});
|
|
8
|
+
});
|
|
@@ -810,7 +810,7 @@ declare const StorefrontConfigSchema: z.ZodObject<{
|
|
|
810
810
|
};
|
|
811
811
|
enabled?: boolean | undefined;
|
|
812
812
|
}>>;
|
|
813
|
-
publicShopData: z.ZodOptional<z.ZodArray<z.
|
|
813
|
+
publicShopData: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
814
814
|
idp: z.ZodOptional<z.ZodObject<{
|
|
815
815
|
enabled: z.ZodBoolean;
|
|
816
816
|
idpKeys: z.ZodArray<z.ZodString, "many">;
|
|
@@ -936,7 +936,7 @@ declare const StorefrontConfigSchema: z.ZodObject<{
|
|
|
936
936
|
tls?: boolean | undefined;
|
|
937
937
|
} | undefined;
|
|
938
938
|
} | undefined;
|
|
939
|
-
publicShopData?:
|
|
939
|
+
publicShopData?: string[] | undefined;
|
|
940
940
|
}, {
|
|
941
941
|
oauth: {
|
|
942
942
|
apiHost: string;
|
|
@@ -1011,7 +1011,7 @@ declare const StorefrontConfigSchema: z.ZodObject<{
|
|
|
1011
1011
|
tls?: boolean | undefined;
|
|
1012
1012
|
} | undefined;
|
|
1013
1013
|
} | undefined;
|
|
1014
|
-
publicShopData?:
|
|
1014
|
+
publicShopData?: string[] | undefined;
|
|
1015
1015
|
}>;
|
|
1016
1016
|
declare const PublicRuntimeConfigSchema: z.ZodObject<{
|
|
1017
1017
|
log: z.ZodObject<{
|
|
@@ -1254,7 +1254,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
1254
1254
|
};
|
|
1255
1255
|
enabled?: boolean | undefined;
|
|
1256
1256
|
}>>;
|
|
1257
|
-
publicShopData: z.ZodOptional<z.ZodArray<z.
|
|
1257
|
+
publicShopData: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
1258
1258
|
idp: z.ZodOptional<z.ZodObject<{
|
|
1259
1259
|
enabled: z.ZodBoolean;
|
|
1260
1260
|
idpKeys: z.ZodArray<z.ZodString, "many">;
|
|
@@ -1380,7 +1380,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
1380
1380
|
tls?: boolean | undefined;
|
|
1381
1381
|
} | undefined;
|
|
1382
1382
|
} | undefined;
|
|
1383
|
-
publicShopData?:
|
|
1383
|
+
publicShopData?: string[] | undefined;
|
|
1384
1384
|
}, {
|
|
1385
1385
|
oauth: {
|
|
1386
1386
|
apiHost: string;
|
|
@@ -1455,7 +1455,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
1455
1455
|
tls?: boolean | undefined;
|
|
1456
1456
|
} | undefined;
|
|
1457
1457
|
} | undefined;
|
|
1458
|
-
publicShopData?:
|
|
1458
|
+
publicShopData?: string[] | undefined;
|
|
1459
1459
|
}>, z.ZodObject<{
|
|
1460
1460
|
shopSelector: z.ZodEnum<["path", "domain", "path_or_default"]>;
|
|
1461
1461
|
stores: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -2187,7 +2187,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
2187
2187
|
tls?: boolean | undefined;
|
|
2188
2188
|
} | undefined;
|
|
2189
2189
|
} | undefined;
|
|
2190
|
-
publicShopData?:
|
|
2190
|
+
publicShopData?: string[] | undefined;
|
|
2191
2191
|
} | {
|
|
2192
2192
|
shopSelector: "domain" | "path" | "path_or_default";
|
|
2193
2193
|
stores: Record<string, {
|
|
@@ -2360,7 +2360,7 @@ export declare const RuntimeConfigSchema: z.ZodObject<{
|
|
|
2360
2360
|
tls?: boolean | undefined;
|
|
2361
2361
|
} | undefined;
|
|
2362
2362
|
} | undefined;
|
|
2363
|
-
publicShopData?:
|
|
2363
|
+
publicShopData?: string[] | undefined;
|
|
2364
2364
|
} | {
|
|
2365
2365
|
shopSelector: "domain" | "path" | "path_or_default";
|
|
2366
2366
|
stores: Record<string, {
|
|
@@ -131,9 +131,7 @@ const StorefrontConfigSchema = z.object({
|
|
|
131
131
|
appKeys: AppKeysSchema,
|
|
132
132
|
apiBasePath: z.string().optional(),
|
|
133
133
|
cache: CacheSchema.optional(),
|
|
134
|
-
publicShopData: z.array(
|
|
135
|
-
z.custom()
|
|
136
|
-
).optional(),
|
|
134
|
+
publicShopData: z.array(z.string()).optional(),
|
|
137
135
|
idp: IdpSchema.optional(),
|
|
138
136
|
/** @deprecated Global storefront.redis config is being removed in favor of `storefront.storage` config */
|
|
139
137
|
redis: RedisConfigSchema.optional()
|