@scayle/storefront-nuxt 8.4.0 → 8.5.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 CHANGED
@@ -1,5 +1,18 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 8.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [Performance] Remove the 'autobinding' of the methods on the `Cached` instance. Instead the `execute` method only is bound when constructing the `RpcContext`. This simplifies the code and improves the performance of the `bootstrap` function. This change is internal to `storefront-core` and the API of `RpcContext` is unchanged.
8
+
9
+ ### Patch Changes
10
+
11
+ **Dependencies**
12
+
13
+ - Updated dependency to @scayle/storefront-core@8.2.0
14
+ - Updated dependency to @scayle/h3-session@0.6.0
15
+
3
16
  ## 8.4.0
4
17
 
5
18
  ### Minor Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "8.4.0",
3
+ "version": "8.5.0",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -45,7 +45,7 @@ export default {
45
45
  }`;
46
46
  }
47
47
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
48
- const PACKAGE_VERSION = "8.4.0";
48
+ const PACKAGE_VERSION = "8.5.0";
49
49
  const logger = createConsola({
50
50
  fancy: true,
51
51
  formatOptions: {
@@ -220,6 +220,7 @@ Missing RPC Overrides: ${Array.from(overridenRPCMethodNames).map((name) => `'${n
220
220
  "handler",
221
221
  "error/handler",
222
222
  "campaignKey",
223
+ "cached",
223
224
  "context",
224
225
  "createLog",
225
226
  "log",
@@ -1,4 +1,4 @@
1
- declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | true | import("@scayle/storefront-core").ShopUser | string[] | Response | import("@scayle/storefront-api").Product | import("@scayle/storefront-api").Product[] | {
1
+ declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<string | true | string[] | import("@scayle/storefront-core").ShopUser | Response | import("@scayle/storefront-api").Product | import("@scayle/storefront-api").Product[] | {
2
2
  count: number;
3
3
  } | {
4
4
  filters: import("@scayle/storefront-api").FiltersEndpointResponseData;
@@ -0,0 +1,2 @@
1
+ import { type Log, type CacheInterface } from '@scayle/storefront-core';
2
+ export declare function getCachedFunction($cache: CacheInterface, $log: Log, enabled: boolean | undefined): <TArgs extends unknown[], TResult>(fn: (...args: TArgs) => Promise<TResult>, options?: import("@scayle/storefront-core").CacheOptions) => Awaited<(...args: TArgs) => Promise<TResult>>;
@@ -0,0 +1,10 @@
1
+ import { Cached } from "@scayle/storefront-core";
2
+ export function getCachedFunction($cache, $log, enabled) {
3
+ const cached = new Cached(
4
+ $cache,
5
+ $log,
6
+ "",
7
+ enabled ?? true
8
+ );
9
+ return cached.execute.bind(cached);
10
+ }
@@ -1,6 +1,5 @@
1
1
  import { getRequestIP, getRequestHeaders } from "h3";
2
2
  import {
3
- Cached,
4
3
  createAndPurifyHeaders,
5
4
  StorefrontAPIClient
6
5
  } from "@scayle/storefront-core";
@@ -10,6 +9,7 @@ import {
10
9
  } from "@scayle/storefront-core/dist/utils/keys";
11
10
  import { useNitroApp } from "nitropack/runtime";
12
11
  import { fetchCampaignKey } from "./campaignKey.js";
12
+ import { getCachedFunction } from "./cached.js";
13
13
  async function getWishlistKey(appKeys, session, $log, $shopConfig) {
14
14
  return session.data.user ? await generateWishlistKey({
15
15
  keyTemplate: appKeys.wishlistKey,
@@ -94,7 +94,11 @@ export const buildContext = async (context) => {
94
94
  "x-internal-access": $storefront.internalAccessHeader
95
95
  } : {}
96
96
  });
97
- const cached = new Cached($cache, $log, "", $storefront.cache?.enabled ?? true).execute;
97
+ const cached = getCachedFunction(
98
+ $cache,
99
+ $log,
100
+ $storefront.cache?.enabled
101
+ );
98
102
  const { hooks } = useNitroApp();
99
103
  const baseContext = {
100
104
  cached,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "8.4.0",
4
+ "version": "8.5.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -71,8 +71,8 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@opentelemetry/api": "^1.9.0",
74
- "@scayle/h3-session": "0.5.1",
75
- "@scayle/storefront-core": "8.1.5",
74
+ "@scayle/h3-session": "0.6.0",
75
+ "@scayle/storefront-core": "8.2.0",
76
76
  "@scayle/unstorage-compression-driver": "^0.2.3",
77
77
  "@vueuse/core": "12.4.0",
78
78
  "consola": "^3.2.3",