@milaboratories/pl-middle-layer 1.23.4 → 1.23.6

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,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAE5D,OAAO,EAAwB,kBAAkB,EAAgB,MAAM,yBAAyB,CAAC;AACjG,OAAO,EAAE,aAAa,EAA2B,MAAM,4BAA4B,CAAC;AACpF,OAAO,EACL,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,EAEP,SAAS,EAET,SAAS,EAKT,aAAa,EAEd,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EAAe,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAsHnE,qBAAa,YAAa,YAAW,eAAe;IAQhD,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM;IARzB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyD;IACjF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAwE;IAChG,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAA+B;IAChE,0FAA0F;IAC1F,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAA8B;gBAG9C,UAAU,EAAE,cAAc,EAC1B,MAAM,EAAE,QAAQ;IA4D5B,YAAY,CACjB,GAAG,EAAE,SAAS,CAAC,kBAAkB,GAAG,aAAa,CAAC,EAClD,GAAG,EAAE,aAAa,GACjB,YAAY;IAaR,YAAY,CACjB,GAAG,EAAE,SAAS,CAA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AY,EACpB,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,oBAAoB,CAAC;IAiBnB,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.23.4",
3
+ "version": "1.23.6",
4
4
  "description": "Pl Middle Layer",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",
@@ -29,20 +29,20 @@
29
29
  "yaml": "^2.6.1",
30
30
  "zod": "~3.23.8",
31
31
  "@milaboratories/pl-http": "^1.0.2",
32
- "@milaboratories/computable": "^2.3.4",
33
32
  "@milaboratories/resolve-helper": "^1.0.2",
34
- "@platforma-sdk/block-tools": "^2.5.1",
33
+ "@milaboratories/computable": "^2.3.4",
35
34
  "@milaboratories/pl-client": "^2.7.1",
36
- "@milaboratories/pl-model-common": "^1.10.2",
35
+ "@platforma-sdk/block-tools": "^2.5.1",
37
36
  "@milaboratories/pl-drivers": "^1.5.6",
38
37
  "@milaboratories/pl-model-middle-layer": "^1.6.9",
39
- "@milaboratories/pl-tree": "^1.4.20",
40
38
  "@milaboratories/pl-model-backend": "^1.0.1",
39
+ "@milaboratories/pl-model-common": "^1.10.2",
40
+ "@milaboratories/pl-tree": "^1.4.20",
41
+ "@milaboratories/ts-helpers": "^1.1.3",
41
42
  "@platforma-sdk/workflow-tengo": "2.8.8",
43
+ "@platforma-sdk/model": "^1.21.0",
42
44
  "@milaboratories/pl-config": "^1.3.3",
43
- "@milaboratories/pl-local": "^1.10.0",
44
- "@platforma-sdk/model": "^1.20.27",
45
- "@milaboratories/ts-helpers": "^1.1.3"
45
+ "@milaboratories/pl-local": "^1.10.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "semver": "^7.6.3",
@@ -54,8 +54,8 @@
54
54
  "jest": "^29.7.0",
55
55
  "@jest/globals": "^29.7.0",
56
56
  "ts-jest": "^29.2.5",
57
- "@milaboratories/platforma-build-configs": "1.0.2",
58
- "@milaboratories/eslint-config": "^1.0.1"
57
+ "@milaboratories/eslint-config": "^1.0.1",
58
+ "@milaboratories/platforma-build-configs": "1.0.2"
59
59
  },
60
60
  "scripts": {
61
61
  "type-check": "tsc --noEmit --composite false",
@@ -180,7 +180,7 @@ export class PFrameDriver implements SdkPFrameDriver {
180
180
  protected createNewResource(params: InternalPFrameData): PFrameHolder {
181
181
  if (getDebugFlags().logPFrameRequests)
182
182
  logger.info(
183
- `Create PFrame (${this.calculateParamsKey(params)}): ${JSON.stringify(params, bigintReplacer)}`
183
+ `PFrame creation (pFrameHandle = ${this.calculateParamsKey(params)}): ${JSON.stringify(params, bigintReplacer)}`
184
184
  );
185
185
  return new PFrameHolder(this.blobDriver, blobContentCache, params);
186
186
  }
@@ -203,7 +203,7 @@ export class PFrameDriver implements SdkPFrameDriver {
203
203
  const rawPTable = await concurrencyLimiter.run(async () => {
204
204
  if (getDebugFlags().logPFrameRequests)
205
205
  logger.info(
206
- `Create PTable (${this.calculateParamsKey(params)}): ${JSON.stringify(params, bigintReplacer)}`
206
+ `PTable creation (pTableHandle = ${this.calculateParamsKey(params)}): ${JSON.stringify(params, bigintReplacer)}`
207
207
  );
208
208
  return await pFrame.pFrame.createTable({
209
209
  src: joinEntryToInternal(params.def.src),
@@ -245,6 +245,13 @@ export class PFrameDriver implements SdkPFrameDriver {
245
245
  const pFrameHandle = this.createPFrame(extractAllColumns(def.src), ctx);
246
246
  const defIds = mapPTableDef(def, (c) => c.id);
247
247
  const res = this.pTables.acquire({ def: defIds, pFrameHandle });
248
+ if (getDebugFlags().logPFrameRequests)
249
+ this.logger.info(
250
+ `Create PTable call (pFrameHandle = ${pFrameHandle}; pTableHandle = ${res}): ${JSON.stringify(
251
+ mapPTableDef(def, (c) => c.spec),
252
+ bigintReplacer
253
+ )}`
254
+ );
248
255
  ctx.addOnDestroy(res.unref); // in addition to pframe unref added in createPFrame above
249
256
  return res.key as PTableHandle;
250
257
  }
@@ -292,7 +299,7 @@ export class PFrameDriver implements SdkPFrameDriver {
292
299
  let table = await this.concurrencyLimiter.run(async () => {
293
300
  if (getDebugFlags().logPFrameRequests)
294
301
  this.logger.info(
295
- `calculateTableData, handle = ${handle}, request = ${JSON.stringify(request, bigintReplacer)}`
302
+ `Call calculateTableData, handle = ${handle}, request = ${JSON.stringify(request, bigintReplacer)}`
296
303
  );
297
304
  return await this.pFrames.getByKey(handle).pFrame.createTable({
298
305
  src: joinEntryToInternal(request.src),
@@ -327,7 +334,7 @@ export class PFrameDriver implements SdkPFrameDriver {
327
334
  return await this.concurrencyLimiter.run(async () => {
328
335
  if (getDebugFlags().logPFrameRequests)
329
336
  this.logger.info(
330
- `getUniqueValues, handle = ${handle}, request = ${JSON.stringify(request, bigintReplacer)}`
337
+ `Call getUniqueValues, handle = ${handle}, request = ${JSON.stringify(request, bigintReplacer)}`
331
338
  );
332
339
  return await this.pFrames.getByKey(handle).pFrame.getUniqueValues({
333
340
  ...request,
@@ -389,58 +396,60 @@ function joinEntryToInternal(entry: JoinEntry<PObjectId>): PFrameInternal.JoinEn
389
396
 
390
397
  function stableKeyFromFullPTableDef(data: FullPTableDef): string {
391
398
  const hash = createHash('sha256');
392
- hash.update(canonicalize(data.def)!);
399
+ hash.update(canonicalize(data)!);
393
400
  return hash.digest().toString('hex');
394
401
  }
395
402
 
396
403
  function stableKeyFromPFrameData(data: PColumn<PFrameInternal.DataInfo<ResourceInfo>>[]): string {
397
- const orderedData = [...data].map((column) => mapPObjectData(column, (r) => {
398
- let result: {
399
- type: string,
400
- keyLength: number,
401
- payload: {
402
- key: string;
403
- value: null | number | string | [string, string]
404
- }[];
405
- };
406
- const type = r.type;
407
- switch (type) {
408
- case 'Json':
409
- result = {
410
- type: r.type,
411
- keyLength: r.keyLength,
412
- payload: Object.entries(r.data).map(([part, value]) => ({
413
- key: part,
414
- value,
415
- }))
416
- };
417
- break;
418
- case 'JsonPartitioned':
419
- result = {
420
- type: r.type,
421
- keyLength: r.partitionKeyLength,
422
- payload: Object.entries(r.parts).map(([part, info]) => ({
423
- key: part,
424
- value: info.id.toString(),
425
- }))
426
- };
427
- break;
428
- case 'BinaryPartitioned':
429
- result = {
430
- type: r.type,
431
- keyLength: r.partitionKeyLength,
432
- payload: Object.entries(r.parts).map(([part, info]) => ({
433
- key: part,
434
- value: [info.index.id.toString(), info.values.id.toString()] as const,
435
- }))
436
- };
437
- break;
438
- default:
439
- throw Error(`unsupported resource type: ${ type satisfies never }`);
440
- }
441
- result.payload.sort((lhs, rhs) => lhs.key.localeCompare(rhs.key));
442
- return result;
443
- }));
404
+ const orderedData = [...data].map((column) =>
405
+ mapPObjectData(column, (r) => {
406
+ let result: {
407
+ type: string;
408
+ keyLength: number;
409
+ payload: {
410
+ key: string;
411
+ value: null | number | string | [string, string];
412
+ }[];
413
+ };
414
+ const type = r.type;
415
+ switch (type) {
416
+ case 'Json':
417
+ result = {
418
+ type: r.type,
419
+ keyLength: r.keyLength,
420
+ payload: Object.entries(r.data).map(([part, value]) => ({
421
+ key: part,
422
+ value
423
+ }))
424
+ };
425
+ break;
426
+ case 'JsonPartitioned':
427
+ result = {
428
+ type: r.type,
429
+ keyLength: r.partitionKeyLength,
430
+ payload: Object.entries(r.parts).map(([part, info]) => ({
431
+ key: part,
432
+ value: info.id.toString()
433
+ }))
434
+ };
435
+ break;
436
+ case 'BinaryPartitioned':
437
+ result = {
438
+ type: r.type,
439
+ keyLength: r.partitionKeyLength,
440
+ payload: Object.entries(r.parts).map(([part, info]) => ({
441
+ key: part,
442
+ value: [info.index.id.toString(), info.values.id.toString()] as const
443
+ }))
444
+ };
445
+ break;
446
+ default:
447
+ throw Error(`unsupported resource type: ${type satisfies never}`);
448
+ }
449
+ result.payload.sort((lhs, rhs) => lhs.key.localeCompare(rhs.key));
450
+ return result;
451
+ })
452
+ );
444
453
  orderedData.sort((lhs, rhs) => lhs.id.localeCompare(rhs.id));
445
454
 
446
455
  const hash = createHash('sha256');