@scayle/storefront-nuxt 7.89.0 → 7.91.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 +18 -0
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +0 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/api/rpcHandler.d.ts +2 -2
- package/dist/runtime/createLog.d.ts +1 -1
- package/dist/runtime/createLog.js +1 -1
- package/dist/runtime/plugin/log.client.d.ts +5 -4
- package/dist/runtime/plugin/shop.d.ts +4 -4
- package/dist/runtime/utils/zodSchema.d.ts +426 -426
- package/dist/test-factories/rpcContext.mjs +1 -1
- package/package.json +3 -3
- package/dist/runtime/log.d.ts +0 -38
- package/dist/runtime/log.js +0 -76
- package/dist/runtime/utils/category.d.ts +0 -4
- package/dist/runtime/utils/category.js +0 -20
|
@@ -3,7 +3,7 @@ import { vi } from "vitest";
|
|
|
3
3
|
import {
|
|
4
4
|
StorefrontAPIClient
|
|
5
5
|
} from "@scayle/storefront-core";
|
|
6
|
-
import { Log } from "../../src
|
|
6
|
+
import { Log } from "../../src";
|
|
7
7
|
export const rpcContextFactory = Factory.define(({ transientParams }) => {
|
|
8
8
|
return {
|
|
9
9
|
locale: "de",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "7.
|
|
4
|
+
"version": "7.91.0",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@nuxt/kit": "^3.12.2",
|
|
70
70
|
"@opentelemetry/api": "^1.9.0",
|
|
71
71
|
"@scayle/h3-session": "^0.4.1",
|
|
72
|
-
"@scayle/storefront-core": "7.66.
|
|
72
|
+
"@scayle/storefront-core": "7.66.2",
|
|
73
73
|
"@scayle/unstorage-compression-driver": "^0.1.5",
|
|
74
74
|
"@vueuse/core": "11.2.0",
|
|
75
75
|
"consola": "^3.2.3",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"@nuxt/test-utils": "3.14.4",
|
|
95
95
|
"@scayle/eslint-config-storefront": "4.3.2",
|
|
96
96
|
"@scayle/eslint-plugin-vue-composable": "0.2.1",
|
|
97
|
-
"@types/node": "22.
|
|
97
|
+
"@types/node": "22.9.0",
|
|
98
98
|
"dprint": "0.47.5",
|
|
99
99
|
"eslint": "9.14.0",
|
|
100
100
|
"eslint-formatter-gitlab": "5.1.0",
|
package/dist/runtime/log.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
2
|
-
export interface LogEntry {
|
|
3
|
-
level: LogLevel;
|
|
4
|
-
space: string;
|
|
5
|
-
message: string;
|
|
6
|
-
data?: object | undefined;
|
|
7
|
-
}
|
|
8
|
-
export type LogHandler = (entry: LogEntry) => void;
|
|
9
|
-
export interface LogOptions {
|
|
10
|
-
handler?: LogHandler;
|
|
11
|
-
space: string;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* This log provides a way to log messages to a custom log handler (in a serial manner).
|
|
15
|
-
* If no handler is provided, it will log to the console.
|
|
16
|
-
*/
|
|
17
|
-
export declare class Log {
|
|
18
|
-
static default: Log;
|
|
19
|
-
_handler?: LogHandler;
|
|
20
|
-
_space: string;
|
|
21
|
-
_type: string;
|
|
22
|
-
constructor(options?: LogOptions);
|
|
23
|
-
debug(message: string, data?: unknown): void;
|
|
24
|
-
info(message: string, data?: unknown): void;
|
|
25
|
-
warn(message: string, data?: unknown): void;
|
|
26
|
-
error(message: string | Error, data?: unknown): void;
|
|
27
|
-
write(level: LogLevel, message: string, data?: unknown): void;
|
|
28
|
-
/**
|
|
29
|
-
* Create a new sub-space.
|
|
30
|
-
* All spaces are being separated by a dot. E.g. `global.api` and `global.api.getUser`
|
|
31
|
-
* @param subSpace The name of the sub-space in camel-case (e.g. `api` and `api.getUser`)
|
|
32
|
-
*/
|
|
33
|
-
space(subSpace: string): Log;
|
|
34
|
-
/**
|
|
35
|
-
* Measure the time of a function.
|
|
36
|
-
*/
|
|
37
|
-
time<T>(message: string, func: () => T): Promise<T>;
|
|
38
|
-
}
|
package/dist/runtime/log.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
function dataToObject(data) {
|
|
2
|
-
if (data === null || data === void 0) {
|
|
3
|
-
return void 0;
|
|
4
|
-
}
|
|
5
|
-
return typeof data !== "object" ? { data } : data;
|
|
6
|
-
}
|
|
7
|
-
export class Log {
|
|
8
|
-
static default = new this({
|
|
9
|
-
space: "global",
|
|
10
|
-
handler: consoleLogHandler
|
|
11
|
-
});
|
|
12
|
-
_handler;
|
|
13
|
-
_space;
|
|
14
|
-
_type = "log";
|
|
15
|
-
constructor(options) {
|
|
16
|
-
this._handler = options?.handler || Log.default._handler;
|
|
17
|
-
this._space = options?.space || Log.default._space;
|
|
18
|
-
}
|
|
19
|
-
debug(message, data) {
|
|
20
|
-
this.write("debug", message, data);
|
|
21
|
-
}
|
|
22
|
-
info(message, data) {
|
|
23
|
-
this.write("info", message, data);
|
|
24
|
-
}
|
|
25
|
-
warn(message, data) {
|
|
26
|
-
this.write("warn", message, data);
|
|
27
|
-
}
|
|
28
|
-
error(message, data) {
|
|
29
|
-
const error = message instanceof Error ? message : null;
|
|
30
|
-
if (error) {
|
|
31
|
-
data = {
|
|
32
|
-
error: message,
|
|
33
|
-
...dataToObject(data)
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
this.write("error", error?.message ?? message, data);
|
|
37
|
-
}
|
|
38
|
-
write(level, message, data) {
|
|
39
|
-
const d = dataToObject(data);
|
|
40
|
-
if (this._handler) {
|
|
41
|
-
try {
|
|
42
|
-
this._handler({ level, message, data: d, space: this._space });
|
|
43
|
-
} catch (e) {
|
|
44
|
-
console.error(`Error writing log message: "${message}" -- ${e}`);
|
|
45
|
-
}
|
|
46
|
-
} else {
|
|
47
|
-
const logFunc = console[level] || console.log;
|
|
48
|
-
logFunc.apply(console, data ? [message, data] : [message]);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Create a new sub-space.
|
|
53
|
-
* All spaces are being separated by a dot. E.g. `global.api` and `global.api.getUser`
|
|
54
|
-
* @param subSpace The name of the sub-space in camel-case (e.g. `api` and `api.getUser`)
|
|
55
|
-
*/
|
|
56
|
-
space(subSpace) {
|
|
57
|
-
return new Log({
|
|
58
|
-
space: `${this._space}.${subSpace}`,
|
|
59
|
-
handler: this._handler
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Measure the time of a function.
|
|
64
|
-
*/
|
|
65
|
-
async time(message, func) {
|
|
66
|
-
const start = Date.now();
|
|
67
|
-
const result = await func();
|
|
68
|
-
const end = Date.now();
|
|
69
|
-
this.debug(`${message} took ${end - start}ms`);
|
|
70
|
-
return result;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
function consoleLogHandler({ level, message, data }) {
|
|
74
|
-
const logFunc = console[level] || console.log;
|
|
75
|
-
logFunc.apply(console, data ? [message, data] : [message]);
|
|
76
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { Category } from '@scayle/storefront-core';
|
|
2
|
-
export declare const getCategoryAncestors: (category: Category, categories?: Category[]) => Category[];
|
|
3
|
-
export declare const isSaleCategory: (category: Category) => boolean;
|
|
4
|
-
export declare const flattenCategoryTree: (categoryTree: Category[]) => Category[];
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export const getCategoryAncestors = (category, categories = []) => {
|
|
2
|
-
if (!category?.parent) {
|
|
3
|
-
return categories;
|
|
4
|
-
}
|
|
5
|
-
return getCategoryAncestors(category.parent, [category.parent, ...categories]);
|
|
6
|
-
};
|
|
7
|
-
export const isSaleCategory = (category) => {
|
|
8
|
-
return category.properties.some(({ name }) => name === "sale");
|
|
9
|
-
};
|
|
10
|
-
export const flattenCategoryTree = (categoryTree) => {
|
|
11
|
-
const flattenedCategoryTreeList = categoryTree.flatMap((categoryNode) => [
|
|
12
|
-
categoryNode,
|
|
13
|
-
...categoryNode.children ? flattenCategoryTree(categoryNode.children) : []
|
|
14
|
-
]);
|
|
15
|
-
return [
|
|
16
|
-
...new Map(
|
|
17
|
-
flattenedCategoryTreeList.map((item) => [item.id, item])
|
|
18
|
-
).values()
|
|
19
|
-
];
|
|
20
|
-
};
|