@milaboratories/pl-model-common 1.21.10 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bmodel/block_config.cjs.map +1 -1
- package/dist/bmodel/block_config.d.ts +6 -2
- package/dist/bmodel/block_config.d.ts.map +1 -1
- package/dist/bmodel/block_config.js.map +1 -1
- package/dist/bmodel/normalization.cjs +3 -1
- package/dist/bmodel/normalization.cjs.map +1 -1
- package/dist/bmodel/normalization.d.ts.map +1 -1
- package/dist/bmodel/normalization.js +3 -1
- package/dist/bmodel/normalization.js.map +1 -1
- package/dist/common_types.d.ts +3 -3
- package/dist/common_types.d.ts.map +1 -1
- package/dist/navigation.cjs.map +1 -1
- package/dist/navigation.d.ts +3 -1
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js.map +1 -1
- package/package.json +8 -7
- package/src/bmodel/block_config.ts +8 -2
- package/src/bmodel/normalization.ts +4 -0
- package/src/common_types.ts +3 -4
- package/src/navigation.ts +4 -1
|
@@ -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
|
|
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;;;;"}
|
|
@@ -19,16 +19,20 @@ export type BlockConfigV3Generic<Args = unknown, UiState = unknown, BroadActiveH
|
|
|
19
19
|
* arguments.
|
|
20
20
|
*
|
|
21
21
|
* Optional to support earlier SDK version configs.
|
|
22
|
-
|
|
22
|
+
*/
|
|
23
23
|
readonly inputsValid: BroadActiveHandleDescriptor;
|
|
24
24
|
/** Configuration to derive list of section for the left overview panel */
|
|
25
25
|
readonly sections: BroadActiveHandleDescriptor;
|
|
26
26
|
/** Lambda to derive block title */
|
|
27
27
|
readonly title?: NarrowActiveHandleDescriptor;
|
|
28
|
+
/** Lambda to derive block subtitle, shown below the title */
|
|
29
|
+
readonly subtitle?: NarrowActiveHandleDescriptor;
|
|
30
|
+
/** Lambda returning array of tags for search functionality */
|
|
31
|
+
readonly tags?: BroadActiveHandleDescriptor;
|
|
28
32
|
/**
|
|
29
33
|
* Lambda returning list of upstream blocks this block enriches with its exports,
|
|
30
34
|
* influences dependency graph construction
|
|
31
|
-
|
|
35
|
+
*/
|
|
32
36
|
readonly enrichmentTargets?: NarrowActiveHandleDescriptor;
|
|
33
37
|
/** Configuration for the output cells */
|
|
34
38
|
readonly outputs: Outputs;
|
|
@@ -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,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAC9B,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,OAAO,EACjB,2BAA2B,GAAG,OAAO,EACrC,4BAA4B,SAAS,2BAA2B,GAAG,2BAA2B,EAC9F,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,IACvG;IACF,oCAAoC;IACpC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,wCAAwC;IACxC,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;IAE3C,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,IAAI,CAAC;IAE3B,oEAAoE;IACpE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IAEjC;;;;;
|
|
1
|
+
{"version":3,"file":"block_config.d.ts","sourceRoot":"","sources":["../../src/bmodel/block_config.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,oBAAoB,CAC9B,IAAI,GAAG,OAAO,EACd,OAAO,GAAG,OAAO,EACjB,2BAA2B,GAAG,OAA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\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
|
|
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;;;;"}
|
|
@@ -16,7 +16,7 @@ function upgradeCfgOrLambda(data) {
|
|
|
16
16
|
function extractConfigGeneric(cfg) {
|
|
17
17
|
if (cfg.v3 !== undefined) {
|
|
18
18
|
// version 3
|
|
19
|
-
const { initialArgs, initialUiState, inputsValid, outputs, renderingMode, sdkVersion, featureFlags, sections, title, enrichmentTargets, } = cfg.v3;
|
|
19
|
+
const { initialArgs, initialUiState, inputsValid, outputs, renderingMode, sdkVersion, featureFlags, sections, title, subtitle, tags, enrichmentTargets, } = cfg.v3;
|
|
20
20
|
const { code } = cfg;
|
|
21
21
|
return {
|
|
22
22
|
initialArgs,
|
|
@@ -28,6 +28,8 @@ function extractConfigGeneric(cfg) {
|
|
|
28
28
|
featureFlags,
|
|
29
29
|
sections,
|
|
30
30
|
title,
|
|
31
|
+
subtitle,
|
|
32
|
+
tags,
|
|
31
33
|
code,
|
|
32
34
|
enrichmentTargets,
|
|
33
35
|
};
|
|
@@ -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 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 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;;
|
|
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,cAAc;YACd,WAAW;YACX,OAAO;YACP,aAAa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;AACL,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,oBAAoB,GAAG,kBAAkB,
|
|
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"}
|
|
@@ -14,7 +14,7 @@ function upgradeCfgOrLambda(data) {
|
|
|
14
14
|
function extractConfigGeneric(cfg) {
|
|
15
15
|
if (cfg.v3 !== undefined) {
|
|
16
16
|
// version 3
|
|
17
|
-
const { initialArgs, initialUiState, inputsValid, outputs, renderingMode, sdkVersion, featureFlags, sections, title, enrichmentTargets, } = cfg.v3;
|
|
17
|
+
const { initialArgs, initialUiState, inputsValid, outputs, renderingMode, sdkVersion, featureFlags, sections, title, subtitle, tags, enrichmentTargets, } = cfg.v3;
|
|
18
18
|
const { code } = cfg;
|
|
19
19
|
return {
|
|
20
20
|
initialArgs,
|
|
@@ -26,6 +26,8 @@ function extractConfigGeneric(cfg) {
|
|
|
26
26
|
featureFlags,
|
|
27
27
|
sections,
|
|
28
28
|
title,
|
|
29
|
+
subtitle,
|
|
30
|
+
tags,
|
|
29
31
|
code,
|
|
30
32
|
enrichmentTargets,
|
|
31
33
|
};
|
|
@@ -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 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 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;;
|
|
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}; 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,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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;;;;"}
|
package/dist/common_types.d.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { ErrorLike } from '@milaboratories/pl-error-like';
|
|
2
2
|
/** Use this as constraint instead of `Function` */
|
|
3
3
|
export type AnyFunction = (...args: any[]) => any;
|
|
4
|
-
|
|
5
|
-
export type ValueOrErrors<T> = {
|
|
4
|
+
export type OutputWithStatus<T> = {
|
|
6
5
|
ok: true;
|
|
7
6
|
value: T;
|
|
7
|
+
stable: boolean;
|
|
8
8
|
} | {
|
|
9
9
|
ok: false;
|
|
10
10
|
errors: ErrorLike[];
|
|
11
11
|
moreErrors: boolean;
|
|
12
12
|
};
|
|
13
13
|
/** Base type for block outputs */
|
|
14
|
-
export type BlockOutputsBase = Record<string,
|
|
14
|
+
export type BlockOutputsBase = Record<string, OutputWithStatus<unknown>>;
|
|
15
15
|
export type ListOptionBase<T = unknown> = {
|
|
16
16
|
label: string;
|
|
17
17
|
description?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common_types.d.ts","sourceRoot":"","sources":["../src/common_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D,mDAAmD;AAEnD,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAElD,
|
|
1
|
+
{"version":3,"file":"common_types.d.ts","sourceRoot":"","sources":["../src/common_types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D,mDAAmD;AAEnD,MAAM,MAAM,WAAW,GAAG,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;AAElD,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAC1B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GACvC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,SAAS,EAAE,CAAC;IAAC,UAAU,EAAE,OAAO,CAAA;CAAE,CAAC;AAE5D,kCAAkC;AAClC,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;AAEzE,MAAM,MAAM,cAAc,CAAC,CAAC,GAAG,OAAO,IAAI;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,CAAC,CAAC;IACT,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
package/dist/navigation.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.cjs","sources":["../src/navigation.ts"],"sourcesContent":["/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Link visual appearance */\n readonly appearance?: BlockSectionLinkAppearance;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n};\n\n/** Different variants for link section appearance */\nexport type BlockSectionLinkAppearance =\n /** Shows a section of type `link` with a `+` icon and a certain specific style */\n 'add-section';\n\n/** Create a horizontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n
|
|
1
|
+
{"version":3,"file":"navigation.cjs","sources":["../src/navigation.ts"],"sourcesContent":["/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Link visual appearance */\n readonly appearance?: BlockSectionLinkAppearance;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n\n /** Optional text shown as a small badge next to the section */\n readonly badge?: string;\n};\n\n/** Different variants for link section appearance */\nexport type BlockSectionLinkAppearance =\n /** Shows a section of type `link` with a `+` icon and a certain specific style */\n 'add-section';\n\n/** Create a horizontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: '/' };\n"],"names":[],"mappings":";;MAyCa,sBAAsB,GAAoB,EAAE,IAAI,EAAE,GAAG;;;;"}
|
package/dist/navigation.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export type BlockSectionLink = {
|
|
|
12
12
|
readonly appearance?: BlockSectionLinkAppearance;
|
|
13
13
|
/** Visible section title, can also be used in the window header. */
|
|
14
14
|
readonly label: string;
|
|
15
|
+
/** Optional text shown as a small badge next to the section */
|
|
16
|
+
readonly badge?: string;
|
|
15
17
|
};
|
|
16
18
|
/** Different variants for link section appearance */
|
|
17
19
|
export type BlockSectionLinkAppearance =
|
|
@@ -24,7 +26,7 @@ export type BlockSectionDelimiter = {
|
|
|
24
26
|
/**
|
|
25
27
|
* Part of the block state, representing current navigation information
|
|
26
28
|
* (i.e. currently selected section)
|
|
27
|
-
|
|
29
|
+
*/
|
|
28
30
|
export type NavigationState<Href extends `/${string}` = `/${string}`> = {
|
|
29
31
|
readonly href: Href;
|
|
30
32
|
};
|
package/dist/navigation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,qBAAqB,CAAC;AAEpE;eACe;AACf,MAAM,MAAM,gBAAgB,GAAG;IAC7B;0DACsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;IAE5B,6BAA6B;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,0BAA0B,CAAC;IAEjD,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,MAAM,YAAY,GAAG,gBAAgB,GAAG,qBAAqB,CAAC;AAEpE;eACe;AACf,MAAM,MAAM,gBAAgB,GAAG;IAC7B;0DACsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,IAAI,MAAM,EAAE,CAAC;IAE5B,6BAA6B;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,0BAA0B,CAAC;IAEjD,oEAAoE;IACpE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,+DAA+D;IAC/D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,0BAA0B;AACpC,kFAAkF;AAClF,aAAa,CAAC;AAEhB,gDAAgD;AAChD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;CAC5B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,CAAC,IAAI,SAAS,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,IAAI;IACtE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,eAA+B,CAAC"}
|
package/dist/navigation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.js","sources":["../src/navigation.ts"],"sourcesContent":["/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Link visual appearance */\n readonly appearance?: BlockSectionLinkAppearance;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n};\n\n/** Different variants for link section appearance */\nexport type BlockSectionLinkAppearance =\n /** Shows a section of type `link` with a `+` icon and a certain specific style */\n 'add-section';\n\n/** Create a horizontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n
|
|
1
|
+
{"version":3,"file":"navigation.js","sources":["../src/navigation.ts"],"sourcesContent":["/** Block section visualized as items in left panel block overview */\nexport type BlockSection = BlockSectionLink | BlockSectionDelimiter;\n\n/** Tells the system that specific section from the main UI of this block should\n * be opened */\nexport type BlockSectionLink = {\n /** Potentially there may be multiple section types, i.e. for \"+\" rows and for\n * sections directly opening html from the outputs. */\n readonly type: 'link';\n\n /** Internal block section identifier */\n readonly href: `/${string}`;\n\n /** Link visual appearance */\n readonly appearance?: BlockSectionLinkAppearance;\n\n /** Visible section title, can also be used in the window header. */\n readonly label: string;\n\n /** Optional text shown as a small badge next to the section */\n readonly badge?: string;\n};\n\n/** Different variants for link section appearance */\nexport type BlockSectionLinkAppearance =\n /** Shows a section of type `link` with a `+` icon and a certain specific style */\n 'add-section';\n\n/** Create a horizontal line between sections */\nexport type BlockSectionDelimiter = {\n readonly type: 'delimiter';\n};\n\n/**\n * Part of the block state, representing current navigation information\n * (i.e. currently selected section)\n */\nexport type NavigationState<Href extends `/${string}` = `/${string}`> = {\n readonly href: Href;\n};\n\nexport const DefaultNavigationState: NavigationState = { href: '/' };\n"],"names":[],"mappings":"MAyCa,sBAAsB,GAAoB,EAAE,IAAI,EAAE,GAAG;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-model-common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.0",
|
|
4
4
|
"description": "Platforma SDK Model",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,18 +24,19 @@
|
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"eslint": "^9.25.1",
|
|
26
26
|
"typescript": "~5.6.3",
|
|
27
|
-
"vitest": "^4.0.
|
|
28
|
-
"@
|
|
29
|
-
"@milaboratories/
|
|
30
|
-
"@
|
|
31
|
-
"@milaboratories/ts-configs": "1.0
|
|
27
|
+
"vitest": "^4.0.16",
|
|
28
|
+
"@vitest/coverage-istanbul": "^4.0.16",
|
|
29
|
+
"@milaboratories/ts-builder": "1.2.1",
|
|
30
|
+
"@milaboratories/eslint-config": "1.0.5",
|
|
31
|
+
"@milaboratories/ts-configs": "1.2.0",
|
|
32
|
+
"@milaboratories/build-configs": "1.2.1"
|
|
32
33
|
},
|
|
33
34
|
"scripts": {
|
|
34
35
|
"type-check": "ts-builder types --target node",
|
|
35
36
|
"build": "ts-builder build --target node",
|
|
36
37
|
"watch": "ts-builder build --target node --watch",
|
|
37
38
|
"lint": "eslint .",
|
|
38
|
-
"test": "vitest run",
|
|
39
|
+
"test": "vitest run --coverage",
|
|
39
40
|
"do-pack": "rm -f *.tgz && pnpm pack && mv *.tgz package.tgz"
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -32,7 +32,7 @@ export type BlockConfigV3Generic<
|
|
|
32
32
|
* arguments.
|
|
33
33
|
*
|
|
34
34
|
* Optional to support earlier SDK version configs.
|
|
35
|
-
|
|
35
|
+
*/
|
|
36
36
|
readonly inputsValid: BroadActiveHandleDescriptor;
|
|
37
37
|
|
|
38
38
|
/** Configuration to derive list of section for the left overview panel */
|
|
@@ -41,10 +41,16 @@ export type BlockConfigV3Generic<
|
|
|
41
41
|
/** Lambda to derive block title */
|
|
42
42
|
readonly title?: NarrowActiveHandleDescriptor;
|
|
43
43
|
|
|
44
|
+
/** Lambda to derive block subtitle, shown below the title */
|
|
45
|
+
readonly subtitle?: NarrowActiveHandleDescriptor;
|
|
46
|
+
|
|
47
|
+
/** Lambda returning array of tags for search functionality */
|
|
48
|
+
readonly tags?: BroadActiveHandleDescriptor;
|
|
49
|
+
|
|
44
50
|
/**
|
|
45
51
|
* Lambda returning list of upstream blocks this block enriches with its exports,
|
|
46
52
|
* influences dependency graph construction
|
|
47
|
-
|
|
53
|
+
*/
|
|
48
54
|
readonly enrichmentTargets?: NarrowActiveHandleDescriptor;
|
|
49
55
|
|
|
50
56
|
/** Configuration for the output cells */
|
|
@@ -32,6 +32,8 @@ export function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGene
|
|
|
32
32
|
featureFlags,
|
|
33
33
|
sections,
|
|
34
34
|
title,
|
|
35
|
+
subtitle,
|
|
36
|
+
tags,
|
|
35
37
|
enrichmentTargets,
|
|
36
38
|
} = cfg.v3;
|
|
37
39
|
const { code } = cfg;
|
|
@@ -45,6 +47,8 @@ export function extractConfigGeneric(cfg: BlockConfigContainer): BlockConfigGene
|
|
|
45
47
|
featureFlags,
|
|
46
48
|
sections,
|
|
47
49
|
title,
|
|
50
|
+
subtitle,
|
|
51
|
+
tags,
|
|
48
52
|
code,
|
|
49
53
|
enrichmentTargets,
|
|
50
54
|
};
|
package/src/common_types.ts
CHANGED
|
@@ -4,13 +4,12 @@ import type { ErrorLike } from '@milaboratories/pl-error-like';
|
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
5
|
export type AnyFunction = (...args: any[]) => any;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
| { ok: true; value: T }
|
|
7
|
+
export type OutputWithStatus<T> =
|
|
8
|
+
| { ok: true; value: T; stable: boolean }
|
|
10
9
|
| { ok: false; errors: ErrorLike[]; moreErrors: boolean };
|
|
11
10
|
|
|
12
11
|
/** Base type for block outputs */
|
|
13
|
-
export type BlockOutputsBase = Record<string,
|
|
12
|
+
export type BlockOutputsBase = Record<string, OutputWithStatus<unknown>>;
|
|
14
13
|
|
|
15
14
|
export type ListOptionBase<T = unknown> = {
|
|
16
15
|
label: string;
|
package/src/navigation.ts
CHANGED
|
@@ -16,6 +16,9 @@ export type BlockSectionLink = {
|
|
|
16
16
|
|
|
17
17
|
/** Visible section title, can also be used in the window header. */
|
|
18
18
|
readonly label: string;
|
|
19
|
+
|
|
20
|
+
/** Optional text shown as a small badge next to the section */
|
|
21
|
+
readonly badge?: string;
|
|
19
22
|
};
|
|
20
23
|
|
|
21
24
|
/** Different variants for link section appearance */
|
|
@@ -31,7 +34,7 @@ export type BlockSectionDelimiter = {
|
|
|
31
34
|
/**
|
|
32
35
|
* Part of the block state, representing current navigation information
|
|
33
36
|
* (i.e. currently selected section)
|
|
34
|
-
|
|
37
|
+
*/
|
|
35
38
|
export type NavigationState<Href extends `/${string}` = `/${string}`> = {
|
|
36
39
|
readonly href: Href;
|
|
37
40
|
};
|