querysub 0.682.0 → 0.684.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "querysub",
3
- "version": "0.682.0",
3
+ "version": "0.684.0",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
6
  "note1": "note on node-forge fork, see https://github.com/digitalbazaar/forge/issues/744 for details",
@@ -297,7 +297,7 @@ export async function runArchiveMover(config: {
297
297
  console.log(" ");
298
298
  }
299
299
 
300
- const splitValuesBelowLimit = measureWrap(function splitValuesBelowLimit(config: {
300
+ export const splitValuesBelowLimit = measureWrap(function splitValuesBelowLimit(config: {
301
301
  values: PathValue[];
302
302
  maxFileValueCount: number;
303
303
  maxFileByteCount: number;
@@ -2,7 +2,7 @@ import "../inject";
2
2
 
3
3
  import { logErrors } from "../errors";
4
4
  import { PathValueArchives, pathValueArchives } from "../0-path-value-core/pathValueArchives";
5
- import { ARCHIVE_FLUSH_LIMIT, ARCHIVE_STABLE_THRESHOLD, PathValue } from "../0-path-value-core/pathValueCore";
5
+ import { ARCHIVE_FLUSH_LIMIT, ARCHIVE_STABLE_THRESHOLD, FILE_SIZE_LIMIT, FILE_VALUE_COUNT_LIMIT, PathValue } from "../0-path-value-core/pathValueCore";
6
6
  import { runInfinitePollCallAtStart } from "socket-function/src/batching";
7
7
  import { measureBlock } from "socket-function/src/profiling/measure";
8
8
  import { pathValueSerializer } from "../-h-path-value-serialize/PathValueSerializer";
@@ -14,6 +14,7 @@ import { magenta } from "socket-function/src/formatting/logColors";
14
14
  import { PathRouter } from "../0-path-value-core/PathRouter";
15
15
  import { disablePathAuditer } from "../diagnostics/pathAuditerCallback";
16
16
  import { getOurAuthoritySpec } from "../0-path-value-core/PathRouterServerAuthoritySpec";
17
+ import { splitValuesBelowLimit } from "../2-proxy/archiveMoveHarness";
17
18
  import yargs from "yargs";
18
19
 
19
20
  let yargObj = isNodeTrue() && yargs(process.argv)
@@ -101,18 +102,23 @@ async function runGenesisJoinIteration(config?: { force?: boolean }) {
101
102
 
102
103
  let targets = await PathRouter.getPathIdentifierTargets(allCombinedValues, authoritySpec);
103
104
  for (let [target, values] of targets) {
104
-
105
- let dataObj = await pathValueArchives.encodeValuePaths(values, {
106
- pathOverrides: {
107
- sourceType: "join",
108
- },
109
- });
110
- if (!dataObj) continue;
111
- let newFileName = target + "/" + dataObj?.file;
112
- transaction.createFiles.push({
113
- file: newFileName,
114
- data: dataObj.data,
105
+ let split = splitValuesBelowLimit({
106
+ values,
107
+ maxFileValueCount: FILE_VALUE_COUNT_LIMIT,
108
+ maxFileByteCount: FILE_SIZE_LIMIT,
115
109
  });
110
+ for (let splitValues of split) {
111
+ let dataObj = await pathValueArchives.encodeValuePaths(splitValues.values, {
112
+ pathOverrides: {
113
+ sourceType: "join",
114
+ },
115
+ });
116
+ if (!dataObj) continue;
117
+ transaction.createFiles.push({
118
+ file: target + "/" + dataObj.file,
119
+ data: dataObj.data,
120
+ });
121
+ }
116
122
  }
117
123
 
118
124
  console.log(magenta(`Joining ${formatNumber(usedFiles.length)} => ${transaction.createFiles.length} files with ${formatNumber(allCombinedValues.length)} values in ${formatNumber(totalSize)} bytes. Original count: ${formatNumber(originalCount)}, under path count: ${formatNumber(underPathCount)}, within time range count: ${formatNumber(withinTimeRangeCount)}`));
@@ -14,6 +14,7 @@ module.hotreload = false;
14
14
 
15
15
  const PARALLEL_FILE_SEARCHES = 4;
16
16
  const DEFAULT_LIMIT = 100;
17
+ const MAX_LIMIT = 10_000;
17
18
  // Compressed input bytes of downloaded files to keep resident.
18
19
  const DOWNLOAD_CACHE_MAX_BYTES = 1024 ** 3;
19
20
  // Decoded output bytes (estimated via serialized length) of decoded files to keep resident. Sized independently of the download cache because the decoded form is much larger than the compressed download.
@@ -125,6 +126,9 @@ export async function searchStorageLogsForMCP(config: {
125
126
  throw new Error(`startTime (${startTime}) must be < endTime (${endTime})`);
126
127
  }
127
128
  let limit = config.limit ?? DEFAULT_LIMIT;
129
+ if (limit > MAX_LIMIT) {
130
+ throw new Error(`limit ${limit} > ${MAX_LIMIT}. This endpoint returns projected rows over a socket, it is not a bulk export. If you need to aggregate large volumes, list the log files and download + parse them directly.`);
131
+ }
128
132
  let direction = config.direction ?? "fromEnd";
129
133
  let columns = config.columns && (config.columns.includes("time") ? config.columns : ["time", ...config.columns]);
130
134
  let clauses = parseSearchClauses(query);