@milaboratories/milaboratories.monetization-test.model 1.0.24 → 1.0.26

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,16 +1,16 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/milaboratories.monetization-test.model@1.0.24 build /home/runner/_work/platforma/platforma/etc/blocks/monetization-test/model
3
+ > @milaboratories/milaboratories.monetization-test.model@1.0.26 build /home/runner/_work/platforma/platforma/etc/blocks/monetization-test/model
4
4
  > ts-builder build --target block-model && block-tools build-model
5
5
 
6
6
  Building block-model project...
7
7
  ↳ rollup -c /configs/rollup.block-model.config.js
8
8
  
9
9
  ./src/index.ts → dist, dist...
10
- created dist, dist in 4.7s
10
+ created dist, dist in 3.9s
11
11
  
12
12
  ./src/index.ts → dist...
13
13
  (!) Circular dependency
14
14
  ../../../../sdk/model/dist/components/PFrameForGraphs.js -> ../../../../sdk/model/dist/components/PlDataTable.js -> ../../../../sdk/model/dist/components/PFrameForGraphs.js
15
- created dist in 4.2s
15
+ created dist in 5.2s
16
16
  Build completed successfully
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/home/runner/_work/platforma/platforma/.npmrc". Failed to replace env in config: ${NPMJS_TOKEN}
2
2
 
3
- > @milaboratories/milaboratories.monetization-test.model@1.0.24 type-check /home/runner/_work/platforma/platforma/etc/blocks/monetization-test/model
3
+ > @milaboratories/milaboratories.monetization-test.model@1.0.26 type-check /home/runner/_work/platforma/platforma/etc/blocks/monetization-test/model
4
4
  > ts-builder types --target block-model
5
5
 
6
6
  ↳ tsc --noEmit --project ./tsconfig.json
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @milaboratories/milaboratories.monetization-test.model
2
2
 
3
+ ## 1.0.26
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [64cee78]
8
+ - @platforma-sdk/model@1.45.17
9
+
10
+ ## 1.0.25
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [3ef2381]
15
+ - @platforma-sdk/model@1.45.0
16
+
3
17
  ## 1.0.24
4
18
 
5
19
  ### Patch Changes
package/dist/bundle.js CHANGED
@@ -4385,6 +4385,36 @@
4385
4385
  }
4386
4386
  }
4387
4387
  }
4388
+ /**
4389
+ * @param dataInfo - The source DataInfo object
4390
+ * @param cb - Callback, function that have access to every blob to visit them all
4391
+ * @returns Nothing
4392
+ */
4393
+ function visitDataInfo(dataInfo, cb) {
4394
+ switch (dataInfo.type) {
4395
+ case 'Json':
4396
+ // Json type doesn't contain blobs, so return as is
4397
+ break;
4398
+ case 'JsonPartitioned': {
4399
+ // Visit each blob in parts
4400
+ Object.values(dataInfo.parts).forEach(cb);
4401
+ break;
4402
+ }
4403
+ case 'BinaryPartitioned': {
4404
+ // Visit each index and values blob in parts
4405
+ Object.values(dataInfo.parts).forEach((chunk) => {
4406
+ cb(chunk.index);
4407
+ cb(chunk.values);
4408
+ });
4409
+ break;
4410
+ }
4411
+ case 'ParquetPartitioned': {
4412
+ // Visit each blob in parts
4413
+ Object.values(dataInfo.parts).forEach(cb);
4414
+ break;
4415
+ }
4416
+ }
4417
+ }
4388
4418
  /**
4389
4419
  * Type guard function that checks if the given value is a valid DataInfoEntries.
4390
4420
  *
@@ -5451,6 +5481,89 @@
5451
5481
  const StagingAccessorName = 'staging';
5452
5482
  const MainAccessorName = 'main';
5453
5483
 
5484
+ function filterDataInfoEntries(dataInfoEntries, axisFilters) {
5485
+ // Sort filters by axis index in descending order to safely remove elements from arrays
5486
+ const sortedFilters = [...axisFilters].sort((a, b) => b[0] - a[0]);
5487
+ // Check for invalid filter axes
5488
+ const { type } = dataInfoEntries;
5489
+ switch (type) {
5490
+ case 'Json': {
5491
+ const { keyLength } = dataInfoEntries;
5492
+ for (const [axisIdx] of axisFilters)
5493
+ if (axisIdx >= keyLength)
5494
+ throw new Error(`Can't filter on non-data axis ${axisIdx}. Must be >= ${keyLength}`);
5495
+ break;
5496
+ }
5497
+ case 'JsonPartitioned':
5498
+ case 'BinaryPartitioned':
5499
+ case 'ParquetPartitioned': {
5500
+ const { partitionKeyLength } = dataInfoEntries;
5501
+ for (const [axisIdx] of axisFilters)
5502
+ if (axisIdx >= partitionKeyLength)
5503
+ throw new Error(`Can't filter on non-partitioned axis ${axisIdx}. Must be >= ${partitionKeyLength}`);
5504
+ break;
5505
+ }
5506
+ default:
5507
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
5508
+ throw new Error(`Unsupported data info type: ${type}`);
5509
+ }
5510
+ const keyMatchesFilters = (key) => {
5511
+ for (const [axisIdx, axisValue] of sortedFilters)
5512
+ if (key[axisIdx] !== axisValue)
5513
+ return false;
5514
+ return true;
5515
+ };
5516
+ const removeFilteredAxes = (key) => {
5517
+ const newKey = [...key];
5518
+ // Remove axes in descending order to maintain correct indices
5519
+ for (const [axisIdx] of sortedFilters)
5520
+ newKey.splice(axisIdx, 1);
5521
+ return newKey;
5522
+ };
5523
+ switch (dataInfoEntries.type) {
5524
+ case 'Json': return {
5525
+ type: 'Json',
5526
+ keyLength: dataInfoEntries.keyLength - axisFilters.length,
5527
+ data: dataInfoEntries.data
5528
+ .filter((entry) => keyMatchesFilters(entry.key))
5529
+ .map((entry) => ({
5530
+ key: removeFilteredAxes(entry.key),
5531
+ value: entry.value,
5532
+ })),
5533
+ };
5534
+ case 'JsonPartitioned': return {
5535
+ type: 'JsonPartitioned',
5536
+ partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
5537
+ parts: dataInfoEntries.parts
5538
+ .filter((entry) => keyMatchesFilters(entry.key))
5539
+ .map((entry) => ({
5540
+ key: removeFilteredAxes(entry.key),
5541
+ value: entry.value,
5542
+ })),
5543
+ };
5544
+ case 'BinaryPartitioned': return {
5545
+ type: 'BinaryPartitioned',
5546
+ partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
5547
+ parts: dataInfoEntries.parts
5548
+ .filter((entry) => keyMatchesFilters(entry.key))
5549
+ .map((entry) => ({
5550
+ key: removeFilteredAxes(entry.key),
5551
+ value: entry.value,
5552
+ })),
5553
+ };
5554
+ case 'ParquetPartitioned': return {
5555
+ type: 'ParquetPartitioned',
5556
+ partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
5557
+ parts: dataInfoEntries.parts
5558
+ .filter((entry) => keyMatchesFilters(entry.key))
5559
+ .map((entry) => ({
5560
+ key: removeFilteredAxes(entry.key),
5561
+ value: entry.value,
5562
+ })),
5563
+ };
5564
+ }
5565
+ }
5566
+
5454
5567
  const TraceEntry = z.object({
5455
5568
  type: z.string(),
5456
5569
  importance: z.number().optional(),
@@ -5934,88 +6047,24 @@
5934
6047
  return parsePColumnData(acc);
5935
6048
  throw new Error(`Unexpected input type: ${typeof acc}`);
5936
6049
  }
5937
-
5938
- function filterDataInfoEntries(dataInfoEntries, axisFilters) {
5939
- // Sort filters by axis index in descending order to safely remove elements from arrays
5940
- const sortedFilters = [...axisFilters].sort((a, b) => b[0] - a[0]);
5941
- // Check for invalid filter axes
5942
- const { type } = dataInfoEntries;
5943
- switch (type) {
5944
- case 'Json': {
5945
- const { keyLength } = dataInfoEntries;
5946
- for (const [axisIdx] of axisFilters)
5947
- if (axisIdx >= keyLength)
5948
- throw new Error(`Can't filter on non-data axis ${axisIdx}. Must be >= ${keyLength}`);
5949
- break;
5950
- }
5951
- case 'JsonPartitioned':
5952
- case 'BinaryPartitioned':
5953
- case 'ParquetPartitioned': {
5954
- const { partitionKeyLength } = dataInfoEntries;
5955
- for (const [axisIdx] of axisFilters)
5956
- if (axisIdx >= partitionKeyLength)
5957
- throw new Error(`Can't filter on non-partitioned axis ${axisIdx}. Must be >= ${partitionKeyLength}`);
5958
- break;
5959
- }
5960
- default:
5961
- // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
5962
- throw new Error(`Unsupported data info type: ${type}`);
6050
+ function isPColumnReady(c) {
6051
+ const isValues = (d) => Array.isArray(d);
6052
+ const isAccessor = (d) => d instanceof TreeNodeAccessor;
6053
+ let ready = true;
6054
+ if (isAccessor(c.data)) {
6055
+ ready &&= c.data.getIsReadyOrError();
5963
6056
  }
5964
- const keyMatchesFilters = (key) => {
5965
- for (const [axisIdx, axisValue] of sortedFilters)
5966
- if (key[axisIdx] !== axisValue)
5967
- return false;
5968
- return true;
5969
- };
5970
- const removeFilteredAxes = (key) => {
5971
- const newKey = [...key];
5972
- // Remove axes in descending order to maintain correct indices
5973
- for (const [axisIdx] of sortedFilters)
5974
- newKey.splice(axisIdx, 1);
5975
- return newKey;
5976
- };
5977
- switch (dataInfoEntries.type) {
5978
- case 'Json': return {
5979
- type: 'Json',
5980
- keyLength: dataInfoEntries.keyLength - axisFilters.length,
5981
- data: dataInfoEntries.data
5982
- .filter((entry) => keyMatchesFilters(entry.key))
5983
- .map((entry) => ({
5984
- key: removeFilteredAxes(entry.key),
5985
- value: entry.value,
5986
- })),
5987
- };
5988
- case 'JsonPartitioned': return {
5989
- type: 'JsonPartitioned',
5990
- partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
5991
- parts: dataInfoEntries.parts
5992
- .filter((entry) => keyMatchesFilters(entry.key))
5993
- .map((entry) => ({
5994
- key: removeFilteredAxes(entry.key),
5995
- value: entry.value,
5996
- })),
5997
- };
5998
- case 'BinaryPartitioned': return {
5999
- type: 'BinaryPartitioned',
6000
- partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
6001
- parts: dataInfoEntries.parts
6002
- .filter((entry) => keyMatchesFilters(entry.key))
6003
- .map((entry) => ({
6004
- key: removeFilteredAxes(entry.key),
6005
- value: entry.value,
6006
- })),
6007
- };
6008
- case 'ParquetPartitioned': return {
6009
- type: 'ParquetPartitioned',
6010
- partitionKeyLength: dataInfoEntries.partitionKeyLength - axisFilters.length,
6011
- parts: dataInfoEntries.parts
6012
- .filter((entry) => keyMatchesFilters(entry.key))
6013
- .map((entry) => ({
6014
- key: removeFilteredAxes(entry.key),
6015
- value: entry.value,
6016
- })),
6017
- };
6057
+ else if (isDataInfo(c.data)) {
6058
+ visitDataInfo(c.data, (v) => ready &&= v.getIsReadyOrError());
6059
+ }
6060
+ else if (!isValues(c.data)) {
6061
+ // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
6062
+ throw Error(`unsupported column data type: ${c.data}`);
6018
6063
  }
6064
+ return ready;
6065
+ }
6066
+ function allPColumnsReady(columns) {
6067
+ return columns.every(isPColumnReady);
6019
6068
  }
6020
6069
 
6021
6070
  function isPColumnValues(value) {
@@ -6821,6 +6870,8 @@
6821
6870
  // TODO remove all non-PColumn fields
6822
6871
  createPFrame(def) {
6823
6872
  this.verifyInlineAndExplicitColumnsSupport(def);
6873
+ if (!allPColumnsReady(def))
6874
+ return undefined;
6824
6875
  return this.ctx.createPFrame(def.map((c) => transformPColumnData(c)));
6825
6876
  }
6826
6877
  createPTable(def) {
@@ -6839,7 +6890,10 @@
6839
6890
  else {
6840
6891
  rawDef = this.patchPTableDef(def);
6841
6892
  }
6842
- this.verifyInlineAndExplicitColumnsSupport(extractAllColumns(rawDef.src));
6893
+ const columns = extractAllColumns(rawDef.src);
6894
+ this.verifyInlineAndExplicitColumnsSupport(columns);
6895
+ if (!allPColumnsReady(columns))
6896
+ return undefined;
6843
6897
  return this.ctx.createPTable(mapPTableDef(rawDef, (po) => transformPColumnData(po)));
6844
6898
  }
6845
6899
  /** @deprecated scheduled for removal from SDK */
@@ -6860,7 +6914,7 @@
6860
6914
  }
6861
6915
  }
6862
6916
 
6863
- var version = "1.44.14";
6917
+ var version = "1.45.17";
6864
6918
 
6865
6919
  const PlatformaSDKVersion = version;
6866
6920