@scayle/storefront-nuxt 7.76.6 → 7.77.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,32 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.77.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add default `getCachedData` implementation to `useRpc`
8
+
9
+ The default implementation looks like this:
10
+
11
+ ```
12
+ getCachedData(key, nuxtApp) {
13
+ return nuxtApp._asyncData[key]?.data.value as TResult
14
+ },
15
+ ```
16
+
17
+ compared to the default in `useAsyncData`
18
+
19
+ ```
20
+ getCachedData(key, nuxtApp) {
21
+ const hydrationData = nuxtApp.isHydrating ? nuxtApp.payload.data[key] : nuxtApp.static.data[key]
22
+ return hydrationData ?? nuxtApp._asyncData[key]?.data.value as TResult
23
+ }
24
+ ```
25
+
26
+ With this change multiple calls to the same composable with the same key will reference the cache. Previously, for every call of a composable a request would be sent except in hydration. This should be more similar to the pre-7.75.0 behavior.
27
+
28
+ The `getCachedData` implementation can be overridden when calling `useRpc` or any related composable.
29
+
3
30
  ## 7.76.6
4
31
 
5
32
  ### Patch Changes
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
- "version": "7.76.5",
3
+ "version": "7.76.6",
4
4
  "configKey": "storefront",
5
5
  "compatibility": {
6
6
  "nuxt": "^3.9.0"
package/dist/module.mjs CHANGED
@@ -64,7 +64,7 @@ export default {
64
64
  }`;
65
65
  }
66
66
  const PACKAGE_NAME = "@scayle/storefront-nuxt";
67
- const PACKAGE_VERSION = "7.76.5";
67
+ const PACKAGE_VERSION = "7.76.6";
68
68
  const logger = createConsola({
69
69
  fancy: true,
70
70
  formatOptions: {
@@ -45,6 +45,10 @@ export function useRpc(method, key, params, options) {
45
45
  {
46
46
  // Both refs and getter functions are valid watch sources
47
47
  ...isRef(params) || typeof params === "function" ? { watch: [params] } : {},
48
+ getCachedData(key2, nuxtApp2) {
49
+ const hydrationData = nuxtApp2.isHydrating ? nuxtApp2.payload.data[key2] : nuxtApp2.static.data[key2];
50
+ return hydrationData ?? nuxtApp2._asyncData[key2]?.data.value;
51
+ },
48
52
  ...options
49
53
  }
50
54
  );
@@ -1,5 +1,5 @@
1
1
  declare const resolveError: (error: Error | unknown) => {
2
- statusCode: 401 | 500 | 400 | 100 | 101 | 102 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511;
2
+ statusCode: 100 | 101 | 102 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 226 | 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308 | 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451 | 500 | 501 | 502 | 503 | 504 | 506 | 507 | 508 | 510 | 511 | 306 | 505;
3
3
  statusMessage: string;
4
4
  name: string;
5
5
  };
@@ -1,8 +1,8 @@
1
1
  declare const _default: import("nuxt/app").Plugin<{
2
- log: import("@scayle/storefront-core").Log;
3
- coreLog: import("@scayle/storefront-core").Log;
2
+ log: any;
3
+ coreLog: any;
4
4
  }> & import("nuxt/app").ObjectPlugin<{
5
- log: import("@scayle/storefront-core").Log;
6
- coreLog: import("@scayle/storefront-core").Log;
5
+ log: any;
6
+ coreLog: any;
7
7
  }>;
8
8
  export default _default;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.76.6",
4
+ "version": "7.77.0",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -85,12 +85,12 @@
85
85
  "@nuxt/test-utils": "3.13.1",
86
86
  "@scayle/eslint-config-storefront": "4.2.0",
87
87
  "@scayle/eslint-plugin-vue-composable": "0.2.0",
88
- "@types/node": "20.14.5",
88
+ "@types/node": "20.14.6",
89
89
  "dprint": "0.46.3",
90
90
  "eslint": "9.5.0",
91
91
  "eslint-formatter-gitlab": "5.1.0",
92
92
  "fishery": "2.2.2",
93
- "h3": "1.11.1",
93
+ "h3": "1.12.0",
94
94
  "node-mocks-http": "1.14.1",
95
95
  "nuxi": "3.12.0",
96
96
  "nuxt": "3.11.2",
@@ -105,7 +105,7 @@
105
105
  "vue": ">=3.4.0"
106
106
  },
107
107
  "resolutions": {
108
- "h3": "1.11.1",
108
+ "h3": "1.12.0",
109
109
  "vue": "3.4.27",
110
110
  "@nuxt/kit": "3.11.2",
111
111
  "@nuxt/schema": "3.11.2"