@nmakarov/cli-toolkit 0.40.0 → 0.43.0
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/cli-runner.cjs +14 -3
- package/dist/cli-runner.cjs.map +1 -1
- package/dist/cli-runner.js +14 -3
- package/dist/cli-runner.js.map +1 -1
- package/dist/filedatabase.cjs +14 -3
- package/dist/filedatabase.cjs.map +1 -1
- package/dist/filedatabase.js +14 -3
- package/dist/filedatabase.js.map +1 -1
- package/dist/http-client2.cjs +14 -3
- package/dist/http-client2.cjs.map +1 -1
- package/dist/http-client2.js +14 -3
- package/dist/http-client2.js.map +1 -1
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/mock-server.cjs +14 -3
- package/dist/mock-server.cjs.map +1 -1
- package/dist/mock-server.js +14 -3
- package/dist/mock-server.js.map +1 -1
- package/dist/tasks.cjs +14 -3
- package/dist/tasks.cjs.map +1 -1
- package/dist/tasks.js +14 -3
- package/dist/tasks.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2534,6 +2534,9 @@ var FileDatabase = class _FileDatabase {
|
|
|
2534
2534
|
currentRecord = 0;
|
|
2535
2535
|
hasReadFirstPage = false;
|
|
2536
2536
|
lastFileData = null;
|
|
2537
|
+
/** Cache of the last JSON file parsed during paginated reads (avoid re-parse per page). */
|
|
2538
|
+
readFileCache = null;
|
|
2539
|
+
// { filePath: string, data: any[] } | null
|
|
2537
2540
|
metadata;
|
|
2538
2541
|
// Synopsis calculation functions
|
|
2539
2542
|
fileSynopsisFunction = null;
|
|
@@ -3300,7 +3303,6 @@ var FileDatabase = class _FileDatabase {
|
|
|
3300
3303
|
let effectivePageSize;
|
|
3301
3304
|
if (nextPage && this.hasReadFirstPage) {
|
|
3302
3305
|
effectivePageSize = pageSize || this.pageSize;
|
|
3303
|
-
this.currentRecord += effectivePageSize;
|
|
3304
3306
|
} else if (!nextPage) {
|
|
3305
3307
|
effectivePageSize = pageSize !== void 0 ? pageSize : this.metadata.totalRecords;
|
|
3306
3308
|
this.currentRecord = 0;
|
|
@@ -3329,8 +3331,14 @@ var FileDatabase = class _FileDatabase {
|
|
|
3329
3331
|
const file = this.metadata.files[i];
|
|
3330
3332
|
const filePath = import_path4.default.join(this.getDestinationPath(this.currentVersion || void 0), file.fileName);
|
|
3331
3333
|
try {
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
+
let fileData;
|
|
3335
|
+
if (this.readFileCache?.filePath === filePath && Array.isArray(this.readFileCache.data)) {
|
|
3336
|
+
fileData = this.readFileCache.data;
|
|
3337
|
+
} else {
|
|
3338
|
+
const rawData = await import_fs4.default.promises.readFile(filePath, "utf8");
|
|
3339
|
+
fileData = deserializeData(rawData, this.metadata.dataType);
|
|
3340
|
+
this.readFileCache = { filePath, data: fileData };
|
|
3341
|
+
}
|
|
3334
3342
|
let startIndex = 0;
|
|
3335
3343
|
if (i === currentFileIndex) {
|
|
3336
3344
|
startIndex = this.currentRecord - cumulativeRecords;
|
|
@@ -3344,6 +3352,7 @@ var FileDatabase = class _FileDatabase {
|
|
|
3344
3352
|
throw new FileDatabaseError(`Failed to read file ${file.fileName}: ${error.message}`);
|
|
3345
3353
|
}
|
|
3346
3354
|
}
|
|
3355
|
+
this.currentRecord += recordsRead;
|
|
3347
3356
|
if (result.length > 0) {
|
|
3348
3357
|
if (nextPage || pageSize !== void 0 && pageSize < this.metadata.totalRecords) {
|
|
3349
3358
|
this.hasReadFirstPage = true;
|
|
@@ -3357,6 +3366,7 @@ var FileDatabase = class _FileDatabase {
|
|
|
3357
3366
|
setStartRecord(startRecord) {
|
|
3358
3367
|
this.currentRecord = startRecord - 1;
|
|
3359
3368
|
this.hasReadFirstPage = false;
|
|
3369
|
+
this.readFileCache = null;
|
|
3360
3370
|
}
|
|
3361
3371
|
/**
|
|
3362
3372
|
* Reset read pagination state
|
|
@@ -3364,6 +3374,7 @@ var FileDatabase = class _FileDatabase {
|
|
|
3364
3374
|
resetPagination() {
|
|
3365
3375
|
this.currentRecord = 0;
|
|
3366
3376
|
this.hasReadFirstPage = false;
|
|
3377
|
+
this.readFileCache = null;
|
|
3367
3378
|
}
|
|
3368
3379
|
/**
|
|
3369
3380
|
* List filenames in the table directory.
|