@milaboratories/pl-model-common 1.23.0 → 1.24.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,4 +21,13 @@ export type BlockState<Args = unknown, Outputs extends BlockOutputsBase = BlockO
21
21
  navigationState: NavigationState<Href>;
22
22
  readonly author: AuthorMarker | undefined;
23
23
  };
24
+ export type BlockStateV3<Outputs extends BlockOutputsBase = BlockOutputsBase, _Data = unknown, Href extends `/${string}` = `/${string}`> = {
25
+ /** Block storage persisted in the block state */
26
+ blockStorage: unknown;
27
+ /** Outputs rendered with block config */
28
+ outputs: Outputs;
29
+ /** Current navigation state */
30
+ navigationState: NavigationState<Href>;
31
+ readonly author: AuthorMarker | undefined;
32
+ };
24
33
  //# sourceMappingURL=block_state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"block_state.d.ts","sourceRoot":"","sources":["../src/block_state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CACpB,IAAI,GAAG,OAAO,EACd,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,OAAO,GAAG,OAAO,EACjB,IAAI,SAAS,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,IACtC;IACF,6CAA6C;IAC7C,IAAI,EAAE,IAAI,CAAC;IAEX;kBACc;IACd,EAAE,EAAE,OAAO,CAAC;IAEZ,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IAEjB,+BAA+B;IAC/B,eAAe,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAEvC,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;CAC3C,CAAC"}
1
+ {"version":3,"file":"block_state.d.ts","sourceRoot":"","sources":["../src/block_state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEpD;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,CACpB,IAAI,GAAG,OAAO,EACd,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,OAAO,GAAG,OAAO,EACjB,IAAI,SAAS,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,IACtC;IACF,6CAA6C;IAC7C,IAAI,EAAE,IAAI,CAAC;IAEX;kBACc;IACd,EAAE,EAAE,OAAO,CAAC;IAEZ,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IAEjB,+BAA+B;IAC/B,eAAe,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAEvC,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;CAC3C,CAAC;AAEF,MAAM,MAAM,YAAY,CACtB,OAAO,SAAS,gBAAgB,GAAG,gBAAgB,EACnD,KAAK,GAAG,OAAO,EACf,IAAI,SAAS,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,IACtC;IACF,iDAAiD;IACjD,YAAY,EAAE,OAAO,CAAC;IAEtB,yCAAyC;IACzC,OAAO,EAAE,OAAO,CAAC;IAEjB,+BAA+B;IAC/B,eAAe,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC;IAEvC,QAAQ,CAAC,MAAM,EAAE,YAAY,GAAG,SAAS,CAAC;CAC3C,CAAC"}
@@ -3,7 +3,7 @@
3
3
  // TODO BroadActiveHandleDescriptor must be removed
4
4
  function extractCodeWithInfo(cfg) {
5
5
  if (cfg.code === undefined)
6
- throw new Error('No code bundle');
6
+ throw new Error('extractCodeWithInfo: No code bundle');
7
7
  return {
8
8
  code: cfg.code,
9
9
  sdkVersion: cfg.sdkVersion,
@@ -1 +1 @@
1
- {"version":3,"file":"block_config.cjs","sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from '../flags';\nimport type { BlockCodeWithInfo, Code } from './code';\nimport type { BlockRenderingMode } from './types';\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo {\n if (cfg.code === undefined) throw new Error('No code bundle');\n return {\n code: cfg.code,\n sdkVersion: cfg.sdkVersion,\n featureFlags: cfg.featureFlags,\n };\n}\n"],"names":[],"mappings":";;AAAA;AAmEM,SAAU,mBAAmB,CAAC,GAAyB,EAAA;AAC3D,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC;IAC7D,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,YAAY,EAAE,GAAG,CAAC,YAAY;KAC/B;AACH;;;;"}
1
+ {"version":3,"file":"block_config.cjs","sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from '../flags';\nimport type { BlockCodeWithInfo, Code } from './code';\nimport type { BlockRenderingMode } from './types';\n\n/**\n * Descriptor for a state migration function.\n * Unlike ConfigRenderLambda, migrations are not rendered reactively -\n * they are one-time synchronous transformations called during block pack updates.\n */\nexport type MigrationDescriptor = {\n /** Index of this migration in the migrations callback array */\n readonly index: number;\n};\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV4Generic<\n _Args = unknown,\n _Data extends Record<string, unknown> = Record<string, unknown>,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** Discriminator to identify config version */\n readonly configVersion: 4;\n\n readonly modelAPIVersion: 2;\n\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Lambda to derive block args from state */\n readonly args: NarrowActiveHandleDescriptor;\n\n /**\n * Lambda to derive prerun args from state (optional).\n * If not defined, defaults to using the args() result.\n * Used for staging/prerun phase.\n */\n readonly prerunArgs?: NarrowActiveHandleDescriptor;\n\n /** Lambda to get initial data when block is added to the project */\n readonly initialData: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive list of sections for the left overview panel */\n readonly sections: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n * */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /**\n * Array of migration descriptors for state version upgrades.\n * Each migration transforms state from version N to N+1.\n * Migrations are NOT rendered reactively - they run synchronously during block pack updates.\n */\n readonly migrations?: MigrationDescriptor[];\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** Discriminator to identify config version */\n readonly configVersion: 3;\n\n readonly modelAPIVersion: 1;\n\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic | BlockConfigV4Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigGeneric): BlockCodeWithInfo {\n if (cfg.code === undefined) throw new Error('extractCodeWithInfo: No code bundle');\n return {\n code: cfg.code,\n sdkVersion: cfg.sdkVersion,\n featureFlags: cfg.featureFlags,\n };\n}\n"],"names":[],"mappings":";;AAAA;AAwJM,SAAU,mBAAmB,CAAC,GAAuB,EAAA;AACzD,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC;IAClF,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,YAAY,EAAE,GAAG,CAAC,YAAY;KAC/B;AACH;;;;"}
@@ -1,11 +1,71 @@
1
1
  import type { BlockCodeFeatureFlags } from '../flags';
2
2
  import type { BlockCodeWithInfo, Code } from './code';
3
3
  import type { BlockRenderingMode } from './types';
4
+ /**
5
+ * Descriptor for a state migration function.
6
+ * Unlike ConfigRenderLambda, migrations are not rendered reactively -
7
+ * they are one-time synchronous transformations called during block pack updates.
8
+ */
9
+ export type MigrationDescriptor = {
10
+ /** Index of this migration in the migrations callback array */
11
+ readonly index: number;
12
+ };
13
+ /**
14
+ * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,
15
+ * NarrowActiveHandleDescriptor = ConfigRenderLambda
16
+ */
17
+ export type BlockConfigV4Generic<_Args = unknown, _Data extends Record<string, unknown> = Record<string, unknown>, BroadActiveHandleDescriptor = unknown, NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor, Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>> = {
18
+ /** Discriminator to identify config version */
19
+ readonly configVersion: 4;
20
+ readonly modelAPIVersion: 2;
21
+ /** SDK version used by the block */
22
+ readonly sdkVersion: string;
23
+ /** Main rendering mode for the block */
24
+ readonly renderingMode: BlockRenderingMode;
25
+ /** Lambda to derive block args from state */
26
+ readonly args: NarrowActiveHandleDescriptor;
27
+ /**
28
+ * Lambda to derive prerun args from state (optional).
29
+ * If not defined, defaults to using the args() result.
30
+ * Used for staging/prerun phase.
31
+ */
32
+ readonly prerunArgs?: NarrowActiveHandleDescriptor;
33
+ /** Lambda to get initial data when block is added to the project */
34
+ readonly initialData: NarrowActiveHandleDescriptor;
35
+ /** Lambda to derive list of sections for the left overview panel */
36
+ readonly sections: NarrowActiveHandleDescriptor;
37
+ /** Lambda to derive block title */
38
+ readonly title?: NarrowActiveHandleDescriptor;
39
+ /** Lambda to derive block subtitle, shown below the title */
40
+ readonly subtitle?: NarrowActiveHandleDescriptor;
41
+ /** Lambda returning array of tags for search functionality */
42
+ readonly tags?: BroadActiveHandleDescriptor;
43
+ /**
44
+ * Lambda returning list of upstream blocks this block enriches with its exports,
45
+ * influences dependency graph construction
46
+ * */
47
+ readonly enrichmentTargets?: NarrowActiveHandleDescriptor;
48
+ /** Configuration for the output cells */
49
+ readonly outputs: Outputs;
50
+ /**
51
+ * Array of migration descriptors for state version upgrades.
52
+ * Each migration transforms state from version N to N+1.
53
+ * Migrations are NOT rendered reactively - they run synchronously during block pack updates.
54
+ */
55
+ readonly migrations?: MigrationDescriptor[];
56
+ /** Config code bundle */
57
+ readonly code?: Code;
58
+ /** Feature flags for the block Model and UI code. */
59
+ readonly featureFlags?: BlockCodeFeatureFlags;
60
+ };
4
61
  /**
5
62
  * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,
6
63
  * NarrowActiveHandleDescriptor = ConfigRenderLambda
7
64
  */
8
65
  export type BlockConfigV3Generic<Args = unknown, UiState = unknown, BroadActiveHandleDescriptor = unknown, NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor, Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>> = {
66
+ /** Discriminator to identify config version */
67
+ readonly configVersion: 3;
68
+ readonly modelAPIVersion: 1;
9
69
  /** SDK version used by the block */
10
70
  readonly sdkVersion: string;
11
71
  /** Main rendering mode for the block */
@@ -41,6 +101,6 @@ export type BlockConfigV3Generic<Args = unknown, UiState = unknown, BroadActiveH
41
101
  /** Feature flags for the block Model and UI code. */
42
102
  readonly featureFlags?: BlockCodeFeatureFlags;
43
103
  };
44
- export type BlockConfigGeneric = BlockConfigV3Generic;
45
- export declare function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo;
104
+ export type BlockConfigGeneric = BlockConfigV3Generic | BlockConfigV4Generic;
105
+ export declare function extractCodeWithInfo(cfg: BlockConfigGeneric): BlockCodeWithInfo;
46
106
  //# sourceMappingURL=block_config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"block_config.d.ts","sourceRoot":"","sources":["../../src/bmodel/block_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM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c,EAAE,OAAO,CAAC;IAEjC;;;;;OAKG;IACH,QAAQ,CAAC,WAAW,EAAE,2BAA2B,CAAC;IAElD,0EAA0E;IAC1E,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;IAE/C,mCAAmC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,4BAA4B,CAAC;IAE9C,6DAA6D;IAC7D,QAAQ,CAAC,QAAQ,CAAC,EAAE,4BAA4B,CAAC;IAEjD,8DAA8D;IAC9D,QAAQ,CAAC,IAAI,CAAC,EAAE,2BAA2B,CAAC;IAE5C;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,4BAA4B,CAAC;IAE1D,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAE1B,yBAAyB;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IAErB,qDAAqD;IACrD,QAAQ,CAAC,YAAY,CAAC,EAAE,qBAAqB,CAAC;CAC/C,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,GAAG,oBAAoB,CAAC;AAE7E,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,kBAAkB,GAAG,iBAAiB,CAO9E"}
@@ -1,7 +1,7 @@
1
1
  // TODO BroadActiveHandleDescriptor must be removed
2
2
  function extractCodeWithInfo(cfg) {
3
3
  if (cfg.code === undefined)
4
- throw new Error('No code bundle');
4
+ throw new Error('extractCodeWithInfo: No code bundle');
5
5
  return {
6
6
  code: cfg.code,
7
7
  sdkVersion: cfg.sdkVersion,
@@ -1 +1 @@
1
- {"version":3,"file":"block_config.js","sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from '../flags';\nimport type { BlockCodeWithInfo, Code } from './code';\nimport type { BlockRenderingMode } from './types';\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigV3Generic): BlockCodeWithInfo {\n if (cfg.code === undefined) throw new Error('No code bundle');\n return {\n code: cfg.code,\n sdkVersion: cfg.sdkVersion,\n featureFlags: cfg.featureFlags,\n };\n}\n"],"names":[],"mappings":"AAAA;AAmEM,SAAU,mBAAmB,CAAC,GAAyB,EAAA;AAC3D,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC;IAC7D,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,YAAY,EAAE,GAAG,CAAC,YAAY;KAC/B;AACH;;;;"}
1
+ {"version":3,"file":"block_config.js","sources":["../../src/bmodel/block_config.ts"],"sourcesContent":["// TODO BroadActiveHandleDescriptor must be removed\n\nimport type { BlockCodeFeatureFlags } from '../flags';\nimport type { BlockCodeWithInfo, Code } from './code';\nimport type { BlockRenderingMode } from './types';\n\n/**\n * Descriptor for a state migration function.\n * Unlike ConfigRenderLambda, migrations are not rendered reactively -\n * they are one-time synchronous transformations called during block pack updates.\n */\nexport type MigrationDescriptor = {\n /** Index of this migration in the migrations callback array */\n readonly index: number;\n};\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV4Generic<\n _Args = unknown,\n _Data extends Record<string, unknown> = Record<string, unknown>,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** Discriminator to identify config version */\n readonly configVersion: 4;\n\n readonly modelAPIVersion: 2;\n\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Lambda to derive block args from state */\n readonly args: NarrowActiveHandleDescriptor;\n\n /**\n * Lambda to derive prerun args from state (optional).\n * If not defined, defaults to using the args() result.\n * Used for staging/prerun phase.\n */\n readonly prerunArgs?: NarrowActiveHandleDescriptor;\n\n /** Lambda to get initial data when block is added to the project */\n readonly initialData: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive list of sections for the left overview panel */\n readonly sections: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n * */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /**\n * Array of migration descriptors for state version upgrades.\n * Each migration transforms state from version N to N+1.\n * Migrations are NOT rendered reactively - they run synchronously during block pack updates.\n */\n readonly migrations?: MigrationDescriptor[];\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\n/**\n * BroadActiveHandleDescriptor = TypedConfigOrConfigLambda,\n * NarrowActiveHandleDescriptor = ConfigRenderLambda\n */\nexport type BlockConfigV3Generic<\n Args = unknown,\n UiState = unknown,\n BroadActiveHandleDescriptor = unknown,\n NarrowActiveHandleDescriptor extends BroadActiveHandleDescriptor = BroadActiveHandleDescriptor,\n Outputs extends Record<string, BroadActiveHandleDescriptor> = Record<string, BroadActiveHandleDescriptor>,\n> = {\n /** Discriminator to identify config version */\n readonly configVersion: 3;\n\n readonly modelAPIVersion: 1;\n\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** Initial value for the args when block is added to the project */\n readonly initialUiState: UiState;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n */\n readonly inputsValid: BroadActiveHandleDescriptor;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: BroadActiveHandleDescriptor;\n\n /** Lambda to derive block title */\n readonly title?: NarrowActiveHandleDescriptor;\n\n /** Lambda to derive block subtitle, shown below the title */\n readonly subtitle?: NarrowActiveHandleDescriptor;\n\n /** Lambda returning array of tags for search functionality */\n readonly tags?: BroadActiveHandleDescriptor;\n\n /**\n * Lambda returning list of upstream blocks this block enriches with its exports,\n * influences dependency graph construction\n */\n readonly enrichmentTargets?: NarrowActiveHandleDescriptor;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n\n /** Feature flags for the block Model and UI code. */\n readonly featureFlags?: BlockCodeFeatureFlags;\n};\n\nexport type BlockConfigGeneric = BlockConfigV3Generic | BlockConfigV4Generic;\n\nexport function extractCodeWithInfo(cfg: BlockConfigGeneric): BlockCodeWithInfo {\n if (cfg.code === undefined) throw new Error('extractCodeWithInfo: No code bundle');\n return {\n code: cfg.code,\n sdkVersion: cfg.sdkVersion,\n featureFlags: cfg.featureFlags,\n };\n}\n"],"names":[],"mappings":"AAAA;AAwJM,SAAU,mBAAmB,CAAC,GAAuB,EAAA;AACzD,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC;IAClF,OAAO;QACL,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,UAAU,EAAE,GAAG,CAAC,UAAU;QAC1B,YAAY,EAAE,GAAG,CAAC,YAAY;KAC/B;AACH;;;;"}
@@ -1,10 +1,11 @@
1
- import type { BlockConfigV3Generic } from './block_config';
1
+ import type { BlockConfigV3Generic, BlockConfigV4Generic } from './block_config';
2
2
  import type { Code } from './code';
3
3
  import type { BlockRenderingMode } from './types';
4
4
  /** Container simplifying maintenance of forward and backward compatibility */
5
5
  export type BlockConfigContainer = {
6
+ readonly v4?: Omit<BlockConfigV4Generic, 'code'>;
6
7
  /** Actual config */
7
- readonly v3: Omit<BlockConfigV3Generic, 'code'>;
8
+ readonly v3?: Omit<BlockConfigV3Generic, 'code'>;
8
9
  /** Config code bundle. Actually is required, but we keep it optional for backward compatibility */
9
10
  readonly code?: Code;
10
11
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/bmodel/container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,oBAAoB;IACpB,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAEhD,mGAAmG;IACnG,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IAMrB;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAE5C;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C,CAAC"}
1
+ {"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/bmodel/container.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjF,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,8EAA8E;AAC9E,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IACjD,oBAAoB;IACpB,QAAQ,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAEjD,mGAAmG;IACnG,QAAQ,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;IAMrB;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAE5C;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;IAE/B;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAE5B;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC5C,CAAC"}
@@ -10,15 +10,38 @@ function upgradeCfgOrLambda(data) {
10
10
  /**
11
11
  * Takes universal config, and converts it into latest config structure.
12
12
  *
13
- * **Important**: This operation is not meant to be executed recusively.
13
+ * **Important**: This operation is not meant to be executed recursively.
14
14
  * In no circumstance result of this function should be persisted!
15
15
  * */
16
16
  function extractConfigGeneric(cfg) {
17
- if (cfg.v3 !== undefined) {
18
- // version 3
17
+ if (cfg.v4 !== undefined) {
18
+ // version 4 (BlockModelV3) - inputsValid is derived from args() success/failure
19
+ const { args, prerunArgs, initialData, outputs, renderingMode, sdkVersion, featureFlags, sections, title, enrichmentTargets, migrations } = cfg.v4;
20
+ const { code } = cfg;
21
+ return {
22
+ configVersion: 4,
23
+ modelAPIVersion: 2,
24
+ args,
25
+ prerunArgs,
26
+ initialData,
27
+ outputs,
28
+ renderingMode,
29
+ sdkVersion,
30
+ featureFlags,
31
+ sections,
32
+ title,
33
+ enrichmentTargets,
34
+ migrations,
35
+ code,
36
+ };
37
+ }
38
+ else if (cfg.v3 !== undefined) {
39
+ // version 3 (BlockModel v1)
19
40
  const { initialArgs, initialUiState, inputsValid, outputs, renderingMode, sdkVersion, featureFlags, sections, title, subtitle, tags, enrichmentTargets, } = cfg.v3;
20
41
  const { code } = cfg;
21
42
  return {
43
+ configVersion: 3,
44
+ modelAPIVersion: 1,
22
45
  initialArgs,
23
46
  initialUiState,
24
47
  inputsValid,
@@ -35,7 +58,7 @@ function extractConfigGeneric(cfg) {
35
58
  };
36
59
  }
37
60
  else if (cfg.inputsValid !== undefined) {
38
- // version 2
61
+ // version 2 (legacy) - normalize to v3 format
39
62
  const { sdkVersion, renderingMode, outputs, inputsValid, sections, initialArgs, code } = cfg;
40
63
  const fields = Object.keys(cfg);
41
64
  if (sdkVersion === undefined
@@ -46,6 +69,8 @@ function extractConfigGeneric(cfg) {
46
69
  || initialArgs === undefined)
47
70
  throw new Error(`Malformed config v2. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`);
48
71
  return {
72
+ configVersion: 3,
73
+ modelAPIVersion: 1,
49
74
  sdkVersion,
50
75
  renderingMode,
51
76
  initialArgs,
@@ -57,7 +82,7 @@ function extractConfigGeneric(cfg) {
57
82
  };
58
83
  }
59
84
  else if (cfg.renderingMode !== undefined) {
60
- // version 1
85
+ // version 1 (legacy) - normalize to v3 format
61
86
  const { sdkVersion, canRun, renderingMode, outputs, sections, initialArgs, code } = cfg;
62
87
  const fields = Object.keys(cfg);
63
88
  if (renderingMode === undefined
@@ -67,6 +92,8 @@ function extractConfigGeneric(cfg) {
67
92
  || initialArgs === undefined)
68
93
  throw new Error(`Malformed config v1. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`);
69
94
  return {
95
+ configVersion: 3,
96
+ modelAPIVersion: 1,
70
97
  sdkVersion: sdkVersion ?? 'unknown',
71
98
  renderingMode,
72
99
  initialArgs,
@@ -1 +1 @@
1
- {"version":3,"file":"normalization.cjs","sources":["../../src/bmodel/normalization.ts"],"sourcesContent":["import type { BlockConfigGeneric } from './block_config';\nimport type { BlockConfigContainer } from './container';\n\nfunction upgradeCfgOrLambda(data: unknown): unknown;\nfunction upgradeCfgOrLambda(\n data: unknown | undefined\n): unknown | undefined;\nfunction upgradeCfgOrLambda(\n data: unknown | undefined,\n): unknown | undefined {\n if (data === undefined) return undefined;\n if (typeof data === 'string') return { __renderLambda: true, handle: data, retentive: false };\n return data;\n}\n\n/**\n * Takes universal config, and converts it into latest config structure.\n *\n * **Important**: This operation is not meant to be executed recusively.\n * In no circumstance result of this function should be persisted!\n * */\nexport function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGeneric {\n if (cfg.v3 !== undefined) {\n // version 3\n const {\n initialArgs,\n initialUiState,\n inputsValid,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n subtitle,\n tags,\n enrichmentTargets,\n } = cfg.v3;\n const { code } = cfg;\n return {\n initialArgs,\n initialUiState,\n inputsValid,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n subtitle,\n tags,\n code,\n enrichmentTargets,\n };\n } else if (cfg.inputsValid !== undefined) {\n // version 2\n const { sdkVersion, renderingMode, outputs, inputsValid, sections, initialArgs, code } = cfg;\n const fields = Object.keys(cfg);\n if (\n sdkVersion === undefined\n || renderingMode === undefined\n || outputs === undefined\n || inputsValid === undefined\n || sections === undefined\n || initialArgs === undefined\n )\n throw new Error(\n `Malformed config v2. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n return {\n sdkVersion,\n renderingMode,\n initialArgs,\n outputs: Object.fromEntries(\n Object.entries(outputs).map(([key, value]) => [key, upgradeCfgOrLambda(value)]),\n ),\n inputsValid: upgradeCfgOrLambda(inputsValid),\n sections: upgradeCfgOrLambda(sections),\n initialUiState: undefined,\n code,\n };\n } else if (cfg.renderingMode !== undefined) {\n // version 1\n const { sdkVersion, canRun, renderingMode, outputs, sections, initialArgs, code } = cfg;\n const fields = Object.keys(cfg);\n if (\n renderingMode === undefined\n || outputs === undefined\n || canRun === undefined\n || sections === undefined\n || initialArgs === undefined\n )\n throw new Error(\n `Malformed config v1. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n return {\n sdkVersion: sdkVersion ?? 'unknown',\n renderingMode,\n initialArgs,\n outputs: Object.fromEntries(\n Object.entries(outputs).map(([key, value]) => [key, upgradeCfgOrLambda(value)]),\n ),\n inputsValid: upgradeCfgOrLambda(canRun),\n sections: upgradeCfgOrLambda(sections),\n initialUiState: undefined,\n code,\n };\n } else {\n const { sdkVersion } = cfg;\n const fields = Object.keys(cfg);\n throw new Error(\n `Config format not supported: SDK = ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n }\n}\n"],"names":[],"mappings":";;AAOA,SAAS,kBAAkB,CACzB,IAAyB,EAAA;IAEzB,IAAI,IAAI,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;IACxC,IAAI,OAAO,IAAI,KAAK,QAAQ;AAAE,QAAA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;AAC7F,IAAA,OAAO,IAAI;AACb;AAEA;;;;;AAKK;AACC,SAAU,oBAAoB,CAAC,GAAyB,EAAA;AAC5D,IAAA,IAAI,GAAG,CAAC,EAAE,KAAK,SAAS,EAAE;;AAExB,QAAA,MAAM,EACJ,WAAW,EACX,cAAc,EACd,WAAW,EACX,OAAO,EACP,aAAa,EACb,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,iBAAiB,GAClB,GAAG,GAAG,CAAC,EAAE;AACV,QAAA,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG;QACpB,OAAO;YACL,WAAW;YACX,cA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AE,GAAG,GAAG;QACvF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QAC/B,IACE,aAAa,KAAK;AACf,eAAA,OAAO,KAAK;AACZ,eAAA,MAAM,KAAK;AACX,eAAA,QAAQ,KAAK;AACb,eAAA,WAAW,KAAK,SAAS;AAE5B,YAAA,MAAM,IAAI,KAAK,CACb,CAAA,iCAAA,EAAoC,UAAU,CAAA,WAAA,EAAc,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAChF;QACH,OAAO;YACL,UAAU,EAAE,UAAU,IAAI,SAAS;YACnC,aAAa;YACb,WAAW;AACX,YAAA,OAAO,EAAE,MAAM,CAAC,WAAW,CACzB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAChF;AACD,YAAA,WAAW,EAAE,kBAAkB,CAAC,MAAM,CAAC;AACvC,YAAA,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC;AACtC,YAAA,cAAc,EAAE,SAAS;YACzB,IAAI;SACL;IACH;SAAO;AACL,QAAA,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG;QAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC/B,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,mCAAA,EAAsC,UAAU,CAAA,WAAA,EAAc,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAClF;IACH;AACF;;;;"}
1
+ {"version":3,"file":"normalization.cjs","sources":["../../src/bmodel/normalization.ts"],"sourcesContent":["import type { BlockConfigGeneric } from './block_config';\nimport type { BlockConfigContainer } from './container';\n\nfunction upgradeCfgOrLambda(data: unknown): unknown;\nfunction upgradeCfgOrLambda(\n data: unknown | undefined\n): unknown | undefined;\nfunction upgradeCfgOrLambda(\n data: unknown | undefined,\n): unknown | undefined {\n if (data === undefined) return undefined;\n if (typeof data === 'string') return { __renderLambda: true, handle: data, retentive: false };\n return data;\n}\n\n/**\n * Takes universal config, and converts it into latest config structure.\n *\n * **Important**: This operation is not meant to be executed recursively.\n * In no circumstance result of this function should be persisted!\n * */\nexport function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGeneric {\n if (cfg.v4 !== undefined) {\n // version 4 (BlockModelV3) - inputsValid is derived from args() success/failure\n const { args, prerunArgs, initialData, outputs, renderingMode, sdkVersion, featureFlags, sections, title, enrichmentTargets, migrations } = cfg.v4;\n const { code } = cfg;\n return {\n configVersion: 4,\n modelAPIVersion: 2,\n args,\n prerunArgs,\n initialData,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n enrichmentTargets,\n migrations,\n code,\n };\n } else if (cfg.v3 !== undefined) {\n // version 3 (BlockModel v1)\n const {\n initialArgs,\n initialUiState,\n inputsValid,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n subtitle,\n tags,\n enrichmentTargets,\n } = cfg.v3;\n const { code } = cfg;\n return {\n configVersion: 3,\n modelAPIVersion: 1,\n initialArgs,\n initialUiState,\n inputsValid,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n subtitle,\n tags,\n code,\n enrichmentTargets,\n };\n } else if (cfg.inputsValid !== undefined) {\n // version 2 (legacy) - normalize to v3 format\n const { sdkVersion, renderingMode, outputs, inputsValid, sections, initialArgs, code } = cfg;\n const fields = Object.keys(cfg);\n if (\n sdkVersion === undefined\n || renderingMode === undefined\n || outputs === undefined\n || inputsValid === undefined\n || sections === undefined\n || initialArgs === undefined\n )\n throw new Error(\n `Malformed config v2. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n return {\n configVersion: 3,\n modelAPIVersion: 1,\n sdkVersion,\n renderingMode,\n initialArgs,\n outputs: Object.fromEntries(\n Object.entries(outputs).map(([key, value]) => [key, upgradeCfgOrLambda(value)]),\n ),\n inputsValid: upgradeCfgOrLambda(inputsValid),\n sections: upgradeCfgOrLambda(sections),\n initialUiState: undefined,\n code,\n };\n } else if (cfg.renderingMode !== undefined) {\n // version 1 (legacy) - normalize to v3 format\n const { sdkVersion, canRun, renderingMode, outputs, sections, initialArgs, code } = cfg;\n const fields = Object.keys(cfg);\n if (\n renderingMode === undefined\n || outputs === undefined\n || canRun === undefined\n || sections === undefined\n || initialArgs === undefined\n )\n throw new Error(\n `Malformed config v1. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n return {\n configVersion: 3,\n modelAPIVersion: 1,\n sdkVersion: sdkVersion ?? 'unknown',\n renderingMode,\n initialArgs,\n outputs: Object.fromEntries(\n Object.entries(outputs).map(([key, value]) => [key, upgradeCfgOrLambda(value)]),\n ),\n inputsValid: upgradeCfgOrLambda(canRun),\n sections: upgradeCfgOrLambda(sections),\n initialUiState: undefined,\n code,\n };\n } else {\n const { sdkVersion } = cfg;\n const fields = Object.keys(cfg);\n throw new Error(\n `Config format not supported: SDK = ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n }\n}\n"],"names":[],"mappings":";;AAOA,SAAS,kBAAkB,CACzB,IAAyB,EAAA;IAEzB,IAAI,IAAI,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;IACxC,IAAI,OAAO,IAAI,KAAK,QAAQ;AAAE,QAAA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;AAC7F,IAAA,OAAO,IAAI;AACb;AAEA;;;;;AAKK;AACC,SAAU,oBAAoB,CAAC,GAAyB,EAAA;AAC5D,IAAA,IAAI,GAAG,CAAC,EAAE,KAAK,SAAS,EAAE;;QAExB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,KA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AACX,YAAA,OAAO,EAAE,MAAM,CAAC,WAAW,CACzB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAChF;AACD,YAAA,WAAW,EAAE,kBAAkB,CAAC,MAAM,CAAC;AACvC,YAAA,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC;AACtC,YAAA,cAAc,EAAE,SAAS;YACzB,IAAI;SACL;IACH;SAAO;AACL,QAAA,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG;QAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC/B,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,mCAAA,EAAsC,UAAU,CAAA,WAAA,EAAc,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAClF;IACH;AACF;;;;"}
@@ -3,7 +3,7 @@ import type { BlockConfigContainer } from './container';
3
3
  /**
4
4
  * Takes universal config, and converts it into latest config structure.
5
5
  *
6
- * **Important**: This operation is not meant to be executed recusively.
6
+ * **Important**: This operation is not meant to be executed recursively.
7
7
  * In no circumstance result of this function should be persisted!
8
8
  * */
9
9
  export declare function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGeneric;
@@ -1 +1 @@
1
- {"version":3,"file":"normalization.d.ts","sourceRoot":"","sources":["../../src/bmodel/normalization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAcxD;;;;;KAKK;AACL,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,oBAAoB,GAAG,kBAAkB,CA6FlF"}
1
+ {"version":3,"file":"normalization.d.ts","sourceRoot":"","sources":["../../src/bmodel/normalization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAcxD;;;;;KAKK;AACL,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,oBAAoB,GAAG,kBAAkB,CAuHlF"}
@@ -8,15 +8,38 @@ function upgradeCfgOrLambda(data) {
8
8
  /**
9
9
  * Takes universal config, and converts it into latest config structure.
10
10
  *
11
- * **Important**: This operation is not meant to be executed recusively.
11
+ * **Important**: This operation is not meant to be executed recursively.
12
12
  * In no circumstance result of this function should be persisted!
13
13
  * */
14
14
  function extractConfigGeneric(cfg) {
15
- if (cfg.v3 !== undefined) {
16
- // version 3
15
+ if (cfg.v4 !== undefined) {
16
+ // version 4 (BlockModelV3) - inputsValid is derived from args() success/failure
17
+ const { args, prerunArgs, initialData, outputs, renderingMode, sdkVersion, featureFlags, sections, title, enrichmentTargets, migrations } = cfg.v4;
18
+ const { code } = cfg;
19
+ return {
20
+ configVersion: 4,
21
+ modelAPIVersion: 2,
22
+ args,
23
+ prerunArgs,
24
+ initialData,
25
+ outputs,
26
+ renderingMode,
27
+ sdkVersion,
28
+ featureFlags,
29
+ sections,
30
+ title,
31
+ enrichmentTargets,
32
+ migrations,
33
+ code,
34
+ };
35
+ }
36
+ else if (cfg.v3 !== undefined) {
37
+ // version 3 (BlockModel v1)
17
38
  const { initialArgs, initialUiState, inputsValid, outputs, renderingMode, sdkVersion, featureFlags, sections, title, subtitle, tags, enrichmentTargets, } = cfg.v3;
18
39
  const { code } = cfg;
19
40
  return {
41
+ configVersion: 3,
42
+ modelAPIVersion: 1,
20
43
  initialArgs,
21
44
  initialUiState,
22
45
  inputsValid,
@@ -33,7 +56,7 @@ function extractConfigGeneric(cfg) {
33
56
  };
34
57
  }
35
58
  else if (cfg.inputsValid !== undefined) {
36
- // version 2
59
+ // version 2 (legacy) - normalize to v3 format
37
60
  const { sdkVersion, renderingMode, outputs, inputsValid, sections, initialArgs, code } = cfg;
38
61
  const fields = Object.keys(cfg);
39
62
  if (sdkVersion === undefined
@@ -44,6 +67,8 @@ function extractConfigGeneric(cfg) {
44
67
  || initialArgs === undefined)
45
68
  throw new Error(`Malformed config v2. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`);
46
69
  return {
70
+ configVersion: 3,
71
+ modelAPIVersion: 1,
47
72
  sdkVersion,
48
73
  renderingMode,
49
74
  initialArgs,
@@ -55,7 +80,7 @@ function extractConfigGeneric(cfg) {
55
80
  };
56
81
  }
57
82
  else if (cfg.renderingMode !== undefined) {
58
- // version 1
83
+ // version 1 (legacy) - normalize to v3 format
59
84
  const { sdkVersion, canRun, renderingMode, outputs, sections, initialArgs, code } = cfg;
60
85
  const fields = Object.keys(cfg);
61
86
  if (renderingMode === undefined
@@ -65,6 +90,8 @@ function extractConfigGeneric(cfg) {
65
90
  || initialArgs === undefined)
66
91
  throw new Error(`Malformed config v1. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`);
67
92
  return {
93
+ configVersion: 3,
94
+ modelAPIVersion: 1,
68
95
  sdkVersion: sdkVersion ?? 'unknown',
69
96
  renderingMode,
70
97
  initialArgs,
@@ -1 +1 @@
1
- {"version":3,"file":"normalization.js","sources":["../../src/bmodel/normalization.ts"],"sourcesContent":["import type { BlockConfigGeneric } from './block_config';\nimport type { BlockConfigContainer } from './container';\n\nfunction upgradeCfgOrLambda(data: unknown): unknown;\nfunction upgradeCfgOrLambda(\n data: unknown | undefined\n): unknown | undefined;\nfunction upgradeCfgOrLambda(\n data: unknown | undefined,\n): unknown | undefined {\n if (data === undefined) return undefined;\n if (typeof data === 'string') return { __renderLambda: true, handle: data, retentive: false };\n return data;\n}\n\n/**\n * Takes universal config, and converts it into latest config structure.\n *\n * **Important**: This operation is not meant to be executed recusively.\n * In no circumstance result of this function should be persisted!\n * */\nexport function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGeneric {\n if (cfg.v3 !== undefined) {\n // version 3\n const {\n initialArgs,\n initialUiState,\n inputsValid,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n subtitle,\n tags,\n enrichmentTargets,\n } = cfg.v3;\n const { code } = cfg;\n return {\n initialArgs,\n initialUiState,\n inputsValid,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n subtitle,\n tags,\n code,\n enrichmentTargets,\n };\n } else if (cfg.inputsValid !== undefined) {\n // version 2\n const { sdkVersion, renderingMode, outputs, inputsValid, sections, initialArgs, code } = cfg;\n const fields = Object.keys(cfg);\n if (\n sdkVersion === undefined\n || renderingMode === undefined\n || outputs === undefined\n || inputsValid === undefined\n || sections === undefined\n || initialArgs === undefined\n )\n throw new Error(\n `Malformed config v2. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n return {\n sdkVersion,\n renderingMode,\n initialArgs,\n outputs: Object.fromEntries(\n Object.entries(outputs).map(([key, value]) => [key, upgradeCfgOrLambda(value)]),\n ),\n inputsValid: upgradeCfgOrLambda(inputsValid),\n sections: upgradeCfgOrLambda(sections),\n initialUiState: undefined,\n code,\n };\n } else if (cfg.renderingMode !== undefined) {\n // version 1\n const { sdkVersion, canRun, renderingMode, outputs, sections, initialArgs, code } = cfg;\n const fields = Object.keys(cfg);\n if (\n renderingMode === undefined\n || outputs === undefined\n || canRun === undefined\n || sections === undefined\n || initialArgs === undefined\n )\n throw new Error(\n `Malformed config v1. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n return {\n sdkVersion: sdkVersion ?? 'unknown',\n renderingMode,\n initialArgs,\n outputs: Object.fromEntries(\n Object.entries(outputs).map(([key, value]) => [key, upgradeCfgOrLambda(value)]),\n ),\n inputsValid: upgradeCfgOrLambda(canRun),\n sections: upgradeCfgOrLambda(sections),\n initialUiState: undefined,\n code,\n };\n } else {\n const { sdkVersion } = cfg;\n const fields = Object.keys(cfg);\n throw new Error(\n `Config format not supported: SDK = ${sdkVersion}; F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,GAAG,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAC,CAChF;AACD,YAAA,WAAW,EAAE,kBAAkB,CAAC,MAAM,CAAC;AACvC,YAAA,QAAQ,EAAE,kBAAkB,CAAC,QAAQ,CAAC;AACtC,YAAA,cAAc,EAAE,SAAS;YACzB,IAAI;SACL;IACH;SAAO;AACL,QAAA,MAAM,EAAE,UAAU,EAAE,GAAG,GAAG;QAC1B,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC/B,QAAA,MAAM,IAAI,KAAK,CACb,CAAA,mCAAA,EAAsC,UAAU,CAAA,WAAA,EAAc,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAClF;IACH;AACF;;;;"}
1
+ {"version":3,"file":"normalization.js","sources":["../../src/bmodel/normalization.ts"],"sourcesContent":["import type { BlockConfigGeneric } from './block_config';\nimport type { BlockConfigContainer } from './container';\n\nfunction upgradeCfgOrLambda(data: unknown): unknown;\nfunction upgradeCfgOrLambda(\n data: unknown | undefined\n): unknown | undefined;\nfunction upgradeCfgOrLambda(\n data: unknown | undefined,\n): unknown | undefined {\n if (data === undefined) return undefined;\n if (typeof data === 'string') return { __renderLambda: true, handle: data, retentive: false };\n return data;\n}\n\n/**\n * Takes universal config, and converts it into latest config structure.\n *\n * **Important**: This operation is not meant to be executed recursively.\n * In no circumstance result of this function should be persisted!\n * */\nexport function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGeneric {\n if (cfg.v4 !== undefined) {\n // version 4 (BlockModelV3) - inputsValid is derived from args() success/failure\n const { args, prerunArgs, initialData, outputs, renderingMode, sdkVersion, featureFlags, sections, title, enrichmentTargets, migrations } = cfg.v4;\n const { code } = cfg;\n return {\n configVersion: 4,\n modelAPIVersion: 2,\n args,\n prerunArgs,\n initialData,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n enrichmentTargets,\n migrations,\n code,\n };\n } else if (cfg.v3 !== undefined) {\n // version 3 (BlockModel v1)\n const {\n initialArgs,\n initialUiState,\n inputsValid,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n subtitle,\n tags,\n enrichmentTargets,\n } = cfg.v3;\n const { code } = cfg;\n return {\n configVersion: 3,\n modelAPIVersion: 1,\n initialArgs,\n initialUiState,\n inputsValid,\n outputs,\n renderingMode,\n sdkVersion,\n featureFlags,\n sections,\n title,\n subtitle,\n tags,\n code,\n enrichmentTargets,\n };\n } else if (cfg.inputsValid !== undefined) {\n // version 2 (legacy) - normalize to v3 format\n const { sdkVersion, renderingMode, outputs, inputsValid, sections, initialArgs, code } = cfg;\n const fields = Object.keys(cfg);\n if (\n sdkVersion === undefined\n || renderingMode === undefined\n || outputs === undefined\n || inputsValid === undefined\n || sections === undefined\n || initialArgs === undefined\n )\n throw new Error(\n `Malformed config v2. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n return {\n configVersion: 3,\n modelAPIVersion: 1,\n sdkVersion,\n renderingMode,\n initialArgs,\n outputs: Object.fromEntries(\n Object.entries(outputs).map(([key, value]) => [key, upgradeCfgOrLambda(value)]),\n ),\n inputsValid: upgradeCfgOrLambda(inputsValid),\n sections: upgradeCfgOrLambda(sections),\n initialUiState: undefined,\n code,\n };\n } else if (cfg.renderingMode !== undefined) {\n // version 1 (legacy) - normalize to v3 format\n const { sdkVersion, canRun, renderingMode, outputs, sections, initialArgs, code } = cfg;\n const fields = Object.keys(cfg);\n if (\n renderingMode === undefined\n || outputs === undefined\n || canRun === undefined\n || sections === undefined\n || initialArgs === undefined\n )\n throw new Error(\n `Malformed config v1. SDK version ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n return {\n configVersion: 3,\n modelAPIVersion: 1,\n sdkVersion: sdkVersion ?? 'unknown',\n renderingMode,\n initialArgs,\n outputs: Object.fromEntries(\n Object.entries(outputs).map(([key, value]) => [key, upgradeCfgOrLambda(value)]),\n ),\n inputsValid: upgradeCfgOrLambda(canRun),\n sections: upgradeCfgOrLambda(sections),\n initialUiState: undefined,\n code,\n };\n } else {\n const { sdkVersion } = cfg;\n const fields = Object.keys(cfg);\n throw new Error(\n `Config format not supported: SDK = ${sdkVersion}; Fields = ${fields.join(', ')}`,\n );\n }\n}\n"],"names":[],"mappings":"AAOA,SAAS,kBAAkB,CACzB,IAAyB,EAAA;IAEzB,IAAI,IAAI,KAAK,SAAS;AAAE,QAAA,OAAO,SAAS;IACxC,IAAI,OAAO,IAAI,KAAK,QAAQ;AAAE,QAAA,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE;AAC7F,IAAA,OAAO,IAAI;AACb;AAEA;;;;;AAKK;AACC,SAAU,oBAAoB,CAAC,GAAyB,EAAA;AAC5D,IAAA,IAAI,GAAG,CAAC,EAAE,KAAK,SAAS,EAAE;;QAExB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,QAAQ,EAAE,KAAK,EAAE,iBAAiB,EAAE,UAAU,EAAE,GAAG,GAAG,CAAC,EAAE;AAClJ,QAAA,MAAM,EAAE,IAAI,EAAE,GAAG,GAAG;QACpB,OAAO;AACL,YAAA,aAAa,EAAE,CAAC;AAChB,YAAA,eAAe,EAAE,CAAC;YAClB,IAAI;YACJ,UAAU;YACV,WAAW;YACX,OAAO;YACP,aAAa;YACb,UAAU;YACV,YAAY;YACZ,QAAQ;YACR,KAAK;YACL,iBAAiB;YACjB,UAAU;YACV,IAAI;SACL;IACH;AAAO,SAAA,IAAI,GAAG,CAAC,EAAE,KAAK,SAAS,EAAE;;AAE/B,QAAA,MAAM,EACJ,WAAW,EACX,cAAc,EACd,WAAW,EACX,OAAO,EACP,aAAa,EACb,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,iBAAiB,GAClB,GAAG,G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MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAE,CAClF;IACH;AACF;;;;"}
@@ -43,6 +43,11 @@ function readMetadataJson(metadata, metadataJson, key) {
43
43
  const Domain = {
44
44
  Alphabet: 'pl7.app/alphabet',
45
45
  BlockId: 'pl7.app/blockId',
46
+ VDJ: {
47
+ ScClonotypeChain: {
48
+ Index: 'pl7.app/vdj/scClonotypeChain/index',
49
+ },
50
+ },
46
51
  };
47
52
  const DomainJson = {};
48
53
  /// Helper function for reading plain domain values
@@ -99,6 +104,9 @@ const Annotation = {
99
104
  Visibility: 'pl7.app/table/visibility',
100
105
  },
101
106
  Trace: 'pl7.app/trace',
107
+ VDJ: {
108
+ IsAssemblingFeature: 'pl7.app/vdj/isAssemblingFeature',
109
+ },
102
110
  };
103
111
  const ValueTypeSchema = zod.z.enum(['Int', 'Long', 'Float', 'Double', 'String']);
104
112
  const AnnotationJson = {
@@ -128,6 +136,7 @@ const AnnotationJson = {
128
136
  [Annotation.Sequence.IsAnnotation]: zod.z.boolean(),
129
137
  [Annotation.Table.OrderPriority]: zod.z.number(),
130
138
  [Annotation.Trace]: zod.z.record(zod.z.string(), zod.z.unknown()),
139
+ [Annotation.VDJ.IsAssemblingFeature]: zod.z.boolean(),
131
140
  };
132
141
  /// Helper function for reading plain annotation values
133
142
  function readAnnotation(spec, key) {
@@ -307,6 +316,18 @@ const PColumnName = {
307
316
  Table: {
308
317
  RowSelection: 'pl7.app/table/row-selection',
309
318
  },
319
+ VDJ: {
320
+ Sequence: 'pl7.app/vdj/sequence',
321
+ },
322
+ };
323
+ /// Well-known axis names
324
+ const PAxisName = {
325
+ VDJ: {
326
+ Assay: {
327
+ SequenceId: 'pl7.app/vdj/assay/sequenceId',
328
+ },
329
+ ScClonotypeKey: 'pl7.app/vdj/scClonotypeKey',
330
+ },
310
331
  };
311
332
  function isLabelColumn(column) {
312
333
  return column.axesSpec.length === 1 && column.name === PColumnName.Label;
@@ -372,6 +393,7 @@ exports.Annotation = Annotation;
372
393
  exports.AnnotationJson = AnnotationJson;
373
394
  exports.Domain = Domain;
374
395
  exports.DomainJson = DomainJson;
396
+ exports.PAxisName = PAxisName;
375
397
  exports.PColumnName = PColumnName;
376
398
  exports.ValueType = ValueType;
377
399
  exports.canonicalizeAxisId = canonicalizeAxisId;