@platforma-sdk/model 1.54.13 → 1.56.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bconfig/normalization.cjs +8 -1
- package/dist/bconfig/normalization.cjs.map +1 -1
- package/dist/bconfig/normalization.d.ts.map +1 -1
- package/dist/bconfig/normalization.js +8 -1
- package/dist/bconfig/normalization.js.map +1 -1
- package/dist/block_api_v3.d.ts +2 -2
- package/dist/block_api_v3.d.ts.map +1 -1
- package/dist/block_migrations.cjs +246 -214
- package/dist/block_migrations.cjs.map +1 -1
- package/dist/block_migrations.d.ts +180 -158
- package/dist/block_migrations.d.ts.map +1 -1
- package/dist/block_migrations.js +247 -214
- package/dist/block_migrations.js.map +1 -1
- package/dist/block_model.cjs +85 -35
- package/dist/block_model.cjs.map +1 -1
- package/dist/block_model.d.ts +66 -38
- package/dist/block_model.d.ts.map +1 -1
- package/dist/block_model.js +86 -36
- package/dist/block_model.js.map +1 -1
- package/dist/{builder.cjs → block_model_legacy.cjs} +2 -2
- package/dist/block_model_legacy.cjs.map +1 -0
- package/dist/{builder.d.ts → block_model_legacy.d.ts} +1 -1
- package/dist/block_model_legacy.d.ts.map +1 -0
- package/dist/{builder.js → block_model_legacy.js} +2 -2
- package/dist/block_model_legacy.js.map +1 -0
- package/dist/block_state_patch.d.ts +11 -1
- package/dist/block_state_patch.d.ts.map +1 -1
- package/dist/block_storage.cjs +126 -109
- package/dist/block_storage.cjs.map +1 -1
- package/dist/block_storage.d.ts +109 -112
- package/dist/block_storage.d.ts.map +1 -1
- package/dist/block_storage.js +126 -101
- package/dist/block_storage.js.map +1 -1
- package/dist/block_storage_callbacks.cjs +227 -0
- package/dist/block_storage_callbacks.cjs.map +1 -0
- package/dist/block_storage_callbacks.d.ts +113 -0
- package/dist/block_storage_callbacks.d.ts.map +1 -0
- package/dist/block_storage_callbacks.js +218 -0
- package/dist/block_storage_callbacks.js.map +1 -0
- package/dist/block_storage_facade.cjs +104 -0
- package/dist/block_storage_facade.cjs.map +1 -0
- package/dist/block_storage_facade.d.ts +168 -0
- package/dist/block_storage_facade.d.ts.map +1 -0
- package/dist/block_storage_facade.js +99 -0
- package/dist/block_storage_facade.js.map +1 -0
- package/dist/index.cjs +13 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/package.json.cjs +1 -1
- package/dist/package.json.js +1 -1
- package/dist/platforma.d.ts +11 -4
- package/dist/platforma.d.ts.map +1 -1
- package/dist/plugin_model.cjs +171 -0
- package/dist/plugin_model.cjs.map +1 -0
- package/dist/plugin_model.d.ts +162 -0
- package/dist/plugin_model.d.ts.map +1 -0
- package/dist/plugin_model.js +169 -0
- package/dist/plugin_model.js.map +1 -0
- package/dist/render/api.cjs +20 -21
- package/dist/render/api.cjs.map +1 -1
- package/dist/render/api.d.ts +8 -8
- package/dist/render/api.d.ts.map +1 -1
- package/dist/render/api.js +20 -21
- package/dist/render/api.js.map +1 -1
- package/dist/render/internal.cjs.map +1 -1
- package/dist/render/internal.d.ts +2 -1
- package/dist/render/internal.d.ts.map +1 -1
- package/dist/render/internal.js.map +1 -1
- package/dist/version.cjs +4 -0
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.ts +4 -0
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +4 -1
- package/dist/version.js.map +1 -1
- package/package.json +5 -5
- package/src/bconfig/normalization.ts +8 -1
- package/src/block_api_v3.ts +2 -2
- package/src/block_migrations.test.ts +141 -171
- package/src/block_migrations.ts +300 -285
- package/src/block_model.ts +205 -95
- package/src/{builder.ts → block_model_legacy.ts} +1 -1
- package/src/block_state_patch.ts +13 -1
- package/src/block_storage.test.ts +283 -95
- package/src/block_storage.ts +199 -188
- package/src/block_storage_callbacks.ts +326 -0
- package/src/block_storage_facade.ts +199 -0
- package/src/index.ts +7 -3
- package/src/platforma.ts +26 -7
- package/src/plugin_model.test.ts +168 -0
- package/src/plugin_model.ts +242 -0
- package/src/render/api.ts +26 -24
- package/src/render/internal.ts +3 -1
- package/src/typing.test.ts +1 -1
- package/src/version.ts +8 -0
- package/dist/block_storage_vm.cjs +0 -262
- package/dist/block_storage_vm.cjs.map +0 -1
- package/dist/block_storage_vm.d.ts +0 -59
- package/dist/block_storage_vm.d.ts.map +0 -1
- package/dist/block_storage_vm.js +0 -258
- package/dist/block_storage_vm.js.map +0 -1
- package/dist/branding.d.ts +0 -7
- package/dist/branding.d.ts.map +0 -1
- package/dist/builder.cjs.map +0 -1
- package/dist/builder.d.ts.map +0 -1
- package/dist/builder.js.map +0 -1
- package/dist/sdk_info.cjs +0 -10
- package/dist/sdk_info.cjs.map +0 -1
- package/dist/sdk_info.d.ts +0 -5
- package/dist/sdk_info.d.ts.map +0 -1
- package/dist/sdk_info.js +0 -8
- package/dist/sdk_info.js.map +0 -1
- package/dist/unionize.d.ts +0 -12
- package/dist/unionize.d.ts.map +0 -1
- package/src/block_storage_vm.ts +0 -346
- package/src/branding.ts +0 -4
- package/src/sdk_info.ts +0 -9
- package/src/unionize.ts +0 -12
package/dist/block_model.d.ts
CHANGED
|
@@ -1,47 +1,56 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BlockSection, PlRef, BlockCodeKnownFeatureFlags } from "@milaboratories/pl-model-common";
|
|
2
2
|
import type { DataModel } from "./block_migrations";
|
|
3
3
|
import type { PlatformaV3 } from "./platforma";
|
|
4
4
|
import type { InferRenderFunctionReturn, RenderFunction } from "./render";
|
|
5
|
-
import "./
|
|
5
|
+
import type { PluginModel } from "./plugin_model";
|
|
6
|
+
import type { RenderCtxBase } from "./render";
|
|
6
7
|
import type { ConfigRenderLambda, DeriveHref, ConfigRenderLambdaFlags, InferOutputsFromLambdas } from "./bconfig";
|
|
7
8
|
import type { PlatformaExtended } from "./platforma";
|
|
8
9
|
type SectionsExpectedType = readonly BlockSection[];
|
|
9
10
|
type NoOb = Record<string, never>;
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
11
|
+
/**
|
|
12
|
+
* Per-property lambdas for deriving plugin params from block render context.
|
|
13
|
+
* Each property is a function that receives the block's RenderCtxBase and returns the param value.
|
|
14
|
+
*/
|
|
15
|
+
export type ParamsInput<Params, BArgs = unknown, BData = unknown> = {
|
|
16
|
+
[K in keyof Params]: (ctx: RenderCtxBase<BArgs, BData>) => Params[K];
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Type-erased version of ParamsInput for internal storage.
|
|
20
|
+
*/
|
|
21
|
+
type ParamsInputErased = Record<string, (ctx: RenderCtxBase) => unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Registered plugin: model + param derivation lambdas.
|
|
24
|
+
* Type parameters are carried by PluginModel generic.
|
|
25
|
+
*/
|
|
26
|
+
export type PluginInstance<Data = unknown, Params = unknown, Outputs = unknown> = {
|
|
27
|
+
readonly model: PluginModel<Data, Params, Outputs>;
|
|
28
|
+
readonly inputs: ParamsInputErased;
|
|
29
|
+
};
|
|
17
30
|
/** Main entry point that each block should use in it's "config" module. Don't forget
|
|
18
31
|
* to call {@link done()} at the end of configuration. Value returned by this builder must be
|
|
19
32
|
* exported as constant with name "platforma" from the "config" module.
|
|
20
33
|
* API version is 3 (for UI) and 2 (for model) */
|
|
21
|
-
export declare class BlockModelV3<Args, OutputsCfg extends Record<string, ConfigRenderLambda>, Data extends Record<string, unknown> = Record<string, unknown>, Href extends `/${string}` = "/"> {
|
|
34
|
+
export declare class BlockModelV3<Args, OutputsCfg extends Record<string, ConfigRenderLambda>, Data extends Record<string, unknown> = Record<string, unknown>, Href extends `/${string}` = "/", Plugins extends Record<string, PluginInstance> = {}> {
|
|
22
35
|
private readonly config;
|
|
23
36
|
private constructor();
|
|
24
37
|
static readonly INITIAL_BLOCK_FEATURE_FLAGS: BlockCodeKnownFeatureFlags;
|
|
25
38
|
/**
|
|
26
|
-
* Creates a new BlockModelV3 builder with the specified data model
|
|
39
|
+
* Creates a new BlockModelV3 builder with the specified data model.
|
|
27
40
|
*
|
|
28
41
|
* @example
|
|
29
|
-
* const
|
|
30
|
-
*
|
|
31
|
-
* type VersionedData = { [Version.V1]: BlockData };
|
|
32
|
-
*
|
|
33
|
-
* const dataModel = new DataModelBuilder<VersionedData>()
|
|
34
|
-
* .from(Version.V1)
|
|
42
|
+
* const dataModel = new DataModelBuilder()
|
|
43
|
+
* .from<BlockData>(DATA_MODEL_DEFAULT_VERSION)
|
|
35
44
|
* .init(() => ({ numbers: [], labels: [] }));
|
|
36
45
|
*
|
|
37
|
-
* BlockModelV3.create(
|
|
46
|
+
* BlockModelV3.create(dataModel)
|
|
38
47
|
* .args((data) => ({ numbers: data.numbers }))
|
|
39
48
|
* .sections(() => [{ type: 'link', href: '/', label: 'Main' }])
|
|
40
49
|
* .done();
|
|
41
50
|
*
|
|
42
|
-
* @param
|
|
51
|
+
* @param dataModel The data model that defines initial data and migrations
|
|
43
52
|
*/
|
|
44
|
-
static create<Data extends Record<string, unknown>>(
|
|
53
|
+
static create<Data extends Record<string, unknown>>(dataModel: DataModel<Data>): BlockModelV3<NoOb, {}, Data>;
|
|
45
54
|
/**
|
|
46
55
|
* Add output cell wrapped with additional status information to the configuration
|
|
47
56
|
*
|
|
@@ -50,13 +59,13 @@ export declare class BlockModelV3<Args, OutputsCfg extends Record<string, Config
|
|
|
50
59
|
* workflows outputs and interact with platforma drivers
|
|
51
60
|
* @param flags additional flags that may alter lambda rendering procedure
|
|
52
61
|
* */
|
|
53
|
-
output<const Key extends string, const RF extends RenderFunction<Args, Data>>(key: Key, rf: RF, flags: ConfigRenderLambdaFlags & {
|
|
62
|
+
output<const Key extends string, const RF extends RenderFunction<Args, Data, unknown>>(key: Key, rf: RF, flags: ConfigRenderLambdaFlags & {
|
|
54
63
|
withStatus: true;
|
|
55
64
|
}): BlockModelV3<Args, OutputsCfg & {
|
|
56
65
|
[K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & {
|
|
57
66
|
withStatus: true;
|
|
58
67
|
};
|
|
59
|
-
}, Data, Href>;
|
|
68
|
+
}, Data, Href, Plugins>;
|
|
60
69
|
/**
|
|
61
70
|
* Add output cell to the configuration
|
|
62
71
|
*
|
|
@@ -65,17 +74,17 @@ export declare class BlockModelV3<Args, OutputsCfg extends Record<string, Config
|
|
|
65
74
|
* workflows outputs and interact with platforma drivers
|
|
66
75
|
* @param flags additional flags that may alter lambda rendering procedure
|
|
67
76
|
* */
|
|
68
|
-
output<const Key extends string, const RF extends RenderFunction<Args, Data>>(key: Key, rf: RF, flags?: ConfigRenderLambdaFlags): BlockModelV3<Args, OutputsCfg & {
|
|
77
|
+
output<const Key extends string, const RF extends RenderFunction<Args, Data, unknown>>(key: Key, rf: RF, flags?: ConfigRenderLambdaFlags): BlockModelV3<Args, OutputsCfg & {
|
|
69
78
|
[K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>>;
|
|
70
|
-
}, Data, Href>;
|
|
79
|
+
}, Data, Href, Plugins>;
|
|
71
80
|
/** Shortcut for {@link output} with retentive flag set to true. */
|
|
72
|
-
retentiveOutput<const Key extends string, const RF extends RenderFunction<Args, Data>>(key: Key, rf: RF): BlockModelV3<Args, OutputsCfg & {
|
|
81
|
+
retentiveOutput<const Key extends string, const RF extends RenderFunction<Args, Data, unknown>>(key: Key, rf: RF): BlockModelV3<Args, OutputsCfg & {
|
|
73
82
|
[K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>>;
|
|
74
|
-
}, Data, Href>;
|
|
83
|
+
}, Data, Href, Plugins>;
|
|
75
84
|
/** Shortcut for {@link output} with withStatus flag set to true. */
|
|
76
|
-
outputWithStatus<const Key extends string, const RF extends RenderFunction<Args, Data>>(key: Key, rf: RF): BlockModelV3<Args, OutputsCfg & { [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & {
|
|
85
|
+
outputWithStatus<const Key extends string, const RF extends RenderFunction<Args, Data, unknown>>(key: Key, rf: RF): BlockModelV3<Args, OutputsCfg & { [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & {
|
|
77
86
|
withStatus: true;
|
|
78
|
-
}; }, Data, Href>;
|
|
87
|
+
}; }, Data, Href, Plugins>;
|
|
79
88
|
/**
|
|
80
89
|
* Sets a function to derive block args from data.
|
|
81
90
|
* This is called during setData to compute the args that will be used for block execution.
|
|
@@ -89,7 +98,7 @@ export declare class BlockModelV3<Args, OutputsCfg extends Record<string, Config
|
|
|
89
98
|
* return { numbers: data.numbers };
|
|
90
99
|
* })
|
|
91
100
|
*/
|
|
92
|
-
args<Args>(lambda: (data: Data) => Args): BlockModelV3<Args, OutputsCfg, Data, Href>;
|
|
101
|
+
args<Args>(lambda: (data: Data) => Args): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>;
|
|
93
102
|
/**
|
|
94
103
|
* Sets a function to derive pre-run args from data (optional).
|
|
95
104
|
* This is called during setData to compute the args that will be used for staging/pre-run phase.
|
|
@@ -110,25 +119,44 @@ export declare class BlockModelV3<Args, OutputsCfg extends Record<string, Config
|
|
|
110
119
|
* return { numbers: data.numbers };
|
|
111
120
|
* })
|
|
112
121
|
*/
|
|
113
|
-
prerunArgs(fn: (data: Data) => unknown): BlockModelV3<Args, OutputsCfg, Data, Href>;
|
|
122
|
+
prerunArgs(fn: (data: Data) => unknown): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>;
|
|
114
123
|
/** Sets the lambda to generate list of sections in the left block overviews panel. */
|
|
115
|
-
sections<const Ret extends SectionsExpectedType, const RF extends RenderFunction<Args, Data, Ret>>(rf: RF): BlockModelV3<Args, OutputsCfg, Data, DeriveHref<ReturnType<RF
|
|
124
|
+
sections<const Ret extends SectionsExpectedType, const RF extends RenderFunction<Args, Data, Ret>>(rf: RF): BlockModelV3<Args, OutputsCfg, Data, DeriveHref<ReturnType<RF>>, Plugins>;
|
|
116
125
|
/** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
|
|
117
|
-
title(rf: RenderFunction<Args, Data, string>): BlockModelV3<Args, OutputsCfg, Data, Href>;
|
|
118
|
-
subtitle(rf: RenderFunction<Args, Data, string>): BlockModelV3<Args, OutputsCfg, Data, Href>;
|
|
119
|
-
tags(rf: RenderFunction<Args, Data, string[]>): BlockModelV3<Args, OutputsCfg, Data, Href>;
|
|
126
|
+
title(rf: RenderFunction<Args, Data, string>): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>;
|
|
127
|
+
subtitle(rf: RenderFunction<Args, Data, string>): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>;
|
|
128
|
+
tags(rf: RenderFunction<Args, Data, string[]>): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>;
|
|
120
129
|
/** Sets or overrides feature flags for the block. */
|
|
121
|
-
withFeatureFlags(flags: Partial<BlockCodeKnownFeatureFlags>): BlockModelV3<Args, OutputsCfg, Data, Href>;
|
|
130
|
+
withFeatureFlags(flags: Partial<BlockCodeKnownFeatureFlags>): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>;
|
|
122
131
|
/**
|
|
123
132
|
* Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.
|
|
124
133
|
* Influences dependency graph construction.
|
|
125
134
|
*/
|
|
126
|
-
enriches(lambda: (args: Args) => PlRef[]): BlockModelV3<Args, OutputsCfg, Data, Href>;
|
|
135
|
+
enriches(lambda: (args: Args) => PlRef[]): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>;
|
|
136
|
+
/**
|
|
137
|
+
* Registers a plugin instance with the block.
|
|
138
|
+
*
|
|
139
|
+
* Plugins are UI components with their own model logic and persistent state.
|
|
140
|
+
* Each plugin must have a unique pluginId within the block.
|
|
141
|
+
*
|
|
142
|
+
* @param pluginId - Unique identifier for this plugin instance within the block
|
|
143
|
+
* @param plugin - Configured PluginModel instance (created via factory.create(config))
|
|
144
|
+
* @param params - Per-property lambdas deriving plugin params from block RenderCtx
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* .plugin('mainTable', dataTablePlugin.create({ defaultOps: {...} }), {
|
|
148
|
+
* columns: (ctx) => ctx.outputs?.resolve("data")?.getPColumns(),
|
|
149
|
+
* sourceId: (ctx) => ctx.data.selectedSource,
|
|
150
|
+
* })
|
|
151
|
+
*/
|
|
152
|
+
plugin<const PluginId extends string, PluginData, PluginParams, PluginOutputs>(pluginId: PluginId, plugin: PluginModel<PluginData, PluginParams, PluginOutputs>, params?: ParamsInput<PluginParams, Args, Data>): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins & {
|
|
153
|
+
[K in PluginId]: PluginInstance<PluginData, PluginParams, PluginOutputs>;
|
|
154
|
+
}>;
|
|
127
155
|
/** Renders all provided block settings into a pre-configured platforma API
|
|
128
156
|
* instance, that can be used in frontend to interact with block data, and
|
|
129
157
|
* other features provided by the platforma to the block. */
|
|
130
|
-
done(): PlatformaExtended<PlatformaV3<Args, InferOutputsFromLambdas<OutputsCfg>,
|
|
131
|
-
_done(): PlatformaExtended<PlatformaV3<Args, InferOutputsFromLambdas<OutputsCfg>,
|
|
158
|
+
done(): PlatformaExtended<PlatformaV3<Data, Args, InferOutputsFromLambdas<OutputsCfg>, Href, Plugins>>;
|
|
159
|
+
_done(): PlatformaExtended<PlatformaV3<Data, Args, InferOutputsFromLambdas<OutputsCfg>, Href, Plugins>>;
|
|
132
160
|
}
|
|
133
161
|
export type Expect<T extends true> = T;
|
|
134
162
|
export type Equal<X, Y> = (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_model.d.ts","sourceRoot":"","sources":["../src/block_model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"block_model.d.ts","sourceRoot":"","sources":["../src/block_model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,YAAY,EAEZ,KAA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C,EAAE,WAAW,CAAC,YAAY,EAAE,IAAI,EAAE,IAAI,CAAC,GAC7C,YAAY,CACb,IAAI,EACJ,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,OAAO,GAAG;SAAG,CAAC,IAAI,QAAQ,GAAG,cAAc,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,CAAC;KAAE,CACvF;IAoBD;;gEAE4D;IACrD,IAAI,IAAI,iBAAiB,CAC9B,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,uBAAuB,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAC5E;IAMM,KAAK,IAAI,iBAAiB,CAC/B,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,uBAAuB,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAC5E;CA+FF;AAID,MAAM,MAAM,MAAM,CAAC,CAAC,SAAS,IAAI,IAAI,CAAC,CAAC;AAEvC,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IACpB,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAErF,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI;KACvB,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK;CACtF,CAAC"}
|
package/dist/block_model.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { createAndRegisterRenderLambda,
|
|
1
|
+
import { createAndRegisterRenderLambda, isInUI, getPlatformaInstance } from './internal.js';
|
|
2
2
|
import { RenderCtx } from './render/api.js';
|
|
3
3
|
import '@milaboratories/pl-model-common';
|
|
4
4
|
import './render/util/label.js';
|
|
5
5
|
import 'canonicalize';
|
|
6
6
|
import { PlatformaSDKVersion } from './version.js';
|
|
7
|
-
import './
|
|
7
|
+
import { derivePrerunArgsFromStorage, deriveArgsFromStorage, createInitialStorage, migrateStorage, getStorageDebugView, applyStorageUpdate } from './block_storage_callbacks.js';
|
|
8
8
|
import { downgradeCfgOrLambda } from './bconfig/normalization.js';
|
|
9
9
|
import { isConfigLambda } from './bconfig/types.js';
|
|
10
|
+
import { BLOCK_STORAGE_FACADE_VERSION, registerFacadeCallbacks, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles } from './block_storage_facade.js';
|
|
10
11
|
|
|
11
12
|
/** Main entry point that each block should use in it's "config" module. Don't forget
|
|
12
13
|
* to call {@link done()} at the end of configuration. Value returned by this builder must be
|
|
@@ -20,34 +21,27 @@ class BlockModelV3 {
|
|
|
20
21
|
static INITIAL_BLOCK_FEATURE_FLAGS = {
|
|
21
22
|
supportsLazyState: true,
|
|
22
23
|
requiresUIAPIVersion: 3,
|
|
23
|
-
requiresModelAPIVersion:
|
|
24
|
-
|
|
24
|
+
requiresModelAPIVersion: BLOCK_STORAGE_FACADE_VERSION,
|
|
25
|
+
requiresCreatePTable: 2,
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
27
|
-
* Creates a new BlockModelV3 builder with the specified data model
|
|
28
|
+
* Creates a new BlockModelV3 builder with the specified data model.
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
30
|
-
* const
|
|
31
|
-
*
|
|
32
|
-
* type VersionedData = { [Version.V1]: BlockData };
|
|
33
|
-
*
|
|
34
|
-
* const dataModel = new DataModelBuilder<VersionedData>()
|
|
35
|
-
* .from(Version.V1)
|
|
31
|
+
* const dataModel = new DataModelBuilder()
|
|
32
|
+
* .from<BlockData>(DATA_MODEL_DEFAULT_VERSION)
|
|
36
33
|
* .init(() => ({ numbers: [], labels: [] }));
|
|
37
34
|
*
|
|
38
|
-
* BlockModelV3.create(
|
|
35
|
+
* BlockModelV3.create(dataModel)
|
|
39
36
|
* .args((data) => ({ numbers: data.numbers }))
|
|
40
37
|
* .sections(() => [{ type: 'link', href: '/', label: 'Main' }])
|
|
41
38
|
* .done();
|
|
42
39
|
*
|
|
43
|
-
* @param
|
|
40
|
+
* @param dataModel The data model that defines initial data and migrations
|
|
44
41
|
*/
|
|
45
|
-
static create(
|
|
46
|
-
const { dataModel, renderingMode = "Heavy" } = options;
|
|
47
|
-
// Register data model callbacks for VM use (initialData and upgrade)
|
|
48
|
-
dataModel.registerCallbacks();
|
|
42
|
+
static create(dataModel) {
|
|
49
43
|
return new BlockModelV3({
|
|
50
|
-
renderingMode,
|
|
44
|
+
renderingMode: "Heavy",
|
|
51
45
|
dataModel,
|
|
52
46
|
outputs: {},
|
|
53
47
|
// Register default sections callback (returns empty array)
|
|
@@ -57,8 +51,9 @@ class BlockModelV3 {
|
|
|
57
51
|
tags: undefined,
|
|
58
52
|
enrichmentTargets: undefined,
|
|
59
53
|
featureFlags: { ...BlockModelV3.INITIAL_BLOCK_FEATURE_FLAGS },
|
|
60
|
-
|
|
61
|
-
|
|
54
|
+
argsFunction: undefined,
|
|
55
|
+
prerunArgsFunction: undefined,
|
|
56
|
+
plugins: {},
|
|
62
57
|
});
|
|
63
58
|
}
|
|
64
59
|
output(key, cfgOrRf, flags = {}) {
|
|
@@ -98,7 +93,7 @@ class BlockModelV3 {
|
|
|
98
93
|
args(lambda) {
|
|
99
94
|
return new BlockModelV3({
|
|
100
95
|
...this.config,
|
|
101
|
-
|
|
96
|
+
argsFunction: lambda,
|
|
102
97
|
});
|
|
103
98
|
}
|
|
104
99
|
/**
|
|
@@ -124,10 +119,7 @@ class BlockModelV3 {
|
|
|
124
119
|
prerunArgs(fn) {
|
|
125
120
|
return new BlockModelV3({
|
|
126
121
|
...this.config,
|
|
127
|
-
|
|
128
|
-
handle: "prerunArgs",
|
|
129
|
-
lambda: fn,
|
|
130
|
-
}),
|
|
122
|
+
prerunArgsFunction: fn,
|
|
131
123
|
});
|
|
132
124
|
}
|
|
133
125
|
/** Sets the lambda to generate list of sections in the left block overviews panel. */
|
|
@@ -186,6 +178,39 @@ class BlockModelV3 {
|
|
|
186
178
|
}),
|
|
187
179
|
});
|
|
188
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Registers a plugin instance with the block.
|
|
183
|
+
*
|
|
184
|
+
* Plugins are UI components with their own model logic and persistent state.
|
|
185
|
+
* Each plugin must have a unique pluginId within the block.
|
|
186
|
+
*
|
|
187
|
+
* @param pluginId - Unique identifier for this plugin instance within the block
|
|
188
|
+
* @param plugin - Configured PluginModel instance (created via factory.create(config))
|
|
189
|
+
* @param params - Per-property lambdas deriving plugin params from block RenderCtx
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* .plugin('mainTable', dataTablePlugin.create({ defaultOps: {...} }), {
|
|
193
|
+
* columns: (ctx) => ctx.outputs?.resolve("data")?.getPColumns(),
|
|
194
|
+
* sourceId: (ctx) => ctx.data.selectedSource,
|
|
195
|
+
* })
|
|
196
|
+
*/
|
|
197
|
+
plugin(pluginId, plugin, params) {
|
|
198
|
+
// Validate pluginId uniqueness
|
|
199
|
+
if (pluginId in this.config.plugins) {
|
|
200
|
+
throw new Error(`Plugin '${pluginId}' already registered`);
|
|
201
|
+
}
|
|
202
|
+
const instance = {
|
|
203
|
+
model: plugin,
|
|
204
|
+
inputs: (params ?? {}),
|
|
205
|
+
};
|
|
206
|
+
return new BlockModelV3({
|
|
207
|
+
...this.config,
|
|
208
|
+
plugins: {
|
|
209
|
+
...this.config.plugins,
|
|
210
|
+
[pluginId]: instance,
|
|
211
|
+
},
|
|
212
|
+
});
|
|
213
|
+
}
|
|
189
214
|
/** Renders all provided block settings into a pre-configured platforma API
|
|
190
215
|
* instance, that can be used in frontend to interact with block data, and
|
|
191
216
|
* other features provided by the platforma to the block. */
|
|
@@ -195,29 +220,54 @@ class BlockModelV3 {
|
|
|
195
220
|
})._done();
|
|
196
221
|
}
|
|
197
222
|
_done() {
|
|
198
|
-
if (this.config.
|
|
223
|
+
if (this.config.argsFunction === undefined)
|
|
199
224
|
throw new Error("Args rendering function not set.");
|
|
200
225
|
const apiVersion = 3;
|
|
201
|
-
|
|
226
|
+
// Build plugin registry
|
|
227
|
+
const { plugins } = this.config;
|
|
228
|
+
const pluginRegistry = {};
|
|
229
|
+
for (const [pluginId, { model }] of Object.entries(plugins)) {
|
|
230
|
+
pluginRegistry[pluginId] = model.name;
|
|
231
|
+
}
|
|
232
|
+
const { dataModel, argsFunction, prerunArgsFunction } = this.config;
|
|
233
|
+
function getPlugin(pluginId) {
|
|
234
|
+
const plugin = plugins[pluginId];
|
|
235
|
+
if (!plugin)
|
|
236
|
+
throw new Error(`Plugin model not found for '${pluginId}'`);
|
|
237
|
+
return plugin;
|
|
238
|
+
}
|
|
239
|
+
// Register ALL facade callbacks here, with dependencies captured via closures
|
|
240
|
+
registerFacadeCallbacks({
|
|
241
|
+
[BlockStorageFacadeCallbacks.StorageApplyUpdate]: applyStorageUpdate,
|
|
242
|
+
[BlockStorageFacadeCallbacks.StorageDebugView]: getStorageDebugView,
|
|
243
|
+
[BlockStorageFacadeCallbacks.StorageMigrate]: (currentStorageJson) => migrateStorage(currentStorageJson, {
|
|
244
|
+
migrateBlockData: (v) => dataModel.migrate(v),
|
|
245
|
+
getPluginRegistry: () => pluginRegistry,
|
|
246
|
+
migratePluginData: (pluginId, v) => getPlugin(pluginId).model.dataModel.migrate(v),
|
|
247
|
+
createPluginData: (pluginId) => getPlugin(pluginId).model.dataModel.getDefaultData(),
|
|
248
|
+
}),
|
|
249
|
+
[BlockStorageFacadeCallbacks.StorageInitial]: () => createInitialStorage({
|
|
250
|
+
getDefaultBlockData: () => dataModel.getDefaultData(),
|
|
251
|
+
getPluginRegistry: () => pluginRegistry,
|
|
252
|
+
createPluginData: (pluginId) => getPlugin(pluginId).model.dataModel.getDefaultData(),
|
|
253
|
+
}),
|
|
254
|
+
[BlockStorageFacadeCallbacks.ArgsDerive]: (storageJson) => deriveArgsFromStorage(storageJson, argsFunction),
|
|
255
|
+
[BlockStorageFacadeCallbacks.PrerunArgsDerive]: (storageJson) => derivePrerunArgsFromStorage(storageJson, argsFunction, prerunArgsFunction),
|
|
256
|
+
});
|
|
202
257
|
const blockConfig = {
|
|
203
258
|
v4: {
|
|
204
259
|
configVersion: 4,
|
|
205
|
-
modelAPIVersion:
|
|
260
|
+
modelAPIVersion: BLOCK_STORAGE_FACADE_VERSION,
|
|
206
261
|
sdkVersion: PlatformaSDKVersion,
|
|
207
262
|
renderingMode: this.config.renderingMode,
|
|
208
|
-
args: this.config.args,
|
|
209
|
-
prerunArgs: this.config.prerunArgs,
|
|
210
|
-
// Reference to __pl_data_initial callback registered by DataModel
|
|
211
|
-
initialData: createRenderLambda({ handle: "__pl_data_initial" }),
|
|
212
263
|
sections: this.config.sections,
|
|
213
264
|
title: this.config.title,
|
|
265
|
+
subtitle: this.config.subtitle,
|
|
266
|
+
tags: this.config.tags,
|
|
214
267
|
outputs: this.config.outputs,
|
|
215
268
|
enrichmentTargets: this.config.enrichmentTargets,
|
|
216
269
|
featureFlags: this.config.featureFlags,
|
|
217
|
-
|
|
218
|
-
migrations: migrationCount > 0
|
|
219
|
-
? Array.from({ length: migrationCount }, (_, i) => ({ index: i }))
|
|
220
|
-
: undefined,
|
|
270
|
+
blockLifecycleCallbacks: { ...BlockStorageFacadeHandles },
|
|
221
271
|
},
|
|
222
272
|
// fields below are added to allow previous desktop versions read generated configs
|
|
223
273
|
sdkVersion: PlatformaSDKVersion,
|
package/dist/block_model.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_model.js","sources":["../src/block_model.ts"],"sourcesContent":["import type {\n BlockRenderingMode,\n BlockSection,\n OutputWithStatus,\n PlRef,\n BlockCodeKnownFeatureFlags,\n BlockConfigContainer,\n} from \"@milaboratories/pl-model-common\";\nimport {\n getPlatformaInstance,\n isInUI,\n createAndRegisterRenderLambda,\n createRenderLambda,\n} from \"./internal\";\nimport type { DataModel } from \"./block_migrations\";\nimport type { PlatformaV3 } from \"./platforma\";\nimport type { InferRenderFunctionReturn, RenderFunction } from \"./render\";\nimport { RenderCtx } from \"./render\";\nimport { PlatformaSDKVersion } from \"./version\";\n// Import storage VM integration (side-effect: registers internal callbacks)\nimport \"./block_storage_vm\";\nimport type {\n ConfigRenderLambda,\n DeriveHref,\n ConfigRenderLambdaFlags,\n InferOutputsFromLambdas,\n} from \"./bconfig\";\nimport { downgradeCfgOrLambda, isConfigLambda } from \"./bconfig\";\nimport type { PlatformaExtended } from \"./platforma\";\n\ntype SectionsExpectedType = readonly BlockSection[];\n\ntype NoOb = Record<string, never>;\n\ninterface BlockModelV3Config<Args, OutputsCfg extends Record<string, ConfigRenderLambda>, Data> {\n renderingMode: BlockRenderingMode;\n dataModel: DataModel<Data>;\n outputs: OutputsCfg;\n sections: ConfigRenderLambda;\n title: ConfigRenderLambda | undefined;\n subtitle: ConfigRenderLambda | undefined;\n tags: ConfigRenderLambda | undefined;\n enrichmentTargets: ConfigRenderLambda | undefined;\n featureFlags: BlockCodeKnownFeatureFlags;\n args: ConfigRenderLambda<Args> | undefined;\n prerunArgs: ConfigRenderLambda<unknown> | undefined;\n}\n\n/** Options for creating a BlockModelV3 */\nexport interface BlockModelV3Options<Data extends Record<string, unknown>> {\n /** The data model that defines initial data and migrations */\n dataModel: DataModel<Data>;\n /** Rendering mode for the block (default: 'Heavy') */\n renderingMode?: BlockRenderingMode;\n}\n\n/** Main entry point that each block should use in it's \"config\" module. Don't forget\n * to call {@link done()} at the end of configuration. Value returned by this builder must be\n * exported as constant with name \"platforma\" from the \"config\" module.\n * API version is 3 (for UI) and 2 (for model) */\nexport class BlockModelV3<\n Args,\n OutputsCfg extends Record<string, ConfigRenderLambda>,\n Data extends Record<string, unknown> = Record<string, unknown>,\n Href extends `/${string}` = \"/\",\n> {\n private constructor(private readonly config: BlockModelV3Config<Args, OutputsCfg, Data>) {}\n\n public static readonly INITIAL_BLOCK_FEATURE_FLAGS: BlockCodeKnownFeatureFlags = {\n supportsLazyState: true,\n requiresUIAPIVersion: 3,\n requiresModelAPIVersion: 2,\n requiresCreatePTableV2: true,\n };\n\n /**\n * Creates a new BlockModelV3 builder with the specified data model and options.\n *\n * @example\n * const Version = defineDataVersions({ V1: DATA_MODEL_DEFAULT_VERSION });\n *\n * type VersionedData = { [Version.V1]: BlockData };\n *\n * const dataModel = new DataModelBuilder<VersionedData>()\n * .from(Version.V1)\n * .init(() => ({ numbers: [], labels: [] }));\n *\n * BlockModelV3.create({ dataModel })\n * .args((data) => ({ numbers: data.numbers }))\n * .sections(() => [{ type: 'link', href: '/', label: 'Main' }])\n * .done();\n *\n * @param options Configuration options including required data model\n */\n public static create<Data extends Record<string, unknown>>(\n options: BlockModelV3Options<Data>,\n ): BlockModelV3<NoOb, {}, Data> {\n const { dataModel, renderingMode = \"Heavy\" } = options;\n\n // Register data model callbacks for VM use (initialData and upgrade)\n dataModel.registerCallbacks();\n\n return new BlockModelV3<NoOb, {}, Data>({\n renderingMode,\n dataModel,\n outputs: {},\n // Register default sections callback (returns empty array)\n sections: createAndRegisterRenderLambda({ handle: \"sections\", lambda: () => [] }, true),\n title: undefined,\n subtitle: undefined,\n tags: undefined,\n enrichmentTargets: undefined,\n featureFlags: { ...BlockModelV3.INITIAL_BLOCK_FEATURE_FLAGS },\n args: undefined,\n prerunArgs: undefined,\n });\n }\n\n /**\n * Add output cell wrapped with additional status information to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunction<Args, Data>>(\n key: Key,\n rf: RF,\n flags: ConfigRenderLambdaFlags & { withStatus: true },\n ): BlockModelV3<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & {\n withStatus: true;\n };\n },\n Data,\n Href\n >;\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunction<Args, Data>>(\n key: Key,\n rf: RF,\n flags?: ConfigRenderLambdaFlags,\n ): BlockModelV3<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>>;\n },\n Data,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: RenderFunction<Args, Data>,\n flags: ConfigRenderLambdaFlags = {},\n ): BlockModelV3<Args, OutputsCfg, Data, Href> {\n return new BlockModelV3({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: createAndRegisterRenderLambda({\n handle: `output#${key}`,\n lambda: () => cfgOrRf(new RenderCtx()),\n ...flags,\n }),\n },\n });\n }\n\n /** Shortcut for {@link output} with retentive flag set to true. */\n public retentiveOutput<const Key extends string, const RF extends RenderFunction<Args, Data>>(\n key: Key,\n rf: RF,\n ): BlockModelV3<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>>;\n },\n Data,\n Href\n > {\n return this.output(key, rf, { retentive: true });\n }\n\n /** Shortcut for {@link output} with withStatus flag set to true. */\n public outputWithStatus<const Key extends string, const RF extends RenderFunction<Args, Data>>(\n key: Key,\n rf: RF,\n ) {\n return this.output(key, rf, { withStatus: true });\n }\n\n /**\n * Sets a function to derive block args from data.\n * This is called during setData to compute the args that will be used for block execution.\n *\n * @example\n * .args<BlockArgs>((data) => ({ numbers: data.numbers }))\n *\n * @example\n * .args<BlockArgs>((data) => {\n * if (data.numbers.length === 0) throw new Error('Numbers required'); // block not ready\n * return { numbers: data.numbers };\n * })\n */\n public args<Args>(lambda: (data: Data) => Args): BlockModelV3<Args, OutputsCfg, Data, Href> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href>({\n ...this.config,\n args: createAndRegisterRenderLambda<Args>({ handle: \"args\", lambda }),\n });\n }\n\n /**\n * Sets a function to derive pre-run args from data (optional).\n * This is called during setData to compute the args that will be used for staging/pre-run phase.\n *\n * If not defined, defaults to using the args() function result.\n * If defined, uses its return value for the staging / prerun phase.\n *\n * The staging / prerun phase runs only if currentPrerunArgs differs from the executed\n * version of prerunArgs (same comparison logic as currentArgs vs prodArgs).\n *\n * @example\n * .prerunArgs((data) => ({ numbers: data.numbers }))\n *\n * @example\n * .prerunArgs((data) => {\n * // Return undefined to skip staging for this block\n * if (!data.isReady) return undefined;\n * return { numbers: data.numbers };\n * })\n */\n public prerunArgs(fn: (data: Data) => unknown): BlockModelV3<Args, OutputsCfg, Data, Href> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href>({\n ...this.config,\n prerunArgs: createAndRegisterRenderLambda({\n handle: \"prerunArgs\",\n lambda: fn,\n }),\n });\n }\n\n /** Sets the lambda to generate list of sections in the left block overviews panel. */\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunction<Args, Data, Ret>,\n >(rf: RF): BlockModelV3<Args, OutputsCfg, Data, DeriveHref<ReturnType<RF>>> {\n return new BlockModelV3<Args, OutputsCfg, Data, DeriveHref<ReturnType<RF>>>({\n ...this.config,\n // Replace the default sections callback with the user-provided one\n sections: createAndRegisterRenderLambda(\n { handle: \"sections\", lambda: () => rf(new RenderCtx()) },\n true,\n ),\n });\n }\n\n /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */\n public title(rf: RenderFunction<Args, Data, string>): BlockModelV3<Args, OutputsCfg, Data, Href> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href>({\n ...this.config,\n title: createAndRegisterRenderLambda({\n handle: \"title\",\n lambda: () => rf(new RenderCtx()),\n }),\n });\n }\n\n public subtitle(\n rf: RenderFunction<Args, Data, string>,\n ): BlockModelV3<Args, OutputsCfg, Data, Href> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href>({\n ...this.config,\n subtitle: createAndRegisterRenderLambda({\n handle: \"subtitle\",\n lambda: () => rf(new RenderCtx()),\n }),\n });\n }\n\n public tags(\n rf: RenderFunction<Args, Data, string[]>,\n ): BlockModelV3<Args, OutputsCfg, Data, Href> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href>({\n ...this.config,\n tags: createAndRegisterRenderLambda({\n handle: \"tags\",\n lambda: () => rf(new RenderCtx()),\n }),\n });\n }\n\n /** Sets or overrides feature flags for the block. */\n public withFeatureFlags(\n flags: Partial<BlockCodeKnownFeatureFlags>,\n ): BlockModelV3<Args, OutputsCfg, Data, Href> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href>({\n ...this.config,\n featureFlags: { ...this.config.featureFlags, ...flags },\n });\n }\n\n /**\n * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.\n * Influences dependency graph construction.\n */\n public enriches(lambda: (args: Args) => PlRef[]): BlockModelV3<Args, OutputsCfg, Data, Href> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href>({\n ...this.config,\n enrichmentTargets: createAndRegisterRenderLambda({\n handle: \"enrichmentTargets\",\n lambda: lambda,\n }),\n });\n }\n\n /** Renders all provided block settings into a pre-configured platforma API\n * instance, that can be used in frontend to interact with block data, and\n * other features provided by the platforma to the block. */\n public done(): PlatformaExtended<\n PlatformaV3<Args, InferOutputsFromLambdas<OutputsCfg>, Data, Href>\n > {\n return this.withFeatureFlags({\n ...this.config.featureFlags,\n })._done();\n }\n\n public _done(): PlatformaExtended<\n PlatformaV3<Args, InferOutputsFromLambdas<OutputsCfg>, Data, Href>\n > {\n if (this.config.args === undefined) throw new Error(\"Args rendering function not set.\");\n\n const apiVersion = 3;\n\n const migrationCount = this.config.dataModel.migrationCount;\n\n const blockConfig: BlockConfigContainer = {\n v4: {\n configVersion: 4,\n modelAPIVersion: 2,\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n args: this.config.args,\n prerunArgs: this.config.prerunArgs,\n // Reference to __pl_data_initial callback registered by DataModel\n initialData: createRenderLambda({ handle: \"__pl_data_initial\" }),\n sections: this.config.sections,\n title: this.config.title,\n outputs: this.config.outputs,\n enrichmentTargets: this.config.enrichmentTargets,\n featureFlags: this.config.featureFlags,\n // Generate migration descriptors (indices for metadata)\n migrations:\n migrationCount > 0\n ? Array.from({ length: migrationCount }, (_, i) => ({ index: i }))\n : undefined,\n },\n\n // fields below are added to allow previous desktop versions read generated configs\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n sections: this.config.sections,\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n downgradeCfgOrLambda(value),\n ]),\n ),\n };\n\n globalThis.platformaApiVersion = apiVersion;\n\n if (!isInUI())\n // we are in the configuration rendering routine, not in actual UI\n return { config: blockConfig } as any;\n // normal operation inside the UI\n else\n return {\n ...getPlatformaInstance({\n sdkVersion: PlatformaSDKVersion,\n apiVersion,\n }),\n blockModelInfo: {\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n {\n withStatus: Boolean(isConfigLambda(value) && value.withStatus),\n },\n ]),\n ),\n },\n } as any;\n }\n}\n\n// Type tests for BlockModelV3\n\nexport type Expect<T extends true> = T;\n\nexport type Equal<X, Y> =\n (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;\n\nexport type Merge<A, B> = {\n [K in keyof A | keyof B]: K extends keyof B ? B[K] : K extends keyof A ? A[K] : never;\n};\n\n// Helper types for testing\ntype _TestArgs = { inputFile: string; threshold: number };\ntype _TestData = { selectedTab: string };\ntype _TestOutputs = {\n result: ConfigRenderLambda<string>;\n count: ConfigRenderLambda<number>;\n};\n\n// Test: Merge type works correctly\ntype _MergeTest1 = Expect<Equal<Merge<{ a: 1 }, { b: 2 }>, { a: 1; b: 2 }>>;\ntype _MergeTest2 = Expect<Equal<Merge<{ a: 1 }, { a: 2 }>, { a: 2 }>>;\ntype _MergeTest3 = Expect<Equal<Merge<{ a: 1; b: 1 }, { b: 2; c: 3 }>, { a: 1; b: 2; c: 3 }>>;\n\n// Test: create() returns a BlockModelV3 instance\n// Note: Due to function overloads, ReturnType uses the last overload signature.\n// We verify the structure is correct using a simpler assignability test.\ntype _CreateResult = ReturnType<typeof BlockModelV3.create>;\ntype _CreateIsBlockModelV3 =\n _CreateResult extends BlockModelV3<infer _A, infer _O, infer _S> ? true : false;\ntype _CreateTest = Expect<_CreateIsBlockModelV3>;\n\n// Test: BlockModelV3Config interface structure\ntype _ConfigTest = Expect<\n Equal<\n BlockModelV3Config<_TestArgs, _TestOutputs, _TestData>,\n {\n renderingMode: BlockRenderingMode;\n args: ConfigRenderLambda<_TestArgs> | undefined;\n prerunArgs: ConfigRenderLambda<unknown> | undefined;\n dataModel: DataModel<_TestData>;\n outputs: _TestOutputs;\n sections: ConfigRenderLambda;\n title: ConfigRenderLambda | undefined;\n subtitle: ConfigRenderLambda | undefined;\n tags: ConfigRenderLambda | undefined;\n enrichmentTargets: ConfigRenderLambda | undefined;\n featureFlags: BlockCodeKnownFeatureFlags;\n }\n >\n>;\n\n// Test: Default Href is '/'\ntype _HrefDefaultTest =\n BlockModelV3<_TestArgs, {}, _TestData> extends BlockModelV3<_TestArgs, {}, _TestData, \"/\">\n ? true\n : false;\ntype _VerifyHrefDefault = Expect<_HrefDefaultTest>;\n\n// Test: Custom Href can be specified\ntype _CustomHref = \"/settings\" | \"/main\";\ntype _HrefCustomBuilder = BlockModelV3<_TestArgs, {}, _TestData, _CustomHref>;\ntype _HrefCustomTest =\n _HrefCustomBuilder extends BlockModelV3<_TestArgs, {}, _TestData, _CustomHref> ? true : false;\ntype _VerifyHrefCustom = Expect<_HrefCustomTest>;\n\n// Test: Output type accumulation with & intersection\ntype _OutputsAccumulation = { a: ConfigRenderLambda<string> } & {\n b: ConfigRenderLambda<number>;\n};\ntype _VerifyOutputsHaveKeys = Expect<Equal<keyof _OutputsAccumulation, \"a\" | \"b\">>;\n\n// Test: Builder with all type parameters specified compiles\ntype _FullBuilder = BlockModelV3<_TestArgs, _TestOutputs, _TestData, \"/main\">;\ntype _FullBuilderTest =\n _FullBuilder extends BlockModelV3<_TestArgs, _TestOutputs, _TestData, \"/main\"> ? true : false;\ntype _VerifyFullBuilder = Expect<_FullBuilderTest>;\n\n// Test: InferOutputsFromLambdas maps outputs correctly\ntype _InferOutputsTest = InferOutputsFromLambdas<{\n myOutput: ConfigRenderLambda<number>;\n}>;\ntype _VerifyInferOutputs = Expect<\n Equal<_InferOutputsTest, { myOutput: OutputWithStatus<number> & { __unwrap: true } }>\n>;\n"],"names":[],"mappings":";;;;;;;;;;AAwDA;;;AAGiD;MACpC,YAAY,CAAA;AAMc,IAAA,MAAA;AAArC,IAAA,WAAA,CAAqC,MAAkD,EAAA;QAAlD,IAAA,CAAA,MAAM,GAAN,MAAM;IAA+C;IAEnF,OAAgB,2BAA2B,GAA+B;AAC/E,QAAA,iBAAiB,EAAE,IAAI;AACvB,QAAA,oBAAoB,EAAE,CAAC;AACvB,QAAA,uBAAuB,EAAE,CAAC;AAC1B,QAAA,sBAAsB,EAAE,IAAI;KAC7B;AAED;;;;;;;;;;;;;;;;;;AAkBG;IACI,OAAO,MAAM,CAClB,OAAkC,EAAA;QAElC,MAAM,EAAE,SAAS,EAAE,aAAa,GAAG,OAAO,EAAE,GAAG,OAAO;;QAGtD,SAAS,CAAC,iBAAiB,EAAE;QAE7B,OAAO,IAAI,YAAY,CAAiB;YACtC,aAAa;YACb,SAAS;AACT,YAAA,OAAO,EAAE,EAAE;;AAEX,YAAA,QAAQ,EAAE,6BAA6B,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC;AACvF,YAAA,KAAK,EAAE,SAAS;AAChB,YAAA,QAAQ,EAAE,SAAS;AACnB,YAAA,IAAI,EAAE,SAAS;AACf,YAAA,iBAAiB,EAAE,SAAS;AAC5B,YAAA,YAA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;AACH,wBAAA;4BACE,UAAU,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC;AAC/D,yBAAA;AACF,qBAAA,CAAC,CACH;AACF,iBAAA;aACK;IACZ;;;;;"}
|
|
1
|
+
{"version":3,"file":"block_model.js","sources":["../src/block_model.ts"],"sourcesContent":["import type {\n BlockRenderingMode,\n BlockSection,\n OutputWithStatus,\n PlRef,\n BlockCodeKnownFeatureFlags,\n BlockConfigContainer,\n} from \"@milaboratories/pl-model-common\";\nimport { getPlatformaInstance, isInUI, createAndRegisterRenderLambda } from \"./internal\";\nimport type { DataModel } from \"./block_migrations\";\nimport type { PlatformaV3 } from \"./platforma\";\nimport type { InferRenderFunctionReturn, RenderFunction } from \"./render\";\nimport { RenderCtx } from \"./render\";\nimport type { PluginModel } from \"./plugin_model\";\nimport type { RenderCtxBase } from \"./render\";\nimport { PlatformaSDKVersion } from \"./version\";\nimport {\n applyStorageUpdate,\n getStorageDebugView,\n migrateStorage,\n createInitialStorage,\n deriveArgsFromStorage,\n derivePrerunArgsFromStorage,\n} from \"./block_storage_callbacks\";\nimport { type PluginName } from \"./block_storage\";\nimport type {\n ConfigRenderLambda,\n DeriveHref,\n ConfigRenderLambdaFlags,\n InferOutputsFromLambdas,\n} from \"./bconfig\";\nimport { downgradeCfgOrLambda, isConfigLambda } from \"./bconfig\";\nimport type { PlatformaExtended } from \"./platforma\";\nimport {\n BLOCK_STORAGE_FACADE_VERSION,\n BlockStorageFacadeCallbacks,\n BlockStorageFacadeHandles,\n registerFacadeCallbacks,\n} from \"./block_storage_facade\";\n\ntype SectionsExpectedType = readonly BlockSection[];\n\ntype NoOb = Record<string, never>;\n\n/**\n * Per-property lambdas for deriving plugin params from block render context.\n * Each property is a function that receives the block's RenderCtxBase and returns the param value.\n */\nexport type ParamsInput<Params, BArgs = unknown, BData = unknown> = {\n [K in keyof Params]: (ctx: RenderCtxBase<BArgs, BData>) => Params[K];\n};\n\n/**\n * Type-erased version of ParamsInput for internal storage.\n */\ntype ParamsInputErased = Record<string, (ctx: RenderCtxBase) => unknown>;\n\n/**\n * Registered plugin: model + param derivation lambdas.\n * Type parameters are carried by PluginModel generic.\n */\nexport type PluginInstance<Data = unknown, Params = unknown, Outputs = unknown> = {\n readonly model: PluginModel<Data, Params, Outputs>;\n readonly inputs: ParamsInputErased;\n};\n\ninterface BlockModelV3Config<\n OutputsCfg extends Record<string, ConfigRenderLambda>,\n Data,\n Plugins extends Record<string, PluginInstance> = {},\n> {\n renderingMode: BlockRenderingMode;\n dataModel: DataModel<Data>;\n outputs: OutputsCfg;\n sections: ConfigRenderLambda;\n title: ConfigRenderLambda | undefined;\n subtitle: ConfigRenderLambda | undefined;\n tags: ConfigRenderLambda | undefined;\n enrichmentTargets: ConfigRenderLambda | undefined;\n featureFlags: BlockCodeKnownFeatureFlags;\n argsFunction: ((data: unknown) => unknown) | undefined;\n prerunArgsFunction: ((data: unknown) => unknown) | undefined;\n plugins: Plugins;\n}\n\n/** Main entry point that each block should use in it's \"config\" module. Don't forget\n * to call {@link done()} at the end of configuration. Value returned by this builder must be\n * exported as constant with name \"platforma\" from the \"config\" module.\n * API version is 3 (for UI) and 2 (for model) */\nexport class BlockModelV3<\n Args,\n OutputsCfg extends Record<string, ConfigRenderLambda>,\n Data extends Record<string, unknown> = Record<string, unknown>,\n Href extends `/${string}` = \"/\",\n Plugins extends Record<string, PluginInstance> = {},\n> {\n private constructor(private readonly config: BlockModelV3Config<OutputsCfg, Data, Plugins>) {}\n\n public static readonly INITIAL_BLOCK_FEATURE_FLAGS: BlockCodeKnownFeatureFlags = {\n supportsLazyState: true,\n requiresUIAPIVersion: 3,\n requiresModelAPIVersion: BLOCK_STORAGE_FACADE_VERSION,\n requiresCreatePTable: 2,\n };\n\n /**\n * Creates a new BlockModelV3 builder with the specified data model.\n *\n * @example\n * const dataModel = new DataModelBuilder()\n * .from<BlockData>(DATA_MODEL_DEFAULT_VERSION)\n * .init(() => ({ numbers: [], labels: [] }));\n *\n * BlockModelV3.create(dataModel)\n * .args((data) => ({ numbers: data.numbers }))\n * .sections(() => [{ type: 'link', href: '/', label: 'Main' }])\n * .done();\n *\n * @param dataModel The data model that defines initial data and migrations\n */\n public static create<Data extends Record<string, unknown>>(\n dataModel: DataModel<Data>,\n ): BlockModelV3<NoOb, {}, Data> {\n return new BlockModelV3<NoOb, {}, Data>({\n renderingMode: \"Heavy\",\n dataModel,\n outputs: {},\n // Register default sections callback (returns empty array)\n sections: createAndRegisterRenderLambda({ handle: \"sections\", lambda: () => [] }, true),\n title: undefined,\n subtitle: undefined,\n tags: undefined,\n enrichmentTargets: undefined,\n featureFlags: { ...BlockModelV3.INITIAL_BLOCK_FEATURE_FLAGS },\n argsFunction: undefined,\n prerunArgsFunction: undefined,\n plugins: {},\n });\n }\n\n /**\n * Add output cell wrapped with additional status information to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunction<Args, Data, unknown>>(\n key: Key,\n rf: RF,\n flags: ConfigRenderLambdaFlags & { withStatus: true },\n ): BlockModelV3<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & {\n withStatus: true;\n };\n },\n Data,\n Href,\n Plugins\n >;\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunction<Args, Data, unknown>>(\n key: Key,\n rf: RF,\n flags?: ConfigRenderLambdaFlags,\n ): BlockModelV3<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>>;\n },\n Data,\n Href,\n Plugins\n >;\n public output(\n key: string,\n cfgOrRf: RenderFunction<Args, Data, unknown>,\n flags: ConfigRenderLambdaFlags = {},\n ): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins> {\n return new BlockModelV3({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: createAndRegisterRenderLambda({\n handle: `output#${key}`,\n lambda: () => cfgOrRf(new RenderCtx<Args, Data>()),\n ...flags,\n }),\n },\n });\n }\n\n /** Shortcut for {@link output} with retentive flag set to true. */\n public retentiveOutput<\n const Key extends string,\n const RF extends RenderFunction<Args, Data, unknown>,\n >(\n key: Key,\n rf: RF,\n ): BlockModelV3<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>>;\n },\n Data,\n Href,\n Plugins\n > {\n return this.output(key, rf, { retentive: true });\n }\n\n /** Shortcut for {@link output} with withStatus flag set to true. */\n public outputWithStatus<\n const Key extends string,\n const RF extends RenderFunction<Args, Data, unknown>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { withStatus: true });\n }\n\n /**\n * Sets a function to derive block args from data.\n * This is called during setData to compute the args that will be used for block execution.\n *\n * @example\n * .args<BlockArgs>((data) => ({ numbers: data.numbers }))\n *\n * @example\n * .args<BlockArgs>((data) => {\n * if (data.numbers.length === 0) throw new Error('Numbers required'); // block not ready\n * return { numbers: data.numbers };\n * })\n */\n public args<Args>(\n lambda: (data: Data) => Args,\n ): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>({\n ...this.config,\n argsFunction: lambda as (data: unknown) => unknown,\n });\n }\n\n /**\n * Sets a function to derive pre-run args from data (optional).\n * This is called during setData to compute the args that will be used for staging/pre-run phase.\n *\n * If not defined, defaults to using the args() function result.\n * If defined, uses its return value for the staging / prerun phase.\n *\n * The staging / prerun phase runs only if currentPrerunArgs differs from the executed\n * version of prerunArgs (same comparison logic as currentArgs vs prodArgs).\n *\n * @example\n * .prerunArgs((data) => ({ numbers: data.numbers }))\n *\n * @example\n * .prerunArgs((data) => {\n * // Return undefined to skip staging for this block\n * if (!data.isReady) return undefined;\n * return { numbers: data.numbers };\n * })\n */\n public prerunArgs(\n fn: (data: Data) => unknown,\n ): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>({\n ...this.config,\n prerunArgsFunction: fn as (data: unknown) => unknown,\n });\n }\n\n /** Sets the lambda to generate list of sections in the left block overviews panel. */\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunction<Args, Data, Ret>,\n >(rf: RF): BlockModelV3<Args, OutputsCfg, Data, DeriveHref<ReturnType<RF>>, Plugins> {\n return new BlockModelV3<Args, OutputsCfg, Data, DeriveHref<ReturnType<RF>>, Plugins>({\n ...this.config,\n // Replace the default sections callback with the user-provided one\n sections: createAndRegisterRenderLambda(\n { handle: \"sections\", lambda: () => rf(new RenderCtx<Args, Data>()) },\n true,\n ),\n });\n }\n\n /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */\n public title(\n rf: RenderFunction<Args, Data, string>,\n ): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>({\n ...this.config,\n title: createAndRegisterRenderLambda({\n handle: \"title\",\n lambda: () => rf(new RenderCtx<Args, Data>()),\n }),\n });\n }\n\n public subtitle(\n rf: RenderFunction<Args, Data, string>,\n ): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>({\n ...this.config,\n subtitle: createAndRegisterRenderLambda({\n handle: \"subtitle\",\n lambda: () => rf(new RenderCtx<Args, Data>()),\n }),\n });\n }\n\n public tags(\n rf: RenderFunction<Args, Data, string[]>,\n ): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>({\n ...this.config,\n tags: createAndRegisterRenderLambda({\n handle: \"tags\",\n lambda: () => rf(new RenderCtx<Args, Data>()),\n }),\n });\n }\n\n /** Sets or overrides feature flags for the block. */\n public withFeatureFlags(\n flags: Partial<BlockCodeKnownFeatureFlags>,\n ): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>({\n ...this.config,\n featureFlags: { ...this.config.featureFlags, ...flags },\n });\n }\n\n /**\n * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.\n * Influences dependency graph construction.\n */\n public enriches(\n lambda: (args: Args) => PlRef[],\n ): BlockModelV3<Args, OutputsCfg, Data, Href, Plugins> {\n return new BlockModelV3<Args, OutputsCfg, Data, Href, Plugins>({\n ...this.config,\n enrichmentTargets: createAndRegisterRenderLambda({\n handle: \"enrichmentTargets\",\n lambda: lambda,\n }),\n });\n }\n\n /**\n * Registers a plugin instance with the block.\n *\n * Plugins are UI components with their own model logic and persistent state.\n * Each plugin must have a unique pluginId within the block.\n *\n * @param pluginId - Unique identifier for this plugin instance within the block\n * @param plugin - Configured PluginModel instance (created via factory.create(config))\n * @param params - Per-property lambdas deriving plugin params from block RenderCtx\n *\n * @example\n * .plugin('mainTable', dataTablePlugin.create({ defaultOps: {...} }), {\n * columns: (ctx) => ctx.outputs?.resolve(\"data\")?.getPColumns(),\n * sourceId: (ctx) => ctx.data.selectedSource,\n * })\n */\n public plugin<const PluginId extends string, PluginData, PluginParams, PluginOutputs>(\n pluginId: PluginId,\n plugin: PluginModel<PluginData, PluginParams, PluginOutputs>,\n params?: ParamsInput<PluginParams, Args, Data>,\n ): BlockModelV3<\n Args,\n OutputsCfg,\n Data,\n Href,\n Plugins & { [K in PluginId]: PluginInstance<PluginData, PluginParams, PluginOutputs> }\n > {\n // Validate pluginId uniqueness\n if (pluginId in this.config.plugins) {\n throw new Error(`Plugin '${pluginId}' already registered`);\n }\n\n const instance: PluginInstance<PluginData, PluginParams, PluginOutputs> = {\n model: plugin,\n inputs: (params ?? {}) as ParamsInputErased,\n };\n\n return new BlockModelV3({\n ...this.config,\n plugins: {\n ...this.config.plugins,\n [pluginId]: instance,\n },\n });\n }\n\n /** Renders all provided block settings into a pre-configured platforma API\n * instance, that can be used in frontend to interact with block data, and\n * other features provided by the platforma to the block. */\n public done(): PlatformaExtended<\n PlatformaV3<Data, Args, InferOutputsFromLambdas<OutputsCfg>, Href, Plugins>\n > {\n return this.withFeatureFlags({\n ...this.config.featureFlags,\n })._done();\n }\n\n public _done(): PlatformaExtended<\n PlatformaV3<Data, Args, InferOutputsFromLambdas<OutputsCfg>, Href, Plugins>\n > {\n if (this.config.argsFunction === undefined) throw new Error(\"Args rendering function not set.\");\n\n const apiVersion = 3;\n\n // Build plugin registry\n const { plugins } = this.config;\n const pluginRegistry: Record<string, PluginName> = {};\n for (const [pluginId, { model }] of Object.entries(plugins)) {\n pluginRegistry[pluginId] = model.name;\n }\n\n const { dataModel, argsFunction, prerunArgsFunction } = this.config;\n\n function getPlugin(pluginId: string): PluginInstance {\n const plugin = plugins[pluginId];\n if (!plugin) throw new Error(`Plugin model not found for '${pluginId}'`);\n return plugin;\n }\n\n // Register ALL facade callbacks here, with dependencies captured via closures\n registerFacadeCallbacks({\n [BlockStorageFacadeCallbacks.StorageApplyUpdate]: applyStorageUpdate,\n [BlockStorageFacadeCallbacks.StorageDebugView]: getStorageDebugView,\n [BlockStorageFacadeCallbacks.StorageMigrate]: (currentStorageJson) =>\n migrateStorage(currentStorageJson, {\n migrateBlockData: (v) => dataModel.migrate(v),\n getPluginRegistry: () => pluginRegistry,\n migratePluginData: (pluginId, v) => getPlugin(pluginId).model.dataModel.migrate(v),\n createPluginData: (pluginId) => getPlugin(pluginId).model.dataModel.getDefaultData(),\n }),\n [BlockStorageFacadeCallbacks.StorageInitial]: () =>\n createInitialStorage({\n getDefaultBlockData: () => dataModel.getDefaultData(),\n getPluginRegistry: () => pluginRegistry,\n createPluginData: (pluginId) => getPlugin(pluginId).model.dataModel.getDefaultData(),\n }),\n [BlockStorageFacadeCallbacks.ArgsDerive]: (storageJson) =>\n deriveArgsFromStorage(storageJson, argsFunction),\n [BlockStorageFacadeCallbacks.PrerunArgsDerive]: (storageJson) =>\n derivePrerunArgsFromStorage(storageJson, argsFunction, prerunArgsFunction),\n });\n\n const blockConfig: BlockConfigContainer = {\n v4: {\n configVersion: 4,\n modelAPIVersion: BLOCK_STORAGE_FACADE_VERSION,\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n sections: this.config.sections,\n title: this.config.title,\n subtitle: this.config.subtitle,\n tags: this.config.tags,\n outputs: this.config.outputs,\n enrichmentTargets: this.config.enrichmentTargets,\n featureFlags: this.config.featureFlags,\n blockLifecycleCallbacks: { ...BlockStorageFacadeHandles },\n },\n\n // fields below are added to allow previous desktop versions read generated configs\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n sections: this.config.sections,\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n downgradeCfgOrLambda(value),\n ]),\n ),\n };\n\n globalThis.platformaApiVersion = apiVersion;\n\n if (!isInUI())\n // we are in the configuration rendering routine, not in actual UI\n return { config: blockConfig } as any;\n // normal operation inside the UI\n else\n return {\n ...getPlatformaInstance({\n sdkVersion: PlatformaSDKVersion,\n apiVersion,\n }),\n blockModelInfo: {\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n {\n withStatus: Boolean(isConfigLambda(value) && value.withStatus),\n },\n ]),\n ),\n },\n } as any;\n }\n}\n\n// Type tests for BlockModelV3\n\nexport type Expect<T extends true> = T;\n\nexport type Equal<X, Y> =\n (<T>() => T extends X ? 1 : 2) extends <T>() => T extends Y ? 1 : 2 ? true : false;\n\nexport type Merge<A, B> = {\n [K in keyof A | keyof B]: K extends keyof B ? B[K] : K extends keyof A ? A[K] : never;\n};\n\n// Helper types for testing\ntype _TestArgs = { inputFile: string; threshold: number };\ntype _TestData = { selectedTab: string };\ntype _TestOutputs = {\n result: ConfigRenderLambda<string>;\n count: ConfigRenderLambda<number>;\n};\n\n// Test: Merge type works correctly\ntype _MergeTest1 = Expect<Equal<Merge<{ a: 1 }, { b: 2 }>, { a: 1; b: 2 }>>;\ntype _MergeTest2 = Expect<Equal<Merge<{ a: 1 }, { a: 2 }>, { a: 2 }>>;\ntype _MergeTest3 = Expect<Equal<Merge<{ a: 1; b: 1 }, { b: 2; c: 3 }>, { a: 1; b: 2; c: 3 }>>;\n\n// Test: create() returns a BlockModelV3 instance\n// Note: Due to function overloads, ReturnType uses the last overload signature.\n// We verify the structure is correct using a simpler assignability test.\ntype _CreateResult = ReturnType<typeof BlockModelV3.create>;\ntype _CreateIsBlockModelV3 =\n _CreateResult extends BlockModelV3<infer _A, infer _O, infer _S> ? true : false;\ntype _CreateTest = Expect<_CreateIsBlockModelV3>;\n\n// Test: BlockModelV3Config interface structure\ntype _ConfigTest = Expect<\n Equal<\n BlockModelV3Config<_TestOutputs, _TestData>,\n {\n renderingMode: BlockRenderingMode;\n argsFunction: ((data: unknown) => unknown) | undefined;\n prerunArgsFunction: ((data: unknown) => unknown) | undefined;\n dataModel: DataModel<_TestData>;\n outputs: _TestOutputs;\n sections: ConfigRenderLambda;\n title: ConfigRenderLambda | undefined;\n subtitle: ConfigRenderLambda | undefined;\n tags: ConfigRenderLambda | undefined;\n enrichmentTargets: ConfigRenderLambda | undefined;\n featureFlags: BlockCodeKnownFeatureFlags;\n plugins: {};\n }\n >\n>;\n\n// Test: Default Href is '/'\ntype _HrefDefaultTest =\n BlockModelV3<_TestArgs, {}, _TestData> extends BlockModelV3<_TestArgs, {}, _TestData, \"/\">\n ? true\n : false;\ntype _VerifyHrefDefault = Expect<_HrefDefaultTest>;\n\n// Test: Custom Href can be specified\ntype _CustomHref = \"/settings\" | \"/main\";\ntype _HrefCustomBuilder = BlockModelV3<_TestArgs, {}, _TestData, _CustomHref>;\ntype _HrefCustomTest =\n _HrefCustomBuilder extends BlockModelV3<_TestArgs, {}, _TestData, _CustomHref> ? true : false;\ntype _VerifyHrefCustom = Expect<_HrefCustomTest>;\n\n// Test: Output type accumulation with & intersection\ntype _OutputsAccumulation = { a: ConfigRenderLambda<string> } & {\n b: ConfigRenderLambda<number>;\n};\ntype _VerifyOutputsHaveKeys = Expect<Equal<keyof _OutputsAccumulation, \"a\" | \"b\">>;\n\n// Test: Builder with all type parameters specified compiles\ntype _FullBuilder = BlockModelV3<_TestArgs, _TestOutputs, _TestData, \"/main\">;\ntype _FullBuilderTest =\n _FullBuilder extends BlockModelV3<_TestArgs, _TestOutputs, _TestData, \"/main\"> ? true : false;\ntype _VerifyFullBuilder = Expect<_FullBuilderTest>;\n\n// Test: InferOutputsFromLambdas maps outputs correctly\ntype _InferOutputsTest = InferOutputsFromLambdas<{\n myOutput: ConfigRenderLambda<number>;\n}>;\ntype _VerifyInferOutputs = Expect<\n Equal<_InferOutputsTest, { myOutput: OutputWithStatus<number> & { __unwrap: true } }>\n>;\n"],"names":[],"mappings":";;;;;;;;;;;AAqFA;;;AAGiD;MACpC,YAAY,CAAA;AAOc,IAAA,MAAA;AAArC,IAAA,WAAA,CAAqC,MAAqD,EAAA;QAArD,IAAA,CAAA,MAAM,GAAN,MAAM;IAAkD;IAEtF,OAAgB,2BAA2B,GAA+B;AAC/E,QAAA,iBAAiB,EAAE,IAAI;AACvB,QAAA,oBAAoB,EAAE,CAAC;AACvB,QAAA,uBAAuB,EAAE,4BAA4B;AACrD,QAAA,oBAAoB,EAAE,CAAC;KACxB;AAED;;;;;;;;;;;;;;AAcG;IACI,OAAO,MAAM,CAClB,SAA0B,EAAA;QAE1B,OAAO,IAAI,YAAY,CAAiB;AACtC,YAAA,aAAa,EAAE,OAAO;YACtB,SAAS;AACT,YAAA,OAAO,EAAE,EAAE;;AAEX,YAAA,QAAQ,EAAE,6BAA6B,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,CAAC;AACvF,YAAA,KAAK,EAAE,SAA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AA;;AAGD,YAAA,UAAU,EAAE,mBAAmB;AAC/B,YAAA,aAAa,EAAE,IAAI,CAAC,MAAM,CAAC,aAAa;AACxC,YAAA,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;YAC9B,OAAO,EAAE,MAAM,CAAC,WAAW,CACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;gBACxD,GAAG;gBACH,oBAAoB,CAAC,KAAK,CAAC;AAC5B,aAAA,CAAC,CACH;SACF;AAED,QAAA,UAAU,CAAC,mBAAmB,GAAG,UAAU;QAE3C,IAAI,CAAC,MAAM,EAAE;;AAEX,YAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAS;;;YAGrC,OAAO;AACL,gBAAA,GAAG,oBAAoB,CAAC;AACtB,oBAAA,UAAU,EAAE,mBAAmB;oBAC/B,UAAU;iBACX,CAAC;AACF,gBAAA,cAAc,EAAE;oBACd,OAAO,EAAE,MAAM,CAAC,WAAW,CACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;wBACxD,GAAG;AACH,wBAAA;4BACE,UAAU,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC;AAC/D,yBAAA;AACF,qBAAA,CAAC,CACH;AACF,iBAAA;aACK;IACZ;;;;;"}
|
|
@@ -23,7 +23,7 @@ class BlockModel {
|
|
|
23
23
|
supportsLazyState: true,
|
|
24
24
|
requiresUIAPIVersion: 1,
|
|
25
25
|
requiresModelAPIVersion: 1,
|
|
26
|
-
|
|
26
|
+
requiresCreatePTable: 2,
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
static create(renderingMode = "Heavy") {
|
|
@@ -255,4 +255,4 @@ class BlockModel {
|
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
exports.BlockModel = BlockModel;
|
|
258
|
-
//# sourceMappingURL=
|
|
258
|
+
//# sourceMappingURL=block_model_legacy.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"block_model_legacy.cjs","sources":["../src/block_model_legacy.ts"],"sourcesContent":["import type {\n BlockRenderingMode,\n BlockSection,\n AnyFunction,\n PlRef,\n BlockCodeKnownFeatureFlags,\n BlockConfigContainer,\n} from \"@milaboratories/pl-model-common\";\nimport type { Checked, ConfigResult, TypedConfig } from \"./config\";\nimport { getImmediate } from \"./config\";\nimport { getPlatformaInstance, isInUI, tryRegisterCallback } from \"./internal\";\nimport type { Platforma, PlatformaApiVersion, PlatformaV1, PlatformaV2 } from \"./platforma\";\nimport type { InferRenderFunctionReturn, RenderFunctionLegacy } from \"./render\";\nimport { RenderCtxLegacy } from \"./render\";\nimport { PlatformaSDKVersion } from \"./version\";\nimport type {\n TypedConfigOrConfigLambda,\n ConfigRenderLambda,\n StdCtxArgsOnly,\n DeriveHref,\n ConfigRenderLambdaFlags,\n InferOutputsFromConfigs,\n} from \"./bconfig\";\nimport { downgradeCfgOrLambda, isConfigLambda } from \"./bconfig\";\nimport type { PlatformaExtended } from \"./platforma\";\n\ntype SectionsExpectedType = readonly BlockSection[];\n\ntype SectionsCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends SectionsExpectedType ? true : false\n>;\n\ntype InputsValidExpectedType = boolean;\n\ntype InputsValidCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends InputsValidExpectedType ? true : false\n>;\n\ntype NoOb = Record<string, never>;\n\n/** Main entry point that each block should use in it's \"config\" module. Don't forget\n * to call {@link done()} at the end of configuration. Value returned by this builder must be\n * exported as constant with name \"platforma\" from the \"config\" module. */\nexport class BlockModel<\n Args,\n OutputsCfg extends Record<string, TypedConfigOrConfigLambda>,\n UiState,\n Href extends `/${string}` = \"/\",\n> {\n private constructor(\n private config: {\n readonly renderingMode: BlockRenderingMode;\n readonly initialArgs?: Args;\n readonly initialUiState: UiState;\n readonly outputs: OutputsCfg;\n readonly inputsValid: TypedConfigOrConfigLambda;\n readonly sections: TypedConfigOrConfigLambda;\n readonly title?: ConfigRenderLambda;\n readonly subtitle?: ConfigRenderLambda;\n readonly tags?: ConfigRenderLambda;\n readonly enrichmentTargets?: ConfigRenderLambda;\n readonly featureFlags: BlockCodeKnownFeatureFlags;\n },\n ) {}\n\n public static get INITIAL_BLOCK_FEATURE_FLAGS(): BlockCodeKnownFeatureFlags {\n return {\n supportsLazyState: true,\n requiresUIAPIVersion: 1,\n requiresModelAPIVersion: 1,\n requiresCreatePTable: 2,\n };\n }\n\n /** Initiates configuration builder */\n public static create(renderingMode: BlockRenderingMode): BlockModel<NoOb, {}, NoOb>;\n /** Initiates configuration builder */\n public static create(): BlockModel<NoOb, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(renderingMode: BlockRenderingMode): BlockModel<Args, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(): BlockModel<Args, {}, NoOb>;\n public static create(renderingMode: BlockRenderingMode = \"Heavy\"): BlockModel<NoOb, {}, NoOb> {\n return new BlockModel<NoOb, {}, NoOb>({\n renderingMode,\n initialUiState: {},\n outputs: {},\n inputsValid: getImmediate(true),\n sections: getImmediate([]),\n featureFlags: BlockModel.INITIAL_BLOCK_FEATURE_FLAGS,\n });\n }\n\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param cfg configuration describing how to render cell value from the blocks\n * workflow outputs\n * @deprecated use lambda-based API\n * */\n public output<const Key extends string, const Cfg extends TypedConfig>(\n key: Key,\n cfg: Cfg,\n ): BlockModel<Args, OutputsCfg & { [K in Key]: Cfg }, UiState, Href>;\n /**\n * Add output cell wrapped with additional status information to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags: ConfigRenderLambdaFlags & { withStatus: true },\n ): BlockModel<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & { withStatus: true };\n },\n UiState,\n Href\n >;\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags?: ConfigRenderLambdaFlags,\n ): BlockModel<\n Args,\n OutputsCfg & { [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> },\n UiState,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: TypedConfig | AnyFunction,\n flags: ConfigRenderLambdaFlags = {},\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n if (typeof cfgOrRf === \"function\") {\n const handle = `output#${key}`;\n tryRegisterCallback(handle, () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: {\n __renderLambda: true,\n handle,\n ...flags,\n },\n },\n });\n } else {\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: cfgOrRf,\n },\n });\n }\n }\n\n /** Shortcut for {@link output} with retentive flag set to true. */\n public retentiveOutput<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true });\n }\n\n /** Shortcut for {@link output} with withStatus flag set to true. */\n public outputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { withStatus: true });\n }\n\n /** Shortcut for {@link output} with retentive and withStatus flags set to true. */\n public retentiveOutputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true, withStatus: true });\n }\n\n /** Sets custom configuration predicate on the block args at which block can be executed\n * @deprecated use lambda-based API */\n public argsValid<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n /** Sets custom configuration predicate on the block args at which block can be executed */\n public argsValid<RF extends RenderFunctionLegacy<Args, UiState, boolean>>(\n rf: RF,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public argsValid(\n cfgOrRf: TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (typeof cfgOrRf === \"function\") {\n tryRegisterCallback(\"inputsValid\", () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: {\n __renderLambda: true,\n handle: \"inputsValid\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: cfgOrRf,\n });\n }\n }\n\n /** Sets the config to generate list of section in the left block overviews panel\n * @deprecated use lambda-based API */\n public sections<const S extends SectionsExpectedType>(\n rf: S,\n ): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;\n /** Sets the config to generate list of section in the left block overviews panel */\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunctionLegacy<Args, UiState, Ret>,\n >(rf: RF): BlockModel<Args, OutputsCfg, UiState, DeriveHref<ReturnType<RF>>>;\n public sections<const Cfg extends TypedConfig>(\n cfg: Cfg & SectionsCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<\n Args,\n OutputsCfg,\n UiState,\n DeriveHref<ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>>>\n >;\n public sections(\n arrOrCfgOrRf: SectionsExpectedType | TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (Array.isArray(arrOrCfgOrRf)) {\n return this.sections(getImmediate(arrOrCfgOrRf));\n } else if (typeof arrOrCfgOrRf === \"function\") {\n tryRegisterCallback(\"sections\", () => arrOrCfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: {\n __renderLambda: true,\n handle: \"sections\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: arrOrCfgOrRf as TypedConfig,\n });\n }\n }\n\n /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */\n public title(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"title\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n title: {\n __renderLambda: true,\n handle: \"title\",\n },\n });\n }\n\n public subtitle(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"subtitle\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n subtitle: {\n __renderLambda: true,\n handle: \"subtitle\",\n },\n });\n }\n\n public tags(\n rf: RenderFunctionLegacy<Args, UiState, string[]>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"tags\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n tags: {\n __renderLambda: true,\n handle: \"tags\",\n },\n });\n }\n\n /**\n * Sets initial args for the block, this value must be specified.\n * @deprecated use {@link withArgs}\n * */\n public initialArgs(value: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return this.withArgs(value);\n }\n\n /** Sets initial args for the block, this value must be specified. */\n public withArgs<Args>(initialArgs: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialArgs,\n });\n }\n\n /** Defines type and sets initial value for block UiState. */\n public withUiState<UiState>(\n initialUiState: UiState,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialUiState,\n });\n }\n\n /** Sets or overrides feature flags for the block. */\n public withFeatureFlags(\n flags: Partial<BlockCodeKnownFeatureFlags>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n featureFlags: {\n ...this.config.featureFlags,\n ...flags,\n },\n });\n }\n\n /**\n * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.\n * Influences dependency graph construction.\n */\n public enriches(lambda: (args: Args) => PlRef[]): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"enrichmentTargets\", lambda);\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n enrichmentTargets: {\n __renderLambda: true,\n handle: \"enrichmentTargets\",\n },\n });\n }\n\n public done(\n apiVersion?: 1,\n ): PlatformaExtended<\n PlatformaV1<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n public done(\n apiVersion: 2,\n ): PlatformaExtended<\n PlatformaV2<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n /** Renders all provided block settings into a pre-configured platforma API\n * instance, that can be used in frontend to interact with block state, and\n * other features provided by the platforma to the block. */\n public done(\n apiVersion: PlatformaApiVersion = 1,\n ): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n return this.withFeatureFlags({\n ...this.config.featureFlags,\n requiresUIAPIVersion: apiVersion,\n }).#done();\n }\n\n #done(): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n if (this.config.initialArgs === undefined) throw new Error(\"Initial arguments not set.\");\n\n const config: BlockConfigContainer = {\n v4: undefined,\n v3: {\n configVersion: 3,\n modelAPIVersion: 1,\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n initialUiState: this.config.initialUiState,\n inputsValid: this.config.inputsValid,\n sections: this.config.sections,\n title: this.config.title,\n subtitle: this.config.subtitle,\n tags: this.config.tags,\n outputs: this.config.outputs,\n enrichmentTargets: this.config.enrichmentTargets,\n featureFlags: this.config.featureFlags,\n },\n\n // fields below are added to allow previous desktop versions read generated configs\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n inputsValid: downgradeCfgOrLambda(this.config.inputsValid),\n sections: downgradeCfgOrLambda(this.config.sections),\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n downgradeCfgOrLambda(value),\n ]),\n ),\n };\n\n globalThis.platformaApiVersion = this.config.featureFlags\n .requiresUIAPIVersion as PlatformaApiVersion;\n\n if (!isInUI())\n // we are in the configuration rendering routine, not in actual UI\n return { config } as any;\n // normal operation inside the UI\n else\n return {\n ...getPlatformaInstance({\n sdkVersion: PlatformaSDKVersion,\n apiVersion: platformaApiVersion,\n }),\n blockModelInfo: {\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n {\n withStatus: Boolean(isConfigLambda(value) && value.withStatus),\n },\n ]),\n ),\n },\n };\n }\n}\n"],"names":["getImmediate","tryRegisterCallback","RenderCtxLegacy","PlatformaSDKVersion","downgradeCfgOrLambda","isInUI","getPlatformaInstance","isConfigLambda"],"mappings":";;;;;;;;;;;;AA0CA;;A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B,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC;YAC1D,QAAQ,EAAEA,kCAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACpD,OAAO,EAAE,MAAM,CAAC,WAAW,CACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;gBACxD,GAAG;gBACHA,kCAAoB,CAAC,KAAK,CAAC;AAC5B,aAAA,CAAC,CACH;SACF;AAED,QAAA,UAAU,CAAC,mBAAmB,GAAG,IAAI,CAAC,MAAM,CAAC;AAC1C,aAAA,oBAA2C;QAE9C,IAAI,CAACC,eAAM,EAAE;;YAEX,OAAO,EAAE,MAAM,EAAS;;;YAGxB,OAAO;AACL,gBAAA,GAAGC,6BAAoB,CAAC;AACtB,oBAAA,UAAU,EAAEH,2BAAmB;AAC/B,oBAAA,UAAU,EAAE,mBAAmB;iBAChC,CAAC;AACF,gBAAA,cAAc,EAAE;oBACd,OAAO,EAAE,MAAM,CAAC,WAAW,CACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;wBACxD,GAAG;AACH,wBAAA;4BACE,UAAU,EAAE,OAAO,CAACI,oBAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC;AAC/D,yBAAA;AACF,qBAAA,CAAC,CACH;AACF,iBAAA;aACF;IACL;AACD;;;;"}
|
|
@@ -113,4 +113,4 @@ export declare class BlockModel<Args, OutputsCfg extends Record<string, TypedCon
|
|
|
113
113
|
done(apiVersion: 2): PlatformaExtended<PlatformaV2<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>>;
|
|
114
114
|
}
|
|
115
115
|
export {};
|
|
116
|
-
//# sourceMappingURL=
|
|
116
|
+
//# sourceMappingURL=block_model_legacy.d.ts.map
|