@milaboratories/milaboratories.monetization-test.model 1.0.49 → 1.0.51

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,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.49 build /home/runner/_work/platforma/platforma/etc/blocks/monetization-test/model
3
+ > @milaboratories/milaboratories.monetization-test.model@1.0.51 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...
@@ -12,5 +12,5 @@ Building block-model project...
12
12
  ./src/index.ts → dist...
13
13
  (!) Circular dependency
14
14
  ../../../../sdk/model/dist/components/PFrameForGraphs.js -> ../../../../sdk/model/dist/pframe_utils/columns.js -> ../../../../sdk/model/dist/components/PFrameForGraphs.js
15
- created dist in 3.9s
15
+ created dist in 4.5s
16
16
  Build completed successfully
@@ -1,5 +1,5 @@
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.49 lint /home/runner/_work/platforma/platforma/etc/blocks/monetization-test/model
3
+ > @milaboratories/milaboratories.monetization-test.model@1.0.51 lint /home/runner/_work/platforma/platforma/etc/blocks/monetization-test/model
4
4
  > eslint .
5
5
 
@@ -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.49 type-check /home/runner/_work/platforma/platforma/etc/blocks/monetization-test/model
3
+ > @milaboratories/milaboratories.monetization-test.model@1.0.51 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 --customConditions ,
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @milaboratories/milaboratories.monetization-test.model
2
2
 
3
+ ## 1.0.51
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [a748b92]
8
+ - @platforma-sdk/model@1.53.1
9
+
10
+ ## 1.0.50
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [43b4247]
15
+ - @platforma-sdk/model@1.53.0
16
+
3
17
  ## 1.0.49
4
18
 
5
19
  ### Patch Changes
package/dist/bundle.js CHANGED
@@ -27,6 +27,11 @@
27
27
  * Increment this when the storage structure itself changes (not block state migrations).
28
28
  */
29
29
  const BLOCK_STORAGE_SCHEMA_VERSION = 'v1';
30
+ /**
31
+ * Default data version for new blocks without migrations.
32
+ * Unique identifier ensures blocks are created via DataModel API.
33
+ */
34
+ const DATA_MODEL_DEFAULT_VERSION = '__pl_v1_d4e8f2a1__';
30
35
  /**
31
36
  * Type guard to check if a value is a valid BlockStorage object.
32
37
  * Checks for the discriminator key and valid schema version.
@@ -46,16 +51,32 @@
46
51
  * Creates a BlockStorage with the given initial data
47
52
  *
48
53
  * @param initialData - The initial data value (defaults to empty object)
49
- * @param version - The initial data version (defaults to 1)
54
+ * @param version - The initial data version key (defaults to DATA_MODEL_DEFAULT_VERSION)
50
55
  * @returns A new BlockStorage instance with discriminator key
51
56
  */
52
- function createBlockStorage(initialData = {}, version = 1) {
57
+ function createBlockStorage(initialData = {}, version = DATA_MODEL_DEFAULT_VERSION) {
53
58
  return {
54
59
  [BLOCK_STORAGE_KEY]: BLOCK_STORAGE_SCHEMA_VERSION,
55
60
  __dataVersion: version,
56
61
  __data: initialData,
57
62
  };
58
63
  }
64
+ /**
65
+ * Normalizes raw storage data to BlockStorage format.
66
+ * If the input is already a BlockStorage, returns it as-is.
67
+ * If the input is legacy format (raw state), wraps it in BlockStorage structure.
68
+ *
69
+ * @param raw - Raw storage data (may be legacy format or BlockStorage)
70
+ * @returns Normalized BlockStorage
71
+ */
72
+ function normalizeBlockStorage(raw) {
73
+ if (isBlockStorage(raw)) {
74
+ const storage = raw;
75
+ return { ...storage, __dataVersion: String(storage.__dataVersion) };
76
+ }
77
+ // Legacy format: raw is the state directly
78
+ return createBlockStorage(raw);
79
+ }
59
80
  // =============================================================================
60
81
  // Data Access & Update Functions
61
82
  // =============================================================================
@@ -4770,6 +4791,9 @@
4770
4791
  Table: {
4771
4792
  OrderPriority: 'pl7.app/table/orderPriority'},
4772
4793
  Trace: 'pl7.app/trace',
4794
+ VDJ: {
4795
+ IsAssemblingFeature: 'pl7.app/vdj/isAssemblingFeature',
4796
+ },
4773
4797
  };
4774
4798
  const ValueTypeSchema = z.enum(['Int', 'Long', 'Float', 'Double', 'String']);
4775
4799
  const AnnotationJson = {
@@ -4799,6 +4823,7 @@
4799
4823
  [Annotation.Sequence.IsAnnotation]: z.boolean(),
4800
4824
  [Annotation.Table.OrderPriority]: z.number(),
4801
4825
  [Annotation.Trace]: z.record(z.string(), z.unknown()),
4826
+ [Annotation.VDJ.IsAssemblingFeature]: z.boolean(),
4802
4827
  };
4803
4828
  /// Helper function for reading plain annotation values
4804
4829
  function readAnnotation(spec, key) {
@@ -7481,7 +7506,7 @@
7481
7506
  }
7482
7507
  }
7483
7508
 
7484
- var version = "1.52.7";
7509
+ var version = "1.53.1";
7485
7510
 
7486
7511
  const PlatformaSDKVersion = version;
7487
7512
 
@@ -7747,7 +7772,7 @@
7747
7772
  *
7748
7773
  * Callbacks registered by DataModel.registerCallbacks():
7749
7774
  * - `__pl_data_initial`: () => initial data
7750
- * - `__pl_data_upgrade`: (versioned) => UpgradeResult
7775
+ * - `__pl_data_migrate`: (versioned) => DataMigrationResult
7751
7776
  * - `__pl_storage_initial`: () => initial BlockStorage as JSON string
7752
7777
  *
7753
7778
  * @module block_storage_vm
@@ -7783,7 +7808,8 @@
7783
7808
  }
7784
7809
  // Check for BlockStorage format (has discriminator)
7785
7810
  if (isBlockStorage(parsed)) {
7786
- return { storage: parsed, data: getStorageData(parsed) };
7811
+ const storage = normalizeBlockStorage(parsed);
7812
+ return { storage, data: getStorageData(storage) };
7787
7813
  }
7788
7814
  // Check for legacy V1/V2 format: { args, uiState }
7789
7815
  if (isLegacyModelV1ApiFormat(parsed)) {
@@ -7848,10 +7874,10 @@
7848
7874
  return getStorageDebugView(rawStorage);
7849
7875
  });
7850
7876
  /**
7851
- * Runs storage migration using the DataModel's upgrade callback.
7877
+ * Runs storage migration using the DataModel's migrate callback.
7852
7878
  * This is the main entry point for the middle layer to trigger migrations.
7853
7879
  *
7854
- * Uses the '__pl_data_upgrade' callback registered by DataModel.registerCallbacks() which:
7880
+ * Uses the '__pl_data_migrate' callback registered by DataModel.registerCallbacks() which:
7855
7881
  * - Handles all migration logic internally
7856
7882
  * - Returns { version, data, warning? } - warning present if reset to initial data
7857
7883
  *
@@ -7875,26 +7901,26 @@
7875
7901
  __data: data,
7876
7902
  });
7877
7903
  };
7878
- // Get the upgrade callback (registered by DataModel.registerCallbacks())
7879
- const upgradeCallback = ctx.callbackRegistry['__pl_data_upgrade'];
7880
- if (typeof upgradeCallback !== 'function') {
7881
- return { error: '__pl_data_upgrade callback not found (DataModel not registered)' };
7904
+ // Get the migrate callback (registered by DataModel.registerCallbacks())
7905
+ const migrateCallback = ctx.callbackRegistry['__pl_data_migrate'];
7906
+ if (typeof migrateCallback !== 'function') {
7907
+ return { error: '__pl_data_migrate callback not found (DataModel not registered)' };
7882
7908
  }
7883
- // Call the migrator's upgrade function
7909
+ // Call the migrator's migrate function
7884
7910
  let result;
7885
7911
  try {
7886
- result = upgradeCallback({ version: currentVersion, data: currentData });
7912
+ result = migrateCallback({ version: currentVersion, data: currentData });
7887
7913
  }
7888
7914
  catch (e) {
7889
7915
  const errorMsg = e instanceof Error ? e.message : String(e);
7890
- return { error: `upgrade() threw: ${errorMsg}` };
7916
+ return { error: `migrate() threw: ${errorMsg}` };
7891
7917
  }
7892
7918
  // Build info message
7893
7919
  const info = result.version === currentVersion
7894
- ? `No migration needed (v${currentVersion})`
7920
+ ? `No migration needed (${currentVersion})`
7895
7921
  : result.warning
7896
- ? `Reset to initial data (v${result.version})`
7897
- : `Migrated v${currentVersion}→v${result.version}`;
7922
+ ? `Reset to initial data (${result.version})`
7923
+ : `Migrated ${currentVersion}→${result.version}`;
7898
7924
  return {
7899
7925
  newStorageJson: createStorageJson(result.data, result.version),
7900
7926
  info,