@akinon/next 1.93.0-rc.47 → 1.93.0-rc.49
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 +88 -0
- package/lib/cache-handler.mjs +52 -35
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,93 @@
|
|
|
1
1
|
# @akinon/next
|
|
2
2
|
|
|
3
|
+
## 1.93.0-rc.49
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5dfeea04: ZERO-2801: Revert ZERO-2801
|
|
8
|
+
- 823d82f9: ZERO-3393: Enhance error handling in checkout middleware to ensure errors are checked for existence before processing
|
|
9
|
+
- 28c7ea79: ZERO-3427: Refactor redirect utility to handle undefined URL and improve locale handling
|
|
10
|
+
- e1aa030: ZERO-3473: Refactor locale handling to prioritize cookie value for matched locale
|
|
11
|
+
- 6e6b0a9e: ZERO-3422: Add pz-flow-payment package
|
|
12
|
+
- 63774a6a: ZERO-3351: Add commerce redirection ignore list functionality and related utility
|
|
13
|
+
- 2d9b2b2c9: ZERO-2816: Add segment to headers
|
|
14
|
+
- 5e1feca6: Revert "ZERO-3286: Add notFound handling for chunk URLs starting with \_next"
|
|
15
|
+
- 40a46853: ZERO-3182: Optimize basket update mutation with optimistic update
|
|
16
|
+
- 5f7edd6: ZERO-3571: Enhance Jest configuration by adding base directory resolution and module name mapping
|
|
17
|
+
- 68bbcb27: ZERO-3393: Fix error handling in checkout middleware to check for errors array length
|
|
18
|
+
- d8be48fb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
|
|
19
|
+
- b55acb76: ZERO-2577: Fix pagination bug and update usePagination hook and ensure pagination controls rendering correctly
|
|
20
|
+
- f49bb74f: ZERO-3097: Add setCookie to logging in payment redirection middlewares
|
|
21
|
+
- 0ad91bb: ZERO-3489: Improve error handling in data fetching across multiple pages and server functions
|
|
22
|
+
- 143be2b9: ZERO-3457: Crop styles are customizable and logic improved for rendering similar products modal
|
|
23
|
+
- e9541a13d: ZERO-2816: Add headers to url
|
|
24
|
+
- 9b7d0de6: ZERO-3393: Improve error handling in checkout middleware to support both object and array error formats
|
|
25
|
+
- 72fd4d67: ZERO-3084: Fix URL search parameters encoding in default middleware
|
|
26
|
+
- c53ef7b95: ZERO-2668: The Link component has been updated to improve the logic for handling href values. Previously, if the href was not a string or started with 'http', it would return the href as is. Now, if the href is not provided, it will default to '#' to prevent any potential errors. Additionally, if the href is a string and does not start with 'http', it will be formatted with the locale and pathname, based on the localeUrlStrategy and defaultLocaleValue. This ensures that the correct href is generated based on the localization settings.
|
|
27
|
+
- 185396f: ZERO-3569: Refactor logging in cache handler to use console_log instead of logger
|
|
28
|
+
- a8539c8c: ZERO-3439: Enhance locale handling in middleware and redirect utility
|
|
29
|
+
- 16aff54: ZERO-3431: Add test script for redirect utility in package.json
|
|
30
|
+
- 64699d3ff: ZERO-2761: Fix invalid import for plugin module
|
|
31
|
+
- 9f8cd3bc: ZERO-3449: AI Search Active Filters & Crop Style changes have been implemented
|
|
32
|
+
- e974d8e8: ZERO-3406: Fix rc build
|
|
33
|
+
- 89ce46f: ZERO-3493: return 404 status code for pz-not-found pages
|
|
34
|
+
- 7eb51ca9: ZERO-3424 :Update package versions
|
|
35
|
+
- c806fad7: ZERO-3422: Add Flow Payment plugin to the defined plugins list
|
|
36
|
+
- 7727ae55: ZERO-3073: Refactor basket page to use server-side data fetching and simplify component structure
|
|
37
|
+
- 8b1d24eb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
|
|
38
|
+
- d552629f: ZERO-3182: Refactor basketApi to use invalidatesTags and comment out onQueryStarted logic
|
|
39
|
+
- 17f87524e: ZERO-2816: Make the incoming currency lowercase
|
|
40
|
+
- 65d3b862: ZERO-3054: Update headers in appFetch
|
|
41
|
+
- 0abde6bb: ZERO-3422: Update fetch method to use dynamic request method in wallet complete redirection middleware
|
|
42
|
+
- 72ad7bb1: ZERO-3422: Add Flow Payment to the list of available plugins
|
|
43
|
+
- c39c7000: ZERO-3420: Refactor Modal component
|
|
44
|
+
- e7cd3a5e: ZERO-3435: Add Accept-Language to requestHeaders
|
|
45
|
+
- bbe18b9ff: ZERO-2575: Fix build error
|
|
46
|
+
- 17bfadc4: ZERO-3275: Disable OpenTelemetry monitoring in production environment
|
|
47
|
+
- 35dfb8f8: ZERO-3363: Refactor URL handling in checkout and redirection middlewares to use url.origin instead of process.env.NEXT_PUBLIC_URL
|
|
48
|
+
- 4920742c2: Disable getCachedTranslations
|
|
49
|
+
- b6e5b624: ZERO-3257: Enhance locale middleware to redirect using existing or default locale and support 303 status for POST requests
|
|
50
|
+
- 0de55738: ZERO-3418: Update remotePatterns hostname to allow all subdomains
|
|
51
|
+
- 7e56d6b6b: ZERO-2841: Update api tagTypes
|
|
52
|
+
- dfaceffd: ZERO-3356: Add useLoyaltyAvailability hook and update checkout state management
|
|
53
|
+
- 86642cf: ZERO-3531: Add saveSampleProducts endpoint and update URLs in checkout
|
|
54
|
+
- d99a6a7d: ZERO-3457: Fixed the settings prop and made sure everything is customizable.
|
|
55
|
+
- 9dc7298a: ZERO-3416: Refactor Accordion component to enhance props and improve styling flexibility
|
|
56
|
+
- 33377cfd: ZERO-3267: Refactor import statement for ROUTES in error-page component
|
|
57
|
+
- 0bdab12: ZERO-3569: Refactor cache handler to improve Redis connection management and logging
|
|
58
|
+
- 43c182ee: ZERO-3054: Update Redis variable checks to conditionally include CACHE_SECRET
|
|
59
|
+
- c480272: ZERO-3531: Refactor checkoutApi: Remove unnecessary invalidatesTags property from POST request from sample products
|
|
60
|
+
- b00a90b1: ZERO-3436: Preserve query params on redirect
|
|
61
|
+
- facf1ada: ZERO-3445: Add SameSite and Secure attributes
|
|
62
|
+
- 485e8ef: ZERO-3422: Refactor parameter handling in wallet complete redirection middleware to use forEach
|
|
63
|
+
- 26b2d0b: ZERO-3571: Remove test script execution from prebuild and simplify Jest module name mapping
|
|
64
|
+
- eeb20bea: Revert "ZERO-3054: Refactor cache handler to use custom Redis handler and implement key hashing"
|
|
65
|
+
- 99b6e7b9: ZERO-3421: Enhance Sentry error handling by adding network error detection logic and refining initialization options
|
|
66
|
+
- 3bf63c8a: ZERO-3286: Add notFound handling for chunk URLs starting with \_next
|
|
67
|
+
- 9be2c081: ZERO-3243: Improve basket update query handling with optimistic updates
|
|
68
|
+
- f7fd459b: ZERO-3445: Refactor setCookie function to include domain handling and improve cookie string construction
|
|
69
|
+
- 4de5303c: ZERO-2504: add cookie filter to api client request
|
|
70
|
+
- dc678c3: ZERO-3523: Enhance redirect tests with dynamic locale handling and settings integration
|
|
71
|
+
- f2c92d5c7: ZERO-2816: Update cookie name
|
|
72
|
+
- a420947: ZERO-3517: Fix optional chaining for rawData in error logging for category data handlers
|
|
73
|
+
- 7bd3d9928: ZERO-2801: Refactor locale middleware to handle single locale configuration
|
|
74
|
+
- 3e4aadc: ZERO-3569: Fix import statement for logger in cache handler
|
|
75
|
+
- acd2afd: ZERO-3431: Fix import statement for findBaseDir in next-config test
|
|
76
|
+
- 2d3f1788: ZERO-3417: Enhance FileInput component with additional props for customization
|
|
77
|
+
- fdd255ee: ZERO-3054: Refactor cache handler to use custom Redis handler and implement key hashing
|
|
78
|
+
- b434ac8: ZERO-3545: Update fetchCheckout API URL to include page parameter
|
|
79
|
+
- 49eeebfa: ZERO-2909: Add deleteCollectionItem query to wishlistApi
|
|
80
|
+
- 3f9b8d7e7: ZERO-2761: Update plugins.js for akinon-next
|
|
81
|
+
- fee608d: ZERO-3422: Refactor body handling in wallet complete redirection middleware
|
|
82
|
+
- cbdb5c1: ZERO-3448: fix set cookie domain handling for subdomain locale strategy
|
|
83
|
+
- 0e82301: ZERO-3531: Add saveSampleProducts endpoint
|
|
84
|
+
|
|
85
|
+
## 1.93.0-rc.48
|
|
86
|
+
|
|
87
|
+
### Minor Changes
|
|
88
|
+
|
|
89
|
+
- 185396f: ZERO-3569: Refactor logging in cache handler to use console_log instead of logger
|
|
90
|
+
|
|
3
91
|
## 1.93.0-rc.47
|
|
4
92
|
|
|
5
93
|
### Minor Changes
|
package/lib/cache-handler.mjs
CHANGED
|
@@ -2,7 +2,6 @@ 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 logger from '../utils/log';
|
|
6
5
|
|
|
7
6
|
// Cache configuration
|
|
8
7
|
const CACHE_CONFIG = {
|
|
@@ -32,10 +31,22 @@ if (!globalForRedis.redisClient) {
|
|
|
32
31
|
globalForRedis.connectionAttempts = 0;
|
|
33
32
|
}
|
|
34
33
|
|
|
34
|
+
// Logging configuration
|
|
35
|
+
const debugValue = process.env.NEXT_PRIVATE_DEBUG_CACHE;
|
|
36
|
+
const debug = debugValue === 'true' || debugValue === '1';
|
|
37
|
+
|
|
38
|
+
let console_log;
|
|
39
|
+
if (debug) {
|
|
40
|
+
// eslint-disable-next-line no-console
|
|
41
|
+
console_log = (...args) => console.log('[Cache Handler]', ...args);
|
|
42
|
+
} else {
|
|
43
|
+
console_log = () => {};
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
async function getRedisClient() {
|
|
36
47
|
// If client exists and is ready, return it
|
|
37
48
|
if (globalForRedis.redisClient?.isReady) {
|
|
38
|
-
|
|
49
|
+
console_log('Reusing existing Redis connection');
|
|
39
50
|
return globalForRedis.redisClient;
|
|
40
51
|
}
|
|
41
52
|
|
|
@@ -53,7 +64,7 @@ async function getRedisClient() {
|
|
|
53
64
|
const redisUrl = `redis://${CACHE_CONFIG.host}:${CACHE_CONFIG.port}/${CACHE_CONFIG.bucket}`;
|
|
54
65
|
|
|
55
66
|
if (globalForRedis.connectionAttempts === 1) {
|
|
56
|
-
|
|
67
|
+
console_log('Creating Redis connection:', redisUrl);
|
|
57
68
|
}
|
|
58
69
|
|
|
59
70
|
const redisClient = createClient({
|
|
@@ -62,8 +73,8 @@ async function getRedisClient() {
|
|
|
62
73
|
reconnectStrategy: (retries) => {
|
|
63
74
|
if (retries > CACHE_CONFIG.redis.reconnectStrategy.maxRetries) {
|
|
64
75
|
if (!globalForRedis.hasLoggedConnectionError) {
|
|
65
|
-
|
|
66
|
-
'Redis is not available, falling back to local cache only'
|
|
76
|
+
console.warn(
|
|
77
|
+
'[Cache Handler] Redis is not available, falling back to local cache only'
|
|
67
78
|
);
|
|
68
79
|
globalForRedis.hasLoggedConnectionError = true;
|
|
69
80
|
}
|
|
@@ -79,23 +90,23 @@ async function getRedisClient() {
|
|
|
79
90
|
// Only log the first connection error to avoid spam
|
|
80
91
|
if (!globalForRedis.hasLoggedConnectionError) {
|
|
81
92
|
if (error.code === 'ECONNREFUSED') {
|
|
82
|
-
|
|
83
|
-
'Redis connection refused. Is Redis running? Falling back to local cache.'
|
|
93
|
+
console.warn(
|
|
94
|
+
'[Cache Handler] Redis connection refused. Is Redis running? Falling back to local cache.'
|
|
84
95
|
);
|
|
85
96
|
} else {
|
|
86
|
-
|
|
97
|
+
console.error('[Cache Handler] Redis client error:', error.message);
|
|
87
98
|
}
|
|
88
99
|
globalForRedis.hasLoggedConnectionError = true;
|
|
89
100
|
}
|
|
90
101
|
});
|
|
91
102
|
|
|
92
103
|
redisClient.on('connect', () => {
|
|
93
|
-
|
|
104
|
+
console_log('Redis connected');
|
|
94
105
|
globalForRedis.hasLoggedConnectionError = false;
|
|
95
106
|
});
|
|
96
107
|
|
|
97
108
|
redisClient.on('ready', () => {
|
|
98
|
-
|
|
109
|
+
console_log('Redis ready');
|
|
99
110
|
globalForRedis.hasLoggedConnectionError = false;
|
|
100
111
|
});
|
|
101
112
|
|
|
@@ -105,9 +116,14 @@ async function getRedisClient() {
|
|
|
105
116
|
} catch (error) {
|
|
106
117
|
if (!globalForRedis.hasLoggedConnectionError) {
|
|
107
118
|
if (error.code === 'ECONNREFUSED') {
|
|
108
|
-
|
|
119
|
+
console.warn(
|
|
120
|
+
'[Cache Handler] Could not connect to Redis - using local cache only'
|
|
121
|
+
);
|
|
109
122
|
} else {
|
|
110
|
-
|
|
123
|
+
console.error(
|
|
124
|
+
'[Cache Handler] Failed to connect to Redis:',
|
|
125
|
+
error.message
|
|
126
|
+
);
|
|
111
127
|
}
|
|
112
128
|
globalForRedis.hasLoggedConnectionError = true;
|
|
113
129
|
}
|
|
@@ -119,7 +135,7 @@ async function getRedisClient() {
|
|
|
119
135
|
}
|
|
120
136
|
|
|
121
137
|
CacheHandler.onCreation(async () => {
|
|
122
|
-
|
|
138
|
+
console_log('Initializing cache handlers...');
|
|
123
139
|
|
|
124
140
|
let client;
|
|
125
141
|
try {
|
|
@@ -163,68 +179,69 @@ CacheHandler.onCreation(async () => {
|
|
|
163
179
|
name: 'custom-local-then-redis',
|
|
164
180
|
get: async (key, context) => {
|
|
165
181
|
const vKey = versionKey(key);
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
182
|
+
console_log(
|
|
183
|
+
'GET called for key:',
|
|
184
|
+
typeof vKey === 'string' ? vKey : vKey?.key
|
|
185
|
+
);
|
|
169
186
|
|
|
170
187
|
// Check local cache first
|
|
171
|
-
|
|
188
|
+
console_log('Checking local cache...');
|
|
172
189
|
const localResult = await localHandler.get(vKey, context);
|
|
173
190
|
|
|
174
191
|
if (localResult) {
|
|
175
|
-
|
|
192
|
+
console_log('Found in local cache');
|
|
176
193
|
return localResult;
|
|
177
194
|
}
|
|
178
195
|
|
|
179
|
-
|
|
196
|
+
console_log('Not found in local, checking Redis...');
|
|
180
197
|
try {
|
|
181
198
|
const redisResult = await redisHandler.get(vKey, context);
|
|
182
199
|
|
|
183
200
|
if (redisResult) {
|
|
184
|
-
|
|
201
|
+
console_log('Found in Redis');
|
|
185
202
|
// Sync back to local cache for faster future access
|
|
186
203
|
try {
|
|
187
204
|
await localHandler.set(vKey, redisResult, context);
|
|
188
|
-
|
|
205
|
+
console_log('Synced to local cache');
|
|
189
206
|
} catch (error) {
|
|
190
|
-
|
|
207
|
+
console_log('Failed to sync to local:', error.message);
|
|
191
208
|
}
|
|
192
209
|
return redisResult;
|
|
193
210
|
}
|
|
194
211
|
} catch (error) {
|
|
195
|
-
|
|
212
|
+
console_log('Redis error:', error.message);
|
|
196
213
|
}
|
|
197
214
|
|
|
198
|
-
|
|
215
|
+
console_log('Not found in any cache');
|
|
199
216
|
return undefined;
|
|
200
217
|
},
|
|
201
218
|
set: async (key, value, context) => {
|
|
202
219
|
const vKey = versionKey(key);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
220
|
+
console_log(
|
|
221
|
+
'SET called for key:',
|
|
222
|
+
typeof vKey === 'string' ? vKey : vKey?.key
|
|
223
|
+
);
|
|
206
224
|
// Set to both caches
|
|
207
225
|
await Promise.allSettled([
|
|
208
226
|
localHandler.set(vKey, value, context),
|
|
209
227
|
redisHandler
|
|
210
228
|
.set(vKey, value, context)
|
|
211
|
-
.catch((error) =>
|
|
212
|
-
logger.warn('Redis SET operation failed', { error: error.message })
|
|
213
|
-
)
|
|
229
|
+
.catch((error) => console_log('Redis SET error:', error.message))
|
|
214
230
|
]);
|
|
215
231
|
},
|
|
216
232
|
delete: async (key, context) => {
|
|
217
233
|
const vKey = versionKey(key);
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
234
|
+
console_log(
|
|
235
|
+
'DELETE called for key:',
|
|
236
|
+
typeof vKey === 'string' ? vKey : vKey?.key
|
|
237
|
+
);
|
|
221
238
|
await Promise.allSettled([
|
|
222
239
|
localHandler.delete?.(vKey, context),
|
|
223
240
|
redisHandler.delete?.(vKey, context)
|
|
224
241
|
]);
|
|
225
242
|
},
|
|
226
243
|
revalidateTag: async (tags, context) => {
|
|
227
|
-
|
|
244
|
+
console_log('REVALIDATE_TAG called for tags:', tags);
|
|
228
245
|
await Promise.allSettled([
|
|
229
246
|
localHandler.revalidateTag?.(tags, context),
|
|
230
247
|
redisHandler.revalidateTag?.(tags, context)
|
|
@@ -232,7 +249,7 @@ CacheHandler.onCreation(async () => {
|
|
|
232
249
|
}
|
|
233
250
|
};
|
|
234
251
|
|
|
235
|
-
|
|
252
|
+
console_log('[Cache Handler] Handlers initialized successfully');
|
|
236
253
|
|
|
237
254
|
return {
|
|
238
255
|
handlers: [customHandler]
|
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.93.0-rc.
|
|
4
|
+
"version": "1.93.0-rc.49",
|
|
5
5
|
"private": false,
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"bin": {
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"set-cookie-parser": "2.6.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@akinon/eslint-plugin-projectzero": "1.93.0-rc.
|
|
37
|
+
"@akinon/eslint-plugin-projectzero": "1.93.0-rc.49",
|
|
38
38
|
"@babel/core": "7.26.10",
|
|
39
39
|
"@babel/preset-env": "7.26.9",
|
|
40
40
|
"@babel/preset-typescript": "7.27.0",
|