@platforma-sdk/model 1.75.5 → 1.75.8
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/block_model.cjs +3 -3
- package/dist/block_model.cjs.map +1 -1
- package/dist/block_model.d.ts +4 -5
- package/dist/block_model.d.ts.map +1 -1
- package/dist/block_model.js +3 -3
- package/dist/block_model.js.map +1 -1
- package/dist/block_model_legacy.cjs +2 -1
- package/dist/block_model_legacy.cjs.map +1 -1
- package/dist/block_model_legacy.js +2 -1
- package/dist/block_model_legacy.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/package.cjs +1 -1
- package/dist/package.js +1 -1
- package/dist/platforma.d.ts +8 -5
- package/dist/platforma.d.ts.map +1 -1
- package/dist/plugin_handle.cjs.map +1 -1
- package/dist/plugin_handle.d.ts +1 -1
- package/dist/plugin_handle.js.map +1 -1
- package/dist/plugin_model.cjs +34 -37
- package/dist/plugin_model.cjs.map +1 -1
- package/dist/plugin_model.d.ts +55 -53
- package/dist/plugin_model.d.ts.map +1 -1
- package/dist/plugin_model.js +34 -37
- package/dist/plugin_model.js.map +1 -1
- package/package.json +8 -8
- package/src/block_model.ts +16 -5
- package/src/block_model_legacy.ts +1 -0
- package/src/index.ts +2 -0
- package/src/platforma.ts +11 -5
- package/src/plugin_handle.ts +1 -1
- package/src/plugin_model.ts +189 -76
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"block_model_legacy.js","names":["#done"],"sources":["../src/block_model_legacy.ts"],"sourcesContent":["import type {\n BlockRenderingMode,\n BlockSection,\n AnyFunction,\n PlRef,\n BlockCodeKnownFeatureFlags,\n BlockConfigContainer,\n} from \"@milaboratories/pl-model-common\";\nimport { REQUIRES_PFRAMES_VERSION } from \"@milaboratories/pl-model-common\";\nimport type { Checked, ConfigResult, TypedConfig } from \"./config\";\nimport { getImmediate } from \"./config\";\nimport { getPlatformaInstance, isInUI, tryRegisterCallback } from \"./internal\";\nimport type { Platforma, PlatformaApiVersion, PlatformaV1, PlatformaV2 } from \"./platforma\";\nimport type { InferRenderFunctionReturn, RenderFunctionLegacy } from \"./render\";\nimport { RenderCtxLegacy } from \"./render\";\nimport { PlatformaSDKVersion } from \"./version\";\nimport type {\n TypedConfigOrConfigLambda,\n ConfigRenderLambda,\n StdCtxArgsOnly,\n DeriveHref,\n ConfigRenderLambdaFlags,\n InferOutputsFromConfigs,\n} from \"./bconfig\";\nimport { downgradeCfgOrLambda, isConfigLambda } from \"./bconfig\";\nimport type { PlatformaExtended } from \"./platforma\";\n\ntype SectionsExpectedType = readonly BlockSection[];\n\ntype SectionsCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends SectionsExpectedType ? true : false\n>;\n\ntype InputsValidExpectedType = boolean;\n\ntype InputsValidCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends InputsValidExpectedType ? true : false\n>;\n\ntype NoOb = Record<string, never>;\n\n/** Main entry point that each block should use in it's \"config\" module. Don't forget\n * to call {@link done()} at the end of configuration. Value returned by this builder must be\n * exported as constant with name \"platforma\" from the \"config\" module. */\nexport class BlockModel<\n Args,\n OutputsCfg extends Record<string, TypedConfigOrConfigLambda>,\n UiState,\n Href extends `/${string}` = \"/\",\n> {\n private constructor(\n private config: {\n readonly renderingMode: BlockRenderingMode;\n readonly initialArgs?: Args;\n readonly initialUiState: UiState;\n readonly outputs: OutputsCfg;\n readonly inputsValid: TypedConfigOrConfigLambda;\n readonly sections: TypedConfigOrConfigLambda;\n readonly title?: ConfigRenderLambda;\n readonly subtitle?: ConfigRenderLambda;\n readonly tags?: ConfigRenderLambda;\n readonly enrichmentTargets?: ConfigRenderLambda;\n readonly featureFlags: BlockCodeKnownFeatureFlags;\n },\n ) {}\n\n public static get INITIAL_BLOCK_FEATURE_FLAGS(): BlockCodeKnownFeatureFlags {\n return {\n supportsLazyState: true,\n supportsPframeQueryRanking: true,\n requiresUIAPIVersion: 1,\n requiresModelAPIVersion: 1,\n requiresCreatePTable: 2,\n requiresPFramesVersion: REQUIRES_PFRAMES_VERSION,\n };\n }\n\n /** Initiates configuration builder */\n public static create(renderingMode: BlockRenderingMode): BlockModel<NoOb, {}, NoOb>;\n /** Initiates configuration builder */\n public static create(): BlockModel<NoOb, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(renderingMode: BlockRenderingMode): BlockModel<Args, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(): BlockModel<Args, {}, NoOb>;\n public static create(renderingMode: BlockRenderingMode = \"Heavy\"): BlockModel<NoOb, {}, NoOb> {\n return new BlockModel<NoOb, {}, NoOb>({\n renderingMode,\n initialUiState: {},\n outputs: {},\n inputsValid: getImmediate(true),\n sections: getImmediate([]),\n featureFlags: BlockModel.INITIAL_BLOCK_FEATURE_FLAGS,\n });\n }\n\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param cfg configuration describing how to render cell value from the blocks\n * workflow outputs\n * @deprecated use lambda-based API\n * */\n public output<const Key extends string, const Cfg extends TypedConfig>(\n key: Key,\n cfg: Cfg,\n ): BlockModel<Args, OutputsCfg & { [K in Key]: Cfg }, UiState, Href>;\n /**\n * Add output cell wrapped with additional status information to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags: ConfigRenderLambdaFlags & { withStatus: true },\n ): BlockModel<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & { withStatus: true };\n },\n UiState,\n Href\n >;\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags?: ConfigRenderLambdaFlags,\n ): BlockModel<\n Args,\n OutputsCfg & { [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> },\n UiState,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: TypedConfig | AnyFunction,\n flags: ConfigRenderLambdaFlags = {},\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n if (typeof cfgOrRf === \"function\") {\n const handle = `output#${key}`;\n tryRegisterCallback(handle, () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: {\n __renderLambda: true,\n handle,\n ...flags,\n },\n },\n });\n } else {\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: cfgOrRf,\n },\n });\n }\n }\n\n /** Shortcut for {@link output} with retentive flag set to true. */\n public retentiveOutput<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true });\n }\n\n /** Shortcut for {@link output} with withStatus flag set to true. */\n public outputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { withStatus: true });\n }\n\n /** Shortcut for {@link output} with retentive and withStatus flags set to true. */\n public retentiveOutputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true, withStatus: true });\n }\n\n /** Sets custom configuration predicate on the block args at which block can be executed\n * @deprecated use lambda-based API */\n public argsValid<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n /** Sets custom configuration predicate on the block args at which block can be executed */\n public argsValid<RF extends RenderFunctionLegacy<Args, UiState, boolean>>(\n rf: RF,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public argsValid(\n cfgOrRf: TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (typeof cfgOrRf === \"function\") {\n tryRegisterCallback(\"inputsValid\", () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: {\n __renderLambda: true,\n handle: \"inputsValid\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: cfgOrRf,\n });\n }\n }\n\n /** Sets the config to generate list of section in the left block overviews panel\n * @deprecated use lambda-based API */\n public sections<const S extends SectionsExpectedType>(\n rf: S,\n ): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;\n /** Sets the config to generate list of section in the left block overviews panel */\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunctionLegacy<Args, UiState, Ret>,\n >(rf: RF): BlockModel<Args, OutputsCfg, UiState, DeriveHref<ReturnType<RF>>>;\n public sections<const Cfg extends TypedConfig>(\n cfg: Cfg & SectionsCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<\n Args,\n OutputsCfg,\n UiState,\n DeriveHref<ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>>>\n >;\n public sections(\n arrOrCfgOrRf: SectionsExpectedType | TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (Array.isArray(arrOrCfgOrRf)) {\n return this.sections(getImmediate(arrOrCfgOrRf));\n } else if (typeof arrOrCfgOrRf === \"function\") {\n tryRegisterCallback(\"sections\", () => arrOrCfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: {\n __renderLambda: true,\n handle: \"sections\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: arrOrCfgOrRf as TypedConfig,\n });\n }\n }\n\n /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */\n public title(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"title\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n title: {\n __renderLambda: true,\n handle: \"title\",\n },\n });\n }\n\n public subtitle(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"subtitle\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n subtitle: {\n __renderLambda: true,\n handle: \"subtitle\",\n },\n });\n }\n\n public tags(\n rf: RenderFunctionLegacy<Args, UiState, string[]>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"tags\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n tags: {\n __renderLambda: true,\n handle: \"tags\",\n },\n });\n }\n\n /**\n * Sets initial args for the block, this value must be specified.\n * @deprecated use {@link withArgs}\n * */\n public initialArgs(value: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return this.withArgs(value);\n }\n\n /** Sets initial args for the block, this value must be specified. */\n public withArgs<Args>(initialArgs: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialArgs,\n });\n }\n\n /** Defines type and sets initial value for block UiState. */\n public withUiState<UiState>(\n initialUiState: UiState,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialUiState,\n });\n }\n\n /** Sets or overrides feature flags for the block. */\n public withFeatureFlags(\n flags: Partial<BlockCodeKnownFeatureFlags>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n featureFlags: {\n ...this.config.featureFlags,\n ...flags,\n },\n });\n }\n\n /**\n * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.\n * Influences dependency graph construction.\n */\n public enriches(lambda: (args: Args) => PlRef[]): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"enrichmentTargets\", lambda);\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n enrichmentTargets: {\n __renderLambda: true,\n handle: \"enrichmentTargets\",\n },\n });\n }\n\n public done(\n apiVersion?: 1,\n ): PlatformaExtended<\n PlatformaV1<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n public done(\n apiVersion: 2,\n ): PlatformaExtended<\n PlatformaV2<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n /** Renders all provided block settings into a pre-configured platforma API\n * instance, that can be used in frontend to interact with block state, and\n * other features provided by the platforma to the block. */\n public done(\n apiVersion: PlatformaApiVersion = 1,\n ): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n return this.withFeatureFlags({\n ...this.config.featureFlags,\n requiresUIAPIVersion: apiVersion,\n }).#done();\n }\n\n #done(): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n if (this.config.initialArgs === undefined) throw new Error(\"Initial arguments not set.\");\n\n const config: BlockConfigContainer = {\n v4: undefined,\n v3: {\n configVersion: 3,\n modelAPIVersion: 1,\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n initialUiState: this.config.initialUiState,\n inputsValid: this.config.inputsValid,\n sections: this.config.sections,\n title: this.config.title,\n subtitle: this.config.subtitle,\n tags: this.config.tags,\n outputs: this.config.outputs,\n enrichmentTargets: this.config.enrichmentTargets,\n featureFlags: this.config.featureFlags,\n },\n\n // fields below are added to allow previous desktop versions read generated configs\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n inputsValid: downgradeCfgOrLambda(this.config.inputsValid),\n sections: downgradeCfgOrLambda(this.config.sections),\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n downgradeCfgOrLambda(value),\n ]),\n ),\n };\n\n globalThis.platformaApiVersion = this.config.featureFlags\n .requiresUIAPIVersion as PlatformaApiVersion;\n\n if (!isInUI()) {\n // we are in the configuration rendering routine, not in actual UI\n return { config } as any;\n } else {\n // normal operation inside the UI\n return {\n ...getPlatformaInstance({\n sdkVersion: PlatformaSDKVersion,\n apiVersion: platformaApiVersion,\n }),\n blockModelInfo: {\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n {\n withStatus: Boolean(isConfigLambda(value) && value.withStatus),\n },\n ]),\n ),\n pluginIds: [],\n featureFlags: this.config.featureFlags,\n },\n };\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA8CA,IAAa,aAAb,MAAa,WAKX;CACA,YACE,QAaA;AAbQ,OAAA,SAAA;;CAeV,WAAkB,8BAA0D;AAC1E,SAAO;GACL,mBAAmB;GACnB,4BAA4B;GAC5B,sBAAsB;GACtB,yBAAyB;GACzB,sBAAsB;GACtB,wBAAwB;GACzB;;CAiBH,OAAc,OAAO,gBAAoC,SAAqC;AAC5F,SAAO,IAAI,WAA2B;GACpC;GACA,gBAAgB,EAAE;GAClB,SAAS,EAAE;GACX,aAAa,aAAa,KAAK;GAC/B,UAAU,aAAa,EAAE,CAAC;GAC1B,cAAc,WAAW;GAC1B,CAAC;;CAqDJ,OACE,KACA,SACA,QAAiC,EAAE,EACU;AAC7C,MAAI,OAAO,YAAY,YAAY;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B;GACnC,IAAI,KAAA;GACJ,IAAI;IACF,eAAe;IACf,iBAAiB;IACjB,YAAY;IACZ,eAAe,KAAK,OAAO;IAC3B,aAAa,KAAK,OAAO;IACzB,gBAAgB,KAAK,OAAO;IAC5B,aAAa,KAAK,OAAO;IACzB,UAAU,KAAK,OAAO;IACtB,OAAO,KAAK,OAAO;IACnB,UAAU,KAAK,OAAO;IACtB,MAAM,KAAK,OAAO;IAClB,SAAS,KAAK,OAAO;IACrB,mBAAmB,KAAK,OAAO;IAC/B,cAAc,KAAK,OAAO;IAC3B;GAGD,YAAY;GACZ,eAAe,KAAK,OAAO;GAC3B,aAAa,KAAK,OAAO;GACzB,aAAa,qBAAqB,KAAK,OAAO,YAAY;GAC1D,UAAU,qBAAqB,KAAK,OAAO,SAAS;GACpD,SAAS,OAAO,YACd,OAAO,QAAQ,KAAK,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,WAAW,CACxD,KACA,qBAAqB,MAAM,CAC5B,CAAC,CACH;GACF;AAED,aAAW,sBAAsB,KAAK,OAAO,aAC1C;AAEH,MAAI,CAAC,QAAQ,CAEX,QAAO,EAAE,QAAQ;MAGjB,QAAO;GACL,GAAG,qBAAqB;IACtB,YAAY;IACZ,YAAY;IACb,CAAC;GACF,gBAAgB;IACd,SAAS,OAAO,YACd,OAAO,QAAQ,KAAK,OAAO,QAAQ,CAAC,KAAK,CAAC,KAAK,WAAW,CACxD,KACA,EACE,YAAY,QAAQ,eAAe,MAAM,IAAI,MAAM,WAAW,EAC/D,CACF,CAAC,CACH;IACD,WAAW,EAAE;IACb,cAAc,KAAK,OAAO;IAC3B;GACF"}
|
|
1
|
+
{"version":3,"file":"block_model_legacy.js","names":["#done"],"sources":["../src/block_model_legacy.ts"],"sourcesContent":["import type {\n BlockRenderingMode,\n BlockSection,\n AnyFunction,\n PlRef,\n BlockCodeKnownFeatureFlags,\n BlockConfigContainer,\n} from \"@milaboratories/pl-model-common\";\nimport { REQUIRES_PFRAMES_VERSION } from \"@milaboratories/pl-model-common\";\nimport type { Checked, ConfigResult, TypedConfig } from \"./config\";\nimport { getImmediate } from \"./config\";\nimport { getPlatformaInstance, isInUI, tryRegisterCallback } from \"./internal\";\nimport type { Platforma, PlatformaApiVersion, PlatformaV1, PlatformaV2 } from \"./platforma\";\nimport type { InferRenderFunctionReturn, RenderFunctionLegacy } from \"./render\";\nimport { RenderCtxLegacy } from \"./render\";\nimport { PlatformaSDKVersion } from \"./version\";\nimport type {\n TypedConfigOrConfigLambda,\n ConfigRenderLambda,\n StdCtxArgsOnly,\n DeriveHref,\n ConfigRenderLambdaFlags,\n InferOutputsFromConfigs,\n} from \"./bconfig\";\nimport { downgradeCfgOrLambda, isConfigLambda } from \"./bconfig\";\nimport type { PlatformaExtended } from \"./platforma\";\n\ntype SectionsExpectedType = readonly BlockSection[];\n\ntype SectionsCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends SectionsExpectedType ? true : false\n>;\n\ntype InputsValidExpectedType = boolean;\n\ntype InputsValidCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends InputsValidExpectedType ? true : false\n>;\n\ntype NoOb = Record<string, never>;\n\n/** Main entry point that each block should use in it's \"config\" module. Don't forget\n * to call {@link done()} at the end of configuration. Value returned by this builder must be\n * exported as constant with name \"platforma\" from the \"config\" module. */\nexport class BlockModel<\n Args,\n OutputsCfg extends Record<string, TypedConfigOrConfigLambda>,\n UiState,\n Href extends `/${string}` = \"/\",\n> {\n private constructor(\n private config: {\n readonly renderingMode: BlockRenderingMode;\n readonly initialArgs?: Args;\n readonly initialUiState: UiState;\n readonly outputs: OutputsCfg;\n readonly inputsValid: TypedConfigOrConfigLambda;\n readonly sections: TypedConfigOrConfigLambda;\n readonly title?: ConfigRenderLambda;\n readonly subtitle?: ConfigRenderLambda;\n readonly tags?: ConfigRenderLambda;\n readonly enrichmentTargets?: ConfigRenderLambda;\n readonly featureFlags: BlockCodeKnownFeatureFlags;\n },\n ) {}\n\n public static get INITIAL_BLOCK_FEATURE_FLAGS(): BlockCodeKnownFeatureFlags {\n return {\n supportsLazyState: true,\n supportsPframeQueryRanking: true,\n requiresUIAPIVersion: 1,\n requiresModelAPIVersion: 1,\n requiresCreatePTable: 2,\n requiresPFramesVersion: REQUIRES_PFRAMES_VERSION,\n };\n }\n\n /** Initiates configuration builder */\n public static create(renderingMode: BlockRenderingMode): BlockModel<NoOb, {}, NoOb>;\n /** Initiates configuration builder */\n public static create(): BlockModel<NoOb, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(renderingMode: BlockRenderingMode): BlockModel<Args, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(): BlockModel<Args, {}, NoOb>;\n public static create(renderingMode: BlockRenderingMode = \"Heavy\"): BlockModel<NoOb, {}, NoOb> {\n return new BlockModel<NoOb, {}, NoOb>({\n renderingMode,\n initialUiState: {},\n outputs: {},\n inputsValid: getImmediate(true),\n sections: getImmediate([]),\n featureFlags: BlockModel.INITIAL_BLOCK_FEATURE_FLAGS,\n });\n }\n\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param cfg configuration describing how to render cell value from the blocks\n * workflow outputs\n * @deprecated use lambda-based API\n * */\n public output<const Key extends string, const Cfg extends TypedConfig>(\n key: Key,\n cfg: Cfg,\n ): BlockModel<Args, OutputsCfg & { [K in Key]: Cfg }, UiState, Href>;\n /**\n * Add output cell wrapped with additional status information to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags: ConfigRenderLambdaFlags & { withStatus: true },\n ): BlockModel<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & { withStatus: true };\n },\n UiState,\n Href\n >;\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags?: ConfigRenderLambdaFlags,\n ): BlockModel<\n Args,\n OutputsCfg & { [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> },\n UiState,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: TypedConfig | AnyFunction,\n flags: ConfigRenderLambdaFlags = {},\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n if (typeof cfgOrRf === \"function\") {\n const handle = `output#${key}`;\n tryRegisterCallback(handle, () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: {\n __renderLambda: true,\n handle,\n ...flags,\n },\n },\n });\n } else {\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: cfgOrRf,\n },\n });\n }\n }\n\n /** Shortcut for {@link output} with retentive flag set to true. */\n public retentiveOutput<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true });\n }\n\n /** Shortcut for {@link output} with withStatus flag set to true. */\n public outputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { withStatus: true });\n }\n\n /** Shortcut for {@link output} with retentive and withStatus flags set to true. */\n public retentiveOutputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true, withStatus: true });\n }\n\n /** Sets custom configuration predicate on the block args at which block can be executed\n * @deprecated use lambda-based API */\n public argsValid<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n /** Sets custom configuration predicate on the block args at which block can be executed */\n public argsValid<RF extends RenderFunctionLegacy<Args, UiState, boolean>>(\n rf: RF,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public argsValid(\n cfgOrRf: TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (typeof cfgOrRf === \"function\") {\n tryRegisterCallback(\"inputsValid\", () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: {\n __renderLambda: true,\n handle: \"inputsValid\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: cfgOrRf,\n });\n }\n }\n\n /** Sets the config to generate list of section in the left block overviews panel\n * @deprecated use lambda-based API */\n public sections<const S extends SectionsExpectedType>(\n rf: S,\n ): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;\n /** Sets the config to generate list of section in the left block overviews panel */\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunctionLegacy<Args, UiState, Ret>,\n >(rf: RF): BlockModel<Args, OutputsCfg, UiState, DeriveHref<ReturnType<RF>>>;\n public sections<const Cfg extends TypedConfig>(\n cfg: Cfg & SectionsCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<\n Args,\n OutputsCfg,\n UiState,\n DeriveHref<ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>>>\n >;\n public sections(\n arrOrCfgOrRf: SectionsExpectedType | TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (Array.isArray(arrOrCfgOrRf)) {\n return this.sections(getImmediate(arrOrCfgOrRf));\n } else if (typeof arrOrCfgOrRf === \"function\") {\n tryRegisterCallback(\"sections\", () => arrOrCfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: {\n __renderLambda: true,\n handle: \"sections\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: arrOrCfgOrRf as TypedConfig,\n });\n }\n }\n\n /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */\n public title(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"title\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n title: {\n __renderLambda: true,\n handle: \"title\",\n },\n });\n }\n\n public subtitle(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"subtitle\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n subtitle: {\n __renderLambda: true,\n handle: \"subtitle\",\n },\n });\n }\n\n public tags(\n rf: RenderFunctionLegacy<Args, UiState, string[]>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"tags\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n tags: {\n __renderLambda: true,\n handle: \"tags\",\n },\n });\n }\n\n /**\n * Sets initial args for the block, this value must be specified.\n * @deprecated use {@link withArgs}\n * */\n public initialArgs(value: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return this.withArgs(value);\n }\n\n /** Sets initial args for the block, this value must be specified. */\n public withArgs<Args>(initialArgs: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialArgs,\n });\n }\n\n /** Defines type and sets initial value for block UiState. */\n public withUiState<UiState>(\n initialUiState: UiState,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialUiState,\n });\n }\n\n /** Sets or overrides feature flags for the block. */\n public withFeatureFlags(\n flags: Partial<BlockCodeKnownFeatureFlags>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n featureFlags: {\n ...this.config.featureFlags,\n ...flags,\n },\n });\n }\n\n /**\n * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.\n * Influences dependency graph construction.\n */\n public enriches(lambda: (args: Args) => PlRef[]): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"enrichmentTargets\", lambda);\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n enrichmentTargets: {\n __renderLambda: true,\n handle: \"enrichmentTargets\",\n },\n });\n }\n\n public done(\n apiVersion?: 1,\n ): PlatformaExtended<\n PlatformaV1<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n public done(\n apiVersion: 2,\n ): PlatformaExtended<\n PlatformaV2<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n /** Renders all provided block settings into a pre-configured platforma API\n * instance, that can be used in frontend to interact with block state, and\n * other features provided by the platforma to the block. */\n public done(\n apiVersion: PlatformaApiVersion = 1,\n ): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n return this.withFeatureFlags({\n ...this.config.featureFlags,\n requiresUIAPIVersion: apiVersion,\n }).#done();\n }\n\n #done(): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n if (this.config.initialArgs === undefined) throw new Error(\"Initial arguments not set.\");\n\n const config: BlockConfigContainer = {\n v4: undefined,\n v3: {\n configVersion: 3,\n modelAPIVersion: 1,\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n initialUiState: this.config.initialUiState,\n inputsValid: this.config.inputsValid,\n sections: this.config.sections,\n title: this.config.title,\n subtitle: this.config.subtitle,\n tags: this.config.tags,\n outputs: this.config.outputs,\n enrichmentTargets: this.config.enrichmentTargets,\n featureFlags: this.config.featureFlags,\n },\n\n // fields below are added to allow previous desktop versions read generated configs\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n inputsValid: downgradeCfgOrLambda(this.config.inputsValid),\n sections: downgradeCfgOrLambda(this.config.sections),\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n downgradeCfgOrLambda(value),\n ]),\n ),\n };\n\n globalThis.platformaApiVersion = this.config.featureFlags\n .requiresUIAPIVersion as PlatformaApiVersion;\n\n if (!isInUI()) {\n // we are in the configuration rendering routine, not in actual UI\n return { config } as any;\n } else {\n // normal operation inside the UI\n return {\n ...getPlatformaInstance({\n sdkVersion: PlatformaSDKVersion,\n apiVersion: platformaApiVersion,\n }),\n blockModelInfo: {\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n {\n withStatus: Boolean(isConfigLambda(value) && value.withStatus),\n },\n ]),\n ),\n pluginIds: [],\n featureFlags: this.config.featureFlags,\n pluginPublicOutputs: {},\n },\n };\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA8CA,IAAa,aAAb,MAAa,WAKX;CACA,YACE,QAaA;AAbQ,OAAA,SAAA;;CAeV,WAAkB,8BAA0D;AAC1E,SAAO;GACL,mBAAmB;GACnB,4BAA4B;GAC5B,sBAAsB;GACtB,yBAAyB;GACzB,sBAAsB;GACtB,wBAAwB;GACzB;;CAiBH,OAAc,OAAO,gBAAoC,SAAqC;AAC5F,SAAO,IAAI,WAA2B;GACpC;GACA,gBAAgB,EAAE;GAClB,SAAS,EAAE;GACX,aAAa,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isLabelProvider, ColumnProvider, PColumnCollection, PColumnEntryUnive
|
|
|
34
34
|
import { BlockRenderCtx, InferRenderFunctionReturn, PluginRenderCtx, RenderCtx, RenderCtxBase, RenderCtxLegacy, RenderFunction, RenderFunctionLegacy, ResultPool, UniversalColumnOption, UnwrapFutureRef } from "./render/api.js";
|
|
35
35
|
import { PColumnKeyList, PColumnResourceMapData, PColumnResourceMapEntry, RT_BINARY_PARTITIONED, RT_BINARY_SUPER_PARTITIONED, RT_JSON_PARTITIONED, RT_JSON_SUPER_PARTITIONED, RT_PARQUET_PARTITIONED, RT_PARQUET_SUPER_PARTITIONED, RT_RESOURCE_MAP, RT_RESOURCE_MAP_PARTITIONED, allPColumnsReady, convertOrParsePColumnData, getPartitionKeysList, getUniquePartitionKeys, isPColumnReady, parsePColumnData, parseResourceMap } from "./render/util/pcolumn_data.js";
|
|
36
36
|
import { filterDataInfoEntries } from "./render/util/axis_filtering.js";
|
|
37
|
-
import { PluginConfig, PluginData, PluginDataModel, PluginDataModelBuilder, PluginDataModelVersions, PluginFactory, PluginInstance, PluginModel, PluginOutputs, PluginParams } from "./plugin_model.js";
|
|
37
|
+
import { PluginConfig, PluginData, PluginDataModel, PluginDataModelBuilder, PluginDataModelVersions, PluginFactory, PluginInstance, PluginModel, PluginOutputs, PluginParams, PluginPublicOutputs, PublicOutputFieldDef } from "./plugin_model.js";
|
|
38
38
|
import { BlockModelV3, ParamsInput, PluginRecord } from "./block_model.js";
|
|
39
|
-
import { BlockModelInfo, InferArgsType, InferBlockState, InferBlockStatePatch, InferDataType, InferHrefType, InferOutputsType, InferPluginData,
|
|
39
|
+
import { BlockModelInfo, InferArgsType, InferBlockState, InferBlockStatePatch, InferDataType, InferHrefType, InferOutputsType, InferPluginData, InferPluginNames, InferPluginUiEntries, InferUiState, Platforma, PlatformaApiVersion, PlatformaExtended, PlatformaFactory, PlatformaV1, PlatformaV2, PlatformaV3 } from "./platforma.js";
|
|
40
40
|
import { BlockModel } from "./block_model_legacy.js";
|
|
41
41
|
import { AxesVault, enrichCompatible, getAvailableWithLinkersAxes } from "./pframe_utils/axes.js";
|
|
42
42
|
import { createPFrameForGraphs, isHiddenFromGraphColumn, isHiddenFromUIColumn } from "./components/PFrameForGraphs.js";
|
|
@@ -74,4 +74,4 @@ import { getService } from "./services/get_services.js";
|
|
|
74
74
|
import { getEnvironmentValue } from "./env_value.js";
|
|
75
75
|
export * from "@milaboratories/pl-model-common";
|
|
76
76
|
export * from "@milaboratories/pl-error-like";
|
|
77
|
-
export { ActAnd, ActExtractArchiveAndGetURL, ActFlatten, ActGetBlobContent, ActGetBlobContentAsJson, ActGetBlobContentAsString, ActGetDownloadedBlobContent, ActGetField, ActGetFromCtx, ActGetImmediate, ActGetLastLogs, ActGetLogHandle, ActGetOnDemandBlobContent, ActGetProgressLog, ActGetProgressLogWithInfo, ActGetResourceField, ActGetResourceValueAsJson, ActImportProgress, ActIsEmpty, ActIsolate, ActMakeArray, ActMakeObject, ActMapArrayValues, ActMapRecordValues, ActMapResourceFields, ActNot, ActOr, ActionResult, AnchorEntry, AnchoredBuildOptions, AnchoredColumnCollection, AnchoredFindColumnsOptions, AndFilter, AnnotationFilter, AnnotationMode, AnnotationScript, AnnotationScript2, AnnotationScriptUi, AnnotationSpec, AnnotationSpecUi, AnnotationStep, AnnotationStepUi, AnyForm, Args, ArrayColumnProvider, AxesVault, AxisLabelProvider, BLOCK_SERVICE_FLAGS, BLOCK_STORAGE_FACADE_VERSION, BlockApiV1, BlockApiV2, BlockConfig, BlockConfigV3, BlockConfigV4, BlockDefaultModelServices, BlockDefaultUiServices, BlockModel, BlockModelInfo, BlockModelV3, BlockRenderCtx, BlockServiceFlags, BlockStatePatch, type BlockStorage, BlockStorageFacade, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, type BlockStorageSchemaVersion, BuildDatasetOptions, BuildOptions, CancelSubscription, Cfg, CfgAnd, CfgBlobContent, CfgBlobContentAsJson, CfgBlobContentAsString, CfgDownloadedBlobContent, CfgExtractArchiveAndGetURL, CfgFlatten, CfgGetFromCtx, CfgGetJsonField, CfgGetResourceField, CfgImmediate, CfgImportProgress, CfgIsEmpty, CfgIsolate, CfgLastLogs, CfgLogHandle, CfgMakeArray, CfgMakeObject, CfgMapArrayValues, CfgMapRecordValues, CfgMapResourceFields, CfgNot, CfgOnDemandBlobContent, CfgOr, CfgProgressLog, CfgProgressLogWithInfo, CfgRenderingMode, CfgResourceValueAsJson, Checked, ColumnCollection, ColumnCollectionBuilder, ColumnData, ColumnDataStatus, ColumnMatch, ColumnMatcher, ColumnOrderRule, ColumnProvider, ColumnSelector, ColumnSnapshot, ColumnSnapshotProvider, ColumnSource, ColumnVariant, ColumnVisibilityRule, ColumnsDisplayOptions, ColumnsSelectorConfig, CommonFieldTraverseOps, CommonTraversalOps, ConfAction, ConfigRenderLambda, ConfigRenderLambdaFlags, ConfigResult, CurrentSdkInfo, DataModel, DataModelBuilder, DatasetOption, DatasetSelection, DeriveHref, DeriveLabelsFormatters, DeriveLabelsOptions, Entry, ExpandByPartitionOpts, ExpandByPartitionResult, ExpressionSpec, ExtractAction, ExtractFunctionHandleReturn, ExtractFutureRefType, FieldTraversalStep, FieldType, FilterSpec, FilterSpecLeaf, FilterSpecNode, FilterSpecOfType, FilterSpecType, FilterSpecUi, FilterUi, FilterUiOfType, FilterUiType, FindColumnsOptions, FormField, FutureRef, GetFieldStep, InferArgsType, InferBlockState, InferBlockStatePatch, InferDataType, InferFactoryData, InferFactoryModelServices, InferFactoryOutputs, InferFactoryParams, InferFactoryUiServices, InferHrefType, InferOutputType, InferOutputsFromConfigs, InferOutputsFromLambdas, InferOutputsType, InferPluginData, InferPluginHandle,
|
|
77
|
+
export { ActAnd, ActExtractArchiveAndGetURL, ActFlatten, ActGetBlobContent, ActGetBlobContentAsJson, ActGetBlobContentAsString, ActGetDownloadedBlobContent, ActGetField, ActGetFromCtx, ActGetImmediate, ActGetLastLogs, ActGetLogHandle, ActGetOnDemandBlobContent, ActGetProgressLog, ActGetProgressLogWithInfo, ActGetResourceField, ActGetResourceValueAsJson, ActImportProgress, ActIsEmpty, ActIsolate, ActMakeArray, ActMakeObject, ActMapArrayValues, ActMapRecordValues, ActMapResourceFields, ActNot, ActOr, ActionResult, AnchorEntry, AnchoredBuildOptions, AnchoredColumnCollection, AnchoredFindColumnsOptions, AndFilter, AnnotationFilter, AnnotationMode, AnnotationScript, AnnotationScript2, AnnotationScriptUi, AnnotationSpec, AnnotationSpecUi, AnnotationStep, AnnotationStepUi, AnyForm, Args, ArrayColumnProvider, AxesVault, AxisLabelProvider, BLOCK_SERVICE_FLAGS, BLOCK_STORAGE_FACADE_VERSION, BlockApiV1, BlockApiV2, BlockConfig, BlockConfigV3, BlockConfigV4, BlockDefaultModelServices, BlockDefaultUiServices, BlockModel, BlockModelInfo, BlockModelV3, BlockRenderCtx, BlockServiceFlags, BlockStatePatch, type BlockStorage, BlockStorageFacade, BlockStorageFacadeCallbacks, BlockStorageFacadeHandles, type BlockStorageSchemaVersion, BuildDatasetOptions, BuildOptions, CancelSubscription, Cfg, CfgAnd, CfgBlobContent, CfgBlobContentAsJson, CfgBlobContentAsString, CfgDownloadedBlobContent, CfgExtractArchiveAndGetURL, CfgFlatten, CfgGetFromCtx, CfgGetJsonField, CfgGetResourceField, CfgImmediate, CfgImportProgress, CfgIsEmpty, CfgIsolate, CfgLastLogs, CfgLogHandle, CfgMakeArray, CfgMakeObject, CfgMapArrayValues, CfgMapRecordValues, CfgMapResourceFields, CfgNot, CfgOnDemandBlobContent, CfgOr, CfgProgressLog, CfgProgressLogWithInfo, CfgRenderingMode, CfgResourceValueAsJson, Checked, ColumnCollection, ColumnCollectionBuilder, ColumnData, ColumnDataStatus, ColumnMatch, ColumnMatcher, ColumnOrderRule, ColumnProvider, ColumnSelector, ColumnSnapshot, ColumnSnapshotProvider, ColumnSource, ColumnVariant, ColumnVisibilityRule, ColumnsDisplayOptions, ColumnsSelectorConfig, CommonFieldTraverseOps, CommonTraversalOps, ConfAction, ConfigRenderLambda, ConfigRenderLambdaFlags, ConfigResult, CurrentSdkInfo, DataModel, DataModelBuilder, DatasetOption, DatasetSelection, DeriveHref, DeriveLabelsFormatters, DeriveLabelsOptions, Entry, ExpandByPartitionOpts, ExpandByPartitionResult, ExpressionSpec, ExtractAction, ExtractFunctionHandleReturn, ExtractFutureRefType, FieldTraversalStep, FieldType, FilterSpec, FilterSpecLeaf, FilterSpecNode, FilterSpecOfType, FilterSpecType, FilterSpecUi, FilterUi, FilterUiOfType, FilterUiType, FindColumnsOptions, FormField, FutureRef, GetFieldStep, InferArgsType, InferBlockState, InferBlockStatePatch, InferDataType, InferFactoryData, InferFactoryModelServices, InferFactoryOutputs, InferFactoryParams, InferFactoryUiServices, InferHrefType, InferOutputType, InferOutputsFromConfigs, InferOutputsFromLambdas, InferOutputsType, InferPluginData, InferPluginHandle, InferPluginNames, InferPluginUiEntries, InferRenderFunctionReturn, InferUiState, InferVarTypeSafe, IsNA, It, internal_d_exports as JsRenderInternal, DeriveLabelsOptions as LabelDerivationOps, LinkerStep, Log10, MainOutputs, MatchQualifications, MatchVariant, MatchingMode, type MigrateBlockStorageConfig, type MigrationFailure, type MigrationResult, type MigrationSuccess, ModelServices, type MutateStoragePayload, NotFilter, NumericalComparisonFilter, OptionalPlResourceEntry, OrFilter, OutputColumnProvider, OutputColumnProviderOpts, OutputError, PColumnCollection, PColumnDataUniversal, PColumnEntryUniversal, PColumnEntryWithLabel, PColumnKeyList, PColumnLazyUniversal, PColumnLazyWithLabel, PColumnPredicate, PColumnResourceMapData, PColumnResourceMapEntry, PFrameImpl, POCExtractAction, PTableKey, PTableParamsV2, type ParamsInput, Patch, PatternFilter, PatternPredicate, PatternPredicateContainSubsequence, PatternPredicateEquals, PlDataTableFilterMeta, PlDataTableFilterSpecLeaf, PlDataTableFilters, PlDataTableFiltersWithMeta, PlDataTableGridStateCore, PlDataTableModel, PlDataTableSheet, PlDataTableSheetState, PlDataTableStateV2, PlDataTableStateV2CacheEntry, PlDataTableStateV2Normalized, PlMultiSequenceAlignmentColorSchemeOption, PlMultiSequenceAlignmentModel, PlMultiSequenceAlignmentSettings, PlMultiSequenceAlignmentWidget, PlResourceEntry, PlSelectionModel, PlTableColumnIdJson, Platforma, PlatformaApiVersion, PlatformaExtended, PlatformaFactory, PlatformaSDKVersion, PlatformaV1, PlatformaV2, PlatformaV3, type PluginConfig, type PluginData, PluginDataModel, PluginDataModelBuilder, type PluginDataModelVersions, type PluginFactory, PluginFactoryLike, PluginHandle, PluginInstance, PluginModel, type PluginName, type PluginOutputs, type PluginParams, type PluginPublicOutputs, type PluginRecord, type PluginRegistry, PluginRenderCtx, PrimitiveOrConfig, PrimitiveToCfg, type PublicOutputFieldDef, RT_BINARY_PARTITIONED, RT_BINARY_SUPER_PARTITIONED, RT_JSON_PARTITIONED, RT_JSON_SUPER_PARTITIONED, RT_PARQUET_PARTITIONED, RT_PARQUET_SUPER_PARTITIONED, RT_RESOURCE_MAP, RT_RESOURCE_MAP_PARTITIONED, RelaxedAxisSelector, RelaxedColumnSelector, RelaxedRecord, RelaxedStringMatchers, RenderCtx, RenderCtxBase, RenderCtxLegacy, RenderFunction, RenderFunctionLegacy, ResolveCfgType, ResolveModelServices, ResolveUiServices, ResourceTraversalOps, ResourceType, ResultPool, ResultPoolColumnSnapshotProvider, SdkInfo, ServiceProxy, SimplifiedPColumnSpec, SimplifiedUniversalPColumnEntry, SnapshotColumnProvider, SortedCumulativeSum, Entry as SpecExtractorResult, SplitAxis, StagingOutputs, StdCtx, StdCtxArgsOnly, StringMatcher, TooltipEntry, Trace, TraceEntry, TransformedColumn, TreeNodeAccessor, TypeField, TypeFieldRecord, TypeForm, TypeToLiteral, TypedConfig, TypedConfigOrConfigLambda, TypedConfigOrString, UiServices, UiState, Unionize, UniversalColumnOption, UnwrapFutureRef, ValueRank, type VersionedData, allPColumnsReady, and, blockServiceNames, buildDatasetOptions, buildRefMap, buildServices, collectCtxColumnSnapshotProviders, compileAnnotationScript, compileFilter, compileFilters, convertColumnSelectorToMultiColumnSelector, convertFilterSpecsToExpressionSpecs, convertFilterUiToExpressionImpl, convertFilterUiToExpressions, convertOrParsePColumnData, convertRelaxedAxisSelectorToMultiAxisSelector, convertRelaxedColumnSelectorToMultiColumnSelector, createBlockStorage, createColumnSnapshot, createDatasetSelection, createDefaultPTableParams, createPFrameForGraphs, createPlDataTable, createPlDataTableOptionsV3, createPlDataTableSheet, createPlDataTableStateV2, createPlDataTableV2, createPlDataTableV3, createPlSelectionModel, createReadyColumnData, createRowSelectionColumn, createServiceProxy, deriveDataFromStorage, deriveDistinctLabels, deriveDistinctTooltips, deriveLabels, discoverTableColumnSnaphots, distillFilterSpec, downgradeCfgOrLambda, enrichCompatible, expandByPartition, extractArchiveAndGetURL, extractConfig, filterDataInfoEntries, filterMatchesToOptions, filterSpecToSpecQueryExpr, findFilterColumns, flatten, fromPlOption, fromPlRef, getAllRelatedColumns, getAvailableWithLinkersAxes, getAxisUniqueValues, getBlobContent, getBlobContentAsJson, getBlobContentAsString, getColumnOrAxisValueLabelsId, getColumnSpecById, getColumnUniqueValues, getColumnsFull, getDownloadedBlobContent, getEffectiveVisibility, getEnvironmentValue, getFromCfg, getImmediate, getImportProgress, getJsonField, getLastLogs, getLogHandle, getOnDemandBlobContent, getOrderPriority, getPartitionKeysList, getPlatformaApiVersion, getPluginData, getProgressLog, getProgressLogWithInfo, getRawPlatformaInstance, getRelatedColumns, getRequestColumnsFromSelectedSources, getResourceField, getResourceValueAsJson, getService, getSingleColumnData, getStorageData, getUniquePartitionKeys, getUniqueSourceValuesWithLabels, ifDef, isBlockStorage, isColumnHidden, isColumnOptional, isColumnSnapshotProvider, isConfigLambda, isDatasetSelection, isEmpty, isHiddenFromGraphColumn, isHiddenFromUIColumn, isPColumnReady, isPluginOutputKey, isolate, makeArray, makeObject, mapArrayValues, mapRecordValues, mapResourceFields, migrateBlockStorage, normalizeBlockStorage, not, or, parsePColumnData, parseResourceMap, pluginOutputKey, pluginOutputPrefix, readOutput, registerFacadeCallbacks, toColumnSnapshotProvider, unreachable, updateStorageData, upgradePlDataTableStateV2, wrapOutputs };
|
package/dist/package.cjs
CHANGED
package/dist/package.js
CHANGED
package/dist/platforma.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { BlockApiV1 } from "./block_api_v1.js";
|
|
|
4
4
|
import { BlockApiV2 } from "./block_api_v2.js";
|
|
5
5
|
import { BlockApiV3 } from "./block_api_v3.js";
|
|
6
6
|
import { SdkInfo } from "./version.js";
|
|
7
|
+
import { PublicOutputFieldDef } from "./plugin_model.js";
|
|
7
8
|
import { PluginRecord } from "./block_model.js";
|
|
8
9
|
import { BlockCodeKnownFeatureFlags, BlockOutputsBase, BlockStateV3, DriverKit, OutputWithStatus, ServiceDispatch, UiServices as UiServices$1 } from "@milaboratories/pl-model-common";
|
|
9
10
|
|
|
@@ -41,6 +42,7 @@ type BlockModelInfo = {
|
|
|
41
42
|
}>;
|
|
42
43
|
pluginIds: PluginHandle[];
|
|
43
44
|
featureFlags: BlockCodeKnownFeatureFlags;
|
|
45
|
+
pluginPublicOutputs: Record<string, Record<string, PublicOutputFieldDef>>;
|
|
44
46
|
};
|
|
45
47
|
type PlatformaApiVersion = Platforma["apiVersion"];
|
|
46
48
|
type InferArgsType<Pl extends Platforma> = Pl extends Platforma<infer Args> ? Args : never;
|
|
@@ -58,13 +60,14 @@ type InferPluginNames<Pl> = Pl extends PlatformaV3<unknown, unknown, BlockOutput
|
|
|
58
60
|
/** Extract the Data type for a specific plugin by its ID. */
|
|
59
61
|
type InferPluginData<Pl, PluginId extends string> = Pl extends PlatformaV3<unknown, unknown, BlockOutputsBase, `/${string}`, infer P> ? PluginId extends keyof P ? P[PluginId] extends PluginRecord<infer D, any, any> ? D : never : never : never;
|
|
60
62
|
/**
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
63
|
+
* Derives the UI-facing entry map for a plugin registry.
|
|
64
|
+
* For each plugin instance, produces a typed handle and its public outputs —
|
|
65
|
+
* the subset of plugin state accessible to block UI without usePlugin().
|
|
64
66
|
*/
|
|
65
|
-
type
|
|
67
|
+
type InferPluginUiEntries<T extends Record<string, unknown>> = { readonly [K in keyof T]: T[K] extends PluginRecord<infer Data, infer Params, infer Outputs, infer PublicOutputs, infer ModelServices, infer UiServices> ? {
|
|
66
68
|
handle: PluginHandle<PluginFactoryLike<Data, Params, Outputs, ModelServices, UiServices>>;
|
|
69
|
+
publicOutputs: PublicOutputs;
|
|
67
70
|
} : never };
|
|
68
71
|
//#endregion
|
|
69
|
-
export { BlockModelInfo, InferArgsType, InferBlockState, InferBlockStatePatch, InferDataType, InferHrefType, InferOutputsType, InferPluginData,
|
|
72
|
+
export { BlockModelInfo, InferArgsType, InferBlockState, InferBlockStatePatch, InferDataType, InferHrefType, InferOutputsType, InferPluginData, InferPluginNames, InferPluginUiEntries, InferUiState, Platforma, PlatformaApiVersion, PlatformaExtended, PlatformaFactory, PlatformaV1, PlatformaV2, PlatformaV3 };
|
|
70
73
|
//# sourceMappingURL=platforma.d.ts.map
|
package/dist/platforma.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platforma.d.ts","names":[],"sources":["../src/platforma.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"platforma.d.ts","names":[],"sources":["../src/platforma.ts"],"mappings":";;;;;;;;;;;;UAmBiB,WAAA,iCAEC,MAAA,SAAe,gBAAA,aAA6B,MAAA,SAE1D,gBAAA,iFAKM,UAAA,CAAW,IAAA,EAAM,OAAA,EAAS,OAAA,EAAS,IAAA,GAAO,SAAA;EATxB;EAAA,SAWjB,OAAA,EAAS,OAAA;EAAA,SACT,UAAA;AAAA;;UAIM,WAAA,iCAEC,MAAA,SAAe,gBAAA,aAA6B,MAAA,SAE1D,gBAAA,iFAKM,UAAA,CAAW,IAAA,EAAM,OAAA,EAAS,OAAA,EAAS,IAAA,GAAO,SAAA;EAhB/B;EAAA,SAkBV,OAAA,EAAS,OAAA;EAAA,SACT,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AA,IACnC,EAAA,SAAW,SAAA,UAAmB,MAAA,SAAe,gBAAA,0BACzC,IAAA;AAAA,KAGM,aAAA,YAAyB,SAAA,IACnC,EAAA,SAAW,SAAA,UAAmB,gBAAA,yBAAyC,IAAA;AAAA,KAE7D,gBAAA,IAAoB,MAAA;EAAU,UAAA;AAAA,MAAyB,SAAA;AAAA,KAEvD,eAAA,YAA2B,SAAA,IAAa,YAAA,CAClD,aAAA,CAAc,EAAA,GACd,gBAAA,CAAiB,EAAA,GACjB,aAAA,CAAc,EAAA;AAAA,KAGJ,oBAAA,YAAgC,SAAA,IAAa,eAAA,CACvD,aAAA,CAAc,EAAA,GACd,gBAAA,CAAiB,EAAA,GACjB,YAAA,CAAa,EAAA,GACb,aAAA,CAAc,EAAA;;KAIJ,gBAAA,OACV,EAAA,SAAW,WAAA,mBAA8B,gBAAA,0CACtB,CAAA;;KAIT,eAAA,gCACV,EAAA,SAAW,WAAA,mBAA8B,gBAAA,2BACrC,QAAA,eAAuB,CAAA,GACrB,CAAA,CAAE,QAAA,UAAkB,YAAA,sBAClB,CAAA;;;;;;KAUE,oBAAA,WAA+B,MAAA,4CACpB,CAAA,GAAI,CAAA,CAAE,CAAA,UAAW,YAAA;EAShC,MAAA,EAAQ,YAAA,CAAa,iBAAA,CAAkB,IAAA,EAAM,MAAA,EAAQ,OAAA,EAAS,aAAA,EAAe,UAAA;EAC7E,aAAA,EAAe,aAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin_handle.cjs","names":[],"sources":["../src/plugin_handle.ts"],"sourcesContent":["/**\n * PluginHandle — Opaque branded handle and output key utilities for plugin instances.\n *\n * Extracted into its own module to break circular dependencies:\n * both block_storage.ts and plugin_model.ts can import from here\n * without depending on each other.\n *\n * @module plugin_handle\n */\n\nimport type { Branded } from \"@milaboratories/helpers\";\n\n/**\n * Phantom-only base type for constraining PluginHandle's type parameter.\n *\n * PluginFactory has create() → PluginInstance with function properties, making it invariant\n * under strictFunctionTypes. PluginFactoryLike exposes only the covariant `__types` phantom,\n * avoiding the contravariance chain. Handles only need `__types` for type extraction.\n *\n * PluginFactory extends PluginFactoryLike, so every concrete factory satisfies this constraint.\n */\nexport interface PluginFactoryLike<\n Data extends Record<string, unknown> = Record<string, unknown>,\n Params extends undefined | Record<string, unknown> = undefined | Record<string, unknown>,\n Outputs extends Record<string, unknown> = Record<string, unknown>,\n ModelServices = unknown,\n UiServices = unknown,\n> {\n readonly __types?: {\n data: Data;\n params: Params;\n outputs: Outputs;\n modelServices: ModelServices;\n uiServices: UiServices;\n };\n}\n\n/** Extract the Data type from a PluginFactoryLike phantom. */\nexport type InferFactoryData<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<infer D, any, any, any, any> ? D : Record<string, unknown>\n>;\n\n/** Extract the Params type from a PluginFactoryLike phantom. */\nexport type InferFactoryParams<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<any, infer P, any, any, any> ? P : undefined\n>;\n\n/** Extract the Outputs type from a PluginFactoryLike phantom. */\nexport type InferFactoryOutputs<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<any, any, infer O, any, any> ? O : Record<string, unknown>\n>;\n\n/** Extract the pre-resolved model services type from a PluginFactoryLike phantom. */\nexport type InferFactoryModelServices<F extends PluginFactoryLike> =\n F extends PluginFactoryLike<any, any, any, infer ModelServices, any> ? ModelServices : {};\n\n/** Extract the pre-resolved UI services type from a PluginFactoryLike phantom. */\nexport type InferFactoryUiServices<F extends PluginFactoryLike> =\n F extends PluginFactoryLike<any, any, any, any, infer UiServices> ? UiServices : {};\n\n/**\n * Derive a typed PluginHandle from a PluginFactory type.\n * Normalizes the brand to data/params/outputs/services (strips config) so handles\n * from
|
|
1
|
+
{"version":3,"file":"plugin_handle.cjs","names":[],"sources":["../src/plugin_handle.ts"],"sourcesContent":["/**\n * PluginHandle — Opaque branded handle and output key utilities for plugin instances.\n *\n * Extracted into its own module to break circular dependencies:\n * both block_storage.ts and plugin_model.ts can import from here\n * without depending on each other.\n *\n * @module plugin_handle\n */\n\nimport type { Branded } from \"@milaboratories/helpers\";\n\n/**\n * Phantom-only base type for constraining PluginHandle's type parameter.\n *\n * PluginFactory has create() → PluginInstance with function properties, making it invariant\n * under strictFunctionTypes. PluginFactoryLike exposes only the covariant `__types` phantom,\n * avoiding the contravariance chain. Handles only need `__types` for type extraction.\n *\n * PluginFactory extends PluginFactoryLike, so every concrete factory satisfies this constraint.\n */\nexport interface PluginFactoryLike<\n Data extends Record<string, unknown> = Record<string, unknown>,\n Params extends undefined | Record<string, unknown> = undefined | Record<string, unknown>,\n Outputs extends Record<string, unknown> = Record<string, unknown>,\n ModelServices = unknown,\n UiServices = unknown,\n> {\n readonly __types?: {\n data: Data;\n params: Params;\n outputs: Outputs;\n modelServices: ModelServices;\n uiServices: UiServices;\n };\n}\n\n/** Extract the Data type from a PluginFactoryLike phantom. */\nexport type InferFactoryData<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<infer D, any, any, any, any> ? D : Record<string, unknown>\n>;\n\n/** Extract the Params type from a PluginFactoryLike phantom. */\nexport type InferFactoryParams<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<any, infer P, any, any, any> ? P : undefined\n>;\n\n/** Extract the Outputs type from a PluginFactoryLike phantom. */\nexport type InferFactoryOutputs<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<any, any, infer O, any, any> ? O : Record<string, unknown>\n>;\n\n/** Extract the pre-resolved model services type from a PluginFactoryLike phantom. */\nexport type InferFactoryModelServices<F extends PluginFactoryLike> =\n F extends PluginFactoryLike<any, any, any, infer ModelServices, any> ? ModelServices : {};\n\n/** Extract the pre-resolved UI services type from a PluginFactoryLike phantom. */\nexport type InferFactoryUiServices<F extends PluginFactoryLike> =\n F extends PluginFactoryLike<any, any, any, any, infer UiServices> ? UiServices : {};\n\n/**\n * Derive a typed PluginHandle from a PluginFactory type.\n * Normalizes the brand to data/params/outputs/services (strips config) so handles\n * from InferPluginUiEntries match handles from InferPluginHandle.\n */\nexport type InferPluginHandle<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<\n infer Data,\n infer Params,\n infer Outputs,\n infer ModelServices,\n infer UiServices\n >\n ? PluginHandle<PluginFactoryLike<Data, Params, Outputs, ModelServices, UiServices>>\n : PluginHandle\n>;\n\n/**\n * Opaque handle for a plugin instance. Runtime value is the plugin instance ID string.\n * Branded with factory phantom `F` for type-safe data/outputs extraction.\n * Constrained with PluginFactoryLike (not PluginFactory) to avoid variance issues.\n */\nexport type PluginHandle<F extends PluginFactoryLike = PluginFactoryLike> = Branded<string, F>;\n\nconst PLUGIN_OUTPUT_PREFIX = \"plugin-output#\";\n\n/** Construct the output key for a plugin output in the block outputs map. */\nexport function pluginOutputKey<F extends PluginFactoryLike>(\n handle: PluginHandle<F>,\n outputKey: string,\n): string {\n return `${PLUGIN_OUTPUT_PREFIX}${handle}#${outputKey}`;\n}\n\n/** Check whether an output key belongs to a plugin (vs block-level output). */\nexport function isPluginOutputKey(key: string): boolean {\n return key.startsWith(PLUGIN_OUTPUT_PREFIX);\n}\n\n/** Get the prefix used for all outputs of a specific plugin instance. */\nexport function pluginOutputPrefix<F extends PluginFactoryLike>(handle: PluginHandle<F>): string {\n return pluginOutputKey(handle, \"\");\n}\n"],"mappings":";AAoFA,MAAM,uBAAuB;;AAG7B,SAAgB,gBACd,QACA,WACQ;AACR,QAAO,GAAG,uBAAuB,OAAO,GAAG;;;AAI7C,SAAgB,kBAAkB,KAAsB;AACtD,QAAO,IAAI,WAAW,qBAAqB;;;AAI7C,SAAgB,mBAAgD,QAAiC;AAC/F,QAAO,gBAAgB,QAAQ,GAAG"}
|
package/dist/plugin_handle.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ type InferFactoryUiServices<F extends PluginFactoryLike> = F extends PluginFacto
|
|
|
32
32
|
/**
|
|
33
33
|
* Derive a typed PluginHandle from a PluginFactory type.
|
|
34
34
|
* Normalizes the brand to data/params/outputs/services (strips config) so handles
|
|
35
|
-
* from
|
|
35
|
+
* from InferPluginUiEntries match handles from InferPluginHandle.
|
|
36
36
|
*/
|
|
37
37
|
type InferPluginHandle<F extends PluginFactoryLike> = NonNullable<F extends PluginFactoryLike<infer Data, infer Params, infer Outputs, infer ModelServices, infer UiServices> ? PluginHandle<PluginFactoryLike<Data, Params, Outputs, ModelServices, UiServices>> : PluginHandle>;
|
|
38
38
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin_handle.js","names":[],"sources":["../src/plugin_handle.ts"],"sourcesContent":["/**\n * PluginHandle — Opaque branded handle and output key utilities for plugin instances.\n *\n * Extracted into its own module to break circular dependencies:\n * both block_storage.ts and plugin_model.ts can import from here\n * without depending on each other.\n *\n * @module plugin_handle\n */\n\nimport type { Branded } from \"@milaboratories/helpers\";\n\n/**\n * Phantom-only base type for constraining PluginHandle's type parameter.\n *\n * PluginFactory has create() → PluginInstance with function properties, making it invariant\n * under strictFunctionTypes. PluginFactoryLike exposes only the covariant `__types` phantom,\n * avoiding the contravariance chain. Handles only need `__types` for type extraction.\n *\n * PluginFactory extends PluginFactoryLike, so every concrete factory satisfies this constraint.\n */\nexport interface PluginFactoryLike<\n Data extends Record<string, unknown> = Record<string, unknown>,\n Params extends undefined | Record<string, unknown> = undefined | Record<string, unknown>,\n Outputs extends Record<string, unknown> = Record<string, unknown>,\n ModelServices = unknown,\n UiServices = unknown,\n> {\n readonly __types?: {\n data: Data;\n params: Params;\n outputs: Outputs;\n modelServices: ModelServices;\n uiServices: UiServices;\n };\n}\n\n/** Extract the Data type from a PluginFactoryLike phantom. */\nexport type InferFactoryData<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<infer D, any, any, any, any> ? D : Record<string, unknown>\n>;\n\n/** Extract the Params type from a PluginFactoryLike phantom. */\nexport type InferFactoryParams<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<any, infer P, any, any, any> ? P : undefined\n>;\n\n/** Extract the Outputs type from a PluginFactoryLike phantom. */\nexport type InferFactoryOutputs<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<any, any, infer O, any, any> ? O : Record<string, unknown>\n>;\n\n/** Extract the pre-resolved model services type from a PluginFactoryLike phantom. */\nexport type InferFactoryModelServices<F extends PluginFactoryLike> =\n F extends PluginFactoryLike<any, any, any, infer ModelServices, any> ? ModelServices : {};\n\n/** Extract the pre-resolved UI services type from a PluginFactoryLike phantom. */\nexport type InferFactoryUiServices<F extends PluginFactoryLike> =\n F extends PluginFactoryLike<any, any, any, any, infer UiServices> ? UiServices : {};\n\n/**\n * Derive a typed PluginHandle from a PluginFactory type.\n * Normalizes the brand to data/params/outputs/services (strips config) so handles\n * from
|
|
1
|
+
{"version":3,"file":"plugin_handle.js","names":[],"sources":["../src/plugin_handle.ts"],"sourcesContent":["/**\n * PluginHandle — Opaque branded handle and output key utilities for plugin instances.\n *\n * Extracted into its own module to break circular dependencies:\n * both block_storage.ts and plugin_model.ts can import from here\n * without depending on each other.\n *\n * @module plugin_handle\n */\n\nimport type { Branded } from \"@milaboratories/helpers\";\n\n/**\n * Phantom-only base type for constraining PluginHandle's type parameter.\n *\n * PluginFactory has create() → PluginInstance with function properties, making it invariant\n * under strictFunctionTypes. PluginFactoryLike exposes only the covariant `__types` phantom,\n * avoiding the contravariance chain. Handles only need `__types` for type extraction.\n *\n * PluginFactory extends PluginFactoryLike, so every concrete factory satisfies this constraint.\n */\nexport interface PluginFactoryLike<\n Data extends Record<string, unknown> = Record<string, unknown>,\n Params extends undefined | Record<string, unknown> = undefined | Record<string, unknown>,\n Outputs extends Record<string, unknown> = Record<string, unknown>,\n ModelServices = unknown,\n UiServices = unknown,\n> {\n readonly __types?: {\n data: Data;\n params: Params;\n outputs: Outputs;\n modelServices: ModelServices;\n uiServices: UiServices;\n };\n}\n\n/** Extract the Data type from a PluginFactoryLike phantom. */\nexport type InferFactoryData<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<infer D, any, any, any, any> ? D : Record<string, unknown>\n>;\n\n/** Extract the Params type from a PluginFactoryLike phantom. */\nexport type InferFactoryParams<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<any, infer P, any, any, any> ? P : undefined\n>;\n\n/** Extract the Outputs type from a PluginFactoryLike phantom. */\nexport type InferFactoryOutputs<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<any, any, infer O, any, any> ? O : Record<string, unknown>\n>;\n\n/** Extract the pre-resolved model services type from a PluginFactoryLike phantom. */\nexport type InferFactoryModelServices<F extends PluginFactoryLike> =\n F extends PluginFactoryLike<any, any, any, infer ModelServices, any> ? ModelServices : {};\n\n/** Extract the pre-resolved UI services type from a PluginFactoryLike phantom. */\nexport type InferFactoryUiServices<F extends PluginFactoryLike> =\n F extends PluginFactoryLike<any, any, any, any, infer UiServices> ? UiServices : {};\n\n/**\n * Derive a typed PluginHandle from a PluginFactory type.\n * Normalizes the brand to data/params/outputs/services (strips config) so handles\n * from InferPluginUiEntries match handles from InferPluginHandle.\n */\nexport type InferPluginHandle<F extends PluginFactoryLike> = NonNullable<\n F extends PluginFactoryLike<\n infer Data,\n infer Params,\n infer Outputs,\n infer ModelServices,\n infer UiServices\n >\n ? PluginHandle<PluginFactoryLike<Data, Params, Outputs, ModelServices, UiServices>>\n : PluginHandle\n>;\n\n/**\n * Opaque handle for a plugin instance. Runtime value is the plugin instance ID string.\n * Branded with factory phantom `F` for type-safe data/outputs extraction.\n * Constrained with PluginFactoryLike (not PluginFactory) to avoid variance issues.\n */\nexport type PluginHandle<F extends PluginFactoryLike = PluginFactoryLike> = Branded<string, F>;\n\nconst PLUGIN_OUTPUT_PREFIX = \"plugin-output#\";\n\n/** Construct the output key for a plugin output in the block outputs map. */\nexport function pluginOutputKey<F extends PluginFactoryLike>(\n handle: PluginHandle<F>,\n outputKey: string,\n): string {\n return `${PLUGIN_OUTPUT_PREFIX}${handle}#${outputKey}`;\n}\n\n/** Check whether an output key belongs to a plugin (vs block-level output). */\nexport function isPluginOutputKey(key: string): boolean {\n return key.startsWith(PLUGIN_OUTPUT_PREFIX);\n}\n\n/** Get the prefix used for all outputs of a specific plugin instance. */\nexport function pluginOutputPrefix<F extends PluginFactoryLike>(handle: PluginHandle<F>): string {\n return pluginOutputKey(handle, \"\");\n}\n"],"mappings":";AAoFA,MAAM,uBAAuB;;AAG7B,SAAgB,gBACd,QACA,WACQ;AACR,QAAO,GAAG,uBAAuB,OAAO,GAAG;;;AAI7C,SAAgB,kBAAkB,KAAsB;AACtD,QAAO,IAAI,WAAW,qBAAqB;;;AAI7C,SAAgB,mBAAgD,QAAiC;AAC/F,QAAO,gBAAgB,QAAQ,GAAG"}
|
package/dist/plugin_model.cjs
CHANGED
|
@@ -208,19 +208,19 @@ var PluginModel = class PluginModel {
|
|
|
208
208
|
dataModel;
|
|
209
209
|
/** Output definitions - functions that compute outputs from plugin context */
|
|
210
210
|
outputs;
|
|
211
|
-
/** Per-output flags (e.g. withStatus) */
|
|
212
|
-
outputFlags;
|
|
213
211
|
/** Feature flags declared by this plugin */
|
|
214
212
|
featureFlags;
|
|
215
213
|
/** Create fresh default data. Config (if any) is captured at creation time. */
|
|
216
214
|
getDefaultData;
|
|
215
|
+
/** Public output definitions — accessible without usePlugin() via app.plugins */
|
|
216
|
+
publicOutputDef;
|
|
217
217
|
constructor(options) {
|
|
218
218
|
this.name = options.name;
|
|
219
219
|
this.dataModel = options.dataModel;
|
|
220
220
|
this.outputs = options.outputs;
|
|
221
|
-
this.outputFlags = options.outputFlags;
|
|
222
221
|
this.featureFlags = options.featureFlags;
|
|
223
222
|
this.getDefaultData = options.getDefaultData;
|
|
223
|
+
this.publicOutputDef = options.publicOutputDef;
|
|
224
224
|
}
|
|
225
225
|
/**
|
|
226
226
|
* Internal method for creating PluginModel from factory.
|
|
@@ -252,15 +252,15 @@ var PluginModelFactory = class PluginModelFactory {
|
|
|
252
252
|
dataFn;
|
|
253
253
|
getDefaultDataFn;
|
|
254
254
|
outputs;
|
|
255
|
-
outputFlags;
|
|
256
255
|
featureFlags;
|
|
256
|
+
publicOutputDef;
|
|
257
257
|
constructor(options) {
|
|
258
258
|
this.name = options.name;
|
|
259
259
|
this.dataFn = options.dataFn;
|
|
260
260
|
this.getDefaultDataFn = options.getDefaultDataFn;
|
|
261
261
|
this.outputs = options.outputs;
|
|
262
|
-
this.outputFlags = options.outputFlags;
|
|
263
262
|
this.featureFlags = options.featureFlags;
|
|
263
|
+
this.publicOutputDef = options.publicOutputDef;
|
|
264
264
|
}
|
|
265
265
|
/** @internal */
|
|
266
266
|
static [FROM_BUILDER](options) {
|
|
@@ -278,9 +278,9 @@ var PluginModelFactory = class PluginModelFactory {
|
|
|
278
278
|
name: this.name,
|
|
279
279
|
dataModel,
|
|
280
280
|
outputs: this.outputs,
|
|
281
|
-
outputFlags: this.outputFlags,
|
|
282
281
|
featureFlags: this.featureFlags,
|
|
283
|
-
getDefaultData: getDefaultDataFn ? () => getDefaultDataFn(config) : () => dataModel.getDefaultData()
|
|
282
|
+
getDefaultData: getDefaultDataFn ? () => getDefaultDataFn(config) : () => dataModel.getDefaultData(),
|
|
283
|
+
publicOutputDef: this.publicOutputDef
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
};
|
|
@@ -308,15 +308,15 @@ var PluginModelBuilder = class PluginModelBuilder {
|
|
|
308
308
|
dataFn;
|
|
309
309
|
getDefaultDataFn;
|
|
310
310
|
outputs;
|
|
311
|
-
outputFlags;
|
|
312
311
|
featureFlags;
|
|
312
|
+
publicOutputDef;
|
|
313
313
|
constructor(options) {
|
|
314
314
|
this.name = options.name;
|
|
315
315
|
this.dataFn = options.dataFn;
|
|
316
316
|
this.getDefaultDataFn = options.getDefaultDataFn;
|
|
317
317
|
this.outputs = options.outputs ?? {};
|
|
318
|
-
this.outputFlags = options.outputFlags ?? {};
|
|
319
318
|
this.featureFlags = options.featureFlags;
|
|
319
|
+
this.publicOutputDef = options.publicOutputDef;
|
|
320
320
|
}
|
|
321
321
|
/** @internal */
|
|
322
322
|
static [FROM_BUILDER](options) {
|
|
@@ -324,14 +324,17 @@ var PluginModelBuilder = class PluginModelBuilder {
|
|
|
324
324
|
}
|
|
325
325
|
/**
|
|
326
326
|
* Adds an output to the plugin.
|
|
327
|
+
* All plugin outputs are always wrapped with status — the UI receives
|
|
328
|
+
* {@link OutputWithStatus} for every output, allowing it to distinguish
|
|
329
|
+
* between pending, success, and error states.
|
|
327
330
|
*
|
|
328
331
|
* @param key - Output name
|
|
329
332
|
* @param fn - Function that computes the output value from plugin context
|
|
330
|
-
* @returns
|
|
333
|
+
* @returns Builder with the new output added
|
|
331
334
|
*
|
|
332
335
|
* @example
|
|
333
336
|
* .output('model', (ctx) => createModel(ctx.params.columns, ctx.data.state))
|
|
334
|
-
* .output('
|
|
337
|
+
* .output('pFrame', (ctx) => ctx.createPFrame([...]))
|
|
335
338
|
*/
|
|
336
339
|
output(key, fn) {
|
|
337
340
|
return new PluginModelBuilder({
|
|
@@ -343,42 +346,32 @@ var PluginModelBuilder = class PluginModelBuilder {
|
|
|
343
346
|
...this.outputs,
|
|
344
347
|
[key]: fn
|
|
345
348
|
},
|
|
346
|
-
|
|
347
|
-
...this.outputFlags,
|
|
348
|
-
[key]: { withStatus: false }
|
|
349
|
-
}
|
|
349
|
+
publicOutputDef: this.publicOutputDef
|
|
350
350
|
});
|
|
351
351
|
}
|
|
352
352
|
/**
|
|
353
|
-
*
|
|
353
|
+
* Exposes a plugin data field as a public output — accessible without `usePlugin()`
|
|
354
|
+
* via `app.plugins.pluginName.publicOutputs.key`.
|
|
354
355
|
*
|
|
355
|
-
* The
|
|
356
|
-
*
|
|
356
|
+
* The getter runs against the plugin's reactive data object.
|
|
357
|
+
* Public outputs are read-only.
|
|
357
358
|
*
|
|
358
|
-
* @param key -
|
|
359
|
-
* @param
|
|
360
|
-
* @returns PluginModel with the new status-wrapped output added
|
|
359
|
+
* @param key - Name of the public output field
|
|
360
|
+
* @param getter - Function deriving the value from plugin data
|
|
361
361
|
*
|
|
362
362
|
* @example
|
|
363
|
-
* .
|
|
364
|
-
* const pCols = ctx.params.pFrame?.getPColumns();
|
|
365
|
-
* if (pCols === undefined) return undefined;
|
|
366
|
-
* return createPlDataTableV2(ctx, pCols, ctx.data.tableState);
|
|
367
|
-
* })
|
|
363
|
+
* .publicOutput('selection', (d) => d.selection)
|
|
368
364
|
*/
|
|
369
|
-
|
|
365
|
+
publicOutput(key, getter) {
|
|
370
366
|
return new PluginModelBuilder({
|
|
371
367
|
name: this.name,
|
|
372
368
|
dataFn: this.dataFn,
|
|
373
369
|
getDefaultDataFn: this.getDefaultDataFn,
|
|
374
370
|
featureFlags: this.featureFlags,
|
|
375
|
-
outputs:
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
outputFlags: {
|
|
380
|
-
...this.outputFlags,
|
|
381
|
-
[key]: { withStatus: true }
|
|
371
|
+
outputs: this.outputs,
|
|
372
|
+
publicOutputDef: {
|
|
373
|
+
...this.publicOutputDef,
|
|
374
|
+
[key]: { getter }
|
|
382
375
|
}
|
|
383
376
|
});
|
|
384
377
|
}
|
|
@@ -401,7 +394,7 @@ var PluginModelBuilder = class PluginModelBuilder {
|
|
|
401
394
|
dataFn: this.dataFn,
|
|
402
395
|
getDefaultDataFn: this.getDefaultDataFn,
|
|
403
396
|
outputs: this.outputs,
|
|
404
|
-
|
|
397
|
+
publicOutputDef: this.publicOutputDef,
|
|
405
398
|
featureFlags: this.featureFlags
|
|
406
399
|
});
|
|
407
400
|
}
|
|
@@ -413,7 +406,10 @@ var PluginModelBuilder = class PluginModelBuilder {
|
|
|
413
406
|
var PluginModelInitialBuilder = class PluginModelInitialBuilder extends PluginModelBuilder {
|
|
414
407
|
/** @internal */
|
|
415
408
|
static create(options) {
|
|
416
|
-
return new PluginModelInitialBuilder(
|
|
409
|
+
return new PluginModelInitialBuilder({
|
|
410
|
+
...options,
|
|
411
|
+
publicOutputDef: {}
|
|
412
|
+
});
|
|
417
413
|
}
|
|
418
414
|
/**
|
|
419
415
|
* Sets the Params type for this plugin — the shape of data derived from the block's
|
|
@@ -429,7 +425,8 @@ var PluginModelInitialBuilder = class PluginModelInitialBuilder extends PluginMo
|
|
|
429
425
|
name: this.name,
|
|
430
426
|
dataFn: this.dataFn,
|
|
431
427
|
getDefaultDataFn: this.getDefaultDataFn,
|
|
432
|
-
featureFlags: this.featureFlags
|
|
428
|
+
featureFlags: this.featureFlags,
|
|
429
|
+
publicOutputDef: {}
|
|
433
430
|
});
|
|
434
431
|
}
|
|
435
432
|
};
|