@scayle/storefront-core 7.28.2 → 7.30.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,17 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 7.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Allow `null` values for `promotionId` within the basket payload
|
|
8
|
+
|
|
9
|
+
## 7.29.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- Remove basic `gzip` compression in custom `unstorage` caching interface in favor of custom `@scayle/unstorage-compression-driver`
|
|
14
|
+
|
|
3
15
|
## 7.28.2
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/api/oauth.d.ts
CHANGED
|
@@ -16,19 +16,19 @@ export declare class OAuthClient {
|
|
|
16
16
|
* Register a user and retrieve a token set
|
|
17
17
|
* @param payload
|
|
18
18
|
*/
|
|
19
|
-
register(payload: RegisterRequest): Oauth
|
|
19
|
+
register(payload: RegisterRequest): Promise<Oauth>;
|
|
20
20
|
/**
|
|
21
21
|
* Execute a user login on the OAuth API and receive a token set
|
|
22
22
|
* @param payload
|
|
23
23
|
*/
|
|
24
24
|
login(payload: LoginRequest & {
|
|
25
25
|
shopId: string;
|
|
26
|
-
}): Oauth
|
|
26
|
+
}): Promise<Oauth>;
|
|
27
27
|
/**
|
|
28
28
|
* Execute a guest user login on the OAuth API and receive a token set
|
|
29
29
|
* @param payload
|
|
30
30
|
*/
|
|
31
|
-
guestLogin(payload: GuestRequest): Oauth
|
|
31
|
+
guestLogin(payload: GuestRequest): Promise<Oauth>;
|
|
32
32
|
/**
|
|
33
33
|
* Send a password reset email
|
|
34
34
|
* @param payload
|
|
@@ -38,7 +38,7 @@ export declare class OAuthClient {
|
|
|
38
38
|
* Update password by hash
|
|
39
39
|
* @param payload
|
|
40
40
|
*/
|
|
41
|
-
updatePasswordByHash(payload: UpdatePasswordByHashRequest): Oauth
|
|
41
|
+
updatePasswordByHash(payload: UpdatePasswordByHashRequest): Promise<Oauth>;
|
|
42
42
|
/**
|
|
43
43
|
* Generate a new access token via a refresh token
|
|
44
44
|
* @param payload
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.UnstorageCache = void 0;
|
|
7
|
-
var _compression = require("../../utils/compression.cjs");
|
|
8
7
|
class UnstorageCache {
|
|
9
8
|
storage;
|
|
10
9
|
prefix;
|
|
@@ -17,7 +16,7 @@ class UnstorageCache {
|
|
|
17
16
|
if (value === null) {
|
|
18
17
|
return null;
|
|
19
18
|
}
|
|
20
|
-
return
|
|
19
|
+
return value;
|
|
21
20
|
}
|
|
22
21
|
async has(key) {
|
|
23
22
|
return await this.storage.hasItem(this.getKey(key));
|
|
@@ -38,8 +37,7 @@ class UnstorageCache {
|
|
|
38
37
|
await Promise.all(keys.map(k => this.storage.removeItem(k)));
|
|
39
38
|
}
|
|
40
39
|
async set(key, value, ttl, tags = []) {
|
|
41
|
-
|
|
42
|
-
await this.storage.setItem(this.getKey(key), _value, {
|
|
40
|
+
await this.storage.setItem(this.getKey(key), value, {
|
|
43
41
|
ttl
|
|
44
42
|
});
|
|
45
43
|
await Promise.all(tags.map(tag => this.addKeyToTag(tag, this.getKey(key))));
|
|
@@ -53,26 +51,5 @@ class UnstorageCache {
|
|
|
53
51
|
getKey(key) {
|
|
54
52
|
return [this.prefix, key].join(":");
|
|
55
53
|
}
|
|
56
|
-
/**
|
|
57
|
-
* First iteration copied from `packages/storefront-core/src/cache/providers/redis.ts`
|
|
58
|
-
* @param value String to be deserialized and decompressed
|
|
59
|
-
*/
|
|
60
|
-
async deserialize(value) {
|
|
61
|
-
try {
|
|
62
|
-
const data = await (0, _compression.decompress)(value);
|
|
63
|
-
return JSON.parse(data);
|
|
64
|
-
} catch (error) {
|
|
65
|
-
console.warn("UnstorageCache: Unable to decompress data", error);
|
|
66
|
-
return value;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* First iteration copied from `packages/storefront-core/src/cache/providers/redis.ts`
|
|
71
|
-
* @param value String to be deserialized and decompressed
|
|
72
|
-
*/
|
|
73
|
-
async serialize(value) {
|
|
74
|
-
const data = JSON.stringify(value);
|
|
75
|
-
return await (0, _compression.compress)(data);
|
|
76
|
-
}
|
|
77
54
|
}
|
|
78
55
|
exports.UnstorageCache = UnstorageCache;
|
|
@@ -13,14 +13,4 @@ export declare class UnstorageCache implements CacheInterface {
|
|
|
13
13
|
set(key: string, value: any, ttl: number, tags?: string[]): Promise<void>;
|
|
14
14
|
private addKeyToTag;
|
|
15
15
|
private getKey;
|
|
16
|
-
/**
|
|
17
|
-
* First iteration copied from `packages/storefront-core/src/cache/providers/redis.ts`
|
|
18
|
-
* @param value String to be deserialized and decompressed
|
|
19
|
-
*/
|
|
20
|
-
private deserialize;
|
|
21
|
-
/**
|
|
22
|
-
* First iteration copied from `packages/storefront-core/src/cache/providers/redis.ts`
|
|
23
|
-
* @param value String to be deserialized and decompressed
|
|
24
|
-
*/
|
|
25
|
-
private serialize;
|
|
26
16
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { compress, decompress } from "../../utils/compression.mjs";
|
|
2
1
|
export class UnstorageCache {
|
|
3
2
|
storage;
|
|
4
3
|
prefix;
|
|
@@ -11,7 +10,7 @@ export class UnstorageCache {
|
|
|
11
10
|
if (value === null) {
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
14
|
-
return
|
|
13
|
+
return value;
|
|
15
14
|
}
|
|
16
15
|
async has(key) {
|
|
17
16
|
return await this.storage.hasItem(this.getKey(key));
|
|
@@ -32,8 +31,7 @@ export class UnstorageCache {
|
|
|
32
31
|
await Promise.all(keys.map((k) => this.storage.removeItem(k)));
|
|
33
32
|
}
|
|
34
33
|
async set(key, value, ttl, tags = []) {
|
|
35
|
-
|
|
36
|
-
await this.storage.setItem(this.getKey(key), _value, { ttl });
|
|
34
|
+
await this.storage.setItem(this.getKey(key), value, { ttl });
|
|
37
35
|
await Promise.all(
|
|
38
36
|
tags.map((tag) => this.addKeyToTag(tag, this.getKey(key)))
|
|
39
37
|
);
|
|
@@ -47,25 +45,4 @@ export class UnstorageCache {
|
|
|
47
45
|
getKey(key) {
|
|
48
46
|
return [this.prefix, key].join(":");
|
|
49
47
|
}
|
|
50
|
-
/**
|
|
51
|
-
* First iteration copied from `packages/storefront-core/src/cache/providers/redis.ts`
|
|
52
|
-
* @param value String to be deserialized and decompressed
|
|
53
|
-
*/
|
|
54
|
-
async deserialize(value) {
|
|
55
|
-
try {
|
|
56
|
-
const data = await decompress(value);
|
|
57
|
-
return JSON.parse(data);
|
|
58
|
-
} catch (error) {
|
|
59
|
-
console.warn("UnstorageCache: Unable to decompress data", error);
|
|
60
|
-
return value;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* First iteration copied from `packages/storefront-core/src/cache/providers/redis.ts`
|
|
65
|
-
* @param value String to be deserialized and decompressed
|
|
66
|
-
*/
|
|
67
|
-
async serialize(value) {
|
|
68
|
-
const data = JSON.stringify(value);
|
|
69
|
-
return await compress(data);
|
|
70
|
-
}
|
|
71
48
|
}
|
|
@@ -13,7 +13,7 @@ export type AddOrUpdateItemType = {
|
|
|
13
13
|
};
|
|
14
14
|
itemGroup?: ItemGroup;
|
|
15
15
|
includeItemsWithoutProductData?: boolean;
|
|
16
|
-
promotionId?: string;
|
|
16
|
+
promotionId?: string | null;
|
|
17
17
|
};
|
|
18
18
|
export interface BasketWithOptions extends BasketWith {
|
|
19
19
|
pricePromotionKey?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.30.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"utility-types": "^3.10.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@scayle/eslint-config-storefront": "3.2.
|
|
69
|
+
"@scayle/eslint-config-storefront": "3.2.6",
|
|
70
70
|
"@scayle/prettier-config-storefront": "2.0.2",
|
|
71
71
|
"@types/crypto-js": "4.2.1",
|
|
72
72
|
"@types/jest": "29.5.11",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"publint": "0.2.6",
|
|
82
82
|
"rimraf": "5.0.5",
|
|
83
83
|
"ts-jest": "29.1.1",
|
|
84
|
-
"ts-node": "10.9.
|
|
84
|
+
"ts-node": "10.9.2",
|
|
85
85
|
"typescript": "5.3.3",
|
|
86
86
|
"unstorage": "1.10.1"
|
|
87
87
|
},
|