@platforma-sdk/ui-vue 1.40.6 → 1.41.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.
- package/.turbo/turbo-build.log +49 -22
- package/.turbo/turbo-type-check.log +1 -1
- package/CHANGELOG.md +20 -0
- package/dist/AgGridVue/useAgGridOptions.js +54 -53
- package/dist/AgGridVue/useAgGridOptions.js.map +1 -1
- package/dist/components/BlockLayout.vue.d.ts.map +1 -1
- package/dist/components/BlockLayout.vue.js +7 -50
- package/dist/components/BlockLayout.vue.js.map +1 -1
- package/dist/components/BlockLayout.vue2.js +53 -2
- package/dist/components/BlockLayout.vue2.js.map +1 -1
- package/dist/components/BlockLayout.vue3.js +9 -0
- package/dist/components/BlockLayout.vue3.js.map +1 -0
- package/dist/components/NotFound.vue.d.ts.map +1 -1
- package/dist/components/NotFound.vue.js +12 -14
- package/dist/components/NotFound.vue.js.map +1 -1
- package/dist/components/PlAgDataTable/PlAgRowCount.vue.js +7 -6
- package/dist/components/PlAgDataTable/PlAgRowCount.vue.js.map +1 -1
- package/dist/components/PlAgDataTable/sources/table-source-v2.js +12 -12
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js +10 -9
- package/dist/components/PlAgRowNumCheckbox/PlAgRowNumCheckbox.vue.js.map +1 -1
- package/dist/components/PlAgRowNumHeader.vue.js +3 -2
- package/dist/components/PlAgRowNumHeader.vue.js.map +1 -1
- package/dist/components/PlAnnotations/components/DynamicForm.vue2.js +10 -10
- package/dist/components/PlAnnotations/components/PlAnnotationCreateDialog.vue.d.ts +1 -1
- package/dist/components/PlAnnotations/components/PlAnnotationCreateDialog.vue.d.ts.map +1 -1
- package/dist/components/PlMultiSequenceAlignment/data.js +51 -51
- package/dist/composition/fileContent.js +16 -16
- package/dist/defineApp.d.ts +19 -6
- package/dist/defineApp.d.ts.map +1 -1
- package/dist/defineApp.js +50 -30
- package/dist/defineApp.js.map +1 -1
- package/dist/internal/UpdateSerializer.d.ts +26 -0
- package/dist/internal/UpdateSerializer.d.ts.map +1 -0
- package/dist/internal/UpdateSerializer.js +65 -0
- package/dist/internal/UpdateSerializer.js.map +1 -0
- package/dist/internal/createAppModel.d.ts +1 -1
- package/dist/internal/createAppModel.d.ts.map +1 -1
- package/dist/internal/createAppModel.js +43 -51
- package/dist/internal/createAppModel.js.map +1 -1
- package/dist/internal/{createApp.d.ts → createAppV1.d.ts} +4 -4
- package/dist/internal/createAppV1.d.ts.map +1 -0
- package/dist/internal/{createApp.js → createAppV1.js} +17 -18
- package/dist/internal/createAppV1.js.map +1 -0
- package/dist/internal/createAppV2.d.ts +56 -0
- package/dist/internal/createAppV2.d.ts.map +1 -0
- package/dist/internal/createAppV2.js +158 -0
- package/dist/internal/createAppV2.js.map +1 -0
- package/dist/internal/test-helpers/BlockMock.d.ts +28 -0
- package/dist/internal/test-helpers/BlockMock.d.ts.map +1 -0
- package/dist/internal/test-helpers/createMockApi.d.ts +4 -0
- package/dist/internal/test-helpers/createMockApi.d.ts.map +1 -0
- package/dist/internal/test-helpers/utils.d.ts +4 -0
- package/dist/internal/test-helpers/utils.d.ts.map +1 -0
- package/dist/{types.static-test.d.ts → internal/v1.static-test.d.ts} +3 -3
- package/dist/internal/v1.static-test.d.ts.map +1 -0
- package/dist/internal/v2.static-test.d.ts +7 -0
- package/dist/internal/v2.static-test.d.ts.map +1 -0
- package/dist/lib/model/common/dist/index.js +214 -199
- package/dist/lib/model/common/dist/index.js.map +1 -1
- package/dist/lib/ui/uikit/dist/lib/model/common/dist/index.js +8 -8
- package/dist/lib/ui/uikit/dist/sdk/model/dist/index.js +64 -43
- package/dist/lib/ui/uikit/dist/sdk/model/dist/index.js.map +1 -1
- package/dist/lib/util/helpers/dist/index.js +67 -56
- package/dist/lib/util/helpers/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js +29 -0
- package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/index.js.map +1 -0
- package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.js +208 -0
- package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/core.js.map +1 -0
- package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/duplex.js +95 -0
- package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/duplex.js.map +1 -0
- package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/helpers.js +112 -0
- package/dist/node_modules/.pnpm/fast-json-patch@3.1.1/node_modules/fast-json-patch/module/helpers.js.map +1 -0
- package/dist/sdk/model/dist/index.js +151 -131
- package/dist/sdk/model/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -6
- package/src/components/BlockLayout.vue +9 -1
- package/src/components/NotFound.vue +1 -3
- package/src/defineApp.ts +134 -36
- package/src/internal/UpdateSerializer.ts +112 -0
- package/src/internal/createAppModel.ts +7 -20
- package/src/internal/{createApp.ts → createAppV1.ts} +10 -6
- package/src/internal/createAppV2.test.ts +158 -0
- package/src/internal/createAppV2.ts +309 -0
- package/src/internal/test-helpers/BlockMock.ts +144 -0
- package/src/internal/test-helpers/createMockApi.ts +92 -0
- package/src/internal/test-helpers/utils.ts +65 -0
- package/src/{types.static-test.ts → internal/v1.static-test.ts} +5 -9
- package/src/internal/v2.static-test.ts +98 -0
- package/src/types.ts +2 -2
- package/dist/internal/createApp.d.ts.map +0 -1
- package/dist/internal/createApp.js.map +0 -1
- package/dist/types.static-test.d.ts.map +0 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { defineComponent as g, mergeModels as O, useModel as D, computed as c, watch as _, resolveComponent as h, createElementBlock as v, createCommentVNode as V, openBlock as n, normalizeClass as B, Fragment as i, renderList as S, createBlock as p, unref as s, withCtx as j, createTextVNode as w, toDisplayString as U } from "vue";
|
|
2
2
|
import { isNil as R } from "../../../lib/util/helpers/dist/index.js";
|
|
3
3
|
import "../../../lib/ui/uikit/dist/index.js";
|
|
4
|
-
import { getFilterUiMetadata as
|
|
4
|
+
import { getFilterUiMetadata as x, getFilterUiTypeOptions as z } from "../../../sdk/model/dist/index.js";
|
|
5
5
|
import k from "../../../lib/ui/uikit/dist/components/PlDropdown/PlDropdown.vue.js";
|
|
6
|
-
import
|
|
6
|
+
import E from "../../../lib/ui/uikit/dist/components/PlTextField/PlTextField.vue.js";
|
|
7
7
|
import T from "../../../lib/ui/uikit/dist/components/PlNumberField/PlNumberField.vue.js";
|
|
8
|
-
import
|
|
9
|
-
const
|
|
8
|
+
import I from "../../../lib/ui/uikit/dist/components/PlCheckbox/PlCheckbox.vue.js";
|
|
9
|
+
const L = { key: 7 }, H = /* @__PURE__ */ g({
|
|
10
10
|
__name: "DynamicForm",
|
|
11
11
|
props: /* @__PURE__ */ O({
|
|
12
12
|
columns: {},
|
|
@@ -25,8 +25,8 @@ const I = { key: 7 }, J = /* @__PURE__ */ g({
|
|
|
25
25
|
}), f = c(() => {
|
|
26
26
|
const o = t.value;
|
|
27
27
|
if (o.type && typeof o.type == "string")
|
|
28
|
-
return
|
|
29
|
-
}), M = c(() =>
|
|
28
|
+
return x(o.type);
|
|
29
|
+
}), M = c(() => z(b.value)), F = c(() => d.columns.map((o) => ({ label: o.label, value: o.id }))), C = c(() => {
|
|
30
30
|
const o = f.value, u = b.value;
|
|
31
31
|
return o && u ? d.columns.filter((r) => o.supportedFor(u, r.obj)).map((r) => ({
|
|
32
32
|
label: r.label,
|
|
@@ -66,7 +66,7 @@ const I = { key: 7 }, J = /* @__PURE__ */ g({
|
|
|
66
66
|
label: l.label ?? e,
|
|
67
67
|
options: M.value,
|
|
68
68
|
"onUpdate:modelValue": (a) => m(e, a)
|
|
69
|
-
}, null, 8, ["model-value", "label", "options", "onUpdate:modelValue"])) : l.fieldType === "string" ? (n(), p(s(
|
|
69
|
+
}, null, 8, ["model-value", "label", "options", "onUpdate:modelValue"])) : l.fieldType === "string" ? (n(), p(s(E), {
|
|
70
70
|
key: 2,
|
|
71
71
|
"model-value": t.value[e],
|
|
72
72
|
label: l.label ?? e,
|
|
@@ -88,7 +88,7 @@ const I = { key: 7 }, J = /* @__PURE__ */ g({
|
|
|
88
88
|
label: l.label ?? e,
|
|
89
89
|
clearable: !0,
|
|
90
90
|
"onUpdate:modelValue": (a) => m(e, a)
|
|
91
|
-
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])) : l.fieldType === "boolean" || l.fieldType === "boolean?" ? (n(), p(s(
|
|
91
|
+
}, null, 8, ["model-value", "label", "onUpdate:modelValue"])) : l.fieldType === "boolean" || l.fieldType === "boolean?" ? (n(), p(s(I), {
|
|
92
92
|
key: 6,
|
|
93
93
|
"model-value": !!t.value[e],
|
|
94
94
|
label: l.label ?? e,
|
|
@@ -98,13 +98,13 @@ const I = { key: 7 }, J = /* @__PURE__ */ g({
|
|
|
98
98
|
w(U(l.label ?? e), 1)
|
|
99
99
|
]),
|
|
100
100
|
_: 2
|
|
101
|
-
}, 1032, ["model-value", "label", "onUpdate:modelValue"])) : (n(), v("pre",
|
|
101
|
+
}, 1032, ["model-value", "label", "onUpdate:modelValue"])) : (n(), v("pre", L, "TODO:" + U(l.fieldType), 1))
|
|
102
102
|
], 64))), 128))
|
|
103
103
|
], 2)) : V("", !0);
|
|
104
104
|
};
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
107
|
export {
|
|
108
|
-
|
|
108
|
+
H as default
|
|
109
109
|
};
|
|
110
110
|
//# sourceMappingURL=DynamicForm.vue2.js.map
|
|
@@ -9,11 +9,11 @@ declare const _default: import('vue').DefineComponent<__VLS_PublicProps, {}, {},
|
|
|
9
9
|
name: string;
|
|
10
10
|
}) => any;
|
|
11
11
|
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
-
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
13
12
|
onSubmit?: ((props: {
|
|
14
13
|
type: "byClonotype" | "bySampleAndClonotype";
|
|
15
14
|
name: string;
|
|
16
15
|
}) => any) | undefined;
|
|
16
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
17
17
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
18
18
|
export default _default;
|
|
19
19
|
//# sourceMappingURL=PlAnnotationCreateDialog.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlAnnotationCreateDialog.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/PlAnnotations/components/PlAnnotationCreateDialog.vue"],"names":[],"mappings":"AA6GA,KAAK,iBAAiB,GAAG;IACzB,UAAU,EAAE,OAAO,CAAC;CACnB,CAAC;;;;;cApC6B,aAAa,GAAG,sBAAsB;cAAQ,MAAM
|
|
1
|
+
{"version":3,"file":"PlAnnotationCreateDialog.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/PlAnnotations/components/PlAnnotationCreateDialog.vue"],"names":[],"mappings":"AA6GA,KAAK,iBAAiB,GAAG;IACzB,UAAU,EAAE,OAAO,CAAC;CACnB,CAAC;;;;;cApC6B,aAAa,GAAG,sBAAsB;cAAQ,MAAM;;;;cAApD,aAAa,GAAG,sBAAsB;cAAQ,MAAM;;;;AAkLnF,wBAQG"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isJsonEqual as L } from "../../lib/util/helpers/dist/index.js";
|
|
2
|
-
import { getRawPlatformaInstance as
|
|
2
|
+
import { getRawPlatformaInstance as Q, isLabelColumn as B, isLinkerColumn as X, createRowSelectionColumn as Y } from "../../sdk/model/dist/index.js";
|
|
3
3
|
import { ref as O, watch as Z } from "vue";
|
|
4
4
|
import { chemicalPropertiesColorMap as I, colorizeSequencesByChemicalProperties as ee } from "./chemical-properties.js";
|
|
5
|
-
import { parseMarkup as
|
|
5
|
+
import { parseMarkup as te, markupAlignedSequence as ne, markupColors as T, colorizeSequencesByMarkup as oe } from "./markup.js";
|
|
6
6
|
import { multiSequenceAlignment as ae } from "./multi-sequence-alignment.js";
|
|
7
7
|
import { getResidueCounts as re } from "./residue-counts.js";
|
|
8
8
|
import { ensureError as se, canonicalizeJson as A, getAxisId as J, parseJson as D, matchAxisId as ie, pTableValue as q } from "../../lib/model/common/dist/index.js";
|
|
9
|
-
const M = () =>
|
|
9
|
+
const M = () => Q().pFrameDriver, E = 1e3, Se = k(
|
|
10
10
|
le
|
|
11
11
|
), xe = k(
|
|
12
12
|
ce
|
|
@@ -17,10 +17,10 @@ const M = () => K().pFrameDriver, E = 1e3, Se = k(
|
|
|
17
17
|
);
|
|
18
18
|
async function le({
|
|
19
19
|
pFrame: c,
|
|
20
|
-
sequenceColumnPredicate:
|
|
20
|
+
sequenceColumnPredicate: t
|
|
21
21
|
}) {
|
|
22
22
|
if (!c) return;
|
|
23
|
-
const a = (await M().listColumns(c)).filter((i) =>
|
|
23
|
+
const a = (await M().listColumns(c)).filter((i) => t(i)).map(({ spec: i, columnId: p }) => {
|
|
24
24
|
var m;
|
|
25
25
|
return {
|
|
26
26
|
label: ((m = i.annotations) == null ? void 0 : m["pl7.app/label"]) ?? "Unlabelled column",
|
|
@@ -31,11 +31,11 @@ async function le({
|
|
|
31
31
|
}
|
|
32
32
|
async function ce({
|
|
33
33
|
pFrame: c,
|
|
34
|
-
sequenceColumnIds:
|
|
34
|
+
sequenceColumnIds: t
|
|
35
35
|
}) {
|
|
36
36
|
var f, x, w;
|
|
37
|
-
if (!c || !
|
|
38
|
-
const d = M(), l = await d.listColumns(c), a = /* @__PURE__ */ new Map(), s = new Map(
|
|
37
|
+
if (!c || !t) return;
|
|
38
|
+
const d = M(), l = await d.listColumns(c), a = /* @__PURE__ */ new Map(), s = new Map(t.flatMap((r) => {
|
|
39
39
|
const y = l.find(({ columnId: u }) => u === r);
|
|
40
40
|
if (!y)
|
|
41
41
|
throw new Error(`Couldn't find sequence column (ID: \`${r}\`).`);
|
|
@@ -76,15 +76,15 @@ async function ce({
|
|
|
76
76
|
}
|
|
77
77
|
async function pe({
|
|
78
78
|
pFrame: c,
|
|
79
|
-
sequenceColumnIds:
|
|
79
|
+
sequenceColumnIds: t
|
|
80
80
|
}) {
|
|
81
|
-
if (!c || (
|
|
81
|
+
if (!c || (t == null ? void 0 : t.length) !== 1) return;
|
|
82
82
|
const l = await M().listColumns(c), a = l.find(
|
|
83
|
-
(s) => s.columnId ===
|
|
83
|
+
(s) => s.columnId === t[0]
|
|
84
84
|
);
|
|
85
85
|
if (!a)
|
|
86
86
|
throw new Error(
|
|
87
|
-
`Couldn't find sequence column (ID: \`${
|
|
87
|
+
`Couldn't find sequence column (ID: \`${t[0]}\`).`
|
|
88
88
|
);
|
|
89
89
|
return l.filter(
|
|
90
90
|
(s) => {
|
|
@@ -104,19 +104,19 @@ async function pe({
|
|
|
104
104
|
}
|
|
105
105
|
async function ue({
|
|
106
106
|
pframe: c,
|
|
107
|
-
sequenceColumnIds:
|
|
107
|
+
sequenceColumnIds: t,
|
|
108
108
|
labelColumnIds: d,
|
|
109
109
|
markupColumnId: l,
|
|
110
110
|
selection: a,
|
|
111
111
|
colorScheme: s,
|
|
112
112
|
alignmentParams: i
|
|
113
113
|
}) {
|
|
114
|
-
var $, j,
|
|
115
|
-
if (!c || !(
|
|
116
|
-
const p = M(), m = await p.listColumns(c), f = m.filter((e) =>
|
|
114
|
+
var $, j, z, N;
|
|
115
|
+
if (!c || !(t != null && t.length) || !d) return;
|
|
116
|
+
const p = M(), m = await p.listColumns(c), f = m.filter((e) => X(e.spec)), x = Y({ selection: a });
|
|
117
117
|
let w = {
|
|
118
118
|
type: "inner",
|
|
119
|
-
entries:
|
|
119
|
+
entries: t.map((e) => ({
|
|
120
120
|
type: "column",
|
|
121
121
|
column: e
|
|
122
122
|
}))
|
|
@@ -141,11 +141,11 @@ async function ue({
|
|
|
141
141
|
const r = d.flatMap((e) => e.type !== "column" ? [] : { type: "column", column: e.id });
|
|
142
142
|
l && r.push({ type: "column", column: l });
|
|
143
143
|
const y = Array.from(
|
|
144
|
-
new Set(
|
|
145
|
-
const
|
|
146
|
-
if (!
|
|
144
|
+
new Set(t.flatMap((e) => {
|
|
145
|
+
const n = m.find(({ columnId: o }) => o === e);
|
|
146
|
+
if (!n)
|
|
147
147
|
throw new Error(`Couldn't find sequence column (ID: ${e})`);
|
|
148
|
-
return
|
|
148
|
+
return n.spec.axesSpec.map((o) => A(J(o)));
|
|
149
149
|
}))
|
|
150
150
|
).sort().map((e) => ({
|
|
151
151
|
column: { type: "axis", id: D(e) },
|
|
@@ -170,27 +170,27 @@ async function ue({
|
|
|
170
170
|
);
|
|
171
171
|
let b = (g == null ? void 0 : g[0].data.data.length) ?? 0, P = !1;
|
|
172
172
|
b > E && (b = E, P = !0);
|
|
173
|
-
const R =
|
|
174
|
-
const
|
|
175
|
-
if (!
|
|
173
|
+
const R = t.map((e) => {
|
|
174
|
+
const n = g.find(({ spec: o }) => o.id === e);
|
|
175
|
+
if (!n)
|
|
176
176
|
throw new Error(`Couldn't find sequence column (ID: \`${e}\`).`);
|
|
177
|
-
return
|
|
177
|
+
return n;
|
|
178
178
|
}), V = d.map((e) => {
|
|
179
|
-
const
|
|
179
|
+
const n = g.find(({ spec: o }) => {
|
|
180
180
|
if (e.type === "axis" && o.type === "axis")
|
|
181
181
|
return L(e.id, o.id);
|
|
182
182
|
if (e.type === "column" && o.type === "column")
|
|
183
183
|
return e.id === o.id;
|
|
184
184
|
});
|
|
185
|
-
if (!
|
|
185
|
+
if (!n)
|
|
186
186
|
throw new Error(`Couldn't find label column (ID: \`${e}\`).`);
|
|
187
|
-
return
|
|
187
|
+
return n;
|
|
188
188
|
}), C = l && g.find(({ spec: e }) => e.id === l), W = await Promise.all(
|
|
189
189
|
R.map(
|
|
190
190
|
(e) => ae(
|
|
191
191
|
Array.from(
|
|
192
192
|
{ length: b },
|
|
193
|
-
(
|
|
193
|
+
(n, o) => {
|
|
194
194
|
var h;
|
|
195
195
|
return ((h = q(e.data, o, { na: "", absent: "" })) == null ? void 0 : h.toString()) ?? "";
|
|
196
196
|
}
|
|
@@ -200,41 +200,41 @@ async function ue({
|
|
|
200
200
|
)
|
|
201
201
|
), F = Array.from(
|
|
202
202
|
{ length: b },
|
|
203
|
-
(e,
|
|
204
|
-
),
|
|
203
|
+
(e, n) => W.map((o) => o[n])
|
|
204
|
+
), G = R.map(
|
|
205
205
|
(e) => {
|
|
206
|
-
var
|
|
207
|
-
return ((
|
|
206
|
+
var n;
|
|
207
|
+
return ((n = e.spec.spec.annotations) == null ? void 0 : n["pl7.app/label"]) ?? "Unlabelled column";
|
|
208
208
|
}
|
|
209
|
-
),
|
|
209
|
+
), H = Array.from(
|
|
210
210
|
{ length: b },
|
|
211
|
-
(e,
|
|
211
|
+
(e, n) => V.map(
|
|
212
212
|
(o) => {
|
|
213
213
|
var h;
|
|
214
|
-
return ((h = q(o.data,
|
|
214
|
+
return ((h = q(o.data, n, { na: "", absent: "" })) == null ? void 0 : h.toString()) ?? "";
|
|
215
215
|
}
|
|
216
216
|
)
|
|
217
217
|
), v = F.map((e) => e.join(" ")), U = re(v), S = {
|
|
218
218
|
sequences: v,
|
|
219
|
-
sequenceNames:
|
|
220
|
-
labelsRows:
|
|
219
|
+
sequenceNames: G,
|
|
220
|
+
labelsRows: H,
|
|
221
221
|
exceedsLimit: P,
|
|
222
222
|
residueCounts: U
|
|
223
223
|
};
|
|
224
224
|
if (C) {
|
|
225
225
|
const e = JSON.parse(
|
|
226
226
|
(($ = C.spec.spec.annotations) == null ? void 0 : $["pl7.app/sequence/annotation/mapping"]) ?? "{}"
|
|
227
|
-
),
|
|
227
|
+
), n = Array.from(
|
|
228
228
|
{ length: b },
|
|
229
229
|
(o, h) => {
|
|
230
|
-
var
|
|
231
|
-
const
|
|
232
|
-
((
|
|
230
|
+
var _;
|
|
231
|
+
const K = te(
|
|
232
|
+
((_ = q(C.data, h, { na: "", absent: "" })) == null ? void 0 : _.toString()) ?? ""
|
|
233
233
|
);
|
|
234
|
-
return
|
|
234
|
+
return ne(F[h][0], K);
|
|
235
235
|
}
|
|
236
236
|
);
|
|
237
|
-
S.markup = { labels: e, data:
|
|
237
|
+
S.markup = { labels: e, data: n };
|
|
238
238
|
}
|
|
239
239
|
if (s.type === "chemical-properties") {
|
|
240
240
|
const e = I;
|
|
@@ -250,16 +250,16 @@ async function ue({
|
|
|
250
250
|
const e = Object.fromEntries(
|
|
251
251
|
Object.entries(
|
|
252
252
|
((j = S.markup) == null ? void 0 : j.labels) ?? {}
|
|
253
|
-
).map(([
|
|
254
|
-
|
|
253
|
+
).map(([n, o], h) => [
|
|
254
|
+
n,
|
|
255
255
|
{ label: o, color: T[h % T.length] }
|
|
256
256
|
])
|
|
257
257
|
);
|
|
258
258
|
S.highlightImage = {
|
|
259
259
|
blob: await oe({
|
|
260
|
-
markupRows: ((
|
|
260
|
+
markupRows: ((z = S.markup) == null ? void 0 : z.data) ?? [],
|
|
261
261
|
colorMap: e,
|
|
262
|
-
columnCount: ((
|
|
262
|
+
columnCount: ((N = v.at(0)) == null ? void 0 : N.length) ?? 0
|
|
263
263
|
}),
|
|
264
264
|
colorMap: e
|
|
265
265
|
};
|
|
@@ -267,7 +267,7 @@ async function ue({
|
|
|
267
267
|
return S;
|
|
268
268
|
}
|
|
269
269
|
function k(c) {
|
|
270
|
-
const
|
|
270
|
+
const t = O(), d = O(!0), l = O();
|
|
271
271
|
let a;
|
|
272
272
|
return (s) => (Z(s, async (i, p) => {
|
|
273
273
|
if (L(i, p)) return;
|
|
@@ -275,13 +275,13 @@ function k(c) {
|
|
|
275
275
|
try {
|
|
276
276
|
l.value = void 0, d.value = !0;
|
|
277
277
|
const f = await c(i);
|
|
278
|
-
m === a && (
|
|
278
|
+
m === a && (t.value = f);
|
|
279
279
|
} catch (f) {
|
|
280
280
|
console.error(f), m === a && (l.value = se(f));
|
|
281
281
|
} finally {
|
|
282
282
|
m === a && (d.value = !1);
|
|
283
283
|
}
|
|
284
|
-
}, { immediate: !0 }), { data:
|
|
284
|
+
}, { immediate: !0 }), { data: t, isLoading: d, error: l });
|
|
285
285
|
}
|
|
286
286
|
export {
|
|
287
287
|
E as sequenceLimit,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var f = Object.defineProperty;
|
|
2
2
|
var h = (i, t, s) => t in i ? f(i, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : i[t] = s;
|
|
3
|
-
var
|
|
3
|
+
var n = (i, t, s) => h(i, typeof t != "symbol" ? t + "" : t, s);
|
|
4
4
|
import { getRawPlatformaInstance as d } from "../sdk/model/dist/index.js";
|
|
5
5
|
import { LRUCache as g } from "../node_modules/.pnpm/lru-cache@11.1.0/node_modules/lru-cache/dist/esm/index.js";
|
|
6
6
|
import { shallowRef as u, computed as r } from "vue";
|
|
@@ -10,10 +10,10 @@ const v = {
|
|
|
10
10
|
};
|
|
11
11
|
class w {
|
|
12
12
|
constructor(t) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
n(this, "_str");
|
|
14
|
+
n(this, "_rawJson");
|
|
15
|
+
n(this, "_zodSchema");
|
|
16
|
+
n(this, "_validatedJson");
|
|
17
17
|
this.bytes = t;
|
|
18
18
|
}
|
|
19
19
|
get str() {
|
|
@@ -28,16 +28,16 @@ class w {
|
|
|
28
28
|
}
|
|
29
29
|
const a = class a {
|
|
30
30
|
constructor(t) {
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
n(this, "fileDataCache");
|
|
32
|
+
n(this, "fileDataRefs", /* @__PURE__ */ new Map());
|
|
33
33
|
const s = { ...v, ...t ?? {} };
|
|
34
34
|
this.fileDataCache = new g({
|
|
35
35
|
maxSize: s.cacheSize,
|
|
36
36
|
fetchMethod: async (e) => new w(await d().blobDriver.getContent(e)),
|
|
37
37
|
sizeCalculation: (e) => e.bytes.length,
|
|
38
38
|
/** Will also be called on error fetching the file */
|
|
39
|
-
dispose: (e,
|
|
40
|
-
this.fileDataRefs.delete(
|
|
39
|
+
dispose: (e, o) => {
|
|
40
|
+
this.fileDataRefs.delete(o);
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
}
|
|
@@ -47,10 +47,10 @@ const a = class a {
|
|
|
47
47
|
const e = u();
|
|
48
48
|
return this.fileDataRefs.set(t, e), (async () => {
|
|
49
49
|
try {
|
|
50
|
-
const
|
|
51
|
-
e.value =
|
|
52
|
-
} catch (
|
|
53
|
-
console.error(
|
|
50
|
+
const o = await this.fileDataCache.fetch(t);
|
|
51
|
+
e.value = o;
|
|
52
|
+
} catch (o) {
|
|
53
|
+
console.error(o);
|
|
54
54
|
}
|
|
55
55
|
})(), e;
|
|
56
56
|
}
|
|
@@ -74,8 +74,8 @@ const a = class a {
|
|
|
74
74
|
if (t === void 0) return;
|
|
75
75
|
const e = this.getDataRef(t);
|
|
76
76
|
return r(() => {
|
|
77
|
-
var
|
|
78
|
-
return s === void 0 ? (
|
|
77
|
+
var o, c;
|
|
78
|
+
return s === void 0 ? (o = e == null ? void 0 : e.value) == null ? void 0 : o.rawJson : (c = e == null ? void 0 : e.value) == null ? void 0 : c.validatedJson(s);
|
|
79
79
|
});
|
|
80
80
|
}
|
|
81
81
|
static getContentBytes(t) {
|
|
@@ -88,7 +88,7 @@ const a = class a {
|
|
|
88
88
|
return a.globalInstance.getContentJson(t, s);
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
|
|
91
|
+
n(a, "globalInstance", new a());
|
|
92
92
|
let l = a;
|
|
93
93
|
export {
|
|
94
94
|
l as ReactiveFileContent
|
package/dist/defineApp.d.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PlatformaV1, PlatformaV2, BlockOutputsBase } from '@platforma-sdk/model';
|
|
2
2
|
import { Component, Reactive } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { BaseAppV1 } from './internal/createAppV1';
|
|
4
|
+
import { BaseAppV2 } from './internal/createAppV2';
|
|
4
5
|
import { AppSettings, ExtendSettings } from './types';
|
|
5
6
|
export declare function useSdkPlugin(): SdkPlugin;
|
|
6
|
-
export declare function defineApp<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`, Extend extends ExtendSettings<Href> = ExtendSettings<Href>>(platforma:
|
|
7
|
-
export
|
|
7
|
+
export declare function defineApp<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`, Extend extends ExtendSettings<Href> = ExtendSettings<Href>>(platforma: PlatformaV1<Args, Outputs, UiState, Href>, extendApp: (app: BaseAppV1<Args, Outputs, UiState, Href>) => Extend, settings?: AppSettings): SdkPluginV1<Args, Outputs, UiState, Href, Extend>;
|
|
8
|
+
export declare function defineApp<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`, Extend extends ExtendSettings<Href> = ExtendSettings<Href>>(platforma: PlatformaV2<Args, Outputs, UiState, Href>, extendApp: (app: BaseAppV2<Args, Outputs, UiState, Href>) => Extend, settings?: AppSettings): SdkPluginV2<Args, Outputs, UiState, Href, Extend>;
|
|
9
|
+
export type AppV1<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`, Local extends ExtendSettings<Href> = ExtendSettings<Href>> = (BaseAppV1<Args, Outputs, UiState, Href>) & Reactive<Omit<Local, 'routes'>> & {
|
|
8
10
|
getRoute(href: Href): Component | undefined;
|
|
9
11
|
};
|
|
10
|
-
export type
|
|
12
|
+
export type AppV2<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`, Local extends ExtendSettings<Href> = ExtendSettings<Href>> = (BaseAppV2<Args, Outputs, UiState, Href>) & Reactive<Omit<Local, 'routes'>> & {
|
|
13
|
+
getRoute(href: Href): Component | undefined;
|
|
14
|
+
};
|
|
15
|
+
export type App<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`, Local extends ExtendSettings<Href> = ExtendSettings<Href>> = AppV1<Args, Outputs, UiState, Href, Local> | AppV2<Args, Outputs, UiState, Href, Local>;
|
|
16
|
+
export type SdkPluginV1<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`, Local extends ExtendSettings<Href> = ExtendSettings<Href>> = {
|
|
17
|
+
loaded: boolean;
|
|
18
|
+
error: unknown;
|
|
19
|
+
useApp<PageHref extends Href = Href>(): AppV1<Args, Outputs, UiState, PageHref, Local>;
|
|
20
|
+
install(app: unknown): void;
|
|
21
|
+
};
|
|
22
|
+
export type SdkPluginV2<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`, Local extends ExtendSettings<Href> = ExtendSettings<Href>> = {
|
|
11
23
|
loaded: boolean;
|
|
12
24
|
error: unknown;
|
|
13
|
-
useApp<PageHref extends Href = Href>():
|
|
25
|
+
useApp<PageHref extends Href = Href>(): AppV2<Args, Outputs, UiState, PageHref, Local>;
|
|
14
26
|
install(app: unknown): void;
|
|
15
27
|
};
|
|
28
|
+
export type SdkPlugin<Args = unknown, Outputs extends BlockOutputsBase = BlockOutputsBase, UiState = unknown, Href extends `/${string}` = `/${string}`, Local extends ExtendSettings<Href> = ExtendSettings<Href>> = SdkPluginV1<Args, Outputs, UiState, Href, Local> | SdkPluginV2<Args, Outputs, UiState, Href, Local>;
|
|
16
29
|
//# sourceMappingURL=defineApp.d.ts.map
|
package/dist/defineApp.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineApp.d.ts","sourceRoot":"","sources":["../src/defineApp.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"defineApp.d.ts","sourceRoot":"","sources":["../src/defineApp.ts"],"names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,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IACvF,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,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,EACxC,KAAK,SAAS,cAAc,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,IACvD,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,GAAG,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC"}
|
package/dist/defineApp.js
CHANGED
|
@@ -1,50 +1,70 @@
|
|
|
1
|
-
import { notEmpty as
|
|
2
|
-
import {
|
|
3
|
-
import { inject as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { notEmpty as V } from "./lib/util/helpers/dist/index.js";
|
|
2
|
+
import { getPlatformaApiVersion as g } from "./sdk/model/dist/index.js";
|
|
3
|
+
import { inject as k, reactive as h, markRaw as A } from "vue";
|
|
4
|
+
import { createAppV1 as j } from "./internal/createAppV1.js";
|
|
5
|
+
import { createAppV2 as S } from "./internal/createAppV2.js";
|
|
6
|
+
import { activateAgGrid as w } from "./aggrid.js";
|
|
7
|
+
import { unwrapResult as y } from "./lib/model/common/dist/index.js";
|
|
8
|
+
const m = Symbol("sdk-vue");
|
|
9
|
+
function $() {
|
|
10
|
+
return k(m);
|
|
9
11
|
}
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
function C(e, p, l = {}) {
|
|
13
|
+
let u;
|
|
14
|
+
w();
|
|
15
|
+
const d = e.apiVersion ?? 1, f = g(), b = async () => {
|
|
16
|
+
if (f !== d)
|
|
17
|
+
throw new Error(`Block requested API version ${f} but runtime API version is ${d}.
|
|
18
|
+
Please update the desktop app to use the latest API version.`);
|
|
19
|
+
e.apiVersion === void 0 || e.apiVersion === 1 ? await e.loadBlockState().then((o) => {
|
|
20
|
+
a.loaded = !0;
|
|
21
|
+
const t = j(o, e, l), i = p(t), c = Object.fromEntries(
|
|
22
|
+
Object.entries(i.routes).map(([s, r]) => {
|
|
23
|
+
const n = typeof r == "function" ? r() : r;
|
|
24
|
+
return [s, A(n)];
|
|
20
25
|
})
|
|
21
26
|
);
|
|
22
|
-
|
|
23
|
-
...
|
|
27
|
+
u = Object.assign(t, {
|
|
28
|
+
...i,
|
|
29
|
+
getRoute(s) {
|
|
30
|
+
return c[s];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}) : e.apiVersion === 2 && await e.loadBlockState().then((o) => {
|
|
34
|
+
const t = y(o);
|
|
35
|
+
a.loaded = !0;
|
|
36
|
+
const i = S(t, e, l), c = p(i), s = Object.fromEntries(
|
|
37
|
+
Object.entries(c.routes).map(([r, n]) => {
|
|
38
|
+
const v = typeof n == "function" ? n() : n;
|
|
39
|
+
return [r, A(v)];
|
|
40
|
+
})
|
|
41
|
+
);
|
|
42
|
+
u = Object.assign(i, {
|
|
43
|
+
...c,
|
|
24
44
|
getRoute(r) {
|
|
25
|
-
return
|
|
45
|
+
return s[r];
|
|
26
46
|
}
|
|
27
47
|
});
|
|
28
|
-
}).catch((t) => {
|
|
29
|
-
console.error("load initial state error", t), e.error = t;
|
|
30
48
|
});
|
|
31
|
-
},
|
|
49
|
+
}, a = h({
|
|
32
50
|
loaded: !1,
|
|
33
51
|
error: void 0,
|
|
34
52
|
// Href to get typed query parameters for a specific route
|
|
35
53
|
useApp() {
|
|
36
|
-
return
|
|
54
|
+
return V(u, "App is not loaded");
|
|
37
55
|
},
|
|
38
56
|
// @todo type portability issue with Vue
|
|
39
57
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
40
|
-
install(
|
|
41
|
-
|
|
58
|
+
install(o) {
|
|
59
|
+
o.provide(m, this), b().catch((t) => {
|
|
60
|
+
console.error("load initial state error", t), a.error = t;
|
|
61
|
+
});
|
|
42
62
|
}
|
|
43
63
|
});
|
|
44
|
-
return
|
|
64
|
+
return a;
|
|
45
65
|
}
|
|
46
66
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
67
|
+
C as defineApp,
|
|
68
|
+
$ as useSdkPlugin
|
|
49
69
|
};
|
|
50
70
|
//# sourceMappingURL=defineApp.js.map
|
package/dist/defineApp.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defineApp.js","sources":["../src/defineApp.ts"],"sourcesContent":["import { notEmpty } from '@milaboratories/helpers';\nimport {
|
|
1
|
+
{"version":3,"file":"defineApp.js","sources":["../src/defineApp.ts"],"sourcesContent":["import { notEmpty } from '@milaboratories/helpers';\nimport type { PlatformaV1, PlatformaV2 } from '@platforma-sdk/model';\nimport { getPlatformaApiVersion, unwrapResult, type BlockOutputsBase, type Platforma } from '@platforma-sdk/model';\nimport type { Component, Reactive } from 'vue';\nimport { inject, markRaw, reactive } from 'vue';\nimport { createAppV1, type BaseAppV1 } from './internal/createAppV1';\nimport { createAppV2, type BaseAppV2 } from './internal/createAppV2';\nimport type { AppSettings, ExtendSettings, Routes } from './types';\nimport { activateAgGrid } from './aggrid';\n\nconst pluginKey = Symbol('sdk-vue');\n\nexport function useSdkPlugin(): SdkPlugin {\n return inject(pluginKey)!;\n}\n\nexport function defineApp<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n Extend extends ExtendSettings<Href> = ExtendSettings<Href>,\n>(\n platforma: PlatformaV1<Args, Outputs, UiState, Href>,\n extendApp: (app: BaseAppV1<Args, Outputs, UiState, Href>) => Extend,\n settings?: AppSettings,\n): SdkPluginV1<Args, Outputs, UiState, Href, Extend>;\n\nexport function defineApp<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n Extend extends ExtendSettings<Href> = ExtendSettings<Href>,\n>(\n platforma: PlatformaV2<Args, Outputs, UiState, Href>,\n extendApp: (app: BaseAppV2<Args, Outputs, UiState, Href>) => Extend,\n settings?: AppSettings,\n): SdkPluginV2<Args, Outputs, UiState, Href, Extend>;\n\nexport function defineApp<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n Extend extends ExtendSettings<Href> = ExtendSettings<Href>,\n>(\n platforma: Platforma<Args, Outputs, UiState, Href>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n extendApp: (app: any) => Extend,\n settings: AppSettings = {},\n): SdkPlugin<Args, Outputs, UiState, Href, Extend> {\n let app: undefined | AppV1<Args, Outputs, UiState, Href, Extend> | AppV2<Args, Outputs, UiState, Href, Extend> = undefined;\n\n activateAgGrid();\n\n const runtimeApiVersion = platforma.apiVersion ?? 1; // undefined means 1 (backward compatibility)\n\n const blockRequestedApiVersion = getPlatformaApiVersion();\n\n const loadApp = async () => {\n if (blockRequestedApiVersion !== runtimeApiVersion) {\n throw new Error(`Block requested API version ${blockRequestedApiVersion} but runtime API version is ${runtimeApiVersion}.\n Please update the desktop app to use the latest API version.`);\n }\n\n if (platforma.apiVersion === undefined || platforma.apiVersion === 1) {\n await platforma\n .loadBlockState()\n .then((state) => {\n plugin.loaded = true;\n const baseApp = createAppV1<Args, Outputs, UiState, Href>(state, platforma, settings);\n\n const localState = extendApp(baseApp);\n\n const routes = Object.fromEntries(\n Object.entries(localState.routes as Routes<Href>).map(([href, component]) => {\n const c = typeof component === 'function' ? component() : component;\n return [href, markRaw(c as Component)];\n }),\n );\n\n app = Object.assign(baseApp, {\n ...localState,\n getRoute(href: Href): Component | undefined {\n return routes[href];\n },\n } as unknown as AppV1<Args, Outputs, UiState, Href, Extend>);\n });\n } else if (platforma.apiVersion === 2) {\n await platforma\n .loadBlockState()\n .then((stateOrError) => {\n const state = unwrapResult(stateOrError);\n plugin.loaded = true;\n const baseApp = createAppV2<Args, Outputs, UiState, Href>(state, platforma, settings);\n\n const localState = extendApp(baseApp);\n\n const routes = Object.fromEntries(\n Object.entries(localState.routes as Routes<Href>).map(([href, component]) => {\n const c = typeof component === 'function' ? component() : component;\n return [href, markRaw(c as Component)];\n }),\n );\n\n app = Object.assign(baseApp, {\n ...localState,\n getRoute(href: Href): Component | undefined {\n return routes[href];\n },\n } as unknown as AppV2<Args, Outputs, UiState, Href, Extend>);\n });\n }\n };\n\n const plugin = reactive({\n loaded: false,\n error: undefined as unknown,\n // Href to get typed query parameters for a specific route\n useApp<PageHref extends Href = Href>() {\n return notEmpty(app, 'App is not loaded') as App<Args, Outputs, UiState, PageHref, Extend>;\n },\n // @todo type portability issue with Vue\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n install(app: any) {\n app.provide(pluginKey, this);\n loadApp().catch((err) => {\n console.error('load initial state error', err);\n plugin.error = err;\n });\n },\n });\n\n return plugin as SdkPlugin<Args, Outputs, UiState, Href, Extend>;\n}\n\nexport type AppV1<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n> = (BaseAppV1<Args, Outputs, UiState, Href>) & Reactive<Omit<Local, 'routes'>> & { getRoute(href: Href): Component | undefined };\n\nexport type AppV2<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n> = (BaseAppV2<Args, Outputs, UiState, Href>) & Reactive<Omit<Local, 'routes'>> & { getRoute(href: Href): Component | undefined };\n\nexport type App<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n> = AppV1<Args, Outputs, UiState, Href, Local> | AppV2<Args, Outputs, UiState, Href, Local>;\n\nexport type SdkPluginV1<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n> = {\n loaded: boolean;\n error: unknown;\n useApp<PageHref extends Href = Href>(): AppV1<Args, Outputs, UiState, PageHref, Local>;\n install(app: unknown): void;\n};\n\nexport type SdkPluginV2<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n> = {\n loaded: boolean;\n error: unknown;\n useApp<PageHref extends Href = Href>(): AppV2<Args, Outputs, UiState, PageHref, Local>;\n install(app: unknown): void;\n};\n\nexport type SdkPlugin<\n Args = unknown,\n Outputs extends BlockOutputsBase = BlockOutputsBase,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n Local extends ExtendSettings<Href> = ExtendSettings<Href>,\n> = SdkPluginV1<Args, Outputs, UiState, Href, Local> | SdkPluginV2<Args, Outputs, UiState, Href, Local>;\n"],"names":["pluginKey","useSdkPlugin","inject","defineApp","platforma","extendApp","settings","app","activateAgGrid","runtimeApiVersion","blockRequestedApiVersion","getPlatformaApiVersion","loadApp","state","plugin","baseApp","createAppV1","localState","routes","href","component","c","markRaw","stateOrError","unwrapResult","createAppV2","reactive","notEmpty","err"],"mappings":";;;;;;;AAUA,MAAMA,IAAY,OAAO,SAAS;AAE3B,SAASC,IAA0B;AACxC,SAA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IAAAA;AAC1D,iBAAO,CAACD,GAAMG,EAAQD,CAAc,CAAC;AAAA,QACtC,CAAA;AAAA,MACH;AAEM,MAAAd,IAAA,OAAO,OAAOQ,GAAS;AAAA,QAC3B,GAAGE;AAAA,QACH,SAASE,GAAmC;AAC1C,iBAAOD,EAAOC,CAAI;AAAA,QAAA;AAAA,MACpB,CACyD;AAAA,IAAA,CAC5D;AAAA,EAEP,GAEML,IAASY,EAAS;AAAA,IACtB,QAAQ;AAAA,IACR,OAAO;AAAA;AAAA,IAEP,SAAuC;AAC9B,aAAAC,EAASpB,GAAK,mBAAmB;AAAA,IAC1C;AAAA;AAAA;AAAA,IAGA,QAAQA,GAAU;AAChBA,MAAAA,EAAI,QAAQP,GAAW,IAAI,GACnBY,EAAA,EAAE,MAAM,CAACgB,MAAQ;AACf,gBAAA,MAAM,4BAA4BA,CAAG,GAC7Cd,EAAO,QAAQc;AAAA,MAAA,CAChB;AAAA,IAAA;AAAA,EACH,CACD;AAEM,SAAAd;AACT;"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type RetryState = {
|
|
2
|
+
i: number;
|
|
3
|
+
};
|
|
4
|
+
export type OnNext = (e: unknown, state: RetryState) => {
|
|
5
|
+
delayMs: number;
|
|
6
|
+
};
|
|
7
|
+
export declare class UpdateSerializer {
|
|
8
|
+
private readonly options;
|
|
9
|
+
private ongoingRun;
|
|
10
|
+
private ongoingOperation;
|
|
11
|
+
private counter;
|
|
12
|
+
constructor(options?: {
|
|
13
|
+
debounceSpan?: number;
|
|
14
|
+
});
|
|
15
|
+
allSettled(): Promise<void>;
|
|
16
|
+
retry<T>(op: () => Promise<T>, onNext: OnNext): Promise<T>;
|
|
17
|
+
/**
|
|
18
|
+
* @returns true if operation succeeded, or false if operation was evicted by a more recent call
|
|
19
|
+
*/
|
|
20
|
+
run(op: () => Promise<void>): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* @returns true if operation succeeded, or false if operation was evicted by a more recent call
|
|
23
|
+
*/
|
|
24
|
+
private _run;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=UpdateSerializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UpdateSerializer.d.ts","sourceRoot":"","sources":["../../src/internal/UpdateSerializer.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU,KAAK;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5E,qBAAa,gBAAgB;IAKf,OAAO,CAAC,QAAQ,CAAC,OAAO;IAJpC,OAAO,CAAC,UAAU,CAA2C;IAC7D,OAAO,CAAC,gBAAgB,CAAoC;IAC5D,OAAO,CAAC,OAAO,CAAK;gBAES,OAAO,GAAE;QACpC,YAAY,CAAC,EAAE,MAAM,CAAC;KAClB;IAEA,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAc3B,KAAK,CAAC,CAAC,EACX,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,CAAC,CAAC;IAqBb;;OAEG;IACU,GAAG,CAAC,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAI3D;;OAEG;YACW,IAAI;CA6CnB"}
|