@platforma-sdk/ui-vue 1.40.6 → 1.41.0

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.
Files changed (98) hide show
  1. package/.turbo/turbo-build.log +49 -22
  2. package/.turbo/turbo-type-check.log +1 -1
  3. package/CHANGELOG.md +12 -0
  4. package/dist/AgGridVue/useAgGridOptions.js +54 -53
  5. package/dist/AgGridVue/useAgGridOptions.js.map +1 -1
  6. package/dist/components/BlockLayout.vue.d.ts.map +1 -1
  7. package/dist/components/BlockLayout.vue.js +7 -50
  8. package/dist/components/BlockLayout.vue.js.map +1 -1
  9. package/dist/components/BlockLayout.vue2.js +53 -2
  10. package/dist/components/BlockLayout.vue2.js.map +1 -1
  11. package/dist/components/BlockLayout.vue3.js +9 -0
  12. package/dist/components/BlockLayout.vue3.js.map +1 -0
  13. package/dist/components/NotFound.vue.d.ts.map +1 -1
  14. package/dist/components/NotFound.vue.js +12 -14
  15. package/dist/components/NotFound.vue.js.map +1 -1
  16. package/dist/components/PlAgDataTable/PlAgRowCount.vue.js +7 -6
  17. package/dist/components/PlAgDataTable/PlAgRowCount.vue.js.map +1 -1
  18. package/dist/components/PlAgDataTable/sources/table-source-v2.js +12 -12
  19. package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js +10 -9
  20. package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js.map +1 -1
  21. package/dist/components/PlAgRowNumHeader.vue.js +3 -2
  22. package/dist/components/PlAgRowNumHeader.vue.js.map +1 -1
  23. package/dist/components/PlAnnotations/components/DynamicForm.vue2.js +10 -10
  24. package/dist/components/PlAnnotations/components/PlAnnotationCreateDialog.vue.d.ts +1 -1
  25. package/dist/components/PlAnnotations/components/PlAnnotationCreateDialog.vue.d.ts.map +1 -1
  26. package/dist/components/PlMultiSequenceAlignment/data.js +51 -51
  27. package/dist/composition/fileContent.js +16 -16
  28. package/dist/defineApp.d.ts +19 -6
  29. package/dist/defineApp.d.ts.map +1 -1
  30. package/dist/defineApp.js +50 -30
  31. package/dist/defineApp.js.map +1 -1
  32. package/dist/internal/UpdateSerializer.d.ts +26 -0
  33. package/dist/internal/UpdateSerializer.d.ts.map +1 -0
  34. package/dist/internal/UpdateSerializer.js +65 -0
  35. package/dist/internal/UpdateSerializer.js.map +1 -0
  36. package/dist/internal/createAppModel.d.ts +1 -1
  37. package/dist/internal/createAppModel.d.ts.map +1 -1
  38. package/dist/internal/createAppModel.js +43 -51
  39. package/dist/internal/createAppModel.js.map +1 -1
  40. package/dist/internal/{createApp.d.ts → createAppV1.d.ts} +4 -4
  41. package/dist/internal/createAppV1.d.ts.map +1 -0
  42. package/dist/internal/{createApp.js → createAppV1.js} +17 -18
  43. package/dist/internal/createAppV1.js.map +1 -0
  44. package/dist/internal/createAppV2.d.ts +56 -0
  45. package/dist/internal/createAppV2.d.ts.map +1 -0
  46. package/dist/internal/createAppV2.js +158 -0
  47. package/dist/internal/createAppV2.js.map +1 -0
  48. package/dist/internal/test-helpers/BlockMock.d.ts +28 -0
  49. package/dist/internal/test-helpers/BlockMock.d.ts.map +1 -0
  50. package/dist/internal/test-helpers/createMockApi.d.ts +4 -0
  51. package/dist/internal/test-helpers/createMockApi.d.ts.map +1 -0
  52. package/dist/internal/test-helpers/utils.d.ts +4 -0
  53. package/dist/internal/test-helpers/utils.d.ts.map +1 -0
  54. package/dist/{types.static-test.d.ts → internal/v1.static-test.d.ts} +3 -3
  55. package/dist/internal/v1.static-test.d.ts.map +1 -0
  56. package/dist/internal/v2.static-test.d.ts +7 -0
  57. package/dist/internal/v2.static-test.d.ts.map +1 -0
  58. package/dist/lib/model/common/dist/index.js +214 -199
  59. package/dist/lib/model/common/dist/index.js.map +1 -1
  60. package/dist/lib/ui/uikit/dist/components/PlAccordion/{ExpandTransition.vue.js → ExpandTransition.vue2.js} +1 -1
  61. package/dist/lib/ui/uikit/dist/components/PlAccordion/ExpandTransition.vue2.js.map +1 -0
  62. package/dist/lib/ui/uikit/dist/components/PlAccordion/PlAccordionSection.vue2.js +1 -1
  63. package/dist/lib/ui/uikit/dist/lib/model/common/dist/index.js +8 -8
  64. package/dist/lib/ui/uikit/dist/sdk/model/dist/index.js +64 -43
  65. package/dist/lib/ui/uikit/dist/sdk/model/dist/index.js.map +1 -1
  66. package/dist/lib/util/helpers/dist/index.js +67 -56
  67. package/dist/lib/util/helpers/dist/index.js.map +1 -1
  68. package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js +29 -0
  69. package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js.map +1 -0
  70. package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.js +208 -0
  71. package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.js.map +1 -0
  72. package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/duplex.js +95 -0
  73. package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/duplex.js.map +1 -0
  74. package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/helpers.js +112 -0
  75. package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/helpers.js.map +1 -0
  76. package/dist/sdk/model/dist/index.js +151 -131
  77. package/dist/sdk/model/dist/index.js.map +1 -1
  78. package/dist/types.d.ts +2 -2
  79. package/dist/types.d.ts.map +1 -1
  80. package/package.json +8 -5
  81. package/src/components/BlockLayout.vue +9 -1
  82. package/src/components/NotFound.vue +1 -3
  83. package/src/defineApp.ts +134 -36
  84. package/src/internal/UpdateSerializer.ts +112 -0
  85. package/src/internal/createAppModel.ts +7 -20
  86. package/src/internal/{createApp.ts → createAppV1.ts} +10 -6
  87. package/src/internal/createAppV2.test.ts +158 -0
  88. package/src/internal/createAppV2.ts +309 -0
  89. package/src/internal/test-helpers/BlockMock.ts +144 -0
  90. package/src/internal/test-helpers/createMockApi.ts +92 -0
  91. package/src/internal/test-helpers/utils.ts +65 -0
  92. package/src/{types.static-test.ts → internal/v1.static-test.ts} +5 -9
  93. package/src/internal/v2.static-test.ts +98 -0
  94. package/src/types.ts +2 -2
  95. package/dist/internal/createApp.d.ts.map +0 -1
  96. package/dist/internal/createApp.js.map +0 -1
  97. package/dist/lib/ui/uikit/dist/components/PlAccordion/ExpandTransition.vue.js.map +0 -1
  98. package/dist/types.static-test.d.ts.map +0 -1
package/dist/types.d.ts CHANGED
@@ -42,9 +42,9 @@ export type RouteParams<Href extends `/${string}` = `/${string}`> = {
42
42
  };
43
43
  export type AppSettings = {
44
44
  /**
45
- * Deep patch `model.` This parameter affects how you listen to model changes; a deep watcher is required if you use the `source` function.
45
+ * App ID (just for debugging)
46
46
  */
47
- deepPatchModel?: boolean;
47
+ appId?: string;
48
48
  /**
49
49
  * Enables some debug logs
50
50
  */
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACvF,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAErD,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,aAAa,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC,OAAO,CAAC,CAAC;AACtG,MAAM,WAAW,iBAAiB,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;IACzC,SAAS,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,CAAC,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY,CAAC,CAAC,EAAE,CAAC,GAAG,C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,KAAK,EAAE,CAAC,CAAC;CACV,GACC;IACA,EAAE,EAAE,KAAK,CAAC;IACV,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEJ,MAAM,MAAM,YAAY,CAAC,OAAO,SAAS,gBAAgB,IAAI;KAC1D,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,YAAY,CAAC,OAAO,SAAS,gBAAgB,IAAI;KAC1D,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,EAAE,KAAK;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IACxB;IACA,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,KAAK,CAAC,EAAE,CAAC,CAAC;CACX,GACC;IACA,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,SAAS,EAAE,CAAC;CACrB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/ui-vue",
3
- "version": "1.40.6",
3
+ "version": "1.41.0",
4
4
  "type": "module",
5
5
  "main": "dist/lib.js",
6
6
  "styles": "dist/lib.js",
@@ -26,8 +26,8 @@
26
26
  "d3-format": "^3.1.0",
27
27
  "zod": "~3.23.8",
28
28
  "@milaboratories/biowasm-tools": "^1.1.0",
29
- "@milaboratories/uikit": "2.3.15",
30
- "@platforma-sdk/model": "~1.40.6"
29
+ "@platforma-sdk/model": "~1.41.0",
30
+ "@milaboratories/uikit": "2.3.16"
31
31
  },
32
32
  "devDependencies": {
33
33
  "happy-dom": "^15.11.7",
@@ -38,12 +38,15 @@
38
38
  "typescript": "~5.6.3",
39
39
  "vite": "^6.3.5",
40
40
  "vitest": "^2.1.9",
41
+ "@vue/test-utils": "^2.4.6",
41
42
  "vue-tsc": "^2.2.10",
42
43
  "yarpm": "^1.2.0",
44
+ "fast-json-patch": "^3.1.1",
45
+ "@faker-js/faker": "^9.2.0",
46
+ "@milaboratories/ts-configs": "1.0.4",
43
47
  "@milaboratories/build-configs": "1.0.4",
44
48
  "@milaboratories/eslint-config": "^1.0.4",
45
- "@milaboratories/helpers": "^1.6.18",
46
- "@milaboratories/ts-configs": "1.0.4"
49
+ "@milaboratories/helpers": "^1.6.18"
47
50
  },
48
51
  "scripts": {
49
52
  "test": "vitest run --passWithNoTests",
@@ -43,7 +43,7 @@ const progress = computed(() => app.value?.progress?.());
43
43
  <template>
44
44
  <div class="block block__layout">
45
45
  <BlockLoader :value="progress" />
46
- <div v-if="sdk.error">{{ sdk.error }}</div>
46
+ <div v-if="sdk.error" :class="$style.error">{{ sdk.error }}</div>
47
47
  <LoaderPage v-else-if="!sdk.loaded">Loading...</LoaderPage>
48
48
  <component :is="CurrentView" v-else-if="CurrentView" :key="href" />
49
49
  <NotFound v-else />
@@ -52,3 +52,11 @@ const progress = computed(() => app.value?.progress?.());
52
52
  <!-- Plugins -->
53
53
  <MonetizationSidebar v-if="CurrentView" />
54
54
  </template>
55
+
56
+ <style module>
57
+ .error {
58
+ color: red;
59
+ font-weight: bold;
60
+ padding: 24px;
61
+ }
62
+ </style>
@@ -7,9 +7,7 @@ const sdk = useSdkPlugin();
7
7
  const app = sdk.useApp();
8
8
 
9
9
  const goToMain = () => {
10
- app.updateNavigationState((state) => {
11
- state.href = '/';
12
- });
10
+ app.navigateTo('/');
13
11
  };
14
12
  </script>
15
13
 
package/src/defineApp.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  import { notEmpty } from '@milaboratories/helpers';
2
- import { getPlatformaOrDefault, type BlockOutputsBase, type Platforma } from '@platforma-sdk/model';
2
+ import type { PlatformaV1, PlatformaV2 } from '@platforma-sdk/model';
3
+ import { getPlatformaApiVersion, unwrapResult, type BlockOutputsBase, type Platforma } from '@platforma-sdk/model';
3
4
  import type { Component, Reactive } from 'vue';
4
5
  import { inject, markRaw, reactive } from 'vue';
5
- import { createApp, type BaseApp } from './internal/createApp';
6
+ import { createAppV1, type BaseAppV1 } from './internal/createAppV1';
7
+ import { createAppV2, type BaseAppV2 } from './internal/createAppV2';
6
8
  import type { AppSettings, ExtendSettings, Routes } from './types';
7
9
  import { activateAgGrid } from './aggrid';
8
10
 
@@ -12,6 +14,30 @@ export function useSdkPlugin(): SdkPlugin {
12
14
  return inject(pluginKey)!;
13
15
  }
14
16
 
17
+ export function defineApp<
18
+ Args = unknown,
19
+ Outputs extends BlockOutputsBase = BlockOutputsBase,
20
+ UiState = unknown,
21
+ Href extends `/${string}` = `/${string}`,
22
+ Extend extends ExtendSettings<Href> = ExtendSettings<Href>,
23
+ >(
24
+ platforma: PlatformaV1<Args, Outputs, UiState, Href>,
25
+ extendApp: (app: BaseAppV1<Args, Outputs, UiState, Href>) => Extend,
26
+ settings?: AppSettings,
27
+ ): SdkPluginV1<Args, Outputs, UiState, Href, Extend>;
28
+
29
+ export function defineApp<
30
+ Args = unknown,
31
+ Outputs extends BlockOutputsBase = BlockOutputsBase,
32
+ UiState = unknown,
33
+ Href extends `/${string}` = `/${string}`,
34
+ Extend extends ExtendSettings<Href> = ExtendSettings<Href>,
35
+ >(
36
+ platforma: PlatformaV2<Args, Outputs, UiState, Href>,
37
+ extendApp: (app: BaseAppV2<Args, Outputs, UiState, Href>) => Extend,
38
+ settings?: AppSettings,
39
+ ): SdkPluginV2<Args, Outputs, UiState, Href, Extend>;
40
+
15
41
  export function defineApp<
16
42
  Args = unknown,
17
43
  Outputs extends BlockOutputsBase = BlockOutputsBase,
@@ -20,40 +46,72 @@ export function defineApp<
20
46
  Extend extends ExtendSettings<Href> = ExtendSettings<Href>,
21
47
  >(
22
48
  platforma: Platforma<Args, Outputs, UiState, Href>,
23
- extendApp: (app: BaseApp<Args, Outputs, UiState, Href>) => Extend,
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ extendApp: (app: any) => Extend,
24
51
  settings: AppSettings = {},
25
52
  ): SdkPlugin<Args, Outputs, UiState, Href, Extend> {
26
- let app: undefined | App<Args, Outputs, UiState, Href, Extend> = undefined;
53
+ let app: undefined | AppV1<Args, Outputs, UiState, Href, Extend> | AppV2<Args, Outputs, UiState, Href, Extend> = undefined;
27
54
 
28
55
  activateAgGrid();
29
56
 
30
- const loadApp = () => {
31
- getPlatformaOrDefault<Args, Outputs, UiState, Href>(platforma)
32
- .loadBlockState()
33
- .then((state) => {
34
- plugin.loaded = true;
35
- const baseApp = createApp<Args, Outputs, UiState, Href>(state, platforma, settings);
36
-
37
- const localState = extendApp(baseApp);
38
-
39
- const routes = Object.fromEntries(
40
- Object.entries(localState.routes as Routes<Href>).map(([href, component]) => {
41
- const c = typeof component === 'function' ? component() : component;
42
- return [href, markRaw(c as Component)];
43
- }),
44
- );
45
-
46
- app = Object.assign(baseApp, {
47
- ...localState,
48
- getRoute(href: Href): Component | undefined {
49
- return routes[href];
50
- },
51
- } as unknown as App<Args, Outputs, UiState, Href, Extend>);
52
- })
53
- .catch((err) => {
54
- console.error('load initial state error', err);
55
- plugin.error = err;
56
- });
57
+ const runtimeApiVersion = platforma.apiVersion ?? 1; // undefined means 1 (backward compatibility)
58
+
59
+ const blockRequestedApiVersion = getPlatformaApiVersion();
60
+
61
+ const loadApp = async () => {
62
+ if (blockRequestedApiVersion !== runtimeApiVersion) {
63
+ throw new Error(`Block requested API version ${blockRequestedApiVersion} but runtime API version is ${runtimeApiVersion}.
64
+ Please update the desktop app to use the latest API version.`);
65
+ }
66
+
67
+ if (platforma.apiVersion === undefined || platforma.apiVersion === 1) {
68
+ await platforma
69
+ .loadBlockState()
70
+ .then((state) => {
71
+ plugin.loaded = true;
72
+ const baseApp = createAppV1<Args, Outputs, UiState, Href>(state, platforma, settings);
73
+
74
+ const localState = extendApp(baseApp);
75
+
76
+ const routes = Object.fromEntries(
77
+ Object.entries(localState.routes as Routes<Href>).map(([href, component]) => {
78
+ const c = typeof component === 'function' ? component() : component;
79
+ return [href, markRaw(c as Component)];
80
+ }),
81
+ );
82
+
83
+ app = Object.assign(baseApp, {
84
+ ...localState,
85
+ getRoute(href: Href): Component | undefined {
86
+ return routes[href];
87
+ },
88
+ } as unknown as AppV1<Args, Outputs, UiState, Href, Extend>);
89
+ });
90
+ } else if (platforma.apiVersion === 2) {
91
+ await platforma
92
+ .loadBlockState()
93
+ .then((stateOrError) => {
94
+ const state = unwrapResult(stateOrError);
95
+ plugin.loaded = true;
96
+ const baseApp = createAppV2<Args, Outputs, UiState, Href>(state, platforma, settings);
97
+
98
+ const localState = extendApp(baseApp);
99
+
100
+ const routes = Object.fromEntries(
101
+ Object.entries(localState.routes as Routes<Href>).map(([href, component]) => {
102
+ const c = typeof component === 'function' ? component() : component;
103
+ return [href, markRaw(c as Component)];
104
+ }),
105
+ );
106
+
107
+ app = Object.assign(baseApp, {
108
+ ...localState,
109
+ getRoute(href: Href): Component | undefined {
110
+ return routes[href];
111
+ },
112
+ } as unknown as AppV2<Args, Outputs, UiState, Href, Extend>);
113
+ });
114
+ }
57
115
  };
58
116
 
59
117
  const plugin = reactive({
@@ -67,22 +125,41 @@ export function defineApp<
67
125
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
126
  install(app: any) {
69
127
  app.provide(pluginKey, this);
70
- loadApp();
128
+ loadApp().catch((err) => {
129
+ console.error('load initial state error', err);
130
+ plugin.error = err;
131
+ });
71
132
  },
72
133
  });
73
134
 
74
- return plugin;
135
+ return plugin as SdkPlugin<Args, Outputs, UiState, Href, Extend>;
75
136
  }
76
137
 
138
+ export type AppV1<
139
+ Args = unknown,
140
+ Outputs extends BlockOutputsBase = BlockOutputsBase,
141
+ UiState = unknown,
142
+ Href extends `/${string}` = `/${string}`,
143
+ Local extends ExtendSettings<Href> = ExtendSettings<Href>,
144
+ > = (BaseAppV1<Args, Outputs, UiState, Href>) & Reactive<Omit<Local, 'routes'>> & { getRoute(href: Href): Component | undefined };
145
+
146
+ export type AppV2<
147
+ Args = unknown,
148
+ Outputs extends BlockOutputsBase = BlockOutputsBase,
149
+ UiState = unknown,
150
+ Href extends `/${string}` = `/${string}`,
151
+ Local extends ExtendSettings<Href> = ExtendSettings<Href>,
152
+ > = (BaseAppV2<Args, Outputs, UiState, Href>) & Reactive<Omit<Local, 'routes'>> & { getRoute(href: Href): Component | undefined };
153
+
77
154
  export type App<
78
155
  Args = unknown,
79
156
  Outputs extends BlockOutputsBase = BlockOutputsBase,
80
157
  UiState = unknown,
81
158
  Href extends `/${string}` = `/${string}`,
82
159
  Local extends ExtendSettings<Href> = ExtendSettings<Href>,
83
- > = BaseApp<Args, Outputs, UiState, Href> & Reactive<Omit<Local, 'routes'>> & { getRoute(href: Href): Component | undefined };
160
+ > = AppV1<Args, Outputs, UiState, Href, Local> | AppV2<Args, Outputs, UiState, Href, Local>;
84
161
 
85
- export type SdkPlugin<
162
+ export type SdkPluginV1<
86
163
  Args = unknown,
87
164
  Outputs extends BlockOutputsBase = BlockOutputsBase,
88
165
  UiState = unknown,
@@ -91,6 +168,27 @@ export type SdkPlugin<
91
168
  > = {
92
169
  loaded: boolean;
93
170
  error: unknown;
94
- useApp<PageHref extends Href = Href>(): App<Args, Outputs, UiState, PageHref, Local>;
171
+ useApp<PageHref extends Href = Href>(): AppV1<Args, Outputs, UiState, PageHref, Local>;
95
172
  install(app: unknown): void;
96
173
  };
174
+
175
+ export type SdkPluginV2<
176
+ Args = unknown,
177
+ Outputs extends BlockOutputsBase = BlockOutputsBase,
178
+ UiState = unknown,
179
+ Href extends `/${string}` = `/${string}`,
180
+ Local extends ExtendSettings<Href> = ExtendSettings<Href>,
181
+ > = {
182
+ loaded: boolean;
183
+ error: unknown;
184
+ useApp<PageHref extends Href = Href>(): AppV2<Args, Outputs, UiState, PageHref, Local>;
185
+ install(app: unknown): void;
186
+ };
187
+
188
+ export type SdkPlugin<
189
+ Args = unknown,
190
+ Outputs extends BlockOutputsBase = BlockOutputsBase,
191
+ UiState = unknown,
192
+ Href extends `/${string}` = `/${string}`,
193
+ Local extends ExtendSettings<Href> = ExtendSettings<Href>,
194
+ > = SdkPluginV1<Args, Outputs, UiState, Href, Local> | SdkPluginV2<Args, Outputs, UiState, Href, Local>;
@@ -0,0 +1,112 @@
1
+ import { delay } from '@milaboratories/helpers';
2
+ import { hasAbortError } from '@platforma-sdk/model';
3
+
4
+ export type RetryState = {
5
+ i: number;
6
+ };
7
+
8
+ export type OnNext = (e: unknown, state: RetryState) => { delayMs: number };
9
+
10
+ export class UpdateSerializer {
11
+ private ongoingRun: Promise<boolean> = Promise.resolve(true);
12
+ private ongoingOperation: Promise<void> = Promise.resolve();
13
+ private counter = 0;
14
+
15
+ constructor(private readonly options: {
16
+ debounceSpan?: number;
17
+ } = {}) {}
18
+
19
+ async allSettled(): Promise<void> {
20
+ await delay(this.options.debounceSpan ?? 0);
21
+ let completed = false;
22
+ do {
23
+ await delay(0);
24
+ completed = await this.ongoingRun.then(() => {
25
+ return true;
26
+ }).catch((e) => {
27
+ console.log('ongoingRun error', e);
28
+ return false;
29
+ });
30
+ } while (!completed);
31
+ }
32
+
33
+ async retry<T>(
34
+ op: () => Promise<T>,
35
+ onNext: OnNext,
36
+ ): Promise<T> {
37
+ const state: RetryState = {
38
+ i: 0,
39
+ };
40
+
41
+ while (true) {
42
+ try {
43
+ state.i++;
44
+ return await op();
45
+ } catch (e: unknown) {
46
+ const { delayMs } = onNext(e, state);
47
+
48
+ if (hasAbortError(e)) {
49
+ throw e;
50
+ }
51
+
52
+ await delay(delayMs);
53
+ }
54
+ }
55
+ }
56
+
57
+ /**
58
+ * @returns true if operation succeeded, or false if operation was evicted by a more recent call
59
+ */
60
+ public async run(op: () => Promise<void>): Promise<boolean> {
61
+ return this.ongoingRun = this._run(op);
62
+ }
63
+
64
+ /**
65
+ * @returns true if operation succeeded, or false if operation was evicted by a more recent call
66
+ */
67
+ private async _run(op: () => Promise<void>): Promise<boolean> {
68
+ // assigning a sequential update id to the call
69
+ this.counter++;
70
+ const myId = this.counter;
71
+
72
+ if (this.options.debounceSpan) {
73
+ await delay(this.options.debounceSpan);
74
+ }
75
+
76
+ // checking that this update is still the most recent
77
+ if (this.counter !== myId) {
78
+ // operation was canceled, because another operation was queued
79
+ // after we started waiting for previous operation to finish
80
+ return false;
81
+ }
82
+
83
+ // awaiting previous operation to finish
84
+ try {
85
+ await this.ongoingOperation;
86
+ } catch (_err: unknown) {
87
+ // ignoring the error here, original caller will receive any rejections
88
+ }
89
+
90
+ // checking that this update is still the most recent
91
+ if (this.counter !== myId) {
92
+ // operation was canceled, because another operation was queued
93
+ // after we started waiting for previous operation to finish
94
+ return false;
95
+ }
96
+
97
+ // asynchronously starting the operation
98
+ const opPromise = this.retry(() => op(), (e) => {
99
+ console.warn('UpdateSerializer.run error, retrying...', e);
100
+ return {
101
+ delayMs: 100, // TODO: flexible delay
102
+ };
103
+ });
104
+ // publishing the promise for the next operation to await
105
+ this.ongoingOperation = opPromise;
106
+ // actually awaiting for the operation result, any rejections will be thrown here
107
+ await opPromise;
108
+
109
+ // operation was successfully called
110
+ return true;
111
+ }
112
+ }
@@ -1,13 +1,13 @@
1
1
  import { reactive, computed, ref, watch, unref, type ComputedRef, type UnwrapNestedRefs } from 'vue';
2
2
  import type { ModelOptions, Model, AppSettings } from '../types';
3
- import { deepClone, deepPatch, isJsonEqual } from '@milaboratories/helpers';
3
+ import { deepClone, isJsonEqual } from '@milaboratories/helpers';
4
4
  import { identity, ensureError, isZodError, formatZodError } from '../utils';
5
5
 
6
6
  export function createAppModel<
7
7
  M extends { args: unknown; ui: unknown },
8
8
  V = unknown,
9
9
  E extends Record<string, ComputedRef<unknown>> = Record<string, ComputedRef<unknown>>,
10
- >(options: ModelOptions<M, V>, extended: E, settings: AppSettings): Model<M & UnwrapNestedRefs<E>> {
10
+ >(options: ModelOptions<M, V>, extended: E, _settings: AppSettings): Model<M & UnwrapNestedRefs<E>> {
11
11
  type R = M & UnwrapNestedRefs<E>;
12
12
 
13
13
  const validate = options.validate ?? identity;
@@ -19,21 +19,10 @@ export function createAppModel<
19
19
  const local = ref<{ model: R; readonly stage: symbol }>();
20
20
 
21
21
  const setSource = (v: M) => {
22
- if (settings.deepPatchModel) {
23
- // deep patch
24
- const model = local.value?.model;
25
- const updated = Object.assign(deepClone(v), extended ?? {}) as R;
26
- local.value = {
27
- model: model ? deepPatch(model, updated) : updated,
28
- stage: Symbol(),
29
- };
30
- } else {
31
- // shallow replace
32
- local.value = {
33
- model: Object.assign(deepClone(v), extended ?? {}) as R,
34
- stage: Symbol(),
35
- };
36
- }
22
+ local.value = {
23
+ model: Object.assign(deepClone(v), extended ?? {}) as R,
24
+ stage: Symbol(),
25
+ };
37
26
  };
38
27
 
39
28
  watch(
@@ -42,9 +31,7 @@ export function createAppModel<
42
31
  { immediate: true },
43
32
  );
44
33
 
45
- const save = () => {
46
- options.onSave(validate(deepClone(local.value?.model)));
47
- };
34
+ const save = () => options.onSave(validate(deepClone(local.value?.model)));
48
35
 
49
36
  const revert = () => {
50
37
  setSource(options.get());
@@ -1,6 +1,6 @@
1
1
  import { deepClone, isJsonEqual, tap } from '@milaboratories/helpers';
2
2
  import type { Mutable } from '@milaboratories/helpers';
3
- import type { NavigationState, BlockOutputsBase, BlockState, Platforma } from '@platforma-sdk/model';
3
+ import type { NavigationState, BlockOutputsBase, BlockState, PlatformaV1 } from '@platforma-sdk/model';
4
4
  import { reactive, nextTick, computed, watch } from 'vue';
5
5
  import type { StateModelOptions, UnwrapOutputs, OptionalResult, OutputValues, OutputErrors, AppSettings } from '../types';
6
6
  import { createModel } from '../createModel';
@@ -22,12 +22,16 @@ import { useDebounceFn } from '@vueuse/core';
22
22
  *
23
23
  * @returns A reactive application object with methods, getters, and state.
24
24
  */
25
- export function createApp<
25
+ export function createAppV1<
26
26
  Args = unknown,
27
27
  Outputs extends BlockOutputsBase = BlockOutputsBase,
28
28
  UiState = unknown,
29
29
  Href extends `/${string}` = `/${string}`,
30
- >(state: BlockState<Args, Outputs, UiState, Href>, platforma: Platforma<Args, Outputs, UiState, Href>, settings: AppSettings) {
30
+ >(
31
+ state: BlockState<Args, Outputs, UiState, Href>,
32
+ platforma: PlatformaV1<Args, Outputs, UiState, Href>,
33
+ settings: AppSettings,
34
+ ) {
31
35
  type AppModel = {
32
36
  args: Args;
33
37
  ui: UiState;
@@ -76,7 +80,7 @@ export function createApp<
76
80
  }
77
81
  }, debounceSpan, { maxWait });
78
82
 
79
- platforma.onStateUpdates(async (updates) => {
83
+ (platforma as unknown as PlatformaV1<Args, Outputs, UiState, Href>).onStateUpdates(async (updates) => {
80
84
  updates.forEach((patch) => {
81
85
  if (patch.key === 'args' && !isJsonEqual(snapshot.args, patch.value)) {
82
86
  snapshot.args = Object.freeze(patch.value);
@@ -269,9 +273,9 @@ export function createApp<
269
273
  return reactive(Object.assign(model, methods, getters));
270
274
  }
271
275
 
272
- export type BaseApp<
276
+ export type BaseAppV1<
273
277
  Args = unknown,
274
278
  Outputs extends BlockOutputsBase = BlockOutputsBase,
275
279
  UiState = unknown,
276
280
  Href extends `/${string}` = `/${string}`,
277
- > = ReturnType<typeof createApp<Args, Outputs, UiState, Href>>;
281
+ > = ReturnType<typeof createAppV1<Args, Outputs, UiState, Href>>;