@milaboratories/pl-middle-layer 1.39.4 → 1.39.5
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/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1180 -1151
- package/dist/index.mjs.map +1 -1
- package/dist/pool/driver.d.ts.map +1 -1
- package/dist/pool/ref_count_pool.d.ts.map +1 -1
- package/package.json +12 -12
- package/src/pool/driver.ts +44 -7
- package/src/pool/ref_count_pool.ts +3 -2
|
@@ -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,EACb,QAAQ,EAET,MAAM,sBAAsB,CAAC;
|
|
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,0BAA0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,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;CAG/C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-middle-layer",
|
|
3
|
-
"version": "1.39.
|
|
3
|
+
"version": "1.39.5",
|
|
4
4
|
"description": "Pl Middle Layer",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.16.0"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"keywords": [],
|
|
23
23
|
"license": "UNLICENSED",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@milaboratories/pframes-rs-node": "1.0.
|
|
25
|
+
"@milaboratories/pframes-rs-node": "1.0.52",
|
|
26
26
|
"canonicalize": "~2.1.0",
|
|
27
27
|
"denque": "^2.1.0",
|
|
28
28
|
"lru-cache": "^11.1.0",
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"remeda": "^2.22.6",
|
|
35
35
|
"@milaboratories/pl-http": "^1.1.4",
|
|
36
36
|
"@milaboratories/computable": "^2.6.0",
|
|
37
|
-
"@milaboratories/pl-drivers": "^1.6.2",
|
|
38
|
-
"@milaboratories/resolve-helper": "^1.1.0",
|
|
39
|
-
"@milaboratories/pl-model-common": "~1.16.2",
|
|
40
|
-
"@platforma-sdk/block-tools": "^2.5.66",
|
|
41
37
|
"@milaboratories/pl-client": "^2.11.2",
|
|
42
|
-
"@milaboratories/
|
|
43
|
-
"@
|
|
38
|
+
"@milaboratories/resolve-helper": "^1.1.0",
|
|
39
|
+
"@platforma-sdk/block-tools": "^2.5.67",
|
|
40
|
+
"@milaboratories/pl-model-common": "~1.16.3",
|
|
41
|
+
"@milaboratories/pl-model-middle-layer": "~1.7.49",
|
|
42
|
+
"@milaboratories/pl-drivers": "^1.6.3",
|
|
44
43
|
"@milaboratories/pl-tree": "~1.7.0",
|
|
45
|
-
"@platforma-sdk/model": "~1.39.
|
|
44
|
+
"@platforma-sdk/model": "~1.39.8",
|
|
46
45
|
"@milaboratories/ts-helpers": "^1.4.1",
|
|
46
|
+
"@milaboratories/pl-model-backend": "~1.1.2",
|
|
47
47
|
"@platforma-sdk/workflow-tengo": "4.9.3",
|
|
48
|
-
"@milaboratories/pl-errors": "^1.1.9",
|
|
49
48
|
"@milaboratories/pl-config": "^1.6.1",
|
|
49
|
+
"@milaboratories/pl-errors": "^1.1.9",
|
|
50
50
|
"@milaboratories/pl-deployments": "^2.4.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"jest": "^29.7.0",
|
|
61
61
|
"@jest/globals": "^29.7.0",
|
|
62
62
|
"ts-jest": "^29.2.6",
|
|
63
|
-
"@milaboratories/
|
|
64
|
-
"@milaboratories/
|
|
63
|
+
"@milaboratories/eslint-config": "^1.0.4",
|
|
64
|
+
"@milaboratories/build-configs": "1.0.4"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"type-check": "tsc --noEmit --composite false",
|
package/src/pool/driver.ts
CHANGED
|
@@ -39,6 +39,9 @@ import {
|
|
|
39
39
|
mapDataInfo,
|
|
40
40
|
isDataInfo,
|
|
41
41
|
ensureError,
|
|
42
|
+
PFrameDriverError,
|
|
43
|
+
isAbortError,
|
|
44
|
+
isPFrameDriverError,
|
|
42
45
|
} from '@platforma-sdk/model';
|
|
43
46
|
import { LRUCache } from 'lru-cache';
|
|
44
47
|
import type { PollResource } from './ref_count_pool';
|
|
@@ -209,8 +212,8 @@ class PFrameHolder implements PFrameInternal.PFrameDataSource, Disposable {
|
|
|
209
212
|
}
|
|
210
213
|
this.pFrame = pFrame;
|
|
211
214
|
} catch (err: unknown) {
|
|
212
|
-
throw new
|
|
213
|
-
`
|
|
215
|
+
throw new PFrameDriverError(
|
|
216
|
+
`PFrame creation failed, columns: ${JSON.stringify(distinctСolumns)}, error: ${ensureError(err)}`,
|
|
214
217
|
);
|
|
215
218
|
}
|
|
216
219
|
}
|
|
@@ -220,7 +223,7 @@ class PFrameHolder implements PFrameInternal.PFrameDataSource, Disposable {
|
|
|
220
223
|
if (computable !== undefined) return computable;
|
|
221
224
|
|
|
222
225
|
const blobResource = this.blobIdToResource.get(blobId);
|
|
223
|
-
if (blobResource === undefined) throw new
|
|
226
|
+
if (blobResource === undefined) throw new PFrameDriverError(`Blob with id ${blobId} not found.`);
|
|
224
227
|
|
|
225
228
|
// precalculation of value tree will trigger the download proecess right away
|
|
226
229
|
computable = this.blobDriver.getDownloadedBlob(blobResource).withPreCalculatedValueTree();
|
|
@@ -232,7 +235,16 @@ class PFrameHolder implements PFrameInternal.PFrameDataSource, Disposable {
|
|
|
232
235
|
|
|
233
236
|
public readonly preloadBlob = async (blobIds: string[]): Promise<void> => {
|
|
234
237
|
const computables = blobIds.map((blobId) => this.getOrCreateComputableForBlob(blobId));
|
|
235
|
-
for (const computable of computables)
|
|
238
|
+
for (const computable of computables) {
|
|
239
|
+
try {
|
|
240
|
+
await computable.awaitStableFullValue(this.disposeSignal);
|
|
241
|
+
} catch (err: unknown) {
|
|
242
|
+
if (isAbortError(err)) {
|
|
243
|
+
break; // silence abort errors
|
|
244
|
+
}
|
|
245
|
+
throw err;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
236
248
|
};
|
|
237
249
|
|
|
238
250
|
public readonly resolveBlobContent = async (blobId: string): Promise<Uint8Array> => {
|
|
@@ -400,6 +412,16 @@ export class PFrameDriver implements InternalPFrameDriver {
|
|
|
400
412
|
super();
|
|
401
413
|
}
|
|
402
414
|
|
|
415
|
+
public acquire(params: InternalPFrameData): PollResource<PFrameHolder> {
|
|
416
|
+
return super.acquire(params);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
public getByKey(key: PFrameHandle): PFrameHolder {
|
|
420
|
+
const resource = super.tryGetByKey(key);
|
|
421
|
+
if (!resource) throw new PFrameDriverError(`PFrame not found, handle = ${key}`);
|
|
422
|
+
return resource;
|
|
423
|
+
}
|
|
424
|
+
|
|
403
425
|
protected createNewResource(params: InternalPFrameData): PFrameHolder {
|
|
404
426
|
if (getDebugFlags().logPFrameRequests)
|
|
405
427
|
logger.info(
|
|
@@ -409,7 +431,12 @@ export class PFrameDriver implements InternalPFrameDriver {
|
|
|
409
431
|
}
|
|
410
432
|
|
|
411
433
|
protected calculateParamsKey(params: InternalPFrameData): string {
|
|
412
|
-
|
|
434
|
+
try {
|
|
435
|
+
return stableKeyFromPFrameData(params);
|
|
436
|
+
} catch (err: unknown) {
|
|
437
|
+
if (isPFrameDriverError(err)) throw err;
|
|
438
|
+
throw new PFrameDriverError(`PFrame handle calculation failed, request: ${JSON.stringify(params, bigintReplacer)}, error: ${ensureError(err)}`);
|
|
439
|
+
}
|
|
413
440
|
}
|
|
414
441
|
})(this.blobDriver, this.logger, this.spillPath);
|
|
415
442
|
|
|
@@ -423,6 +450,12 @@ export class PFrameDriver implements InternalPFrameDriver {
|
|
|
423
450
|
super();
|
|
424
451
|
}
|
|
425
452
|
|
|
453
|
+
public getByKey(key: PTableHandle): PTableHolder {
|
|
454
|
+
const resource = super.tryGetByKey(key);
|
|
455
|
+
if (!resource) throw new PFrameDriverError(`PTable not found, handle = ${key}`);
|
|
456
|
+
return resource;
|
|
457
|
+
}
|
|
458
|
+
|
|
426
459
|
protected createNewResource(params: FullPTableDef): PTableHolder {
|
|
427
460
|
if (getDebugFlags().logPFrameRequests) {
|
|
428
461
|
logger.info(
|
|
@@ -470,7 +503,11 @@ export class PFrameDriver implements InternalPFrameDriver {
|
|
|
470
503
|
}
|
|
471
504
|
|
|
472
505
|
protected calculateParamsKey(params: FullPTableDef): string {
|
|
473
|
-
|
|
506
|
+
try {
|
|
507
|
+
return stableKeyFromFullPTableDef(params);
|
|
508
|
+
} catch (err: unknown) {
|
|
509
|
+
throw new PFrameDriverError(`PTable handle calculation failed, request: ${JSON.stringify(params)}, error: ${ensureError(err)}`);
|
|
510
|
+
}
|
|
474
511
|
}
|
|
475
512
|
})(this.pFrames);
|
|
476
513
|
}
|
|
@@ -769,7 +806,7 @@ function stableKeyFromPFrameData(data: PColumn<DataInfo<ResourceInfo>>[]): strin
|
|
|
769
806
|
};
|
|
770
807
|
break;
|
|
771
808
|
default:
|
|
772
|
-
throw
|
|
809
|
+
throw new PFrameDriverError(`unsupported resource type: ${JSON.stringify(type satisfies never)}`);
|
|
773
810
|
}
|
|
774
811
|
result.payload.sort((lhs, rhs) => lhs.key.localeCompare(rhs.key));
|
|
775
812
|
return result;
|
|
@@ -66,8 +66,9 @@ export abstract class RefCountResourcePool<P, R> {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
public getByKey(key: string): R {
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
const envelop = this.resources.get(key);
|
|
70
|
+
if (envelop === undefined) throw new Error(`resource not found, key = ${key}`);
|
|
71
|
+
return envelop.resource;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
public tryGetByKey(key: string): R | undefined {
|