@scayle/storefront-nuxt 8.34.0 → 8.35.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-V7.md +1 -1
- package/CHANGELOG.md +31 -3
- package/dist/module.json +1 -1
- package/dist/module.mjs +1 -1
- package/dist/runtime/cached.d.ts +1 -1
- package/dist/runtime/composables/core/useIDP.d.ts +1 -1
- package/dist/runtime/composables/core/useRpc.d.ts +3 -2
- package/dist/runtime/composables/core/useRpc.js +1 -4
- package/dist/runtime/composables/core/useUser.d.ts +2 -2
- package/dist/runtime/composables/storefront/useBasket.d.ts +2 -2
- package/dist/runtime/composables/storefront/useBasket.js +2 -7
- package/dist/runtime/composables/storefront/useCategoryTree.d.ts +1 -1
- package/dist/runtime/composables/storefront/useCategoryTree.js +1 -3
- package/dist/runtime/composables/storefront/useOrder.d.ts +1 -1
- package/dist/runtime/composables/storefront/useWishlist.d.ts +2 -2
- package/dist/runtime/composables/storefront/useWishlist.js +1 -5
- package/dist/runtime/context.d.ts +1 -1
- package/dist/runtime/nitro/plugins/configValidation.d.ts +4 -3
- package/dist/runtime/nitro/plugins/configValidation.js +3 -3
- package/dist/runtime/nitro/plugins/internalFetch.d.ts +1 -1
- package/dist/runtime/server/middleware/bootstrap-utils.d.ts +1 -1
- package/dist/runtime/server/middleware/bootstrap-utils.js +1 -5
- package/dist/runtime/server/middleware/bootstrap.js +1 -4
- package/dist/runtime/server/utils/cacheStorage.d.ts +1 -1
- package/dist/runtime/utils/rpc.d.ts +1 -1
- package/dist/runtime/utils/rpc.js +1 -3
- package/dist/runtime/utils/zodSchema.d.ts +985 -2470
- package/dist/runtime/utils/zodSchema.js +76 -69
- package/package.json +10 -9
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as z from "zod/mini";
|
|
2
2
|
import { builtinDrivers } from "unstorage";
|
|
3
3
|
export const RedirectsSchema = z.object({
|
|
4
4
|
enabled: z.boolean(),
|
|
5
|
-
queryParamWhitelist: z.array(z.string())
|
|
6
|
-
strategy: z.enum(["before-request", "on-missing"])
|
|
5
|
+
queryParamWhitelist: z.optional(z.array(z.string())),
|
|
6
|
+
strategy: z.optional(z.enum(["before-request", "on-missing"]))
|
|
7
7
|
});
|
|
8
8
|
const SessionSchema = z.object({
|
|
9
9
|
/**
|
|
10
10
|
* The sameSite policy to use for the session cookie
|
|
11
11
|
*/
|
|
12
|
-
sameSite: z.enum(["lax", "strict", "none"])
|
|
12
|
+
sameSite: z.optional(z.enum(["lax", "strict", "none"])),
|
|
13
13
|
/**
|
|
14
14
|
* The default maxAge (in seconds) set on the session cookie and default TTL for session store
|
|
15
15
|
*/
|
|
16
|
-
maxAge: z.
|
|
16
|
+
maxAge: z.optional(z.number()),
|
|
17
17
|
/**
|
|
18
18
|
* The name used for the session cookie
|
|
19
19
|
*/
|
|
20
|
-
cookieName: z.
|
|
20
|
+
cookieName: z.optional(z.string()),
|
|
21
21
|
/**
|
|
22
22
|
* The secret used for signing session cookies. If an array is passed, the last
|
|
23
23
|
* value is used for signing new cookies, but all values are used to verify cookies.
|
|
24
24
|
*/
|
|
25
|
-
secret: z.
|
|
25
|
+
secret: z.optional(z.union([z.string(), z.array(z.string())])),
|
|
26
26
|
/**
|
|
27
27
|
* Controls the domain option on the session cookie
|
|
28
28
|
*/
|
|
29
|
-
domain: z.
|
|
29
|
+
domain: z.optional(z.string())
|
|
30
30
|
});
|
|
31
31
|
const SapiSchema = z.object({
|
|
32
|
-
host: z.
|
|
33
|
-
token: z.string().
|
|
32
|
+
host: z.url(),
|
|
33
|
+
token: z.string().check(z.minLength(1))
|
|
34
34
|
});
|
|
35
35
|
const OAuthSchema = z.object({
|
|
36
|
-
apiHost: z.
|
|
37
|
-
clientId: z.number()
|
|
38
|
-
clientSecret: z.string().
|
|
36
|
+
apiHost: z.url(),
|
|
37
|
+
clientId: z.union([z.number(), z.string().check(z.minLength(1))]),
|
|
38
|
+
clientSecret: z.string().check(z.minLength(1))
|
|
39
39
|
});
|
|
40
40
|
const IdpSchema = z.object({
|
|
41
41
|
enabled: z.boolean(),
|
|
@@ -43,28 +43,30 @@ const IdpSchema = z.object({
|
|
|
43
43
|
idpRedirectURL: z.string()
|
|
44
44
|
});
|
|
45
45
|
const LegacySchema = z.object({
|
|
46
|
-
enableSessionMigration: z.
|
|
46
|
+
enableSessionMigration: z.optional(z.boolean())
|
|
47
47
|
});
|
|
48
48
|
const builtinDriverKeys = Object.keys(builtinDrivers);
|
|
49
|
-
const compressionSchema = z.
|
|
49
|
+
const compressionSchema = z.optional(
|
|
50
|
+
z.enum(["deflate", "gzip", "brotli", "none"])
|
|
51
|
+
);
|
|
50
52
|
const scayleKvConfigSchema = z.object({
|
|
51
53
|
driver: z.literal("scayleKv"),
|
|
52
54
|
compression: compressionSchema,
|
|
53
|
-
ttl: z.
|
|
54
|
-
disableClusterMode: z.
|
|
55
|
+
ttl: z.optional(z.number()),
|
|
56
|
+
disableClusterMode: z.optional(z.boolean())
|
|
55
57
|
});
|
|
56
58
|
const StorageSchema = z.discriminatedUnion("driver", [
|
|
57
59
|
z.object({
|
|
58
60
|
driver: z.enum(builtinDriverKeys),
|
|
59
61
|
compression: compressionSchema,
|
|
60
|
-
url: z.
|
|
61
|
-
token: z.
|
|
62
|
-
host: z.
|
|
63
|
-
port: z.
|
|
64
|
-
username: z.
|
|
65
|
-
password: z.
|
|
66
|
-
tls: z.
|
|
67
|
-
ttl: z.
|
|
62
|
+
url: z.optional(z.url()),
|
|
63
|
+
token: z.optional(z.string()),
|
|
64
|
+
host: z.optional(z.string()),
|
|
65
|
+
port: z.optional(z.number()),
|
|
66
|
+
username: z.optional(z.string()),
|
|
67
|
+
password: z.optional(z.string()),
|
|
68
|
+
tls: z.optional(z.boolean()),
|
|
69
|
+
ttl: z.optional(z.number())
|
|
68
70
|
}),
|
|
69
71
|
scayleKvConfigSchema
|
|
70
72
|
]);
|
|
@@ -76,85 +78,90 @@ const AppKeysSchema = z.object(
|
|
|
76
78
|
}
|
|
77
79
|
);
|
|
78
80
|
const CheckoutShopConfigSchema = z.object({
|
|
79
|
-
token: z.string().
|
|
80
|
-
secret: z.string().
|
|
81
|
-
host: z.
|
|
82
|
-
user: z.string()
|
|
83
|
-
cbdExpiration: z.
|
|
84
|
-
shopId: z.
|
|
85
|
-
});
|
|
86
|
-
const emptyString = z.string().refine((val) => val === "", {
|
|
87
|
-
message: "Expected boolean, received string"
|
|
81
|
+
token: z.string().check(z.minLength(1)),
|
|
82
|
+
secret: z.string().check(z.minLength(1)),
|
|
83
|
+
host: z.url(),
|
|
84
|
+
user: z.union([z.string(), z.number()]),
|
|
85
|
+
cbdExpiration: z.optional(z.number()),
|
|
86
|
+
shopId: z.optional(z.number())
|
|
88
87
|
});
|
|
88
|
+
const emptyString = z.string().check(z.refine((val) => val === "", {
|
|
89
|
+
error: "Expected boolean, received string"
|
|
90
|
+
}));
|
|
89
91
|
const ShopConfigSchema = z.object({
|
|
90
|
-
idp:
|
|
92
|
+
idp: z.optional(IdpSchema),
|
|
91
93
|
shopId: z.number(),
|
|
92
|
-
path: z.
|
|
93
|
-
domain: z.
|
|
94
|
+
path: z.optional(z.union([z.string(), z.array(z.string())])),
|
|
95
|
+
domain: z.optional(z.string()),
|
|
94
96
|
locale: z.string(),
|
|
95
97
|
auth: z.object({
|
|
96
98
|
resetPasswordUrl: z.string()
|
|
97
99
|
}),
|
|
98
100
|
currency: z.string(),
|
|
99
101
|
checkout: CheckoutShopConfigSchema,
|
|
100
|
-
appKeys:
|
|
101
|
-
currencyFractionDigits: z.
|
|
102
|
-
isEnabled: z.
|
|
103
|
-
sessionConfig:
|
|
104
|
-
sapi:
|
|
102
|
+
appKeys: z.optional(AppKeysSchema),
|
|
103
|
+
currencyFractionDigits: z.optional(z.number()),
|
|
104
|
+
isEnabled: z.optional(z.boolean()),
|
|
105
|
+
sessionConfig: z.optional(SessionSchema),
|
|
106
|
+
sapi: z.optional(SapiSchema),
|
|
105
107
|
/** @deprecated The `storage` option within `shopConfig` is deprecated. Consider using nuxt storage configuration instead. */
|
|
106
|
-
storage: z.object({
|
|
107
|
-
session:
|
|
108
|
-
cache:
|
|
109
|
-
})
|
|
110
|
-
isDefault: z.
|
|
108
|
+
storage: z.optional(z.object({
|
|
109
|
+
session: z.optional(StorageSchema),
|
|
110
|
+
cache: z.optional(StorageSchema)
|
|
111
|
+
})),
|
|
112
|
+
isDefault: z.optional(z.union([z.boolean(), emptyString]))
|
|
111
113
|
});
|
|
112
114
|
const CacheSchema = z.object({
|
|
113
|
-
auth: z.object({
|
|
115
|
+
auth: z.optional(z.object({
|
|
114
116
|
username: z.string(),
|
|
115
117
|
password: z.string()
|
|
116
|
-
})
|
|
117
|
-
enabled: z.
|
|
118
|
+
})),
|
|
119
|
+
enabled: z.optional(z.boolean())
|
|
118
120
|
});
|
|
119
121
|
const ShopSelectorSchema = z.enum(["path", "domain", "path_or_default"]);
|
|
120
122
|
const StorefrontConfigSchema = z.object({
|
|
121
|
-
session:
|
|
123
|
+
session: z.optional(SessionSchema),
|
|
122
124
|
/** @deprecated The `storage` option within `storefront` is deprecated. Consider using nuxt storage configuration instead. */
|
|
123
|
-
storage: z.object({
|
|
124
|
-
session:
|
|
125
|
-
cache:
|
|
126
|
-
})
|
|
125
|
+
storage: z.optional(z.object({
|
|
126
|
+
session: z.optional(StorageSchema),
|
|
127
|
+
cache: z.optional(StorageSchema)
|
|
128
|
+
})),
|
|
127
129
|
oauth: OAuthSchema,
|
|
128
130
|
appKeys: AppKeysSchema,
|
|
129
|
-
apiBasePath: z.
|
|
130
|
-
cache:
|
|
131
|
-
publicShopData: z.array(z.string())
|
|
132
|
-
idp:
|
|
131
|
+
apiBasePath: z.optional(z.string()),
|
|
132
|
+
cache: z.optional(CacheSchema),
|
|
133
|
+
publicShopData: z.optional(z.array(z.string())),
|
|
134
|
+
idp: z.optional(IdpSchema),
|
|
133
135
|
sapi: SapiSchema,
|
|
134
136
|
/** Collection of feature flags regarding legacy features and functionalities */
|
|
135
|
-
legacy:
|
|
137
|
+
legacy: z.optional(LegacySchema),
|
|
136
138
|
/** Undocumented property intended for internal usage only */
|
|
137
|
-
internalAccessHeader: z.
|
|
139
|
+
internalAccessHeader: z.optional(z.string())
|
|
138
140
|
});
|
|
139
141
|
const ModuleOptionSchema = z.object(
|
|
140
142
|
{
|
|
141
143
|
shopSelector: ShopSelectorSchema,
|
|
142
|
-
redirects:
|
|
143
|
-
shops: z.record(ShopConfigSchema)
|
|
144
|
+
redirects: z.optional(RedirectsSchema),
|
|
145
|
+
shops: z.record(z.string(), ShopConfigSchema)
|
|
144
146
|
}
|
|
145
147
|
);
|
|
146
|
-
const logLevel = z.enum([
|
|
148
|
+
const logLevel = z.enum([
|
|
149
|
+
"debug",
|
|
150
|
+
"info",
|
|
151
|
+
"warn",
|
|
152
|
+
"error"
|
|
153
|
+
]);
|
|
147
154
|
const PublicRuntimeConfigSchema = z.object({
|
|
148
155
|
log: z.object({
|
|
149
156
|
name: z.string(),
|
|
150
157
|
level: logLevel,
|
|
151
|
-
json: z.
|
|
152
|
-
output: z.enum(["stdout", "stderr", "auto"])
|
|
158
|
+
json: z.optional(z.boolean()),
|
|
159
|
+
output: z._default(z.enum(["stdout", "stderr", "auto"]), "auto")
|
|
153
160
|
}),
|
|
154
161
|
/** Collection of feature flags regarding legacy features and functionalities */
|
|
155
|
-
legacy: z.object({
|
|
156
|
-
enableDefaultGetCachedDataOverride: z.
|
|
157
|
-
})
|
|
162
|
+
legacy: z.optional(z.object({
|
|
163
|
+
enableDefaultGetCachedDataOverride: z.optional(z.boolean())
|
|
164
|
+
}))
|
|
158
165
|
});
|
|
159
166
|
export const RuntimeConfigSchema = z.object({
|
|
160
167
|
storefront: z.intersection(ModuleOptionSchema, StorefrontConfigSchema),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "8.
|
|
4
|
+
"version": "8.35.0",
|
|
5
5
|
"description": "Nuxt integration for the SCAYLE Commerce Engine and Storefront API",
|
|
6
6
|
"author": "SCAYLE Commerce Engine",
|
|
7
7
|
"license": "MIT",
|
|
@@ -89,35 +89,36 @@
|
|
|
89
89
|
"unstorage": "^1.10.2",
|
|
90
90
|
"utility-types": "^3.11.0",
|
|
91
91
|
"vue-router": "^4.4.0",
|
|
92
|
-
"zod": "^
|
|
93
|
-
"@scayle/storefront-core": "8.
|
|
92
|
+
"zod": "^4.0.0",
|
|
93
|
+
"@scayle/storefront-core": "8.35.0",
|
|
94
94
|
"@scayle/unstorage-compression-driver": "1.0.0"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
97
|
"@arethetypeswrong/cli": "0.18.2",
|
|
98
98
|
"@eslint/eslintrc": "3.3.1",
|
|
99
99
|
"@nuxt/eslint": "1.5.2",
|
|
100
|
-
"@nuxt/
|
|
100
|
+
"@nuxt/eslint-config": "1.4.1",
|
|
101
|
+
"@nuxt/kit": "3.17.7",
|
|
101
102
|
"@nuxt/module-builder": "1.0.1",
|
|
102
|
-
"@nuxt/schema": "3.
|
|
103
|
+
"@nuxt/schema": "3.17.7",
|
|
103
104
|
"@nuxt/test-utils": "3.19.2",
|
|
104
|
-
"@types/node": "22.16.
|
|
105
|
+
"@types/node": "22.16.4",
|
|
105
106
|
"@vitest/coverage-v8": "3.2.4",
|
|
106
107
|
"dprint": "0.50.1",
|
|
107
108
|
"eslint-formatter-gitlab": "6.0.1",
|
|
108
|
-
"eslint": "9.
|
|
109
|
+
"eslint": "9.31.0",
|
|
109
110
|
"fishery": "2.3.1",
|
|
110
111
|
"h3": "1.15.3",
|
|
111
112
|
"nitro-test-utils": "0.9.2",
|
|
112
113
|
"nitropack": "2.11.13",
|
|
113
114
|
"node-mocks-http": "1.17.2",
|
|
114
|
-
"nuxt": "3.
|
|
115
|
+
"nuxt": "3.17.7",
|
|
115
116
|
"publint": "0.3.12",
|
|
116
117
|
"typescript": "5.8.3",
|
|
117
118
|
"unbuild": "3.5.0",
|
|
118
119
|
"vitest": "3.2.4",
|
|
119
120
|
"vue-tsc": "3.0.1",
|
|
120
|
-
"@scayle/eslint-config-storefront": "4.
|
|
121
|
+
"@scayle/eslint-config-storefront": "4.6.1",
|
|
121
122
|
"@scayle/eslint-plugin-vue-composable": "0.2.1",
|
|
122
123
|
"@scayle/unstorage-scayle-kv-driver": "1.0.2"
|
|
123
124
|
},
|