@platforma-sdk/model 1.51.9 → 1.52.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 (82) hide show
  1. package/dist/bconfig/lambdas.d.ts +26 -4
  2. package/dist/bconfig/lambdas.d.ts.map +1 -1
  3. package/dist/bconfig/v3.d.ts +4 -2
  4. package/dist/bconfig/v3.d.ts.map +1 -1
  5. package/dist/block_api_v3.d.ts +32 -0
  6. package/dist/block_api_v3.d.ts.map +1 -0
  7. package/dist/block_migrations.cjs +138 -0
  8. package/dist/block_migrations.cjs.map +1 -0
  9. package/dist/block_migrations.d.ts +79 -0
  10. package/dist/block_migrations.d.ts.map +1 -0
  11. package/dist/block_migrations.js +136 -0
  12. package/dist/block_migrations.js.map +1 -0
  13. package/dist/block_model.cjs +222 -0
  14. package/dist/block_model.cjs.map +1 -0
  15. package/dist/block_model.d.ts +132 -0
  16. package/dist/block_model.d.ts.map +1 -0
  17. package/dist/block_model.js +220 -0
  18. package/dist/block_model.js.map +1 -0
  19. package/dist/block_storage.cjs +244 -0
  20. package/dist/block_storage.cjs.map +1 -0
  21. package/dist/block_storage.d.ts +208 -0
  22. package/dist/block_storage.d.ts.map +1 -0
  23. package/dist/block_storage.js +225 -0
  24. package/dist/block_storage.js.map +1 -0
  25. package/dist/block_storage_vm.cjs +264 -0
  26. package/dist/block_storage_vm.cjs.map +1 -0
  27. package/dist/block_storage_vm.d.ts +67 -0
  28. package/dist/block_storage_vm.d.ts.map +1 -0
  29. package/dist/block_storage_vm.js +260 -0
  30. package/dist/block_storage_vm.js.map +1 -0
  31. package/dist/builder.cjs +9 -6
  32. package/dist/builder.cjs.map +1 -1
  33. package/dist/builder.d.ts +15 -30
  34. package/dist/builder.d.ts.map +1 -1
  35. package/dist/builder.js +10 -7
  36. package/dist/builder.js.map +1 -1
  37. package/dist/components/PlDataTable.cjs.map +1 -1
  38. package/dist/components/PlDataTable.d.ts +2 -2
  39. package/dist/components/PlDataTable.d.ts.map +1 -1
  40. package/dist/components/PlDataTable.js.map +1 -1
  41. package/dist/index.cjs +25 -0
  42. package/dist/index.cjs.map +1 -1
  43. package/dist/index.d.ts +3 -0
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +4 -1
  46. package/dist/index.js.map +1 -1
  47. package/dist/internal.cjs +38 -0
  48. package/dist/internal.cjs.map +1 -1
  49. package/dist/internal.d.ts +21 -0
  50. package/dist/internal.d.ts.map +1 -1
  51. package/dist/internal.js +36 -1
  52. package/dist/internal.js.map +1 -1
  53. package/dist/package.json.cjs +1 -1
  54. package/dist/package.json.js +1 -1
  55. package/dist/platforma.d.ts +18 -3
  56. package/dist/platforma.d.ts.map +1 -1
  57. package/dist/render/api.cjs +43 -16
  58. package/dist/render/api.cjs.map +1 -1
  59. package/dist/render/api.d.ts +19 -7
  60. package/dist/render/api.d.ts.map +1 -1
  61. package/dist/render/api.js +42 -17
  62. package/dist/render/api.js.map +1 -1
  63. package/dist/render/internal.cjs.map +1 -1
  64. package/dist/render/internal.d.ts +3 -1
  65. package/dist/render/internal.d.ts.map +1 -1
  66. package/dist/render/internal.js.map +1 -1
  67. package/package.json +7 -7
  68. package/src/bconfig/lambdas.ts +35 -4
  69. package/src/bconfig/v3.ts +12 -2
  70. package/src/block_api_v3.ts +49 -0
  71. package/src/block_migrations.ts +173 -0
  72. package/src/block_model.ts +440 -0
  73. package/src/block_storage.test.ts +258 -0
  74. package/src/block_storage.ts +365 -0
  75. package/src/block_storage_vm.ts +349 -0
  76. package/src/builder.ts +24 -59
  77. package/src/components/PlDataTable.ts +2 -1
  78. package/src/index.ts +3 -0
  79. package/src/internal.ts +51 -0
  80. package/src/platforma.ts +31 -5
  81. package/src/render/api.ts +52 -21
  82. package/src/render/internal.ts +3 -1
package/dist/index.cjs CHANGED
@@ -1,7 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var block_state_util = require('./block_state_util.cjs');
4
+ var block_storage = require('./block_storage.cjs');
4
5
  var builder = require('./builder.cjs');
6
+ var block_model = require('./block_model.cjs');
7
+ var block_migrations = require('./block_migrations.cjs');
5
8
  var normalization = require('./bconfig/normalization.cjs');
6
9
  var types = require('./bconfig/types.cjs');
7
10
  var PFrameForGraphs = require('./components/PFrameForGraphs.cjs');
@@ -35,7 +38,27 @@ var columns = require('./pframe_utils/columns.cjs');
35
38
  exports.OutputError = block_state_util.OutputError;
36
39
  exports.readOutput = block_state_util.readOutput;
37
40
  exports.wrapOutputs = block_state_util.wrapOutputs;
41
+ exports.BLOCK_STORAGE_KEY = block_storage.BLOCK_STORAGE_KEY;
42
+ exports.BLOCK_STORAGE_SCHEMA_VERSION = block_storage.BLOCK_STORAGE_SCHEMA_VERSION;
43
+ exports.createBlockStorage = block_storage.createBlockStorage;
44
+ exports.defaultBlockStorageHandlers = block_storage.defaultBlockStorageHandlers;
45
+ exports.deriveDataFromStorage = block_storage.deriveDataFromStorage;
46
+ exports.getFromStorage = block_storage.getFromStorage;
47
+ exports.getPluginData = block_storage.getPluginData;
48
+ exports.getPluginNames = block_storage.getPluginNames;
49
+ exports.getStorageData = block_storage.getStorageData;
50
+ exports.getStorageDataVersion = block_storage.getStorageDataVersion;
51
+ exports.isBlockStorage = block_storage.isBlockStorage;
52
+ exports.mergeBlockStorageHandlers = block_storage.mergeBlockStorageHandlers;
53
+ exports.normalizeBlockStorage = block_storage.normalizeBlockStorage;
54
+ exports.removePluginData = block_storage.removePluginData;
55
+ exports.setPluginData = block_storage.setPluginData;
56
+ exports.updateStorage = block_storage.updateStorage;
57
+ exports.updateStorageData = block_storage.updateStorageData;
58
+ exports.updateStorageDataVersion = block_storage.updateStorageDataVersion;
38
59
  exports.BlockModel = builder.BlockModel;
60
+ exports.BlockModelV3 = block_model.BlockModelV3;
61
+ exports.DataModel = block_migrations.DataModel;
39
62
  exports.downgradeCfgOrLambda = normalization.downgradeCfgOrLambda;
40
63
  exports.extractConfig = normalization.extractConfig;
41
64
  exports.isConfigLambda = types.isConfigLambda;
@@ -95,6 +118,8 @@ exports.PFrameImpl = pframe.PFrameImpl;
95
118
  exports.fromPlOption = ref_util.fromPlOption;
96
119
  exports.fromPlRef = ref_util.fromPlRef;
97
120
  exports.RenderCtx = api.RenderCtx;
121
+ exports.RenderCtxBase = api.RenderCtxBase;
122
+ exports.RenderCtxLegacy = api.RenderCtxLegacy;
98
123
  exports.ResultPool = api.ResultPool;
99
124
  exports.TreeNodeAccessor = accessor.TreeNodeAccessor;
100
125
  exports.ifDef = accessor.ifDef;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  export * from './block_state_patch';
2
2
  export * from './block_state_util';
3
+ export * from './block_storage';
3
4
  export * from './builder';
5
+ export { BlockModelV3 } from './block_model';
6
+ export { DataModel } from './block_migrations';
4
7
  export * from './bconfig';
5
8
  export * from './components';
6
9
  export * from './config';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc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AAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -1,5 +1,8 @@
1
1
  export { OutputError, readOutput, wrapOutputs } from './block_state_util.js';
2
+ export { BLOCK_STORAGE_KEY, BLOCK_STORAGE_SCHEMA_VERSION, createBlockStorage, defaultBlockStorageHandlers, deriveDataFromStorage, getFromStorage, getPluginData, getPluginNames, getStorageData, getStorageDataVersion, isBlockStorage, mergeBlockStorageHandlers, normalizeBlockStorage, removePluginData, setPluginData, updateStorage, updateStorageData, updateStorageDataVersion } from './block_storage.js';
2
3
  export { BlockModel } from './builder.js';
4
+ export { BlockModelV3 } from './block_model.js';
5
+ export { DataModel } from './block_migrations.js';
3
6
  export { downgradeCfgOrLambda, extractConfig } from './bconfig/normalization.js';
4
7
  export { isConfigLambda } from './bconfig/types.js';
5
8
  export { createPFrameForGraphs, enrichCompatible, getAvailableWithLinkersAxes, isHiddenFromGraphColumn, isHiddenFromUIColumn } from './components/PFrameForGraphs.js';
@@ -10,7 +13,7 @@ export { createPlSelectionModel } from './components/PlSelectionModel.js';
10
13
  export { Args, It, MainOutputs, StagingOutputs, UiState, and, extractArchiveAndGetURL, flatten, getBlobContent, getBlobContentAsJson, getBlobContentAsString, getDownloadedBlobContent, getFromCfg, getImmediate, getImportProgress, getJsonField, getLastLogs, getLogHandle, getOnDemandBlobContent, getProgressLog, getProgressLogWithInfo, getResourceField, getResourceValueAsJson, isEmpty, isolate, makeArray, makeObject, mapArrayValues, mapRecordValues, mapResourceFields, not, or } from './config/actions.js';
11
14
  export { PFrameImpl } from './pframe.js';
12
15
  export { fromPlOption, fromPlRef } from './ref_util.js';
13
- export { RenderCtx, ResultPool } from './render/api.js';
16
+ export { RenderCtx, RenderCtxBase, RenderCtxLegacy, ResultPool } from './render/api.js';
14
17
  export { TreeNodeAccessor, ifDef } from './render/accessor.js';
15
18
  export { 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';
16
19
  export { Trace, TraceEntry, deriveLabels } from './render/util/label.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/internal.cjs CHANGED
@@ -34,6 +34,41 @@ function tryRegisterCallback(key, callback) {
34
34
  ctx.callbackRegistry[key] = callback;
35
35
  return true;
36
36
  }
37
+ /**
38
+ * Registers a callback, replacing any existing callback with the same key.
39
+ * Use this for callbacks that have a default value but can be overridden.
40
+ *
41
+ * @param key - The callback registry key
42
+ * @param callback - The callback function to register
43
+ * @returns true if registered, false if not in render context
44
+ */
45
+ function replaceCallback(key, callback) {
46
+ const ctx = tryGetCfgRenderCtx();
47
+ if (ctx === undefined)
48
+ return false;
49
+ ctx.callbackRegistry[key] = callback;
50
+ return true;
51
+ }
52
+ /** Creates a ConfigRenderLambda descriptor without registering a callback. */
53
+ function createRenderLambda(opts) {
54
+ const { handle, ...flags } = opts;
55
+ return {
56
+ __renderLambda: true,
57
+ handle,
58
+ ...flags,
59
+ };
60
+ }
61
+ /** Registers a callback and returns a ConfigRenderLambda descriptor. */
62
+ function createAndRegisterRenderLambda(opts, replace) {
63
+ const { handle, lambda, ...flags } = opts;
64
+ if (replace) {
65
+ replaceCallback(handle, lambda);
66
+ }
67
+ else {
68
+ tryRegisterCallback(handle, lambda);
69
+ }
70
+ return createRenderLambda({ handle, ...flags });
71
+ }
37
72
  const futureResolves = new Map();
38
73
  function registerFutureAwait(handle, onResolve) {
39
74
  if (!(handle in getCfgRenderCtx().callbackRegistry)) {
@@ -47,10 +82,13 @@ function registerFutureAwait(handle, onResolve) {
47
82
  futureResolves.get(handle).push(onResolve);
48
83
  }
49
84
 
85
+ exports.createAndRegisterRenderLambda = createAndRegisterRenderLambda;
86
+ exports.createRenderLambda = createRenderLambda;
50
87
  exports.getCfgRenderCtx = getCfgRenderCtx;
51
88
  exports.getPlatformaInstance = getPlatformaInstance;
52
89
  exports.isInUI = isInUI;
53
90
  exports.registerFutureAwait = registerFutureAwait;
91
+ exports.replaceCallback = replaceCallback;
54
92
  exports.tryGetCfgRenderCtx = tryGetCfgRenderCtx;
55
93
  exports.tryRegisterCallback = tryRegisterCallback;
56
94
  //# sourceMappingURL=internal.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.cjs","sources":["../src/internal.ts"],"sourcesContent":["import type { OutputWithStatus } from '@milaboratories/pl-model-common';\nimport { } from './global';\nimport type { Platforma, PlatformaApiVersion } from './platforma';\nimport type { FutureHandle, GlobalCfgRenderCtx } from './render/internal';\n\n/** Utility code helping to identify whether the code is running in actual UI environment */\nexport function isInUI() {\n return (\n typeof globalThis.getPlatforma !== 'undefined' || typeof globalThis.platforma !== 'undefined'\n );\n}\n\n/** Utility code helping to retrieve a platforma instance form the environment */\nexport function getPlatformaInstance<\n Args = unknown,\n Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n>(config?: { sdkVersion: string; apiVersion: PlatformaApiVersion }): Platforma<Args, Outputs, UiState, Href> {\n if (config && typeof globalThis.getPlatforma === 'function')\n return globalThis.getPlatforma(config);\n else if (typeof globalThis.platforma !== 'undefined') return globalThis.platforma as Platforma<Args, Outputs, UiState, Href>;\n else throw new Error('Can\\'t get platforma instance.');\n}\n\nexport function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {\n if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;\n else return undefined;\n}\n\nexport function getCfgRenderCtx(): GlobalCfgRenderCtx {\n if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;\n else throw new Error('Not in config rendering context');\n}\n\nexport function tryRegisterCallback(key: string, callback: (...args: any[]) => any): boolean {\n const ctx = tryGetCfgRenderCtx();\n if (ctx === undefined) return false;\n if (key in ctx.callbackRegistry) throw new Error(`Callback with key ${key} already registered.`);\n ctx.callbackRegistry[key] = callback;\n return true;\n}\n\nconst futureResolves = new Map<string, ((value: unknown) => void)[]>();\n\nexport function registerFutureAwait(handle: FutureHandle, onResolve: (value: unknown) => void) {\n if (!(handle in getCfgRenderCtx().callbackRegistry)) {\n getCfgRenderCtx().callbackRegistry[handle] = (value: unknown) => {\n for (const res of futureResolves.get(handle)!) {\n res(value);\n }\n };\n futureResolves.set(handle, []);\n }\n futureResolves.get(handle)!.push(onResolve);\n}\n"],"names":[],"mappings":";;AAKA;SACgB,MAAM,GAAA;AACpB,IAAA,QACE,OAAO,UAAU,CAAC,YAAY,KAAK,WAAW,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,WAAW;AAEjG;AAEA;AACM,SAAU,oBAAoB,CAKlC,MAAgE,EAAA;AAChE,IAAA,IAAI,MAAM,IAAI,OAAO,UAAU,CAAC,YAAY,KAAK,UAAU;AACzD,QAAA,OAAO,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC;AACnC,SAAA,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,WAAW;QAAE,OAAO,UAAU,CAAC,SAAoD;;AACvH,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC;AACxD;SAEgB,kBAAkB,GAAA;AAChC,IAAA,IAAI,OAAO,UAAU,CAAC,YAAY,KAAK,WAAW;QAAE,OAAO,UAAU,CAAC,YAAY;;AAC7E,QAAA,OAAO,SAAS;AACvB;SAEgB,eAAe,GAAA;AAC7B,IAAA,IAAI,OAAO,UAAU,CAAC,YAAY,KAAK,WAAW;QAAE,OAAO,UAAU,CAAC,YAAY;;AAC7E,QAAA,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC;AACzD;AAEM,SAAU,mBAAmB,CAAC,GAAW,EAAE,QAAiC,EAAA;AAChF,IAAA,MAAM,GAAG,GAAG,kBAAkB,EAAE;IAChC,IAAI,GAAG,KAAK,SAAS;AAAE,QAAA,OAAO,KAAK;AACnC,IAAA,IAAI,GAAG,IAAI,GAAG,CAAC,gBAAgB;AAAE,QAAA,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,CAAA,oBAAA,CAAsB,CAAC;AAChG,IAAA,GAAG,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,QAAQ;AACpC,IAAA,OAAO,IAAI;AACb;AAEA,MAAM,cAAc,GAAG,IAAI,GAAG,EAAwC;AAEhE,SAAU,mBAAmB,CAAC,MAAoB,EAAE,SAAmC,EAAA;IAC3F,IAAI,EAAE,MAAM,IAAI,eAAe,EAAE,CAAC,gBAAgB,CAAC,EAAE;QACnD,eAAe,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,KAAc,KAAI;YAC9D,KAAK,MAAM,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,MAAM,CAAE,EAAE;gBAC7C,GAAG,CAAC,KAAK,CAAC;YACZ;AACF,QAAA,CAAC;AACD,QAAA,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;IAChC;IACA,cAAc,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC,IAAI,CAAC,SAAS,CAAC;AAC7C;;;;;;;;;"}
1
+ {"version":3,"file":"internal.cjs","sources":["../src/internal.ts"],"sourcesContent":["import type { OutputWithStatus } from '@milaboratories/pl-model-common';\nimport { } from './global';\nimport type { Platforma, PlatformaApiVersion } from './platforma';\nimport type { FutureHandle, GlobalCfgRenderCtx } from './render/internal';\nimport type { ConfigRenderLambda, ConfigRenderLambdaFlags } from './bconfig';\n\n/** Utility code helping to identify whether the code is running in actual UI environment */\nexport function isInUI() {\n return (\n typeof globalThis.getPlatforma !== 'undefined' || typeof globalThis.platforma !== 'undefined'\n );\n}\n\n/** Utility code helping to retrieve a platforma instance form the environment */\nexport function getPlatformaInstance<\n Args = unknown,\n Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n>(config?: { sdkVersion: string; apiVersion: PlatformaApiVersion }): Platforma<Args, Outputs, UiState, Href> {\n if (config && typeof globalThis.getPlatforma === 'function')\n return globalThis.getPlatforma(config);\n else if (typeof globalThis.platforma !== 'undefined') return globalThis.platforma as Platforma<Args, Outputs, UiState, Href>;\n else throw new Error('Can\\'t get platforma instance.');\n}\n\nexport function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {\n if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;\n else return undefined;\n}\n\nexport function getCfgRenderCtx(): GlobalCfgRenderCtx {\n if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;\n else throw new Error('Not in config rendering context');\n}\n\nexport function tryRegisterCallback(key: string, callback: (...args: any[]) => any): boolean {\n const ctx = tryGetCfgRenderCtx();\n if (ctx === undefined) return false;\n if (key in ctx.callbackRegistry) throw new Error(`Callback with key ${key} already registered.`);\n ctx.callbackRegistry[key] = callback;\n return true;\n}\n\n/**\n * Registers a callback, replacing any existing callback with the same key.\n * Use this for callbacks that have a default value but can be overridden.\n *\n * @param key - The callback registry key\n * @param callback - The callback function to register\n * @returns true if registered, false if not in render context\n */\nexport function replaceCallback(key: string, callback: (...args: any[]) => any): boolean {\n const ctx = tryGetCfgRenderCtx();\n if (ctx === undefined) return false;\n ctx.callbackRegistry[key] = callback;\n return true;\n}\n\n//\n// ConfigRenderLambda helpers\n//\n\n/** Options for creating a ConfigRenderLambda descriptor */\nexport type CreateLambdaOptions = ConfigRenderLambdaFlags & {\n /** The callback registry key */\n handle: string;\n};\n\n/** Creates a ConfigRenderLambda descriptor without registering a callback. */\nexport function createRenderLambda<T = unknown>(opts: CreateLambdaOptions): ConfigRenderLambda<T> {\n const { handle, ...flags } = opts;\n return {\n __renderLambda: true,\n handle,\n ...flags,\n } as ConfigRenderLambda<T>;\n}\n\n/** Registers a callback and returns a ConfigRenderLambda descriptor. */\nexport function createAndRegisterRenderLambda<T = unknown>(opts: CreateLambdaOptions & {\n lambda: (...args: any[]) => any;\n}, replace?: boolean): ConfigRenderLambda<T> {\n const { handle, lambda, ...flags } = opts;\n\n if (replace) {\n replaceCallback(handle, lambda);\n } else {\n tryRegisterCallback(handle, lambda);\n }\n\n return createRenderLambda<T>({ handle, ...flags });\n}\n\nconst futureResolves = new Map<string, ((value: unknown) => void)[]>();\n\nexport function registerFutureAwait(handle: FutureHandle, onResolve: (value: unknown) => void) {\n if (!(handle in getCfgRenderCtx().callbackRegistry)) {\n getCfgRenderCtx().callbackRegistry[handle] = (value: unknown) => {\n for (const res of futureResolves.get(handle)!) {\n res(value);\n }\n };\n futureResolves.set(handle, []);\n }\n futureResolves.get(handle)!.push(onResolve);\n}\n"],"names":[],"mappings":";;AAMA;SACgB,MAAM,GAAA;AACpB,IAAA,QACE,OAAO,UAAU,CAAC,YAAY,KAAK,WAAW,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,WAAW;AAEjG;AAEA;AACM,SAAU,oBAAoB,CAKlC,MAAgE,EAAA;AAChE,IAAA,IAAI,MAAM,IAAI,OAAO,UAAU,CAAC,YAAY,KAAK,UAAU;AACzD,QAAA,OAAO,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC;AACnC,SAAA,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,WAAW;QAAE,OAAO,UAAU,CAAC,SAAoD;;AACvH,QAAA,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC;AACxD;SAEgB,kBAAkB,GAAA;AAChC,IAAA,IAAI,OAAO,UAAU,CAAC,YAAY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Ae,CAAC,MAAM,EAAE,MAAM,CAAC;IACjC;SAAO;AACL,QAAA,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC;IACrC;IAEA,OAAO,kBAAkB,CAAI,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC;AACpD;AAEA,MAAM,cAAc,GAAG,IAAI,GAAG,EAAwC;AAEhE,SAAU,mBAAmB,CAAC,MAAoB,EAAE,SAAmC,EAAA;IAC3F,IAAI,EAAE,MAAM,IAAI,eAAe,EAAE,CAAC,gBAAgB,CAAC,EAAE;QACnD,eAAe,EAAE,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,CAAC,KAAc,KAAI;YAC9D,KAAK,MAAM,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,MAAM,CAAE,EAAE;gBAC7C,GAAG,CAAC,KAAK,CAAC;YACZ;AACF,QAAA,CAAC;AACD,QAAA,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;IAChC;IACA,cAAc,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC,IAAI,CAAC,SAAS,CAAC;AAC7C;;;;;;;;;;;;"}
@@ -1,6 +1,7 @@
1
1
  import type { OutputWithStatus } from '@milaboratories/pl-model-common';
2
2
  import type { Platforma, PlatformaApiVersion } from './platforma';
3
3
  import type { FutureHandle, GlobalCfgRenderCtx } from './render/internal';
4
+ import type { ConfigRenderLambda, ConfigRenderLambdaFlags } from './bconfig';
4
5
  /** Utility code helping to identify whether the code is running in actual UI environment */
5
6
  export declare function isInUI(): boolean;
6
7
  /** Utility code helping to retrieve a platforma instance form the environment */
@@ -11,5 +12,25 @@ export declare function getPlatformaInstance<Args = unknown, Outputs extends Rec
11
12
  export declare function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined;
12
13
  export declare function getCfgRenderCtx(): GlobalCfgRenderCtx;
13
14
  export declare function tryRegisterCallback(key: string, callback: (...args: any[]) => any): boolean;
15
+ /**
16
+ * Registers a callback, replacing any existing callback with the same key.
17
+ * Use this for callbacks that have a default value but can be overridden.
18
+ *
19
+ * @param key - The callback registry key
20
+ * @param callback - The callback function to register
21
+ * @returns true if registered, false if not in render context
22
+ */
23
+ export declare function replaceCallback(key: string, callback: (...args: any[]) => any): boolean;
24
+ /** Options for creating a ConfigRenderLambda descriptor */
25
+ export type CreateLambdaOptions = ConfigRenderLambdaFlags & {
26
+ /** The callback registry key */
27
+ handle: string;
28
+ };
29
+ /** Creates a ConfigRenderLambda descriptor without registering a callback. */
30
+ export declare function createRenderLambda<T = unknown>(opts: CreateLambdaOptions): ConfigRenderLambda<T>;
31
+ /** Registers a callback and returns a ConfigRenderLambda descriptor. */
32
+ export declare function createAndRegisterRenderLambda<T = unknown>(opts: CreateLambdaOptions & {
33
+ lambda: (...args: any[]) => any;
34
+ }, replace?: boolean): ConfigRenderLambda<T>;
14
35
  export declare function registerFutureAwait(handle: FutureHandle, onResolve: (value: unknown) => void): void;
15
36
  //# sourceMappingURL=internal.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,SAAS,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAE1E,4FAA4F;AAC5F,wBAAgB,MAAM,YAIrB;AAED,iFAAiF;AACjF,wBAAgB,oBAAoB,CAClC,IAAI,GAAG,OAAO,EACd,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC,EACrG,OAAO,GAAG,OAAO,EACjB,IAAI,SAAS,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,EACxC,MAAM,CAA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CAAA;CAAE,GAAG,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAK3G;AAED,wBAAgB,kBAAkB,IAAI,kBAAkB,GAAG,SAAS,CAGnE;AAED,wBAAgB,eAAe,IAAI,kBAAkB,CAGpD;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,OAAO,CAM3F;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,GAAG,OAAO,CAKvF;AAMD,2DAA2D;AAC3D,MAAM,MAAM,mBAAmB,GAAG,uBAAuB,GAAG;IAC1D,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,8EAA8E;AAC9E,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,mBAAmB,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAOhG;AAED,wEAAwE;AACxE,wBAAgB,6BAA6B,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,mBAAmB,GAAG;IACrF,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC;CACjC,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,kBAAkB,CAAC,CAAC,CAAC,CAU3C;AAID,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,QAU5F"}
package/dist/internal.js CHANGED
@@ -32,6 +32,41 @@ function tryRegisterCallback(key, callback) {
32
32
  ctx.callbackRegistry[key] = callback;
33
33
  return true;
34
34
  }
35
+ /**
36
+ * Registers a callback, replacing any existing callback with the same key.
37
+ * Use this for callbacks that have a default value but can be overridden.
38
+ *
39
+ * @param key - The callback registry key
40
+ * @param callback - The callback function to register
41
+ * @returns true if registered, false if not in render context
42
+ */
43
+ function replaceCallback(key, callback) {
44
+ const ctx = tryGetCfgRenderCtx();
45
+ if (ctx === undefined)
46
+ return false;
47
+ ctx.callbackRegistry[key] = callback;
48
+ return true;
49
+ }
50
+ /** Creates a ConfigRenderLambda descriptor without registering a callback. */
51
+ function createRenderLambda(opts) {
52
+ const { handle, ...flags } = opts;
53
+ return {
54
+ __renderLambda: true,
55
+ handle,
56
+ ...flags,
57
+ };
58
+ }
59
+ /** Registers a callback and returns a ConfigRenderLambda descriptor. */
60
+ function createAndRegisterRenderLambda(opts, replace) {
61
+ const { handle, lambda, ...flags } = opts;
62
+ if (replace) {
63
+ replaceCallback(handle, lambda);
64
+ }
65
+ else {
66
+ tryRegisterCallback(handle, lambda);
67
+ }
68
+ return createRenderLambda({ handle, ...flags });
69
+ }
35
70
  const futureResolves = new Map();
36
71
  function registerFutureAwait(handle, onResolve) {
37
72
  if (!(handle in getCfgRenderCtx().callbackRegistry)) {
@@ -45,5 +80,5 @@ function registerFutureAwait(handle, onResolve) {
45
80
  futureResolves.get(handle).push(onResolve);
46
81
  }
47
82
 
48
- export { getCfgRenderCtx, getPlatformaInstance, isInUI, registerFutureAwait, tryGetCfgRenderCtx, tryRegisterCallback };
83
+ export { createAndRegisterRenderLambda, createRenderLambda, getCfgRenderCtx, getPlatformaInstance, isInUI, registerFutureAwait, replaceCallback, tryGetCfgRenderCtx, tryRegisterCallback };
49
84
  //# sourceMappingURL=internal.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"internal.js","sources":["../src/internal.ts"],"sourcesContent":["import type { OutputWithStatus } from '@milaboratories/pl-model-common';\nimport { } from './global';\nimport type { Platforma, PlatformaApiVersion } from './platforma';\nimport type { FutureHandle, GlobalCfgRenderCtx } from './render/internal';\n\n/** Utility code helping to identify whether the code is running in actual UI environment */\nexport function isInUI() {\n return (\n typeof globalThis.getPlatforma !== 'undefined' || typeof globalThis.platforma !== 'undefined'\n );\n}\n\n/** Utility code helping to retrieve a platforma instance form the environment */\nexport function getPlatformaInstance<\n Args = unknown,\n Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n>(config?: { sdkVersion: string; apiVersion: PlatformaApiVersion }): Platforma<Args, Outputs, UiState, Href> {\n if (config && typeof globalThis.getPlatforma === 'function')\n return globalThis.getPlatforma(config);\n else if (typeof globalThis.platforma !== 'undefined') return globalThis.platforma as Platforma<Args, Outputs, UiState, Href>;\n else throw new Error('Can\\'t get platforma instance.');\n}\n\nexport function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {\n if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;\n else return undefined;\n}\n\nexport function getCfgRenderCtx(): GlobalCfgRenderCtx {\n if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;\n else throw new Error('Not in config rendering context');\n}\n\nexport function tryRegisterCallback(key: string, callback: (...args: any[]) => any): boolean {\n const ctx = tryGetCfgRenderCtx();\n if (ctx === undefined) return false;\n if (key in ctx.callbackRegistry) throw new Error(`Callback with key ${key} already registered.`);\n ctx.callbackRegistry[key] = callback;\n return true;\n}\n\nconst futureResolves = new Map<string, ((value: unknown) => void)[]>();\n\nexport function registerFutureAwait(handle: FutureHandle, onResolve: (value: unknown) => void) {\n if (!(handle in getCfgRenderCtx().callbackRegistry)) {\n getCfgRenderCtx().callbackRegistry[handle] = (value: unknown) => {\n for (const res of futureResolves.get(handle)!) {\n res(value);\n }\n };\n futureResolves.set(handle, []);\n }\n futureResolves.get(handle)!.push(onResolve);\n}\n"],"names":[],"mappings":"AAKA;SACgB,MAAM,GAAA;AACpB,IAAA,QACE,OAAO,UAAU,CAAC,YAAY,KAAK,WAAW,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,WAAW;AAEjG;AAEA;AACM,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GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,MAAM,CAAE,EAAE;gBAC7C,GAAG,CAAC,KAAK,CAAC;YACZ;AACF,QAAA,CAAC;AACD,QAAA,cAAc,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC;IAChC;IACA,cAAc,CAAC,GAAG,CAAC,MAAM,CAAE,CAAC,IAAI,CAAC,SAAS,CAAC;AAC7C;;;;"}
1
+ {"version":3,"file":"internal.js","sources":["../src/internal.ts"],"sourcesContent":["import type { OutputWithStatus } from '@milaboratories/pl-model-common';\nimport { } from './global';\nimport type { Platforma, PlatformaApiVersion } from './platforma';\nimport type { FutureHandle, GlobalCfgRenderCtx } from './render/internal';\nimport type { ConfigRenderLambda, ConfigRenderLambdaFlags } from './bconfig';\n\n/** Utility code helping to identify whether the code is running in actual UI environment */\nexport function isInUI() {\n return (\n typeof globalThis.getPlatforma !== 'undefined' || typeof globalThis.platforma !== 'undefined'\n );\n}\n\n/** Utility code helping to retrieve a platforma instance form the environment */\nexport function getPlatformaInstance<\n Args = unknown,\n Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>,\n UiState = unknown,\n Href extends `/${string}` = `/${string}`,\n>(config?: { sdkVersion: string; apiVersion: PlatformaApiVersion }): Platforma<Args, Outputs, UiState, Href> {\n if (config && typeof globalThis.getPlatforma === 'function')\n return globalThis.getPlatforma(config);\n else if (typeof globalThis.platforma !== 'undefined') return globalThis.platforma as Platforma<Args, Outputs, UiState, Href>;\n else throw new Error('Can\\'t get platforma instance.');\n}\n\nexport function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {\n if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;\n else return undefined;\n}\n\nexport function getCfgRenderCtx(): GlobalCfgRenderCtx {\n if (typeof globalThis.cfgRenderCtx !== 'undefined') return globalThis.cfgRenderCtx;\n else throw new Error('Not in config rendering context');\n}\n\nexport function tryRegisterCallback(key: string, callback: (...args: any[]) => any): boolean {\n const ctx = tryGetCfgRenderCtx();\n if (ctx === undefined) return false;\n if (key in ctx.callbackRegistry) throw new Error(`Callback with key ${key} already registered.`);\n ctx.callbackRegistry[key] = callback;\n return true;\n}\n\n/**\n * Registers a callback, replacing any existing callback with the same key.\n * Use this for callbacks that have a default value but can be overridden.\n *\n * @param key - The callback registry key\n * @param callback - The callback function to register\n * @returns true if registered, false if not in render context\n */\nexport function replaceCallback(key: string, callback: (...args: any[]) => any): boolean {\n const ctx = tryGetCfgRenderCtx();\n if (ctx === undefined) return false;\n ctx.callbackRegistry[key] = callback;\n return true;\n}\n\n//\n// ConfigRenderLambda helpers\n//\n\n/** Options for creating a ConfigRenderLambda descriptor */\nexport type CreateLambdaOptions = ConfigRenderLambdaFlags & {\n /** The callback registry key */\n handle: string;\n};\n\n/** Creates a ConfigRenderLambda descriptor without registering a callback. */\nexport function createRenderLambda<T = unknown>(opts: CreateLambdaOptions): ConfigRenderLambda<T> {\n const { handle, ...flags } = opts;\n return {\n __renderLambda: true,\n handle,\n ...flags,\n } as ConfigRenderLambda<T>;\n}\n\n/** Registers a callback and returns a ConfigRenderLambda descriptor. */\nexport function createAndRegisterRenderLambda<T = unknown>(opts: CreateLambdaOptions & {\n lambda: (...args: any[]) => any;\n}, replace?: boolean): ConfigRenderLambda<T> {\n const { handle, lambda, ...flags } = opts;\n\n if (replace) {\n replaceCallback(handle, lambda);\n } else {\n tryRegisterCallback(handle, lambda);\n }\n\n return createRenderLambda<T>({ handle, ...flags });\n}\n\nconst futureResolves = new Map<string, ((value: unknown) => void)[]>();\n\nexport function registerFutureAwait(handle: FutureHandle, onResolve: (value: unknown) => void) {\n if (!(handle in getCfgRenderCtx().callbackRegistry)) {\n getCfgRenderCtx().callbackRegistry[handle] = (value: unknown) => {\n for (const res of futureResolves.get(handle)!) {\n res(value);\n }\n };\n futureResolves.set(handle, []);\n }\n futureResolves.get(handle)!.push(onResolve);\n}\n"],"names":[],"mappings":"AAMA;SACgB,MAAM,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
3
+ var version = "1.52.0";
4
4
 
5
5
  exports.version = version;
6
6
  //# sourceMappingURL=package.json.cjs.map
@@ -1,4 +1,4 @@
1
- var version = "1.51.9";
1
+ var version = "1.52.0";
2
2
 
3
3
  export { version };
4
4
  //# sourceMappingURL=package.json.js.map
@@ -1,6 +1,7 @@
1
1
  import type { BlockApiV1 } from './block_api_v1';
2
2
  import type { BlockApiV2 } from './block_api_v2';
3
- import type { BlockOutputsBase, BlockState, DriverKit, OutputWithStatus } from '@milaboratories/pl-model-common';
3
+ import type { BlockApiV3 } from './block_api_v3';
4
+ import type { BlockOutputsBase, BlockStateV3, DriverKit, OutputWithStatus } from '@milaboratories/pl-model-common';
4
5
  import type { SdkInfo } from './sdk_info';
5
6
  import type { BlockStatePatch } from './block_state_patch';
6
7
  /** Defines all methods to interact with the platform environment from within a block UI. @deprecated */
@@ -15,15 +16,29 @@ export interface PlatformaV2<Args = unknown, Outputs extends Record<string, Outp
15
16
  readonly sdkInfo: SdkInfo;
16
17
  readonly apiVersion: 2;
17
18
  }
18
- export type Platforma<Args = unknown, Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>, UiState = unknown, Href extends `/${string}` = `/${string}`> = PlatformaV1<Args, Outputs, UiState, Href> | PlatformaV2<Args, Outputs, UiState, Href>;
19
+ export interface PlatformaV3<Args = unknown, Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>, Data = unknown, Href extends `/${string}` = `/${string}`> extends BlockApiV3<Args, Outputs, Data, Href>, DriverKit {
20
+ /** Information about SDK version current platforma environment was compiled with. */
21
+ readonly sdkInfo: SdkInfo;
22
+ readonly apiVersion: 3;
23
+ }
24
+ export type Platforma<Args = unknown, Outputs extends Record<string, OutputWithStatus<unknown>> = Record<string, OutputWithStatus<unknown>>, UiState = unknown, Href extends `/${string}` = `/${string}`> = PlatformaV1<Args, Outputs, UiState, Href> | PlatformaV2<Args, Outputs, UiState, Href> | PlatformaV3<Args, Outputs, UiState, Href>;
25
+ export type PlatformaExtended<Pl extends Platforma = Platforma> = Pl & {
26
+ blockModelInfo: BlockModelInfo;
27
+ };
28
+ export type BlockModelInfo = {
29
+ outputs: Record<string, {
30
+ withStatus: boolean;
31
+ }>;
32
+ };
19
33
  export type PlatformaApiVersion = Platforma['apiVersion'];
20
34
  export type InferArgsType<Pl extends Platforma> = Pl extends Platforma<infer Args> ? Args : never;
21
35
  export type InferOutputsType<Pl extends Platforma> = Pl extends Platforma<unknown, infer Outputs> ? Outputs : never;
22
36
  export type InferUiState<Pl extends Platforma> = Pl extends Platforma<unknown, Record<string, OutputWithStatus<unknown>>, infer UiState> ? UiState : never;
37
+ export type InferDataType<Pl extends Platforma> = Pl extends Platforma<unknown, Record<string, OutputWithStatus<unknown>>, infer Data> ? Data : never;
23
38
  export type InferHrefType<Pl extends Platforma> = Pl extends Platforma<unknown, BlockOutputsBase, unknown, infer Href> ? Href : never;
24
39
  export type PlatformaFactory = (config: {
25
40
  sdkVersion: string;
26
41
  }) => Platforma;
27
- export type InferBlockState<Pl extends Platforma> = BlockState<InferArgsType<Pl>, InferOutputsType<Pl>, InferUiState<Pl>, InferHrefType<Pl>>;
42
+ export type InferBlockState<Pl extends Platforma> = BlockStateV3<InferOutputsType<Pl>, InferHrefType<Pl>>;
28
43
  export type InferBlockStatePatch<Pl extends Platforma> = BlockStatePatch<InferArgsType<Pl>, InferOutputsType<Pl>, InferUiState<Pl>, InferHrefType<Pl>>;
29
44
  //# sourceMappingURL=platforma.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"platforma.d.ts","sourceRoot":"","sources":["../src/platforma.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,C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,GAAG,IAAI,GAAG,KAAK,CAAC;AAEtF,MAAM,MAAM,gBAAgB,GAAG,CAAC,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,KAAK,SAAS,CAAC;AAE7E,MAAM,MAAM,eAAe,CAAC,EAAE,SAAS,SAAS,IAAI,YAAY,CAC9D,gBAAgB,CAAC,EAAE,CAAC,EACpB,aAAa,CAAC,EAAE,CAAC,CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAAC,EAAE,SAAS,SAAS,IAAI,eAAe,CACtE,aAAa,CAAC,EAAE,CAAC,EACjB,gBAAgB,CAAC,EAAE,CAAC,EACpB,YAAY,CAAC,EAAE,CAAC,EAChB,aAAa,CAAC,EAAE,CAAC,CAClB,CAAC"}
@@ -382,28 +382,19 @@ class ResultPool {
382
382
  }
383
383
  }
384
384
  /** Main entry point to the API available within model lambdas (like outputs, sections, etc..) */
385
- class RenderCtx {
385
+ class RenderCtxBase {
386
386
  ctx;
387
387
  constructor() {
388
388
  this.ctx = internal.getCfgRenderCtx();
389
389
  }
390
- _argsCache;
391
- get args() {
392
- if (this._argsCache === undefined) {
393
- const raw = this.ctx.args;
394
- const value = typeof raw === 'function' ? raw() : raw;
395
- this._argsCache = { v: JSON.parse(value) };
396
- }
397
- return this._argsCache.v;
398
- }
399
- _uiStateCache;
400
- get uiState() {
401
- if (this._uiStateCache === undefined) {
402
- const raw = this.ctx.uiState;
390
+ _dataCache;
391
+ get data() {
392
+ if (this._dataCache === undefined) {
393
+ const raw = this.ctx.data;
403
394
  const value = typeof raw === 'function' ? raw() : raw;
404
- this._uiStateCache = { v: value ? JSON.parse(value) : {} };
395
+ this._dataCache = { v: value ? JSON.parse(value) : {} };
405
396
  }
406
- return this._uiStateCache.v;
397
+ return this._dataCache.v;
407
398
  }
408
399
  // lazy rendering because this feature is rarely used
409
400
  _activeArgsCache;
@@ -514,7 +505,43 @@ class RenderCtx {
514
505
  this.ctx.logError(msg);
515
506
  }
516
507
  }
508
+ /** Main entry point to the API available within model lambdas (like outputs, sections, etc..) for v3+ blocks */
509
+ class RenderCtx extends RenderCtxBase {
510
+ _argsCache;
511
+ get args() {
512
+ if (this._argsCache === undefined) {
513
+ const raw = this.ctx.args;
514
+ const value = typeof raw === 'function' ? raw() : raw;
515
+ // args can be undefined when derivation fails (e.g., validation error in args())
516
+ this._argsCache = { v: value === undefined ? undefined : JSON.parse(value) };
517
+ }
518
+ return this._argsCache.v;
519
+ }
520
+ }
521
+ /** Render context for legacy v1/v2 blocks - provides backward compatibility */
522
+ class RenderCtxLegacy extends RenderCtxBase {
523
+ _argsCache;
524
+ get args() {
525
+ if (this._argsCache === undefined) {
526
+ const raw = this.ctx.args;
527
+ const value = typeof raw === 'function' ? raw() : raw;
528
+ this._argsCache = { v: JSON.parse(value) };
529
+ }
530
+ return this._argsCache.v;
531
+ }
532
+ _uiStateCache;
533
+ get uiState() {
534
+ if (this._uiStateCache === undefined) {
535
+ const raw = this.ctx.uiState;
536
+ const value = typeof raw === 'function' ? raw() : raw;
537
+ this._uiStateCache = { v: value ? JSON.parse(value) : {} };
538
+ }
539
+ return this._uiStateCache.v;
540
+ }
541
+ }
517
542
 
518
543
  exports.RenderCtx = RenderCtx;
544
+ exports.RenderCtxBase = RenderCtxBase;
545
+ exports.RenderCtxLegacy = RenderCtxLegacy;
519
546
  exports.ResultPool = ResultPool;
520
547
  //# sourceMappingURL=api.cjs.map