@platforma-sdk/model 1.54.13 → 1.56.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (120) hide show
  1. package/dist/bconfig/normalization.cjs +8 -1
  2. package/dist/bconfig/normalization.cjs.map +1 -1
  3. package/dist/bconfig/normalization.d.ts.map +1 -1
  4. package/dist/bconfig/normalization.js +8 -1
  5. package/dist/bconfig/normalization.js.map +1 -1
  6. package/dist/block_api_v3.d.ts +2 -2
  7. package/dist/block_api_v3.d.ts.map +1 -1
  8. package/dist/block_migrations.cjs +246 -214
  9. package/dist/block_migrations.cjs.map +1 -1
  10. package/dist/block_migrations.d.ts +180 -158
  11. package/dist/block_migrations.d.ts.map +1 -1
  12. package/dist/block_migrations.js +247 -214
  13. package/dist/block_migrations.js.map +1 -1
  14. package/dist/block_model.cjs +85 -35
  15. package/dist/block_model.cjs.map +1 -1
  16. package/dist/block_model.d.ts +66 -38
  17. package/dist/block_model.d.ts.map +1 -1
  18. package/dist/block_model.js +86 -36
  19. package/dist/block_model.js.map +1 -1
  20. package/dist/{builder.cjs → block_model_legacy.cjs} +2 -2
  21. package/dist/block_model_legacy.cjs.map +1 -0
  22. package/dist/{builder.d.ts → block_model_legacy.d.ts} +1 -1
  23. package/dist/block_model_legacy.d.ts.map +1 -0
  24. package/dist/{builder.js → block_model_legacy.js} +2 -2
  25. package/dist/block_model_legacy.js.map +1 -0
  26. package/dist/block_state_patch.d.ts +11 -1
  27. package/dist/block_state_patch.d.ts.map +1 -1
  28. package/dist/block_storage.cjs +126 -109
  29. package/dist/block_storage.cjs.map +1 -1
  30. package/dist/block_storage.d.ts +109 -112
  31. package/dist/block_storage.d.ts.map +1 -1
  32. package/dist/block_storage.js +126 -101
  33. package/dist/block_storage.js.map +1 -1
  34. package/dist/block_storage_callbacks.cjs +227 -0
  35. package/dist/block_storage_callbacks.cjs.map +1 -0
  36. package/dist/block_storage_callbacks.d.ts +113 -0
  37. package/dist/block_storage_callbacks.d.ts.map +1 -0
  38. package/dist/block_storage_callbacks.js +218 -0
  39. package/dist/block_storage_callbacks.js.map +1 -0
  40. package/dist/block_storage_facade.cjs +104 -0
  41. package/dist/block_storage_facade.cjs.map +1 -0
  42. package/dist/block_storage_facade.d.ts +168 -0
  43. package/dist/block_storage_facade.d.ts.map +1 -0
  44. package/dist/block_storage_facade.js +99 -0
  45. package/dist/block_storage_facade.js.map +1 -0
  46. package/dist/index.cjs +13 -14
  47. package/dist/index.cjs.map +1 -1
  48. package/dist/index.d.ts +8 -3
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +6 -4
  51. package/dist/index.js.map +1 -1
  52. package/dist/package.json.cjs +1 -1
  53. package/dist/package.json.js +1 -1
  54. package/dist/platforma.d.ts +11 -4
  55. package/dist/platforma.d.ts.map +1 -1
  56. package/dist/plugin_model.cjs +171 -0
  57. package/dist/plugin_model.cjs.map +1 -0
  58. package/dist/plugin_model.d.ts +162 -0
  59. package/dist/plugin_model.d.ts.map +1 -0
  60. package/dist/plugin_model.js +169 -0
  61. package/dist/plugin_model.js.map +1 -0
  62. package/dist/render/api.cjs +20 -21
  63. package/dist/render/api.cjs.map +1 -1
  64. package/dist/render/api.d.ts +8 -8
  65. package/dist/render/api.d.ts.map +1 -1
  66. package/dist/render/api.js +20 -21
  67. package/dist/render/api.js.map +1 -1
  68. package/dist/render/internal.cjs.map +1 -1
  69. package/dist/render/internal.d.ts +2 -1
  70. package/dist/render/internal.d.ts.map +1 -1
  71. package/dist/render/internal.js.map +1 -1
  72. package/dist/version.cjs +4 -0
  73. package/dist/version.cjs.map +1 -1
  74. package/dist/version.d.ts +4 -0
  75. package/dist/version.d.ts.map +1 -1
  76. package/dist/version.js +4 -1
  77. package/dist/version.js.map +1 -1
  78. package/package.json +5 -5
  79. package/src/bconfig/normalization.ts +8 -1
  80. package/src/block_api_v3.ts +2 -2
  81. package/src/block_migrations.test.ts +141 -171
  82. package/src/block_migrations.ts +300 -285
  83. package/src/block_model.ts +205 -95
  84. package/src/{builder.ts → block_model_legacy.ts} +1 -1
  85. package/src/block_state_patch.ts +13 -1
  86. package/src/block_storage.test.ts +283 -95
  87. package/src/block_storage.ts +199 -188
  88. package/src/block_storage_callbacks.ts +326 -0
  89. package/src/block_storage_facade.ts +199 -0
  90. package/src/index.ts +7 -3
  91. package/src/platforma.ts +26 -7
  92. package/src/plugin_model.test.ts +168 -0
  93. package/src/plugin_model.ts +242 -0
  94. package/src/render/api.ts +26 -24
  95. package/src/render/internal.ts +3 -1
  96. package/src/typing.test.ts +1 -1
  97. package/src/version.ts +8 -0
  98. package/dist/block_storage_vm.cjs +0 -262
  99. package/dist/block_storage_vm.cjs.map +0 -1
  100. package/dist/block_storage_vm.d.ts +0 -59
  101. package/dist/block_storage_vm.d.ts.map +0 -1
  102. package/dist/block_storage_vm.js +0 -258
  103. package/dist/block_storage_vm.js.map +0 -1
  104. package/dist/branding.d.ts +0 -7
  105. package/dist/branding.d.ts.map +0 -1
  106. package/dist/builder.cjs.map +0 -1
  107. package/dist/builder.d.ts.map +0 -1
  108. package/dist/builder.js.map +0 -1
  109. package/dist/sdk_info.cjs +0 -10
  110. package/dist/sdk_info.cjs.map +0 -1
  111. package/dist/sdk_info.d.ts +0 -5
  112. package/dist/sdk_info.d.ts.map +0 -1
  113. package/dist/sdk_info.js +0 -8
  114. package/dist/sdk_info.js.map +0 -1
  115. package/dist/unionize.d.ts +0 -12
  116. package/dist/unionize.d.ts.map +0 -1
  117. package/src/block_storage_vm.ts +0 -346
  118. package/src/branding.ts +0 -4
  119. package/src/sdk_info.ts +0 -9
  120. package/src/unionize.ts +0 -12
@@ -1,7 +0,0 @@
1
- declare const __brand: unique symbol;
2
- type Brand<B> = {
3
- [__brand]: B;
4
- };
5
- export type Branded<T, B> = T & Brand<B>;
6
- export {};
7
- //# sourceMappingURL=branding.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"branding.d.ts","sourceRoot":"","sources":["../src/branding.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,OAAO,EAAE,OAAO,MAAM,CAAC;AACrC,KAAK,KAAK,CAAC,CAAC,IAAI;IAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;CAAE,CAAC;AAEjC,MAAM,MAAM,OAAO,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"builder.cjs","sources":["../src/builder.ts"],"sourcesContent":["import type {\n BlockRenderingMode,\n BlockSection,\n AnyFunction,\n PlRef,\n BlockCodeKnownFeatureFlags,\n BlockConfigContainer,\n} from \"@milaboratories/pl-model-common\";\nimport type { Checked, ConfigResult, TypedConfig } from \"./config\";\nimport { getImmediate } from \"./config\";\nimport { getPlatformaInstance, isInUI, tryRegisterCallback } from \"./internal\";\nimport type { Platforma, PlatformaApiVersion, PlatformaV1, PlatformaV2 } from \"./platforma\";\nimport type { InferRenderFunctionReturn, RenderFunctionLegacy } from \"./render\";\nimport { RenderCtxLegacy } from \"./render\";\nimport { PlatformaSDKVersion } from \"./version\";\nimport type {\n TypedConfigOrConfigLambda,\n ConfigRenderLambda,\n StdCtxArgsOnly,\n DeriveHref,\n ConfigRenderLambdaFlags,\n InferOutputsFromConfigs,\n} from \"./bconfig\";\nimport { downgradeCfgOrLambda, isConfigLambda } from \"./bconfig\";\nimport type { PlatformaExtended } from \"./platforma\";\n\ntype SectionsExpectedType = readonly BlockSection[];\n\ntype SectionsCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends SectionsExpectedType ? true : false\n>;\n\ntype InputsValidExpectedType = boolean;\n\ntype InputsValidCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends InputsValidExpectedType ? true : false\n>;\n\ntype NoOb = Record<string, never>;\n\n/** Main entry point that each block should use in it's \"config\" module. Don't forget\n * to call {@link done()} at the end of configuration. Value returned by this builder must be\n * exported as constant with name \"platforma\" from the \"config\" module. */\nexport class BlockModel<\n Args,\n OutputsCfg extends Record<string, TypedConfigOrConfigLambda>,\n UiState,\n Href extends `/${string}` = \"/\",\n> {\n private constructor(\n private config: {\n readonly renderingMode: BlockRenderingMode;\n readonly initialArgs?: Args;\n readonly initialUiState: UiState;\n readonly outputs: OutputsCfg;\n readonly inputsValid: TypedConfigOrConfigLambda;\n readonly sections: TypedConfigOrConfigLambda;\n readonly title?: ConfigRenderLambda;\n readonly subtitle?: ConfigRenderLambda;\n readonly tags?: ConfigRenderLambda;\n readonly enrichmentTargets?: ConfigRenderLambda;\n readonly featureFlags: BlockCodeKnownFeatureFlags;\n },\n ) {}\n\n public static get INITIAL_BLOCK_FEATURE_FLAGS(): BlockCodeKnownFeatureFlags {\n return {\n supportsLazyState: true,\n requiresUIAPIVersion: 1,\n requiresModelAPIVersion: 1,\n requiresCreatePTableV2: true,\n };\n }\n\n /** Initiates configuration builder */\n public static create(renderingMode: BlockRenderingMode): BlockModel<NoOb, {}, NoOb>;\n /** Initiates configuration builder */\n public static create(): BlockModel<NoOb, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(renderingMode: BlockRenderingMode): BlockModel<Args, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(): BlockModel<Args, {}, NoOb>;\n public static create(renderingMode: BlockRenderingMode = \"Heavy\"): BlockModel<NoOb, {}, NoOb> {\n return new BlockModel<NoOb, {}, NoOb>({\n renderingMode,\n initialUiState: {},\n outputs: {},\n inputsValid: getImmediate(true),\n sections: getImmediate([]),\n featureFlags: BlockModel.INITIAL_BLOCK_FEATURE_FLAGS,\n });\n }\n\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param cfg configuration describing how to render cell value from the blocks\n * workflow outputs\n * @deprecated use lambda-based API\n * */\n public output<const Key extends string, const Cfg extends TypedConfig>(\n key: Key,\n cfg: Cfg,\n ): BlockModel<Args, OutputsCfg & { [K in Key]: Cfg }, UiState, Href>;\n /**\n * Add output cell wrapped with additional status information to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags: ConfigRenderLambdaFlags & { withStatus: true },\n ): BlockModel<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & { withStatus: true };\n },\n UiState,\n Href\n >;\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags?: ConfigRenderLambdaFlags,\n ): BlockModel<\n Args,\n OutputsCfg & { [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> },\n UiState,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: TypedConfig | AnyFunction,\n flags: ConfigRenderLambdaFlags = {},\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n if (typeof cfgOrRf === \"function\") {\n const handle = `output#${key}`;\n tryRegisterCallback(handle, () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: {\n __renderLambda: true,\n handle,\n ...flags,\n },\n },\n });\n } else {\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: cfgOrRf,\n },\n });\n }\n }\n\n /** Shortcut for {@link output} with retentive flag set to true. */\n public retentiveOutput<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true });\n }\n\n /** Shortcut for {@link output} with withStatus flag set to true. */\n public outputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { withStatus: true });\n }\n\n /** Shortcut for {@link output} with retentive and withStatus flags set to true. */\n public retentiveOutputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true, withStatus: true });\n }\n\n /** Sets custom configuration predicate on the block args at which block can be executed\n * @deprecated use lambda-based API */\n public argsValid<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n /** Sets custom configuration predicate on the block args at which block can be executed */\n public argsValid<RF extends RenderFunctionLegacy<Args, UiState, boolean>>(\n rf: RF,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public argsValid(\n cfgOrRf: TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (typeof cfgOrRf === \"function\") {\n tryRegisterCallback(\"inputsValid\", () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: {\n __renderLambda: true,\n handle: \"inputsValid\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: cfgOrRf,\n });\n }\n }\n\n /** Sets the config to generate list of section in the left block overviews panel\n * @deprecated use lambda-based API */\n public sections<const S extends SectionsExpectedType>(\n rf: S,\n ): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;\n /** Sets the config to generate list of section in the left block overviews panel */\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunctionLegacy<Args, UiState, Ret>,\n >(rf: RF): BlockModel<Args, OutputsCfg, UiState, DeriveHref<ReturnType<RF>>>;\n public sections<const Cfg extends TypedConfig>(\n cfg: Cfg & SectionsCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<\n Args,\n OutputsCfg,\n UiState,\n DeriveHref<ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>>>\n >;\n public sections(\n arrOrCfgOrRf: SectionsExpectedType | TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (Array.isArray(arrOrCfgOrRf)) {\n return this.sections(getImmediate(arrOrCfgOrRf));\n } else if (typeof arrOrCfgOrRf === \"function\") {\n tryRegisterCallback(\"sections\", () => arrOrCfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: {\n __renderLambda: true,\n handle: \"sections\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: arrOrCfgOrRf as TypedConfig,\n });\n }\n }\n\n /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */\n public title(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"title\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n title: {\n __renderLambda: true,\n handle: \"title\",\n },\n });\n }\n\n public subtitle(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"subtitle\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n subtitle: {\n __renderLambda: true,\n handle: \"subtitle\",\n },\n });\n }\n\n public tags(\n rf: RenderFunctionLegacy<Args, UiState, string[]>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"tags\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n tags: {\n __renderLambda: true,\n handle: \"tags\",\n },\n });\n }\n\n /**\n * Sets initial args for the block, this value must be specified.\n * @deprecated use {@link withArgs}\n * */\n public initialArgs(value: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return this.withArgs(value);\n }\n\n /** Sets initial args for the block, this value must be specified. */\n public withArgs<Args>(initialArgs: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialArgs,\n });\n }\n\n /** Defines type and sets initial value for block UiState. */\n public withUiState<UiState>(\n initialUiState: UiState,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialUiState,\n });\n }\n\n /** Sets or overrides feature flags for the block. */\n public withFeatureFlags(\n flags: Partial<BlockCodeKnownFeatureFlags>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n featureFlags: {\n ...this.config.featureFlags,\n ...flags,\n },\n });\n }\n\n /**\n * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.\n * Influences dependency graph construction.\n */\n public enriches(lambda: (args: Args) => PlRef[]): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"enrichmentTargets\", lambda);\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n enrichmentTargets: {\n __renderLambda: true,\n handle: \"enrichmentTargets\",\n },\n });\n }\n\n public done(\n apiVersion?: 1,\n ): PlatformaExtended<\n PlatformaV1<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n public done(\n apiVersion: 2,\n ): PlatformaExtended<\n PlatformaV2<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n /** Renders all provided block settings into a pre-configured platforma API\n * instance, that can be used in frontend to interact with block state, and\n * other features provided by the platforma to the block. */\n public done(\n apiVersion: PlatformaApiVersion = 1,\n ): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n return this.withFeatureFlags({\n ...this.config.featureFlags,\n requiresUIAPIVersion: apiVersion,\n }).#done();\n }\n\n #done(): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n if (this.config.initialArgs === undefined) throw new Error(\"Initial arguments not set.\");\n\n const config: BlockConfigContainer = {\n v4: undefined,\n v3: {\n configVersion: 3,\n modelAPIVersion: 1,\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n initialUiState: this.config.initialUiState,\n inputsValid: this.config.inputsValid,\n sections: this.config.sections,\n title: this.config.title,\n subtitle: this.config.subtitle,\n tags: this.config.tags,\n outputs: this.config.outputs,\n enrichmentTargets: this.config.enrichmentTargets,\n featureFlags: this.config.featureFlags,\n },\n\n // fields below are added to allow previous desktop versions read generated configs\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n inputsValid: downgradeCfgOrLambda(this.config.inputsValid),\n sections: downgradeCfgOrLambda(this.config.sections),\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n downgradeCfgOrLambda(value),\n ]),\n ),\n };\n\n globalThis.platformaApiVersion = this.config.featureFlags\n .requiresUIAPIVersion as PlatformaApiVersion;\n\n if (!isInUI())\n // we are in the configuration rendering routine, not in actual UI\n return { config } as any;\n // normal operation inside the UI\n else\n return {\n ...getPlatformaInstance({\n sdkVersion: PlatformaSDKVersion,\n apiVersion: platformaApiVersion,\n }),\n blockModelInfo: {\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n {\n withStatus: Boolean(isConfigLambda(value) && value.withStatus),\n },\n ]),\n ),\n },\n };\n }\n}\n"],"names":["getImmediate","tryRegisterCallback","RenderCtxLegacy","Plat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IAAI,CAAC;IAW9C;;;SAGK;IACE,WAAW,CAAC,KAAK,EAAE,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC;IAI5E,qEAAqE;IAC9D,QAAQ,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,GAAG,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC;IAOrF,6DAA6D;IACtD,WAAW,CAAC,OAAO,EACxB,cAAc,EAAE,OAAO,GACtB,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC;IAO9C,qDAAqD;IAC9C,gBAAgB,CACrB,KAAK,EAAE,OAAO,CAAC,0BAA0B,CAAC,GACzC,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC;IAU9C;;;OAGG;IACI,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,KAAK,EAAE,GAAG,UAAU,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC;IAWtF,IAAI,CACT,UAAU,CAAC,EAAE,CAAC,GACb,iBAAiB,CAClB,WAAW,CAAC,IAAI,EAAE,uBAAuB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,CACrF;IAEM,IAAI,CACT,UAAU,EAAE,CAAC,GACZ,iBAAiB,CAClB,WAAW,CAAC,IAAI,EAAE,uBAAuB,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,CACrF;CA+EF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"builder.js","sources":["../src/builder.ts"],"sourcesContent":["import type {\n BlockRenderingMode,\n BlockSection,\n AnyFunction,\n PlRef,\n BlockCodeKnownFeatureFlags,\n BlockConfigContainer,\n} from \"@milaboratories/pl-model-common\";\nimport type { Checked, ConfigResult, TypedConfig } from \"./config\";\nimport { getImmediate } from \"./config\";\nimport { getPlatformaInstance, isInUI, tryRegisterCallback } from \"./internal\";\nimport type { Platforma, PlatformaApiVersion, PlatformaV1, PlatformaV2 } from \"./platforma\";\nimport type { InferRenderFunctionReturn, RenderFunctionLegacy } from \"./render\";\nimport { RenderCtxLegacy } from \"./render\";\nimport { PlatformaSDKVersion } from \"./version\";\nimport type {\n TypedConfigOrConfigLambda,\n ConfigRenderLambda,\n StdCtxArgsOnly,\n DeriveHref,\n ConfigRenderLambdaFlags,\n InferOutputsFromConfigs,\n} from \"./bconfig\";\nimport { downgradeCfgOrLambda, isConfigLambda } from \"./bconfig\";\nimport type { PlatformaExtended } from \"./platforma\";\n\ntype SectionsExpectedType = readonly BlockSection[];\n\ntype SectionsCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends SectionsExpectedType ? true : false\n>;\n\ntype InputsValidExpectedType = boolean;\n\ntype InputsValidCfgChecked<Cfg extends TypedConfig, Args, UiState> = Checked<\n Cfg,\n ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>> extends InputsValidExpectedType ? true : false\n>;\n\ntype NoOb = Record<string, never>;\n\n/** Main entry point that each block should use in it's \"config\" module. Don't forget\n * to call {@link done()} at the end of configuration. Value returned by this builder must be\n * exported as constant with name \"platforma\" from the \"config\" module. */\nexport class BlockModel<\n Args,\n OutputsCfg extends Record<string, TypedConfigOrConfigLambda>,\n UiState,\n Href extends `/${string}` = \"/\",\n> {\n private constructor(\n private config: {\n readonly renderingMode: BlockRenderingMode;\n readonly initialArgs?: Args;\n readonly initialUiState: UiState;\n readonly outputs: OutputsCfg;\n readonly inputsValid: TypedConfigOrConfigLambda;\n readonly sections: TypedConfigOrConfigLambda;\n readonly title?: ConfigRenderLambda;\n readonly subtitle?: ConfigRenderLambda;\n readonly tags?: ConfigRenderLambda;\n readonly enrichmentTargets?: ConfigRenderLambda;\n readonly featureFlags: BlockCodeKnownFeatureFlags;\n },\n ) {}\n\n public static get INITIAL_BLOCK_FEATURE_FLAGS(): BlockCodeKnownFeatureFlags {\n return {\n supportsLazyState: true,\n requiresUIAPIVersion: 1,\n requiresModelAPIVersion: 1,\n requiresCreatePTableV2: true,\n };\n }\n\n /** Initiates configuration builder */\n public static create(renderingMode: BlockRenderingMode): BlockModel<NoOb, {}, NoOb>;\n /** Initiates configuration builder */\n public static create(): BlockModel<NoOb, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(renderingMode: BlockRenderingMode): BlockModel<Args, {}, NoOb>;\n /**\n * Initiates configuration builder\n * @deprecated use create method without generic parameter\n */\n public static create<Args>(): BlockModel<Args, {}, NoOb>;\n public static create(renderingMode: BlockRenderingMode = \"Heavy\"): BlockModel<NoOb, {}, NoOb> {\n return new BlockModel<NoOb, {}, NoOb>({\n renderingMode,\n initialUiState: {},\n outputs: {},\n inputsValid: getImmediate(true),\n sections: getImmediate([]),\n featureFlags: BlockModel.INITIAL_BLOCK_FEATURE_FLAGS,\n });\n }\n\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param cfg configuration describing how to render cell value from the blocks\n * workflow outputs\n * @deprecated use lambda-based API\n * */\n public output<const Key extends string, const Cfg extends TypedConfig>(\n key: Key,\n cfg: Cfg,\n ): BlockModel<Args, OutputsCfg & { [K in Key]: Cfg }, UiState, Href>;\n /**\n * Add output cell wrapped with additional status information to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags: ConfigRenderLambdaFlags & { withStatus: true },\n ): BlockModel<\n Args,\n OutputsCfg & {\n [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> & { withStatus: true };\n },\n UiState,\n Href\n >;\n /**\n * Add output cell to the configuration\n *\n * @param key output cell name, that can be later used to retrieve the rendered value\n * @param rf callback calculating output value using context, that allows to access\n * workflows outputs and interact with platforma drivers\n * @param flags additional flags that may alter lambda rendering procedure\n * */\n public output<const Key extends string, const RF extends RenderFunctionLegacy<Args, UiState>>(\n key: Key,\n rf: RF,\n flags?: ConfigRenderLambdaFlags,\n ): BlockModel<\n Args,\n OutputsCfg & { [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>> },\n UiState,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: TypedConfig | AnyFunction,\n flags: ConfigRenderLambdaFlags = {},\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n if (typeof cfgOrRf === \"function\") {\n const handle = `output#${key}`;\n tryRegisterCallback(handle, () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: {\n __renderLambda: true,\n handle,\n ...flags,\n },\n },\n });\n } else {\n return new BlockModel({\n ...this.config,\n outputs: {\n ...this.config.outputs,\n [key]: cfgOrRf,\n },\n });\n }\n }\n\n /** Shortcut for {@link output} with retentive flag set to true. */\n public retentiveOutput<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true });\n }\n\n /** Shortcut for {@link output} with withStatus flag set to true. */\n public outputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { withStatus: true });\n }\n\n /** Shortcut for {@link output} with retentive and withStatus flags set to true. */\n public retentiveOutputWithStatus<\n const Key extends string,\n const RF extends RenderFunctionLegacy<Args, UiState>,\n >(key: Key, rf: RF) {\n return this.output(key, rf, { retentive: true, withStatus: true });\n }\n\n /** Sets custom configuration predicate on the block args at which block can be executed\n * @deprecated use lambda-based API */\n public argsValid<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n /** Sets custom configuration predicate on the block args at which block can be executed */\n public argsValid<RF extends RenderFunctionLegacy<Args, UiState, boolean>>(\n rf: RF,\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public argsValid(\n cfgOrRf: TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (typeof cfgOrRf === \"function\") {\n tryRegisterCallback(\"inputsValid\", () => cfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: {\n __renderLambda: true,\n handle: \"inputsValid\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n inputsValid: cfgOrRf,\n });\n }\n }\n\n /** Sets the config to generate list of section in the left block overviews panel\n * @deprecated use lambda-based API */\n public sections<const S extends SectionsExpectedType>(\n rf: S,\n ): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;\n /** Sets the config to generate list of section in the left block overviews panel */\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunctionLegacy<Args, UiState, Ret>,\n >(rf: RF): BlockModel<Args, OutputsCfg, UiState, DeriveHref<ReturnType<RF>>>;\n public sections<const Cfg extends TypedConfig>(\n cfg: Cfg & SectionsCfgChecked<Cfg, Args, UiState>,\n ): BlockModel<\n Args,\n OutputsCfg,\n UiState,\n DeriveHref<ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>>>\n >;\n public sections(\n arrOrCfgOrRf: SectionsExpectedType | TypedConfig | AnyFunction,\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (Array.isArray(arrOrCfgOrRf)) {\n return this.sections(getImmediate(arrOrCfgOrRf));\n } else if (typeof arrOrCfgOrRf === \"function\") {\n tryRegisterCallback(\"sections\", () => arrOrCfgOrRf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: {\n __renderLambda: true,\n handle: \"sections\",\n },\n });\n } else {\n return new BlockModel<Args, OutputsCfg, UiState>({\n ...this.config,\n sections: arrOrCfgOrRf as TypedConfig,\n });\n }\n }\n\n /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */\n public title(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"title\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n title: {\n __renderLambda: true,\n handle: \"title\",\n },\n });\n }\n\n public subtitle(\n rf: RenderFunctionLegacy<Args, UiState, string>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"subtitle\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n subtitle: {\n __renderLambda: true,\n handle: \"subtitle\",\n },\n });\n }\n\n public tags(\n rf: RenderFunctionLegacy<Args, UiState, string[]>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"tags\", () => rf(new RenderCtxLegacy()));\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n tags: {\n __renderLambda: true,\n handle: \"tags\",\n },\n });\n }\n\n /**\n * Sets initial args for the block, this value must be specified.\n * @deprecated use {@link withArgs}\n * */\n public initialArgs(value: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return this.withArgs(value);\n }\n\n /** Sets initial args for the block, this value must be specified. */\n public withArgs<Args>(initialArgs: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialArgs,\n });\n }\n\n /** Defines type and sets initial value for block UiState. */\n public withUiState<UiState>(\n initialUiState: UiState,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n initialUiState,\n });\n }\n\n /** Sets or overrides feature flags for the block. */\n public withFeatureFlags(\n flags: Partial<BlockCodeKnownFeatureFlags>,\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n featureFlags: {\n ...this.config.featureFlags,\n ...flags,\n },\n });\n }\n\n /**\n * Defines how to derive list of upstream references this block is meant to enrich with its exports from block args.\n * Influences dependency graph construction.\n */\n public enriches(lambda: (args: Args) => PlRef[]): BlockModel<Args, OutputsCfg, UiState, Href> {\n tryRegisterCallback(\"enrichmentTargets\", lambda);\n return new BlockModel<Args, OutputsCfg, UiState, Href>({\n ...this.config,\n enrichmentTargets: {\n __renderLambda: true,\n handle: \"enrichmentTargets\",\n },\n });\n }\n\n public done(\n apiVersion?: 1,\n ): PlatformaExtended<\n PlatformaV1<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n public done(\n apiVersion: 2,\n ): PlatformaExtended<\n PlatformaV2<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n >;\n\n /** Renders all provided block settings into a pre-configured platforma API\n * instance, that can be used in frontend to interact with block state, and\n * other features provided by the platforma to the block. */\n public done(\n apiVersion: PlatformaApiVersion = 1,\n ): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n return this.withFeatureFlags({\n ...this.config.featureFlags,\n requiresUIAPIVersion: apiVersion,\n }).#done();\n }\n\n #done(): PlatformaExtended<\n Platforma<Args, InferOutputsFromConfigs<Args, OutputsCfg, UiState>, UiState, Href>\n > {\n if (this.config.initialArgs === undefined) throw new Error(\"Initial arguments not set.\");\n\n const config: BlockConfigContainer = {\n v4: undefined,\n v3: {\n configVersion: 3,\n modelAPIVersion: 1,\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n initialUiState: this.config.initialUiState,\n inputsValid: this.config.inputsValid,\n sections: this.config.sections,\n title: this.config.title,\n subtitle: this.config.subtitle,\n tags: this.config.tags,\n outputs: this.config.outputs,\n enrichmentTargets: this.config.enrichmentTargets,\n featureFlags: this.config.featureFlags,\n },\n\n // fields below are added to allow previous desktop versions read generated configs\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this.config.renderingMode,\n initialArgs: this.config.initialArgs,\n inputsValid: downgradeCfgOrLambda(this.config.inputsValid),\n sections: downgradeCfgOrLambda(this.config.sections),\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n downgradeCfgOrLambda(value),\n ]),\n ),\n };\n\n globalThis.platformaApiVersion = this.config.featureFlags\n .requiresUIAPIVersion as PlatformaApiVersion;\n\n if (!isInUI())\n // we are in the configuration rendering routine, not in actual UI\n return { config } as any;\n // normal operation inside the UI\n else\n return {\n ...getPlatformaInstance({\n sdkVersion: PlatformaSDKVersion,\n apiVersion: platformaApiVersion,\n }),\n blockModelInfo: {\n outputs: Object.fromEntries(\n Object.entries(this.config.outputs).map(([key, value]) => [\n key,\n {\n withStatus: Boolean(isConfigLambda(value) && value.withStatus),\n },\n ]),\n ),\n },\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;AA0CA;;AAE0E;MAC7D,UAAU,CAAA;AAOX,IAAA,MAAA;AADV,IAAA,WAAA,CACU,MAYP,EAAA;QAZO,IAAA,CAAA,MAAM,GAAN,MAAM;IAab;AAEI,IAAA,WAAW,2BAA2B,GAAA;QAC3C,OAAO;AACL,YAAA,iBAAiB,EAAE,IAAI;AACvB,YAAA,oBAAoB,EAAE,CAAC;AACvB,YAAA,uBAAuB,EAAE,CAAC;AAC1B,YAAA,sBAAsB,EAAE,IAAI;SAC7B;IACH;AAgBO,IAAA,OAAO,MAAM,CAAC,aAAA,GAAoC,OAAO,EAAA;QAC9D,OAAO,IAAI,UAAU,CAAiB;YACpC,aAAa;AACb,YAAA,cAAc,EAAE,EAAE;AAClB,YAAA,OAAO,EAAE,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M,EAAS;;;YAGxB,OAAO;AACL,gBAAA,GAAG,oBAAoB,CAAC;AACtB,oBAAA,UAAU,EAAE,mBAAmB;AAC/B,oBAAA,UAAU,EAAE,mBAAmB;iBAChC,CAAC;AACF,gBAAA,cAAc,EAAE;oBACd,OAAO,EAAE,MAAM,CAAC,WAAW,CACzB,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;wBACxD,GAAG;AACH,wBAAA;4BACE,UAAU,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC;AAC/D,yBAAA;AACF,qBAAA,CAAC,CACH;AACF,iBAAA;aACF;IACL;AACD;;;;"}
package/dist/sdk_info.cjs DELETED
@@ -1,10 +0,0 @@
1
- 'use strict';
2
-
3
- var version = require('./version.cjs');
4
-
5
- const CurrentSdkInfo = {
6
- sdkVersion: version.PlatformaSDKVersion,
7
- };
8
-
9
- exports.CurrentSdkInfo = CurrentSdkInfo;
10
- //# sourceMappingURL=sdk_info.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk_info.cjs","sources":["../src/sdk_info.ts"],"sourcesContent":["import { PlatformaSDKVersion } from \"./version\";\n\nexport type SdkInfo = {\n readonly sdkVersion: string;\n};\n\nexport const CurrentSdkInfo: SdkInfo = {\n sdkVersion: PlatformaSDKVersion,\n};\n"],"names":["PlatformaSDKVersion"],"mappings":";;;;AAMO,MAAM,cAAc,GAAY;AACrC,IAAA,UAAU,EAAEA,2BAAmB;;;;;"}
@@ -1,5 +0,0 @@
1
- export type SdkInfo = {
2
- readonly sdkVersion: string;
3
- };
4
- export declare const CurrentSdkInfo: SdkInfo;
5
- //# sourceMappingURL=sdk_info.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk_info.d.ts","sourceRoot":"","sources":["../src/sdk_info.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,OAE5B,CAAC"}
package/dist/sdk_info.js DELETED
@@ -1,8 +0,0 @@
1
- import { PlatformaSDKVersion } from './version.js';
2
-
3
- const CurrentSdkInfo = {
4
- sdkVersion: PlatformaSDKVersion,
5
- };
6
-
7
- export { CurrentSdkInfo };
8
- //# sourceMappingURL=sdk_info.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk_info.js","sources":["../src/sdk_info.ts"],"sourcesContent":["import { PlatformaSDKVersion } from \"./version\";\n\nexport type SdkInfo = {\n readonly sdkVersion: string;\n};\n\nexport const CurrentSdkInfo: SdkInfo = {\n sdkVersion: PlatformaSDKVersion,\n};\n"],"names":[],"mappings":";;AAMO,MAAM,cAAc,GAAY;AACrC,IAAA,UAAU,EAAE,mBAAmB;;;;;"}
@@ -1,12 +0,0 @@
1
- /** Patch for the structural object */
2
- export type Patch<K, V> = {
3
- /** Field name to patch */
4
- readonly key: K;
5
- /** New value for the field */
6
- readonly value: V;
7
- };
8
- /** Creates union type of all possible shallow patches for the given structure */
9
- export type Unionize<T extends Record<string, unknown>> = {
10
- [K in keyof T]: Patch<K, T[K]>;
11
- }[keyof T];
12
- //# sourceMappingURL=unionize.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unionize.d.ts","sourceRoot":"","sources":["../src/unionize.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,MAAM,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC,IAAI;IACxB,0BAA0B;IAC1B,QAAQ,CAAC,GAAG,EAAE,CAAC,CAAC;IAChB,8BAA8B;IAC9B,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;KACvD,CAAC,IAAI,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC,MAAM,CAAC,CAAC,CAAC"}
@@ -1,346 +0,0 @@
1
- /**
2
- * BlockStorage VM Integration - Internal module for VM-based storage operations.
3
- *
4
- * This module auto-registers internal callbacks that the middle layer can invoke
5
- * to perform storage transformations. Block developers never interact with these
6
- * directly - they only see `state`.
7
- *
8
- * Registered callbacks (all prefixed with `__pl_` for internal SDK use):
9
- * - `__pl_storage_applyUpdate`: (currentStorageJson, payload) => updatedStorageJson
10
- * - `__pl_storage_debugView`: (rawStorage) => JSON string with storage debug view
11
- * - `__pl_storage_migrate`: (currentStorageJson) => MigrationResult
12
- * - `__pl_args_derive`: (storageJson) => ArgsDeriveResult
13
- * - `__pl_prerunArgs_derive`: (storageJson) => ArgsDeriveResult
14
- *
15
- * Callbacks registered by DataModel.registerCallbacks():
16
- * - `__pl_data_initial`: () => initial data
17
- * - `__pl_data_upgrade`: (versioned) => DataMigrationResult
18
- * - `__pl_storage_initial`: () => initial BlockStorage as JSON string
19
- *
20
- * @module block_storage_vm
21
- * @internal
22
- */
23
-
24
- import {
25
- BLOCK_STORAGE_KEY,
26
- BLOCK_STORAGE_SCHEMA_VERSION,
27
- type BlockStorage,
28
- type MutateStoragePayload,
29
- type StorageDebugView,
30
- createBlockStorage,
31
- getStorageData,
32
- isBlockStorage,
33
- normalizeBlockStorage,
34
- updateStorageData,
35
- } from "./block_storage";
36
- import { stringifyJson, type StringifiedJson } from "@milaboratories/pl-model-common";
37
- import { tryGetCfgRenderCtx, tryRegisterCallback } from "./internal";
38
-
39
- /**
40
- * Result of storage normalization
41
- */
42
- export interface NormalizeStorageResult {
43
- /** The normalized BlockStorage object */
44
- storage: BlockStorage;
45
- /** The extracted data (what developers see) */
46
- data: unknown;
47
- }
48
-
49
- /**
50
- * Normalizes raw storage data and extracts state.
51
- * Handles all formats:
52
- * - New BlockStorage format (has discriminator)
53
- * - Legacy V1/V2 format ({ args, uiState })
54
- * - Raw V3 state (any other format)
55
- *
56
- * @param rawStorage - Raw data from blockStorage field (may be JSON string or object)
57
- * @returns Object with normalized storage and extracted state
58
- */
59
- function normalizeStorage(rawStorage: unknown): NormalizeStorageResult {
60
- // Handle undefined/null
61
- if (rawStorage === undefined || rawStorage === null) {
62
- const storage = createBlockStorage({});
63
- return { storage, data: {} };
64
- }
65
-
66
- // Parse JSON string if needed
67
- let parsed = rawStorage;
68
- if (typeof rawStorage === "string") {
69
- try {
70
- parsed = JSON.parse(rawStorage);
71
- } catch {
72
- // If parsing fails, treat string as the data
73
- const storage = createBlockStorage(rawStorage);
74
- return { storage, data: rawStorage };
75
- }
76
- }
77
-
78
- // Check for BlockStorage format (has discriminator)
79
- if (isBlockStorage(parsed)) {
80
- const storage = normalizeBlockStorage(parsed);
81
- return { storage, data: getStorageData(storage) };
82
- }
83
-
84
- // Check for legacy V1/V2 format: { args, uiState }
85
- if (isLegacyModelV1ApiFormat(parsed)) {
86
- // For legacy format, the whole object IS the data
87
- const storage = createBlockStorage(parsed);
88
- return { storage, data: parsed };
89
- }
90
-
91
- // Raw V3 data - wrap it
92
- const storage = createBlockStorage(parsed);
93
- return { storage, data: parsed };
94
- }
95
-
96
- /**
97
- * Applies a state update to existing storage.
98
- * Used when setData is called from the frontend.
99
- *
100
- * @param currentStorageJson - Current storage as JSON string (must be defined)
101
- * @param newData - New data from application
102
- * @returns Updated storage as JSON string
103
- */
104
- function applyStorageUpdate(currentStorageJson: string, payload: MutateStoragePayload): string {
105
- const { storage: currentStorage } = normalizeStorage(currentStorageJson);
106
-
107
- // Update data while preserving other storage fields (version, plugins)
108
- const updatedStorage = updateStorageData(currentStorage, payload);
109
-
110
- return JSON.stringify(updatedStorage);
111
- }
112
-
113
- /**
114
- * Checks if data is in legacy Model API v1 format.
115
- * Legacy format has { args, uiState? } at top level without the BlockStorage discriminator.
116
- */
117
- function isLegacyModelV1ApiFormat(data: unknown): data is { args?: unknown } {
118
- if (data === null || typeof data !== "object") return false;
119
- if (isBlockStorage(data)) return false;
120
-
121
- const obj = data as Record<string, unknown>;
122
- return "args" in obj;
123
- }
124
-
125
- // =============================================================================
126
- // Auto-register internal callbacks when module is loaded in VM
127
- // =============================================================================
128
-
129
- // Register apply update callback (requires existing storage)
130
- tryRegisterCallback(
131
- "__pl_storage_applyUpdate",
132
- (currentStorageJson: string, payload: MutateStoragePayload) => {
133
- return applyStorageUpdate(currentStorageJson, payload);
134
- },
135
- );
136
-
137
- /**
138
- * Gets storage debug view from raw storage data.
139
- * Returns structured debug info about the storage state.
140
- *
141
- * @param rawStorage - Raw data from blockStorage field (may be JSON string or object)
142
- * @returns JSON string with storage debug view
143
- */
144
- function getStorageDebugView(rawStorage: unknown): StringifiedJson<StorageDebugView> {
145
- const { storage } = normalizeStorage(rawStorage);
146
- const debugView: StorageDebugView = {
147
- dataVersion: storage.__dataVersion,
148
- data: storage.__data,
149
- };
150
- return stringifyJson(debugView);
151
- }
152
-
153
- // Register debug view callback
154
- tryRegisterCallback("__pl_storage_debugView", (rawStorage: unknown) => {
155
- return getStorageDebugView(rawStorage);
156
- });
157
-
158
- // =============================================================================
159
- // Migration Support
160
- // =============================================================================
161
-
162
- /**
163
- * Result of storage migration.
164
- * Returned by __pl_storage_migrate callback.
165
- *
166
- * - Error result: { error: string } - serious failure (no context, etc.)
167
- * - Success result: { newStorageJson: string, info: string, warn?: string } - migration succeeded or reset to initial
168
- */
169
- export type MigrationResult =
170
- | { error: string }
171
- | { error?: undefined; newStorageJson: string; info: string; warn?: string };
172
-
173
- /** Result from DataModel.migrate() */
174
- interface DataMigrationResult {
175
- version: string;
176
- data: unknown;
177
- warning?: string;
178
- }
179
-
180
- /**
181
- * Runs storage migration using the DataModel's migrate callback.
182
- * This is the main entry point for the middle layer to trigger migrations.
183
- *
184
- * Uses the '__pl_data_upgrade' callback registered by DataModel.registerCallbacks() which:
185
- * - Handles all migration logic internally
186
- * - Returns { version, data, warning? } - warning present if reset to initial data
187
- *
188
- * @param currentStorageJson - Current storage as JSON string (or undefined)
189
- * @returns MigrationResult
190
- */
191
- function migrateStorage(currentStorageJson: string | undefined): MigrationResult {
192
- // Get the callback registry context
193
- const ctx = tryGetCfgRenderCtx();
194
- if (ctx === undefined) {
195
- return { error: "Not in config rendering context" };
196
- }
197
-
198
- // Normalize storage to get current data and version
199
- const { storage: currentStorage, data: currentData } = normalizeStorage(currentStorageJson);
200
- const currentVersion = currentStorage.__dataVersion;
201
-
202
- // Helper to create storage with given data and version
203
- const createStorageJson = (data: unknown, version: string): string => {
204
- return JSON.stringify({
205
- ...currentStorage,
206
- __dataVersion: version,
207
- __data: data,
208
- });
209
- };
210
-
211
- // Get the migrate callback (registered by DataModel.registerCallbacks())
212
- const migrateCallback = ctx.callbackRegistry["__pl_data_upgrade"] as
213
- | ((v: { version: string; data: unknown }) => DataMigrationResult)
214
- | undefined;
215
- if (typeof migrateCallback !== "function") {
216
- return { error: "__pl_data_upgrade callback not found (DataModel not registered)" };
217
- }
218
-
219
- // Call the migrator's migrate function
220
- let result: DataMigrationResult;
221
- try {
222
- result = migrateCallback({ version: currentVersion, data: currentData });
223
- } catch (e) {
224
- const errorMsg = e instanceof Error ? e.message : String(e);
225
- return { error: `migrate() threw: ${errorMsg}` };
226
- }
227
-
228
- // Build info message
229
- const info =
230
- result.version === currentVersion
231
- ? `No migration needed (${currentVersion})`
232
- : result.warning
233
- ? `Reset to initial data (${result.version})`
234
- : `Migrated ${currentVersion}→${result.version}`;
235
-
236
- return {
237
- newStorageJson: createStorageJson(result.data, result.version),
238
- info,
239
- warn: result.warning,
240
- };
241
- }
242
-
243
- // Register migrate callback
244
- tryRegisterCallback("__pl_storage_migrate", (currentStorageJson: string | undefined) => {
245
- return migrateStorage(currentStorageJson);
246
- });
247
-
248
- // =============================================================================
249
- // Args Derivation from Storage
250
- // =============================================================================
251
-
252
- /**
253
- * Result of args derivation from storage.
254
- * Returned by __pl_args_derive and __pl_prerunArgs_derive callbacks.
255
- */
256
- export type ArgsDeriveResult = { error: string } | { error?: undefined; value: unknown };
257
-
258
- /**
259
- * Derives args from storage using the registered 'args' callback.
260
- * This extracts data from storage and passes it to the block's args() function.
261
- *
262
- * @param storageJson - Storage as JSON string
263
- * @returns ArgsDeriveResult with derived args or error
264
- */
265
- function deriveArgsFromStorage(storageJson: string): ArgsDeriveResult {
266
- const ctx = tryGetCfgRenderCtx();
267
- if (ctx === undefined) {
268
- return { error: "Not in config rendering context" };
269
- }
270
-
271
- // Extract data from storage
272
- const { data } = normalizeStorage(storageJson);
273
-
274
- // Get the args callback (registered by BlockModelV3.args())
275
- const argsCallback = ctx.callbackRegistry["args"] as ((data: unknown) => unknown) | undefined;
276
- if (typeof argsCallback !== "function") {
277
- return { error: "args callback not found" };
278
- }
279
-
280
- // Call the args callback with extracted data
281
- try {
282
- const result = argsCallback(data);
283
- return { value: result };
284
- } catch (e) {
285
- const errorMsg = e instanceof Error ? e.message : String(e);
286
- return { error: `args() threw: ${errorMsg}` };
287
- }
288
- }
289
-
290
- // Register args derivation callback
291
- tryRegisterCallback("__pl_args_derive", (storageJson: string) => {
292
- return deriveArgsFromStorage(storageJson);
293
- });
294
-
295
- /**
296
- * Derives prerunArgs from storage using the registered 'prerunArgs' callback.
297
- * Falls back to 'args' callback if 'prerunArgs' is not defined.
298
- *
299
- * @param storageJson - Storage as JSON string
300
- * @returns ArgsDeriveResult with derived prerunArgs or error
301
- */
302
- function derivePrerunArgsFromStorage(storageJson: string): ArgsDeriveResult {
303
- const ctx = tryGetCfgRenderCtx();
304
- if (ctx === undefined) {
305
- return { error: "Not in config rendering context" };
306
- }
307
-
308
- // Extract data from storage
309
- const { data } = normalizeStorage(storageJson);
310
-
311
- // Try prerunArgs callback first
312
- const prerunArgsCallback = ctx.callbackRegistry["prerunArgs"] as
313
- | ((data: unknown) => unknown)
314
- | undefined;
315
- if (typeof prerunArgsCallback === "function") {
316
- try {
317
- const result = prerunArgsCallback(data);
318
- return { value: result };
319
- } catch (e) {
320
- const errorMsg = e instanceof Error ? e.message : String(e);
321
- return { error: `prerunArgs() threw: ${errorMsg}` };
322
- }
323
- }
324
-
325
- // Fall back to args callback
326
- const argsCallback = ctx.callbackRegistry["args"] as ((data: unknown) => unknown) | undefined;
327
- if (typeof argsCallback !== "function") {
328
- return { error: "args callback not found (fallback from missing prerunArgs)" };
329
- }
330
-
331
- try {
332
- const result = argsCallback(data);
333
- return { value: result };
334
- } catch (e) {
335
- const errorMsg = e instanceof Error ? e.message : String(e);
336
- return { error: `args() threw (fallback): ${errorMsg}` };
337
- }
338
- }
339
-
340
- // Register prerunArgs derivation callback
341
- tryRegisterCallback("__pl_prerunArgs_derive", (storageJson: string) => {
342
- return derivePrerunArgsFromStorage(storageJson);
343
- });
344
-
345
- // Export discriminator key and schema version for external checks
346
- export { BLOCK_STORAGE_KEY, BLOCK_STORAGE_SCHEMA_VERSION };
package/src/branding.ts DELETED
@@ -1,4 +0,0 @@
1
- declare const __brand: unique symbol;
2
- type Brand<B> = { [__brand]: B };
3
-
4
- export type Branded<T, B> = T & Brand<B>;
package/src/sdk_info.ts DELETED
@@ -1,9 +0,0 @@
1
- import { PlatformaSDKVersion } from "./version";
2
-
3
- export type SdkInfo = {
4
- readonly sdkVersion: string;
5
- };
6
-
7
- export const CurrentSdkInfo: SdkInfo = {
8
- sdkVersion: PlatformaSDKVersion,
9
- };
package/src/unionize.ts DELETED
@@ -1,12 +0,0 @@
1
- /** Patch for the structural object */
2
- export type Patch<K, V> = {
3
- /** Field name to patch */
4
- readonly key: K;
5
- /** New value for the field */
6
- readonly value: V;
7
- };
8
-
9
- /** Creates union type of all possible shallow patches for the given structure */
10
- export type Unionize<T extends Record<string, unknown>> = {
11
- [K in keyof T]: Patch<K, T[K]>;
12
- }[keyof T];