@scayle/storefront-nuxt 7.40.3 → 7.40.5

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,20 @@
1
1
  # @scayle/storefront-nuxt
2
2
 
3
+ ## 7.40.5
4
+
5
+ ### Patch Changes
6
+
7
+ - Allow setting the log level in the module config
8
+ - Prevent infinite loops when log writing fails
9
+ - Updated dependencies
10
+ - @scayle/storefront-core@7.28.0
11
+
12
+ ## 7.40.4
13
+
14
+ ### Patch Changes
15
+
16
+ - Resolve error with newly introduced `nitro` plugin during local dev mode
17
+
3
18
  ## 7.40.3
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
- export { e as AdditionalShopConfig, A as AppKeys, d as AuthenticationConfig, B as BapiConfig, b as CacheConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, O as OauthConfig, P as PublicShopConfig, c as RedirectsConfig, R as RedisConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.9548700f.mjs';
1
+ export { e as AdditionalShopConfig, A as AppKeys, d as AuthenticationConfig, B as BapiConfig, b as CacheConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, O as OauthConfig, P as PublicShopConfig, c as RedirectsConfig, R as RedisConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.1cbf9601.mjs';
2
2
  export { rpcCall } from './rpc.mjs';
3
3
  export * from '@scayle/storefront-core';
4
+ export { LogLevel } from '@scayle/storefront-core';
4
5
  import 'nuxt/app';
5
6
 
6
7
  interface RpcMethodsStorefront {
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
- export { e as AdditionalShopConfig, A as AppKeys, d as AuthenticationConfig, B as BapiConfig, b as CacheConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, O as OauthConfig, P as PublicShopConfig, c as RedirectsConfig, R as RedisConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.9548700f.js';
1
+ export { e as AdditionalShopConfig, A as AppKeys, d as AuthenticationConfig, B as BapiConfig, b as CacheConfig, i as CheckoutEvent, C as CheckoutShopConfig, M as ModuleOptions, O as OauthConfig, P as PublicShopConfig, c as RedirectsConfig, R as RedisConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.1cbf9601.js';
2
2
  export { rpcCall } from './rpc.js';
3
3
  export * from '@scayle/storefront-core';
4
+ export { LogLevel } from '@scayle/storefront-core';
4
5
  import 'nuxt/app';
5
6
 
6
7
  interface RpcMethodsStorefront {
package/dist/module.d.mts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleOptions } from './shared/storefront-nuxt.9548700f.mjs';
3
- export { e as AdditionalShopConfig, A as AppKeys, d as AuthenticationConfig, B as BapiConfig, b as CacheConfig, i as CheckoutEvent, C as CheckoutShopConfig, O as OauthConfig, P as PublicShopConfig, c as RedirectsConfig, R as RedisConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.9548700f.mjs';
4
- import '@scayle/storefront-core';
2
+ import { M as ModuleOptions } from './shared/storefront-nuxt.1cbf9601.mjs';
3
+ export { e as AdditionalShopConfig, A as AppKeys, d as AuthenticationConfig, B as BapiConfig, b as CacheConfig, i as CheckoutEvent, C as CheckoutShopConfig, O as OauthConfig, P as PublicShopConfig, c as RedirectsConfig, R as RedisConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.1cbf9601.mjs';
4
+ export { LogLevel } from '@scayle/storefront-core';
5
5
 
6
6
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
7
7
 
package/dist/module.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { M as ModuleOptions } from './shared/storefront-nuxt.9548700f.js';
3
- export { e as AdditionalShopConfig, A as AppKeys, d as AuthenticationConfig, B as BapiConfig, b as CacheConfig, i as CheckoutEvent, C as CheckoutShopConfig, O as OauthConfig, P as PublicShopConfig, c as RedirectsConfig, R as RedisConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.9548700f.js';
4
- import '@scayle/storefront-core';
2
+ import { M as ModuleOptions } from './shared/storefront-nuxt.1cbf9601.js';
3
+ export { e as AdditionalShopConfig, A as AppKeys, d as AuthenticationConfig, B as BapiConfig, b as CacheConfig, i as CheckoutEvent, C as CheckoutShopConfig, O as OauthConfig, P as PublicShopConfig, c as RedirectsConfig, R as RedisConfig, a as SessionConfig, f as ShopConfig, g as ShopConfigIndexed, S as StorageProvider, h as StorefrontConfig } from './shared/storefront-nuxt.1cbf9601.js';
4
+ export { LogLevel } from '@scayle/storefront-core';
5
5
 
6
6
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
7
7
 
package/dist/module.json CHANGED
@@ -4,5 +4,5 @@
4
4
  "compatibility": {
5
5
  "nuxt": "^3.7.0"
6
6
  },
7
- "version": "7.40.2"
7
+ "version": "7.40.4"
8
8
  }
package/dist/module.mjs CHANGED
@@ -35,7 +35,8 @@ const module = defineNuxtModule({
35
35
  shopSelector: "domain",
36
36
  stores: {},
37
37
  log: {
38
- name: ""
38
+ name: "",
39
+ level: "debug"
39
40
  },
40
41
  auth: {
41
42
  redirect: {
@@ -145,9 +146,7 @@ const module = defineNuxtModule({
145
146
  nuxt.hook("prepare:types", ({ references }) => {
146
147
  references.push({ path: template.dst });
147
148
  });
148
- addServerPlugin(
149
- resolve("./runtime/server/plugins/nitroSetXPoweredByHeader")
150
- );
149
+ addServerPlugin(resolve("./runtime/nitro/plugins/nitroSetXPoweredByHeader"));
151
150
  nuxt.hooks.hook("nitro:config", (nitroConfig) => {
152
151
  nitroConfig.externals = nitroConfig.externals || {};
153
152
  nitroConfig.externals.inline = nitroConfig.externals.inline || [];
@@ -162,7 +161,8 @@ const module = defineNuxtModule({
162
161
  "rpc/rpcRequest",
163
162
  "server/middleware/oauth",
164
163
  "server/middleware/redirects",
165
- "server/middleware/cache"
164
+ "server/middleware/cache",
165
+ "nitro/plugins/nitroSetXPoweredByHeader"
166
166
  ];
167
167
  runtimePaths.forEach((path) => {
168
168
  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.9548700f.mjs';
3
+ import { P as PublicShopConfig } from './shared/storefront-nuxt.1cbf9601.mjs';
4
4
 
5
5
  /**
6
6
  * rpcCall can be used to invoke an RPC method either on the client or server
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.9548700f.js';
3
+ import { P as PublicShopConfig } from './shared/storefront-nuxt.1cbf9601.js';
4
4
 
5
5
  /**
6
6
  * rpcCall can be used to invoke an RPC method either on the client or server
@@ -1,7 +1,7 @@
1
1
  export declare function useSession(): {
2
- login: (params: import("@scayle/storefront-core").LoginRequest) => Promise<undefined>;
3
- register: (params: import("@scayle/storefront-core").RegisterRequest) => Promise<undefined>;
4
- guestLogin: (params: import("@scayle/storefront-core").GuestRequest) => Promise<undefined>;
2
+ login: (params: import("utility-types").Optional<import("@scayle/storefront-core").LoginRequest, "shop_id">) => Promise<undefined>;
3
+ register: (params: import("utility-types").Optional<import("@scayle/storefront-core").RegisterRequest, "shop_id">) => Promise<undefined>;
4
+ guestLogin: (params: import("utility-types").Optional<import("@scayle/storefront-core").GuestRequest, "shop_id">) => Promise<undefined>;
5
5
  refreshToken: () => Promise<{
6
6
  success: boolean;
7
7
  }>;
@@ -1,3 +1,4 @@
1
1
  import type { ConsolaInstance, ConsolaOptions } from 'consola';
2
+ import type { LogLevel } from '../types/module';
2
3
  import { Log } from './log';
3
- export default function createLog(createConsola: (options?: Partial<ConsolaOptions>) => ConsolaInstance, space?: string): Log;
4
+ export default function createLog(createConsola: (options?: Partial<ConsolaOptions>) => ConsolaInstance, space: string | undefined, level: LogLevel): Log;
@@ -16,10 +16,18 @@ function prepareData(data) {
16
16
  }
17
17
  return data;
18
18
  }
19
- export default function createLog(createConsola, space = "default-storefront") {
19
+ const levelMap = {
20
+ error: 0,
21
+ warn: 1,
22
+ info: 3,
23
+ debug: 4
24
+ };
25
+ function toConsolaLogLevel(level) {
26
+ return levelMap[level];
27
+ }
28
+ export default function createLog(createConsola, space = "default-storefront", level) {
20
29
  const logger = createConsola({
21
- level: 4
22
- // set to 3 to skip debug messages
30
+ level: toConsolaLogLevel(level)
23
31
  });
24
32
  const handler = (entry) => {
25
33
  const data = prepareData(entry.data);
@@ -34,7 +34,11 @@ export class Log {
34
34
  data = typeof data !== "object" ? { data } : data;
35
35
  }
36
36
  if (this._handler) {
37
- this._handler({ level, message, data, space: this._space });
37
+ try {
38
+ this._handler({ level, message, data, space: this._space });
39
+ } catch (e) {
40
+ console.error(`Error writing log message: ${e}`);
41
+ }
38
42
  } else {
39
43
  const logFunc = console[level] || console.log;
40
44
  logFunc.apply(console, data ? [message, data] : [message]);
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../playground/.nuxt/tsconfig.server.json",
3
+ "exclude": ["../../../dist", "../../../test", "../../../playground"]
4
+ }
@@ -3,7 +3,7 @@ import { createConsola } from "consola/browser";
3
3
  import createLog from "../createLog.mjs";
4
4
  export default defineNuxtPlugin((nuxtApp) => {
5
5
  const config = useRuntimeConfig().public;
6
- const log = createLog(createConsola, config.log.name);
6
+ const log = createLog(createConsola, config.log.name, config.log.level);
7
7
  const coreLog = log.space("sfc");
8
8
  coreLog.debug("Attached client-side logger");
9
9
  addClientSideErrorHandling(log, nuxtApp.vueApp);
@@ -166,7 +166,11 @@ export default defineEventHandler(async (event) => {
166
166
  if (url.pathname === `${apiBasePath}/up`) {
167
167
  return;
168
168
  }
169
- const log = createLog(createConsola, $storefrontConfig.log.name);
169
+ const log = createLog(
170
+ createConsola,
171
+ $storefrontConfig.log.name,
172
+ $storefrontConfig.log.level
173
+ );
170
174
  if (!event.context.$rpcContext) {
171
175
  await bootstrap(
172
176
  event,
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "../../../playground/.nuxt/tsconfig.server.json",
3
+ "exclude": ["../../../dist", "../../../test", "../../../playground"]
4
+ }
@@ -1,4 +1,4 @@
1
- import { HashAlgorithm, WithParams, ShopUser } from '@scayle/storefront-core';
1
+ import { LogLevel, HashAlgorithm, WithParams, ShopUser } from '@scayle/storefront-core';
2
2
 
3
3
  type StorageProvider = 'memory' | 'redis';
4
4
  type CheckoutShopConfig = {
@@ -132,6 +132,7 @@ type ModuleOptions = StorefrontConfig & {
132
132
  rpcMethodNames?: string[];
133
133
  log: {
134
134
  name: string;
135
+ level: LogLevel;
135
136
  };
136
137
  redirects?: RedirectsConfig;
137
138
  };
@@ -153,6 +154,7 @@ declare module '@nuxt/schema' {
153
154
  imageBaseUrl: string;
154
155
  log: {
155
156
  name: string;
157
+ level: LogLevel;
156
158
  };
157
159
  auth: AuthenticationConfig;
158
160
  }
@@ -1,4 +1,4 @@
1
- import { HashAlgorithm, WithParams, ShopUser } from '@scayle/storefront-core';
1
+ import { LogLevel, HashAlgorithm, WithParams, ShopUser } from '@scayle/storefront-core';
2
2
 
3
3
  type StorageProvider = 'memory' | 'redis';
4
4
  type CheckoutShopConfig = {
@@ -132,6 +132,7 @@ type ModuleOptions = StorefrontConfig & {
132
132
  rpcMethodNames?: string[];
133
133
  log: {
134
134
  name: string;
135
+ level: LogLevel;
135
136
  };
136
137
  redirects?: RedirectsConfig;
137
138
  };
@@ -153,6 +154,7 @@ declare module '@nuxt/schema' {
153
154
  imageBaseUrl: string;
154
155
  log: {
155
156
  name: string;
157
+ level: LogLevel;
156
158
  };
157
159
  auth: AuthenticationConfig;
158
160
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scayle/storefront-nuxt",
3
3
  "type": "module",
4
- "version": "7.40.3",
4
+ "version": "7.40.5",
5
5
  "description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
6
6
  "author": "SCAYLE Commerce Engine",
7
7
  "license": "MIT",
@@ -62,7 +62,7 @@
62
62
  "dependencies": {
63
63
  "@nuxt/kit": "3.8.1",
64
64
  "@scayle/h3-session": "0.3.4",
65
- "@scayle/storefront-core": "7.27.0",
65
+ "@scayle/storefront-core": "7.28.0",
66
66
  "@vueuse/core": "10.6.1",
67
67
  "consola": "3.2.3",
68
68
  "core-js": "3.33.3",
@@ -82,7 +82,7 @@
82
82
  "@nuxt/test-utils": "3.8.1",
83
83
  "@scayle/eslint-config-storefront": "3.2.5",
84
84
  "@scayle/prettier-config-storefront": "2.0.2",
85
- "@types/node": "20.9.4",
85
+ "@types/node": "20.9.5",
86
86
  "eslint": "8.54.0",
87
87
  "eslint-formatter-gitlab": "5.1.0",
88
88
  "node-mocks-http": "1.13.0",