@platforma-sdk/ui-vue 1.82.6 → 1.83.1

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 (141) hide show
  1. package/.turbo/turbo-build.log +169 -23
  2. package/.turbo/turbo-formatter$colon$check.log +2 -2
  3. package/.turbo/turbo-linter$colon$check.log +2 -2
  4. package/.turbo/turbo-types$colon$check.log +2 -2
  5. package/CHANGELOG.md +62 -0
  6. package/dist/components/PlAgDataTable/PlAgDataTableV2.vue2.js +1 -1
  7. package/dist/components/PlAgDataTable/compositions/useFilterableColumns.d.ts +16 -16
  8. package/dist/components/PlAnnotations/components/AnnotationsSidebar.js.map +1 -1
  9. package/dist/components/PlAnnotations/components/AnnotationsSidebar.style.js.map +1 -1
  10. package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js +1 -1
  11. package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue2.js.map +1 -1
  12. package/dist/components/PlAnnotations/components/FilterSidebar.js.map +1 -1
  13. package/dist/components/PlAnnotations/components/FilterSidebar.style.js.map +1 -1
  14. package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js +1 -1
  15. package/dist/components/PlAnnotations/components/FilterSidebar.vue2.js.map +1 -1
  16. package/dist/components/PlAnnotations/components/PlAnnotations.vue2.js.map +1 -1
  17. package/dist/defineApp.d.ts +2 -32
  18. package/dist/defineApp.d.ts.map +1 -1
  19. package/dist/defineApp.js +20 -62
  20. package/dist/defineApp.js.map +1 -1
  21. package/dist/index.js +39 -39
  22. package/dist/internal/createAppV3.d.ts +1 -1
  23. package/dist/internal/createAppV3.js +16 -16
  24. package/dist/lib/util/helpers/dist/utils.js +2 -5
  25. package/dist/lib/util/helpers/dist/utils.js.map +1 -1
  26. package/dist/lib.js +1 -1
  27. package/package.json +8 -8
  28. package/src/components/PlAnnotations/components/AnnotationsSidebar.vue +2 -2
  29. package/src/components/PlAnnotations/components/FilterSidebar.vue +2 -2
  30. package/src/defineApp.ts +1 -183
  31. package/dist/components/BlockLayout.vue.d.ts +0 -3
  32. package/dist/components/BlockLayout.vue.d.ts.map +0 -1
  33. package/dist/components/BlockLoader.vue.d.ts +0 -6
  34. package/dist/components/BlockLoader.vue.d.ts.map +0 -1
  35. package/dist/components/LoaderPage.vue.d.ts +0 -3
  36. package/dist/components/LoaderPage.vue.d.ts.map +0 -1
  37. package/dist/components/NotFound.vue.d.ts +0 -3
  38. package/dist/components/NotFound.vue.d.ts.map +0 -1
  39. package/dist/components/PlAdvancedFilter/FilterEditor.vue.d.ts +0 -23
  40. package/dist/components/PlAdvancedFilter/FilterEditor.vue.d.ts.map +0 -1
  41. package/dist/components/PlAdvancedFilter/OperandButton.vue.d.ts +0 -9
  42. package/dist/components/PlAdvancedFilter/OperandButton.vue.d.ts.map +0 -1
  43. package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.d.ts +0 -55
  44. package/dist/components/PlAdvancedFilter/PlAdvancedFilter.vue.d.ts.map +0 -1
  45. package/dist/components/PlAgCellFile/PlAgCellFile.vue.d.ts +0 -26
  46. package/dist/components/PlAgCellFile/PlAgCellFile.vue.d.ts.map +0 -1
  47. package/dist/components/PlAgCellProgress/PlAgCellProgress.vue.d.ts +0 -8
  48. package/dist/components/PlAgCellProgress/PlAgCellProgress.vue.d.ts.map +0 -1
  49. package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue.d.ts +0 -10
  50. package/dist/components/PlAgCellStatusTag/PlAgCellStatusTag.vue.d.ts.map +0 -1
  51. package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue.d.ts +0 -11
  52. package/dist/components/PlAgChartHistogramCell/PlAgChartHistogramCell.vue.d.ts.map +0 -1
  53. package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue.d.ts +0 -8
  54. package/dist/components/PlAgChartStackedBarCell/PlAgChartStackedBarCell.vue.d.ts.map +0 -1
  55. package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue.d.ts +0 -10
  56. package/dist/components/PlAgColumnHeader/PlAgColumnHeader.vue.d.ts.map +0 -1
  57. package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue.d.ts +0 -10
  58. package/dist/components/PlAgCsvExporter/PlAgCsvExporter.vue.d.ts.map +0 -1
  59. package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue.d.ts +0 -31
  60. package/dist/components/PlAgDataTable/PlAgDataTableSheets.vue.d.ts.map +0 -1
  61. package/dist/components/PlAgDataTable/PlAgDataTableV2.vue.d.ts +0 -94
  62. package/dist/components/PlAgDataTable/PlAgDataTableV2.vue.d.ts.map +0 -1
  63. package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue.d.ts +0 -10
  64. package/dist/components/PlAgDataTable/PlAgOverlayLoading.vue.d.ts.map +0 -1
  65. package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue.d.ts +0 -9
  66. package/dist/components/PlAgDataTable/PlAgOverlayNoRows.vue.d.ts.map +0 -1
  67. package/dist/components/PlAgDataTable/PlAgRowCount.vue.d.ts +0 -9
  68. package/dist/components/PlAgDataTable/PlAgRowCount.vue.d.ts.map +0 -1
  69. package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue.d.ts +0 -17
  70. package/dist/components/PlAgGridColumnManager/PlAgGridColumnManager.vue.d.ts.map +0 -1
  71. package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.d.ts +0 -7
  72. package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.d.ts.map +0 -1
  73. package/dist/components/PlAgRowNumHeader.vue.d.ts +0 -7
  74. package/dist/components/PlAgRowNumHeader.vue.d.ts.map +0 -1
  75. package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue.d.ts +0 -32
  76. package/dist/components/PlAgTextAndButtonCell/PlAgTextAndButtonCell.vue.d.ts.map +0 -1
  77. package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue.d.ts +0 -14
  78. package/dist/components/PlAnnotations/components/AnnotationsSidebar.vue.d.ts.map +0 -1
  79. package/dist/components/PlAnnotations/components/FilterSidebar.vue.d.ts +0 -26
  80. package/dist/components/PlAnnotations/components/FilterSidebar.vue.d.ts.map +0 -1
  81. package/dist/components/PlAnnotations/components/PlAnnotations.vue.d.ts +0 -10
  82. package/dist/components/PlAnnotations/components/PlAnnotations.vue.d.ts.map +0 -1
  83. package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue.d.ts +0 -8
  84. package/dist/components/PlAnnotations/components/PlAnnotationsModal.vue.d.ts.map +0 -1
  85. package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue.d.ts +0 -11
  86. package/dist/components/PlAppErrorNotificationAlert/PlAppErrorNotificationAlert.vue.d.ts.map +0 -1
  87. package/dist/components/PlBtnExportArchive/Item.vue.d.ts +0 -7
  88. package/dist/components/PlBtnExportArchive/Item.vue.d.ts.map +0 -1
  89. package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue.d.ts +0 -35
  90. package/dist/components/PlBtnExportArchive/PlBtnExportArchive.vue.d.ts.map +0 -1
  91. package/dist/components/PlBtnExportArchive/Summary.vue.d.ts +0 -11
  92. package/dist/components/PlBtnExportArchive/Summary.vue.d.ts.map +0 -1
  93. package/dist/components/PlDatasetSelector/PlDatasetSelector.vue.d.ts +0 -77
  94. package/dist/components/PlDatasetSelector/PlDatasetSelector.vue.d.ts.map +0 -1
  95. package/dist/components/PlTableFastSearch/PlTableFastSearch.vue.d.ts +0 -10
  96. package/dist/components/PlTableFastSearch/PlTableFastSearch.vue.d.ts.map +0 -1
  97. package/dist/components/PlTableFilters/PlTableFiltersV2.vue.d.ts +0 -14
  98. package/dist/components/PlTableFilters/PlTableFiltersV2.vue.d.ts.map +0 -1
  99. package/dist/internal/createAppModel.d.ts +0 -7
  100. package/dist/internal/createAppModel.d.ts.map +0 -1
  101. package/dist/internal/createAppModel.js +0 -57
  102. package/dist/internal/createAppModel.js.map +0 -1
  103. package/dist/internal/createAppV1.d.ts +0 -53
  104. package/dist/internal/createAppV1.d.ts.map +0 -1
  105. package/dist/internal/createAppV1.js +0 -129
  106. package/dist/internal/createAppV1.js.map +0 -1
  107. package/dist/internal/createAppV2.d.ts +0 -50
  108. package/dist/internal/createAppV2.d.ts.map +0 -1
  109. package/dist/internal/createAppV2.js +0 -137
  110. package/dist/internal/createAppV2.js.map +0 -1
  111. package/dist/internal/createAppV2.test.d.ts +0 -15
  112. package/dist/internal/createAppV2.test.d.ts.map +0 -1
  113. package/dist/internal/test-helpers/BlockMock.d.ts +0 -29
  114. package/dist/internal/test-helpers/BlockMock.d.ts.map +0 -1
  115. package/dist/internal/test-helpers/createMockApi.d.ts +0 -4
  116. package/dist/internal/test-helpers/createMockApi.d.ts.map +0 -1
  117. package/dist/internal/test-helpers/utils.d.ts +0 -4
  118. package/dist/internal/test-helpers/utils.d.ts.map +0 -1
  119. package/dist/internal/v1.static-test.d.ts +0 -7
  120. package/dist/internal/v1.static-test.d.ts.map +0 -1
  121. package/dist/internal/v2.static-test.d.ts +0 -7
  122. package/dist/internal/v2.static-test.d.ts.map +0 -1
  123. package/dist/plugins/Monetization/EndOfPeriod.vue.d.ts +0 -6
  124. package/dist/plugins/Monetization/EndOfPeriod.vue.d.ts.map +0 -1
  125. package/dist/plugins/Monetization/LimitCard.vue.d.ts +0 -11
  126. package/dist/plugins/Monetization/LimitCard.vue.d.ts.map +0 -1
  127. package/dist/plugins/Monetization/MonetizationSidebar.vue.d.ts +0 -3
  128. package/dist/plugins/Monetization/MonetizationSidebar.vue.d.ts.map +0 -1
  129. package/dist/plugins/Monetization/RunStatus.vue.d.ts +0 -23
  130. package/dist/plugins/Monetization/RunStatus.vue.d.ts.map +0 -1
  131. package/dist/plugins/Monetization/UserCabinetCard.vue.d.ts +0 -7
  132. package/dist/plugins/Monetization/UserCabinetCard.vue.d.ts.map +0 -1
  133. package/src/internal/createAppModel.ts +0 -112
  134. package/src/internal/createAppV1.ts +0 -324
  135. package/src/internal/createAppV2.test.ts +0 -207
  136. package/src/internal/createAppV2.ts +0 -392
  137. package/src/internal/test-helpers/BlockMock.ts +0 -161
  138. package/src/internal/test-helpers/createMockApi.ts +0 -104
  139. package/src/internal/test-helpers/utils.ts +0 -65
  140. package/src/internal/v1.static-test.ts +0 -107
  141. package/src/internal/v2.static-test.ts +0 -107
@@ -1,10 +0,0 @@
1
- type __VLS_PublicProps = {
2
- modelValue: string;
3
- };
4
- declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
5
- "update:modelValue": (value: string) => any;
6
- }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
7
- "onUpdate:modelValue"?: ((value: string) => any) | undefined;
8
- }>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
9
- export default _default;
10
- //# sourceMappingURL=PlTableFastSearch.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlTableFastSearch.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PlTableFastSearch/PlTableFastSearch.vue"],"names":[],"mappings":"AA+CA,KAAK,iBAAiB,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;CAClB,CAAC;;;;;;AA6FF,wBAQG"}
@@ -1,14 +0,0 @@
1
- import { PTableColumnSpec, PlDataTableFiltersWithMeta, PFrameHandle } from '@platforma-sdk/model';
2
- import { Nil } from '@milaboratories/helpers';
3
- type __VLS_Props = {
4
- columns: PTableColumnSpec[];
5
- pframeHandle: Nil | PFrameHandle;
6
- filters: PlDataTableFiltersWithMeta;
7
- defaultFilters: Nil | PlDataTableFiltersWithMeta;
8
- onUpdateFilters: (value: PlDataTableFiltersWithMeta) => void;
9
- onResetDefaultFilters?: () => void;
10
- onUpdateDefaultFilters?: (value: PlDataTableFiltersWithMeta) => void;
11
- };
12
- declare const _default: import('vue').DefineComponent<__VLS_Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
13
- export default _default;
14
- //# sourceMappingURL=PlTableFiltersV2.vue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"PlTableFiltersV2.vue.d.ts","sourceRoot":"","sources":["../../../src/components/PlTableFilters/PlTableFiltersV2.vue"],"names":[],"mappings":"AAoNA,OAAO,KAAK,EACV,gBAAgB,EAChB,0BAA0B,EAC1B,YAAY,EAGb,MAAM,sBAAsB,CAAC;AAoB9B,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAGnD,KAAK,WAAW,GAAG;IACjB,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,YAAY,EAAE,GAAG,GAAG,YAAY,CAAC;IACjC,OAAO,EAAE,0BAA0B,CAAC;IACpC,cAAc,EAAE,GAAG,GAAG,0BAA0B,CAAC;IACjD,eAAe,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAC7D,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,sBAAsB,CAAC,EAAE,CAAC,KAAK,EAAE,0BAA0B,KAAK,IAAI,CAAC;CACtE,CAAC;;AA+RF,wBAMG"}
@@ -1,7 +0,0 @@
1
- import { ComputedRef, UnwrapNestedRefs } from 'vue';
2
- import { ModelOptions, Model, AppSettings } from '../types';
3
- export declare function createAppModel<M extends {
4
- args: unknown;
5
- ui: unknown;
6
- }, V = unknown, E extends Record<string, ComputedRef<unknown>> = Record<string, ComputedRef<unknown>>>(options: ModelOptions<M, V>, extended: E, _settings: AppSettings): Model<M & UnwrapNestedRefs<E>>;
7
- //# sourceMappingURL=createAppModel.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAppModel.d.ts","sourceRoot":"","sources":["../../src/internal/createAppModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACtB,MAAM,KAAK,CAAC;AACb,OAAO,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAIjE,wBAAgB,cAAc,CAC5B,CAAC,SAAS;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,OAAO,CAAA;CAAE,EACxC,CAAC,GAAG,OAAO,EACX,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC,EAErF,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC,EAC3B,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,WAAW,GACrB,KAAK,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CA0FhC"}
@@ -1,57 +0,0 @@
1
- import { deepClone as e, isJsonEqual as t } from "../lib/util/helpers/dist/objects.js";
2
- import "../lib/util/helpers/dist/index.js";
3
- import { ensureError as n, formatZodError as r, identity as i, isZodError as a } from "../utils.js";
4
- import { computed as o, reactive as s, ref as c, unref as l, watch as u } from "vue";
5
- //#region src/internal/createAppModel.ts
6
- function d(d, f, p) {
7
- let m = d.validate ?? i, { autoSave: h } = d, g = c(), _ = c(), v = (t) => {
8
- _.value = {
9
- model: Object.assign(e(t), f ?? {}),
10
- stage: Symbol()
11
- };
12
- };
13
- u(() => d.get(), (e) => v(e), { immediate: !0 });
14
- let y = () => d.onSave(m(e(_.value?.model))), b = () => {
15
- v(d.get()), g.value = void 0;
16
- }, x = (e) => {
17
- let t = n(e);
18
- a(t) ? g.value = Error(r(t)) : g.value = t;
19
- }, S = (e) => {
20
- g.value = void 0;
21
- try {
22
- m(e), h && y();
23
- } catch (e) {
24
- x(e);
25
- }
26
- }, C = o({
27
- get: () => _.value?.model,
28
- set() {
29
- throw Error("Cannot replace base model");
30
- }
31
- });
32
- return u([() => ({
33
- args: C.value.args,
34
- ui: C.value.ui
35
- }), () => _.value?.stage], ([e, t], [n, r]) => {
36
- t === r && S(e);
37
- }, { deep: !0 }), s({
38
- model: C,
39
- valid: o(() => !g.value),
40
- isChanged: o(() => {
41
- let { args: e, ui: n } = l(_)?.model ?? {};
42
- return !t(d.get(), {
43
- args: e,
44
- ui: n
45
- });
46
- }),
47
- error: g,
48
- errorString: o(() => g.value ? g.value.message : ""),
49
- save: y,
50
- revert: b,
51
- setError: x
52
- });
53
- }
54
- //#endregion
55
- export { d as createAppModel };
56
-
57
- //# sourceMappingURL=createAppModel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAppModel.js","names":[],"sources":["../../src/internal/createAppModel.ts"],"sourcesContent":["import {\n reactive,\n computed,\n ref,\n watch,\n unref,\n type ComputedRef,\n type UnwrapNestedRefs,\n} from \"vue\";\nimport type { ModelOptions, Model, AppSettings } from \"../types\";\nimport { deepClone, isJsonEqual } from \"@milaboratories/helpers\";\nimport { identity, ensureError, isZodError, formatZodError } from \"../utils\";\n\nexport function createAppModel<\n M extends { args: unknown; ui: unknown },\n V = unknown,\n E extends Record<string, ComputedRef<unknown>> = Record<string, ComputedRef<unknown>>,\n>(\n options: ModelOptions<M, V>,\n extended: E,\n _settings: AppSettings,\n): Model<M & UnwrapNestedRefs<E>> {\n type R = M & UnwrapNestedRefs<E>;\n\n const validate = options.validate ?? identity;\n\n const { autoSave } = options;\n\n const error = ref<Error | undefined>();\n\n const local = ref<{ model: R; readonly stage: symbol }>();\n\n const setSource = (v: M) => {\n local.value = {\n model: Object.assign(deepClone(v), extended ?? {}) as R,\n stage: Symbol(),\n };\n };\n\n watch(\n () => options.get(),\n (v) => setSource(v),\n { immediate: true },\n );\n\n const save = () => options.onSave(validate(deepClone(local.value?.model)));\n\n const revert = () => {\n setSource(options.get());\n error.value = undefined;\n };\n\n const setError = (cause: unknown) => {\n const err = ensureError(cause);\n if (isZodError(err)) {\n error.value = Error(formatZodError(err)); // @todo temp\n } else {\n error.value = err;\n }\n };\n\n const setValue = (v: M) => {\n error.value = undefined;\n try {\n validate(v);\n if (autoSave) {\n save();\n }\n } catch (cause: unknown) {\n setError(cause);\n }\n };\n\n const model = computed<R>({\n get: () => {\n return local.value?.model as R;\n },\n set() {\n throw Error(\"Cannot replace base model\");\n },\n });\n\n watch(\n [() => ({ args: model.value.args, ui: model.value.ui }), () => local.value?.stage],\n ([n, newStage], [_, oldStage]) => {\n if (newStage === oldStage) {\n setValue(n as M);\n }\n },\n { deep: true },\n );\n\n const valid = computed(() => !error.value);\n\n const isChanged = computed(() => {\n const { args, ui } = unref(local)?.model ?? {};\n return !isJsonEqual(options.get(), { args, ui });\n });\n\n const errorString = computed(() => (error.value ? error.value.message : \"\"));\n\n return reactive({\n model,\n valid,\n isChanged,\n error,\n errorString,\n save,\n revert,\n setError,\n });\n}\n"],"mappings":";;;;;AAaA,SAAgB,EAKd,GACA,GACA,GACgC;CAGhC,IAAM,IAAW,EAAQ,YAAY,GAE/B,EAAE,gBAAa,GAEf,IAAQ,GAAwB,EAEhC,IAAQ,GAA2C,EAEnD,KAAa,MAAS;AAC1B,IAAM,QAAQ;GACZ,OAAO,OAAO,OAAO,EAAU,EAAE,EAAE,KAAY,EAAE,CAAC;GAClD,OAAO,QAAQ;GAChB;;AAGH,SACQ,EAAQ,KAAK,GAClB,MAAM,EAAU,EAAE,EACnB,EAAE,WAAW,IAAM,CACpB;CAED,IAAM,UAAa,EAAQ,OAAO,EAAS,EAAU,EAAM,OAAO,MAAM,CAAC,CAAC,EAEpE,UAAe;AAEnB,EADA,EAAU,EAAQ,KAAK,CAAC,EACxB,EAAM,QAAQ,KAAA;IAGV,KAAY,MAAmB;EACnC,IAAM,IAAM,EAAY,EAAM;AAC9B,EAAI,EAAW,EAAI,GACjB,EAAM,QAAQ,MAAM,EAAe,EAAI,CAAC,GAExC,EAAM,QAAQ;IAIZ,KAAY,MAAS;AACzB,IAAM,QAAQ,KAAA;AACd,MAAI;AAEF,GADA,EAAS,EAAE,EACP,KACF,GAAM;WAED,GAAgB;AACvB,KAAS,EAAM;;IAIb,IAAQ,EAAY;EACxB,WACS,EAAM,OAAO;EAEtB,MAAM;AACJ,SAAM,MAAM,4BAA4B;;EAE3C,CAAC;AAqBF,QAnBA,EACE,QAAQ;EAAE,MAAM,EAAM,MAAM;EAAM,IAAI,EAAM,MAAM;EAAI,SAAS,EAAM,OAAO,MAAM,GACjF,CAAC,GAAG,IAAW,CAAC,GAAG,OAAc;AAChC,EAAI,MAAa,KACf,EAAS,EAAO;IAGpB,EAAE,MAAM,IAAM,CACf,EAWM,EAAS;EACd;EACA,OAXY,QAAe,CAAC,EAAM,MAAM;EAYxC,WAVgB,QAAe;GAC/B,IAAM,EAAE,SAAM,UAAO,EAAM,EAAM,EAAE,SAAS,EAAE;AAC9C,UAAO,CAAC,EAAY,EAAQ,KAAK,EAAE;IAAE;IAAM;IAAI,CAAC;IAChD;EAQA;EACA,aAPkB,QAAgB,EAAM,QAAQ,EAAM,MAAM,UAAU,GAAI;EAQ1E;EACA;EACA;EACD,CAAC"}
@@ -1,53 +0,0 @@
1
- import { Mutable } from '@milaboratories/helpers';
2
- import { NavigationState, BlockOutputsBase, BlockState, PlatformaV1, PlatformaExtended } from '@platforma-sdk/model';
3
- import { StateModelOptions, UnwrapOutputs, OptionalResult, OutputValues, OutputErrors, AppSettings } from '../types';
4
- /**
5
- * Creates an application instance with reactive state management, outputs, and methods for state updates and navigation.
6
- *
7
- * @template Args - The type of arguments used in the application.
8
- * @template Outputs - The type of block outputs extending `BlockOutputsBase`.
9
- * @template UiState - The type of the UI state.
10
- * @template Href - The type of navigation href, defaulting to a string starting with `/`.
11
- *
12
- * @param state - Initial state of the application, including args, outputs, UI state, and navigation state.
13
- * @param platforma - A platform interface for interacting with block states.
14
- * @param settings - Application settings, such as debug flags.
15
- *
16
- * @returns A reactive application object with methods, getters, and state.
17
- */
18
- export declare function createAppV1<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`>(state: BlockState<Args, Outputs, UiState, Href>, platforma: PlatformaExtended<PlatformaV1<Args, Outputs, UiState, Href>>, settings: AppSettings): {
19
- model: {
20
- args: import('vue').UnwrapRef<Args>;
21
- ui: import('vue').UnwrapRef<UiState>;
22
- outputs: import('vue').UnwrapRef<OutputValues<Outputs>>;
23
- outputErrors: import('vue').UnwrapRef<OutputErrors<Outputs>>;
24
- };
25
- readonly valid: boolean;
26
- readonly isChanged: boolean;
27
- readonly error: Error | undefined;
28
- readonly errorString: string | undefined;
29
- readonly save: () => void;
30
- readonly revert: () => void;
31
- readonly setError: (cause: unknown) => void;
32
- createArgsModel: <T = Args>(options?: StateModelOptions<Args, T>) => import('../types').Model<T>;
33
- createUiModel: <T = UiState>(options: StateModelOptions<UiState, T> | undefined, defaultUiState: () => UiState) => import('../types').Model<T>;
34
- useOutputs: <K extends keyof Outputs>(...keys: K[]) => OptionalResult<UnwrapOutputs<Outputs, K>>;
35
- unwrapOutputs: <K extends keyof Outputs>(...keys: K[]) => UnwrapOutputs<Outputs, K>;
36
- updateArgs: (cb: (args: Args) => void) => Promise<void>;
37
- updateUiState: (cb: (args: UiState) => UiState) => Promise<void>;
38
- updateNavigationState: (cb: (args: Mutable<NavigationState<Href>>) => void) => Promise<void>;
39
- navigateTo: (href: Href) => Promise<void>;
40
- snapshot: {
41
- args: import('vue').UnwrapRef<Readonly<Args>>;
42
- outputs: import('vue').UnwrapRef<Partial<Readonly<Outputs>>>;
43
- ui: import('vue').UnwrapRef<Readonly<UiState>>;
44
- navigationState: {
45
- readonly href: import('vue').UnwrapRef<Href>;
46
- };
47
- };
48
- queryParams: import('../types').ParseQuery<Href>;
49
- href: Href;
50
- hasErrors: boolean;
51
- };
52
- export type BaseAppV1<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> = ReturnType<typeof createAppV1<Args, Outputs, UiState, Href>>;
53
-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AAO,KAAK,OAAO,KAAG,OAAO,CAAC,IAAI,CAAC;gCAUlC,CAAC,IAAI,EAAE,OAAO,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI;uBAWvD,IAAI;;;;;;;;;;;;EAsDxB;AAED,MAAM,MAAM,SAAS,CACnB,IAAI,GAAG,OAAO,EACd,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,OAAO,GAAG,OAAO,EACjB,IAAI,SAAS,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,IACtC,UAAU,CAAC,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC"}
@@ -1,129 +0,0 @@
1
- import { tap as e } from "../lib/util/helpers/dist/utils.js";
2
- import { deepClone as t, isJsonEqual as n } from "../lib/util/helpers/dist/objects.js";
3
- import "../lib/util/helpers/dist/index.js";
4
- import { MultiError as r, ensureOutputHasStableFlag as i, unwrapOutput as a } from "../utils.js";
5
- import { createModel as o } from "../createModel.js";
6
- import { createAppModel as s } from "./createAppModel.js";
7
- import { parseQuery as c } from "../urls.js";
8
- import { computed as l, nextTick as u, reactive as d, watch as f } from "vue";
9
- import { useDebounceFn as p } from "@vueuse/core";
10
- //#region src/internal/createAppV1.ts
11
- function m(m, h, g) {
12
- let _ = (e, ...t) => {
13
- g.debug && console.log(`%c>>> %c${e}`, "color: orange; font-weight: bold", "color: orange", ...t);
14
- }, v = d({
15
- args: Object.freeze(m.args),
16
- outputs: Object.freeze(m.outputs),
17
- ui: Object.freeze(m.ui),
18
- navigationState: Object.freeze(m.navigationState)
19
- }), y = g.debounceSpan ?? 200, b = e(g.debounceMaxWait ?? 0, (e) => e < 2e4 ? 2e4 : e < y ? y * 100 : e), x = p((e) => {
20
- n(e, v.args) || h.setBlockArgs(e);
21
- }, y, { maxWait: b }), S = p((e) => {
22
- n(e, v.ui) || h.setBlockUiState(e);
23
- }, y, { maxWait: b }), C = p((e, t) => {
24
- (!n(e, v.args) || !n(t, v.ui)) && h.setBlockArgsAndUiState(e, t);
25
- }, y, { maxWait: b });
26
- h.onStateUpdates(async (e) => {
27
- e.forEach((e) => {
28
- e.key === "args" && !n(v.args, e.value) && (v.args = Object.freeze(e.value), _("args patch", v.args)), e.key === "ui" && !n(v.ui, e.value) && (v.ui = Object.freeze(e.value), _("ui patch", v.ui)), e.key === "outputs" && !n(v.outputs, e.value) && (v.outputs = Object.freeze(e.value), _("outputs patch", v.outputs)), e.key === "navigationState" && !n(v.navigationState, e.value) && (v.navigationState = Object.freeze(e.value), _("navigationState patch", v.navigationState));
29
- }), await u();
30
- });
31
- let w = () => t(v.args), T = () => t(v.ui), E = () => t(v.navigationState), D = {
32
- createArgsModel(e = {}) {
33
- return o({
34
- get() {
35
- return e.transform ? e.transform(v.args) : v.args;
36
- },
37
- validate: e.validate,
38
- autoSave: !0,
39
- onSave(e) {
40
- x(e);
41
- }
42
- });
43
- },
44
- createUiModel(e = {}, t) {
45
- return o({
46
- get() {
47
- return e.transform ? e.transform(v.ui) : v.ui ?? t();
48
- },
49
- validate: e.validate,
50
- autoSave: !0,
51
- onSave(e) {
52
- S(e);
53
- }
54
- });
55
- },
56
- useOutputs(...e) {
57
- let t = d({
58
- errors: void 0,
59
- value: void 0
60
- });
61
- return f(() => v.outputs, () => {
62
- try {
63
- Object.assign(t, {
64
- value: this.unwrapOutputs(...e),
65
- errors: void 0
66
- });
67
- } catch (e) {
68
- Object.assign(t, {
69
- value: void 0,
70
- errors: [String(e)]
71
- });
72
- }
73
- }, {
74
- immediate: !0,
75
- deep: !0
76
- }), t;
77
- },
78
- unwrapOutputs(...e) {
79
- let t = v.outputs, n = e.map((e) => [e, a(t[e])]);
80
- return Object.fromEntries(n);
81
- },
82
- updateArgs(e) {
83
- let t = w();
84
- return e(t), h.setBlockArgs(t);
85
- },
86
- updateUiState(e) {
87
- let t = T();
88
- return h.setBlockUiState(e(t));
89
- },
90
- updateNavigationState(e) {
91
- let t = E();
92
- return e(t), h.setNavigationState(t);
93
- },
94
- navigateTo(e) {
95
- let t = E();
96
- return t.href = e, h.setNavigationState(t);
97
- }
98
- }, O = l(() => {
99
- let e = Object.entries(v.outputs).map(([e, t]) => h.blockModelInfo.outputs[e].withStatus ? [e, i(t)] : [e, t.ok && t.value !== void 0 ? t.value : void 0]);
100
- return Object.fromEntries(e);
101
- }), k = l(() => {
102
- let e = Object.entries(v.outputs).map(([e, t]) => [e, t && t.ok === !1 ? new r(t.errors) : void 0]);
103
- return Object.fromEntries(e);
104
- }), A = {
105
- snapshot: v,
106
- queryParams: l(() => c(v.navigationState.href)),
107
- href: l(() => v.navigationState.href),
108
- hasErrors: l(() => Object.values(v.outputs).some((e) => !e?.ok))
109
- }, j = s({
110
- get() {
111
- return {
112
- args: v.args,
113
- ui: v.ui
114
- };
115
- },
116
- autoSave: !0,
117
- onSave(e) {
118
- C(e.args, e.ui);
119
- }
120
- }, {
121
- outputs: O,
122
- outputErrors: k
123
- }, g);
124
- return d(Object.assign(j, D, A));
125
- }
126
- //#endregion
127
- export { m as createAppV1 };
128
-
129
- //# sourceMappingURL=createAppV1.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAppV1.js","names":[],"sources":["../../src/internal/createAppV1.ts"],"sourcesContent":["import { deepClone, isJsonEqual, tap } from \"@milaboratories/helpers\";\nimport type { Mutable } from \"@milaboratories/helpers\";\nimport type {\n NavigationState,\n BlockOutputsBase,\n BlockState,\n PlatformaV1,\n PlatformaExtended,\n} from \"@platforma-sdk/model\";\nimport { reactive, nextTick, computed, watch } from \"vue\";\nimport type {\n StateModelOptions,\n UnwrapOutputs,\n OptionalResult,\n OutputValues,\n OutputErrors,\n AppSettings,\n} from \"../types\";\nimport { createModel } from \"../createModel\";\nimport { createAppModel } from \"./createAppModel\";\nimport { parseQuery } from \"../urls\";\nimport { ensureOutputHasStableFlag, MultiError, unwrapOutput } from \"../utils\";\nimport { useDebounceFn } from \"@vueuse/core\";\n/**\n * Creates an application instance with reactive state management, outputs, and methods for state updates and navigation.\n *\n * @template Args - The type of arguments used in the application.\n * @template Outputs - The type of block outputs extending `BlockOutputsBase`.\n * @template UiState - The type of the UI state.\n * @template Href - The type of navigation href, defaulting to a string starting with `/`.\n *\n * @param state - Initial state of the application, including args, outputs, UI state, and navigation state.\n * @param platforma - A platform interface for interacting with block states.\n * @param settings - Application settings, such as debug flags.\n *\n * @returns A reactive application object with methods, getters, and state.\n */\nexport function createAppV1<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n>(\n state: BlockState<Args, Outputs, UiState, Href>,\n platforma: PlatformaExtended<PlatformaV1<Args, Outputs, UiState, Href>>,\n settings: AppSettings,\n) {\n type AppModel = {\n args: Args;\n ui: UiState;\n };\n\n const log = (msg: string, ...rest: unknown[]) => {\n if (settings.debug) {\n console.log(`%c>>> %c${msg}`, \"color: orange; font-weight: bold\", \"color: orange\", ...rest);\n }\n };\n\n /**\n * Reactive snapshot of the application state, including args, outputs, UI state, and navigation state.\n */\n const snapshot = reactive({\n args: Object.freeze(state.args),\n outputs: Object.freeze(state.outputs),\n ui: Object.freeze(state.ui),\n navigationState: Object.freeze(state.navigationState) as NavigationState<Href>,\n }) as {\n args: Readonly<Args>;\n outputs: Partial<Readonly<Outputs>>;\n ui: Readonly<UiState>;\n navigationState: Readonly<NavigationState<Href>>;\n };\n\n const debounceSpan = settings.debounceSpan ?? 200;\n\n const maxWait = tap(settings.debounceMaxWait ?? 0, (v) =>\n v < 20_000 ? 20_000 : v < debounceSpan ? debounceSpan * 100 : v,\n );\n\n const setBlockArgs = useDebounceFn(\n (args: Args) => {\n if (!isJsonEqual(args, snapshot.args)) {\n platforma.setBlockArgs(args);\n }\n },\n debounceSpan,\n { maxWait },\n );\n\n const setBlockUiState = useDebounceFn(\n (ui: UiState) => {\n if (!isJsonEqual(ui, snapshot.ui)) {\n platforma.setBlockUiState(ui);\n }\n },\n debounceSpan,\n { maxWait },\n );\n\n const setBlockArgsAndUiState = useDebounceFn(\n (args: Args, ui: UiState) => {\n if (!isJsonEqual(args, snapshot.args) || !isJsonEqual(ui, snapshot.ui)) {\n platforma.setBlockArgsAndUiState(args, ui);\n }\n },\n debounceSpan,\n { maxWait },\n );\n\n (platforma as PlatformaV1<Args, Outputs, UiState, Href>).onStateUpdates(async (updates) => {\n updates.forEach((patch) => {\n if (patch.key === \"args\" && !isJsonEqual(snapshot.args, patch.value)) {\n snapshot.args = Object.freeze(patch.value);\n log(\"args patch\", snapshot.args);\n }\n\n if (patch.key === \"ui\" && !isJsonEqual(snapshot.ui, patch.value)) {\n snapshot.ui = Object.freeze(patch.value);\n log(\"ui patch\", snapshot.ui);\n }\n\n if (patch.key === \"outputs\" && !isJsonEqual(snapshot.outputs, patch.value)) {\n snapshot.outputs = Object.freeze(patch.value);\n log(\"outputs patch\", snapshot.outputs);\n }\n\n if (patch.key === \"navigationState\" && !isJsonEqual(snapshot.navigationState, patch.value)) {\n snapshot.navigationState = Object.freeze(patch.value);\n log(\"navigationState patch\", snapshot.navigationState);\n }\n });\n\n await nextTick();\n });\n\n const cloneArgs = () => deepClone(snapshot.args) as Args;\n const cloneUiState = () => deepClone(snapshot.ui) as UiState;\n const cloneNavigationState = () =>\n deepClone(snapshot.navigationState) as Mutable<NavigationState<Href>>;\n\n const methods = {\n createArgsModel<T = Args>(options: StateModelOptions<Args, T> = {}) {\n return createModel<T, Args>({\n get() {\n if (options.transform) {\n return options.transform(snapshot.args);\n }\n\n return snapshot.args as T;\n },\n validate: options.validate,\n autoSave: true,\n onSave(newArgs) {\n setBlockArgs(newArgs);\n },\n });\n },\n /**\n * defaultUiState is temporarily here, remove it after implementing initialUiState\n */\n createUiModel<T = UiState>(\n options: StateModelOptions<UiState, T> = {},\n defaultUiState: () => UiState,\n ) {\n return createModel<T, UiState>({\n get() {\n if (options.transform) {\n return options.transform(snapshot.ui);\n }\n\n return (snapshot.ui ?? defaultUiState()) as T;\n },\n validate: options.validate,\n autoSave: true,\n onSave(newData) {\n setBlockUiState(newData);\n },\n });\n },\n /**\n * Note: Don't forget to list the output names, like: useOutputs('output1', 'output2', ...etc)\n * @param keys - List of output names\n * @returns {OptionalResult<UnwrapOutputs<Outputs, K>>}\n */\n useOutputs<K extends keyof Outputs>(...keys: K[]): OptionalResult<UnwrapOutputs<Outputs, K>> {\n const data = reactive({\n errors: undefined,\n value: undefined,\n });\n\n watch(\n () => snapshot.outputs,\n () => {\n try {\n Object.assign(data, {\n value: this.unwrapOutputs<K>(...keys),\n errors: undefined,\n });\n } catch (error) {\n Object.assign(data, {\n value: undefined,\n errors: [String(error)],\n });\n }\n },\n { immediate: true, deep: true },\n );\n\n return data as OptionalResult<UnwrapOutputs<Outputs, K>>;\n },\n /**\n * Retrieves the unwrapped values of outputs for the given keys.\n *\n * @template K - Keys of the outputs to unwrap.\n * @param keys - List of output names.\n * @throws Error if the outputs contain errors.\n * @returns An object with unwrapped output values.\n */\n unwrapOutputs<K extends keyof Outputs>(...keys: K[]): UnwrapOutputs<Outputs, K> {\n const outputs = snapshot.outputs;\n const entries = keys.map((key) => [key, unwrapOutput(outputs[key])]);\n return Object.fromEntries(entries);\n },\n /**\n * Updates the arguments state by applying a callback.\n *\n * @param cb - Callback to modify the current arguments.\n * @returns A promise resolving after the update is applied.\n */\n updateArgs(cb: (args: Args) => void) {\n const newArgs = cloneArgs();\n cb(newArgs);\n return platforma.setBlockArgs(newArgs);\n },\n /**\n * Updates the UI state by applying a callback.\n *\n * @param cb - Callback to modify the current UI state.\n * @returns A promise resolving after the update is applied.\n * @todo Make it mutable since there is already an initial one\n */\n updateUiState(cb: (args: UiState) => UiState): Promise<void> {\n const newUiState = cloneUiState();\n return platforma.setBlockUiState(cb(newUiState));\n },\n /**\n * Updates the navigation state by applying a callback.\n *\n * @param cb - Callback to modify the current navigation state.\n * @returns A promise resolving after the update is applied.\n */\n updateNavigationState(cb: (args: Mutable<NavigationState<Href>>) => void) {\n const newState = cloneNavigationState();\n cb(newState);\n return platforma.setNavigationState(newState);\n },\n /**\n * Navigates to a specific href by updating the navigation state.\n *\n * @param href - The target href to navigate to.\n * @returns A promise resolving after the navigation state is updated.\n */\n navigateTo(href: Href) {\n const newState = cloneNavigationState();\n newState.href = href;\n return platforma.setNavigationState(newState);\n },\n };\n\n const outputs = computed<OutputValues<Outputs>>(() => {\n const entries = Object.entries(snapshot.outputs).map(([k, outputWithStatus]) =>\n platforma.blockModelInfo.outputs[k].withStatus\n ? [k, ensureOutputHasStableFlag(outputWithStatus)]\n : [\n k,\n outputWithStatus.ok && outputWithStatus.value !== undefined\n ? outputWithStatus.value\n : undefined,\n ],\n );\n return Object.fromEntries(entries);\n });\n\n const outputErrors = computed<OutputErrors<Outputs>>(() => {\n const entries = Object.entries(snapshot.outputs).map(([k, vOrErr]) => [\n k,\n vOrErr && vOrErr.ok === false ? new MultiError(vOrErr.errors) : undefined,\n ]);\n return Object.fromEntries(entries);\n });\n\n const getters = {\n snapshot,\n queryParams: computed(() => parseQuery<Href>(snapshot.navigationState.href)),\n href: computed(() => snapshot.navigationState.href),\n hasErrors: computed(() => Object.values(snapshot.outputs).some((v) => !v?.ok)),\n };\n\n const model = createAppModel(\n {\n get() {\n return { args: snapshot.args, ui: snapshot.ui } as AppModel;\n },\n autoSave: true,\n onSave(newData: AppModel) {\n setBlockArgsAndUiState(newData.args, newData.ui);\n },\n },\n {\n outputs,\n outputErrors,\n },\n settings,\n );\n\n return reactive(Object.assign(model, methods, getters));\n}\n\nexport type BaseAppV1<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n> = ReturnType<typeof createAppV1<Args, Outputs, UiState, Href>>;\n"],"mappings":";;;;;;;;;;AAqCA,SAAgB,EAMd,GACA,GACA,GACA;CAMA,IAAM,KAAO,GAAa,GAAG,MAAoB;AAC/C,EAAI,EAAS,SACX,QAAQ,IAAI,WAAW,KAAO,oCAAoC,iBAAiB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uB,EAAQ,MAAM,EAAQ,GAAG;;EAEnD,EACD;EACE;EACA;EACD,EACD,EACD;AAED,QAAO,EAAS,OAAO,OAAO,GAAO,GAAS,EAAQ,CAAC"}
@@ -1,50 +0,0 @@
1
- import { Mutable } from '@milaboratories/helpers';
2
- import { NavigationState, BlockOutputsBase, BlockState, PlatformaV2, ValueWithUTag, AuthorMarker, PlatformaExtended } from '@platforma-sdk/model';
3
- import { StateModelOptions, UnwrapOutputs, OutputValues, OutputErrors, AppSettings } from '../types';
4
- export declare const patchPoolingDelay = 150;
5
- export declare const createNextAuthorMarker: (marker: AuthorMarker | undefined) => AuthorMarker;
6
- /**
7
- * Creates an application instance with reactive state management, outputs, and methods for state updates and navigation.
8
- *
9
- * @template Args - The type of arguments used in the application.
10
- * @template Outputs - The type of block outputs extending `BlockOutputsBase`.
11
- * @template UiState - The type of the UI state.
12
- * @template Href - The type of navigation href, defaulting to a string starting with `/`.
13
- *
14
- * @param state - Initial state of the application, including args, outputs, UI state, and navigation state.
15
- * @param platforma - A platform interface for interacting with block states.
16
- * @param settings - Application settings, such as debug flags.
17
- *
18
- * @returns A reactive application object with methods, getters, and state.
19
- */
20
- export declare function createAppV2<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`>(state: ValueWithUTag<BlockState<Args, Outputs, UiState, Href>>, platforma: PlatformaExtended<PlatformaV2<Args, Outputs, UiState, Href>>, settings: AppSettings): {
21
- error: string;
22
- model: {
23
- args: import('vue').UnwrapRef<Args>;
24
- ui: import('vue').UnwrapRef<UiState>;
25
- outputs: import('vue').UnwrapRef<OutputValues<Outputs>>;
26
- outputErrors: import('vue').UnwrapRef<OutputErrors<Outputs>>;
27
- };
28
- cloneArgs: () => Args;
29
- cloneUiState: () => UiState;
30
- cloneNavigationState: () => Mutable<NavigationState<Href>>;
31
- createArgsModel: <T extends Args = Args>(options?: StateModelOptions<Args, T>) => import('../types').Model<T>;
32
- createUiModel: <T extends UiState = UiState>(options: StateModelOptions<UiState, T> | undefined, defaultUiState: () => UiState) => import('../types').Model<T>;
33
- unwrapOutputs: <K extends keyof Outputs>(...keys: K[]) => UnwrapOutputs<Outputs, K>;
34
- updateArgs: (cb: (args: Args) => void) => Promise<boolean>;
35
- updateUiState: (cb: (args: UiState) => UiState) => Promise<boolean>;
36
- navigateTo: (href: Href) => Promise<boolean>;
37
- allSettled: () => Promise<void>;
38
- closedRef: boolean;
39
- snapshot: {
40
- args: Args;
41
- outputs: Partial<Outputs>;
42
- ui: UiState;
43
- navigationState: NavigationState<Href>;
44
- };
45
- queryParams: import('../types').ParseQuery<Href>;
46
- href: Href;
47
- hasErrors: boolean;
48
- };
49
- export type BaseAppV2<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> = ReturnType<typeof createAppV2<Args, Outputs, UiState, Href>>;
50
- //# sourceMappingURL=createAppV2.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAppV2.d.ts","sourceRoot":"","sources":["../../src/internal/createAppV2.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,EACV,eAAe,EACf,gBAAgB,EAChB,UAAU,EACV,WAAW,EACX,aAAa,EACb,YAAY,EACZ,iBAAiB,EAClB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,KAAK,EACV,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACZ,MAAM,UAAU,CAAC;AAQlB,eAAO,MAAM,iBAAiB,MAAM,CAAC;AAErC,eAAO,MAAM,sBAAsB,GAAI,QAAQ,YAAY,GAAG,SAAS,KAAG,YAGxE,CAAC;AAUH;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,IAAI,GAAG,OAAO,EACd,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,OAAO,GAAG,OAAO,EACjB,IAA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queId as t } from "../lib/util/helpers/dist/strings.js";
3
- import { deepClone as n } from "../lib/util/helpers/dist/objects.js";
4
- import "../lib/util/helpers/dist/index.js";
5
- import { MultiError as r, ensureOutputHasStableFlag as i, unwrapOutput as a } from "../utils.js";
6
- import { createModel as o } from "../createModel.js";
7
- import { parseQuery as s } from "../urls.js";
8
- import { UpdateSerializer as c } from "./UpdateSerializer.js";
9
- import { computed as l, reactive as u, ref as d } from "vue";
10
- import { hasAbortError as f, unwrapResult as p } from "@platforma-sdk/model";
11
- import { watchIgnorable as m } from "@vueuse/core";
12
- import { applyPatch as h } from "fast-json-patch";
13
- var g = (e) => ({
14
- authorId: e?.authorId ?? t(),
15
- localVersion: (e?.localVersion ?? 0) + 1
16
- }), _ = (e) => {
17
- try {
18
- return JSON.stringify(e, null, 2);
19
- } catch (e) {
20
- return e instanceof Error ? e.message : String(e);
21
- }
22
- };
23
- function v(v, y, b) {
24
- let x = (e, ...t) => {
25
- b.debug && console.log(`%c>>> %c${e}`, "color: orange; font-weight: bold", "color: orange", ...t.map((e) => _(e)));
26
- }, S = (e, ...t) => {
27
- console.error(`%c>>> %c${e}`, "color: red; font-weight: bold", "color: red", ...t.map((e) => _(e)));
28
- }, C = {
29
- isExternalSnapshot: !1,
30
- author: {
31
- authorId: t(),
32
- localVersion: 0
33
- }
34
- }, w = () => (C.author = g(C.author), x("nextAuthorMarker", C.author), C.author), T = d(!1), E = d(v.uTag), D = b.debounceSpan ?? 200, O = new c({ debounceSpan: D }), k = new c({ debounceSpan: D }), A = new c({ debounceSpan: D }), j = new c({ debounceSpan: D }), M = d(v.value), N = async (e) => y.setBlockArgs(e, w()), P = async (e) => y.setBlockUiState(e, w()), F = async (e, t) => y.setBlockArgsAndUiState(e, t, w()), I = async (e) => y.setNavigationState(e), L = l(() => {
35
- let e = Object.entries(M.value.outputs).map(([e, t]) => y.blockModelInfo.outputs[e].withStatus ? [e, i(t)] : [e, t.ok && t.value !== void 0 ? t.value : void 0]);
36
- return Object.fromEntries(e);
37
- }), R = l(() => {
38
- let e = Object.entries(M.value.outputs).map(([e, t]) => [e, t && t.ok === !1 ? new r(t.errors) : void 0]);
39
- return Object.fromEntries(e);
40
- }), z = u({
41
- error: "",
42
- model: {
43
- args: n(M.value.args),
44
- ui: n(M.value.ui),
45
- outputs: L,
46
- outputErrors: R
47
- }
48
- }), { ignoreUpdates: B } = m(() => z.model, (e) => {
49
- let t = n(e);
50
- x("setArgsAndUiStateQueue appModel.model, args", t.args, "ui", t.ui), A.run(() => F(t.args, t.ui).then(p));
51
- }, { deep: !0 }), V = (e) => {
52
- x("updateAppModel", e), z.model.args = n(e.args), z.model.ui = n(e.ui);
53
- };
54
- (async () => {
55
- for (window.addEventListener("beforeunload", () => {
56
- T.value = !0, y.dispose().then(p).catch((e) => {
57
- S("error in dispose", e);
58
- });
59
- }); !T.value;) try {
60
- let e = await y.getPatches(E.value).then(p);
61
- if (x("patches.length", e.value.length), x("uTagRef.value", E.value), x("patches.uTag", e.uTag), x("patches.author", e.author), x("data.author", C.author), E.value = e.uTag, e.value.length === 0) {
62
- await new Promise((e) => setTimeout(e, 150));
63
- continue;
64
- }
65
- let t = C.author?.authorId !== e.author?.authorId;
66
- t || C.isExternalSnapshot ? (x("got external changes, applying them to the snapshot", e.value), B(() => {
67
- M.value = h(M.value, e.value, !1, !1).newDocument, V({
68
- args: M.value.args,
69
- ui: M.value.ui
70
- }), C.isExternalSnapshot = t;
71
- })) : (x("outputs changed", e.value), B(() => {
72
- M.value = h(M.value, e.value).newDocument;
73
- })), await new Promise((e) => setTimeout(e, 150));
74
- } catch (e) {
75
- f(e) ? (x("patches loop aborted"), T.value = !0) : (S("error in patches loop", e), await new Promise((e) => setTimeout(e, 1e3)));
76
- }
77
- })();
78
- let H = () => n(z.model.args), U = () => n(z.model.ui), W = () => n(M.value.navigationState), G = {
79
- cloneArgs: H,
80
- cloneUiState: U,
81
- cloneNavigationState: W,
82
- createArgsModel(e = {}) {
83
- return o({
84
- get() {
85
- return e.transform ? e.transform(M.value.args) : M.value.args;
86
- },
87
- validate: e.validate,
88
- autoSave: !0,
89
- onSave(e) {
90
- O.run(() => N(e).then(p));
91
- }
92
- });
93
- },
94
- createUiModel(e = {}, t) {
95
- return o({
96
- get() {
97
- return e.transform ? e.transform(M.value.ui) : M.value.ui ?? t();
98
- },
99
- validate: e.validate,
100
- autoSave: !0,
101
- onSave(e) {
102
- k.run(() => P(e).then(p));
103
- }
104
- });
105
- },
106
- unwrapOutputs(...e) {
107
- let t = M.value.outputs, n = e.map((e) => [e, a(t[e])]);
108
- return Object.fromEntries(n);
109
- },
110
- updateArgs(e) {
111
- let t = H();
112
- return e(t), x("updateArgs", t), z.model.args = t, O.run(() => N(t).then(p));
113
- },
114
- updateUiState(e) {
115
- let t = e(U());
116
- return x("updateUiState", t), z.model.ui = t, k.run(() => P(t).then(p));
117
- },
118
- navigateTo(e) {
119
- let t = W();
120
- return t.href = e, j.run(() => I(t).then(p));
121
- },
122
- async allSettled() {
123
- return await e(0), A.allSettled();
124
- }
125
- }, K = {
126
- closedRef: T,
127
- snapshot: M,
128
- queryParams: l(() => s(M.value.navigationState.href)),
129
- href: l(() => M.value.navigationState.href),
130
- hasErrors: l(() => Object.values(M.value.outputs).some((e) => !e?.ok))
131
- }, q = u(Object.assign(z, G, K));
132
- return b.debug && (globalThis.__block_app__ = q), q;
133
- }
134
- //#endregion
135
- export { v as createAppV2 };
136
-
137
- //# sourceMappingURL=createAppV2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAppV2.js","names":[],"sources":["../../src/internal/createAppV2.ts"],"sourcesContent":["import { deepClone, delay, uniqueId } from \"@milaboratories/helpers\";\nimport type { Mutable } from \"@milaboratories/helpers\";\nimport type {\n NavigationState,\n BlockOutputsBase,\n BlockState,\n PlatformaV2,\n ValueWithUTag,\n AuthorMarker,\n PlatformaExtended,\n} from \"@platforma-sdk/model\";\nimport { hasAbortError, unwrapResult } from \"@platforma-sdk/model\";\nimport type { Ref } from \"vue\";\nimport { reactive, computed, ref } from \"vue\";\nimport type {\n StateModelOptions,\n UnwrapOutputs,\n OutputValues,\n OutputErrors,\n AppSettings,\n} from \"../types\";\nimport { createModel } from \"../createModel\";\nimport { parseQuery } from \"../urls\";\nimport { ensureOutputHasStableFlag, MultiError, unwrapOutput } from \"../utils\";\nimport { applyPatch } from \"fast-json-patch\";\nimport { UpdateSerializer } from \"./UpdateSerializer\";\nimport { watchIgnorable } from \"@vueuse/core\";\n\nexport const patchPoolingDelay = 150;\n\nexport const createNextAuthorMarker = (marker: AuthorMarker | undefined): AuthorMarker => ({\n authorId: marker?.authorId ?? uniqueId(),\n localVersion: (marker?.localVersion ?? 0) + 1,\n});\n\nconst stringifyForDebug = (v: unknown) => {\n try {\n return JSON.stringify(v, null, 2);\n } catch (err) {\n return err instanceof Error ? err.message : String(err);\n }\n};\n\n/**\n * Creates an application instance with reactive state management, outputs, and methods for state updates and navigation.\n *\n * @template Args - The type of arguments used in the application.\n * @template Outputs - The type of block outputs extending `BlockOutputsBase`.\n * @template UiState - The type of the UI state.\n * @template Href - The type of navigation href, defaulting to a string starting with `/`.\n *\n * @param state - Initial state of the application, including args, outputs, UI state, and navigation state.\n * @param platforma - A platform interface for interacting with block states.\n * @param settings - Application settings, such as debug flags.\n *\n * @returns A reactive application object with methods, getters, and state.\n */\nexport function createAppV2<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n>(\n state: ValueWithUTag<BlockState<Args, Outputs, UiState, Href>>,\n platforma: PlatformaExtended<PlatformaV2<Args, Outputs, UiState, Href>>,\n settings: AppSettings,\n) {\n const debug = (msg: string, ...rest: unknown[]) => {\n if (settings.debug) {\n console.log(\n `%c>>> %c${msg}`,\n \"color: orange; font-weight: bold\",\n \"color: orange\",\n ...rest.map((r) => stringifyForDebug(r)),\n );\n }\n };\n\n const error = (msg: string, ...rest: unknown[]) => {\n console.error(\n `%c>>> %c${msg}`,\n \"color: red; font-weight: bold\",\n \"color: red\",\n ...rest.map((r) => stringifyForDebug(r)),\n );\n };\n\n const data = {\n isExternalSnapshot: false,\n author: {\n authorId: uniqueId(),\n localVersion: 0,\n },\n };\n\n const nextAuthorMarker = () => {\n data.author = createNextAuthorMarker(data.author);\n debug(\"nextAuthorMarker\", data.author);\n return data.author;\n };\n\n const closedRef = ref(false);\n\n const uTagRef = ref(state.uTag);\n\n const debounceSpan = settings.debounceSpan ?? 200;\n\n const setArgsQueue = new UpdateSerializer({ debounceSpan });\n const setUiStateQueue = new UpdateSerializer({ debounceSpan });\n const setArgsAndUiStateQueue = new UpdateSerializer({ debounceSpan });\n const setNavigationStateQueue = new UpdateSerializer({ debounceSpan });\n\n /**\n * Reactive snapshot of the application state, including args, outputs, UI state, and navigation state.\n */\n const snapshot = ref<{\n args: Args;\n outputs: Partial<Outputs>;\n ui: UiState;\n navigationState: NavigationState<Href>;\n }>(state.value) as Ref<{\n args: Args;\n outputs: Partial<Outputs>;\n ui: UiState;\n navigationState: NavigationState<Href>;\n }>;\n\n const setBlockArgs = async (args: Args) => {\n return platforma.setBlockArgs(args, nextAuthorMarker());\n };\n\n const setBlockUiState = async (ui: UiState) => {\n return platforma.setBlockUiState(ui, nextAuthorMarker());\n };\n\n const setBlockArgsAndUiState = async (args: Args, ui: UiState) => {\n return platforma.setBlockArgsAndUiState(args, ui, nextAuthorMarker());\n };\n\n const setNavigationState = async (state: NavigationState<Href>) => {\n return platforma.setNavigationState(state);\n };\n\n const outputs = computed<OutputValues<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>).map(\n ([k, outputWithStatus]) =>\n platforma.blockModelInfo.outputs[k].withStatus\n ? [k, ensureOutputHasStableFlag(outputWithStatus)]\n : [\n k,\n outputWithStatus.ok && outputWithStatus.value !== undefined\n ? outputWithStatus.value\n : undefined,\n ],\n );\n return Object.fromEntries(entries);\n });\n\n const outputErrors = computed<OutputErrors<Outputs>>(() => {\n const entries = Object.entries(snapshot.value.outputs as Partial<Readonly<Outputs>>).map(\n ([k, vOrErr]) => [\n k,\n vOrErr && vOrErr.ok === false ? new MultiError(vOrErr.errors) : undefined,\n ],\n );\n return Object.fromEntries(entries);\n });\n\n const appModel = reactive({\n error: \"\",\n model: {\n args: deepClone(snapshot.value.args) as Args,\n ui: deepClone(snapshot.value.ui) as UiState,\n outputs,\n outputErrors,\n },\n }) as {\n error: string;\n model: {\n args: Args;\n ui: UiState;\n outputs: OutputValues<Outputs>;\n outputErrors: OutputErrors<Outputs>;\n };\n };\n\n const { ignoreUpdates } = watchIgnorable(\n () => appModel.model,\n (_newData) => {\n const newData = deepClone(_newData);\n debug(\"setArgsAndUiStateQueue appModel.model, args\", newData.args, \"ui\", newData.ui);\n setArgsAndUiStateQueue.run(() =>\n setBlockArgsAndUiState(newData.args, newData.ui).then(unwrapResult),\n );\n },\n { deep: true },\n );\n\n const updateAppModel = (newData: { args: Args; ui: UiState }) => {\n debug(\"updateAppModel\", newData);\n appModel.model.args = deepClone(newData.args) as Args;\n appModel.model.ui = deepClone(newData.ui) as UiState;\n };\n\n (async () => {\n window.addEventListener(\"beforeunload\", () => {\n closedRef.value = true;\n platforma\n .dispose()\n .then(unwrapResult)\n .catch((err) => {\n error(\"error in dispose\", err);\n });\n });\n\n while (!closedRef.value) {\n try {\n const patches = await platforma.getPatches(uTagRef.value).then(unwrapResult);\n\n debug(\"patches.length\", patches.value.length);\n debug(\"uTagRef.value\", uTagRef.value);\n debug(\"patches.uTag\", patches.uTag);\n debug(\"patches.author\", patches.author);\n debug(\"data.author\", data.author);\n\n uTagRef.value = patches.uTag;\n\n if (patches.value.length === 0) {\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n continue;\n }\n\n const isAuthorChanged = data.author?.authorId !== patches.author?.authorId;\n\n // Immutable behavior, apply external changes to the snapshot\n if (isAuthorChanged || data.isExternalSnapshot) {\n debug(\"got external changes, applying them to the snapshot\", patches.value);\n ignoreUpdates(() => {\n snapshot.value = applyPatch(snapshot.value, patches.value, false, false).newDocument;\n updateAppModel({ args: snapshot.value.args, ui: snapshot.value.ui });\n data.isExternalSnapshot = isAuthorChanged;\n });\n } else {\n // Mutable behavior\n debug(\"outputs changed\", patches.value);\n ignoreUpdates(() => {\n snapshot.value = applyPatch(snapshot.value, patches.value).newDocument;\n });\n }\n\n await new Promise((resolve) => setTimeout(resolve, patchPoolingDelay));\n } catch (err) {\n if (hasAbortError(err)) {\n debug(\"patches loop aborted\");\n closedRef.value = true;\n } else {\n error(\"error in patches loop\", err);\n await new Promise((resolve) => setTimeout(resolve, 1000));\n }\n }\n }\n })();\n\n const cloneArgs = () => deepClone(appModel.model.args) as Args;\n const cloneUiState = () => deepClone(appModel.model.ui) as UiState;\n const cloneNavigationState = () =>\n deepClone(snapshot.value.navigationState) as Mutable<NavigationState<Href>>;\n\n const methods = {\n cloneArgs,\n cloneUiState,\n cloneNavigationState,\n createArgsModel<T extends Args = Args>(options: StateModelOptions<Args, T> = {}) {\n return createModel<T, Args>({\n get() {\n if (options.transform) {\n return options.transform(snapshot.value.args as Args);\n }\n\n return snapshot.value.args as T;\n },\n validate: options.validate,\n autoSave: true,\n onSave(newArgs) {\n setArgsQueue.run(() => setBlockArgs(newArgs).then(unwrapResult));\n },\n });\n },\n /**\n * defaultUiState is temporarily here, remove it after implementing initialUiState\n */\n createUiModel<T extends UiState = UiState>(\n options: StateModelOptions<UiState, T> = {},\n defaultUiState: () => UiState,\n ) {\n return createModel<T, UiState>({\n get() {\n if (options.transform) {\n return options.transform(snapshot.value.ui as UiState);\n }\n\n return (snapshot.value.ui ?? defaultUiState()) as T;\n },\n validate: options.validate,\n autoSave: true,\n onSave(newData) {\n setUiStateQueue.run(() => setBlockUiState(newData).then(unwrapResult));\n },\n });\n },\n /**\n * Retrieves the unwrapped values of outputs for the given keys.\n *\n * @template K - Keys of the outputs to unwrap.\n * @param keys - List of output names.\n * @throws Error if the outputs contain errors.\n * @returns An object with unwrapped output values.\n */\n unwrapOutputs<K extends keyof Outputs>(...keys: K[]): UnwrapOutputs<Outputs, K> {\n const outputs = snapshot.value.outputs as Partial<Readonly<Outputs>>;\n const entries = keys.map((key) => [key, unwrapOutput(outputs[key])]);\n return Object.fromEntries(entries);\n },\n /**\n * Updates the arguments state by applying a callback.\n *\n * @param cb - Callback to modify the current arguments.\n * @returns A promise resolving after the update is applied.\n */\n updateArgs(cb: (args: Args) => void): Promise<boolean> {\n const newArgs = cloneArgs();\n cb(newArgs);\n debug(\"updateArgs\", newArgs);\n appModel.model.args = newArgs;\n return setArgsQueue.run(() => setBlockArgs(newArgs).then(unwrapResult));\n },\n /**\n * Updates the UI state by applying a callback.\n *\n * @param cb - Callback to modify the current UI state.\n * @returns A promise resolving after the update is applied.\n * @todo Make it mutable since there is already an initial one\n */\n updateUiState(cb: (args: UiState) => UiState): Promise<boolean> {\n const newUiState = cb(cloneUiState());\n debug(\"updateUiState\", newUiState);\n appModel.model.ui = newUiState;\n return setUiStateQueue.run(() => setBlockUiState(newUiState).then(unwrapResult));\n },\n /**\n * Navigates to a specific href by updating the navigation state.\n *\n * @param href - The target href to navigate to.\n * @returns A promise resolving after the navigation state is updated.\n */\n navigateTo(href: Href) {\n const newState = cloneNavigationState();\n newState.href = href;\n return setNavigationStateQueue.run(() => setNavigationState(newState).then(unwrapResult));\n },\n async allSettled() {\n await delay(0);\n return setArgsAndUiStateQueue.allSettled();\n },\n };\n\n const getters = {\n closedRef,\n snapshot,\n queryParams: computed(() => parseQuery<Href>(snapshot.value.navigationState.href as Href)),\n href: computed(() => snapshot.value.navigationState.href),\n hasErrors: computed(() =>\n Object.values(snapshot.value.outputs as Partial<Readonly<Outputs>>).some((v) => !v?.ok),\n ),\n };\n\n const app = reactive(Object.assign(appModel, methods, getters));\n\n if (settings.debug) {\n // @ts-expect-error (to inspect in console in debug mode)\n globalThis.__block_app__ = app;\n }\n\n return app;\n}\n\nexport type BaseAppV2<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n> = ReturnType<typeof createAppV2<Args, Outputs, UiState, Href>>;\n"],"mappings":";;;;;;;;;;;;AA8BA,IAAa,KAA0B,OAAoD;CACzF,UAAU,GAAQ,YAAY,GAAU;CACxC,eAAe,GAAQ,gBAAgB,KAAK;CAC7C,GAEK,KAAqB,MAAe;AACxC,KAAI;AACF,SAAO,KAAK,UAAU,GAAG,MAAM,EAAE;UAC1B,GAAK;AACZ,SAAO,aAAe,QAAQ,EAAI,UAAU,OAAO,EAAI;;;AAkB3D,SAAgB,EAMd,GACA,GACA,GACA;CACA,IAAM,KAAS,GAAa,GAAG,MAAoB;AACjD,EAAI,EAAS,SACX,QAAQ,IACN,WAAW,KACX,oCACA,iBACA,GAAG,EAAK,KAAK,MAAM,EAAkB,EAAE,CAAC,CACzC;IAIC,KAAS,GAAa,GAAG,MAAoB;AACjD,UAAQ,MACN,WAAW,KACX,iCACA,cACA,GAAG,EAAK,KAAK,MAAM,EAAkB,EAAE,CAAC,CACzC;IAGG,IAAO;EACX,oBAAoB;EACpB,QAAQ;GACN,UAAU,GAAU;GACpB,cAAc;GACf;EACF,EAEK,WACJ,EAAK,SAAS,EAAuB,EAAK,OAAO,EACjD,EAAM,oBAAoB,EAAK,OAAO,EAC/B,EAAK,SAGR,IAAY,EAAI,GAAM,EAEtB,IAAU,EAAI,EAAM,KAAK,EAEzB,IAAe,EAAS,gBAAgB,KAExC,IAAe,IAAI,EAAiB,EAAE,iBAAc,CAAC,EACrD,IAAkB,IAAI,EAAiB,EAAE,iBAAc,CAAC,EACxD,IAAyB,IAAI,EAAiB,EAAE,iBAAc,CAAC,EAC/D,IAA0B,IAAI,EAAiB,EAAE,iBAAc,CAAC,EAKhE,IAAW,EAKd,EAAM,MAAM,EAOT,IAAe,OAAO,MACnB,EAAU,aAAa,GAAM,GAAkB,CAAC,EAGnD,IAAkB,OAAO,MACtB,EAAU,gBAAgB,GAAI,GAAkB,CAAC,EAGpD,I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,UADA,MAAM,EAAM,EAAE,EACP,EAAuB,YAAY;;EAE7C,EAEK,IAAU;EACd;EACA;EACA,aAAa,QAAe,EAAiB,EAAS,MAAM,gBAAgB,KAAa,CAAC;EAC1F,MAAM,QAAe,EAAS,MAAM,gBAAgB,KAAK;EACzD,WAAW,QACT,OAAO,OAAO,EAAS,MAAM,QAAsC,CAAC,MAAM,MAAM,CAAC,GAAG,GAAG,CACxF;EACF,EAEK,IAAM,EAAS,OAAO,OAAO,GAAU,GAAS,EAAQ,CAAC;AAO/D,QALI,EAAS,UAEX,WAAW,gBAAgB,IAGtB"}
@@ -1,15 +0,0 @@
1
- import { OutputWithStatus } from '@platforma-sdk/model';
2
- type Args = {
3
- x: number;
4
- y: number;
5
- };
6
- type UiState = {
7
- label: string;
8
- delay?: number;
9
- };
10
- type Outputs = {
11
- sum: OutputWithStatus<number>;
12
- };
13
- export declare const platforma: import('@platforma-sdk/model').PlatformaV2<Args, Outputs, UiState, `/${string}`>;
14
- export {};
15
- //# sourceMappingURL=createAppV2.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"createAppV2.test.d.ts","sourceRoot":"","sources":["../../src/internal/createAppV2.test.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,gBAAgB,EAAgB,MAAM,sBAAsB,CAAC;AAQ3E,KAAK,IAAI,GAAG;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,KAAK,OAAO,GAAG;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAOF,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAC;CAC/B,CAAC;AA0BF,eAAO,MAAM,SAAS,kFAAsE,CAAC"}
@@ -1,29 +0,0 @@
1
- import { BlockOutputsBase, BlockState, NavigationState, AuthorMarker, ValueWithUTagAndAuthor, ResultOrError, BlockApiV2, ValueWithUTag } from '@platforma-sdk/model';
2
- import { Operation } from 'fast-json-patch';
3
- export declare class BlockStateMock<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> {
4
- args: Args;
5
- outputs: Outputs;
6
- ui: UiState;
7
- href: Href;
8
- author: AuthorMarker;
9
- uTag: string;
10
- constructor(args: Args, outputs: Outputs, ui: UiState, href: Href, author?: AuthorMarker, uTag?: string);
11
- setState(_state: Partial<BlockStateMock<Args, Outputs, UiState, Href>>): void;
12
- }
13
- export declare abstract class BlockMock<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`> implements BlockApiV2<Args, Outputs, UiState, Href> {
14
- #private;
15
- state: BlockStateMock<Args, Outputs, UiState, Href>;
16
- constructor(state: BlockStateMock<Args, Outputs, UiState, Href>);
17
- dispose(): Promise<ResultOrError<void>>;
18
- get uTag(): string;
19
- setBlockArgs(args: Args, author?: AuthorMarker): Promise<ResultOrError<void, Error>>;
20
- setBlockUiState(ui: UiState, author?: AuthorMarker): Promise<ResultOrError<void, Error>>;
21
- setBlockArgsAndUiState(args: Args, ui: UiState, author?: AuthorMarker): Promise<ResultOrError<void, Error>>;
22
- setNavigationState(navigationState: NavigationState<Href>): Promise<ResultOrError<void, Error>>;
23
- loadBlockState(): Promise<ResultOrError<ValueWithUTag<BlockState<Args, Outputs, UiState, Href>>>>;
24
- getPatches(uTag: string): Promise<ResultOrError<ValueWithUTagAndAuthor<Operation[]>>>;
25
- private doUpdate;
26
- abstract process(): Promise<void>;
27
- }
28
- export type InferState<B> = B extends BlockMock<infer S> ? S : never;
29
- //# sourceMappingURL=BlockMock.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BlockMock.d.ts","sourceRoot":"","sources":["../../../src/internal/test-helpers/BlockMock.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,eAA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