@vue-skuilder/db 0.1.39 → 0.1.40
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/core/index.js.map +1 -1
- package/dist/core/index.mjs.map +1 -1
- package/dist/impl/couch/index.d.cts +25 -1
- package/dist/impl/couch/index.d.ts +25 -1
- package/dist/impl/couch/index.js +24 -2
- package/dist/impl/couch/index.js.map +1 -1
- package/dist/impl/couch/index.mjs +24 -2
- package/dist/impl/couch/index.mjs.map +1 -1
- package/dist/impl/static/index.js.map +1 -1
- package/dist/impl/static/index.mjs.map +1 -1
- package/dist/index.d.cts +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/factory.ts +17 -0
- package/src/impl/couch/CourseSyncService.ts +46 -1
- package/src/study/SessionController.ts +12 -5
|
@@ -7934,16 +7934,21 @@ var init_adminDB2 = __esm({
|
|
|
7934
7934
|
});
|
|
7935
7935
|
|
|
7936
7936
|
// src/impl/couch/CourseSyncService.ts
|
|
7937
|
-
var CourseSyncService;
|
|
7937
|
+
var DEFAULT_REPLICATION, CourseSyncService;
|
|
7938
7938
|
var init_CourseSyncService = __esm({
|
|
7939
7939
|
"src/impl/couch/CourseSyncService.ts"() {
|
|
7940
7940
|
"use strict";
|
|
7941
7941
|
init_pouchdb_setup();
|
|
7942
7942
|
init_couch();
|
|
7943
7943
|
init_logger();
|
|
7944
|
+
DEFAULT_REPLICATION = {
|
|
7945
|
+
batchSize: 1e3,
|
|
7946
|
+
batchesLimit: 5
|
|
7947
|
+
};
|
|
7944
7948
|
CourseSyncService = class _CourseSyncService {
|
|
7945
7949
|
static instance = null;
|
|
7946
7950
|
entries = /* @__PURE__ */ new Map();
|
|
7951
|
+
replicationOptions = DEFAULT_REPLICATION;
|
|
7947
7952
|
constructor() {
|
|
7948
7953
|
}
|
|
7949
7954
|
static getInstance() {
|
|
@@ -7952,6 +7957,21 @@ var init_CourseSyncService = __esm({
|
|
|
7952
7957
|
}
|
|
7953
7958
|
return _CourseSyncService.instance;
|
|
7954
7959
|
}
|
|
7960
|
+
/**
|
|
7961
|
+
* Apply replication tuning. Typically called once from `initializeDataLayer`.
|
|
7962
|
+
* Partial overrides merge with defaults.
|
|
7963
|
+
*/
|
|
7964
|
+
configure(opts) {
|
|
7965
|
+
if (opts.replication) {
|
|
7966
|
+
this.replicationOptions = {
|
|
7967
|
+
...DEFAULT_REPLICATION,
|
|
7968
|
+
...opts.replication
|
|
7969
|
+
};
|
|
7970
|
+
logger.info(
|
|
7971
|
+
`[CourseSyncService] Replication configured: batch_size=${this.replicationOptions.batchSize}, batches_limit=${this.replicationOptions.batchesLimit}`
|
|
7972
|
+
);
|
|
7973
|
+
}
|
|
7974
|
+
}
|
|
7955
7975
|
/**
|
|
7956
7976
|
* Reset the singleton (for testing).
|
|
7957
7977
|
*/
|
|
@@ -8080,7 +8100,7 @@ var init_CourseSyncService = __esm({
|
|
|
8080
8100
|
const remoteDB = this.getRemoteDB(courseId);
|
|
8081
8101
|
const syncStart = Date.now();
|
|
8082
8102
|
logger.info(
|
|
8083
|
-
`[CourseSyncService] Starting one-shot replication for course ${courseId}`
|
|
8103
|
+
`[CourseSyncService] Starting one-shot replication for course ${courseId} (batch_size=${this.replicationOptions.batchSize}, batches_limit=${this.replicationOptions.batchesLimit})`
|
|
8084
8104
|
);
|
|
8085
8105
|
const result = await this.replicate(remoteDB, localDB);
|
|
8086
8106
|
const syncTimeMs = Date.now() - syncStart;
|
|
@@ -8138,6 +8158,8 @@ var init_CourseSyncService = __esm({
|
|
|
8138
8158
|
return new Promise((resolve, reject) => {
|
|
8139
8159
|
void pouchdb_setup_default.replicate(source, target, {
|
|
8140
8160
|
// One-shot, not live. Local is a read-only snapshot.
|
|
8161
|
+
batch_size: this.replicationOptions.batchSize,
|
|
8162
|
+
batches_limit: this.replicationOptions.batchesLimit
|
|
8141
8163
|
}).on("complete", (info) => {
|
|
8142
8164
|
resolve(info);
|
|
8143
8165
|
}).on("error", (err) => {
|