@platforma-sdk/model 1.82.0 → 1.83.9
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/dist/annotations/converter.d.ts +1 -3
- package/dist/annotations/converter.d.ts.map +1 -1
- package/dist/annotations/types.d.ts +5 -6
- package/dist/annotations/types.d.ts.map +1 -1
- package/dist/bconfig/index.d.ts +2 -2
- package/dist/bconfig/lambdas.d.ts +11 -21
- package/dist/bconfig/lambdas.d.ts.map +1 -1
- package/dist/bconfig/normalization.d.ts +3 -5
- package/dist/bconfig/normalization.d.ts.map +1 -1
- package/dist/bconfig/types.d.ts +4 -5
- package/dist/bconfig/types.d.ts.map +1 -1
- package/dist/bconfig/util.d.ts +1 -3
- package/dist/bconfig/util.d.ts.map +1 -1
- package/dist/bconfig/v3.d.ts +4 -6
- package/dist/bconfig/v3.d.ts.map +1 -1
- package/dist/block_api_v1.d.ts +2 -4
- package/dist/block_api_v1.d.ts.map +1 -1
- package/dist/block_api_v2.d.ts +1 -3
- package/dist/block_api_v2.d.ts.map +1 -1
- package/dist/block_api_v3.d.ts +1 -3
- package/dist/block_api_v3.d.ts.map +1 -1
- package/dist/block_migrations.d.ts +20 -36
- package/dist/block_migrations.d.ts.map +1 -1
- package/dist/block_model.cjs +2 -2
- package/dist/block_model.d.ts +10 -10
- package/dist/block_model.d.ts.map +1 -1
- package/dist/block_model.js +2 -2
- package/dist/block_state_patch.d.ts +6 -6
- package/dist/block_state_patch.d.ts.map +1 -1
- package/dist/block_state_util.d.ts +4 -6
- package/dist/block_state_util.d.ts.map +1 -1
- package/dist/block_storage.d.ts +24 -23
- package/dist/block_storage.d.ts.map +1 -1
- package/dist/block_storage_facade.d.ts +11 -12
- package/dist/block_storage_facade.d.ts.map +1 -1
- package/dist/columns/column.d.ts +5 -6
- package/dist/columns/column.d.ts.map +1 -1
- package/dist/columns/column_providers/index.d.ts +5 -6
- package/dist/columns/column_providers/index.d.ts.map +1 -1
- package/dist/columns/column_providers/providers.d.ts +10 -11
- package/dist/columns/column_providers/providers.d.ts.map +1 -1
- package/dist/columns/column_providers/types.d.ts +2 -3
- package/dist/columns/column_providers/types.d.ts.map +1 -1
- package/dist/columns/column_recipes/column_discovered_recipe.d.ts +1 -3
- package/dist/columns/column_recipes/column_discovered_recipe.d.ts.map +1 -1
- package/dist/columns/column_recipes/column_filtered_recipe.d.ts +1 -3
- package/dist/columns/column_recipes/column_filtered_recipe.d.ts.map +1 -1
- package/dist/columns/column_recipes/column_overrided_recipe.d.ts +2 -3
- package/dist/columns/column_recipes/column_overrided_recipe.d.ts.map +1 -1
- package/dist/columns/column_recipes/index.d.ts +3 -4
- package/dist/columns/column_recipes/index.d.ts.map +1 -1
- package/dist/columns/column_recipes/types.d.ts +5 -6
- package/dist/columns/column_recipes/types.d.ts.map +1 -1
- package/dist/columns/columns_collection.d.ts +7 -8
- package/dist/columns/columns_collection.d.ts.map +1 -1
- package/dist/columns/data_column.d.ts +12 -16
- package/dist/columns/data_column.d.ts.map +1 -1
- package/dist/columns/derive_axis_values_labels.d.ts +2 -3
- package/dist/columns/derive_axis_values_labels.d.ts.map +1 -1
- package/dist/columns/split_by_axes.d.ts +3 -5
- package/dist/columns/split_by_axes.d.ts.map +1 -1
- package/dist/columns/utils.d.ts +10 -12
- package/dist/columns/utils.d.ts.map +1 -1
- package/dist/components/PFrameForGraphs.d.ts +5 -5
- package/dist/components/PFrameForGraphs.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filter.d.ts +59 -40
- package/dist/components/PlAnnotations/filter.d.ts.map +1 -1
- package/dist/components/PlAnnotations/filters_ui.d.ts +18 -18
- package/dist/components/PlAnnotations/filters_ui.d.ts.map +1 -1
- package/dist/components/PlDataTable/columnResolver.cjs +2 -4
- package/dist/components/PlDataTable/columnResolver.cjs.map +1 -1
- package/dist/components/PlDataTable/columnResolver.js +2 -4
- package/dist/components/PlDataTable/columnResolver.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts +3 -4
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV2.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.cjs.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts +13 -10
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js +1 -1
- package/dist/components/PlDataTable/createPlDataTable/createPlDataTableV3.js.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts +5 -5
- package/dist/components/PlDataTable/createPlDataTable/discoverColumns.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/index.d.ts +4 -4
- package/dist/components/PlDataTable/createPlDataTable/index.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTable/utils.d.ts +8 -7
- package/dist/components/PlDataTable/createPlDataTable/utils.d.ts.map +1 -1
- package/dist/components/PlDataTable/createPlDataTableSheet.d.ts +2 -3
- package/dist/components/PlDataTable/createPlDataTableSheet.d.ts.map +1 -1
- package/dist/components/PlDataTable/state-migration.d.ts +6 -7
- package/dist/components/PlDataTable/state-migration.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV4.d.ts +73 -42
- package/dist/components/PlDataTable/typesV4.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV5.d.ts +3 -5
- package/dist/components/PlDataTable/typesV5.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV6.d.ts +4 -6
- package/dist/components/PlDataTable/typesV6.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV7.d.ts +45 -27
- package/dist/components/PlDataTable/typesV7.d.ts.map +1 -1
- package/dist/components/PlDataTable/typesV8.d.ts +80 -45
- package/dist/components/PlDataTable/typesV8.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/build_dataset_options.d.ts +7 -6
- package/dist/components/PlDatasetSelector/build_dataset_options.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/dataset_selection.d.ts +4 -6
- package/dist/components/PlDatasetSelector/dataset_selection.d.ts.map +1 -1
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts +9 -8
- package/dist/components/PlDatasetSelector/filter_discovery.d.ts.map +1 -1
- package/dist/components/PlMultiSequenceAlignment.d.ts +6 -13
- package/dist/components/PlMultiSequenceAlignment.d.ts.map +1 -1
- package/dist/components/PlSelectionModel.d.ts +6 -6
- package/dist/components/PlSelectionModel.d.ts.map +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/config/index.d.ts +2 -6
- package/dist/config/model.d.ts +28 -30
- package/dist/config/model.d.ts.map +1 -1
- package/dist/config/type_engine.d.ts +8 -31
- package/dist/config/type_engine.d.ts.map +1 -1
- package/dist/env_value.d.ts +1 -2
- package/dist/env_value.d.ts.map +1 -1
- package/dist/filters/converters/filterToQuery.d.ts +6 -7
- package/dist/filters/converters/filterToQuery.d.ts.map +1 -1
- package/dist/filters/converters/filterUiToExpressionImpl.d.ts +2 -4
- package/dist/filters/converters/filterUiToExpressionImpl.d.ts.map +1 -1
- package/dist/filters/distill.d.ts +1 -3
- package/dist/filters/distill.d.ts.map +1 -1
- package/dist/filters/index.d.ts +1 -0
- package/dist/filters/types.d.ts +3 -4
- package/dist/filters/types.d.ts.map +1 -1
- package/dist/index.cjs +20 -60
- package/dist/index.d.ts +14 -11
- package/dist/index.js +4 -8
- package/dist/labels/derive_distinct_labels.d.ts +28 -17
- package/dist/labels/derive_distinct_labels.d.ts.map +1 -1
- package/dist/labels/derive_distinct_tooltips.d.ts +11 -8
- package/dist/labels/derive_distinct_tooltips.d.ts.map +1 -1
- package/dist/labels/linked_column_postfix.d.ts +3 -5
- package/dist/labels/linked_column_postfix.d.ts.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/pframe.d.ts +1 -3
- package/dist/pframe.d.ts.map +1 -1
- package/dist/pframe_utils/axes.d.ts +4 -5
- package/dist/pframe_utils/axes.d.ts.map +1 -1
- package/dist/pframe_utils/columns.d.ts +3 -7
- package/dist/pframe_utils/columns.d.ts.map +1 -1
- package/dist/pframe_utils/index.d.ts +9 -10
- package/dist/pframe_utils/index.d.ts.map +1 -1
- package/dist/platforma.d.ts +19 -21
- package/dist/platforma.d.ts.map +1 -1
- package/dist/plugin_handle.d.ts +11 -13
- package/dist/plugin_handle.d.ts.map +1 -1
- package/dist/plugin_model.d.ts +21 -22
- package/dist/plugin_model.d.ts.map +1 -1
- package/dist/raw_globals.d.ts +3 -4
- package/dist/raw_globals.d.ts.map +1 -1
- package/dist/render/accessor.d.ts +2 -4
- package/dist/render/accessor.d.ts.map +1 -1
- package/dist/render/api.cjs +0 -22
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +13 -21
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/api.js +1 -22
- package/dist/render/api.js.map +1 -1
- package/dist/render/future.d.ts +2 -4
- package/dist/render/future.d.ts.map +1 -1
- package/dist/render/index.cjs +0 -1
- package/dist/render/index.d.ts +3 -2
- package/dist/render/index.js +2 -2
- package/dist/render/internal.d.ts +11 -13
- package/dist/render/internal.d.ts.map +1 -1
- package/dist/render/traversal_ops.d.ts +14 -11
- package/dist/render/traversal_ops.d.ts.map +1 -1
- package/dist/render/util/axis_filtering.d.ts +5 -7
- package/dist/render/util/axis_filtering.d.ts.map +1 -1
- package/dist/render/util/column_collection.d.ts +14 -12
- package/dist/render/util/column_collection.d.ts.map +1 -1
- package/dist/render/util/label.d.ts +2 -3
- package/dist/render/util/label.d.ts.map +1 -1
- package/dist/render/util/pcolumn_data.d.ts +24 -25
- package/dist/render/util/pcolumn_data.d.ts.map +1 -1
- package/dist/render/util/split_selectors.d.ts +4 -6
- package/dist/render/util/split_selectors.d.ts.map +1 -1
- package/dist/services/block_services.d.ts +3 -4
- package/dist/services/block_services.d.ts.map +1 -1
- package/dist/services/get_services.d.ts +1 -3
- package/dist/services/get_services.d.ts.map +1 -1
- package/dist/services/service_bridge.d.ts +3 -5
- package/dist/services/service_bridge.d.ts.map +1 -1
- package/dist/services/service_resolve.d.ts +6 -7
- package/dist/services/service_resolve.d.ts.map +1 -1
- package/dist/version.d.ts +3 -4
- package/dist/version.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/bconfig/lambdas.ts +1 -25
- package/src/components/PlDataTable/columnResolver.test.ts +3 -5
- package/src/components/PlDataTable/columnResolver.ts +2 -12
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV2.ts +1 -4
- package/src/components/PlDataTable/createPlDataTable/createPlDataTableV3.ts +5 -4
- package/src/config/index.ts +0 -4
- package/src/config/type_engine.ts +6 -49
- package/src/index.ts +0 -2
- package/src/render/api.ts +0 -32
- package/src/typing.test.ts +4 -143
- package/dist/block_model_legacy.cjs +0 -240
- package/dist/block_model_legacy.cjs.map +0 -1
- package/dist/block_model_legacy.d.ts +0 -115
- package/dist/block_model_legacy.d.ts.map +0 -1
- package/dist/block_model_legacy.js +0 -240
- package/dist/block_model_legacy.js.map +0 -1
- package/dist/config/actions.cjs +0 -232
- package/dist/config/actions.cjs.map +0 -1
- package/dist/config/actions.d.ts +0 -48
- package/dist/config/actions.d.ts.map +0 -1
- package/dist/config/actions.js +0 -201
- package/dist/config/actions.js.map +0 -1
- package/dist/config/actions_kinds.d.ts +0 -116
- package/dist/config/actions_kinds.d.ts.map +0 -1
- package/dist/config/index.cjs +0 -33
- package/dist/config/index.js +0 -2
- package/dist/config/model_meta.d.ts +0 -9
- package/dist/config/model_meta.d.ts.map +0 -1
- package/dist/config/type_util.d.ts +0 -14
- package/dist/config/type_util.d.ts.map +0 -1
- package/dist/ref_util.cjs +0 -21
- package/dist/ref_util.cjs.map +0 -1
- package/dist/ref_util.d.ts +0 -19
- package/dist/ref_util.d.ts.map +0 -1
- package/dist/ref_util.js +0 -20
- package/dist/ref_util.js.map +0 -1
- package/src/block_model_legacy.ts +0 -465
- package/src/config/actions.ts +0 -468
- package/src/config/actions_kinds.ts +0 -264
- package/src/config/model_meta.ts +0 -5
- package/src/config/type_util.ts +0 -25
- package/src/ref_util.ts +0 -17
package/src/bconfig/lambdas.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { PlResourceEntry } from "../config";
|
|
2
2
|
import type { OutputWithStatus } from "@milaboratories/pl-model-common";
|
|
3
|
-
import type { TypedConfigOrConfigLambda } from "./types";
|
|
4
3
|
|
|
5
4
|
export type StdCtxArgsOnly<Args, Data = undefined> = {
|
|
6
5
|
readonly $blockId: string;
|
|
@@ -15,11 +14,6 @@ export type StdCtx<Args, Data = undefined> = StdCtxArgsOnly<Args, Data> & {
|
|
|
15
14
|
readonly $staging: PlResourceEntry;
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
export type ResolveCfgType<Cfg extends TypedConfig, Args, UiState = undefined> = ConfigResult<
|
|
19
|
-
Cfg,
|
|
20
|
-
StdCtx<Args, UiState>
|
|
21
|
-
>;
|
|
22
|
-
|
|
23
17
|
/** Additional information that may alter lambda rendering procedure. */
|
|
24
18
|
export type ConfigRenderLambdaFlags = {
|
|
25
19
|
/**
|
|
@@ -56,24 +50,6 @@ export interface ConfigRenderLambda<Return = unknown> extends ConfigRenderLambda
|
|
|
56
50
|
export type ExtractFunctionHandleReturn<Func extends ConfigRenderLambda> =
|
|
57
51
|
Func extends ConfigRenderLambda<infer Return> ? Return : never;
|
|
58
52
|
|
|
59
|
-
/** Infers the output type from a TypedConfig or ConfigRenderLambda */
|
|
60
|
-
export type InferOutputType<CfgOrFH, Args, UiState> = CfgOrFH extends TypedConfig
|
|
61
|
-
? ResolveCfgType<CfgOrFH, Args, UiState>
|
|
62
|
-
: CfgOrFH extends ConfigRenderLambda
|
|
63
|
-
? ExtractFunctionHandleReturn<CfgOrFH>
|
|
64
|
-
: never;
|
|
65
|
-
|
|
66
|
-
/** Maps outputs configuration to inferred output types with status wrapper */
|
|
67
|
-
export type InferOutputsFromConfigs<
|
|
68
|
-
Args,
|
|
69
|
-
OutputsCfg extends Record<string, TypedConfigOrConfigLambda>,
|
|
70
|
-
UiState,
|
|
71
|
-
> = {
|
|
72
|
-
[Key in keyof OutputsCfg]: OutputWithStatus<InferOutputType<OutputsCfg[Key], Args, UiState>> & {
|
|
73
|
-
__unwrap: OutputsCfg[Key] extends { withStatus: true } ? false : true;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
|
|
77
53
|
/** Maps lambda-only outputs configuration to inferred output types (for V3 blocks) */
|
|
78
54
|
export type InferOutputsFromLambdas<OutputsCfg extends Record<string, ConfigRenderLambda>> = {
|
|
79
55
|
[Key in keyof OutputsCfg]: OutputWithStatus<ExtractFunctionHandleReturn<OutputsCfg[Key]>> & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { afterEach, beforeEach, describe, expect, test
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, test } from "vitest";
|
|
2
2
|
import {
|
|
3
3
|
createLocalPObjectId,
|
|
4
4
|
createColumnOverriddenId,
|
|
@@ -97,7 +97,7 @@ describe("createColumnResolver", () => {
|
|
|
97
97
|
expect(r({ type: "column", id: other })).toBeUndefined();
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
test("collision
|
|
100
|
+
test("collision keeps first", () => {
|
|
101
101
|
const pid = createLocalPObjectId(["main", "out"], "col-1");
|
|
102
102
|
const wrappedA = wrap(pid, "A");
|
|
103
103
|
const wrappedB = wrap(pid, "B");
|
|
@@ -113,9 +113,7 @@ describe("createColumnResolver", () => {
|
|
|
113
113
|
return r;
|
|
114
114
|
};
|
|
115
115
|
|
|
116
|
-
const
|
|
117
|
-
const r = createColumnResolver([makeFake(wrappedA), makeFake(wrappedB)], { warn });
|
|
118
|
-
expect(warn).toHaveBeenCalledTimes(1);
|
|
116
|
+
const r = createColumnResolver([makeFake(wrappedA), makeFake(wrappedB)]);
|
|
119
117
|
const out = r({ type: "column", id: pid });
|
|
120
118
|
expect(out).toEqual({ type: "column", id: wrappedA });
|
|
121
119
|
});
|
|
@@ -20,10 +20,7 @@ import type { ColumnRecipe } from "../../columns";
|
|
|
20
20
|
*/
|
|
21
21
|
export type ColumnResolver = (ref: PTableColumnId) => PTableColumnId | undefined;
|
|
22
22
|
|
|
23
|
-
export function createColumnResolver(
|
|
24
|
-
columns: ColumnRecipe[],
|
|
25
|
-
deps?: { warn?: (msg: string) => void },
|
|
26
|
-
): ColumnResolver {
|
|
23
|
+
export function createColumnResolver(columns: ColumnRecipe[]): ColumnResolver {
|
|
27
24
|
const axisIds: AxisId[] = [];
|
|
28
25
|
for (const c of columns) {
|
|
29
26
|
for (const ax of c.getSpec().axesSpec) {
|
|
@@ -36,14 +33,7 @@ export function createColumnResolver(
|
|
|
36
33
|
for (const c of columns) {
|
|
37
34
|
byFullId.set(c.id, c);
|
|
38
35
|
const pid = extractPObjectId(c.id);
|
|
39
|
-
|
|
40
|
-
if (existing === undefined) {
|
|
41
|
-
byPObjectId.set(pid, c);
|
|
42
|
-
} else if (existing.id !== c.id) {
|
|
43
|
-
deps?.warn?.(
|
|
44
|
-
`Ambiguous PObjectId ${pid}: recipe ids ${existing.id} and ${c.id} both match — keeping first.`,
|
|
45
|
-
);
|
|
46
|
-
}
|
|
36
|
+
if (!byPObjectId.has(pid)) byPObjectId.set(pid, c);
|
|
47
37
|
}
|
|
48
38
|
|
|
49
39
|
return (ref: PTableColumnId): PTableColumnId | undefined => {
|
|
@@ -82,10 +82,7 @@ export function createPlDataTableV2<A, U>(
|
|
|
82
82
|
|
|
83
83
|
const fullColumns = [...columns, ...fullLabelColumns];
|
|
84
84
|
|
|
85
|
-
const resolver = createColumnResolver(
|
|
86
|
-
fullColumns.map((c) => DataColumn.fromColumn(c)),
|
|
87
|
-
{ warn: ctx.logWarn.bind(ctx) },
|
|
88
|
-
);
|
|
85
|
+
const resolver = createColumnResolver(fullColumns.map((c) => DataColumn.fromColumn(c)));
|
|
89
86
|
|
|
90
87
|
// -- Filtering: rewrite via resolver, throw if any reference is unresolved --
|
|
91
88
|
const rawFilters = tableStateNormalized.pTableParams.filters;
|
|
@@ -132,10 +132,11 @@ export function createPlDataTableV3<A, U>(
|
|
|
132
132
|
);
|
|
133
133
|
const orderByColId = evaluateRules(options.displayOptions?.ordering ?? [], allColumnsForRules);
|
|
134
134
|
|
|
135
|
-
const resolver = createColumnResolver(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
135
|
+
const resolver = createColumnResolver([
|
|
136
|
+
...primary,
|
|
137
|
+
...direct,
|
|
138
|
+
...linked.flatMap((lc) => [...collectLinkerColumns(lc), lc]),
|
|
139
|
+
]);
|
|
139
140
|
|
|
140
141
|
const remapedDefaultFilters = remapFilterColumnIds(options.filters, resolver);
|
|
141
142
|
const filters = filterFilters(
|
package/src/config/index.ts
CHANGED
|
@@ -1,54 +1,11 @@
|
|
|
1
|
-
import type { ActGetImmediate } from "./actions_kinds";
|
|
2
1
|
import type { Cfg } from "./model";
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export interface ConfAction {
|
|
11
|
-
readonly ctx: unknown;
|
|
12
|
-
new: GenericFunction;
|
|
13
|
-
isSync: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
/** This type basically sets parameter to a ConfAction kind. */
|
|
17
|
-
export type ActionResult<A extends ConfAction, Ctx> = ReturnType<
|
|
18
|
-
(A & {
|
|
19
|
-
readonly ctx: Ctx;
|
|
20
|
-
})["new"]
|
|
21
|
-
>;
|
|
22
|
-
|
|
23
|
-
// Branding pattern taken from here: https://egghead.io/blog/using-branded-types-in-typescript
|
|
24
|
-
|
|
25
|
-
/** Field key to attach ConfAction information to a config type. */
|
|
26
|
-
declare const __config_action__: unique symbol;
|
|
27
|
-
|
|
28
|
-
/** Creates branded Cfg type */
|
|
29
|
-
export type TypedConfig<Action extends ConfAction = ConfAction> = Cfg & {
|
|
30
|
-
[__config_action__]: Action;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export type PrimitiveOrConfig = TypedConfig | string | number | boolean | null;
|
|
34
|
-
|
|
35
|
-
/** Converts primitive types to immediate config */
|
|
36
|
-
export type PrimitiveToCfg<T extends PrimitiveOrConfig> = T extends string | number | boolean | null
|
|
37
|
-
? TypedConfig<ActGetImmediate<T>>
|
|
38
|
-
: T;
|
|
39
|
-
|
|
40
|
-
/** Extracts action */
|
|
41
|
-
export type ExtractAction<Cfg extends TypedConfig> = Cfg[typeof __config_action__];
|
|
42
|
-
|
|
43
|
-
export type POCExtractAction<T extends PrimitiveOrConfig> = ExtractAction<PrimitiveToCfg<T>>;
|
|
44
|
-
|
|
45
|
-
export type InferVarTypeSafe<Ctx, V> = V extends string
|
|
46
|
-
? Ctx extends { [key in V]: infer T }
|
|
47
|
-
? T
|
|
48
|
-
: undefined
|
|
49
|
-
: unknown;
|
|
50
|
-
|
|
51
|
-
export type ConfigResult<Cfg extends TypedConfig, Ctx> = ActionResult<ExtractAction<Cfg>, Ctx>;
|
|
3
|
+
/** Config tree of an already published block, as stored in its compiled model.
|
|
4
|
+
*
|
|
5
|
+
* Nothing in the SDK builds these any more — the builder DSL that produced them
|
|
6
|
+
* went away with the v1/v2 block model. The type is kept because the middle
|
|
7
|
+
* layer still has to read and render configs of blocks published before that. */
|
|
8
|
+
export type TypedConfig = Cfg;
|
|
52
9
|
|
|
53
10
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
54
11
|
declare const plResourceEntry: unique symbol;
|
package/src/index.ts
CHANGED
|
@@ -22,7 +22,6 @@ export {
|
|
|
22
22
|
getPluginData,
|
|
23
23
|
} from "./block_storage";
|
|
24
24
|
export * from "./block_storage_facade";
|
|
25
|
-
export * from "./block_model_legacy";
|
|
26
25
|
export { BlockModelV3 } from "./block_model";
|
|
27
26
|
export type { PluginRecord, ParamsInput } from "./block_model";
|
|
28
27
|
export { DataModel, DataModelBuilder } from "./block_migrations";
|
|
@@ -47,7 +46,6 @@ export * from "./pframe";
|
|
|
47
46
|
export * from "./labels";
|
|
48
47
|
export * from "./columns";
|
|
49
48
|
export * from "./platforma";
|
|
50
|
-
export * from "./ref_util";
|
|
51
49
|
export * from "./render";
|
|
52
50
|
export * from "./version";
|
|
53
51
|
export * from "./raw_globals";
|
package/src/render/api.ts
CHANGED
|
@@ -728,34 +728,6 @@ export class BlockRenderCtx<Args = unknown, Data = unknown> extends RenderCtxBas
|
|
|
728
728
|
}
|
|
729
729
|
}
|
|
730
730
|
|
|
731
|
-
/** Render context for legacy v1/v2 blocks - provides backward compatibility */
|
|
732
|
-
export class RenderCtxLegacy<Args = unknown, UiState = unknown> extends RenderCtxBase<
|
|
733
|
-
Args,
|
|
734
|
-
UiState
|
|
735
|
-
> {
|
|
736
|
-
private argsCache?: { v: Args };
|
|
737
|
-
|
|
738
|
-
public get args(): Args {
|
|
739
|
-
if (this.argsCache === undefined) {
|
|
740
|
-
const raw = this.ctx.args;
|
|
741
|
-
const value = typeof raw === "function" ? raw() : raw;
|
|
742
|
-
this.argsCache = { v: JSON.parse(value) };
|
|
743
|
-
}
|
|
744
|
-
return this.argsCache.v;
|
|
745
|
-
}
|
|
746
|
-
|
|
747
|
-
private uiStateCache?: { v: UiState };
|
|
748
|
-
|
|
749
|
-
public get uiState(): UiState {
|
|
750
|
-
if (this.uiStateCache === undefined) {
|
|
751
|
-
const raw = this.ctx.uiState!;
|
|
752
|
-
const value = typeof raw === "function" ? raw() : raw;
|
|
753
|
-
this.uiStateCache = { v: value ? JSON.parse(value) : ({} as UiState) };
|
|
754
|
-
}
|
|
755
|
-
return this.uiStateCache.v;
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
|
|
759
731
|
/**
|
|
760
732
|
* Render context for plugin output functions.
|
|
761
733
|
* Reads plugin data from blockStorage and derives params from pre-wrapped input callbacks.
|
|
@@ -811,10 +783,6 @@ export type RenderFunction<Args = unknown, State = unknown, Ret = unknown> = (
|
|
|
811
783
|
rCtx: BlockRenderCtx<Args, State>,
|
|
812
784
|
) => Ret;
|
|
813
785
|
|
|
814
|
-
export type RenderFunctionLegacy<Args = unknown, State = unknown, Ret = unknown> = (
|
|
815
|
-
rCtx: RenderCtxLegacy<Args, State>,
|
|
816
|
-
) => Ret;
|
|
817
|
-
|
|
818
786
|
export type UnwrapFutureRef<K> =
|
|
819
787
|
K extends FutureRef<infer T>
|
|
820
788
|
? T
|
package/src/typing.test.ts
CHANGED
|
@@ -1,34 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
OutputWithStatus,
|
|
5
|
-
RemoteBlobHandleAndSize,
|
|
6
|
-
} from "@milaboratories/pl-model-common";
|
|
7
|
-
import { expect, test } from "vitest";
|
|
8
|
-
import { DeriveHref, StdCtx } from "./bconfig";
|
|
9
|
-
import { BlockModel } from "./block_model_legacy";
|
|
10
|
-
import {
|
|
11
|
-
Args,
|
|
12
|
-
ConfigResult,
|
|
13
|
-
flatten,
|
|
14
|
-
getBlobContent,
|
|
15
|
-
getBlobContentAsJson,
|
|
16
|
-
getBlobContentAsString,
|
|
17
|
-
getDownloadedBlobContent,
|
|
18
|
-
getImmediate,
|
|
19
|
-
getJsonField,
|
|
20
|
-
getOnDemandBlobContent,
|
|
21
|
-
getResourceField,
|
|
22
|
-
getResourceValueAsJson,
|
|
23
|
-
isEmpty,
|
|
24
|
-
It,
|
|
25
|
-
MainOutputs,
|
|
26
|
-
makeArray,
|
|
27
|
-
makeObject,
|
|
28
|
-
mapArrayValues,
|
|
29
|
-
mapRecordValues,
|
|
30
|
-
} from "./config";
|
|
31
|
-
import { InferHrefType, InferOutputsType } from "./platforma";
|
|
1
|
+
import { BlockSection } from "@milaboratories/pl-model-common";
|
|
2
|
+
import { test } from "vitest";
|
|
3
|
+
import { DeriveHref } from "./bconfig";
|
|
32
4
|
|
|
33
5
|
type AssertEqual<T, Expected> = [T] extends [Expected]
|
|
34
6
|
? [Expected] extends [T]
|
|
@@ -50,43 +22,11 @@ export const assertTypeExtends = <T, Expected>(
|
|
|
50
22
|
// noop
|
|
51
23
|
};
|
|
52
24
|
|
|
53
|
-
function _typeTest1() {
|
|
54
|
-
const a = getJsonField(Args, "field1");
|
|
55
|
-
const dd = getResourceValueAsJson<{ s: boolean; g: number }>()(
|
|
56
|
-
getResourceField(MainOutputs, "a"),
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const cfg1 = makeObject({
|
|
60
|
-
a,
|
|
61
|
-
b: "attagaca",
|
|
62
|
-
c: mapRecordValues(getJsonField(Args, "field2"), getJsonField(It, "b")),
|
|
63
|
-
d: getJsonField(dd, "s"),
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
type Ret = ConfigResult<
|
|
67
|
-
typeof cfg1,
|
|
68
|
-
StdCtx<{
|
|
69
|
-
field1: number;
|
|
70
|
-
field2: Record<string, { b: "yap" }>;
|
|
71
|
-
}>
|
|
72
|
-
>;
|
|
73
|
-
|
|
74
|
-
assertType<
|
|
75
|
-
Ret,
|
|
76
|
-
{
|
|
77
|
-
a: number;
|
|
78
|
-
b: "attagaca";
|
|
79
|
-
c: Record<string, "yap">;
|
|
80
|
-
d: boolean;
|
|
81
|
-
}
|
|
82
|
-
>();
|
|
83
|
-
}
|
|
84
|
-
|
|
85
25
|
function testCreateSections<const S extends BlockSection[]>(_sections: () => S): DeriveHref<S> {
|
|
86
26
|
return undefined as any;
|
|
87
27
|
}
|
|
88
28
|
|
|
89
|
-
test("
|
|
29
|
+
test("href derivation from sections", () => {
|
|
90
30
|
const s1 = testCreateSections(() => [
|
|
91
31
|
{ type: "delimiter" },
|
|
92
32
|
{ type: "link", href: "/a1", label: "l" },
|
|
@@ -99,82 +39,3 @@ test("test config content", () => {
|
|
|
99
39
|
|
|
100
40
|
assertType<typeof s2, never>();
|
|
101
41
|
});
|
|
102
|
-
|
|
103
|
-
test("test config content", () => {
|
|
104
|
-
const platforma = BlockModel.create("Heavy")
|
|
105
|
-
.withArgs<{ a: string[] }>({ a: [] })
|
|
106
|
-
.argsValid(isEmpty(getJsonField(Args, "a")))
|
|
107
|
-
.output("cell1", makeObject({ b: getJsonField(Args, "a") }))
|
|
108
|
-
.output("cell2", mapArrayValues(getJsonField(Args, "a"), getImmediate("v1")))
|
|
109
|
-
.sections(() => {
|
|
110
|
-
return [
|
|
111
|
-
{ type: "link", href: "/", label: "Main" },
|
|
112
|
-
{ type: "link", href: "/subsection", label: "Subsection" },
|
|
113
|
-
];
|
|
114
|
-
})
|
|
115
|
-
.done();
|
|
116
|
-
|
|
117
|
-
assertType<
|
|
118
|
-
InferOutputsType<typeof platforma>,
|
|
119
|
-
{
|
|
120
|
-
cell1: OutputWithStatus<{ b: string[] }>;
|
|
121
|
-
cell2: OutputWithStatus<"v1"[]>;
|
|
122
|
-
}
|
|
123
|
-
>();
|
|
124
|
-
|
|
125
|
-
assertType<InferHrefType<typeof platforma>, "/" | "/subsection">();
|
|
126
|
-
|
|
127
|
-
expect(JSON.stringify((platforma as any).config).length).toBeGreaterThan(20);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
test("test config 2", () => {
|
|
131
|
-
const platforma = BlockModel.create<{ a: string[] }>("Heavy")
|
|
132
|
-
.initialArgs({ a: [] })
|
|
133
|
-
.output(
|
|
134
|
-
"cell1",
|
|
135
|
-
makeObject({
|
|
136
|
-
b: getBlobContentAsString(getResourceField(MainOutputs, "field1")),
|
|
137
|
-
c: makeArray(getBlobContent(getResourceField(MainOutputs, "field2")), "asd"),
|
|
138
|
-
d: getBlobContentAsJson<string[]>()(getResourceField(MainOutputs, "field3")),
|
|
139
|
-
e: flatten(
|
|
140
|
-
makeArray(
|
|
141
|
-
getBlobContentAsJson<string[]>()(getResourceField(MainOutputs, "field3")),
|
|
142
|
-
getImmediate(["asd", "d"] as string[]),
|
|
143
|
-
),
|
|
144
|
-
),
|
|
145
|
-
f: getDownloadedBlobContent(getResourceField(MainOutputs, "field4")),
|
|
146
|
-
g: getOnDemandBlobContent(getResourceField(MainOutputs, "field5")),
|
|
147
|
-
}),
|
|
148
|
-
)
|
|
149
|
-
.output("cell2", () => 42)
|
|
150
|
-
.output("cell3", () => undefined)
|
|
151
|
-
.withArgs(isEmpty(getJsonField(Args, "a")))
|
|
152
|
-
.sections(
|
|
153
|
-
() =>
|
|
154
|
-
[
|
|
155
|
-
{ type: "link", href: "/", label: "Main" },
|
|
156
|
-
{ type: "link", href: "/subsection", label: "Subsection" },
|
|
157
|
-
] satisfies BlockSection[],
|
|
158
|
-
)
|
|
159
|
-
.done();
|
|
160
|
-
|
|
161
|
-
assertType<
|
|
162
|
-
InferOutputsType<typeof platforma>,
|
|
163
|
-
{
|
|
164
|
-
cell1: OutputWithStatus<{
|
|
165
|
-
b: string;
|
|
166
|
-
c: [Uint8Array, "asd"];
|
|
167
|
-
d: string[];
|
|
168
|
-
e: string[];
|
|
169
|
-
f: LocalBlobHandleAndSize;
|
|
170
|
-
g: RemoteBlobHandleAndSize;
|
|
171
|
-
}>;
|
|
172
|
-
cell2: OutputWithStatus<number>;
|
|
173
|
-
cell3: OutputWithStatus<undefined>;
|
|
174
|
-
}
|
|
175
|
-
>();
|
|
176
|
-
|
|
177
|
-
assertType<InferHrefType<typeof platforma>, "/" | "/subsection">();
|
|
178
|
-
|
|
179
|
-
expect(JSON.stringify((platforma as any).config).length).toBeGreaterThan(20);
|
|
180
|
-
});
|
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
const require_internal = require("./internal.cjs");
|
|
2
|
-
const require_actions = require("./config/actions.cjs");
|
|
3
|
-
require("./config/index.cjs");
|
|
4
|
-
const require_api = require("./render/api.cjs");
|
|
5
|
-
require("./render/index.cjs");
|
|
6
|
-
const require_version = require("./version.cjs");
|
|
7
|
-
const require_types = require("./bconfig/types.cjs");
|
|
8
|
-
const require_normalization = require("./bconfig/normalization.cjs");
|
|
9
|
-
require("./bconfig/index.cjs");
|
|
10
|
-
let _milaboratories_pl_model_common = require("@milaboratories/pl-model-common");
|
|
11
|
-
//#region src/block_model_legacy.ts
|
|
12
|
-
/** Main entry point that each block should use in it's "config" module. Don't forget
|
|
13
|
-
* to call {@link done()} at the end of configuration. Value returned by this builder must be
|
|
14
|
-
* exported as constant with name "platforma" from the "config" module. */
|
|
15
|
-
var BlockModel = class BlockModel {
|
|
16
|
-
config;
|
|
17
|
-
constructor(config) {
|
|
18
|
-
this.config = config;
|
|
19
|
-
}
|
|
20
|
-
static get INITIAL_BLOCK_FEATURE_FLAGS() {
|
|
21
|
-
return {
|
|
22
|
-
supportsLazyState: true,
|
|
23
|
-
supportsPframeQueryRanking: true,
|
|
24
|
-
requiresUIAPIVersion: 1,
|
|
25
|
-
requiresModelAPIVersion: 1,
|
|
26
|
-
requiresCreatePTable: 2,
|
|
27
|
-
requiresPFramesVersion: _milaboratories_pl_model_common.REQUIRES_PFRAMES_VERSION
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
static create(renderingMode = "Heavy") {
|
|
31
|
-
return new BlockModel({
|
|
32
|
-
renderingMode,
|
|
33
|
-
initialUiState: {},
|
|
34
|
-
outputs: {},
|
|
35
|
-
inputsValid: require_actions.getImmediate(true),
|
|
36
|
-
sections: require_actions.getImmediate([]),
|
|
37
|
-
featureFlags: BlockModel.INITIAL_BLOCK_FEATURE_FLAGS
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
output(key, cfgOrRf, flags = {}) {
|
|
41
|
-
if (typeof cfgOrRf === "function") {
|
|
42
|
-
const handle = `output#${key}`;
|
|
43
|
-
require_internal.tryRegisterCallback(handle, () => cfgOrRf(new require_api.RenderCtxLegacy()));
|
|
44
|
-
return new BlockModel({
|
|
45
|
-
...this.config,
|
|
46
|
-
outputs: {
|
|
47
|
-
...this.config.outputs,
|
|
48
|
-
[key]: {
|
|
49
|
-
__renderLambda: true,
|
|
50
|
-
handle,
|
|
51
|
-
...flags
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
} else return new BlockModel({
|
|
56
|
-
...this.config,
|
|
57
|
-
outputs: {
|
|
58
|
-
...this.config.outputs,
|
|
59
|
-
[key]: cfgOrRf
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
/** Shortcut for {@link output} with retentive flag set to true. */
|
|
64
|
-
retentiveOutput(key, rf) {
|
|
65
|
-
return this.output(key, rf, { retentive: true });
|
|
66
|
-
}
|
|
67
|
-
/** Shortcut for {@link output} with withStatus flag set to true. */
|
|
68
|
-
outputWithStatus(key, rf) {
|
|
69
|
-
return this.output(key, rf, { withStatus: true });
|
|
70
|
-
}
|
|
71
|
-
/** Shortcut for {@link output} with retentive and withStatus flags set to true. */
|
|
72
|
-
retentiveOutputWithStatus(key, rf) {
|
|
73
|
-
return this.output(key, rf, {
|
|
74
|
-
retentive: true,
|
|
75
|
-
withStatus: true
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
argsValid(cfgOrRf) {
|
|
79
|
-
if (typeof cfgOrRf === "function") {
|
|
80
|
-
require_internal.tryRegisterCallback("inputsValid", () => cfgOrRf(new require_api.RenderCtxLegacy()));
|
|
81
|
-
return new BlockModel({
|
|
82
|
-
...this.config,
|
|
83
|
-
inputsValid: {
|
|
84
|
-
__renderLambda: true,
|
|
85
|
-
handle: "inputsValid"
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
} else return new BlockModel({
|
|
89
|
-
...this.config,
|
|
90
|
-
inputsValid: cfgOrRf
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
sections(arrOrCfgOrRf) {
|
|
94
|
-
if (Array.isArray(arrOrCfgOrRf)) return this.sections(require_actions.getImmediate(arrOrCfgOrRf));
|
|
95
|
-
else if (typeof arrOrCfgOrRf === "function") {
|
|
96
|
-
require_internal.tryRegisterCallback("sections", () => arrOrCfgOrRf(new require_api.RenderCtxLegacy()));
|
|
97
|
-
return new BlockModel({
|
|
98
|
-
...this.config,
|
|
99
|
-
sections: {
|
|
100
|
-
__renderLambda: true,
|
|
101
|
-
handle: "sections"
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
} else return new BlockModel({
|
|
105
|
-
...this.config,
|
|
106
|
-
sections: arrOrCfgOrRf
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
/** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
|
|
110
|
-
title(rf) {
|
|
111
|
-
require_internal.tryRegisterCallback("title", () => rf(new require_api.RenderCtxLegacy()));
|
|
112
|
-
return new BlockModel({
|
|
113
|
-
...this.config,
|
|
114
|
-
title: {
|
|
115
|
-
__renderLambda: true,
|
|
116
|
-
handle: "title"
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
subtitle(rf) {
|
|
121
|
-
require_internal.tryRegisterCallback("subtitle", () => rf(new require_api.RenderCtxLegacy()));
|
|
122
|
-
return new BlockModel({
|
|
123
|
-
...this.config,
|
|
124
|
-
subtitle: {
|
|
125
|
-
__renderLambda: true,
|
|
126
|
-
handle: "subtitle"
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
tags(rf) {
|
|
131
|
-
require_internal.tryRegisterCallback("tags", () => rf(new require_api.RenderCtxLegacy()));
|
|
132
|
-
return new BlockModel({
|
|
133
|
-
...this.config,
|
|
134
|
-
tags: {
|
|
135
|
-
__renderLambda: true,
|
|
136
|
-
handle: "tags"
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Sets initial args for the block, this value must be specified.
|
|
142
|
-
* @deprecated use {@link withArgs}
|
|
143
|
-
* */
|
|
144
|
-
initialArgs(value) {
|
|
145
|
-
return this.withArgs(value);
|
|
146
|
-
}
|
|
147
|
-
/** Sets initial args for the block, this value must be specified. */
|
|
148
|
-
withArgs(initialArgs) {
|
|
149
|
-
return new BlockModel({
|
|
150
|
-
...this.config,
|
|
151
|
-
initialArgs
|
|
152
|
-
});
|
|
153
|
-
}
|
|
154
|
-
/** Defines type and sets initial value for block UiState. */
|
|
155
|
-
withUiState(initialUiState) {
|
|
156
|
-
return new BlockModel({
|
|
157
|
-
...this.config,
|
|
158
|
-
initialUiState
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
/** Sets or overrides feature flags for the block. */
|
|
162
|
-
withFeatureFlags(flags) {
|
|
163
|
-
return new BlockModel({
|
|
164
|
-
...this.config,
|
|
165
|
-
featureFlags: {
|
|
166
|
-
...this.config.featureFlags,
|
|
167
|
-
...flags
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.
|
|
173
|
-
* Influences dependency graph construction.
|
|
174
|
-
*/
|
|
175
|
-
enriches(lambda) {
|
|
176
|
-
require_internal.tryRegisterCallback("enrichmentTargets", lambda);
|
|
177
|
-
return new BlockModel({
|
|
178
|
-
...this.config,
|
|
179
|
-
enrichmentTargets: {
|
|
180
|
-
__renderLambda: true,
|
|
181
|
-
handle: "enrichmentTargets"
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
/** Renders all provided block settings into a pre-configured platforma API
|
|
186
|
-
* instance, that can be used in frontend to interact with block state, and
|
|
187
|
-
* other features provided by the platforma to the block. */
|
|
188
|
-
done(apiVersion = 1) {
|
|
189
|
-
return this.withFeatureFlags({
|
|
190
|
-
...this.config.featureFlags,
|
|
191
|
-
requiresUIAPIVersion: apiVersion
|
|
192
|
-
}).#done();
|
|
193
|
-
}
|
|
194
|
-
#done() {
|
|
195
|
-
if (this.config.initialArgs === void 0) throw new Error("Initial arguments not set.");
|
|
196
|
-
const config = {
|
|
197
|
-
v4: void 0,
|
|
198
|
-
v3: {
|
|
199
|
-
configVersion: 3,
|
|
200
|
-
modelAPIVersion: 1,
|
|
201
|
-
sdkVersion: require_version.PlatformaSDKVersion,
|
|
202
|
-
renderingMode: this.config.renderingMode,
|
|
203
|
-
initialArgs: this.config.initialArgs,
|
|
204
|
-
initialUiState: this.config.initialUiState,
|
|
205
|
-
inputsValid: this.config.inputsValid,
|
|
206
|
-
sections: this.config.sections,
|
|
207
|
-
title: this.config.title,
|
|
208
|
-
subtitle: this.config.subtitle,
|
|
209
|
-
tags: this.config.tags,
|
|
210
|
-
outputs: this.config.outputs,
|
|
211
|
-
enrichmentTargets: this.config.enrichmentTargets,
|
|
212
|
-
featureFlags: this.config.featureFlags
|
|
213
|
-
},
|
|
214
|
-
sdkVersion: require_version.PlatformaSDKVersion,
|
|
215
|
-
renderingMode: this.config.renderingMode,
|
|
216
|
-
initialArgs: this.config.initialArgs,
|
|
217
|
-
inputsValid: require_normalization.downgradeCfgOrLambda(this.config.inputsValid),
|
|
218
|
-
sections: require_normalization.downgradeCfgOrLambda(this.config.sections),
|
|
219
|
-
outputs: Object.fromEntries(Object.entries(this.config.outputs).map(([key, value]) => [key, require_normalization.downgradeCfgOrLambda(value)]))
|
|
220
|
-
};
|
|
221
|
-
globalThis.platformaApiVersion = this.config.featureFlags.requiresUIAPIVersion;
|
|
222
|
-
if (!require_internal.isInUI()) return { config };
|
|
223
|
-
else return {
|
|
224
|
-
...require_internal.getPlatformaInstance({
|
|
225
|
-
sdkVersion: require_version.PlatformaSDKVersion,
|
|
226
|
-
apiVersion: platformaApiVersion
|
|
227
|
-
}),
|
|
228
|
-
blockModelInfo: {
|
|
229
|
-
outputs: Object.fromEntries(Object.entries(this.config.outputs).map(([key, value]) => [key, { withStatus: Boolean(require_types.isConfigLambda(value) && value.withStatus) }])),
|
|
230
|
-
pluginIds: [],
|
|
231
|
-
featureFlags: this.config.featureFlags,
|
|
232
|
-
pluginPublicOutputs: {}
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
//#endregion
|
|
238
|
-
exports.BlockModel = BlockModel;
|
|
239
|
-
|
|
240
|
-
//# sourceMappingURL=block_model_legacy.cjs.map
|