@adobe/spacecat-shared-utils 1.82.0 → 1.82.2
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 +14 -0
- package/package.json +1 -1
- package/src/calendar-week-helper.js +20 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [@adobe/spacecat-shared-utils-v1.82.2](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.82.1...@adobe/spacecat-shared-utils-v1.82.2) (2025-12-09)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **rum-api-client:** traffic attibution for new llms ([#1229](https://github.com/adobe/spacecat-shared/issues/1229)) ([a6aac37](https://github.com/adobe/spacecat-shared/commit/a6aac37993e4c5e7527d4f1853a137f2ed9c2779))
|
|
7
|
+
|
|
8
|
+
# [@adobe/spacecat-shared-utils-v1.82.1](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.82.0...@adobe/spacecat-shared-utils-v1.82.1) (2025-12-05)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* 0 week valid month on numSeries ([#1220](https://github.com/adobe/spacecat-shared/issues/1220)) ([7670da9](https://github.com/adobe/spacecat-shared/commit/7670da9691b2623aa149b1b07c36c97585112ca7))
|
|
14
|
+
|
|
1
15
|
# [@adobe/spacecat-shared-utils-v1.82.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-utils-v1.81.1...@adobe/spacecat-shared-utils-v1.82.0) (2025-12-03)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -207,54 +207,63 @@ export function getTemporalCondition({
|
|
|
207
207
|
month,
|
|
208
208
|
year,
|
|
209
209
|
numSeries = 1,
|
|
210
|
+
log = null,
|
|
210
211
|
} = {}) {
|
|
211
|
-
const
|
|
212
|
-
const
|
|
212
|
+
const hasValidWeek = isValidWeek(week, year);
|
|
213
|
+
const hasValidMonth = isValidMonth(month, year);
|
|
214
|
+
log?.info(`[getTemporalCondition] hasValidWeek: ${hasValidWeek}, hasValidMonth: ${hasValidMonth}`);
|
|
213
215
|
|
|
214
216
|
if (numSeries > 1) {
|
|
215
|
-
if (!
|
|
217
|
+
if (!hasValidWeek && !hasValidMonth) {
|
|
216
218
|
throw new Error('Missing required parameters: week or month');
|
|
217
219
|
}
|
|
218
220
|
|
|
219
221
|
const conditions = [];
|
|
220
222
|
for (let i = 0; i < numSeries; i += 1) {
|
|
221
|
-
if (
|
|
223
|
+
if (hasValidWeek) {
|
|
222
224
|
let currentWeek = week - i;
|
|
223
225
|
let currentYear = year;
|
|
224
226
|
if (currentWeek < 1) {
|
|
225
227
|
currentWeek = has53CalendarWeeks(currentYear) ? 53 : 52;
|
|
226
228
|
currentYear -= 1;
|
|
227
229
|
}
|
|
230
|
+
log?.info(`[getTemporalCondition] currentWeek: ${currentWeek}, currentYear: ${currentYear}`);
|
|
228
231
|
conditions.push(getWeekInfo(currentWeek, currentYear).temporalCondition);
|
|
229
|
-
} else if (
|
|
232
|
+
} else if (hasValidMonth) {
|
|
230
233
|
let currentMonth = month - i;
|
|
231
234
|
let currentYear = year;
|
|
232
235
|
if (currentMonth < 1) {
|
|
233
236
|
currentMonth = 12;
|
|
234
237
|
currentYear -= 1;
|
|
235
238
|
}
|
|
239
|
+
log?.info(`[getTemporalCondition] currentMonth: ${currentMonth}, currentYear: ${currentYear}`);
|
|
236
240
|
conditions.push(getMonthInfo(currentMonth, currentYear).temporalCondition);
|
|
237
241
|
}
|
|
238
242
|
}
|
|
239
243
|
return conditions.join(' OR ');
|
|
240
244
|
}
|
|
241
245
|
|
|
242
|
-
if (
|
|
246
|
+
if (hasValidWeek) {
|
|
243
247
|
return getWeekInfo(week, year).temporalCondition;
|
|
244
248
|
}
|
|
245
249
|
|
|
246
|
-
if (
|
|
250
|
+
if (hasValidMonth) {
|
|
247
251
|
return getMonthInfo(month, year).temporalCondition;
|
|
248
252
|
}
|
|
249
253
|
|
|
250
254
|
// Fallbacks
|
|
251
|
-
|
|
252
|
-
|
|
255
|
+
// If week was provided (even if invalid), default to last full week
|
|
256
|
+
if (Number.isInteger(week)) {
|
|
253
257
|
return getWeekInfo().temporalCondition;
|
|
254
258
|
}
|
|
255
259
|
|
|
256
|
-
//
|
|
257
|
-
|
|
260
|
+
// If month was provided (even if invalid), default to last full month
|
|
261
|
+
if (Number.isInteger(month)) {
|
|
262
|
+
return getMonthInfo().temporalCondition;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// If neither was provided, default to last full week
|
|
266
|
+
return getWeekInfo().temporalCondition;
|
|
258
267
|
}
|
|
259
268
|
|
|
260
269
|
// Note: This function binds week exclusively to one year
|