@opengis/fastify-table 2.0.139 → 2.0.140

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.
@@ -1 +1 @@
1
- {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../../../server/routes/file/controllers/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAgCzD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAA8B,WAAW,CACvC,EACE,EAAqB,EACrB,OAAO,EACP,IAAI,EACJ,OAAO,EAAE,QAAQ,EACjB,GAAG,EACH,KAAU,EACV,IAAkB,EAClB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EACD,KAAK,EAAE,YAAY,gBA0YpB"}
1
+ {"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../../../../server/routes/file/controllers/export.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAgCzD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,wBAA8B,WAAW,CACvC,EACE,EAAqB,EACrB,OAAO,EACP,IAAI,EACJ,OAAO,EAAE,QAAQ,EACjB,GAAG,EACH,KAAU,EACV,IAAkB,EAClB,QAAQ,EACR,UAAU,GACX,EAAE;IACD,EAAE,EAAE,UAAU,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EACD,KAAK,EAAE,YAAY,gBAiZpB"}
@@ -52,7 +52,7 @@ export default async function exportTable({ pg = pgClients.client, headers, user
52
52
  if (!["csv", "xlsx", "json", "geojson"].includes(format)) {
53
53
  return reply.status(400).send("param format is invalid");
54
54
  }
55
- const slice = query.slice ? Math.min(+query.slice || 16, 16) : null;
55
+ const slice = query.slice ? Math.min(+query.slice || 16, 1000) : null;
56
56
  const date = new Date();
57
57
  const sufixName = `${filter}-${cols || "all"}-${search}-${query.limit || "unlimited"}-${query.slice || "full"}-${id}`;
58
58
  const sufixDate = [
@@ -179,7 +179,7 @@ export default async function exportTable({ pg = pgClients.client, headers, user
179
179
  // export xlsx / csv / json
180
180
  const source = loadTable?.title || loadTable?.ua || table || sourceName;
181
181
  const interval = setInterval(async () => {
182
- send("process query..." + randomUUID().split('-')[0]);
182
+ send("process query..." + randomUUID().split("-")[0]);
183
183
  }, 10000);
184
184
  // start stream only if total exceed limit, but use while anyway
185
185
  const res = {};
@@ -209,7 +209,14 @@ export default async function exportTable({ pg = pgClients.client, headers, user
209
209
  ? await pg.query(`select * from (${tableSql || viewSql})q where ${loadTable?.key && id
210
210
  ? `${loadTable?.key}::text = '${id}'`
211
211
  : "true"} limit ${options.limit} offset ${offset}`)
212
- : await getData({ ...options, query: { page, ...options.query } }, reply, true);
212
+ : await getData({
213
+ ...options,
214
+ query: {
215
+ page,
216
+ ...options.query,
217
+ limit: Math.min(+query.batchLimit || 500, 1000),
218
+ },
219
+ }, reply, true);
213
220
  send(`seq: ${++seq}`);
214
221
  send(`Обробка ${rows.length} об'єктів...`);
215
222
  if (!rows.length) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.0.139",
3
+ "version": "2.0.140",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [