@platforma-sdk/model 1.81.1 → 1.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/bconfig/index.d.ts +2 -2
  2. package/dist/bconfig/lambdas.d.ts +2 -12
  3. package/dist/bconfig/lambdas.d.ts.map +1 -1
  4. package/dist/bconfig/v3.d.ts +1 -1
  5. package/dist/block_migrations.cjs +92 -8
  6. package/dist/block_migrations.cjs.map +1 -1
  7. package/dist/block_migrations.d.ts +121 -32
  8. package/dist/block_migrations.d.ts.map +1 -1
  9. package/dist/block_migrations.js +92 -8
  10. package/dist/block_migrations.js.map +1 -1
  11. package/dist/block_model.cjs +71 -17
  12. package/dist/block_model.cjs.map +1 -1
  13. package/dist/block_model.d.ts +58 -22
  14. package/dist/block_model.d.ts.map +1 -1
  15. package/dist/block_model.js +72 -18
  16. package/dist/block_model.js.map +1 -1
  17. package/dist/block_storage_callbacks.cjs +194 -13
  18. package/dist/block_storage_callbacks.cjs.map +1 -1
  19. package/dist/block_storage_callbacks.js +192 -15
  20. package/dist/block_storage_callbacks.js.map +1 -1
  21. package/dist/block_storage_facade.cjs +4 -1
  22. package/dist/block_storage_facade.cjs.map +1 -1
  23. package/dist/block_storage_facade.d.ts +102 -0
  24. package/dist/block_storage_facade.d.ts.map +1 -1
  25. package/dist/block_storage_facade.js +4 -1
  26. package/dist/block_storage_facade.js.map +1 -1
  27. package/dist/config/index.d.ts +2 -6
  28. package/dist/config/type_engine.d.ts +7 -28
  29. package/dist/config/type_engine.d.ts.map +1 -1
  30. package/dist/index.cjs +20 -60
  31. package/dist/index.d.ts +5 -11
  32. package/dist/index.js +4 -8
  33. package/dist/package.cjs +1 -1
  34. package/dist/package.js +1 -1
  35. package/dist/render/api.cjs +0 -22
  36. package/dist/render/api.cjs.map +1 -1
  37. package/dist/render/api.d.ts +1 -9
  38. package/dist/render/api.d.ts.map +1 -1
  39. package/dist/render/api.js +1 -22
  40. package/dist/render/api.js.map +1 -1
  41. package/dist/render/index.cjs +0 -1
  42. package/dist/render/index.d.ts +2 -2
  43. package/dist/render/index.js +2 -2
  44. package/package.json +10 -9
  45. package/src/bconfig/lambdas.ts +1 -25
  46. package/src/block_migrations.ts +205 -55
  47. package/src/block_model.ts +190 -59
  48. package/src/block_storage_callbacks.ts +294 -15
  49. package/src/block_storage_facade.ts +95 -0
  50. package/src/config/index.ts +0 -4
  51. package/src/config/type_engine.ts +6 -49
  52. package/src/index.ts +0 -2
  53. package/src/kind_reference.test.ts +134 -0
  54. package/src/render/api.ts +0 -32
  55. package/src/template_init.test.ts +413 -0
  56. package/src/template_params.test.ts +135 -0
  57. package/src/typing.test.ts +4 -143
  58. package/dist/block_model_legacy.cjs +0 -240
  59. package/dist/block_model_legacy.cjs.map +0 -1
  60. package/dist/block_model_legacy.d.ts +0 -115
  61. package/dist/block_model_legacy.d.ts.map +0 -1
  62. package/dist/block_model_legacy.js +0 -240
  63. package/dist/block_model_legacy.js.map +0 -1
  64. package/dist/config/actions.cjs +0 -232
  65. package/dist/config/actions.cjs.map +0 -1
  66. package/dist/config/actions.d.ts +0 -48
  67. package/dist/config/actions.d.ts.map +0 -1
  68. package/dist/config/actions.js +0 -201
  69. package/dist/config/actions.js.map +0 -1
  70. package/dist/config/actions_kinds.d.ts +0 -116
  71. package/dist/config/actions_kinds.d.ts.map +0 -1
  72. package/dist/config/index.cjs +0 -33
  73. package/dist/config/index.js +0 -2
  74. package/dist/config/model_meta.d.ts +0 -9
  75. package/dist/config/model_meta.d.ts.map +0 -1
  76. package/dist/config/type_util.d.ts +0 -14
  77. package/dist/config/type_util.d.ts.map +0 -1
  78. package/dist/ref_util.cjs +0 -21
  79. package/dist/ref_util.cjs.map +0 -1
  80. package/dist/ref_util.d.ts +0 -19
  81. package/dist/ref_util.d.ts.map +0 -1
  82. package/dist/ref_util.js +0 -20
  83. package/dist/ref_util.js.map +0 -1
  84. package/src/block_model_legacy.ts +0 -465
  85. package/src/config/actions.ts +0 -468
  86. package/src/config/actions_kinds.ts +0 -264
  87. package/src/config/model_meta.ts +0 -5
  88. package/src/config/type_util.ts +0 -25
  89. package/src/ref_util.ts +0 -17
@@ -0,0 +1,135 @@
1
+ import { describe, expect, expectTypeOf, test } from "vitest";
2
+ import type { PlRef } from "@milaboratories/pl-model-common";
3
+ import { createPlRef, stringifyJson } from "@milaboratories/pl-model-common";
4
+ import { createBlockStorage } from "./block_storage";
5
+ import { deriveTemplateParamsFromStorage } from "./block_storage_callbacks";
6
+ import { BlockModelV3 } from "./block_model";
7
+ import { DataModelBuilder } from "./block_migrations";
8
+ import { defineBlockKind } from "@platforma-sdk/block-kind";
9
+
10
+ // A kind whose params carry a reference — the case that exercises the rewrite.
11
+ type Params = { sources?: PlRef[]; label: string };
12
+
13
+ const kind = defineBlockKind<Params>({
14
+ name: "@platforma-open/milaboratories.demo.kind",
15
+ version: "1.0.0",
16
+ // These tests are about the export direction, so the parser only carries the shape
17
+ // through; rejection behaviour lives in `template_init.test.ts`.
18
+ parseInitializationParams: (value) => value as Params,
19
+ });
20
+
21
+ type BlockData = { sources: PlRef[]; label: string; scratch: number };
22
+
23
+ const dataModel = new DataModelBuilder({ kind }).from<BlockData>("v1").init(({ params }) => ({
24
+ sources: params?.sources ?? [],
25
+ label: params?.label ?? "",
26
+ // Derived/runtime state — must NOT survive into a template entry.
27
+ scratch: 0,
28
+ }));
29
+
30
+ const upstream = "3f1c2b7a-0000-4000-8000-000000000001";
31
+
32
+ const storageOf = (data: BlockData) => stringifyJson(createBlockStorage(data));
33
+
34
+ describe("deriveTemplateParamsFromStorage", () => {
35
+ test("projects data back to params, untouched", () => {
36
+ const result = deriveTemplateParamsFromStorage(
37
+ storageOf({ sources: [createPlRef(upstream, "reads")], label: "run 1", scratch: 42 }),
38
+ (data) => {
39
+ const d = data as BlockData;
40
+ return { sources: d.sources, label: d.label };
41
+ },
42
+ );
43
+
44
+ // `scratch` is dropped because the lambda does not return it. Everything the lambda DID
45
+ // return is written exactly as it is: the reference is not marked, normalized or rewritten
46
+ // on the way out, because pointing it at another project is the receiving block's job, on
47
+ // the way back in.
48
+ expect(result).toEqual({
49
+ value: { sources: [createPlRef(upstream, "reads")], label: "run 1" },
50
+ });
51
+ });
52
+
53
+ test("a block with nothing to project yields empty params, not absent ones", () => {
54
+ // Every block declares the lambda, so there is no "no params" outcome to test for.
55
+ // A block whose state carries nothing worth restoring returns `{}`, and `{}` is what
56
+ // gets written — the entry is still checked against the kind on the way back in.
57
+ expect(
58
+ deriveTemplateParamsFromStorage(
59
+ storageOf({ sources: [], label: "", scratch: 0 }),
60
+ () => ({}),
61
+ ),
62
+ ).toEqual({ value: {} });
63
+ });
64
+
65
+ test("a throwing lambda is reported, not propagated", () => {
66
+ const result = deriveTemplateParamsFromStorage(
67
+ storageOf({ sources: [], label: "", scratch: 0 }),
68
+ () => {
69
+ throw new Error("not exportable yet");
70
+ },
71
+ );
72
+
73
+ expect(result).toEqual({ error: "templateParams() threw: not exportable yet" });
74
+ });
75
+ });
76
+
77
+ describe("BlockModelV3.templateParams", () => {
78
+ test("the lambda's return type is the kind's params", () => {
79
+ const model = BlockModelV3.create({ dataModel, kind })
80
+ .args((data) => ({ label: data.label }))
81
+ .templateParams((data) => ({ sources: data.sources, label: data.label }));
82
+
83
+ expectTypeOf(model.templateParams).parameter(0).toEqualTypeOf<(data: BlockData) => Params>();
84
+ });
85
+
86
+ test("a projection that drifts from the kind's params does not compile", () => {
87
+ const builder = BlockModelV3.create({ dataModel, kind }).args((data) => ({
88
+ label: data.label,
89
+ }));
90
+
91
+ // @ts-expect-error - `label` is required by Params
92
+ builder.templateParams((data) => ({ sources: data.sources }));
93
+ // @ts-expect-error - wrong type for a declared param
94
+ builder.templateParams(() => ({ label: 42 }));
95
+ });
96
+
97
+ test("KNOWN HOLE: an extra field the kind does not declare is not rejected", () => {
98
+ const builder = BlockModelV3.create({ dataModel, kind }).args((data) => ({
99
+ label: data.label,
100
+ }));
101
+
102
+ // No `@ts-expect-error` here, and that is the point: TypeScript does not
103
+ // apply excess-property checks to an object literal returned from a
104
+ // contextually-typed arrow, so `scratch` type-checks and would be written
105
+ // into the exported file. The kind's parser does not catch it either — that runs
106
+ // on params coming IN, and nothing runs on what the projection hands back. The
107
+ // asymmetry is real: such a file is written happily and rejected on re-import by
108
+ // the same kind that would have caught it here. This test pins current behaviour.
109
+ builder.templateParams((data) => ({
110
+ label: data.label,
111
+ sources: data.sources,
112
+ scratch: data.scratch,
113
+ }));
114
+ });
115
+
116
+ test("a model that declares it builds", () => {
117
+ expect(() =>
118
+ BlockModelV3.create({ dataModel, kind })
119
+ .args((data) => ({ label: data.label }))
120
+ .templateParams((data) => ({ sources: data.sources, label: data.label }))
121
+ .done(),
122
+ ).not.toThrow();
123
+ });
124
+
125
+ test("a model that omits it does not build", () => {
126
+ // The projection is not optional. Without this gate a block exports an entry with
127
+ // no params, which applies as a default-initialized block that looks restored — so
128
+ // the failure has to land on whoever wrote the model, at build.
129
+ expect(() =>
130
+ BlockModelV3.create({ dataModel, kind })
131
+ .args((data) => ({ label: data.label }))
132
+ .done(),
133
+ ).toThrow(/templateParams\(\) not set/);
134
+ });
135
+ });
@@ -1,34 +1,6 @@
1
- import {
2
- BlockSection,
3
- LocalBlobHandleAndSize,
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("test config content", () => {
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
@@ -1 +0,0 @@
1
- {"version":3,"file":"block_model_legacy.cjs","names":["REQUIRES_PFRAMES_VERSION","getImmediate","RenderCtxLegacy","#done","PlatformaSDKVersion","downgradeCfgOrLambda","isInUI","getPlatformaInstance","isConfigLambda"],"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 { REQUIRES_PFRAMES_VERSION } 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 supportsPframeQueryRanking: true,\n requiresUIAPIVersion: 1,\n requiresModelAPIVersion: 1,\n requiresCreatePTable: 2,\n requiresPFramesVersion: REQUIRES_PFRAMES_VERSION,\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 } else {\n // normal operation inside the UI\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 pluginIds: [],\n featureFlags: this.config.featureFlags,\n pluginPublicOutputs: {},\n },\n };\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA8CA,IAAa,aAAb,MAAa,WAKX;CAEU;CADV,YACE,QAaA;EAbQ,KAAA,SAAA;CAaP;CAEH,WAAkB,8BAA0D;EAC1E,OAAO;GACL,mBAAmB;GACnB,4BAA4B;GAC5B,sBAAsB;GACtB,yBAAyB;GACzB,sBAAsB;GACtB,wBAAwBA,gCAAAA;EAC1B;CACF;CAgBA,OAAc,OAAO,gBAAoC,SAAqC;EAC5F,OAAO,IAAI,WAA2B;GACpC;GACA,gBAAgB,CAAC;GACjB,SAAS,CAAC;GACV,aAAaC,gBAAAA,aAAa,IAAI;GAC9B,UAAUA,gBAAAA,aAAa,CAAC,CAAC;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