@akinon/next 1.95.0-snapshot-ZERO-3586-20250901132537 → 1.95.0-snapshot-ZERO-3586-20250901142729
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 +5 -5
- package/api/cache.ts +0 -2
- package/data/server/category.ts +1 -1
- package/lib/cache-handler.mjs +55 -18
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
-
## 1.95.0-snapshot-ZERO-3586-
|
|
3
|
+
## 1.95.0-snapshot-ZERO-3586-20250901142729
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- 5dfeea04: ZERO-2801: Revert ZERO-2801
|
|
8
8
|
- 823d82f9: ZERO-3393: Enhance error handling in checkout middleware to ensure errors are checked for existence before processing
|
|
9
9
|
- 412f0e2: ZERO-3586: Enhance caching functionality by adding support for compressed data storage and retrieval, along with a new method for setting multiple key-value pairs.
|
|
10
10
|
- 28c7ea79: ZERO-3427: Refactor redirect utility to handle undefined URL and improve locale handling
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
- d8be48fb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
|
|
19
19
|
- b55acb76: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
|
|
20
20
|
- f49bb74f: ZERO-3097: Add setCookie to logging in payment redirection middlewares
|
|
21
|
-
-
|
|
21
|
+
- 0ad91bbd: ZERO-3489: Improve error handling in data fetching across multiple pages and server functions
|
|
22
22
|
- 143be2b9: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
|
|
23
23
|
- e9541a13d: ZERO-2816: Add headers to url
|
|
24
24
|
- 9b7d0de6: ZERO-3393: Improve error handling in checkout middleware to support both object and array error formats
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
- 64699d3ff: ZERO-2761: Fix invalid import for plugin module
|
|
30
30
|
- 9f8cd3bc: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
|
|
31
31
|
- e974d8e8: ZERO-3406: Fix rc build
|
|
32
|
-
-
|
|
32
|
+
- 89ce46fc: ZERO-3493: return 404 status code for pz-not-found pages
|
|
33
33
|
- 8645d90: ZERO-3574:Refactor redirect tests: streamline mock setup, enhance locale handling, and improve URL path resolution logic
|
|
34
34
|
- 7eb51ca9: ZERO-3424 :Update package versions
|
|
35
35
|
- 7727ae55: ZERO-3073: Refactor basket page to use server-side data fetching and simplify component structure
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
- 4920742c2: Disable getCachedTranslations
|
|
44
44
|
- b6e5b624: ZERO-3257: Enhance locale middleware to redirect using existing or default locale and support 303 status for POST requests
|
|
45
45
|
- 0de55738: ZERO-3418: Update remotePatterns hostname to allow all subdomains
|
|
46
|
-
-
|
|
46
|
+
- 7e56d6b6: ZERO-2841: Update api tagTypes
|
|
47
47
|
- d99a6a7d: ZERO-3457: Fixed the settings prop and made sure everything is customizable.
|
|
48
48
|
- 9dc7298a: ZERO-3416: Refactor Accordion component to enhance props and improve styling flexibility
|
|
49
49
|
- 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
|
package/api/cache.ts
CHANGED
|
@@ -38,7 +38,6 @@ async function handleRequest(...args) {
|
|
|
38
38
|
|
|
39
39
|
try {
|
|
40
40
|
if (req.method === 'POST') {
|
|
41
|
-
// GET request - check if compressed flag is set
|
|
42
41
|
if (compressed === 'true') {
|
|
43
42
|
response = await Cache.getCompressed(key);
|
|
44
43
|
} else {
|
|
@@ -64,7 +63,6 @@ async function handleRequest(...args) {
|
|
|
64
63
|
);
|
|
65
64
|
}
|
|
66
65
|
} else {
|
|
67
|
-
// SET request - check if compressed flag is set
|
|
68
66
|
if (compressed === 'true') {
|
|
69
67
|
response = await Cache.setCompressed(key, value, expire);
|
|
70
68
|
} else {
|
package/data/server/category.ts
CHANGED
package/lib/cache-handler.mjs
CHANGED
|
@@ -2,15 +2,21 @@ import { CacheHandler } from '@neshca/cache-handler';
|
|
|
2
2
|
import createLruHandler from '@neshca/cache-handler/local-lru';
|
|
3
3
|
import createRedisHandler from '@neshca/cache-handler/redis-strings';
|
|
4
4
|
import { createClient } from 'redis';
|
|
5
|
-
import * as zstdWasm from '@bokuweb/zstd-wasm';
|
|
6
5
|
|
|
7
6
|
let zstd;
|
|
8
7
|
|
|
9
8
|
(async () => {
|
|
10
9
|
try {
|
|
11
|
-
await
|
|
12
|
-
zstd =
|
|
10
|
+
const { compress, decompress } = await import('@mongodb-js/zstd');
|
|
11
|
+
zstd = { compress, decompress, type: 'native' };
|
|
12
|
+
console.warn(
|
|
13
|
+
'[Cache Handler] ✅ Native @mongodb-js/zstd loaded successfully'
|
|
14
|
+
);
|
|
13
15
|
} catch (error) {
|
|
16
|
+
console.warn(
|
|
17
|
+
'[Cache Handler] ❌ @mongodb-js/zstd failed to load, fallback to uncompressed:',
|
|
18
|
+
error.message
|
|
19
|
+
);
|
|
14
20
|
zstd = false;
|
|
15
21
|
}
|
|
16
22
|
})();
|
|
@@ -41,10 +47,16 @@ const compressValue = async (value) => {
|
|
|
41
47
|
let compressed;
|
|
42
48
|
|
|
43
49
|
if (zstdLib && zstdLib !== false) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
50
|
+
const inputBuffer = Buffer.from(serializedNestedValue, 'utf8');
|
|
51
|
+
|
|
52
|
+
if (
|
|
53
|
+
typeof zstdLib.compress === 'function' &&
|
|
54
|
+
zstdLib.compress.constructor.name === 'AsyncFunction'
|
|
55
|
+
) {
|
|
56
|
+
compressed = await zstdLib.compress(inputBuffer, 3);
|
|
57
|
+
} else {
|
|
58
|
+
compressed = zstdLib.compress(inputBuffer, 3);
|
|
59
|
+
}
|
|
48
60
|
} else {
|
|
49
61
|
return {
|
|
50
62
|
...value,
|
|
@@ -123,7 +135,16 @@ const compressValue = async (value) => {
|
|
|
123
135
|
let compressed;
|
|
124
136
|
|
|
125
137
|
if (zstdLib && zstdLib !== false) {
|
|
126
|
-
|
|
138
|
+
const inputBuffer = Buffer.from(serializedValue, 'utf8');
|
|
139
|
+
|
|
140
|
+
if (
|
|
141
|
+
typeof zstdLib.compress === 'function' &&
|
|
142
|
+
zstdLib.compress.constructor.name === 'AsyncFunction'
|
|
143
|
+
) {
|
|
144
|
+
compressed = await zstdLib.compress(inputBuffer, 3);
|
|
145
|
+
} else {
|
|
146
|
+
compressed = zstdLib.compress(inputBuffer, 3);
|
|
147
|
+
}
|
|
127
148
|
} else {
|
|
128
149
|
if (
|
|
129
150
|
value &&
|
|
@@ -186,14 +207,22 @@ const decompressValue = async (compressedData) => {
|
|
|
186
207
|
if (compressedNestedValue.__method === 'zstd') {
|
|
187
208
|
const zstdLib = getZstd();
|
|
188
209
|
if (zstdLib && zstdLib !== false) {
|
|
189
|
-
|
|
210
|
+
if (
|
|
211
|
+
typeof zstdLib.decompress === 'function' &&
|
|
212
|
+
zstdLib.decompress.constructor.name === 'AsyncFunction'
|
|
213
|
+
) {
|
|
214
|
+
const decompressedBuffer = await zstdLib.decompress(
|
|
215
|
+
compressedBuffer
|
|
216
|
+
);
|
|
217
|
+
decompressed = decompressedBuffer.toString('utf8');
|
|
218
|
+
} else {
|
|
219
|
+
decompressed = zstdLib
|
|
220
|
+
.decompress(compressedBuffer)
|
|
221
|
+
.toString('utf8');
|
|
222
|
+
}
|
|
190
223
|
} else {
|
|
191
224
|
throw new Error('zstd not available for decompression');
|
|
192
225
|
}
|
|
193
|
-
} else {
|
|
194
|
-
throw new Error(
|
|
195
|
-
'gzip decompression no longer supported - please invalidate cache'
|
|
196
|
-
);
|
|
197
226
|
}
|
|
198
227
|
|
|
199
228
|
return {
|
|
@@ -213,14 +242,22 @@ const decompressValue = async (compressedData) => {
|
|
|
213
242
|
if (compressedData.__method === 'zstd') {
|
|
214
243
|
const zstdLib = getZstd();
|
|
215
244
|
if (zstdLib && zstdLib !== false) {
|
|
216
|
-
|
|
245
|
+
if (
|
|
246
|
+
typeof zstdLib.decompress === 'function' &&
|
|
247
|
+
zstdLib.decompress.constructor.name === 'AsyncFunction'
|
|
248
|
+
) {
|
|
249
|
+
const decompressedBuffer = await zstdLib.decompress(
|
|
250
|
+
compressedBuffer
|
|
251
|
+
);
|
|
252
|
+
decompressed = decompressedBuffer.toString('utf8');
|
|
253
|
+
} else {
|
|
254
|
+
decompressed = zstdLib
|
|
255
|
+
.decompress(compressedBuffer)
|
|
256
|
+
.toString('utf8');
|
|
257
|
+
}
|
|
217
258
|
} else {
|
|
218
259
|
throw new Error('zstd not available for decompression');
|
|
219
260
|
}
|
|
220
|
-
} else {
|
|
221
|
-
throw new Error(
|
|
222
|
-
'gzip decompression no longer supported - please invalidate cache'
|
|
223
|
-
);
|
|
224
261
|
}
|
|
225
262
|
|
|
226
263
|
return JSON.parse(decompressed);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@akinon/next",
|
|
3
3
|
"description": "Core package for Project Zero Next",
|
|
4
|
-
"version": "1.95.0-snapshot-ZERO-3586-
|
|
4
|
+
"version": "1.95.0-snapshot-ZERO-3586-20250901142729",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"test": "jest"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@
|
|
20
|
+
"@mongodb-js/zstd": "^2.0.1",
|
|
21
21
|
"@neshca/cache-handler": "1.9.0",
|
|
22
22
|
"@opentelemetry/exporter-trace-otlp-http": "0.46.0",
|
|
23
23
|
"@opentelemetry/resources": "1.19.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"set-cookie-parser": "2.6.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@akinon/eslint-plugin-projectzero": "1.95.0-snapshot-ZERO-3586-
|
|
38
|
+
"@akinon/eslint-plugin-projectzero": "1.95.0-snapshot-ZERO-3586-20250901142729",
|
|
39
39
|
"@babel/core": "7.26.10",
|
|
40
40
|
"@babel/preset-env": "7.26.9",
|
|
41
41
|
"@babel/preset-typescript": "7.27.0",
|