@milaboratories/pl-middle-layer 1.29.1 → 1.29.3

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":"driver.d.ts","sourceRoot":"","sources":["../../src/pool/driver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEjE,OAAO,KAAK,EAAE,kBAAkB,EAAgB,MAAM,yBAAyB,CAAC;AAEhF,OAAO,KAAK,EAAE,aAAa,EAA2B,MAAM,4BAA4B,CAAC;AACzF,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,kBAAkB,EAClB,mBAAmB,EAEnB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,IAAI,eAAe,EAC/B,OAAO,EACP,SAAS,EAET,SAAS,EAIT,aAAa,EACW,MAAM,sBAAsB,CAAC;AASvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAmN3D;;;GAGG;AACH,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,0BAA0B;IAC1B,YAAY,CACV,GAAG,EAAE,SAAS,CAAC,kBAAkB,GAAG,aAAa,CAAC,EAClD,GAAG,EAAE,aAAa,GACjB,YAAY,CAAC;IAEhB,0BAA0B;IAC1B,YAAY,CACV,GAAG,EAAE,SAAS,CAAC,OAAO,CAAC,kBAAkB,GAAG,aAAa,CAAC,CAAC,EAC3D,GAAG,EAAE,aAAa,EAClB,MAAM,CAAC,EAAE,WAAW,GACnB,YAAY,CAAC;IAEhB,mFAAmF;IACnF,kBAAkB,CAChB,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,EAC7C,MAAM,CAAC,EAAE,W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,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC;IAI9E,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAI9D,kBAAkB,CAC7B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,yBAAyB,CAAC,SAAS,CAAC,EAC7C,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,0BAA0B,CAAC;IAwDzB,eAAe,CAC1B,MAAM,EAAE,YAAY,EACpB,OAAO,EAAE,mBAAmB,EAC5B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,oBAAoB,CAAC;IAkBnB,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IAKpD,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAK1D,OAAO,CAClB,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,MAAM,EAAE,EACvB,KAAK,CAAC,EAAE,UAAU,GACjB,OAAO,CAAC,YAAY,EAAE,CAAC;CAM3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@milaboratories/pl-middle-layer",
3
- "version": "1.29.1",
3
+ "version": "1.29.3",
4
4
  "description": "Pl Middle Layer",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -20,7 +20,7 @@
20
20
  "license": "UNLICENSED",
21
21
  "dependencies": {
22
22
  "@milaboratories/pframes-node": "2.1.13",
23
- "@milaboratories/pframes-rs-node": "1.0.16",
23
+ "@milaboratories/pframes-rs-node": "1.0.18",
24
24
  "canonicalize": "~2.0.0",
25
25
  "denque": "^2.1.0",
26
26
  "lru-cache": "^11.0.2",
@@ -29,19 +29,19 @@
29
29
  "utility-types": "^3.11.0",
30
30
  "yaml": "^2.6.1",
31
31
  "zod": "~3.23.8",
32
- "@milaboratories/pl-http": "^1.1.0",
33
32
  "@milaboratories/computable": "^2.3.5",
33
+ "@milaboratories/pl-http": "^1.1.0",
34
+ "@milaboratories/pl-client": "^2.7.11",
34
35
  "@milaboratories/resolve-helper": "^1.0.2",
35
36
  "@platforma-sdk/block-tools": "^2.5.18",
36
- "@milaboratories/pl-client": "^2.7.11",
37
37
  "@milaboratories/pl-drivers": "^1.5.24",
38
38
  "@milaboratories/pl-model-common": "^1.10.6",
39
39
  "@milaboratories/pl-model-middle-layer": "^1.7.6",
40
40
  "@milaboratories/pl-tree": "^1.4.30",
41
+ "@platforma-sdk/model": "^1.22.59",
41
42
  "@milaboratories/pl-model-backend": "^1.0.2",
42
43
  "@milaboratories/ts-helpers": "^1.1.4",
43
- "@platforma-sdk/model": "^1.22.59",
44
- "@platforma-sdk/workflow-tengo": "2.15.1",
44
+ "@platforma-sdk/workflow-tengo": "2.15.2",
45
45
  "@milaboratories/pl-config": "^1.4.3",
46
46
  "@milaboratories/pl-deployments": "^1.2.4"
47
47
  },
@@ -336,28 +336,43 @@ export class PFrameDriver implements InternalPFrameDriver {
336
336
 
337
337
  protected createNewResource(params: FullPTableDef): PTableHolder {
338
338
  const handle: PFrameHandle = params.pFrameHandle;
339
- const tablePromise = concurrencyLimiter.run(async () => {
340
- if (getDebugFlags().logPFrameRequests)
341
- logger.info(
342
- `PTable creation (pTableHandle = ${this.calculateParamsKey(params)}): ${JSON.stringify(params, bigintReplacer)}`,
343
- );
339
+ if (getDebugFlags().logPFrameRequests) {
340
+ logger.info(
341
+ `PTable creation (pTableHandle = ${this.calculateParamsKey(params)}): ${JSON.stringify(params, bigintReplacer)}`,
342
+ );
343
+ }
344
+ const tablePromise = (async () => {
344
345
  if (getDebugFlags().usePFrameRs && allFiltersAreRustSupported(params.def.filters)) {
345
- return await this.pFrames.getByKey(handle).rustPFrame.createTable({
346
+ return this.pFrames.getByKey(handle).rustPFrame.createTable({
346
347
  src: joinEntryToInternal(params.def.src),
347
348
  filters: migrateFilters(params.def.filters),
348
- }, params.signal);
349
+ }, params.signal).then(async (table) => {
350
+ if (params.def.sorting.length > 0) {
351
+ const sortedTable = await table.sort(params.def.sorting, params.signal);
352
+ table.dispose();
353
+ return sortedTable;
354
+ }
355
+ return table;
356
+ });
349
357
  } else {
350
- using disposableDataPFrame = this.pFrames.getByKey(handle).disposableDataPFrame;
351
- return await disposableDataPFrame.dataPFrame.createTable({
352
- src: joinEntryToInternal(params.def.src),
353
- filters: migrateFilters(params.def.filters),
354
- }, params.signal);
358
+ return concurrencyLimiter.run(async () => {
359
+ using disposableDataPFrame = this.pFrames.getByKey(handle).disposableDataPFrame;
360
+ return await disposableDataPFrame.dataPFrame.createTable({
361
+ src: joinEntryToInternal(params.def.src),
362
+ filters: migrateFilters(params.def.filters),
363
+ }, params.signal);
364
+ }).then(async (table) => {
365
+ if (params.def.sorting.length > 0) {
366
+ const sortedTable = await concurrencyLimiter.run(async () => {
367
+ return await table.sort(params.def.sorting, params.signal);
368
+ });
369
+ table.dispose();
370
+ return sortedTable;
371
+ }
372
+ return table;
373
+ });
355
374
  }
356
- }).then(async (table) =>
357
- params.def.sorting.length !== 0
358
- ? await table.sort(params.def.sorting, params.signal)
359
- : table,
360
- );
375
+ })();
361
376
  return new PTableHolder(tablePromise);
362
377
  }
363
378
 
@@ -453,43 +468,59 @@ export class PFrameDriver implements InternalPFrameDriver {
453
468
  request: CalculateTableDataRequest<PObjectId>,
454
469
  signal?: AbortSignal,
455
470
  ): Promise<CalculateTableDataResponse> {
456
- let table = await this.concurrencyLimiter.run(async () => {
457
- if (getDebugFlags().logPFrameRequests)
458
- this.logger.info(
459
- `Call calculateTableData, handle = ${handle}, request = ${JSON.stringify(request, bigintReplacer)}`,
460
- );
461
- if (getDebugFlags().usePFrameRs && allFiltersAreRustSupported(request.filters)) {
462
- return await this.pFrames.getByKey(handle).rustPFrame.createTable({
463
- src: joinEntryToInternal(request.src),
464
- filters: migrateFilters(request.filters),
465
- }, signal);
466
- } else {
471
+ if (getDebugFlags().logPFrameRequests) {
472
+ this.logger.info(
473
+ `Call calculateTableData, handle = ${handle}, request = ${JSON.stringify(request, bigintReplacer)}`,
474
+ );
475
+ }
476
+ if (getDebugFlags().usePFrameRs && allFiltersAreRustSupported(request.filters)) {
477
+ return await this.pFrames.getByKey(handle).rustPFrame.createTable({
478
+ src: joinEntryToInternal(request.src),
479
+ filters: migrateFilters(request.filters),
480
+ }, signal).then(async (table) => {
481
+ if (request.sorting.length > 0) {
482
+ const sortedTable = await table.sort(request.sorting, signal);
483
+ table.dispose();
484
+ return sortedTable;
485
+ }
486
+ return table;
487
+ }).then(async (table) => {
488
+ const spec = table.getSpec();
489
+ const data = await table.getData([...spec.keys()]);
490
+ table.dispose();
491
+ return spec.map((spec, i) => ({
492
+ spec: spec,
493
+ data: data[i],
494
+ }));
495
+ });
496
+ } else {
497
+ return await this.concurrencyLimiter.run(async () => {
467
498
  using disposableDataPFrame = this.pFrames.getByKey(handle).disposableDataPFrame;
468
499
  return await disposableDataPFrame.dataPFrame.createTable({
469
500
  src: joinEntryToInternal(request.src),
470
501
  filters: migrateFilters(request.filters),
471
502
  }, signal);
472
- }
473
- });
474
-
475
- if (request.sorting.length > 0) {
476
- const sortedTable = await this.concurrencyLimiter.run(
477
- async () => await table.sort(request.sorting, signal),
478
- );
479
- table.dispose();
480
- table = sortedTable;
503
+ }).then(async (table) => {
504
+ if (request.sorting.length > 0) {
505
+ const sortedTable = await this.concurrencyLimiter.run(async () => {
506
+ return await table.sort(request.sorting, signal);
507
+ });
508
+ table.dispose();
509
+ return sortedTable;
510
+ }
511
+ return table;
512
+ }).then(async (table) => {
513
+ const spec = table.getSpec();
514
+ const data = await this.concurrencyLimiter.run(
515
+ async () => await table.getData([...spec.keys()]),
516
+ );
517
+ table.dispose();
518
+ return spec.map((spec, i) => ({
519
+ spec: spec,
520
+ data: data[i],
521
+ }));
522
+ });
481
523
  }
482
-
483
- const spec = table.getSpec();
484
- const data = await this.concurrencyLimiter.run(
485
- async () => await table.getData([...spec.keys()]),
486
- );
487
- table.dispose();
488
-
489
- return spec.map((spec, i) => ({
490
- spec: spec,
491
- data: data[i],
492
- }));
493
524
  }
494
525
 
495
526
  public async getUniqueValues(
@@ -515,13 +546,13 @@ export class PFrameDriver implements InternalPFrameDriver {
515
546
  //
516
547
 
517
548
  public async getShape(handle: PTableHandle): Promise<PTableShape> {
518
- const pTable = await this.pTables.getByKey(handle).table; // internally concurrency limited
549
+ const pTable = await this.pTables.getByKey(handle).table;
519
550
  return pTable.getShape();
520
551
  }
521
552
 
522
553
  public async getSpec(handle: PTableHandle): Promise<PTableColumnSpec[]> {
523
- const pTable = await this.pTables.getByKey(handle).table; // internally concurrency limited
524
- return pTable.getSpec(); // sync operation
554
+ const pTable = await this.pTables.getByKey(handle).table;
555
+ return pTable.getSpec();
525
556
  }
526
557
 
527
558
  public async getData(
@@ -529,7 +560,7 @@ export class PFrameDriver implements InternalPFrameDriver {
529
560
  columnIndices: number[],
530
561
  range?: TableRange,
531
562
  ): Promise<PTableVector[]> {
532
- const pTable = await this.pTables.getByKey(handle).table; // internally concurrency limited
563
+ const pTable = await this.pTables.getByKey(handle).table;
533
564
  return await this.concurrencyLimiter.run(
534
565
  async () => await pTable.getData(columnIndices, range),
535
566
  );