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/dist/s3db.es.js
CHANGED
|
@@ -4860,9 +4860,7 @@ function createConfig(options, detectedTimezone) {
|
|
|
4860
4860
|
deleteConsolidatedTransactions: checkpoints.deleteConsolidated !== false,
|
|
4861
4861
|
autoCheckpoint: checkpoints.auto !== false,
|
|
4862
4862
|
// Debug
|
|
4863
|
-
verbose: options.verbose
|
|
4864
|
-
// Default: true (can disable with verbose: false)
|
|
4865
|
-
debug: options.debug || false
|
|
4863
|
+
verbose: options.verbose || false
|
|
4866
4864
|
};
|
|
4867
4865
|
}
|
|
4868
4866
|
function validateResourcesConfig(resources) {
|
|
@@ -5401,7 +5399,7 @@ async function consolidateRecord(originalId, transactionResource, targetResource
|
|
|
5401
5399
|
`[EventualConsistency] ${config.resource}.${config.field} - ${originalId}: ${currentValue} \u2192 ${consolidatedValue} (${consolidatedValue > currentValue ? "+" : ""}${consolidatedValue - currentValue})`
|
|
5402
5400
|
);
|
|
5403
5401
|
}
|
|
5404
|
-
if (config.
|
|
5402
|
+
if (config.verbose) {
|
|
5405
5403
|
console.log(
|
|
5406
5404
|
`\u{1F525} [DEBUG] BEFORE targetResource.update() {
|
|
5407
5405
|
originalId: '${originalId}',
|
|
@@ -5416,7 +5414,7 @@ async function consolidateRecord(originalId, transactionResource, targetResource
|
|
|
5416
5414
|
[config.field]: consolidatedValue
|
|
5417
5415
|
})
|
|
5418
5416
|
);
|
|
5419
|
-
if (config.
|
|
5417
|
+
if (config.verbose) {
|
|
5420
5418
|
console.log(
|
|
5421
5419
|
`\u{1F525} [DEBUG] AFTER targetResource.update() {
|
|
5422
5420
|
updateOk: ${updateOk},
|
|
@@ -5426,7 +5424,7 @@ async function consolidateRecord(originalId, transactionResource, targetResource
|
|
|
5426
5424
|
}`
|
|
5427
5425
|
);
|
|
5428
5426
|
}
|
|
5429
|
-
if (updateOk &&
|
|
5427
|
+
if (updateOk && config.verbose) {
|
|
5430
5428
|
const [verifyOk, verifyErr, verifiedRecord] = await tryFn(
|
|
5431
5429
|
() => targetResource.get(originalId, { skipCache: true })
|
|
5432
5430
|
);
|
|
@@ -5760,12 +5758,12 @@ async function updateAnalytics(transactions, analyticsResource, config) {
|
|
|
5760
5758
|
throw new Error(
|
|
5761
5759
|
`[EventualConsistency] CRITICAL BUG: config.field is undefined in updateAnalytics()!
|
|
5762
5760
|
This indicates a race condition in the plugin where multiple handlers are sharing the same config object.
|
|
5763
|
-
Config: ${JSON.stringify({ resource: config.resource, field: config.field
|
|
5761
|
+
Config: ${JSON.stringify({ resource: config.resource, field: config.field })}
|
|
5764
5762
|
Transactions count: ${transactions.length}
|
|
5765
5763
|
AnalyticsResource: ${analyticsResource?.name || "unknown"}`
|
|
5766
5764
|
);
|
|
5767
5765
|
}
|
|
5768
|
-
if (config.verbose
|
|
5766
|
+
if (config.verbose) {
|
|
5769
5767
|
console.log(
|
|
5770
5768
|
`[EventualConsistency] ${config.resource}.${config.field} - Updating analytics for ${transactions.length} transactions...`
|
|
5771
5769
|
);
|
|
@@ -5773,7 +5771,7 @@ AnalyticsResource: ${analyticsResource?.name || "unknown"}`
|
|
|
5773
5771
|
try {
|
|
5774
5772
|
const byHour = groupByCohort(transactions, "cohortHour");
|
|
5775
5773
|
const cohortCount = Object.keys(byHour).length;
|
|
5776
|
-
if (config.verbose
|
|
5774
|
+
if (config.verbose) {
|
|
5777
5775
|
console.log(
|
|
5778
5776
|
`[EventualConsistency] ${config.resource}.${config.field} - Updating ${cohortCount} hourly analytics cohorts...`
|
|
5779
5777
|
);
|
|
@@ -5783,7 +5781,7 @@ AnalyticsResource: ${analyticsResource?.name || "unknown"}`
|
|
|
5783
5781
|
}
|
|
5784
5782
|
if (config.analyticsConfig.rollupStrategy === "incremental") {
|
|
5785
5783
|
const uniqueHours = Object.keys(byHour);
|
|
5786
|
-
if (config.verbose
|
|
5784
|
+
if (config.verbose) {
|
|
5787
5785
|
console.log(
|
|
5788
5786
|
`[EventualConsistency] ${config.resource}.${config.field} - Rolling up ${uniqueHours.length} hours to daily/monthly analytics...`
|
|
5789
5787
|
);
|
|
@@ -5792,7 +5790,7 @@ AnalyticsResource: ${analyticsResource?.name || "unknown"}`
|
|
|
5792
5790
|
await rollupAnalytics(cohortHour, analyticsResource, config);
|
|
5793
5791
|
}
|
|
5794
5792
|
}
|
|
5795
|
-
if (config.verbose
|
|
5793
|
+
if (config.verbose) {
|
|
5796
5794
|
console.log(
|
|
5797
5795
|
`[EventualConsistency] ${config.resource}.${config.field} - Analytics update complete for ${cohortCount} cohorts`
|
|
5798
5796
|
);
|
|
@@ -12784,7 +12782,7 @@ class Database extends EventEmitter {
|
|
|
12784
12782
|
this.id = idGenerator(7);
|
|
12785
12783
|
this.version = "1";
|
|
12786
12784
|
this.s3dbVersion = (() => {
|
|
12787
|
-
const [ok, err, version] = tryFn(() => true ? "11.0.
|
|
12785
|
+
const [ok, err, version] = tryFn(() => true ? "11.0.2" : "latest");
|
|
12788
12786
|
return ok ? version : "latest";
|
|
12789
12787
|
})();
|
|
12790
12788
|
this.resources = {};
|