s3db.js 11.0.1 → 11.0.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/dist/s3db.cjs.js +10 -12
- package/dist/s3db.cjs.js.map +1 -1
- package/dist/s3db.es.js +10 -12
- package/dist/s3db.es.js.map +1 -1
- package/package.json +1 -1
- package/src/plugins/eventual-consistency/analytics.js +5 -5
- package/src/plugins/eventual-consistency/config.js +1 -2
- package/src/plugins/eventual-consistency/consolidation.js +3 -3
- package/dist/s3db-cli.js +0 -54741
package/package.json
CHANGED
|
@@ -23,13 +23,13 @@ export async function updateAnalytics(transactions, analyticsResource, config) {
|
|
|
23
23
|
throw new Error(
|
|
24
24
|
`[EventualConsistency] CRITICAL BUG: config.field is undefined in updateAnalytics()!\n` +
|
|
25
25
|
`This indicates a race condition in the plugin where multiple handlers are sharing the same config object.\n` +
|
|
26
|
-
`Config: ${JSON.stringify({ resource: config.resource, field: config.field
|
|
26
|
+
`Config: ${JSON.stringify({ resource: config.resource, field: config.field })}\n` +
|
|
27
27
|
`Transactions count: ${transactions.length}\n` +
|
|
28
28
|
`AnalyticsResource: ${analyticsResource?.name || 'unknown'}`
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
if (config.verbose
|
|
32
|
+
if (config.verbose) {
|
|
33
33
|
console.log(
|
|
34
34
|
`[EventualConsistency] ${config.resource}.${config.field} - ` +
|
|
35
35
|
`Updating analytics for ${transactions.length} transactions...`
|
|
@@ -41,7 +41,7 @@ export async function updateAnalytics(transactions, analyticsResource, config) {
|
|
|
41
41
|
const byHour = groupByCohort(transactions, 'cohortHour');
|
|
42
42
|
const cohortCount = Object.keys(byHour).length;
|
|
43
43
|
|
|
44
|
-
if (config.verbose
|
|
44
|
+
if (config.verbose) {
|
|
45
45
|
console.log(
|
|
46
46
|
`[EventualConsistency] ${config.resource}.${config.field} - ` +
|
|
47
47
|
`Updating ${cohortCount} hourly analytics cohorts...`
|
|
@@ -57,7 +57,7 @@ export async function updateAnalytics(transactions, analyticsResource, config) {
|
|
|
57
57
|
if (config.analyticsConfig.rollupStrategy === 'incremental') {
|
|
58
58
|
const uniqueHours = Object.keys(byHour);
|
|
59
59
|
|
|
60
|
-
if (config.verbose
|
|
60
|
+
if (config.verbose) {
|
|
61
61
|
console.log(
|
|
62
62
|
`[EventualConsistency] ${config.resource}.${config.field} - ` +
|
|
63
63
|
`Rolling up ${uniqueHours.length} hours to daily/monthly analytics...`
|
|
@@ -69,7 +69,7 @@ export async function updateAnalytics(transactions, analyticsResource, config) {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
if (config.verbose
|
|
72
|
+
if (config.verbose) {
|
|
73
73
|
console.log(
|
|
74
74
|
`[EventualConsistency] ${config.resource}.${config.field} - ` +
|
|
75
75
|
`Analytics update complete for ${cohortCount} cohorts`
|
|
@@ -79,8 +79,7 @@ export function createConfig(options, detectedTimezone) {
|
|
|
79
79
|
autoCheckpoint: checkpoints.auto !== false,
|
|
80
80
|
|
|
81
81
|
// Debug
|
|
82
|
-
verbose: options.verbose
|
|
83
|
-
debug: options.debug || false
|
|
82
|
+
verbose: options.verbose || false
|
|
84
83
|
};
|
|
85
84
|
}
|
|
86
85
|
|
|
@@ -414,7 +414,7 @@ export async function consolidateRecord(
|
|
|
414
414
|
}
|
|
415
415
|
|
|
416
416
|
// 🔥 DEBUG: Log BEFORE update
|
|
417
|
-
if (config.
|
|
417
|
+
if (config.verbose) {
|
|
418
418
|
console.log(
|
|
419
419
|
`🔥 [DEBUG] BEFORE targetResource.update() {` +
|
|
420
420
|
`\n originalId: '${originalId}',` +
|
|
@@ -437,7 +437,7 @@ export async function consolidateRecord(
|
|
|
437
437
|
);
|
|
438
438
|
|
|
439
439
|
// 🔥 DEBUG: Log AFTER update
|
|
440
|
-
if (config.
|
|
440
|
+
if (config.verbose) {
|
|
441
441
|
console.log(
|
|
442
442
|
`🔥 [DEBUG] AFTER targetResource.update() {` +
|
|
443
443
|
`\n updateOk: ${updateOk},` +
|
|
@@ -449,7 +449,7 @@ export async function consolidateRecord(
|
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
// 🔥 VERIFY: Check if update actually persisted
|
|
452
|
-
if (updateOk &&
|
|
452
|
+
if (updateOk && config.verbose) {
|
|
453
453
|
// Bypass cache to get fresh data
|
|
454
454
|
const [verifyOk, verifyErr, verifiedRecord] = await tryFn(() =>
|
|
455
455
|
targetResource.get(originalId, { skipCache: true })
|