@scayle/storefront-nuxt 7.72.4 → 7.73.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 +19 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/module.d.mts +5 -4
- package/dist/module.d.ts +5 -4
- package/dist/module.json +1 -1
- package/dist/module.mjs +16 -7
- package/dist/rpc.d.mts +2 -1
- package/dist/rpc.d.ts +2 -1
- package/dist/runtime/nitro/plugins/configValidation.d.ts +1 -0
- package/dist/runtime/nitro/plugins/configValidation.mjs +44 -9
- package/dist/runtime/server/middleware/bootstrap.mjs +8 -3
- package/dist/runtime/server/middleware/bootstrap.utils.d.ts +4 -3
- package/dist/runtime/server/middleware/bootstrap.utils.mjs +20 -12
- package/dist/runtime/utils/zodSchema.d.ts +1954 -652
- package/dist/runtime/utils/zodSchema.mjs +77 -35
- package/dist/shared/storefront-nuxt.d9a4c377.d.mts +1135 -0
- package/dist/shared/storefront-nuxt.d9a4c377.d.ts +1135 -0
- package/dist/types.d.mts +2 -6
- package/dist/types.d.ts +2 -6
- package/package.json +4 -3
- package/dist/shared/storefront-nuxt.20d8641a.d.mts +0 -185
- package/dist/shared/storefront-nuxt.20d8641a.d.ts +0 -185
|
@@ -1,15 +1,44 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { HashAlgorithm } from "@scayle/storefront-core";
|
|
3
3
|
import { builtinDrivers } from "unstorage";
|
|
4
|
-
const RedirectsSchema = z.object({
|
|
4
|
+
export const RedirectsSchema = z.object({
|
|
5
5
|
enabled: z.boolean(),
|
|
6
6
|
queryParamWhitelist: z.array(z.string()).optional()
|
|
7
7
|
});
|
|
8
|
+
const RedisConfigSchema = z.object({
|
|
9
|
+
port: z.number().optional(),
|
|
10
|
+
host: z.string().optional(),
|
|
11
|
+
prefix: z.string().optional(),
|
|
12
|
+
sslTransit: z.boolean().optional()
|
|
13
|
+
}).or(z.object({
|
|
14
|
+
port: z.number().optional(),
|
|
15
|
+
host: z.string().optional(),
|
|
16
|
+
prefix: z.string().optional(),
|
|
17
|
+
sslTransit: z.boolean().optional(),
|
|
18
|
+
user: z.string(),
|
|
19
|
+
password: z.string()
|
|
20
|
+
}));
|
|
8
21
|
const SessionSchema = z.object({
|
|
22
|
+
/**
|
|
23
|
+
* The sameSite policy to use for the session cookie
|
|
24
|
+
*/
|
|
9
25
|
sameSite: z.enum(["lax", "strict", "none"]).optional(),
|
|
26
|
+
/**
|
|
27
|
+
* The default maxAge (in seconds) set on the session cookie and default TTL for session store
|
|
28
|
+
*/
|
|
10
29
|
maxAge: z.number().optional(),
|
|
30
|
+
/**
|
|
31
|
+
* The name used for the session cookie
|
|
32
|
+
*/
|
|
11
33
|
cookieName: z.string().optional(),
|
|
12
|
-
|
|
34
|
+
/**
|
|
35
|
+
* The secret used for signing session cookies. If an array is passed, the last
|
|
36
|
+
* value is used for signing new cookies, but all values are used to verify cookies.
|
|
37
|
+
*/
|
|
38
|
+
secret: z.string().or(z.array(z.string())).optional(),
|
|
39
|
+
/**
|
|
40
|
+
* Controls the domain option on the session cookie
|
|
41
|
+
*/
|
|
13
42
|
domain: z.string().optional()
|
|
14
43
|
});
|
|
15
44
|
const BapiSchema = z.object({
|
|
@@ -47,7 +76,14 @@ const AppKeysSchema = z.object(
|
|
|
47
76
|
hashAlgorithm: z.enum(hashValues)
|
|
48
77
|
}
|
|
49
78
|
);
|
|
50
|
-
const
|
|
79
|
+
const CheckoutShopConfigSchema = z.object({
|
|
80
|
+
token: z.string().min(1),
|
|
81
|
+
secret: z.string().min(1),
|
|
82
|
+
host: z.string().url(),
|
|
83
|
+
user: z.string().or(z.number()),
|
|
84
|
+
cbdExpiration: z.number().optional()
|
|
85
|
+
});
|
|
86
|
+
const ShopConfigSchema = z.object({
|
|
51
87
|
idp: IdpSchema.optional(),
|
|
52
88
|
shopId: z.number(),
|
|
53
89
|
path: z.string().optional(),
|
|
@@ -59,23 +95,20 @@ const ShopConfigSchema = z.record(z.object({
|
|
|
59
95
|
}),
|
|
60
96
|
storeCampaignKeyword: z.string().optional(),
|
|
61
97
|
currency: z.string(),
|
|
62
|
-
checkout:
|
|
63
|
-
token: z.string().min(1),
|
|
64
|
-
secret: z.string().min(1),
|
|
65
|
-
host: z.string().url(),
|
|
66
|
-
user: z.string().or(z.number()),
|
|
67
|
-
cbdExpiration: z.number().optional()
|
|
68
|
-
}),
|
|
98
|
+
checkout: CheckoutShopConfigSchema,
|
|
69
99
|
appKeys: AppKeysSchema.optional(),
|
|
70
|
-
currencyFractionDigits: z.
|
|
100
|
+
currencyFractionDigits: z.number().optional(),
|
|
71
101
|
isEnabled: z.boolean().optional(),
|
|
72
102
|
sessionConfig: SessionSchema.optional(),
|
|
73
103
|
bapi: BapiSchema.optional(),
|
|
74
104
|
storage: z.object({
|
|
75
|
-
session: StorageSchema,
|
|
76
|
-
cache: StorageSchema
|
|
77
|
-
}).optional()
|
|
78
|
-
|
|
105
|
+
session: StorageSchema.optional(),
|
|
106
|
+
cache: StorageSchema.optional()
|
|
107
|
+
}).optional(),
|
|
108
|
+
isDefault: z.boolean().optional(),
|
|
109
|
+
/** @deprecated shop-specific storefront.redis config is being removed in favor of global nitro.storage config */
|
|
110
|
+
redis: RedisConfigSchema.optional()
|
|
111
|
+
});
|
|
79
112
|
const CacheSchema = z.object({
|
|
80
113
|
auth: z.object({
|
|
81
114
|
username: z.string().min(1),
|
|
@@ -83,31 +116,40 @@ const CacheSchema = z.object({
|
|
|
83
116
|
}),
|
|
84
117
|
enabled: z.boolean()
|
|
85
118
|
});
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
redirects: RedirectsSchema.optional(),
|
|
119
|
+
const ShopSelectorSchema = z.enum(["path", "domain", "path_or_default"]);
|
|
120
|
+
const StorefrontConfigSchema = z.object({
|
|
89
121
|
session: SessionSchema.optional(),
|
|
90
122
|
bapi: BapiSchema,
|
|
91
|
-
oauth: OAuthSchema,
|
|
92
|
-
idp: IdpSchema.optional(),
|
|
93
|
-
shopSelector: z.enum(["path", "domain", "path_or_default"]),
|
|
94
|
-
stores: ShopConfigSchema,
|
|
95
123
|
storage: z.object({
|
|
96
|
-
session: StorageSchema,
|
|
97
|
-
cache: StorageSchema
|
|
98
|
-
}),
|
|
124
|
+
session: StorageSchema.optional(),
|
|
125
|
+
cache: StorageSchema.optional()
|
|
126
|
+
}).optional(),
|
|
127
|
+
oauth: OAuthSchema,
|
|
128
|
+
appKeys: AppKeysSchema,
|
|
129
|
+
apiBasePath: z.string().optional(),
|
|
99
130
|
cache: CacheSchema.optional(),
|
|
100
|
-
|
|
131
|
+
publicShopData: z.array(z.string()).optional(),
|
|
132
|
+
idp: IdpSchema.optional(),
|
|
133
|
+
/** @deprecated Global storefront.redis config is being removed in favor of `storefront.storage` config */
|
|
134
|
+
redis: RedisConfigSchema.optional()
|
|
101
135
|
});
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
136
|
+
const ModuleOptionSchema = z.object(
|
|
137
|
+
{
|
|
138
|
+
shopSelector: ShopSelectorSchema,
|
|
139
|
+
stores: z.record(ShopConfigSchema),
|
|
140
|
+
redirects: RedirectsSchema.optional()
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
const logLevel = z.enum(["debug", "info", "warn", "error"]);
|
|
144
|
+
const PublicRuntimeConfigSchema = z.object({
|
|
145
|
+
log: z.object({
|
|
146
|
+
name: z.string(),
|
|
147
|
+
level: logLevel
|
|
108
148
|
})
|
|
109
149
|
});
|
|
110
|
-
export const
|
|
111
|
-
storefront:
|
|
112
|
-
public:
|
|
150
|
+
export const RuntimeConfigSchema = z.object({
|
|
151
|
+
storefront: z.union([StorefrontConfigSchema, ModuleOptionSchema]),
|
|
152
|
+
public: z.object({
|
|
153
|
+
storefront: PublicRuntimeConfigSchema
|
|
154
|
+
})
|
|
113
155
|
});
|