@milaboratories/milaboratories.monetization-test.model 1.0.50 → 1.0.52
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/.turbo/turbo-build.log +3 -3
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +14 -0
- package/dist/bundle.js +43 -15
- package/dist/bundle.js.map +1 -1
- package/dist/model.json +1 -1
- package/package.json +3 -3
package/.turbo/turbo-build.log
CHANGED
|
@@ -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.
|
|
3
|
+
> @milaboratories/milaboratories.monetization-test.model@1.0.52 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
|
[36m
|
|
9
9
|
[1m./src/index.ts[22m → [1mdist, dist[22m...[39m
|
|
10
|
-
[32mcreated [1mdist, dist[22m in [
|
|
10
|
+
[32mcreated [1mdist, dist[22m in [1m2.8s[22m[39m
|
|
11
11
|
[36m
|
|
12
12
|
[1m./src/index.ts[22m → [1mdist[22m...[39m
|
|
13
13
|
[1m[33m(!) Circular dependency[39m[22m
|
|
14
14
|
../../../../sdk/model/dist/components/PFrameForGraphs.js -> ../../../../sdk/model/dist/pframe_utils/columns.js -> ../../../../sdk/model/dist/components/PFrameForGraphs.js
|
|
15
|
-
[32mcreated [1mdist[22m in [
|
|
15
|
+
[32mcreated [1mdist[22m in [1m3.8s[22m[39m
|
|
16
16
|
Build completed successfully
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -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.
|
|
3
|
+
> @milaboratories/milaboratories.monetization-test.model@1.0.52 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.
|
|
3
|
+
> @milaboratories/milaboratories.monetization-test.model@1.0.52 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.52
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [57799dd]
|
|
8
|
+
- @platforma-sdk/model@1.53.2
|
|
9
|
+
|
|
10
|
+
## 1.0.51
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies [a748b92]
|
|
15
|
+
- @platforma-sdk/model@1.53.1
|
|
16
|
+
|
|
3
17
|
## 1.0.50
|
|
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,38 @@
|
|
|
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
|
|
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 =
|
|
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 {
|
|
76
|
+
...storage,
|
|
77
|
+
// Fix for early released version where __dataVersion was a number
|
|
78
|
+
__dataVersion: typeof storage.__dataVersion === 'number'
|
|
79
|
+
? DATA_MODEL_DEFAULT_VERSION
|
|
80
|
+
: storage.__dataVersion,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
// Legacy format: raw is the state directly
|
|
84
|
+
return createBlockStorage(raw);
|
|
85
|
+
}
|
|
59
86
|
// =============================================================================
|
|
60
87
|
// Data Access & Update Functions
|
|
61
88
|
// =============================================================================
|
|
@@ -7485,7 +7512,7 @@
|
|
|
7485
7512
|
}
|
|
7486
7513
|
}
|
|
7487
7514
|
|
|
7488
|
-
var version = "1.53.
|
|
7515
|
+
var version = "1.53.2";
|
|
7489
7516
|
|
|
7490
7517
|
const PlatformaSDKVersion = version;
|
|
7491
7518
|
|
|
@@ -7751,7 +7778,7 @@
|
|
|
7751
7778
|
*
|
|
7752
7779
|
* Callbacks registered by DataModel.registerCallbacks():
|
|
7753
7780
|
* - `__pl_data_initial`: () => initial data
|
|
7754
|
-
* - `__pl_data_upgrade`: (versioned) =>
|
|
7781
|
+
* - `__pl_data_upgrade`: (versioned) => DataMigrationResult
|
|
7755
7782
|
* - `__pl_storage_initial`: () => initial BlockStorage as JSON string
|
|
7756
7783
|
*
|
|
7757
7784
|
* @module block_storage_vm
|
|
@@ -7787,7 +7814,8 @@
|
|
|
7787
7814
|
}
|
|
7788
7815
|
// Check for BlockStorage format (has discriminator)
|
|
7789
7816
|
if (isBlockStorage(parsed)) {
|
|
7790
|
-
|
|
7817
|
+
const storage = normalizeBlockStorage(parsed);
|
|
7818
|
+
return { storage, data: getStorageData(storage) };
|
|
7791
7819
|
}
|
|
7792
7820
|
// Check for legacy V1/V2 format: { args, uiState }
|
|
7793
7821
|
if (isLegacyModelV1ApiFormat(parsed)) {
|
|
@@ -7852,7 +7880,7 @@
|
|
|
7852
7880
|
return getStorageDebugView(rawStorage);
|
|
7853
7881
|
});
|
|
7854
7882
|
/**
|
|
7855
|
-
* Runs storage migration using the DataModel's
|
|
7883
|
+
* Runs storage migration using the DataModel's migrate callback.
|
|
7856
7884
|
* This is the main entry point for the middle layer to trigger migrations.
|
|
7857
7885
|
*
|
|
7858
7886
|
* Uses the '__pl_data_upgrade' callback registered by DataModel.registerCallbacks() which:
|
|
@@ -7879,26 +7907,26 @@
|
|
|
7879
7907
|
__data: data,
|
|
7880
7908
|
});
|
|
7881
7909
|
};
|
|
7882
|
-
// Get the
|
|
7883
|
-
const
|
|
7884
|
-
if (typeof
|
|
7910
|
+
// Get the migrate callback (registered by DataModel.registerCallbacks())
|
|
7911
|
+
const migrateCallback = ctx.callbackRegistry['__pl_data_upgrade'];
|
|
7912
|
+
if (typeof migrateCallback !== 'function') {
|
|
7885
7913
|
return { error: '__pl_data_upgrade callback not found (DataModel not registered)' };
|
|
7886
7914
|
}
|
|
7887
|
-
// Call the migrator's
|
|
7915
|
+
// Call the migrator's migrate function
|
|
7888
7916
|
let result;
|
|
7889
7917
|
try {
|
|
7890
|
-
result =
|
|
7918
|
+
result = migrateCallback({ version: currentVersion, data: currentData });
|
|
7891
7919
|
}
|
|
7892
7920
|
catch (e) {
|
|
7893
7921
|
const errorMsg = e instanceof Error ? e.message : String(e);
|
|
7894
|
-
return { error: `
|
|
7922
|
+
return { error: `migrate() threw: ${errorMsg}` };
|
|
7895
7923
|
}
|
|
7896
7924
|
// Build info message
|
|
7897
7925
|
const info = result.version === currentVersion
|
|
7898
|
-
? `No migration needed (
|
|
7926
|
+
? `No migration needed (${currentVersion})`
|
|
7899
7927
|
: result.warning
|
|
7900
|
-
? `Reset to initial data (
|
|
7901
|
-
: `Migrated
|
|
7928
|
+
? `Reset to initial data (${result.version})`
|
|
7929
|
+
: `Migrated ${currentVersion}→${result.version}`;
|
|
7902
7930
|
return {
|
|
7903
7931
|
newStorageJson: createStorageJson(result.data, result.version),
|
|
7904
7932
|
info,
|