@platforma-sdk/model 1.2.28 → 1.2.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/env_value.d.ts +5 -0
- package/dist/env_value.d.ts.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +107 -102
- package/dist/index.mjs.map +1 -1
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
- package/src/env_value.ts +8 -0
- package/src/index.ts +1 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env_value.d.ts","sourceRoot":"","sources":["../src/env_value.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,SAAS,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CAChE;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGpE"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -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,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAG3B,cAAc,iCAAiC,CAAC;AAEhD,OAAO,KAAK,gBAAgB,MAAM,mBAAmB,CAAC"}
|
|
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,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAG3B,cAAc,iCAAiC,CAAC;AAEhD,OAAO,KAAK,gBAAgB,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var B=Object.defineProperty;var x=(e,t,n)=>t in e?B(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var l=(e,t,n)=>x(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@milaboratories/pl-model-common");class F extends Error{constructor(t,n){super(`${t.length}${n?"+":""} errors, first error: `+t[0]),this.errors=t,this.moreErrors=n}}function P(e){if(!e.ok)throw new F(e.errors,e.moreErrors);return e.value}function L(e){return new Proxy(e,{get(t,n){return P(t[n])}})}function o(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null?h(e):e}function p(e){return{type:"GetFromCtx",variable:e}}function j(e){return{type:"Isolate",cfg:e}}const E=p("$args"),k=p("$it"),J=p("$prod"),H=p("$staging"),M=p("$ui");function h(e){return{type:"Immediate",value:e}}function A(e){const t={};for(const[n,r]of Object.entries(e))t[n]=o(r);return{type:"MakeObject",template:t}}function N(...e){const t=[];for(const n of e)t.push(o(n));return{type:"MakeArray",template:t}}function f(e,t){return{type:"GetJsonField",source:o(e),field:o(t)}}function G(e,t,n="$it"){return{type:"MapRecordValues",source:e,mapping:t,itVar:n}}function $(e,t,n="$it"){return{type:"MapArrayValues",source:e,mapping:t,itVar:n}}function T(e){return{type:"Flatten",source:e}}function K(e){return{type:"IsEmpty",arg:e}}function z(e){return{type:"Not",operand:e}}function U(e,t){return{type:"And",operand1:e,operand2:t}}function W(e,t){return{type:"Or",operand1:e,operand2:t}}function q(e,t){return{type:"GetResourceField",source:o(e),field:o(t)}}function Q(){return function(e){return{type:"GetResourceValueAsJson",source:o(e)}}}function X(e,t,n="$it"){return{type:"MapResourceFields",source:e,mapping:t,itVar:n}}function Y(e){return{type:"GetBlobContent",source:o(e)}}function Z(e){return{type:"GetBlobContentAsString",source:o(e)}}function tt(){return function(e){return{type:"GetBlobContentAsJson",source:o(e)}}}function et(e){return{type:"GetDownloadedBlobContent",source:o(e)}}function nt(e){return{type:"GetOnDemandBlobContent",source:o(e)}}function rt(e){return{type:"GetImportProgress",source:o(e)}}function st(e,t){return{type:"GetLastLogs",source:o(e),lines:t}}function ot(e,t){return{type:"GetProgressLog",source:o(e),patternToSearch:t}}function it(e){return{type:"GetLogHandle",source:o(e)}}function at(){return typeof getPlatforma<"u"||typeof platforma<"u"}function ut(e){if(typeof getPlatforma=="function")return getPlatforma(e);if(typeof platforma<"u")return platforma;throw new Error("Can't get platforma instance.")}function lt(){if(typeof cfgRenderCtx<"u")return cfgRenderCtx}function s(){if(typeof cfgRenderCtx<"u")return cfgRenderCtx;throw new Error("Not in config rendering context")}function y(e,t){const n=lt();if(n===void 0)return!1;if(e in n.callbackRegistry)throw new Error(`Callback with key ${e} already registered.`);return n.callbackRegistry[e]=t,!0}const w=new Map;function ct(e,t){e in s().callbackRegistry||(s().callbackRegistry[e]=n=>{for(const r of w.get(e))r(n)},w.set(e,[])),w.get(e).push(t)}class a{constructor(t,n=r=>r){l(this,"isResolved",!1);l(this,"resolvedValue");this.handle=t,this.postProcess=n,ct(t,r=>{this.resolvedValue=n(r),this.isResolved=!0})}map(t){return new a(this.handle,n=>t(this.postProcess(n)))}mapDefined(t){return new a(this.handle,n=>{const r=this.postProcess(n);return r?t(r):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function C(e){return e===void 0?void 0:new d(e)}class d{constructor(t){this.handle=t}resolve(...t){return this.resolveWithCommon({},...t)}resolveWithCommon(t,...n){return C(s().resolveWithCommon(this.handle,t,...n))}get resourceType(){return s().getResourceType(this.handle)}getInputsLocked(){return s().getInputsLocked(this.handle)}getOutputsLocked(){return s().getOutputsLocked(this.handle)}getIsReadyOrError(){return s().getIsReadyOrError(this.handle)}getIsFinal(){return s().getIsFinal(this.handle)}getError(){return C(s().getError(this.handle))}listInputFields(){return s().listInputFields(this.handle)}listOutputFields(){return s().listOutputFields(this.handle)}listDynamicFields(){return s().listDynamicFields(this.handle)}getKeyValueBase64(t){return s().getKeyValueBase64(this.handle,t)}getKeyValueAsString(t){return s().getKeyValueAsString(this.handle,t)}getKeyValueAsJson(t){const n=this.getKeyValueAsString(t);if(n==null)throw new Error("Resource has no content.");return JSON.parse(n)}getDataBase64(){return s().getDataBase64(this.handle)}getDataAsString(){return s().getDataAsString(this.handle)}getDataAsJson(){const t=this.getDataAsString();if(t==null)throw new Error("Resource has no content.");return JSON.parse(t)}getPColumns(t=!1,n=""){const r=this.parsePObjectCollection(t,n);return r===void 0?void 0:Object.entries(r).map(([,g])=>{if(!c.isPColumn(g))throw new Error(`not a PColumn (kind = ${g.spec.kind})`);return g})}parsePObjectCollection(t=!1,n=""){const r=s().parsePObjectCollection(this.handle,t,n);if(r===void 0)return;const i={};for(const[g,v]of Object.entries(r))i[g]=c.mapPObjectData(v,I=>new d(I));return i}getFileContentAsBase64(){return new a(s().getBlobContentAsBase64(this.handle))}getFileContentAsString(){return new a(s().getBlobContentAsString(this.handle))}getFileContentAsJson(){return new a(s().getBlobContentAsString(this.handle)).mapDefined(t=>JSON.parse(t))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new a(s().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new a(s().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}getImportProgress(){return new a(s().getImportProgress(this.handle))}getLastLogs(t){return new a(s().getLastLogs(this.handle,t))}getProgressLog(t){return new a(s().getProgressLog(this.handle,t))}getLogHandle(){return new a(s().getLogHandle(this.handle))}}const _="staging",O="main";function R(e){return typeof e=="object"&&e!==null&&"__awaited_futures__"in e}function b(e,t,n){if(t.has(n))return;if(t.add(n),typeof n==="object")if(R(n))n.__awaited_futures__.forEach(i=>e.add(i));else if(Array.isArray(n))for(const i of n)b(e,t,i);else for(const[,i]of Object.entries(n))i!==n&&b(e,t,i)}function gt(e){const t=new Set;return b(t,new Set,e),t}const dt=Object.freeze(Object.defineProperty({__proto__:null,MainAccessorName:O,StagingAccessorName:_,getAllFutureAwaits:gt,isFutureAwait:R},Symbol.toStringTag,{value:"Module"}));class S{constructor(){l(this,"ctx",s())}calculateOptions(t){return this.ctx.calculateOptions(t)}getDataFromResultPool(){const t=this.ctx.getDataFromResultPool();return{isComplete:t.isComplete,entries:t.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:new d(n.obj.data)}}))}}getDataWithErrorsFromResultPool(){const t=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:t.isComplete,entries:t.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:c.mapValueInVOE(n.obj.data,r=>new d(r))}}))}}getSpecsFromResultPool(){return this.ctx.getSpecsFromResultPool()}}class m{constructor(){l(this,"ctx");l(this,"args");l(this,"uiState");l(this,"resultPool",new S);this.ctx=s(),this.args=JSON.parse(this.ctx.args),this.uiState=this.ctx.uiState!==void 0?JSON.parse(this.ctx.uiState):void 0}getNamedAccessor(t){const n=this.ctx.getAccessorHandleByName(t);return n?new d(n):void 0}get prerun(){return this.getNamedAccessor(_)}get precalc(){return this.prerun}get stagingOutput(){return this.precalc}get outputs(){return this.getNamedAccessor(O)}get mainOutput(){return this.outputs}createPFrame(t){return this.ctx.createPFrame(t.map(n=>c.mapPObjectData(n,r=>r.handle)))}createPTable(t){var n;return"columns"in t?n={src:{type:"inner",entries:t.columns.map(r=>({type:"column",column:r}))},filters:t.filters??[],sorting:t.sorting??[]}:n=t,this.ctx.createPTable(c.mapPTableDef(n,r=>c.mapPObjectData(r,i=>i.handle)))}getBlockLabel(t){return this.ctx.getBlockLabel(t)}}const V="1.2.28";function pt(e){return typeof e=="string"}function ht(e){if(e.inputsValid!==void 0)return e;{if(e.canRun===void 0)throw new Error(`Malformed config, SDK version ${e.sdkVersion}`);const t={...e,inputsValid:e.canRun};return delete t.canRun,t}}class u{constructor(t,n,r,i,g){this._renderingMode=t,this._initialArgs=n,this._outputs=r,this._inputsValid=i,this._sections=g}static create(t="Heavy"){return new u(t,void 0,{},h(!0),h([]))}output(t,n){if(typeof n=="function"){const r=`output#${t}`;return y(r,()=>n(new m)),new u(this._renderingMode,this._initialArgs,{...this._outputs,[t]:r},this._inputsValid,this._sections)}else return new u(this._renderingMode,this._initialArgs,{...this._outputs,[t]:n},this._inputsValid,this._sections)}canRun(t){return this.inputsValid(t)}argsValid(t){return typeof t=="function"?(y("inputsValid",()=>t(new m)),new u(this._renderingMode,this._initialArgs,this._outputs,"inputsValid",this._sections)):new u(this._renderingMode,this._initialArgs,this._outputs,t,this._sections)}inputsValid(t){return this.argsValid(t)}sections(t){return Array.isArray(t)?this.sections(h(t)):typeof t=="function"?(y("sections",()=>t(new m)),new u(this._renderingMode,this._initialArgs,this._outputs,this._inputsValid,"sections")):new u(this._renderingMode,this._initialArgs,this._outputs,this._inputsValid,t)}initialArgs(t){return new u(this._renderingMode,t,this._outputs,this._inputsValid,this._sections)}done(){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const t={sdkVersion:V,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:this._inputsValid,sections:this._sections,outputs:this._outputs};return at()?ut(t):{config:t}}}class ft{constructor(t){this.handle=t}async findColumns(t){return await platforma.pFrameDriver.findColumns(this.handle,t)}async getColumnSpec(t){return await platforma.pFrameDriver.getColumnSpec(this.handle,t)}async listColumns(){return await platforma.pFrameDriver.listColumns(this.handle)}async calculateTableData(t){return await platforma.pFrameDriver.calculateTableData(this.handle,t)}async getUniqueValues(t){return await platforma.pFrameDriver.getUniqueValues(this.handle,t)}}function D(e){return A({__isRef:!0,blockId:f(e,"blockId"),name:f(e,"name")})}function mt(e){return A({ref:D(f(e,"ref")),label:f(e,"label")})}const yt={sdkVersion:V};exports.Args=E;exports.BlockModel=u;exports.CurrentSdkInfo=yt;exports.FutureRef=a;exports.It=k;exports.JsRenderInternal=dt;exports.MainOutputs=J;exports.OutputError=F;exports.PFrameImpl=ft;exports.RenderCtx=m;exports.ResultPool=S;exports.StagingOutputs=H;exports.TreeNodeAccessor=d;exports.UiState=M;exports.and=U;exports.flatten=T;exports.fromPlOption=mt;exports.fromPlRef=D;exports.getBlobContent=Y;exports.getBlobContentAsJson=tt;exports.getBlobContentAsString=Z;exports.getDownloadedBlobContent=et;exports.getFromCfg=p;exports.getImmediate=h;exports.getImportProgress=rt;exports.getJsonField=f;exports.getLastLogs=st;exports.getLogHandle=it;exports.getOnDemandBlobContent=nt;exports.getProgressLog=ot;exports.getResourceField=q;exports.getResourceValueAsJson=Q;exports.isEmpty=K;exports.isFunctionHandle=pt;exports.isolate=j;exports.makeArray=N;exports.makeObject=A;exports.mapArrayValues=$;exports.mapRecordValues=G;exports.mapResourceFields=X;exports.normalizeBlockConfig=ht;exports.not=z;exports.or=W;exports.readOutput=P;exports.wrapOutputs=L;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
|
|
1
|
+
"use strict";var x=Object.defineProperty;var E=(e,t,n)=>t in e?x(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var l=(e,t,n)=>E(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("@milaboratories/pl-model-common");class P extends Error{constructor(t,n){super(`${t.length}${n?"+":""} errors, first error: `+t[0]),this.errors=t,this.moreErrors=n}}function _(e){if(!e.ok)throw new P(e.errors,e.moreErrors);return e.value}function L(e){return new Proxy(e,{get(t,n){return _(t[n])}})}function o(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||e===null?h(e):e}function p(e){return{type:"GetFromCtx",variable:e}}function j(e){return{type:"Isolate",cfg:e}}const k=p("$args"),J=p("$it"),H=p("$prod"),M=p("$staging"),N=p("$ui");function h(e){return{type:"Immediate",value:e}}function C(e){const t={};for(const[n,r]of Object.entries(e))t[n]=o(r);return{type:"MakeObject",template:t}}function G(...e){const t=[];for(const n of e)t.push(o(n));return{type:"MakeArray",template:t}}function f(e,t){return{type:"GetJsonField",source:o(e),field:o(t)}}function $(e,t,n="$it"){return{type:"MapRecordValues",source:e,mapping:t,itVar:n}}function T(e,t,n="$it"){return{type:"MapArrayValues",source:e,mapping:t,itVar:n}}function K(e){return{type:"Flatten",source:e}}function z(e){return{type:"IsEmpty",arg:e}}function U(e){return{type:"Not",operand:e}}function W(e,t){return{type:"And",operand1:e,operand2:t}}function q(e,t){return{type:"Or",operand1:e,operand2:t}}function Q(e,t){return{type:"GetResourceField",source:o(e),field:o(t)}}function X(){return function(e){return{type:"GetResourceValueAsJson",source:o(e)}}}function Y(e,t,n="$it"){return{type:"MapResourceFields",source:e,mapping:t,itVar:n}}function Z(e){return{type:"GetBlobContent",source:o(e)}}function tt(e){return{type:"GetBlobContentAsString",source:o(e)}}function et(){return function(e){return{type:"GetBlobContentAsJson",source:o(e)}}}function nt(e){return{type:"GetDownloadedBlobContent",source:o(e)}}function rt(e){return{type:"GetOnDemandBlobContent",source:o(e)}}function st(e){return{type:"GetImportProgress",source:o(e)}}function ot(e,t){return{type:"GetLastLogs",source:o(e),lines:t}}function it(e,t){return{type:"GetProgressLog",source:o(e),patternToSearch:t}}function at(e){return{type:"GetLogHandle",source:o(e)}}function ut(){return typeof getPlatforma<"u"||typeof platforma<"u"}function lt(e){if(typeof getPlatforma=="function")return getPlatforma(e);if(typeof platforma<"u")return platforma;throw new Error("Can't get platforma instance.")}function ct(){if(typeof cfgRenderCtx<"u")return cfgRenderCtx}function s(){if(typeof cfgRenderCtx<"u")return cfgRenderCtx;throw new Error("Not in config rendering context")}function y(e,t){const n=ct();if(n===void 0)return!1;if(e in n.callbackRegistry)throw new Error(`Callback with key ${e} already registered.`);return n.callbackRegistry[e]=t,!0}const w=new Map;function gt(e,t){e in s().callbackRegistry||(s().callbackRegistry[e]=n=>{for(const r of w.get(e))r(n)},w.set(e,[])),w.get(e).push(t)}class a{constructor(t,n=r=>r){l(this,"isResolved",!1);l(this,"resolvedValue");this.handle=t,this.postProcess=n,gt(t,r=>{this.resolvedValue=n(r),this.isResolved=!0})}map(t){return new a(this.handle,n=>t(this.postProcess(n)))}mapDefined(t){return new a(this.handle,n=>{const r=this.postProcess(n);return r?t(r):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function F(e){return e===void 0?void 0:new d(e)}class d{constructor(t){this.handle=t}resolve(...t){return this.resolveWithCommon({},...t)}resolveWithCommon(t,...n){return F(s().resolveWithCommon(this.handle,t,...n))}get resourceType(){return s().getResourceType(this.handle)}getInputsLocked(){return s().getInputsLocked(this.handle)}getOutputsLocked(){return s().getOutputsLocked(this.handle)}getIsReadyOrError(){return s().getIsReadyOrError(this.handle)}getIsFinal(){return s().getIsFinal(this.handle)}getError(){return F(s().getError(this.handle))}listInputFields(){return s().listInputFields(this.handle)}listOutputFields(){return s().listOutputFields(this.handle)}listDynamicFields(){return s().listDynamicFields(this.handle)}getKeyValueBase64(t){return s().getKeyValueBase64(this.handle,t)}getKeyValueAsString(t){return s().getKeyValueAsString(this.handle,t)}getKeyValueAsJson(t){const n=this.getKeyValueAsString(t);if(n==null)throw new Error("Resource has no content.");return JSON.parse(n)}getDataBase64(){return s().getDataBase64(this.handle)}getDataAsString(){return s().getDataAsString(this.handle)}getDataAsJson(){const t=this.getDataAsString();if(t==null)throw new Error("Resource has no content.");return JSON.parse(t)}getPColumns(t=!1,n=""){const r=this.parsePObjectCollection(t,n);return r===void 0?void 0:Object.entries(r).map(([,g])=>{if(!c.isPColumn(g))throw new Error(`not a PColumn (kind = ${g.spec.kind})`);return g})}parsePObjectCollection(t=!1,n=""){const r=s().parsePObjectCollection(this.handle,t,n);if(r===void 0)return;const i={};for(const[g,I]of Object.entries(r))i[g]=c.mapPObjectData(I,B=>new d(B));return i}getFileContentAsBase64(){return new a(s().getBlobContentAsBase64(this.handle))}getFileContentAsString(){return new a(s().getBlobContentAsString(this.handle))}getFileContentAsJson(){return new a(s().getBlobContentAsString(this.handle)).mapDefined(t=>JSON.parse(t))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new a(s().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new a(s().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}getImportProgress(){return new a(s().getImportProgress(this.handle))}getLastLogs(t){return new a(s().getLastLogs(this.handle,t))}getProgressLog(t){return new a(s().getProgressLog(this.handle,t))}getLogHandle(){return new a(s().getLogHandle(this.handle))}}const O="staging",R="main";function S(e){return typeof e=="object"&&e!==null&&"__awaited_futures__"in e}function b(e,t,n){if(t.has(n))return;if(t.add(n),typeof n==="object")if(S(n))n.__awaited_futures__.forEach(i=>e.add(i));else if(Array.isArray(n))for(const i of n)b(e,t,i);else for(const[,i]of Object.entries(n))i!==n&&b(e,t,i)}function dt(e){const t=new Set;return b(t,new Set,e),t}const pt=Object.freeze(Object.defineProperty({__proto__:null,MainAccessorName:R,StagingAccessorName:O,getAllFutureAwaits:dt,isFutureAwait:S},Symbol.toStringTag,{value:"Module"}));class V{constructor(){l(this,"ctx",s())}calculateOptions(t){return this.ctx.calculateOptions(t)}getDataFromResultPool(){const t=this.ctx.getDataFromResultPool();return{isComplete:t.isComplete,entries:t.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:new d(n.obj.data)}}))}}getDataWithErrorsFromResultPool(){const t=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:t.isComplete,entries:t.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:c.mapValueInVOE(n.obj.data,r=>new d(r))}}))}}getSpecsFromResultPool(){return this.ctx.getSpecsFromResultPool()}}class m{constructor(){l(this,"ctx");l(this,"args");l(this,"uiState");l(this,"resultPool",new V);this.ctx=s(),this.args=JSON.parse(this.ctx.args),this.uiState=this.ctx.uiState!==void 0?JSON.parse(this.ctx.uiState):void 0}getNamedAccessor(t){const n=this.ctx.getAccessorHandleByName(t);return n?new d(n):void 0}get prerun(){return this.getNamedAccessor(O)}get precalc(){return this.prerun}get stagingOutput(){return this.precalc}get outputs(){return this.getNamedAccessor(R)}get mainOutput(){return this.outputs}createPFrame(t){return this.ctx.createPFrame(t.map(n=>c.mapPObjectData(n,r=>r.handle)))}createPTable(t){var n;return"columns"in t?n={src:{type:"inner",entries:t.columns.map(r=>({type:"column",column:r}))},filters:t.filters??[],sorting:t.sorting??[]}:n=t,this.ctx.createPTable(c.mapPTableDef(n,r=>c.mapPObjectData(r,i=>i.handle)))}getBlockLabel(t){return this.ctx.getBlockLabel(t)}}const v="1.2.29";function ht(e){return typeof e=="string"}function ft(e){if(e.inputsValid!==void 0)return e;{if(e.canRun===void 0)throw new Error(`Malformed config, SDK version ${e.sdkVersion}`);const t={...e,inputsValid:e.canRun};return delete t.canRun,t}}class u{constructor(t,n,r,i,g){this._renderingMode=t,this._initialArgs=n,this._outputs=r,this._inputsValid=i,this._sections=g}static create(t="Heavy"){return new u(t,void 0,{},h(!0),h([]))}output(t,n){if(typeof n=="function"){const r=`output#${t}`;return y(r,()=>n(new m)),new u(this._renderingMode,this._initialArgs,{...this._outputs,[t]:r},this._inputsValid,this._sections)}else return new u(this._renderingMode,this._initialArgs,{...this._outputs,[t]:n},this._inputsValid,this._sections)}canRun(t){return this.inputsValid(t)}argsValid(t){return typeof t=="function"?(y("inputsValid",()=>t(new m)),new u(this._renderingMode,this._initialArgs,this._outputs,"inputsValid",this._sections)):new u(this._renderingMode,this._initialArgs,this._outputs,t,this._sections)}inputsValid(t){return this.argsValid(t)}sections(t){return Array.isArray(t)?this.sections(h(t)):typeof t=="function"?(y("sections",()=>t(new m)),new u(this._renderingMode,this._initialArgs,this._outputs,this._inputsValid,"sections")):new u(this._renderingMode,this._initialArgs,this._outputs,this._inputsValid,t)}initialArgs(t){return new u(this._renderingMode,t,this._outputs,this._inputsValid,this._sections)}done(){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const t={sdkVersion:v,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:this._inputsValid,sections:this._sections,outputs:this._outputs};return ut()?lt(t):{config:t}}}class mt{constructor(t){this.handle=t}async findColumns(t){return await platforma.pFrameDriver.findColumns(this.handle,t)}async getColumnSpec(t){return await platforma.pFrameDriver.getColumnSpec(this.handle,t)}async listColumns(){return await platforma.pFrameDriver.listColumns(this.handle)}async calculateTableData(t){return await platforma.pFrameDriver.calculateTableData(this.handle,t)}async getUniqueValues(t){return await platforma.pFrameDriver.getUniqueValues(this.handle,t)}}function D(e){return C({__isRef:!0,blockId:f(e,"blockId"),name:f(e,"name")})}function yt(e){return C({ref:D(f(e,"ref")),label:f(e,"label")})}const wt={sdkVersion:v};function A(e){if(typeof A=="function")return A()}exports.Args=k;exports.BlockModel=u;exports.CurrentSdkInfo=wt;exports.FutureRef=a;exports.It=J;exports.JsRenderInternal=pt;exports.MainOutputs=H;exports.OutputError=P;exports.PFrameImpl=mt;exports.RenderCtx=m;exports.ResultPool=V;exports.StagingOutputs=M;exports.TreeNodeAccessor=d;exports.UiState=N;exports.and=W;exports.flatten=K;exports.fromPlOption=yt;exports.fromPlRef=D;exports.getBlobContent=Z;exports.getBlobContentAsJson=et;exports.getBlobContentAsString=tt;exports.getDownloadedBlobContent=nt;exports.getEnvironmentValue=A;exports.getFromCfg=p;exports.getImmediate=h;exports.getImportProgress=st;exports.getJsonField=f;exports.getLastLogs=ot;exports.getLogHandle=at;exports.getOnDemandBlobContent=rt;exports.getProgressLog=it;exports.getResourceField=Q;exports.getResourceValueAsJson=X;exports.isEmpty=z;exports.isFunctionHandle=ht;exports.isolate=j;exports.makeArray=G;exports.makeObject=C;exports.mapArrayValues=T;exports.mapRecordValues=$;exports.mapResourceFields=Y;exports.normalizeBlockConfig=ft;exports.not=U;exports.or=q;exports.readOutput=_;exports.wrapOutputs=L;Object.keys(c).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>c[e]})});
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/block_state_util.ts","../src/config/actions.ts","../src/internal.ts","../src/render/future.ts","../src/render/accessor.ts","../src/render/internal.ts","../src/render/api.ts","../src/version.ts","../src/builder.ts","../src/pframe.ts","../src/ref_util.ts","../src/sdk_info.ts"],"sourcesContent":["import { BlockOutputsBase, ValueOrErrors } from '@milaboratories/pl-model-common';\n\nexport class OutputError extends Error {\n constructor(\n public readonly errors: string[],\n public readonly moreErrors: boolean\n ) {\n super(`${errors.length}${moreErrors ? '+' : ''} errors, first error: ` + errors[0]);\n }\n}\n\nexport function readOutput<T>(outputValue: ValueOrErrors<T>): T {\n if (!outputValue.ok) throw new OutputError(outputValue.errors, outputValue.moreErrors);\n return outputValue.value;\n}\n\ntype ExtractValueType<V extends ValueOrErrors<unknown>> = Extract<V, { ok: true }>['value'];\ntype SimpleOutputs<Outputs extends BlockOutputsBase> = {\n [Key in keyof Outputs]: ExtractValueType<Outputs[Key]>;\n};\n\nexport function wrapOutputs<Outputs extends BlockOutputsBase>(\n outputs: Outputs\n): SimpleOutputs<Outputs> {\n return new Proxy(outputs, {\n get(target, key: string) {\n return readOutput(target[key]);\n }\n }) as SimpleOutputs<Outputs>;\n}\n","import {\n ActGetField,\n ActGetFromCtx,\n ActGetImmediate,\n ActGetResourceField,\n ActGetResourceValueAsJson,\n ActMakeObject,\n ActMapRecordValues,\n ActMapResourceFields,\n ActMapArrayValues,\n ActIsEmpty,\n ActNot,\n ActIsolate,\n ActGetBlobContentAsJson,\n ActGetBlobContentAsString,\n ActGetBlobContent,\n ActAnd,\n ActOr,\n ActMakeArray,\n ActFlatten,\n ActGetDownloadedBlobContent,\n ActGetOnDemandBlobContent,\n ActImportProgress,\n ActGetLastLogs,\n ActGetProgressLog,\n ActGetLogHandle\n} from './actions_kinds';\nimport { ExtractAction, POCExtractAction, PrimitiveOrConfig, TypedConfig } from './type_engine';\nimport { Cfg } from './model';\nimport { CheckedSyncConf } from './type_util';\n\n//\n// Helpers\n//\n\nfunction primitiveToConfig(value: PrimitiveOrConfig): TypedConfig {\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value === null\n )\n return getImmediate(value);\n else return value as TypedConfig;\n}\n\n//\n// Context\n//\n\nexport function getFromCfg<const V extends string>(variable: V): TypedConfig<ActGetFromCtx<V>> {\n return { type: 'GetFromCtx', variable } as Cfg as any;\n}\n\n//\n// Isolate\n//\n\nexport function isolate<const Config extends TypedConfig>(\n cfg: Config\n): TypedConfig<ActIsolate<ExtractAction<Config>>> {\n return {\n type: 'Isolate',\n cfg\n } as Cfg as any;\n}\n\n//\n// Well-known Context Vars\n//\n\nexport const Args = getFromCfg('$args');\nexport const It = getFromCfg('$it');\nexport const MainOutputs = getFromCfg('$prod');\nexport const StagingOutputs = getFromCfg('$staging');\nexport const UiState = getFromCfg('$ui');\n\n//\n// Json\n//\n\nexport function getImmediate<const T>(value: T): TypedConfig<ActGetImmediate<T>> {\n return { type: 'Immediate', value } as Cfg as any;\n}\n\nexport function makeObject<const T extends Record<string, PrimitiveOrConfig>>(\n template: T\n): TypedConfig<ActMakeObject<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {\n const normalizedTemplate: Record<string, TypedConfig> = {};\n for (const [k, cfg] of Object.entries(template)) normalizedTemplate[k] = primitiveToConfig(cfg);\n return {\n type: 'MakeObject',\n template: normalizedTemplate\n } as Cfg as any;\n}\n\nexport function makeArray<const T extends PrimitiveOrConfig[]>(\n ...template: T\n): TypedConfig<ActMakeArray<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {\n const normalizedTemplate: TypedConfig[] = [];\n for (const cfg of template) normalizedTemplate.push(primitiveToConfig(cfg));\n return {\n type: 'MakeArray',\n template: normalizedTemplate\n } as Cfg as any;\n}\n\nexport function getJsonField<\n const Source extends PrimitiveOrConfig,\n const Field extends PrimitiveOrConfig\n>(\n source: Source,\n field: Field\n): TypedConfig<ActGetField<POCExtractAction<Source>, POCExtractAction<Field>>> {\n return {\n type: 'GetJsonField',\n source: primitiveToConfig(source),\n field: primitiveToConfig(field)\n } as Cfg as any;\n}\n\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>,\n itVar: ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapRecordValues',\n source,\n mapping,\n itVar\n } as Cfg as any;\n}\n\nexport function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>,\n itVar: ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapArrayValues',\n source,\n mapping,\n itVar\n } as Cfg as any;\n}\n\nexport function flatten<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActFlatten<ExtractAction<Source>>> {\n return {\n type: 'Flatten',\n source\n } as Cfg as any;\n}\n\n//\n// Boolean\n//\n\nexport function isEmpty<const Arg extends TypedConfig>(\n arg: Arg\n): TypedConfig<ActIsEmpty<ExtractAction<Arg>>> {\n return {\n type: 'IsEmpty',\n arg\n } as Cfg as any;\n}\n\nexport function not<const Operand extends TypedConfig>(\n operand: Operand\n): TypedConfig<ActNot<ExtractAction<Operand>>> {\n return {\n type: 'Not',\n operand\n } as Cfg as any;\n}\n\nexport function and<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(\n operand1: Operand1,\n operand2: Operand2\n): TypedConfig<ActAnd<ExtractAction<Operand1>, ExtractAction<Operand2>>> {\n return {\n type: 'And',\n operand1,\n operand2\n } as Cfg as any;\n}\n\nexport function or<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(\n operand1: Operand1,\n operand2: Operand2\n): TypedConfig<ActOr<ExtractAction<Operand1>, ExtractAction<Operand2>>> {\n return {\n type: 'Or',\n operand1,\n operand2\n } as Cfg as any;\n}\n\n//\n// Resources\n//\n\nexport function getResourceField<\n const Source extends PrimitiveOrConfig,\n const Field extends PrimitiveOrConfig\n>(\n source: Source,\n field: Field\n): TypedConfig<ActGetResourceField<POCExtractAction<Source>, POCExtractAction<Field>>> {\n return {\n type: 'GetResourceField',\n source: primitiveToConfig(source),\n field: primitiveToConfig(field)\n } as Cfg as any;\n}\n\nexport function getResourceValueAsJson<T>() {\n return function <const Source extends PrimitiveOrConfig>(\n source: Source\n ): TypedConfig<ActGetResourceValueAsJson<POCExtractAction<Source>, T>> {\n return {\n type: 'GetResourceValueAsJson',\n source: primitiveToConfig(source)\n } as Cfg as any;\n };\n}\n\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source,\n mapping: Mapping\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapResourceFields',\n source,\n mapping,\n itVar\n } as Cfg as TypedConfig<\n ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>\n >;\n}\n\n//\n// Download Blobs\n//\n\nexport function getBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getBlobContentAsString<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetBlobContentAsString<ExtractAction<Source>>> {\n return {\n type: 'GetBlobContentAsString',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getBlobContentAsJson<T>() {\n return function <const Source extends TypedConfig>(\n source: Source\n ): TypedConfig<ActGetBlobContentAsJson<ExtractAction<Source>, T>> {\n return {\n type: 'GetBlobContentAsJson',\n source: primitiveToConfig(source)\n } as Cfg as any;\n };\n}\n\nexport function getDownloadedBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetDownloadedBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetDownloadedBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getOnDemandBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetOnDemandBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetOnDemandBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\n//\n// Upload Blobs\n//\n\nexport function getImportProgress<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActImportProgress<ExtractAction<Source>>> {\n return {\n type: 'GetImportProgress',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\n//\n// Logs\n//\n\nexport function getLastLogs<const Source extends TypedConfig>(\n source: Source,\n lines: number\n): TypedConfig<ActGetLastLogs<ExtractAction<Source>>> {\n return {\n type: 'GetLastLogs',\n source: primitiveToConfig(source),\n lines\n } as Cfg as any;\n}\n\nexport function getProgressLog<const Source extends TypedConfig>(\n source: Source,\n patternToSearch: string\n): TypedConfig<ActGetProgressLog<ExtractAction<Source>>> {\n return {\n type: 'GetProgressLog',\n source: primitiveToConfig(source),\n patternToSearch\n } as Cfg as any;\n}\n\nexport function getLogHandle<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetLogHandle<ExtractAction<Source>>> {\n return {\n type: 'GetLogHandle',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n","import { Platforma, PlatformaFactory } from './platforma';\nimport { BlockConfig } from './builder';\nimport { FutureHandle, GlobalCfgRenderCtx } from './render/internal';\n\ndeclare global {\n /** Global factory method returning platforma instance */\n const getPlatforma: PlatformaFactory;\n const platforma: Platforma;\n\n /** Global rendering context, present only in rendering environment */\n const cfgRenderCtx: GlobalCfgRenderCtx;\n}\n\n/** Utility code helping to identify whether the code is running in actual UI environment */\nexport function isInUI() {\n return typeof getPlatforma !== 'undefined' || typeof platforma !== 'undefined';\n}\n\n/** Utility code helping to retrieve a platforma instance form the environment */\nexport function getPlatformaInstance(config: BlockConfig): Platforma {\n if (typeof getPlatforma === 'function') return getPlatforma(config);\n else if (typeof platforma !== 'undefined') return platforma;\n else throw new Error(\"Can't get platforma instance.\");\n}\n\nexport function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {\n if (typeof cfgRenderCtx !== 'undefined') return cfgRenderCtx;\n else return undefined;\n}\n\nexport function getCfgRenderCtx(): GlobalCfgRenderCtx {\n if (typeof cfgRenderCtx !== 'undefined') return 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","import { FutureAwait, FutureHandle } from './internal';\nimport { registerFutureAwait } from '../internal';\n\nexport class FutureRef<T = unknown> {\n private isResolved = false;\n private resolvedValue?: T;\n\n constructor(\n private readonly handle: FutureHandle,\n private readonly postProcess: (value: unknown) => T = (v) => v as T\n ) {\n registerFutureAwait(handle, (value) => {\n this.resolvedValue = postProcess(value);\n this.isResolved = true;\n });\n }\n\n public map<R>(mapping: (v: T) => R): FutureRef<R> {\n return new FutureRef<R>(this.handle, (v) => mapping(this.postProcess(v)));\n }\n\n public mapDefined<R>(mapping: (v: NonNullable<T>) => R): FutureRef<R | undefined> {\n return new FutureRef<R | undefined>(this.handle, (v) => {\n const vv = this.postProcess(v);\n return vv ? mapping(vv) : undefined;\n });\n }\n\n toJSON(): any {\n return this.isResolved\n ? this.resolvedValue\n : ({ __awaited_futures__: [this.handle] } as FutureAwait);\n }\n}\n\nexport type ExtractFutureRefType<Ref extends FutureRef> =\n Ref extends FutureRef<infer T> ? T : never;\n","import {\n AnyLogHandle,\n ImportProgress,\n LocalBlobHandleAndSize,\n PColumn,\n PObject,\n RemoteBlobHandleAndSize,\n isPColumn,\n mapPObjectData\n} from '@milaboratories/pl-model-common';\nimport { getCfgRenderCtx } from '../internal';\nimport { FutureRef } from './future';\nimport { AccessorHandle } from './internal';\nimport { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';\n\nfunction ifDef<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined {\n return value === undefined ? undefined : cb(value);\n}\n\nfunction wrapBuffer(buf: ArrayBuffer | undefined): Uint8Array | undefined {\n return buf === undefined ? undefined : new Uint8Array(buf);\n}\n\nfunction wrapAccessor(handle: AccessorHandle | undefined): TreeNodeAccessor | undefined {\n return handle === undefined ? undefined : new TreeNodeAccessor(handle);\n}\n\n/** Represent resource tree node accessor */\nexport class TreeNodeAccessor {\n constructor(public readonly handle: AccessorHandle) {}\n\n public resolve(\n ...steps: [\n Omit<FieldTraversalStep, 'errorIfFieldNotSet'> & {\n errorIfFieldNotAssigned: true;\n }\n ]\n ): TreeNodeAccessor;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n return this.resolveWithCommon({}, ...steps);\n }\n\n public resolveWithCommon(\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): TreeNodeAccessor | undefined {\n return wrapAccessor(getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps));\n }\n\n public get resourceType(): ResourceType {\n return getCfgRenderCtx().getResourceType(this.handle);\n }\n\n public getInputsLocked(): boolean {\n return getCfgRenderCtx().getInputsLocked(this.handle);\n }\n\n public getOutputsLocked(): boolean {\n return getCfgRenderCtx().getOutputsLocked(this.handle);\n }\n\n public getIsReadyOrError(): boolean {\n return getCfgRenderCtx().getIsReadyOrError(this.handle);\n }\n\n public getIsFinal(): boolean {\n return getCfgRenderCtx().getIsFinal(this.handle);\n }\n\n public getError(): TreeNodeAccessor | undefined {\n return wrapAccessor(getCfgRenderCtx().getError(this.handle));\n }\n\n public listInputFields(): string[] {\n return getCfgRenderCtx().listInputFields(this.handle);\n }\n\n public listOutputFields(): string[] {\n return getCfgRenderCtx().listOutputFields(this.handle);\n }\n\n public listDynamicFields(): string[] {\n return getCfgRenderCtx().listDynamicFields(this.handle);\n }\n\n public getKeyValueBase64(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueBase64(this.handle, key);\n }\n\n public getKeyValueAsString(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueAsString(this.handle, key);\n }\n\n public getKeyValueAsJson<T>(key: string): T {\n const content = this.getKeyValueAsString(key);\n if (content == undefined) throw new Error('Resource has no content.');\n return JSON.parse(content);\n }\n\n public getDataBase64(): string | undefined {\n return getCfgRenderCtx().getDataBase64(this.handle);\n }\n\n public getDataAsString(): string | undefined {\n return getCfgRenderCtx().getDataAsString(this.handle);\n }\n\n public getDataAsJson<T>(): T {\n const content = this.getDataAsString();\n if (content == undefined) throw new Error('Resource has no content.');\n return JSON.parse(content);\n }\n\n /**\n *\n */\n public getPColumns(\n errorOnUnknownField: boolean = false,\n prefix: string = ''\n ): PColumn<TreeNodeAccessor>[] | undefined {\n const result = this.parsePObjectCollection(errorOnUnknownField, prefix);\n if (result === undefined) return undefined;\n\n const pf = Object.entries(result).map(([, obj]) => {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n });\n\n return pf;\n }\n\n /**\n *\n */\n public parsePObjectCollection(\n errorOnUnknownField: boolean = false,\n prefix: string = ''\n ): Record<string, PObject<TreeNodeAccessor>> | undefined {\n const pObjects = getCfgRenderCtx().parsePObjectCollection(\n this.handle,\n errorOnUnknownField,\n prefix\n );\n if (pObjects === undefined) return undefined;\n const result: Record<string, PObject<TreeNodeAccessor>> = {};\n for (const [key, value] of Object.entries(pObjects))\n result[key] = mapPObjectData(value, (c) => new TreeNodeAccessor(c));\n return result;\n }\n\n public getFileContentAsBase64(): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsBase64(this.handle));\n }\n\n public getFileContentAsString(): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle));\n }\n\n public getFileContentAsJson<T>(): FutureRef<T | undefined> {\n return new FutureRef<string | undefined>(\n getCfgRenderCtx().getBlobContentAsString(this.handle)\n ).mapDefined((v) => JSON.parse(v) as T);\n }\n\n /**\n * @deprecated use getFileContentAsBase64\n */\n public getBlobContentAsBase64(): FutureRef<string | undefined> {\n return this.getFileContentAsBase64();\n }\n\n /**\n * @deprecated use getFileContentAsString\n */\n public getBlobContentAsString(): FutureRef<string | undefined> {\n return this.getFileContentAsString();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getFileHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getFileHandle\n */\n public getDownloadedBlobHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return this.getFileHandle();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getRemoteFileHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getRemoteFileHandle\n */\n public getOnDemandBlobHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return this.getRemoteFileHandle();\n }\n\n public getImportProgress(): FutureRef<ImportProgress> {\n return new FutureRef(getCfgRenderCtx().getImportProgress(this.handle));\n }\n\n public getLastLogs(nLines: number): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getLastLogs(this.handle, nLines));\n }\n\n public getProgressLog(patternToSearch: string): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));\n }\n\n public getLogHandle(): FutureRef<AnyLogHandle | undefined> {\n return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));\n }\n}\n","import { Optional } from 'utility-types';\nimport { Branded } from '../branding';\nimport { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';\nimport {\n Option,\n PColumn,\n PFrameDef,\n PFrameHandle,\n PObject,\n PObjectSpec,\n PSpecPredicate,\n PTableDef,\n PTableHandle,\n ResultCollection,\n ValueOrError\n} from '@milaboratories/pl-model-common';\n\nexport const StagingAccessorName = 'staging';\nexport const MainAccessorName = 'main';\n\nexport type AccessorHandle = Branded<string, 'AccessorHandle'>;\nexport type FutureHandle = Branded<string, 'FutureHandle'>;\n\nexport interface GlobalCfgRenderCtxMethods<AHandle = AccessorHandle, FHandle = FutureHandle> {\n //\n // Root accessor creation\n //\n\n getAccessorHandleByName(name: string): AHandle | undefined;\n\n //\n // Basic resource accessor actions\n //\n\n resolveWithCommon(\n handle: AHandle,\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): AHandle | undefined;\n\n getResourceType(handle: AHandle): ResourceType;\n\n getInputsLocked(handle: AHandle): boolean;\n\n getOutputsLocked(handle: AHandle): boolean;\n\n getIsReadyOrError(handle: AHandle): boolean;\n\n getIsFinal(handle: AHandle): boolean;\n\n getError(handle: AHandle): AHandle | undefined;\n\n listInputFields(handle: AHandle): string[];\n\n listOutputFields(handle: AHandle): string[];\n\n listDynamicFields(handle: AHandle): string[];\n\n getKeyValueBase64(handle: AHandle, key: string): string | undefined;\n\n getKeyValueAsString(handle: AHandle, key: string): string | undefined;\n\n getDataBase64(handle: AHandle): string | undefined;\n\n getDataAsString(handle: AHandle): string | undefined;\n\n /** If not final returns undefined */\n parsePObjectCollection(\n handle: AHandle,\n errorOnUnknownField: boolean,\n prefix: string\n ): Record<string, PObject<AHandle>> | undefined;\n\n //\n // Blob\n //\n\n getBlobContentAsBase64(handle: AHandle): FHandle; // string | undefined\n\n getBlobContentAsString(handle: AHandle): FHandle; // string | undefined\n\n getDownloadedBlobContentHandle(handle: AHandle): FHandle; // LocalBlobHandleAndSize | undefined;\n\n getOnDemandBlobContentHandle(handle: AHandle): FHandle; // RemoteBlobHandleAndSize | undefined;\n\n //\n // Import progress\n //\n\n getImportProgress(handle: AHandle): FHandle; // ImportProgress;\n\n //\n // Logs\n //\n\n getLastLogs(handle: AHandle, nLines: number): FHandle; // string | undefined;\n\n getProgressLog(handle: AHandle, patternToSearch: string): FHandle; // string | undefined;\n\n getLogHandle(handle: AHandle): FHandle; // AnyLogHandle | undefined;\n\n //\n // Blocks\n //\n\n getBlockLabel(blockId: string): string;\n\n //\n // Result Pool\n //\n\n getDataFromResultPool(): ResultCollection<PObject<AHandle>>;\n\n getDataWithErrorsFromResultPool(): ResultCollection<\n Optional<PObject<ValueOrError<AHandle, string>>, 'id'>\n >;\n\n getSpecsFromResultPool(): ResultCollection<PObjectSpec>;\n\n calculateOptions(predicate: PSpecPredicate): Option[];\n\n //\n // PFrame / PTable\n //\n\n createPFrame(def: PFrameDef<AHandle>): PFrameHandle;\n\n createPTable(def: PTableDef<PColumn<AHandle>>): PTableHandle;\n}\n\nexport interface GlobalCfgRenderCtx extends GlobalCfgRenderCtxMethods {\n readonly args: string;\n readonly uiState?: string;\n readonly callbackRegistry: Record<string, Function>;\n}\n\nexport type FutureAwait = {\n __awaited_futures__: FutureHandle[];\n};\n\nexport function isFutureAwait(obj: unknown): obj is FutureAwait {\n return typeof obj === 'object' && obj !== null && '__awaited_futures__' in obj;\n}\n\nfunction addAllFutureAwaits(set: Set<string>, visited: Set<unknown>, node: unknown) {\n if (visited.has(node)) return;\n visited.add(node);\n\n const type = typeof node;\n if (type === 'object') {\n if (isFutureAwait(node)) node.__awaited_futures__.forEach((a) => set.add(a));\n else if (Array.isArray(node))\n for (const nested of node) addAllFutureAwaits(set, visited, nested);\n else\n for (const [, nested] of Object.entries(node as object))\n if (nested !== node) addAllFutureAwaits(set, visited, nested);\n }\n}\n\nexport function getAllFutureAwaits(obj: unknown): Set<string> {\n const set = new Set<string>();\n addAllFutureAwaits(set, new Set(), obj);\n return set;\n}\n","import {\n Option,\n PColumn,\n PFrameDef,\n PFrameHandle,\n PObject,\n PObjectSpec,\n PSpecPredicate,\n PTableDef,\n PTableHandle,\n PTableRecordFilter,\n PTableSorting,\n ResultCollection,\n ValueOrError,\n mapPObjectData,\n mapPTableDef,\n mapValueInVOE\n} from '@milaboratories/pl-model-common';\nimport { Optional } from 'utility-types';\nimport { getCfgRenderCtx } from '../internal';\nimport { TreeNodeAccessor } from './accessor';\nimport { FutureRef } from './future';\nimport { GlobalCfgRenderCtx, MainAccessorName, StagingAccessorName } from './internal';\n\nexport class ResultPool {\n private readonly ctx: GlobalCfgRenderCtx = getCfgRenderCtx();\n\n public calculateOptions(predicate: PSpecPredicate): Option[] {\n return this.ctx.calculateOptions(predicate);\n }\n\n public getDataFromResultPool(): ResultCollection<PObject<TreeNodeAccessor>> {\n const result = this.ctx.getDataFromResultPool();\n return {\n isComplete: result.isComplete,\n entries: result.entries.map((e) => ({\n ref: e.ref,\n obj: {\n ...e.obj,\n data: new TreeNodeAccessor(e.obj.data)\n }\n }))\n };\n }\n\n public getDataWithErrorsFromResultPool(): ResultCollection<\n Optional<PObject<ValueOrError<TreeNodeAccessor, string>>, 'id'>\n > {\n const result = this.ctx.getDataWithErrorsFromResultPool();\n return {\n isComplete: result.isComplete,\n entries: result.entries.map((e) => ({\n ref: e.ref,\n obj: {\n ...e.obj,\n data: mapValueInVOE(e.obj.data, (handle) => new TreeNodeAccessor(handle))\n }\n }))\n };\n }\n\n public getSpecsFromResultPool(): ResultCollection<PObjectSpec> {\n return this.ctx.getSpecsFromResultPool();\n }\n}\n\nexport class RenderCtx<Args, UiState> {\n private readonly ctx: GlobalCfgRenderCtx;\n\n public readonly args: Args;\n public readonly uiState: UiState | undefined;\n\n constructor() {\n this.ctx = getCfgRenderCtx();\n this.args = JSON.parse(this.ctx.args);\n this.uiState = this.ctx.uiState !== undefined ? JSON.parse(this.ctx.uiState) : undefined;\n }\n\n private getNamedAccessor(name: string): TreeNodeAccessor | undefined {\n const accessorId = this.ctx.getAccessorHandleByName(name);\n return accessorId ? new TreeNodeAccessor(accessorId) : undefined;\n }\n\n public get prerun(): TreeNodeAccessor | undefined {\n return this.getNamedAccessor(StagingAccessorName);\n }\n\n /**\n * @deprecated use prerun\n */\n public get precalc(): TreeNodeAccessor | undefined {\n return this.prerun;\n }\n\n /**\n * @deprecated use prerun\n */\n public get stagingOutput(): TreeNodeAccessor | undefined {\n return this.precalc;\n }\n\n public get outputs(): TreeNodeAccessor | undefined {\n return this.getNamedAccessor(MainAccessorName);\n }\n\n /**\n * @deprecated use outputs\n */\n public get mainOutput(): TreeNodeAccessor | undefined {\n return this.outputs;\n }\n\n public readonly resultPool = new ResultPool();\n\n public createPFrame(def: PFrameDef<TreeNodeAccessor>): PFrameHandle {\n return this.ctx.createPFrame(def.map((c) => mapPObjectData(c, (d) => d.handle)));\n }\n\n public createPTable(def: PTableDef<PColumn<TreeNodeAccessor>>): PTableHandle;\n public createPTable(def: {\n columns: PColumn<TreeNodeAccessor>[];\n filters?: PTableRecordFilter[];\n /** Table sorting */\n sorting?: PTableSorting[];\n }): PTableHandle;\n public createPTable(\n def:\n | PTableDef<PColumn<TreeNodeAccessor>>\n | {\n columns: PColumn<TreeNodeAccessor>[];\n filters?: PTableRecordFilter[];\n /** Table sorting */\n sorting?: PTableSorting[];\n }\n ): PTableHandle {\n var rawDef: PTableDef<PColumn<TreeNodeAccessor>>;\n if ('columns' in def) {\n rawDef = {\n src: {\n type: 'inner',\n entries: def.columns.map((c) => ({ type: 'column', column: c }))\n },\n filters: def.filters ?? [],\n sorting: def.sorting ?? []\n };\n } else {\n rawDef = def;\n }\n return this.ctx.createPTable(mapPTableDef(rawDef, (po) => mapPObjectData(po, (d) => d.handle)));\n }\n\n public getBlockLabel(blockId: string): string {\n return this.ctx.getBlockLabel(blockId);\n }\n}\n\nexport type RenderFunction<Args = unknown, UiState = unknown, Ret = unknown> = (\n rCtx: RenderCtx<Args, UiState>\n) => Ret;\n\nexport type UnwrapFutureRef<K> =\n K extends FutureRef<infer T>\n ? T\n : K extends bigint | boolean | null | number | string | symbol | undefined\n ? K\n : { [key in keyof K]: UnwrapFutureRef<K[key]> };\n\nexport type InferRenderFunctionReturn<RF extends Function> = RF extends (...args: any) => infer R\n ? UnwrapFutureRef<R>\n : never;\n","export const PlatformaSDKVersion = '1.2.28';\n","import { BlockRenderingMode, BlockSection, ValueOrErrors } from '@milaboratories/pl-model-common';\nimport { Checked, ConfigResult, getImmediate, PlResourceEntry, TypedConfig } from './config';\nimport { getPlatformaInstance, isInUI, tryRegisterCallback } from './internal';\nimport { Platforma } from './platforma';\nimport { InferRenderFunctionReturn, RenderCtx, RenderFunction } from './render';\nimport { PlatformaSDKVersion } from './version';\n\ntype StdCtxArgsOnly<Args, UiState = undefined> = {\n readonly $blockId: string;\n readonly $args: Args;\n readonly $ui: UiState;\n};\n\nexport type StdCtx<Args, UiState = undefined> = StdCtxArgsOnly<Args, UiState> & {\n readonly $prod: PlResourceEntry;\n readonly $staging: PlResourceEntry;\n};\n\nexport type ResolveCfgType<Cfg extends TypedConfig, Args, UiState = undefined> = ConfigResult<\n Cfg,\n StdCtx<Args, UiState>\n>;\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 SectionsRFChecked<RF extends Function> = Checked<\n RF,\n InferRenderFunctionReturn<RF> 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 InputsValidRFChecked<RF extends Function> = Checked<\n RF,\n InferRenderFunctionReturn<RF> extends InputsValidExpectedType ? true : false\n>;\n\nexport type Code = {\n type: 'plain';\n content: string;\n};\n\n/** Field key to attach ConfAction information to a config type. */\ndeclare const __function_handle__: unique symbol;\n\n/** Creates branded Cfg type */\nexport type FunctionHandle<Return = unknown> = string & { [__function_handle__]: Return };\n\nexport type ExtractFunctionHandleReturn<Func extends FunctionHandle> =\n Func[typeof __function_handle__];\n\nexport type TypedConfigOrFunctionHandle = TypedConfig | FunctionHandle;\n\nexport function isFunctionHandle(cfgOrFh: TypedConfigOrFunctionHandle): cfgOrFh is FunctionHandle {\n return typeof cfgOrFh === 'string';\n}\n\ntype OnlyString<S> = S extends string ? S : '';\n\n// prettier-ignore\nexport type DeriveHref<S> = S extends readonly BlockSection[]\n ? OnlyString<Extract<S[number], { type: 'link' }>['href']>\n : never;\n\n/** This structure is rendered from the configuration, type can accommodate any\n * version of config structure. */\nexport type BlockConfigUniversal<\n Args = unknown,\n Outputs extends Record<string, TypedConfigOrFunctionHandle> = Record<\n string,\n TypedConfigOrFunctionHandle\n >\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** @deprecated */\n readonly canRun?: TypedConfigOrFunctionHandle;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n * */\n readonly inputsValid?: TypedConfigOrFunctionHandle;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: TypedConfigOrFunctionHandle;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n};\n\n/** This structure is rendered from the configuration */\nexport type BlockConfig<\n Args = unknown,\n Outputs extends Record<string, TypedConfigOrFunctionHandle> = Record<\n string,\n TypedConfigOrFunctionHandle\n >\n> = Required<Omit<BlockConfigUniversal<Args, Outputs>, 'canRun' | 'code'>> &\n Pick<BlockConfigUniversal<Args, Outputs>, 'code'>;\n\n/** Takes universal config, and converts it into latest structure */\nexport function normalizeBlockConfig<\n Args,\n Outputs extends Record<string, TypedConfigOrFunctionHandle>\n>(cfg: BlockConfigUniversal<Args, Outputs>): BlockConfig<Args, Outputs> {\n if (cfg.inputsValid !== undefined) return cfg as BlockConfig<Args, Outputs>;\n else {\n if (cfg.canRun === undefined)\n throw new Error(`Malformed config, SDK version ${cfg.sdkVersion}`);\n const latest = { ...cfg, inputsValid: cfg.canRun };\n delete latest['canRun'];\n return latest;\n }\n}\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, TypedConfigOrFunctionHandle>,\n UiState,\n Href extends `/${string}` = '/'\n> {\n private constructor(\n private readonly _renderingMode: BlockRenderingMode,\n private readonly _initialArgs: Args | undefined,\n private readonly _outputs: OutputsCfg,\n private readonly _inputsValid: TypedConfigOrFunctionHandle,\n private readonly _sections: TypedConfigOrFunctionHandle\n ) { }\n\n /** Initiates configuration builder */\n public static create<Args, UiState = undefined>(\n renderingMode: BlockRenderingMode = 'Heavy'\n ): BlockModel<Args, {}, UiState> {\n return new BlockModel<Args, {}, UiState>(\n renderingMode,\n undefined,\n {},\n getImmediate(true),\n getImmediate([])\n );\n }\n\n /**\n * Add output cell to the configuration\n *\n * @param key cell name, that can be used to retrieve the rendered value\n * @param cfg configuration describing how to render cell value from the blocks\n * workflow outputs\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 public output<const Key extends string, const RF extends RenderFunction<Args, UiState>>(\n key: Key,\n rf: RF\n ): BlockModel<\n Args,\n OutputsCfg & { [K in Key]: FunctionHandle<InferRenderFunctionReturn<RF>> },\n UiState,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n if (typeof cfgOrRf === 'function') {\n const functionHandle = `output#${key}` as FunctionHandle;\n tryRegisterCallback(functionHandle, () => cfgOrRf(new RenderCtx()));\n return new BlockModel(\n this._renderingMode,\n this._initialArgs,\n {\n ...this._outputs,\n [key]: functionHandle\n },\n this._inputsValid,\n this._sections\n );\n } else\n return new BlockModel(\n this._renderingMode,\n this._initialArgs,\n {\n ...this._outputs,\n [key]: cfgOrRf\n },\n this._inputsValid,\n this._sections\n );\n }\n\n /** @deprecated */\n public canRun<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return this.inputsValid(cfg as any);\n }\n\n /** Sets custom configuration predicate on the block args at which block can be executed */\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 RenderFunction<Args, UiState, boolean>>(\n rf: RF\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public argsValid(\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (typeof cfgOrRf === 'function') {\n tryRegisterCallback('inputsValid', () => cfgOrRf(new RenderCtx()));\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n 'inputsValid' as FunctionHandle,\n this._sections\n );\n } else\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n cfgOrRf,\n this._sections\n );\n }\n\n /** @deprecated use argsValid() */\n public inputsValid<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n /** @deprecated use argsValid() */\n public inputsValid<RF extends RenderFunction<Args, UiState, boolean>>(\n rf: RF\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public inputsValid(\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n return this.argsValid(cfgOrRf as any);\n }\n\n /** Sets the config to generate list of section in the left block overviews panel */\n public sections<const S extends SectionsExpectedType,>(rf: S): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunction<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 | Function\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 RenderCtx()));\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n this._inputsValid,\n 'sections' as FunctionHandle\n );\n } else\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n this._inputsValid,\n arrOrCfgOrRf as TypedConfig\n );\n }\n\n\n /** Sets initial args for the block, this value must be specified. */\n public initialArgs(value: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>(\n this._renderingMode,\n value,\n this._outputs,\n this._inputsValid,\n this._sections\n );\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(): Platforma<\n Args,\n InferOutputsFromConfigs<Args, OutputsCfg, UiState>,\n UiState,\n Href\n > {\n if (this._initialArgs === undefined) throw new Error('Initial arguments not set.');\n\n const config: BlockConfig<Args, OutputsCfg> = {\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this._renderingMode,\n initialArgs: this._initialArgs,\n inputsValid: this._inputsValid,\n sections: this._sections,\n outputs: this._outputs\n };\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 return getPlatformaInstance(config) as any;\n }\n}\n\nexport type InferOutputType<CfgOrFH, Args, UiState> = CfgOrFH extends TypedConfig\n ? ResolveCfgType<CfgOrFH, Args, UiState>\n : CfgOrFH extends FunctionHandle\n ? ExtractFunctionHandleReturn<CfgOrFH>\n : never;\n\ntype InferOutputsFromConfigs<\n Args,\n OutputsCfg extends Record<string, TypedConfigOrFunctionHandle>,\n UiState\n> = {\n [Key in keyof OutputsCfg]: ValueOrErrors<InferOutputType<OutputsCfg[Key], Args, UiState>>;\n};\n","import {\n CalculateTableDataRequest,\n CalculateTableDataResponse,\n FindColumnsRequest,\n FindColumnsResponse,\n PColumnIdAndSpec,\n PColumnSpec,\n PFrame,\n PFrameHandle,\n PObjectId,\n UniqueValuesRequest,\n UniqueValuesResponse\n} from '@milaboratories/pl-model-common';\n\nexport class PFrameImpl implements PFrame {\n constructor(private readonly handle: PFrameHandle) {}\n\n public async findColumns(request: FindColumnsRequest): Promise<FindColumnsResponse> {\n return await platforma.pFrameDriver.findColumns(this.handle, request);\n }\n\n public async getColumnSpec(columnId: PObjectId): Promise<PColumnSpec> {\n return await platforma.pFrameDriver.getColumnSpec(this.handle, columnId);\n }\n\n public async listColumns(): Promise<PColumnIdAndSpec[]> {\n return await platforma.pFrameDriver.listColumns(this.handle);\n }\n\n public async calculateTableData(\n request: CalculateTableDataRequest<PObjectId>\n ): Promise<CalculateTableDataResponse> {\n return await platforma.pFrameDriver.calculateTableData(this.handle, request);\n }\n\n public async getUniqueValues(request: UniqueValuesRequest): Promise<UniqueValuesResponse> {\n return await platforma.pFrameDriver.getUniqueValues(this.handle, request);\n }\n}\n","import { getJsonField, makeObject, TypedConfig } from './config';\n\nexport function fromPlRef<Source extends TypedConfig>(source: Source) {\n return makeObject({\n __isRef: true,\n blockId: getJsonField(source, 'blockId'),\n name: getJsonField(source, 'name')\n });\n}\n\nexport function fromPlOption<Source extends TypedConfig>(source: Source) {\n return makeObject({\n ref: fromPlRef(getJsonField(source, 'ref')),\n label: getJsonField(source, 'label')\n });\n}\n","import { PlatformaSDKVersion } from './version';\n\nexport type SdkInfo = {\n readonly sdkVersion: string;\n};\n\nexport const CurrentSdkInfo: SdkInfo = {\n sdkVersion: PlatformaSDKVersion\n};\n"],"names":["OutputError","errors","moreErrors","readOutput","outputValue","wrapOutputs","outputs","target","key","primitiveToConfig","value","getImmediate","getFromCfg","variable","isolate","cfg","Args","It","MainOutputs","StagingOutputs","UiState","makeObject","template","normalizedTemplate","k","makeArray","getJsonField","source","field","mapRecordValues","mapping","itVar","mapArrayValues","flatten","isEmpty","arg","not","operand","and","operand1","operand2","or","getResourceField","getResourceValueAsJson","mapResourceFields","getBlobContent","getBlobContentAsString","getBlobContentAsJson","getDownloadedBlobContent","getOnDemandBlobContent","getImportProgress","getLastLogs","lines","getProgressLog","patternToSearch","getLogHandle","isInUI","getPlatformaInstance","config","tryGetCfgRenderCtx","getCfgRenderCtx","tryRegisterCallback","callback","ctx","futureResolves","registerFutureAwait","handle","onResolve","res","FutureRef","postProcess","v","__publicField","vv","wrapAccessor","TreeNodeAccessor","steps","commonOptions","content","errorOnUnknownField","prefix","result","obj","isPColumn","pObjects","mapPObjectData","c","nLines","StagingAccessorName","MainAccessorName","isFutureAwait","addAllFutureAwaits","set","visited","node","a","nested","getAllFutureAwaits","ResultPool","predicate","e","mapValueInVOE","RenderCtx","name","accessorId","def","d","rawDef","mapPTableDef","po","blockId","PlatformaSDKVersion","isFunctionHandle","cfgOrFh","normalizeBlockConfig","latest","BlockModel","_renderingMode","_initialArgs","_outputs","_inputsValid","_sections","renderingMode","cfgOrRf","functionHandle","arrOrCfgOrRf","PFrameImpl","request","columnId","fromPlRef","fromPlOption","CurrentSdkInfo"],"mappings":"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GAA0B,CACrC,WAAYpB,CACd"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/block_state_util.ts","../src/config/actions.ts","../src/internal.ts","../src/render/future.ts","../src/render/accessor.ts","../src/render/internal.ts","../src/render/api.ts","../src/version.ts","../src/builder.ts","../src/pframe.ts","../src/ref_util.ts","../src/sdk_info.ts","../src/env_value.ts"],"sourcesContent":["import { BlockOutputsBase, ValueOrErrors } from '@milaboratories/pl-model-common';\n\nexport class OutputError extends Error {\n constructor(\n public readonly errors: string[],\n public readonly moreErrors: boolean\n ) {\n super(`${errors.length}${moreErrors ? '+' : ''} errors, first error: ` + errors[0]);\n }\n}\n\nexport function readOutput<T>(outputValue: ValueOrErrors<T>): T {\n if (!outputValue.ok) throw new OutputError(outputValue.errors, outputValue.moreErrors);\n return outputValue.value;\n}\n\ntype ExtractValueType<V extends ValueOrErrors<unknown>> = Extract<V, { ok: true }>['value'];\ntype SimpleOutputs<Outputs extends BlockOutputsBase> = {\n [Key in keyof Outputs]: ExtractValueType<Outputs[Key]>;\n};\n\nexport function wrapOutputs<Outputs extends BlockOutputsBase>(\n outputs: Outputs\n): SimpleOutputs<Outputs> {\n return new Proxy(outputs, {\n get(target, key: string) {\n return readOutput(target[key]);\n }\n }) as SimpleOutputs<Outputs>;\n}\n","import {\n ActGetField,\n ActGetFromCtx,\n ActGetImmediate,\n ActGetResourceField,\n ActGetResourceValueAsJson,\n ActMakeObject,\n ActMapRecordValues,\n ActMapResourceFields,\n ActMapArrayValues,\n ActIsEmpty,\n ActNot,\n ActIsolate,\n ActGetBlobContentAsJson,\n ActGetBlobContentAsString,\n ActGetBlobContent,\n ActAnd,\n ActOr,\n ActMakeArray,\n ActFlatten,\n ActGetDownloadedBlobContent,\n ActGetOnDemandBlobContent,\n ActImportProgress,\n ActGetLastLogs,\n ActGetProgressLog,\n ActGetLogHandle\n} from './actions_kinds';\nimport { ExtractAction, POCExtractAction, PrimitiveOrConfig, TypedConfig } from './type_engine';\nimport { Cfg } from './model';\nimport { CheckedSyncConf } from './type_util';\n\n//\n// Helpers\n//\n\nfunction primitiveToConfig(value: PrimitiveOrConfig): TypedConfig {\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value === null\n )\n return getImmediate(value);\n else return value as TypedConfig;\n}\n\n//\n// Context\n//\n\nexport function getFromCfg<const V extends string>(variable: V): TypedConfig<ActGetFromCtx<V>> {\n return { type: 'GetFromCtx', variable } as Cfg as any;\n}\n\n//\n// Isolate\n//\n\nexport function isolate<const Config extends TypedConfig>(\n cfg: Config\n): TypedConfig<ActIsolate<ExtractAction<Config>>> {\n return {\n type: 'Isolate',\n cfg\n } as Cfg as any;\n}\n\n//\n// Well-known Context Vars\n//\n\nexport const Args = getFromCfg('$args');\nexport const It = getFromCfg('$it');\nexport const MainOutputs = getFromCfg('$prod');\nexport const StagingOutputs = getFromCfg('$staging');\nexport const UiState = getFromCfg('$ui');\n\n//\n// Json\n//\n\nexport function getImmediate<const T>(value: T): TypedConfig<ActGetImmediate<T>> {\n return { type: 'Immediate', value } as Cfg as any;\n}\n\nexport function makeObject<const T extends Record<string, PrimitiveOrConfig>>(\n template: T\n): TypedConfig<ActMakeObject<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {\n const normalizedTemplate: Record<string, TypedConfig> = {};\n for (const [k, cfg] of Object.entries(template)) normalizedTemplate[k] = primitiveToConfig(cfg);\n return {\n type: 'MakeObject',\n template: normalizedTemplate\n } as Cfg as any;\n}\n\nexport function makeArray<const T extends PrimitiveOrConfig[]>(\n ...template: T\n): TypedConfig<ActMakeArray<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {\n const normalizedTemplate: TypedConfig[] = [];\n for (const cfg of template) normalizedTemplate.push(primitiveToConfig(cfg));\n return {\n type: 'MakeArray',\n template: normalizedTemplate\n } as Cfg as any;\n}\n\nexport function getJsonField<\n const Source extends PrimitiveOrConfig,\n const Field extends PrimitiveOrConfig\n>(\n source: Source,\n field: Field\n): TypedConfig<ActGetField<POCExtractAction<Source>, POCExtractAction<Field>>> {\n return {\n type: 'GetJsonField',\n source: primitiveToConfig(source),\n field: primitiveToConfig(field)\n } as Cfg as any;\n}\n\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>,\n itVar: ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapRecordValues',\n source,\n mapping,\n itVar\n } as Cfg as any;\n}\n\nexport function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>,\n itVar: ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapArrayValues',\n source,\n mapping,\n itVar\n } as Cfg as any;\n}\n\nexport function flatten<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActFlatten<ExtractAction<Source>>> {\n return {\n type: 'Flatten',\n source\n } as Cfg as any;\n}\n\n//\n// Boolean\n//\n\nexport function isEmpty<const Arg extends TypedConfig>(\n arg: Arg\n): TypedConfig<ActIsEmpty<ExtractAction<Arg>>> {\n return {\n type: 'IsEmpty',\n arg\n } as Cfg as any;\n}\n\nexport function not<const Operand extends TypedConfig>(\n operand: Operand\n): TypedConfig<ActNot<ExtractAction<Operand>>> {\n return {\n type: 'Not',\n operand\n } as Cfg as any;\n}\n\nexport function and<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(\n operand1: Operand1,\n operand2: Operand2\n): TypedConfig<ActAnd<ExtractAction<Operand1>, ExtractAction<Operand2>>> {\n return {\n type: 'And',\n operand1,\n operand2\n } as Cfg as any;\n}\n\nexport function or<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(\n operand1: Operand1,\n operand2: Operand2\n): TypedConfig<ActOr<ExtractAction<Operand1>, ExtractAction<Operand2>>> {\n return {\n type: 'Or',\n operand1,\n operand2\n } as Cfg as any;\n}\n\n//\n// Resources\n//\n\nexport function getResourceField<\n const Source extends PrimitiveOrConfig,\n const Field extends PrimitiveOrConfig\n>(\n source: Source,\n field: Field\n): TypedConfig<ActGetResourceField<POCExtractAction<Source>, POCExtractAction<Field>>> {\n return {\n type: 'GetResourceField',\n source: primitiveToConfig(source),\n field: primitiveToConfig(field)\n } as Cfg as any;\n}\n\nexport function getResourceValueAsJson<T>() {\n return function <const Source extends PrimitiveOrConfig>(\n source: Source\n ): TypedConfig<ActGetResourceValueAsJson<POCExtractAction<Source>, T>> {\n return {\n type: 'GetResourceValueAsJson',\n source: primitiveToConfig(source)\n } as Cfg as any;\n };\n}\n\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source,\n mapping: Mapping\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapResourceFields',\n source,\n mapping,\n itVar\n } as Cfg as TypedConfig<\n ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>\n >;\n}\n\n//\n// Download Blobs\n//\n\nexport function getBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getBlobContentAsString<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetBlobContentAsString<ExtractAction<Source>>> {\n return {\n type: 'GetBlobContentAsString',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getBlobContentAsJson<T>() {\n return function <const Source extends TypedConfig>(\n source: Source\n ): TypedConfig<ActGetBlobContentAsJson<ExtractAction<Source>, T>> {\n return {\n type: 'GetBlobContentAsJson',\n source: primitiveToConfig(source)\n } as Cfg as any;\n };\n}\n\nexport function getDownloadedBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetDownloadedBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetDownloadedBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getOnDemandBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetOnDemandBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetOnDemandBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\n//\n// Upload Blobs\n//\n\nexport function getImportProgress<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActImportProgress<ExtractAction<Source>>> {\n return {\n type: 'GetImportProgress',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\n//\n// Logs\n//\n\nexport function getLastLogs<const Source extends TypedConfig>(\n source: Source,\n lines: number\n): TypedConfig<ActGetLastLogs<ExtractAction<Source>>> {\n return {\n type: 'GetLastLogs',\n source: primitiveToConfig(source),\n lines\n } as Cfg as any;\n}\n\nexport function getProgressLog<const Source extends TypedConfig>(\n source: Source,\n patternToSearch: string\n): TypedConfig<ActGetProgressLog<ExtractAction<Source>>> {\n return {\n type: 'GetProgressLog',\n source: primitiveToConfig(source),\n patternToSearch\n } as Cfg as any;\n}\n\nexport function getLogHandle<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetLogHandle<ExtractAction<Source>>> {\n return {\n type: 'GetLogHandle',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n","import { Platforma, PlatformaFactory } from './platforma';\nimport { BlockConfig } from './builder';\nimport { FutureHandle, GlobalCfgRenderCtx } from './render/internal';\n\ndeclare global {\n /** Global factory method returning platforma instance */\n const getPlatforma: PlatformaFactory;\n const platforma: Platforma;\n\n /** Global rendering context, present only in rendering environment */\n const cfgRenderCtx: GlobalCfgRenderCtx;\n}\n\n/** Utility code helping to identify whether the code is running in actual UI environment */\nexport function isInUI() {\n return typeof getPlatforma !== 'undefined' || typeof platforma !== 'undefined';\n}\n\n/** Utility code helping to retrieve a platforma instance form the environment */\nexport function getPlatformaInstance(config: BlockConfig): Platforma {\n if (typeof getPlatforma === 'function') return getPlatforma(config);\n else if (typeof platforma !== 'undefined') return platforma;\n else throw new Error(\"Can't get platforma instance.\");\n}\n\nexport function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {\n if (typeof cfgRenderCtx !== 'undefined') return cfgRenderCtx;\n else return undefined;\n}\n\nexport function getCfgRenderCtx(): GlobalCfgRenderCtx {\n if (typeof cfgRenderCtx !== 'undefined') return 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","import { FutureAwait, FutureHandle } from './internal';\nimport { registerFutureAwait } from '../internal';\n\nexport class FutureRef<T = unknown> {\n private isResolved = false;\n private resolvedValue?: T;\n\n constructor(\n private readonly handle: FutureHandle,\n private readonly postProcess: (value: unknown) => T = (v) => v as T\n ) {\n registerFutureAwait(handle, (value) => {\n this.resolvedValue = postProcess(value);\n this.isResolved = true;\n });\n }\n\n public map<R>(mapping: (v: T) => R): FutureRef<R> {\n return new FutureRef<R>(this.handle, (v) => mapping(this.postProcess(v)));\n }\n\n public mapDefined<R>(mapping: (v: NonNullable<T>) => R): FutureRef<R | undefined> {\n return new FutureRef<R | undefined>(this.handle, (v) => {\n const vv = this.postProcess(v);\n return vv ? mapping(vv) : undefined;\n });\n }\n\n toJSON(): any {\n return this.isResolved\n ? this.resolvedValue\n : ({ __awaited_futures__: [this.handle] } as FutureAwait);\n }\n}\n\nexport type ExtractFutureRefType<Ref extends FutureRef> =\n Ref extends FutureRef<infer T> ? T : never;\n","import {\n AnyLogHandle,\n ImportProgress,\n LocalBlobHandleAndSize,\n PColumn,\n PObject,\n RemoteBlobHandleAndSize,\n isPColumn,\n mapPObjectData\n} from '@milaboratories/pl-model-common';\nimport { getCfgRenderCtx } from '../internal';\nimport { FutureRef } from './future';\nimport { AccessorHandle } from './internal';\nimport { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';\n\nfunction ifDef<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined {\n return value === undefined ? undefined : cb(value);\n}\n\nfunction wrapBuffer(buf: ArrayBuffer | undefined): Uint8Array | undefined {\n return buf === undefined ? undefined : new Uint8Array(buf);\n}\n\nfunction wrapAccessor(handle: AccessorHandle | undefined): TreeNodeAccessor | undefined {\n return handle === undefined ? undefined : new TreeNodeAccessor(handle);\n}\n\n/** Represent resource tree node accessor */\nexport class TreeNodeAccessor {\n constructor(public readonly handle: AccessorHandle) {}\n\n public resolve(\n ...steps: [\n Omit<FieldTraversalStep, 'errorIfFieldNotSet'> & {\n errorIfFieldNotAssigned: true;\n }\n ]\n ): TreeNodeAccessor;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n return this.resolveWithCommon({}, ...steps);\n }\n\n public resolveWithCommon(\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): TreeNodeAccessor | undefined {\n return wrapAccessor(getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps));\n }\n\n public get resourceType(): ResourceType {\n return getCfgRenderCtx().getResourceType(this.handle);\n }\n\n public getInputsLocked(): boolean {\n return getCfgRenderCtx().getInputsLocked(this.handle);\n }\n\n public getOutputsLocked(): boolean {\n return getCfgRenderCtx().getOutputsLocked(this.handle);\n }\n\n public getIsReadyOrError(): boolean {\n return getCfgRenderCtx().getIsReadyOrError(this.handle);\n }\n\n public getIsFinal(): boolean {\n return getCfgRenderCtx().getIsFinal(this.handle);\n }\n\n public getError(): TreeNodeAccessor | undefined {\n return wrapAccessor(getCfgRenderCtx().getError(this.handle));\n }\n\n public listInputFields(): string[] {\n return getCfgRenderCtx().listInputFields(this.handle);\n }\n\n public listOutputFields(): string[] {\n return getCfgRenderCtx().listOutputFields(this.handle);\n }\n\n public listDynamicFields(): string[] {\n return getCfgRenderCtx().listDynamicFields(this.handle);\n }\n\n public getKeyValueBase64(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueBase64(this.handle, key);\n }\n\n public getKeyValueAsString(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueAsString(this.handle, key);\n }\n\n public getKeyValueAsJson<T>(key: string): T {\n const content = this.getKeyValueAsString(key);\n if (content == undefined) throw new Error('Resource has no content.');\n return JSON.parse(content);\n }\n\n public getDataBase64(): string | undefined {\n return getCfgRenderCtx().getDataBase64(this.handle);\n }\n\n public getDataAsString(): string | undefined {\n return getCfgRenderCtx().getDataAsString(this.handle);\n }\n\n public getDataAsJson<T>(): T {\n const content = this.getDataAsString();\n if (content == undefined) throw new Error('Resource has no content.');\n return JSON.parse(content);\n }\n\n /**\n *\n */\n public getPColumns(\n errorOnUnknownField: boolean = false,\n prefix: string = ''\n ): PColumn<TreeNodeAccessor>[] | undefined {\n const result = this.parsePObjectCollection(errorOnUnknownField, prefix);\n if (result === undefined) return undefined;\n\n const pf = Object.entries(result).map(([, obj]) => {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n });\n\n return pf;\n }\n\n /**\n *\n */\n public parsePObjectCollection(\n errorOnUnknownField: boolean = false,\n prefix: string = ''\n ): Record<string, PObject<TreeNodeAccessor>> | undefined {\n const pObjects = getCfgRenderCtx().parsePObjectCollection(\n this.handle,\n errorOnUnknownField,\n prefix\n );\n if (pObjects === undefined) return undefined;\n const result: Record<string, PObject<TreeNodeAccessor>> = {};\n for (const [key, value] of Object.entries(pObjects))\n result[key] = mapPObjectData(value, (c) => new TreeNodeAccessor(c));\n return result;\n }\n\n public getFileContentAsBase64(): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsBase64(this.handle));\n }\n\n public getFileContentAsString(): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle));\n }\n\n public getFileContentAsJson<T>(): FutureRef<T | undefined> {\n return new FutureRef<string | undefined>(\n getCfgRenderCtx().getBlobContentAsString(this.handle)\n ).mapDefined((v) => JSON.parse(v) as T);\n }\n\n /**\n * @deprecated use getFileContentAsBase64\n */\n public getBlobContentAsBase64(): FutureRef<string | undefined> {\n return this.getFileContentAsBase64();\n }\n\n /**\n * @deprecated use getFileContentAsString\n */\n public getBlobContentAsString(): FutureRef<string | undefined> {\n return this.getFileContentAsString();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getFileHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getFileHandle\n */\n public getDownloadedBlobHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return this.getFileHandle();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getRemoteFileHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getRemoteFileHandle\n */\n public getOnDemandBlobHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return this.getRemoteFileHandle();\n }\n\n public getImportProgress(): FutureRef<ImportProgress> {\n return new FutureRef(getCfgRenderCtx().getImportProgress(this.handle));\n }\n\n public getLastLogs(nLines: number): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getLastLogs(this.handle, nLines));\n }\n\n public getProgressLog(patternToSearch: string): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));\n }\n\n public getLogHandle(): FutureRef<AnyLogHandle | undefined> {\n return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));\n }\n}\n","import { Optional } from 'utility-types';\nimport { Branded } from '../branding';\nimport { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';\nimport {\n Option,\n PColumn,\n PFrameDef,\n PFrameHandle,\n PObject,\n PObjectSpec,\n PSpecPredicate,\n PTableDef,\n PTableHandle,\n ResultCollection,\n ValueOrError\n} from '@milaboratories/pl-model-common';\n\nexport const StagingAccessorName = 'staging';\nexport const MainAccessorName = 'main';\n\nexport type AccessorHandle = Branded<string, 'AccessorHandle'>;\nexport type FutureHandle = Branded<string, 'FutureHandle'>;\n\nexport interface GlobalCfgRenderCtxMethods<AHandle = AccessorHandle, FHandle = FutureHandle> {\n //\n // Root accessor creation\n //\n\n getAccessorHandleByName(name: string): AHandle | undefined;\n\n //\n // Basic resource accessor actions\n //\n\n resolveWithCommon(\n handle: AHandle,\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): AHandle | undefined;\n\n getResourceType(handle: AHandle): ResourceType;\n\n getInputsLocked(handle: AHandle): boolean;\n\n getOutputsLocked(handle: AHandle): boolean;\n\n getIsReadyOrError(handle: AHandle): boolean;\n\n getIsFinal(handle: AHandle): boolean;\n\n getError(handle: AHandle): AHandle | undefined;\n\n listInputFields(handle: AHandle): string[];\n\n listOutputFields(handle: AHandle): string[];\n\n listDynamicFields(handle: AHandle): string[];\n\n getKeyValueBase64(handle: AHandle, key: string): string | undefined;\n\n getKeyValueAsString(handle: AHandle, key: string): string | undefined;\n\n getDataBase64(handle: AHandle): string | undefined;\n\n getDataAsString(handle: AHandle): string | undefined;\n\n /** If not final returns undefined */\n parsePObjectCollection(\n handle: AHandle,\n errorOnUnknownField: boolean,\n prefix: string\n ): Record<string, PObject<AHandle>> | undefined;\n\n //\n // Blob\n //\n\n getBlobContentAsBase64(handle: AHandle): FHandle; // string | undefined\n\n getBlobContentAsString(handle: AHandle): FHandle; // string | undefined\n\n getDownloadedBlobContentHandle(handle: AHandle): FHandle; // LocalBlobHandleAndSize | undefined;\n\n getOnDemandBlobContentHandle(handle: AHandle): FHandle; // RemoteBlobHandleAndSize | undefined;\n\n //\n // Import progress\n //\n\n getImportProgress(handle: AHandle): FHandle; // ImportProgress;\n\n //\n // Logs\n //\n\n getLastLogs(handle: AHandle, nLines: number): FHandle; // string | undefined;\n\n getProgressLog(handle: AHandle, patternToSearch: string): FHandle; // string | undefined;\n\n getLogHandle(handle: AHandle): FHandle; // AnyLogHandle | undefined;\n\n //\n // Blocks\n //\n\n getBlockLabel(blockId: string): string;\n\n //\n // Result Pool\n //\n\n getDataFromResultPool(): ResultCollection<PObject<AHandle>>;\n\n getDataWithErrorsFromResultPool(): ResultCollection<\n Optional<PObject<ValueOrError<AHandle, string>>, 'id'>\n >;\n\n getSpecsFromResultPool(): ResultCollection<PObjectSpec>;\n\n calculateOptions(predicate: PSpecPredicate): Option[];\n\n //\n // PFrame / PTable\n //\n\n createPFrame(def: PFrameDef<AHandle>): PFrameHandle;\n\n createPTable(def: PTableDef<PColumn<AHandle>>): PTableHandle;\n}\n\nexport interface GlobalCfgRenderCtx extends GlobalCfgRenderCtxMethods {\n readonly args: string;\n readonly uiState?: string;\n readonly callbackRegistry: Record<string, Function>;\n}\n\nexport type FutureAwait = {\n __awaited_futures__: FutureHandle[];\n};\n\nexport function isFutureAwait(obj: unknown): obj is FutureAwait {\n return typeof obj === 'object' && obj !== null && '__awaited_futures__' in obj;\n}\n\nfunction addAllFutureAwaits(set: Set<string>, visited: Set<unknown>, node: unknown) {\n if (visited.has(node)) return;\n visited.add(node);\n\n const type = typeof node;\n if (type === 'object') {\n if (isFutureAwait(node)) node.__awaited_futures__.forEach((a) => set.add(a));\n else if (Array.isArray(node))\n for (const nested of node) addAllFutureAwaits(set, visited, nested);\n else\n for (const [, nested] of Object.entries(node as object))\n if (nested !== node) addAllFutureAwaits(set, visited, nested);\n }\n}\n\nexport function getAllFutureAwaits(obj: unknown): Set<string> {\n const set = new Set<string>();\n addAllFutureAwaits(set, new Set(), obj);\n return set;\n}\n","import {\n Option,\n PColumn,\n PFrameDef,\n PFrameHandle,\n PObject,\n PObjectSpec,\n PSpecPredicate,\n PTableDef,\n PTableHandle,\n PTableRecordFilter,\n PTableSorting,\n ResultCollection,\n ValueOrError,\n mapPObjectData,\n mapPTableDef,\n mapValueInVOE\n} from '@milaboratories/pl-model-common';\nimport { Optional } from 'utility-types';\nimport { getCfgRenderCtx } from '../internal';\nimport { TreeNodeAccessor } from './accessor';\nimport { FutureRef } from './future';\nimport { GlobalCfgRenderCtx, MainAccessorName, StagingAccessorName } from './internal';\n\nexport class ResultPool {\n private readonly ctx: GlobalCfgRenderCtx = getCfgRenderCtx();\n\n public calculateOptions(predicate: PSpecPredicate): Option[] {\n return this.ctx.calculateOptions(predicate);\n }\n\n public getDataFromResultPool(): ResultCollection<PObject<TreeNodeAccessor>> {\n const result = this.ctx.getDataFromResultPool();\n return {\n isComplete: result.isComplete,\n entries: result.entries.map((e) => ({\n ref: e.ref,\n obj: {\n ...e.obj,\n data: new TreeNodeAccessor(e.obj.data)\n }\n }))\n };\n }\n\n public getDataWithErrorsFromResultPool(): ResultCollection<\n Optional<PObject<ValueOrError<TreeNodeAccessor, string>>, 'id'>\n > {\n const result = this.ctx.getDataWithErrorsFromResultPool();\n return {\n isComplete: result.isComplete,\n entries: result.entries.map((e) => ({\n ref: e.ref,\n obj: {\n ...e.obj,\n data: mapValueInVOE(e.obj.data, (handle) => new TreeNodeAccessor(handle))\n }\n }))\n };\n }\n\n public getSpecsFromResultPool(): ResultCollection<PObjectSpec> {\n return this.ctx.getSpecsFromResultPool();\n }\n}\n\nexport class RenderCtx<Args, UiState> {\n private readonly ctx: GlobalCfgRenderCtx;\n\n public readonly args: Args;\n public readonly uiState: UiState | undefined;\n\n constructor() {\n this.ctx = getCfgRenderCtx();\n this.args = JSON.parse(this.ctx.args);\n this.uiState = this.ctx.uiState !== undefined ? JSON.parse(this.ctx.uiState) : undefined;\n }\n\n private getNamedAccessor(name: string): TreeNodeAccessor | undefined {\n const accessorId = this.ctx.getAccessorHandleByName(name);\n return accessorId ? new TreeNodeAccessor(accessorId) : undefined;\n }\n\n public get prerun(): TreeNodeAccessor | undefined {\n return this.getNamedAccessor(StagingAccessorName);\n }\n\n /**\n * @deprecated use prerun\n */\n public get precalc(): TreeNodeAccessor | undefined {\n return this.prerun;\n }\n\n /**\n * @deprecated use prerun\n */\n public get stagingOutput(): TreeNodeAccessor | undefined {\n return this.precalc;\n }\n\n public get outputs(): TreeNodeAccessor | undefined {\n return this.getNamedAccessor(MainAccessorName);\n }\n\n /**\n * @deprecated use outputs\n */\n public get mainOutput(): TreeNodeAccessor | undefined {\n return this.outputs;\n }\n\n public readonly resultPool = new ResultPool();\n\n public createPFrame(def: PFrameDef<TreeNodeAccessor>): PFrameHandle {\n return this.ctx.createPFrame(def.map((c) => mapPObjectData(c, (d) => d.handle)));\n }\n\n public createPTable(def: PTableDef<PColumn<TreeNodeAccessor>>): PTableHandle;\n public createPTable(def: {\n columns: PColumn<TreeNodeAccessor>[];\n filters?: PTableRecordFilter[];\n /** Table sorting */\n sorting?: PTableSorting[];\n }): PTableHandle;\n public createPTable(\n def:\n | PTableDef<PColumn<TreeNodeAccessor>>\n | {\n columns: PColumn<TreeNodeAccessor>[];\n filters?: PTableRecordFilter[];\n /** Table sorting */\n sorting?: PTableSorting[];\n }\n ): PTableHandle {\n var rawDef: PTableDef<PColumn<TreeNodeAccessor>>;\n if ('columns' in def) {\n rawDef = {\n src: {\n type: 'inner',\n entries: def.columns.map((c) => ({ type: 'column', column: c }))\n },\n filters: def.filters ?? [],\n sorting: def.sorting ?? []\n };\n } else {\n rawDef = def;\n }\n return this.ctx.createPTable(mapPTableDef(rawDef, (po) => mapPObjectData(po, (d) => d.handle)));\n }\n\n public getBlockLabel(blockId: string): string {\n return this.ctx.getBlockLabel(blockId);\n }\n}\n\nexport type RenderFunction<Args = unknown, UiState = unknown, Ret = unknown> = (\n rCtx: RenderCtx<Args, UiState>\n) => Ret;\n\nexport type UnwrapFutureRef<K> =\n K extends FutureRef<infer T>\n ? T\n : K extends bigint | boolean | null | number | string | symbol | undefined\n ? K\n : { [key in keyof K]: UnwrapFutureRef<K[key]> };\n\nexport type InferRenderFunctionReturn<RF extends Function> = RF extends (...args: any) => infer R\n ? UnwrapFutureRef<R>\n : never;\n","export const PlatformaSDKVersion = '1.2.29';\n","import { BlockRenderingMode, BlockSection, ValueOrErrors } from '@milaboratories/pl-model-common';\nimport { Checked, ConfigResult, getImmediate, PlResourceEntry, TypedConfig } from './config';\nimport { getPlatformaInstance, isInUI, tryRegisterCallback } from './internal';\nimport { Platforma } from './platforma';\nimport { InferRenderFunctionReturn, RenderCtx, RenderFunction } from './render';\nimport { PlatformaSDKVersion } from './version';\n\ntype StdCtxArgsOnly<Args, UiState = undefined> = {\n readonly $blockId: string;\n readonly $args: Args;\n readonly $ui: UiState;\n};\n\nexport type StdCtx<Args, UiState = undefined> = StdCtxArgsOnly<Args, UiState> & {\n readonly $prod: PlResourceEntry;\n readonly $staging: PlResourceEntry;\n};\n\nexport type ResolveCfgType<Cfg extends TypedConfig, Args, UiState = undefined> = ConfigResult<\n Cfg,\n StdCtx<Args, UiState>\n>;\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 SectionsRFChecked<RF extends Function> = Checked<\n RF,\n InferRenderFunctionReturn<RF> 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 InputsValidRFChecked<RF extends Function> = Checked<\n RF,\n InferRenderFunctionReturn<RF> extends InputsValidExpectedType ? true : false\n>;\n\nexport type Code = {\n type: 'plain';\n content: string;\n};\n\n/** Field key to attach ConfAction information to a config type. */\ndeclare const __function_handle__: unique symbol;\n\n/** Creates branded Cfg type */\nexport type FunctionHandle<Return = unknown> = string & { [__function_handle__]: Return };\n\nexport type ExtractFunctionHandleReturn<Func extends FunctionHandle> =\n Func[typeof __function_handle__];\n\nexport type TypedConfigOrFunctionHandle = TypedConfig | FunctionHandle;\n\nexport function isFunctionHandle(cfgOrFh: TypedConfigOrFunctionHandle): cfgOrFh is FunctionHandle {\n return typeof cfgOrFh === 'string';\n}\n\ntype OnlyString<S> = S extends string ? S : '';\n\n// prettier-ignore\nexport type DeriveHref<S> = S extends readonly BlockSection[]\n ? OnlyString<Extract<S[number], { type: 'link' }>['href']>\n : never;\n\n/** This structure is rendered from the configuration, type can accommodate any\n * version of config structure. */\nexport type BlockConfigUniversal<\n Args = unknown,\n Outputs extends Record<string, TypedConfigOrFunctionHandle> = Record<\n string,\n TypedConfigOrFunctionHandle\n >\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** @deprecated */\n readonly canRun?: TypedConfigOrFunctionHandle;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n * */\n readonly inputsValid?: TypedConfigOrFunctionHandle;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: TypedConfigOrFunctionHandle;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n};\n\n/** This structure is rendered from the configuration */\nexport type BlockConfig<\n Args = unknown,\n Outputs extends Record<string, TypedConfigOrFunctionHandle> = Record<\n string,\n TypedConfigOrFunctionHandle\n >\n> = Required<Omit<BlockConfigUniversal<Args, Outputs>, 'canRun' | 'code'>> &\n Pick<BlockConfigUniversal<Args, Outputs>, 'code'>;\n\n/** Takes universal config, and converts it into latest structure */\nexport function normalizeBlockConfig<\n Args,\n Outputs extends Record<string, TypedConfigOrFunctionHandle>\n>(cfg: BlockConfigUniversal<Args, Outputs>): BlockConfig<Args, Outputs> {\n if (cfg.inputsValid !== undefined) return cfg as BlockConfig<Args, Outputs>;\n else {\n if (cfg.canRun === undefined)\n throw new Error(`Malformed config, SDK version ${cfg.sdkVersion}`);\n const latest = { ...cfg, inputsValid: cfg.canRun };\n delete latest['canRun'];\n return latest;\n }\n}\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, TypedConfigOrFunctionHandle>,\n UiState,\n Href extends `/${string}` = '/'\n> {\n private constructor(\n private readonly _renderingMode: BlockRenderingMode,\n private readonly _initialArgs: Args | undefined,\n private readonly _outputs: OutputsCfg,\n private readonly _inputsValid: TypedConfigOrFunctionHandle,\n private readonly _sections: TypedConfigOrFunctionHandle\n ) { }\n\n /** Initiates configuration builder */\n public static create<Args, UiState = undefined>(\n renderingMode: BlockRenderingMode = 'Heavy'\n ): BlockModel<Args, {}, UiState> {\n return new BlockModel<Args, {}, UiState>(\n renderingMode,\n undefined,\n {},\n getImmediate(true),\n getImmediate([])\n );\n }\n\n /**\n * Add output cell to the configuration\n *\n * @param key cell name, that can be used to retrieve the rendered value\n * @param cfg configuration describing how to render cell value from the blocks\n * workflow outputs\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 public output<const Key extends string, const RF extends RenderFunction<Args, UiState>>(\n key: Key,\n rf: RF\n ): BlockModel<\n Args,\n OutputsCfg & { [K in Key]: FunctionHandle<InferRenderFunctionReturn<RF>> },\n UiState,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n if (typeof cfgOrRf === 'function') {\n const functionHandle = `output#${key}` as FunctionHandle;\n tryRegisterCallback(functionHandle, () => cfgOrRf(new RenderCtx()));\n return new BlockModel(\n this._renderingMode,\n this._initialArgs,\n {\n ...this._outputs,\n [key]: functionHandle\n },\n this._inputsValid,\n this._sections\n );\n } else\n return new BlockModel(\n this._renderingMode,\n this._initialArgs,\n {\n ...this._outputs,\n [key]: cfgOrRf\n },\n this._inputsValid,\n this._sections\n );\n }\n\n /** @deprecated */\n public canRun<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return this.inputsValid(cfg as any);\n }\n\n /** Sets custom configuration predicate on the block args at which block can be executed */\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 RenderFunction<Args, UiState, boolean>>(\n rf: RF\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public argsValid(\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (typeof cfgOrRf === 'function') {\n tryRegisterCallback('inputsValid', () => cfgOrRf(new RenderCtx()));\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n 'inputsValid' as FunctionHandle,\n this._sections\n );\n } else\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n cfgOrRf,\n this._sections\n );\n }\n\n /** @deprecated use argsValid() */\n public inputsValid<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n /** @deprecated use argsValid() */\n public inputsValid<RF extends RenderFunction<Args, UiState, boolean>>(\n rf: RF\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public inputsValid(\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n return this.argsValid(cfgOrRf as any);\n }\n\n /** Sets the config to generate list of section in the left block overviews panel */\n public sections<const S extends SectionsExpectedType,>(rf: S): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunction<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 | Function\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 RenderCtx()));\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n this._inputsValid,\n 'sections' as FunctionHandle\n );\n } else\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n this._inputsValid,\n arrOrCfgOrRf as TypedConfig\n );\n }\n\n\n /** Sets initial args for the block, this value must be specified. */\n public initialArgs(value: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>(\n this._renderingMode,\n value,\n this._outputs,\n this._inputsValid,\n this._sections\n );\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(): Platforma<\n Args,\n InferOutputsFromConfigs<Args, OutputsCfg, UiState>,\n UiState,\n Href\n > {\n if (this._initialArgs === undefined) throw new Error('Initial arguments not set.');\n\n const config: BlockConfig<Args, OutputsCfg> = {\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this._renderingMode,\n initialArgs: this._initialArgs,\n inputsValid: this._inputsValid,\n sections: this._sections,\n outputs: this._outputs\n };\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 return getPlatformaInstance(config) as any;\n }\n}\n\nexport type InferOutputType<CfgOrFH, Args, UiState> = CfgOrFH extends TypedConfig\n ? ResolveCfgType<CfgOrFH, Args, UiState>\n : CfgOrFH extends FunctionHandle\n ? ExtractFunctionHandleReturn<CfgOrFH>\n : never;\n\ntype InferOutputsFromConfigs<\n Args,\n OutputsCfg extends Record<string, TypedConfigOrFunctionHandle>,\n UiState\n> = {\n [Key in keyof OutputsCfg]: ValueOrErrors<InferOutputType<OutputsCfg[Key], Args, UiState>>;\n};\n","import {\n CalculateTableDataRequest,\n CalculateTableDataResponse,\n FindColumnsRequest,\n FindColumnsResponse,\n PColumnIdAndSpec,\n PColumnSpec,\n PFrame,\n PFrameHandle,\n PObjectId,\n UniqueValuesRequest,\n UniqueValuesResponse\n} from '@milaboratories/pl-model-common';\n\nexport class PFrameImpl implements PFrame {\n constructor(private readonly handle: PFrameHandle) {}\n\n public async findColumns(request: FindColumnsRequest): Promise<FindColumnsResponse> {\n return await platforma.pFrameDriver.findColumns(this.handle, request);\n }\n\n public async getColumnSpec(columnId: PObjectId): Promise<PColumnSpec> {\n return await platforma.pFrameDriver.getColumnSpec(this.handle, columnId);\n }\n\n public async listColumns(): Promise<PColumnIdAndSpec[]> {\n return await platforma.pFrameDriver.listColumns(this.handle);\n }\n\n public async calculateTableData(\n request: CalculateTableDataRequest<PObjectId>\n ): Promise<CalculateTableDataResponse> {\n return await platforma.pFrameDriver.calculateTableData(this.handle, request);\n }\n\n public async getUniqueValues(request: UniqueValuesRequest): Promise<UniqueValuesResponse> {\n return await platforma.pFrameDriver.getUniqueValues(this.handle, request);\n }\n}\n","import { getJsonField, makeObject, TypedConfig } from './config';\n\nexport function fromPlRef<Source extends TypedConfig>(source: Source) {\n return makeObject({\n __isRef: true,\n blockId: getJsonField(source, 'blockId'),\n name: getJsonField(source, 'name')\n });\n}\n\nexport function fromPlOption<Source extends TypedConfig>(source: Source) {\n return makeObject({\n ref: fromPlRef(getJsonField(source, 'ref')),\n label: getJsonField(source, 'label')\n });\n}\n","import { PlatformaSDKVersion } from './version';\n\nexport type SdkInfo = {\n readonly sdkVersion: string;\n};\n\nexport const CurrentSdkInfo: SdkInfo = {\n sdkVersion: PlatformaSDKVersion\n};\n","declare global {\n function getEnvironmentValue(name: string): string | undefined;\n}\n\nexport function getEnvironmentValue(name: string): string | undefined {\n if (typeof getEnvironmentValue !== 'function') return undefined;\n else return getEnvironmentValue(name);\n}\n"],"names":["OutputError","errors","moreErrors","readOutput","outputValue","wrapOutputs","outputs","target","key","primitiveToConfig","value","getImmediate","getFromCfg","variable","isolate","cfg","Args","It","MainOutputs","StagingOutputs","UiState","makeObject","template","normalizedTemplate","k","makeArray","getJsonField","source","field","mapRecordValues","mapping","itVar","mapArrayValues","flatten","isEmpty","arg","not","operand","and","operand1","operand2","or","getResourceField","getResourceValueAsJson","mapResourceFields","getBlobContent","getBlobContentAsString","getBlobContentAsJson","getDownloadedBlobContent","getOnDemandBlobContent","getImportProgress","getLastLogs","lines","getProgressLog","patternToSearch","getLogHandle","isInUI","getPlatformaInstance","config","tryGetCfgRenderCtx","getCfgRenderCtx","tryRegisterCallback","callback","ctx","futureResolves","registerFutureAwait","handle","onResolve","res","FutureRef","postProcess","v","__publicField","vv","wrapAccessor","TreeNodeAccessor","steps","commonOptions","content","errorOnUnknownField","prefix","result","obj","isPColumn","pObjects","mapPObjectData","c","nLines","StagingAccessorName","MainAccessorName","isFutureAwait","addAllFutureAwaits","set","visited","node","a","nested","getAllFutureAwaits","ResultPool","predicate","e","mapValueInVOE","RenderCtx","name","accessorId","def","d","rawDef","mapPTableDef","po","blockId","PlatformaSDKVersion","isFunctionHandle","cfgOrFh","normalizeBlockConfig","latest","BlockModel","_renderingMode","_initialArgs","_outputs","_inputsValid","_sections","renderingMode","cfgOrRf","functionHandle","arrOrCfgOrRf","PFrameImpl","request","columnId","fromPlRef","fromPlOption","CurrentSdkInfo","getEnvironmentValue"],"mappings":"uSAEO,MAAMA,UAAoB,KAAM,CACrC,YACkBC,EACAC,EAChB,CACM,MAAA,GAAGD,EAAO,MAAM,GAAGC,EAAa,IAAM,EAAE,yBAA2BD,EAAO,CAAC,CAAC,EAHlE,KAAA,OAAAA,EACA,KAAA,WAAAC,CAGlB,CACF,CAEO,SAASC,EAAcC,EAAkC,CAC1D,GAAA,CAACA,EAAY,GAAI,MAAM,IAAIJ,EAAYI,EAAY,OAAQA,EAAY,UAAU,EACrF,OAAOA,EAAY,KACrB,CAOO,SAASC,EACdC,EACwB,CACjB,OAAA,IA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C,GAAqBC,CAAM,EAF9B,CAAE,OAAAA,CAAO,CAGpB,CACF,CC3UO,MAAMoE,EAA6B,CACxC,YAA6B5D,EAAsB,CAAtB,KAAA,OAAAA,CAAuB,CAEpD,MAAa,YAAY6D,EAA2D,CAClF,OAAO,MAAM,UAAU,aAAa,YAAY,KAAK,OAAQA,CAAO,CACtE,CAEA,MAAa,cAAcC,EAA2C,CACpE,OAAO,MAAM,UAAU,aAAa,cAAc,KAAK,OAAQA,CAAQ,CACzE,CAEA,MAAa,aAA2C,CACtD,OAAO,MAAM,UAAU,aAAa,YAAY,KAAK,MAAM,CAC7D,CAEA,MAAa,mBACXD,EACqC,CACrC,OAAO,MAAM,UAAU,aAAa,mBAAmB,KAAK,OAAQA,CAAO,CAC7E,CAEA,MAAa,gBAAgBA,EAA6D,CACxF,OAAO,MAAM,UAAU,aAAa,gBAAgB,KAAK,OAAQA,CAAO,CAC1E,CACF,CCpCO,SAASE,EAAsCtG,EAAgB,CACpE,OAAON,EAAW,CAChB,QAAS,GACT,QAASK,EAAaC,EAAQ,SAAS,EACvC,KAAMD,EAAaC,EAAQ,MAAM,CAAA,CAClC,CACH,CAEO,SAASuG,GAAyCvG,EAAgB,CACvE,OAAON,EAAW,CAChB,IAAK4G,EAAUvG,EAAaC,EAAQ,KAAK,CAAC,EAC1C,MAAOD,EAAaC,EAAQ,OAAO,CAAA,CACpC,CACH,CCTO,MAAMwG,GAA0B,CACrC,WAAYpB,CACd,ECJO,SAASqB,EAAoB7B,EAAkC,CAChE,GAAA,OAAO6B,GAAwB,WAC9B,OAAOA,EAAwB,CACtC"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var l = (e, t, n) =>
|
|
4
|
-
import { isPColumn as
|
|
1
|
+
var D = Object.defineProperty;
|
|
2
|
+
var O = (e, t, n) => t in e ? D(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var l = (e, t, n) => O(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import { isPColumn as x, mapPObjectData as w, mapValueInVOE as I, mapPTableDef as B } from "@milaboratories/pl-model-common";
|
|
5
5
|
export * from "@milaboratories/pl-model-common";
|
|
6
|
-
class
|
|
6
|
+
class E extends Error {
|
|
7
7
|
constructor(t, n) {
|
|
8
8
|
super(`${t.length}${n ? "+" : ""} errors, first error: ` + t[0]), this.errors = t, this.moreErrors = n;
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
function L(e) {
|
|
12
|
-
if (!e.ok) throw new
|
|
12
|
+
if (!e.ok) throw new E(e.errors, e.moreErrors);
|
|
13
13
|
return e.value;
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function K(e) {
|
|
16
16
|
return new Proxy(e, {
|
|
17
17
|
get(t, n) {
|
|
18
18
|
return L(t[n]);
|
|
@@ -25,17 +25,17 @@ function i(e) {
|
|
|
25
25
|
function g(e) {
|
|
26
26
|
return { type: "GetFromCtx", variable: e };
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function W(e) {
|
|
29
29
|
return {
|
|
30
30
|
type: "Isolate",
|
|
31
31
|
cfg: e
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
const
|
|
34
|
+
const z = g("$args"), U = g("$it"), q = g("$prod"), Q = g("$staging"), X = g("$ui");
|
|
35
35
|
function p(e) {
|
|
36
36
|
return { type: "Immediate", value: e };
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function _(e) {
|
|
39
39
|
const t = {};
|
|
40
40
|
for (const [n, r] of Object.entries(e)) t[n] = i(r);
|
|
41
41
|
return {
|
|
@@ -43,7 +43,7 @@ function C(e) {
|
|
|
43
43
|
template: t
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
function
|
|
46
|
+
function Y(...e) {
|
|
47
47
|
const t = [];
|
|
48
48
|
for (const n of e) t.push(i(n));
|
|
49
49
|
return {
|
|
@@ -58,7 +58,7 @@ function h(e, t) {
|
|
|
58
58
|
field: i(t)
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function Z(e, t, n = "$it") {
|
|
62
62
|
return {
|
|
63
63
|
type: "MapRecordValues",
|
|
64
64
|
source: e,
|
|
@@ -66,7 +66,7 @@ function Y(e, t, n = "$it") {
|
|
|
66
66
|
itVar: n
|
|
67
67
|
};
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function tt(e, t, n = "$it") {
|
|
70
70
|
return {
|
|
71
71
|
type: "MapArrayValues",
|
|
72
72
|
source: e,
|
|
@@ -74,46 +74,46 @@ function Z(e, t, n = "$it") {
|
|
|
74
74
|
itVar: n
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function et(e) {
|
|
78
78
|
return {
|
|
79
79
|
type: "Flatten",
|
|
80
80
|
source: e
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function nt(e) {
|
|
84
84
|
return {
|
|
85
85
|
type: "IsEmpty",
|
|
86
86
|
arg: e
|
|
87
87
|
};
|
|
88
88
|
}
|
|
89
|
-
function
|
|
89
|
+
function rt(e) {
|
|
90
90
|
return {
|
|
91
91
|
type: "Not",
|
|
92
92
|
operand: e
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function st(e, t) {
|
|
96
96
|
return {
|
|
97
97
|
type: "And",
|
|
98
98
|
operand1: e,
|
|
99
99
|
operand2: t
|
|
100
100
|
};
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function it(e, t) {
|
|
103
103
|
return {
|
|
104
104
|
type: "Or",
|
|
105
105
|
operand1: e,
|
|
106
106
|
operand2: t
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
function
|
|
109
|
+
function ot(e, t) {
|
|
110
110
|
return {
|
|
111
111
|
type: "GetResourceField",
|
|
112
112
|
source: i(e),
|
|
113
113
|
field: i(t)
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
function
|
|
116
|
+
function at() {
|
|
117
117
|
return function(e) {
|
|
118
118
|
return {
|
|
119
119
|
type: "GetResourceValueAsJson",
|
|
@@ -121,7 +121,7 @@ function ot() {
|
|
|
121
121
|
};
|
|
122
122
|
};
|
|
123
123
|
}
|
|
124
|
-
function
|
|
124
|
+
function ut(e, t, n = "$it") {
|
|
125
125
|
return {
|
|
126
126
|
type: "MapResourceFields",
|
|
127
127
|
source: e,
|
|
@@ -129,19 +129,19 @@ function at(e, t, n = "$it") {
|
|
|
129
129
|
itVar: n
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
function
|
|
132
|
+
function lt(e) {
|
|
133
133
|
return {
|
|
134
134
|
type: "GetBlobContent",
|
|
135
135
|
source: i(e)
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function ct(e) {
|
|
139
139
|
return {
|
|
140
140
|
type: "GetBlobContentAsString",
|
|
141
141
|
source: i(e)
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function dt() {
|
|
145
145
|
return function(e) {
|
|
146
146
|
return {
|
|
147
147
|
type: "GetBlobContentAsJson",
|
|
@@ -149,53 +149,53 @@ function ct() {
|
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
151
|
}
|
|
152
|
-
function
|
|
152
|
+
function gt(e) {
|
|
153
153
|
return {
|
|
154
154
|
type: "GetDownloadedBlobContent",
|
|
155
155
|
source: i(e)
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function pt(e) {
|
|
159
159
|
return {
|
|
160
160
|
type: "GetOnDemandBlobContent",
|
|
161
161
|
source: i(e)
|
|
162
162
|
};
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function ht(e) {
|
|
165
165
|
return {
|
|
166
166
|
type: "GetImportProgress",
|
|
167
167
|
source: i(e)
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
|
-
function
|
|
170
|
+
function ft(e, t) {
|
|
171
171
|
return {
|
|
172
172
|
type: "GetLastLogs",
|
|
173
173
|
source: i(e),
|
|
174
174
|
lines: t
|
|
175
175
|
};
|
|
176
176
|
}
|
|
177
|
-
function
|
|
177
|
+
function mt(e, t) {
|
|
178
178
|
return {
|
|
179
179
|
type: "GetProgressLog",
|
|
180
180
|
source: i(e),
|
|
181
181
|
patternToSearch: t
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function yt(e) {
|
|
185
185
|
return {
|
|
186
186
|
type: "GetLogHandle",
|
|
187
187
|
source: i(e)
|
|
188
188
|
};
|
|
189
189
|
}
|
|
190
|
-
function
|
|
190
|
+
function k() {
|
|
191
191
|
return typeof getPlatforma < "u" || typeof platforma < "u";
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function j(e) {
|
|
194
194
|
if (typeof getPlatforma == "function") return getPlatforma(e);
|
|
195
195
|
if (typeof platforma < "u") return platforma;
|
|
196
196
|
throw new Error("Can't get platforma instance.");
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function H() {
|
|
199
199
|
if (typeof cfgRenderCtx < "u") return cfgRenderCtx;
|
|
200
200
|
}
|
|
201
201
|
function s() {
|
|
@@ -203,13 +203,13 @@ function s() {
|
|
|
203
203
|
throw new Error("Not in config rendering context");
|
|
204
204
|
}
|
|
205
205
|
function f(e, t) {
|
|
206
|
-
const n =
|
|
206
|
+
const n = H();
|
|
207
207
|
if (n === void 0) return !1;
|
|
208
208
|
if (e in n.callbackRegistry) throw new Error(`Callback with key ${e} already registered.`);
|
|
209
209
|
return n.callbackRegistry[e] = t, !0;
|
|
210
210
|
}
|
|
211
211
|
const m = /* @__PURE__ */ new Map();
|
|
212
|
-
function
|
|
212
|
+
function J(e, t) {
|
|
213
213
|
e in s().callbackRegistry || (s().callbackRegistry[e] = (n) => {
|
|
214
214
|
for (const r of m.get(e))
|
|
215
215
|
r(n);
|
|
@@ -219,7 +219,7 @@ class a {
|
|
|
219
219
|
constructor(t, n = (r) => r) {
|
|
220
220
|
l(this, "isResolved", !1);
|
|
221
221
|
l(this, "resolvedValue");
|
|
222
|
-
this.handle = t, this.postProcess = n,
|
|
222
|
+
this.handle = t, this.postProcess = n, J(t, (r) => {
|
|
223
223
|
this.resolvedValue = n(r), this.isResolved = !0;
|
|
224
224
|
});
|
|
225
225
|
}
|
|
@@ -304,7 +304,7 @@ class d {
|
|
|
304
304
|
getPColumns(t = !1, n = "") {
|
|
305
305
|
const r = this.parsePObjectCollection(t, n);
|
|
306
306
|
return r === void 0 ? void 0 : Object.entries(r).map(([, c]) => {
|
|
307
|
-
if (!
|
|
307
|
+
if (!x(c)) throw new Error(`not a PColumn (kind = ${c.spec.kind})`);
|
|
308
308
|
return c;
|
|
309
309
|
});
|
|
310
310
|
}
|
|
@@ -319,8 +319,8 @@ class d {
|
|
|
319
319
|
);
|
|
320
320
|
if (r === void 0) return;
|
|
321
321
|
const o = {};
|
|
322
|
-
for (const [c,
|
|
323
|
-
o[c] = w(
|
|
322
|
+
for (const [c, V] of Object.entries(r))
|
|
323
|
+
o[c] = w(V, (R) => new d(R));
|
|
324
324
|
return o;
|
|
325
325
|
}
|
|
326
326
|
getFileContentAsBase64() {
|
|
@@ -383,32 +383,32 @@ class d {
|
|
|
383
383
|
return new a(s().getLogHandle(this.handle));
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
|
-
const
|
|
387
|
-
function
|
|
386
|
+
const F = "staging", P = "main";
|
|
387
|
+
function v(e) {
|
|
388
388
|
return typeof e == "object" && e !== null && "__awaited_futures__" in e;
|
|
389
389
|
}
|
|
390
390
|
function A(e, t, n) {
|
|
391
391
|
if (t.has(n)) return;
|
|
392
392
|
if (t.add(n), typeof n === "object")
|
|
393
|
-
if (
|
|
393
|
+
if (v(n)) n.__awaited_futures__.forEach((o) => e.add(o));
|
|
394
394
|
else if (Array.isArray(n))
|
|
395
395
|
for (const o of n) A(e, t, o);
|
|
396
396
|
else
|
|
397
397
|
for (const [, o] of Object.entries(n))
|
|
398
398
|
o !== n && A(e, t, o);
|
|
399
399
|
}
|
|
400
|
-
function
|
|
400
|
+
function G(e) {
|
|
401
401
|
const t = /* @__PURE__ */ new Set();
|
|
402
402
|
return A(t, /* @__PURE__ */ new Set(), e), t;
|
|
403
403
|
}
|
|
404
|
-
const
|
|
404
|
+
const wt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
405
405
|
__proto__: null,
|
|
406
|
-
MainAccessorName:
|
|
407
|
-
StagingAccessorName:
|
|
408
|
-
getAllFutureAwaits:
|
|
409
|
-
isFutureAwait:
|
|
406
|
+
MainAccessorName: P,
|
|
407
|
+
StagingAccessorName: F,
|
|
408
|
+
getAllFutureAwaits: G,
|
|
409
|
+
isFutureAwait: v
|
|
410
410
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
411
|
-
class
|
|
411
|
+
class N {
|
|
412
412
|
constructor() {
|
|
413
413
|
l(this, "ctx", s());
|
|
414
414
|
}
|
|
@@ -436,7 +436,7 @@ class G {
|
|
|
436
436
|
ref: n.ref,
|
|
437
437
|
obj: {
|
|
438
438
|
...n.obj,
|
|
439
|
-
data:
|
|
439
|
+
data: I(n.obj.data, (r) => new d(r))
|
|
440
440
|
}
|
|
441
441
|
}))
|
|
442
442
|
};
|
|
@@ -450,7 +450,7 @@ class y {
|
|
|
450
450
|
l(this, "ctx");
|
|
451
451
|
l(this, "args");
|
|
452
452
|
l(this, "uiState");
|
|
453
|
-
l(this, "resultPool", new
|
|
453
|
+
l(this, "resultPool", new N());
|
|
454
454
|
this.ctx = s(), this.args = JSON.parse(this.ctx.args), this.uiState = this.ctx.uiState !== void 0 ? JSON.parse(this.ctx.uiState) : void 0;
|
|
455
455
|
}
|
|
456
456
|
getNamedAccessor(t) {
|
|
@@ -458,7 +458,7 @@ class y {
|
|
|
458
458
|
return n ? new d(n) : void 0;
|
|
459
459
|
}
|
|
460
460
|
get prerun() {
|
|
461
|
-
return this.getNamedAccessor(
|
|
461
|
+
return this.getNamedAccessor(F);
|
|
462
462
|
}
|
|
463
463
|
/**
|
|
464
464
|
* @deprecated use prerun
|
|
@@ -473,7 +473,7 @@ class y {
|
|
|
473
473
|
return this.precalc;
|
|
474
474
|
}
|
|
475
475
|
get outputs() {
|
|
476
|
-
return this.getNamedAccessor(
|
|
476
|
+
return this.getNamedAccessor(P);
|
|
477
477
|
}
|
|
478
478
|
/**
|
|
479
479
|
* @deprecated use outputs
|
|
@@ -493,17 +493,17 @@ class y {
|
|
|
493
493
|
},
|
|
494
494
|
filters: t.filters ?? [],
|
|
495
495
|
sorting: t.sorting ?? []
|
|
496
|
-
} : n = t, this.ctx.createPTable(
|
|
496
|
+
} : n = t, this.ctx.createPTable(B(n, (r) => w(r, (o) => o.handle)));
|
|
497
497
|
}
|
|
498
498
|
getBlockLabel(t) {
|
|
499
499
|
return this.ctx.getBlockLabel(t);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
const S = "1.2.
|
|
503
|
-
function
|
|
502
|
+
const S = "1.2.29";
|
|
503
|
+
function At(e) {
|
|
504
504
|
return typeof e == "string";
|
|
505
505
|
}
|
|
506
|
-
function
|
|
506
|
+
function bt(e) {
|
|
507
507
|
if (e.inputsValid !== void 0) return e;
|
|
508
508
|
{
|
|
509
509
|
if (e.canRun === void 0)
|
|
@@ -611,10 +611,10 @@ class u {
|
|
|
611
611
|
sections: this._sections,
|
|
612
612
|
outputs: this._outputs
|
|
613
613
|
};
|
|
614
|
-
return
|
|
614
|
+
return k() ? j(t) : { config: t };
|
|
615
615
|
}
|
|
616
616
|
}
|
|
617
|
-
class
|
|
617
|
+
class Ct {
|
|
618
618
|
constructor(t) {
|
|
619
619
|
this.handle = t;
|
|
620
620
|
}
|
|
@@ -634,67 +634,72 @@ class bt {
|
|
|
634
634
|
return await platforma.pFrameDriver.getUniqueValues(this.handle, t);
|
|
635
635
|
}
|
|
636
636
|
}
|
|
637
|
-
function
|
|
638
|
-
return
|
|
637
|
+
function $(e) {
|
|
638
|
+
return _({
|
|
639
639
|
__isRef: !0,
|
|
640
640
|
blockId: h(e, "blockId"),
|
|
641
641
|
name: h(e, "name")
|
|
642
642
|
});
|
|
643
643
|
}
|
|
644
|
-
function
|
|
645
|
-
return
|
|
646
|
-
ref:
|
|
644
|
+
function _t(e) {
|
|
645
|
+
return _({
|
|
646
|
+
ref: $(h(e, "ref")),
|
|
647
647
|
label: h(e, "label")
|
|
648
648
|
});
|
|
649
649
|
}
|
|
650
|
-
const
|
|
650
|
+
const Ft = {
|
|
651
651
|
sdkVersion: S
|
|
652
652
|
};
|
|
653
|
+
function C(e) {
|
|
654
|
+
if (typeof C == "function")
|
|
655
|
+
return C();
|
|
656
|
+
}
|
|
653
657
|
export {
|
|
654
|
-
|
|
658
|
+
z as Args,
|
|
655
659
|
u as BlockModel,
|
|
656
|
-
|
|
660
|
+
Ft as CurrentSdkInfo,
|
|
657
661
|
a as FutureRef,
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
662
|
+
U as It,
|
|
663
|
+
wt as JsRenderInternal,
|
|
664
|
+
q as MainOutputs,
|
|
665
|
+
E as OutputError,
|
|
666
|
+
Ct as PFrameImpl,
|
|
663
667
|
y as RenderCtx,
|
|
664
|
-
|
|
665
|
-
|
|
668
|
+
N as ResultPool,
|
|
669
|
+
Q as StagingOutputs,
|
|
666
670
|
d as TreeNodeAccessor,
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
671
|
+
X as UiState,
|
|
672
|
+
st as and,
|
|
673
|
+
et as flatten,
|
|
674
|
+
_t as fromPlOption,
|
|
675
|
+
$ as fromPlRef,
|
|
676
|
+
lt as getBlobContent,
|
|
677
|
+
dt as getBlobContentAsJson,
|
|
678
|
+
ct as getBlobContentAsString,
|
|
679
|
+
gt as getDownloadedBlobContent,
|
|
680
|
+
C as getEnvironmentValue,
|
|
676
681
|
g as getFromCfg,
|
|
677
682
|
p as getImmediate,
|
|
678
|
-
|
|
683
|
+
ht as getImportProgress,
|
|
679
684
|
h as getJsonField,
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
685
|
+
ft as getLastLogs,
|
|
686
|
+
yt as getLogHandle,
|
|
687
|
+
pt as getOnDemandBlobContent,
|
|
688
|
+
mt as getProgressLog,
|
|
689
|
+
ot as getResourceField,
|
|
690
|
+
at as getResourceValueAsJson,
|
|
691
|
+
nt as isEmpty,
|
|
692
|
+
At as isFunctionHandle,
|
|
693
|
+
W as isolate,
|
|
694
|
+
Y as makeArray,
|
|
695
|
+
_ as makeObject,
|
|
696
|
+
tt as mapArrayValues,
|
|
697
|
+
Z as mapRecordValues,
|
|
698
|
+
ut as mapResourceFields,
|
|
699
|
+
bt as normalizeBlockConfig,
|
|
700
|
+
rt as not,
|
|
701
|
+
it as or,
|
|
697
702
|
L as readOutput,
|
|
698
|
-
|
|
703
|
+
K as wrapOutputs
|
|
699
704
|
};
|
|
700
705
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/block_state_util.ts","../src/config/actions.ts","../src/internal.ts","../src/render/future.ts","../src/render/accessor.ts","../src/render/internal.ts","../src/render/api.ts","../src/version.ts","../src/builder.ts","../src/pframe.ts","../src/ref_util.ts","../src/sdk_info.ts"],"sourcesContent":["import { BlockOutputsBase, ValueOrErrors } from '@milaboratories/pl-model-common';\n\nexport class OutputError extends Error {\n constructor(\n public readonly errors: string[],\n public readonly moreErrors: boolean\n ) {\n super(`${errors.length}${moreErrors ? '+' : ''} errors, first error: ` + errors[0]);\n }\n}\n\nexport function readOutput<T>(outputValue: ValueOrErrors<T>): T {\n if (!outputValue.ok) throw new OutputError(outputValue.errors, outputValue.moreErrors);\n return outputValue.value;\n}\n\ntype ExtractValueType<V extends ValueOrErrors<unknown>> = Extract<V, { ok: true }>['value'];\ntype SimpleOutputs<Outputs extends BlockOutputsBase> = {\n [Key in keyof Outputs]: ExtractValueType<Outputs[Key]>;\n};\n\nexport function wrapOutputs<Outputs extends BlockOutputsBase>(\n outputs: Outputs\n): SimpleOutputs<Outputs> {\n return new Proxy(outputs, {\n get(target, key: string) {\n return readOutput(target[key]);\n }\n }) as SimpleOutputs<Outputs>;\n}\n","import {\n ActGetField,\n ActGetFromCtx,\n ActGetImmediate,\n ActGetResourceField,\n ActGetResourceValueAsJson,\n ActMakeObject,\n ActMapRecordValues,\n ActMapResourceFields,\n ActMapArrayValues,\n ActIsEmpty,\n ActNot,\n ActIsolate,\n ActGetBlobContentAsJson,\n ActGetBlobContentAsString,\n ActGetBlobContent,\n ActAnd,\n ActOr,\n ActMakeArray,\n ActFlatten,\n ActGetDownloadedBlobContent,\n ActGetOnDemandBlobContent,\n ActImportProgress,\n ActGetLastLogs,\n ActGetProgressLog,\n ActGetLogHandle\n} from './actions_kinds';\nimport { ExtractAction, POCExtractAction, PrimitiveOrConfig, TypedConfig } from './type_engine';\nimport { Cfg } from './model';\nimport { CheckedSyncConf } from './type_util';\n\n//\n// Helpers\n//\n\nfunction primitiveToConfig(value: PrimitiveOrConfig): TypedConfig {\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value === null\n )\n return getImmediate(value);\n else return value as TypedConfig;\n}\n\n//\n// Context\n//\n\nexport function getFromCfg<const V extends string>(variable: V): TypedConfig<ActGetFromCtx<V>> {\n return { type: 'GetFromCtx', variable } as Cfg as any;\n}\n\n//\n// Isolate\n//\n\nexport function isolate<const Config extends TypedConfig>(\n cfg: Config\n): TypedConfig<ActIsolate<ExtractAction<Config>>> {\n return {\n type: 'Isolate',\n cfg\n } as Cfg as any;\n}\n\n//\n// Well-known Context Vars\n//\n\nexport const Args = getFromCfg('$args');\nexport const It = getFromCfg('$it');\nexport const MainOutputs = getFromCfg('$prod');\nexport const StagingOutputs = getFromCfg('$staging');\nexport const UiState = getFromCfg('$ui');\n\n//\n// Json\n//\n\nexport function getImmediate<const T>(value: T): TypedConfig<ActGetImmediate<T>> {\n return { type: 'Immediate', value } as Cfg as any;\n}\n\nexport function makeObject<const T extends Record<string, PrimitiveOrConfig>>(\n template: T\n): TypedConfig<ActMakeObject<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {\n const normalizedTemplate: Record<string, TypedConfig> = {};\n for (const [k, cfg] of Object.entries(template)) normalizedTemplate[k] = primitiveToConfig(cfg);\n return {\n type: 'MakeObject',\n template: normalizedTemplate\n } as Cfg as any;\n}\n\nexport function makeArray<const T extends PrimitiveOrConfig[]>(\n ...template: T\n): TypedConfig<ActMakeArray<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {\n const normalizedTemplate: TypedConfig[] = [];\n for (const cfg of template) normalizedTemplate.push(primitiveToConfig(cfg));\n return {\n type: 'MakeArray',\n template: normalizedTemplate\n } as Cfg as any;\n}\n\nexport function getJsonField<\n const Source extends PrimitiveOrConfig,\n const Field extends PrimitiveOrConfig\n>(\n source: Source,\n field: Field\n): TypedConfig<ActGetField<POCExtractAction<Source>, POCExtractAction<Field>>> {\n return {\n type: 'GetJsonField',\n source: primitiveToConfig(source),\n field: primitiveToConfig(field)\n } as Cfg as any;\n}\n\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>,\n itVar: ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapRecordValues',\n source,\n mapping,\n itVar\n } as Cfg as any;\n}\n\nexport function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>,\n itVar: ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapArrayValues',\n source,\n mapping,\n itVar\n } as Cfg as any;\n}\n\nexport function flatten<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActFlatten<ExtractAction<Source>>> {\n return {\n type: 'Flatten',\n source\n } as Cfg as any;\n}\n\n//\n// Boolean\n//\n\nexport function isEmpty<const Arg extends TypedConfig>(\n arg: Arg\n): TypedConfig<ActIsEmpty<ExtractAction<Arg>>> {\n return {\n type: 'IsEmpty',\n arg\n } as Cfg as any;\n}\n\nexport function not<const Operand extends TypedConfig>(\n operand: Operand\n): TypedConfig<ActNot<ExtractAction<Operand>>> {\n return {\n type: 'Not',\n operand\n } as Cfg as any;\n}\n\nexport function and<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(\n operand1: Operand1,\n operand2: Operand2\n): TypedConfig<ActAnd<ExtractAction<Operand1>, ExtractAction<Operand2>>> {\n return {\n type: 'And',\n operand1,\n operand2\n } as Cfg as any;\n}\n\nexport function or<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(\n operand1: Operand1,\n operand2: Operand2\n): TypedConfig<ActOr<ExtractAction<Operand1>, ExtractAction<Operand2>>> {\n return {\n type: 'Or',\n operand1,\n operand2\n } as Cfg as any;\n}\n\n//\n// Resources\n//\n\nexport function getResourceField<\n const Source extends PrimitiveOrConfig,\n const Field extends PrimitiveOrConfig\n>(\n source: Source,\n field: Field\n): TypedConfig<ActGetResourceField<POCExtractAction<Source>, POCExtractAction<Field>>> {\n return {\n type: 'GetResourceField',\n source: primitiveToConfig(source),\n field: primitiveToConfig(field)\n } as Cfg as any;\n}\n\nexport function getResourceValueAsJson<T>() {\n return function <const Source extends PrimitiveOrConfig>(\n source: Source\n ): TypedConfig<ActGetResourceValueAsJson<POCExtractAction<Source>, T>> {\n return {\n type: 'GetResourceValueAsJson',\n source: primitiveToConfig(source)\n } as Cfg as any;\n };\n}\n\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source,\n mapping: Mapping\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapResourceFields',\n source,\n mapping,\n itVar\n } as Cfg as TypedConfig<\n ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>\n >;\n}\n\n//\n// Download Blobs\n//\n\nexport function getBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getBlobContentAsString<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetBlobContentAsString<ExtractAction<Source>>> {\n return {\n type: 'GetBlobContentAsString',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getBlobContentAsJson<T>() {\n return function <const Source extends TypedConfig>(\n source: Source\n ): TypedConfig<ActGetBlobContentAsJson<ExtractAction<Source>, T>> {\n return {\n type: 'GetBlobContentAsJson',\n source: primitiveToConfig(source)\n } as Cfg as any;\n };\n}\n\nexport function getDownloadedBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetDownloadedBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetDownloadedBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getOnDemandBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetOnDemandBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetOnDemandBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\n//\n// Upload Blobs\n//\n\nexport function getImportProgress<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActImportProgress<ExtractAction<Source>>> {\n return {\n type: 'GetImportProgress',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\n//\n// Logs\n//\n\nexport function getLastLogs<const Source extends TypedConfig>(\n source: Source,\n lines: number\n): TypedConfig<ActGetLastLogs<ExtractAction<Source>>> {\n return {\n type: 'GetLastLogs',\n source: primitiveToConfig(source),\n lines\n } as Cfg as any;\n}\n\nexport function getProgressLog<const Source extends TypedConfig>(\n source: Source,\n patternToSearch: string\n): TypedConfig<ActGetProgressLog<ExtractAction<Source>>> {\n return {\n type: 'GetProgressLog',\n source: primitiveToConfig(source),\n patternToSearch\n } as Cfg as any;\n}\n\nexport function getLogHandle<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetLogHandle<ExtractAction<Source>>> {\n return {\n type: 'GetLogHandle',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n","import { Platforma, PlatformaFactory } from './platforma';\nimport { BlockConfig } from './builder';\nimport { FutureHandle, GlobalCfgRenderCtx } from './render/internal';\n\ndeclare global {\n /** Global factory method returning platforma instance */\n const getPlatforma: PlatformaFactory;\n const platforma: Platforma;\n\n /** Global rendering context, present only in rendering environment */\n const cfgRenderCtx: GlobalCfgRenderCtx;\n}\n\n/** Utility code helping to identify whether the code is running in actual UI environment */\nexport function isInUI() {\n return typeof getPlatforma !== 'undefined' || typeof platforma !== 'undefined';\n}\n\n/** Utility code helping to retrieve a platforma instance form the environment */\nexport function getPlatformaInstance(config: BlockConfig): Platforma {\n if (typeof getPlatforma === 'function') return getPlatforma(config);\n else if (typeof platforma !== 'undefined') return platforma;\n else throw new Error(\"Can't get platforma instance.\");\n}\n\nexport function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {\n if (typeof cfgRenderCtx !== 'undefined') return cfgRenderCtx;\n else return undefined;\n}\n\nexport function getCfgRenderCtx(): GlobalCfgRenderCtx {\n if (typeof cfgRenderCtx !== 'undefined') return 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","import { FutureAwait, FutureHandle } from './internal';\nimport { registerFutureAwait } from '../internal';\n\nexport class FutureRef<T = unknown> {\n private isResolved = false;\n private resolvedValue?: T;\n\n constructor(\n private readonly handle: FutureHandle,\n private readonly postProcess: (value: unknown) => T = (v) => v as T\n ) {\n registerFutureAwait(handle, (value) => {\n this.resolvedValue = postProcess(value);\n this.isResolved = true;\n });\n }\n\n public map<R>(mapping: (v: T) => R): FutureRef<R> {\n return new FutureRef<R>(this.handle, (v) => mapping(this.postProcess(v)));\n }\n\n public mapDefined<R>(mapping: (v: NonNullable<T>) => R): FutureRef<R | undefined> {\n return new FutureRef<R | undefined>(this.handle, (v) => {\n const vv = this.postProcess(v);\n return vv ? mapping(vv) : undefined;\n });\n }\n\n toJSON(): any {\n return this.isResolved\n ? this.resolvedValue\n : ({ __awaited_futures__: [this.handle] } as FutureAwait);\n }\n}\n\nexport type ExtractFutureRefType<Ref extends FutureRef> =\n Ref extends FutureRef<infer T> ? T : never;\n","import {\n AnyLogHandle,\n ImportProgress,\n LocalBlobHandleAndSize,\n PColumn,\n PObject,\n RemoteBlobHandleAndSize,\n isPColumn,\n mapPObjectData\n} from '@milaboratories/pl-model-common';\nimport { getCfgRenderCtx } from '../internal';\nimport { FutureRef } from './future';\nimport { AccessorHandle } from './internal';\nimport { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';\n\nfunction ifDef<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined {\n return value === undefined ? undefined : cb(value);\n}\n\nfunction wrapBuffer(buf: ArrayBuffer | undefined): Uint8Array | undefined {\n return buf === undefined ? undefined : new Uint8Array(buf);\n}\n\nfunction wrapAccessor(handle: AccessorHandle | undefined): TreeNodeAccessor | undefined {\n return handle === undefined ? undefined : new TreeNodeAccessor(handle);\n}\n\n/** Represent resource tree node accessor */\nexport class TreeNodeAccessor {\n constructor(public readonly handle: AccessorHandle) {}\n\n public resolve(\n ...steps: [\n Omit<FieldTraversalStep, 'errorIfFieldNotSet'> & {\n errorIfFieldNotAssigned: true;\n }\n ]\n ): TreeNodeAccessor;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n return this.resolveWithCommon({}, ...steps);\n }\n\n public resolveWithCommon(\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): TreeNodeAccessor | undefined {\n return wrapAccessor(getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps));\n }\n\n public get resourceType(): ResourceType {\n return getCfgRenderCtx().getResourceType(this.handle);\n }\n\n public getInputsLocked(): boolean {\n return getCfgRenderCtx().getInputsLocked(this.handle);\n }\n\n public getOutputsLocked(): boolean {\n return getCfgRenderCtx().getOutputsLocked(this.handle);\n }\n\n public getIsReadyOrError(): boolean {\n return getCfgRenderCtx().getIsReadyOrError(this.handle);\n }\n\n public getIsFinal(): boolean {\n return getCfgRenderCtx().getIsFinal(this.handle);\n }\n\n public getError(): TreeNodeAccessor | undefined {\n return wrapAccessor(getCfgRenderCtx().getError(this.handle));\n }\n\n public listInputFields(): string[] {\n return getCfgRenderCtx().listInputFields(this.handle);\n }\n\n public listOutputFields(): string[] {\n return getCfgRenderCtx().listOutputFields(this.handle);\n }\n\n public listDynamicFields(): string[] {\n return getCfgRenderCtx().listDynamicFields(this.handle);\n }\n\n public getKeyValueBase64(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueBase64(this.handle, key);\n }\n\n public getKeyValueAsString(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueAsString(this.handle, key);\n }\n\n public getKeyValueAsJson<T>(key: string): T {\n const content = this.getKeyValueAsString(key);\n if (content == undefined) throw new Error('Resource has no content.');\n return JSON.parse(content);\n }\n\n public getDataBase64(): string | undefined {\n return getCfgRenderCtx().getDataBase64(this.handle);\n }\n\n public getDataAsString(): string | undefined {\n return getCfgRenderCtx().getDataAsString(this.handle);\n }\n\n public getDataAsJson<T>(): T {\n const content = this.getDataAsString();\n if (content == undefined) throw new Error('Resource has no content.');\n return JSON.parse(content);\n }\n\n /**\n *\n */\n public getPColumns(\n errorOnUnknownField: boolean = false,\n prefix: string = ''\n ): PColumn<TreeNodeAccessor>[] | undefined {\n const result = this.parsePObjectCollection(errorOnUnknownField, prefix);\n if (result === undefined) return undefined;\n\n const pf = Object.entries(result).map(([, obj]) => {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n });\n\n return pf;\n }\n\n /**\n *\n */\n public parsePObjectCollection(\n errorOnUnknownField: boolean = false,\n prefix: string = ''\n ): Record<string, PObject<TreeNodeAccessor>> | undefined {\n const pObjects = getCfgRenderCtx().parsePObjectCollection(\n this.handle,\n errorOnUnknownField,\n prefix\n );\n if (pObjects === undefined) return undefined;\n const result: Record<string, PObject<TreeNodeAccessor>> = {};\n for (const [key, value] of Object.entries(pObjects))\n result[key] = mapPObjectData(value, (c) => new TreeNodeAccessor(c));\n return result;\n }\n\n public getFileContentAsBase64(): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsBase64(this.handle));\n }\n\n public getFileContentAsString(): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle));\n }\n\n public getFileContentAsJson<T>(): FutureRef<T | undefined> {\n return new FutureRef<string | undefined>(\n getCfgRenderCtx().getBlobContentAsString(this.handle)\n ).mapDefined((v) => JSON.parse(v) as T);\n }\n\n /**\n * @deprecated use getFileContentAsBase64\n */\n public getBlobContentAsBase64(): FutureRef<string | undefined> {\n return this.getFileContentAsBase64();\n }\n\n /**\n * @deprecated use getFileContentAsString\n */\n public getBlobContentAsString(): FutureRef<string | undefined> {\n return this.getFileContentAsString();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getFileHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getFileHandle\n */\n public getDownloadedBlobHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return this.getFileHandle();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getRemoteFileHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getRemoteFileHandle\n */\n public getOnDemandBlobHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return this.getRemoteFileHandle();\n }\n\n public getImportProgress(): FutureRef<ImportProgress> {\n return new FutureRef(getCfgRenderCtx().getImportProgress(this.handle));\n }\n\n public getLastLogs(nLines: number): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getLastLogs(this.handle, nLines));\n }\n\n public getProgressLog(patternToSearch: string): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));\n }\n\n public getLogHandle(): FutureRef<AnyLogHandle | undefined> {\n return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));\n }\n}\n","import { Optional } from 'utility-types';\nimport { Branded } from '../branding';\nimport { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';\nimport {\n Option,\n PColumn,\n PFrameDef,\n PFrameHandle,\n PObject,\n PObjectSpec,\n PSpecPredicate,\n PTableDef,\n PTableHandle,\n ResultCollection,\n ValueOrError\n} from '@milaboratories/pl-model-common';\n\nexport const StagingAccessorName = 'staging';\nexport const MainAccessorName = 'main';\n\nexport type AccessorHandle = Branded<string, 'AccessorHandle'>;\nexport type FutureHandle = Branded<string, 'FutureHandle'>;\n\nexport interface GlobalCfgRenderCtxMethods<AHandle = AccessorHandle, FHandle = FutureHandle> {\n //\n // Root accessor creation\n //\n\n getAccessorHandleByName(name: string): AHandle | undefined;\n\n //\n // Basic resource accessor actions\n //\n\n resolveWithCommon(\n handle: AHandle,\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): AHandle | undefined;\n\n getResourceType(handle: AHandle): ResourceType;\n\n getInputsLocked(handle: AHandle): boolean;\n\n getOutputsLocked(handle: AHandle): boolean;\n\n getIsReadyOrError(handle: AHandle): boolean;\n\n getIsFinal(handle: AHandle): boolean;\n\n getError(handle: AHandle): AHandle | undefined;\n\n listInputFields(handle: AHandle): string[];\n\n listOutputFields(handle: AHandle): string[];\n\n listDynamicFields(handle: AHandle): string[];\n\n getKeyValueBase64(handle: AHandle, key: string): string | undefined;\n\n getKeyValueAsString(handle: AHandle, key: string): string | undefined;\n\n getDataBase64(handle: AHandle): string | undefined;\n\n getDataAsString(handle: AHandle): string | undefined;\n\n /** If not final returns undefined */\n parsePObjectCollection(\n handle: AHandle,\n errorOnUnknownField: boolean,\n prefix: string\n ): Record<string, PObject<AHandle>> | undefined;\n\n //\n // Blob\n //\n\n getBlobContentAsBase64(handle: AHandle): FHandle; // string | undefined\n\n getBlobContentAsString(handle: AHandle): FHandle; // string | undefined\n\n getDownloadedBlobContentHandle(handle: AHandle): FHandle; // LocalBlobHandleAndSize | undefined;\n\n getOnDemandBlobContentHandle(handle: AHandle): FHandle; // RemoteBlobHandleAndSize | undefined;\n\n //\n // Import progress\n //\n\n getImportProgress(handle: AHandle): FHandle; // ImportProgress;\n\n //\n // Logs\n //\n\n getLastLogs(handle: AHandle, nLines: number): FHandle; // string | undefined;\n\n getProgressLog(handle: AHandle, patternToSearch: string): FHandle; // string | undefined;\n\n getLogHandle(handle: AHandle): FHandle; // AnyLogHandle | undefined;\n\n //\n // Blocks\n //\n\n getBlockLabel(blockId: string): string;\n\n //\n // Result Pool\n //\n\n getDataFromResultPool(): ResultCollection<PObject<AHandle>>;\n\n getDataWithErrorsFromResultPool(): ResultCollection<\n Optional<PObject<ValueOrError<AHandle, string>>, 'id'>\n >;\n\n getSpecsFromResultPool(): ResultCollection<PObjectSpec>;\n\n calculateOptions(predicate: PSpecPredicate): Option[];\n\n //\n // PFrame / PTable\n //\n\n createPFrame(def: PFrameDef<AHandle>): PFrameHandle;\n\n createPTable(def: PTableDef<PColumn<AHandle>>): PTableHandle;\n}\n\nexport interface GlobalCfgRenderCtx extends GlobalCfgRenderCtxMethods {\n readonly args: string;\n readonly uiState?: string;\n readonly callbackRegistry: Record<string, Function>;\n}\n\nexport type FutureAwait = {\n __awaited_futures__: FutureHandle[];\n};\n\nexport function isFutureAwait(obj: unknown): obj is FutureAwait {\n return typeof obj === 'object' && obj !== null && '__awaited_futures__' in obj;\n}\n\nfunction addAllFutureAwaits(set: Set<string>, visited: Set<unknown>, node: unknown) {\n if (visited.has(node)) return;\n visited.add(node);\n\n const type = typeof node;\n if (type === 'object') {\n if (isFutureAwait(node)) node.__awaited_futures__.forEach((a) => set.add(a));\n else if (Array.isArray(node))\n for (const nested of node) addAllFutureAwaits(set, visited, nested);\n else\n for (const [, nested] of Object.entries(node as object))\n if (nested !== node) addAllFutureAwaits(set, visited, nested);\n }\n}\n\nexport function getAllFutureAwaits(obj: unknown): Set<string> {\n const set = new Set<string>();\n addAllFutureAwaits(set, new Set(), obj);\n return set;\n}\n","import {\n Option,\n PColumn,\n PFrameDef,\n PFrameHandle,\n PObject,\n PObjectSpec,\n PSpecPredicate,\n PTableDef,\n PTableHandle,\n PTableRecordFilter,\n PTableSorting,\n ResultCollection,\n ValueOrError,\n mapPObjectData,\n mapPTableDef,\n mapValueInVOE\n} from '@milaboratories/pl-model-common';\nimport { Optional } from 'utility-types';\nimport { getCfgRenderCtx } from '../internal';\nimport { TreeNodeAccessor } from './accessor';\nimport { FutureRef } from './future';\nimport { GlobalCfgRenderCtx, MainAccessorName, StagingAccessorName } from './internal';\n\nexport class ResultPool {\n private readonly ctx: GlobalCfgRenderCtx = getCfgRenderCtx();\n\n public calculateOptions(predicate: PSpecPredicate): Option[] {\n return this.ctx.calculateOptions(predicate);\n }\n\n public getDataFromResultPool(): ResultCollection<PObject<TreeNodeAccessor>> {\n const result = this.ctx.getDataFromResultPool();\n return {\n isComplete: result.isComplete,\n entries: result.entries.map((e) => ({\n ref: e.ref,\n obj: {\n ...e.obj,\n data: new TreeNodeAccessor(e.obj.data)\n }\n }))\n };\n }\n\n public getDataWithErrorsFromResultPool(): ResultCollection<\n Optional<PObject<ValueOrError<TreeNodeAccessor, string>>, 'id'>\n > {\n const result = this.ctx.getDataWithErrorsFromResultPool();\n return {\n isComplete: result.isComplete,\n entries: result.entries.map((e) => ({\n ref: e.ref,\n obj: {\n ...e.obj,\n data: mapValueInVOE(e.obj.data, (handle) => new TreeNodeAccessor(handle))\n }\n }))\n };\n }\n\n public getSpecsFromResultPool(): ResultCollection<PObjectSpec> {\n return this.ctx.getSpecsFromResultPool();\n }\n}\n\nexport class RenderCtx<Args, UiState> {\n private readonly ctx: GlobalCfgRenderCtx;\n\n public readonly args: Args;\n public readonly uiState: UiState | undefined;\n\n constructor() {\n this.ctx = getCfgRenderCtx();\n this.args = JSON.parse(this.ctx.args);\n this.uiState = this.ctx.uiState !== undefined ? JSON.parse(this.ctx.uiState) : undefined;\n }\n\n private getNamedAccessor(name: string): TreeNodeAccessor | undefined {\n const accessorId = this.ctx.getAccessorHandleByName(name);\n return accessorId ? new TreeNodeAccessor(accessorId) : undefined;\n }\n\n public get prerun(): TreeNodeAccessor | undefined {\n return this.getNamedAccessor(StagingAccessorName);\n }\n\n /**\n * @deprecated use prerun\n */\n public get precalc(): TreeNodeAccessor | undefined {\n return this.prerun;\n }\n\n /**\n * @deprecated use prerun\n */\n public get stagingOutput(): TreeNodeAccessor | undefined {\n return this.precalc;\n }\n\n public get outputs(): TreeNodeAccessor | undefined {\n return this.getNamedAccessor(MainAccessorName);\n }\n\n /**\n * @deprecated use outputs\n */\n public get mainOutput(): TreeNodeAccessor | undefined {\n return this.outputs;\n }\n\n public readonly resultPool = new ResultPool();\n\n public createPFrame(def: PFrameDef<TreeNodeAccessor>): PFrameHandle {\n return this.ctx.createPFrame(def.map((c) => mapPObjectData(c, (d) => d.handle)));\n }\n\n public createPTable(def: PTableDef<PColumn<TreeNodeAccessor>>): PTableHandle;\n public createPTable(def: {\n columns: PColumn<TreeNodeAccessor>[];\n filters?: PTableRecordFilter[];\n /** Table sorting */\n sorting?: PTableSorting[];\n }): PTableHandle;\n public createPTable(\n def:\n | PTableDef<PColumn<TreeNodeAccessor>>\n | {\n columns: PColumn<TreeNodeAccessor>[];\n filters?: PTableRecordFilter[];\n /** Table sorting */\n sorting?: PTableSorting[];\n }\n ): PTableHandle {\n var rawDef: PTableDef<PColumn<TreeNodeAccessor>>;\n if ('columns' in def) {\n rawDef = {\n src: {\n type: 'inner',\n entries: def.columns.map((c) => ({ type: 'column', column: c }))\n },\n filters: def.filters ?? [],\n sorting: def.sorting ?? []\n };\n } else {\n rawDef = def;\n }\n return this.ctx.createPTable(mapPTableDef(rawDef, (po) => mapPObjectData(po, (d) => d.handle)));\n }\n\n public getBlockLabel(blockId: string): string {\n return this.ctx.getBlockLabel(blockId);\n }\n}\n\nexport type RenderFunction<Args = unknown, UiState = unknown, Ret = unknown> = (\n rCtx: RenderCtx<Args, UiState>\n) => Ret;\n\nexport type UnwrapFutureRef<K> =\n K extends FutureRef<infer T>\n ? T\n : K extends bigint | boolean | null | number | string | symbol | undefined\n ? K\n : { [key in keyof K]: UnwrapFutureRef<K[key]> };\n\nexport type InferRenderFunctionReturn<RF extends Function> = RF extends (...args: any) => infer R\n ? UnwrapFutureRef<R>\n : never;\n","export const PlatformaSDKVersion = '1.2.28';\n","import { BlockRenderingMode, BlockSection, ValueOrErrors } from '@milaboratories/pl-model-common';\nimport { Checked, ConfigResult, getImmediate, PlResourceEntry, TypedConfig } from './config';\nimport { getPlatformaInstance, isInUI, tryRegisterCallback } from './internal';\nimport { Platforma } from './platforma';\nimport { InferRenderFunctionReturn, RenderCtx, RenderFunction } from './render';\nimport { PlatformaSDKVersion } from './version';\n\ntype StdCtxArgsOnly<Args, UiState = undefined> = {\n readonly $blockId: string;\n readonly $args: Args;\n readonly $ui: UiState;\n};\n\nexport type StdCtx<Args, UiState = undefined> = StdCtxArgsOnly<Args, UiState> & {\n readonly $prod: PlResourceEntry;\n readonly $staging: PlResourceEntry;\n};\n\nexport type ResolveCfgType<Cfg extends TypedConfig, Args, UiState = undefined> = ConfigResult<\n Cfg,\n StdCtx<Args, UiState>\n>;\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 SectionsRFChecked<RF extends Function> = Checked<\n RF,\n InferRenderFunctionReturn<RF> 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 InputsValidRFChecked<RF extends Function> = Checked<\n RF,\n InferRenderFunctionReturn<RF> extends InputsValidExpectedType ? true : false\n>;\n\nexport type Code = {\n type: 'plain';\n content: string;\n};\n\n/** Field key to attach ConfAction information to a config type. */\ndeclare const __function_handle__: unique symbol;\n\n/** Creates branded Cfg type */\nexport type FunctionHandle<Return = unknown> = string & { [__function_handle__]: Return };\n\nexport type ExtractFunctionHandleReturn<Func extends FunctionHandle> =\n Func[typeof __function_handle__];\n\nexport type TypedConfigOrFunctionHandle = TypedConfig | FunctionHandle;\n\nexport function isFunctionHandle(cfgOrFh: TypedConfigOrFunctionHandle): cfgOrFh is FunctionHandle {\n return typeof cfgOrFh === 'string';\n}\n\ntype OnlyString<S> = S extends string ? S : '';\n\n// prettier-ignore\nexport type DeriveHref<S> = S extends readonly BlockSection[]\n ? OnlyString<Extract<S[number], { type: 'link' }>['href']>\n : never;\n\n/** This structure is rendered from the configuration, type can accommodate any\n * version of config structure. */\nexport type BlockConfigUniversal<\n Args = unknown,\n Outputs extends Record<string, TypedConfigOrFunctionHandle> = Record<\n string,\n TypedConfigOrFunctionHandle\n >\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** @deprecated */\n readonly canRun?: TypedConfigOrFunctionHandle;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n * */\n readonly inputsValid?: TypedConfigOrFunctionHandle;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: TypedConfigOrFunctionHandle;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n};\n\n/** This structure is rendered from the configuration */\nexport type BlockConfig<\n Args = unknown,\n Outputs extends Record<string, TypedConfigOrFunctionHandle> = Record<\n string,\n TypedConfigOrFunctionHandle\n >\n> = Required<Omit<BlockConfigUniversal<Args, Outputs>, 'canRun' | 'code'>> &\n Pick<BlockConfigUniversal<Args, Outputs>, 'code'>;\n\n/** Takes universal config, and converts it into latest structure */\nexport function normalizeBlockConfig<\n Args,\n Outputs extends Record<string, TypedConfigOrFunctionHandle>\n>(cfg: BlockConfigUniversal<Args, Outputs>): BlockConfig<Args, Outputs> {\n if (cfg.inputsValid !== undefined) return cfg as BlockConfig<Args, Outputs>;\n else {\n if (cfg.canRun === undefined)\n throw new Error(`Malformed config, SDK version ${cfg.sdkVersion}`);\n const latest = { ...cfg, inputsValid: cfg.canRun };\n delete latest['canRun'];\n return latest;\n }\n}\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, TypedConfigOrFunctionHandle>,\n UiState,\n Href extends `/${string}` = '/'\n> {\n private constructor(\n private readonly _renderingMode: BlockRenderingMode,\n private readonly _initialArgs: Args | undefined,\n private readonly _outputs: OutputsCfg,\n private readonly _inputsValid: TypedConfigOrFunctionHandle,\n private readonly _sections: TypedConfigOrFunctionHandle\n ) { }\n\n /** Initiates configuration builder */\n public static create<Args, UiState = undefined>(\n renderingMode: BlockRenderingMode = 'Heavy'\n ): BlockModel<Args, {}, UiState> {\n return new BlockModel<Args, {}, UiState>(\n renderingMode,\n undefined,\n {},\n getImmediate(true),\n getImmediate([])\n );\n }\n\n /**\n * Add output cell to the configuration\n *\n * @param key cell name, that can be used to retrieve the rendered value\n * @param cfg configuration describing how to render cell value from the blocks\n * workflow outputs\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 public output<const Key extends string, const RF extends RenderFunction<Args, UiState>>(\n key: Key,\n rf: RF\n ): BlockModel<\n Args,\n OutputsCfg & { [K in Key]: FunctionHandle<InferRenderFunctionReturn<RF>> },\n UiState,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n if (typeof cfgOrRf === 'function') {\n const functionHandle = `output#${key}` as FunctionHandle;\n tryRegisterCallback(functionHandle, () => cfgOrRf(new RenderCtx()));\n return new BlockModel(\n this._renderingMode,\n this._initialArgs,\n {\n ...this._outputs,\n [key]: functionHandle\n },\n this._inputsValid,\n this._sections\n );\n } else\n return new BlockModel(\n this._renderingMode,\n this._initialArgs,\n {\n ...this._outputs,\n [key]: cfgOrRf\n },\n this._inputsValid,\n this._sections\n );\n }\n\n /** @deprecated */\n public canRun<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return this.inputsValid(cfg as any);\n }\n\n /** Sets custom configuration predicate on the block args at which block can be executed */\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 RenderFunction<Args, UiState, boolean>>(\n rf: RF\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public argsValid(\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (typeof cfgOrRf === 'function') {\n tryRegisterCallback('inputsValid', () => cfgOrRf(new RenderCtx()));\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n 'inputsValid' as FunctionHandle,\n this._sections\n );\n } else\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n cfgOrRf,\n this._sections\n );\n }\n\n /** @deprecated use argsValid() */\n public inputsValid<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n /** @deprecated use argsValid() */\n public inputsValid<RF extends RenderFunction<Args, UiState, boolean>>(\n rf: RF\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public inputsValid(\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n return this.argsValid(cfgOrRf as any);\n }\n\n /** Sets the config to generate list of section in the left block overviews panel */\n public sections<const S extends SectionsExpectedType,>(rf: S): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunction<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 | Function\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 RenderCtx()));\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n this._inputsValid,\n 'sections' as FunctionHandle\n );\n } else\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n this._inputsValid,\n arrOrCfgOrRf as TypedConfig\n );\n }\n\n\n /** Sets initial args for the block, this value must be specified. */\n public initialArgs(value: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>(\n this._renderingMode,\n value,\n this._outputs,\n this._inputsValid,\n this._sections\n );\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(): Platforma<\n Args,\n InferOutputsFromConfigs<Args, OutputsCfg, UiState>,\n UiState,\n Href\n > {\n if (this._initialArgs === undefined) throw new Error('Initial arguments not set.');\n\n const config: BlockConfig<Args, OutputsCfg> = {\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this._renderingMode,\n initialArgs: this._initialArgs,\n inputsValid: this._inputsValid,\n sections: this._sections,\n outputs: this._outputs\n };\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 return getPlatformaInstance(config) as any;\n }\n}\n\nexport type InferOutputType<CfgOrFH, Args, UiState> = CfgOrFH extends TypedConfig\n ? ResolveCfgType<CfgOrFH, Args, UiState>\n : CfgOrFH extends FunctionHandle\n ? ExtractFunctionHandleReturn<CfgOrFH>\n : never;\n\ntype InferOutputsFromConfigs<\n Args,\n OutputsCfg extends Record<string, TypedConfigOrFunctionHandle>,\n UiState\n> = {\n [Key in keyof OutputsCfg]: ValueOrErrors<InferOutputType<OutputsCfg[Key], Args, UiState>>;\n};\n","import {\n CalculateTableDataRequest,\n CalculateTableDataResponse,\n FindColumnsRequest,\n FindColumnsResponse,\n PColumnIdAndSpec,\n PColumnSpec,\n PFrame,\n PFrameHandle,\n PObjectId,\n UniqueValuesRequest,\n UniqueValuesResponse\n} from '@milaboratories/pl-model-common';\n\nexport class PFrameImpl implements PFrame {\n constructor(private readonly handle: PFrameHandle) {}\n\n public async findColumns(request: FindColumnsRequest): Promise<FindColumnsResponse> {\n return await platforma.pFrameDriver.findColumns(this.handle, request);\n }\n\n public async getColumnSpec(columnId: PObjectId): Promise<PColumnSpec> {\n return await platforma.pFrameDriver.getColumnSpec(this.handle, columnId);\n }\n\n public async listColumns(): Promise<PColumnIdAndSpec[]> {\n return await platforma.pFrameDriver.listColumns(this.handle);\n }\n\n public async calculateTableData(\n request: CalculateTableDataRequest<PObjectId>\n ): Promise<CalculateTableDataResponse> {\n return await platforma.pFrameDriver.calculateTableData(this.handle, request);\n }\n\n public async getUniqueValues(request: UniqueValuesRequest): Promise<UniqueValuesResponse> {\n return await platforma.pFrameDriver.getUniqueValues(this.handle, request);\n }\n}\n","import { getJsonField, makeObject, TypedConfig } from './config';\n\nexport function fromPlRef<Source extends TypedConfig>(source: Source) {\n return makeObject({\n __isRef: true,\n blockId: getJsonField(source, 'blockId'),\n name: getJsonField(source, 'name')\n });\n}\n\nexport function fromPlOption<Source extends TypedConfig>(source: Source) {\n return makeObject({\n ref: fromPlRef(getJsonField(source, 'ref')),\n label: getJsonField(source, 'label')\n });\n}\n","import { PlatformaSDKVersion } from './version';\n\nexport type SdkInfo = {\n readonly sdkVersion: string;\n};\n\nexport const CurrentSdkInfo: SdkInfo = {\n sdkVersion: PlatformaSDKVersion\n};\n"],"names":["OutputError","errors","moreErrors","readOutput","outputValue","wrapOutputs","outputs","target","key","primitiveToConfig","value","getImmediate","getFromCfg","variable","isolate","cfg","Args","It","MainOutputs","StagingOutputs","UiState","makeObject","template","normalizedTemplate","k","makeArray","getJsonField","source","field","mapRecordValues","mapping","itVar","mapArrayValues","flatten","isEmpty","arg","not","operand","and","operand1","operand2","or","getResourceField","getResourceValueAsJson","mapResourceFields","getBlobContent","getBlobContentAsString","getBlobContentAsJson","getDownloadedBlobContent","getOnDemandBlobContent","getImportProgress","getLastLogs","lines","getProgressLog","patternToSearch","getLogHandle","isInUI","getPlatformaInstance","config","tryGetCfgRenderCtx","getCfgRenderCtx","tryRegisterCallback","callback","ctx","futureResolves","registerFutureAwait","handle","onResolve","res","FutureRef","postProcess","v","__publicField","vv","wrapAccessor","TreeNodeAccessor","steps","commonOptions","content","errorOnUnknownField","prefix","result","obj","isPColumn","pObjects","mapPObjectData","c","nLines","StagingAccessorName","MainAccessorName","isFutureAwait","addAllFutureAwaits","set","visited","node","a","nested","getAllFutureAwaits","ResultPool","predicate","e","mapValueInVOE","RenderCtx","name","accessorId","def","d","rawDef","mapPTableDef","po","blockId","PlatformaSDKVersion","isFunctionHandle","cfgOrFh","normalizeBlockConfig","latest","BlockModel","_renderingMode","_initialArgs","_outputs","_inputsValid","_sections","renderingMode","cfgOrRf","functionHandle","arrOrCfgOrRf","PFrameImpl","request","columnId","fromPlRef","fromPlOption","CurrentSdkInfo"],"mappings":";;;;;AAEO,MAAMA,UAAoB,MAAM;AAAA,EACrC,YACkBC,GACAC,GAChB;AACM,UAAA,GAAGD,EAAO,MAAM,GAAGC,IAAa,MAAM,EAAE,2BAA2BD,EAAO,CAAC,CAAC,GAHlE,KAAA,SAAAA,GACA,KAAA,aAAAC;AAAA,EAGlB;AACF;AAEO,SAASC,EAAcC,GAAkC;AAC1D,MAAA,CAACA,EAAY,GAAI,OAAM,IAAIJ,EAAYI,EAAY,QAAQA,EAAY,UAAU;AACrF,SAAOA,EAAY;AACrB;AAOO,SAASC,EACdC,GACwB;AACjB,SAAA,IAAI,MAAMA,GAAS;AAAA,IACxB,IAAIC,GAAQC,GAAa;AAChB,aAAAL,EAAWI,EAAOC,CAAG,CAAC;AAAA,IAC/B;AAAA,EAAA,CACD;AACH;ACMA,SAASC,EAAkBC,GAAuC;AAE9D,SAAA,OAAOA,KAAU,YACjB,OAAOA,KAAU,YACjB,OAAOA,KAAU,aACjBA,MAAU,OAEHC,EAAaD,CAAK,IACfA;AACd;AAMO,SAASE,EAAmCC,GAA4C;AACtF,SAAA,EAAE,MAAM,cAAc,UAAAA;AAC/B;AAMO,SAASC,EACdC,GACgD;AACzC,SAAA;AAAA,IACL,MAAM;AAAA,IACN,KAAAA;AAAA,EAAA;AAEJ;AAMa,MAA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SAAON,EAAW;AAAA,IAChB,SAAS;AAAA,IACT,SAASK,EAAaC,GAAQ,SAAS;AAAA,IACvC,MAAMD,EAAaC,GAAQ,MAAM;AAAA,EAAA,CAClC;AACH;AAEO,SAASuG,GAAyCvG,GAAgB;AACvE,SAAON,EAAW;AAAA,IAChB,KAAK4G,EAAUvG,EAAaC,GAAQ,KAAK,CAAC;AAAA,IAC1C,OAAOD,EAAaC,GAAQ,OAAO;AAAA,EAAA,CACpC;AACH;ACTO,MAAMwG,KAA0B;AAAA,EACrC,YAAYpB;AACd;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/block_state_util.ts","../src/config/actions.ts","../src/internal.ts","../src/render/future.ts","../src/render/accessor.ts","../src/render/internal.ts","../src/render/api.ts","../src/version.ts","../src/builder.ts","../src/pframe.ts","../src/ref_util.ts","../src/sdk_info.ts","../src/env_value.ts"],"sourcesContent":["import { BlockOutputsBase, ValueOrErrors } from '@milaboratories/pl-model-common';\n\nexport class OutputError extends Error {\n constructor(\n public readonly errors: string[],\n public readonly moreErrors: boolean\n ) {\n super(`${errors.length}${moreErrors ? '+' : ''} errors, first error: ` + errors[0]);\n }\n}\n\nexport function readOutput<T>(outputValue: ValueOrErrors<T>): T {\n if (!outputValue.ok) throw new OutputError(outputValue.errors, outputValue.moreErrors);\n return outputValue.value;\n}\n\ntype ExtractValueType<V extends ValueOrErrors<unknown>> = Extract<V, { ok: true }>['value'];\ntype SimpleOutputs<Outputs extends BlockOutputsBase> = {\n [Key in keyof Outputs]: ExtractValueType<Outputs[Key]>;\n};\n\nexport function wrapOutputs<Outputs extends BlockOutputsBase>(\n outputs: Outputs\n): SimpleOutputs<Outputs> {\n return new Proxy(outputs, {\n get(target, key: string) {\n return readOutput(target[key]);\n }\n }) as SimpleOutputs<Outputs>;\n}\n","import {\n ActGetField,\n ActGetFromCtx,\n ActGetImmediate,\n ActGetResourceField,\n ActGetResourceValueAsJson,\n ActMakeObject,\n ActMapRecordValues,\n ActMapResourceFields,\n ActMapArrayValues,\n ActIsEmpty,\n ActNot,\n ActIsolate,\n ActGetBlobContentAsJson,\n ActGetBlobContentAsString,\n ActGetBlobContent,\n ActAnd,\n ActOr,\n ActMakeArray,\n ActFlatten,\n ActGetDownloadedBlobContent,\n ActGetOnDemandBlobContent,\n ActImportProgress,\n ActGetLastLogs,\n ActGetProgressLog,\n ActGetLogHandle\n} from './actions_kinds';\nimport { ExtractAction, POCExtractAction, PrimitiveOrConfig, TypedConfig } from './type_engine';\nimport { Cfg } from './model';\nimport { CheckedSyncConf } from './type_util';\n\n//\n// Helpers\n//\n\nfunction primitiveToConfig(value: PrimitiveOrConfig): TypedConfig {\n if (\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean' ||\n value === null\n )\n return getImmediate(value);\n else return value as TypedConfig;\n}\n\n//\n// Context\n//\n\nexport function getFromCfg<const V extends string>(variable: V): TypedConfig<ActGetFromCtx<V>> {\n return { type: 'GetFromCtx', variable } as Cfg as any;\n}\n\n//\n// Isolate\n//\n\nexport function isolate<const Config extends TypedConfig>(\n cfg: Config\n): TypedConfig<ActIsolate<ExtractAction<Config>>> {\n return {\n type: 'Isolate',\n cfg\n } as Cfg as any;\n}\n\n//\n// Well-known Context Vars\n//\n\nexport const Args = getFromCfg('$args');\nexport const It = getFromCfg('$it');\nexport const MainOutputs = getFromCfg('$prod');\nexport const StagingOutputs = getFromCfg('$staging');\nexport const UiState = getFromCfg('$ui');\n\n//\n// Json\n//\n\nexport function getImmediate<const T>(value: T): TypedConfig<ActGetImmediate<T>> {\n return { type: 'Immediate', value } as Cfg as any;\n}\n\nexport function makeObject<const T extends Record<string, PrimitiveOrConfig>>(\n template: T\n): TypedConfig<ActMakeObject<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {\n const normalizedTemplate: Record<string, TypedConfig> = {};\n for (const [k, cfg] of Object.entries(template)) normalizedTemplate[k] = primitiveToConfig(cfg);\n return {\n type: 'MakeObject',\n template: normalizedTemplate\n } as Cfg as any;\n}\n\nexport function makeArray<const T extends PrimitiveOrConfig[]>(\n ...template: T\n): TypedConfig<ActMakeArray<{ [Key in keyof T]: POCExtractAction<T[Key]> }>> {\n const normalizedTemplate: TypedConfig[] = [];\n for (const cfg of template) normalizedTemplate.push(primitiveToConfig(cfg));\n return {\n type: 'MakeArray',\n template: normalizedTemplate\n } as Cfg as any;\n}\n\nexport function getJsonField<\n const Source extends PrimitiveOrConfig,\n const Field extends PrimitiveOrConfig\n>(\n source: Source,\n field: Field\n): TypedConfig<ActGetField<POCExtractAction<Source>, POCExtractAction<Field>>> {\n return {\n type: 'GetJsonField',\n source: primitiveToConfig(source),\n field: primitiveToConfig(field)\n } as Cfg as any;\n}\n\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>,\n itVar: ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapRecordValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapRecordValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapRecordValues',\n source,\n mapping,\n itVar\n } as Cfg as any;\n}\n\nexport function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapArrayValues<const Source extends TypedConfig, const Mapping extends TypedConfig>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source & CheckedSyncConf<Source>,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping & CheckedSyncConf<Mapping>,\n itVar: ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapArrayValues<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapArrayValues<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapArrayValues',\n source,\n mapping,\n itVar\n } as Cfg as any;\n}\n\nexport function flatten<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActFlatten<ExtractAction<Source>>> {\n return {\n type: 'Flatten',\n source\n } as Cfg as any;\n}\n\n//\n// Boolean\n//\n\nexport function isEmpty<const Arg extends TypedConfig>(\n arg: Arg\n): TypedConfig<ActIsEmpty<ExtractAction<Arg>>> {\n return {\n type: 'IsEmpty',\n arg\n } as Cfg as any;\n}\n\nexport function not<const Operand extends TypedConfig>(\n operand: Operand\n): TypedConfig<ActNot<ExtractAction<Operand>>> {\n return {\n type: 'Not',\n operand\n } as Cfg as any;\n}\n\nexport function and<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(\n operand1: Operand1,\n operand2: Operand2\n): TypedConfig<ActAnd<ExtractAction<Operand1>, ExtractAction<Operand2>>> {\n return {\n type: 'And',\n operand1,\n operand2\n } as Cfg as any;\n}\n\nexport function or<const Operand1 extends TypedConfig, const Operand2 extends TypedConfig>(\n operand1: Operand1,\n operand2: Operand2\n): TypedConfig<ActOr<ExtractAction<Operand1>, ExtractAction<Operand2>>> {\n return {\n type: 'Or',\n operand1,\n operand2\n } as Cfg as any;\n}\n\n//\n// Resources\n//\n\nexport function getResourceField<\n const Source extends PrimitiveOrConfig,\n const Field extends PrimitiveOrConfig\n>(\n source: Source,\n field: Field\n): TypedConfig<ActGetResourceField<POCExtractAction<Source>, POCExtractAction<Field>>> {\n return {\n type: 'GetResourceField',\n source: primitiveToConfig(source),\n field: primitiveToConfig(field)\n } as Cfg as any;\n}\n\nexport function getResourceValueAsJson<T>() {\n return function <const Source extends PrimitiveOrConfig>(\n source: Source\n ): TypedConfig<ActGetResourceValueAsJson<POCExtractAction<Source>, T>> {\n return {\n type: 'GetResourceValueAsJson',\n source: primitiveToConfig(source)\n } as Cfg as any;\n };\n}\n\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig\n>(\n source: Source,\n mapping: Mapping\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, '$it'>>;\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>>;\nexport function mapResourceFields<\n const Source extends TypedConfig,\n const Mapping extends TypedConfig,\n const ItVar extends string\n>(\n source: Source,\n mapping: Mapping,\n itVar: ItVar = '$it' as ItVar\n): TypedConfig<ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>> {\n return {\n type: 'MapResourceFields',\n source,\n mapping,\n itVar\n } as Cfg as TypedConfig<\n ActMapResourceFields<ExtractAction<Source>, ExtractAction<Mapping>, ItVar>\n >;\n}\n\n//\n// Download Blobs\n//\n\nexport function getBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getBlobContentAsString<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetBlobContentAsString<ExtractAction<Source>>> {\n return {\n type: 'GetBlobContentAsString',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getBlobContentAsJson<T>() {\n return function <const Source extends TypedConfig>(\n source: Source\n ): TypedConfig<ActGetBlobContentAsJson<ExtractAction<Source>, T>> {\n return {\n type: 'GetBlobContentAsJson',\n source: primitiveToConfig(source)\n } as Cfg as any;\n };\n}\n\nexport function getDownloadedBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetDownloadedBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetDownloadedBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\nexport function getOnDemandBlobContent<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetOnDemandBlobContent<ExtractAction<Source>>> {\n return {\n type: 'GetOnDemandBlobContent',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\n//\n// Upload Blobs\n//\n\nexport function getImportProgress<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActImportProgress<ExtractAction<Source>>> {\n return {\n type: 'GetImportProgress',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n\n//\n// Logs\n//\n\nexport function getLastLogs<const Source extends TypedConfig>(\n source: Source,\n lines: number\n): TypedConfig<ActGetLastLogs<ExtractAction<Source>>> {\n return {\n type: 'GetLastLogs',\n source: primitiveToConfig(source),\n lines\n } as Cfg as any;\n}\n\nexport function getProgressLog<const Source extends TypedConfig>(\n source: Source,\n patternToSearch: string\n): TypedConfig<ActGetProgressLog<ExtractAction<Source>>> {\n return {\n type: 'GetProgressLog',\n source: primitiveToConfig(source),\n patternToSearch\n } as Cfg as any;\n}\n\nexport function getLogHandle<const Source extends TypedConfig>(\n source: Source\n): TypedConfig<ActGetLogHandle<ExtractAction<Source>>> {\n return {\n type: 'GetLogHandle',\n source: primitiveToConfig(source)\n } as Cfg as any;\n}\n","import { Platforma, PlatformaFactory } from './platforma';\nimport { BlockConfig } from './builder';\nimport { FutureHandle, GlobalCfgRenderCtx } from './render/internal';\n\ndeclare global {\n /** Global factory method returning platforma instance */\n const getPlatforma: PlatformaFactory;\n const platforma: Platforma;\n\n /** Global rendering context, present only in rendering environment */\n const cfgRenderCtx: GlobalCfgRenderCtx;\n}\n\n/** Utility code helping to identify whether the code is running in actual UI environment */\nexport function isInUI() {\n return typeof getPlatforma !== 'undefined' || typeof platforma !== 'undefined';\n}\n\n/** Utility code helping to retrieve a platforma instance form the environment */\nexport function getPlatformaInstance(config: BlockConfig): Platforma {\n if (typeof getPlatforma === 'function') return getPlatforma(config);\n else if (typeof platforma !== 'undefined') return platforma;\n else throw new Error(\"Can't get platforma instance.\");\n}\n\nexport function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {\n if (typeof cfgRenderCtx !== 'undefined') return cfgRenderCtx;\n else return undefined;\n}\n\nexport function getCfgRenderCtx(): GlobalCfgRenderCtx {\n if (typeof cfgRenderCtx !== 'undefined') return 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","import { FutureAwait, FutureHandle } from './internal';\nimport { registerFutureAwait } from '../internal';\n\nexport class FutureRef<T = unknown> {\n private isResolved = false;\n private resolvedValue?: T;\n\n constructor(\n private readonly handle: FutureHandle,\n private readonly postProcess: (value: unknown) => T = (v) => v as T\n ) {\n registerFutureAwait(handle, (value) => {\n this.resolvedValue = postProcess(value);\n this.isResolved = true;\n });\n }\n\n public map<R>(mapping: (v: T) => R): FutureRef<R> {\n return new FutureRef<R>(this.handle, (v) => mapping(this.postProcess(v)));\n }\n\n public mapDefined<R>(mapping: (v: NonNullable<T>) => R): FutureRef<R | undefined> {\n return new FutureRef<R | undefined>(this.handle, (v) => {\n const vv = this.postProcess(v);\n return vv ? mapping(vv) : undefined;\n });\n }\n\n toJSON(): any {\n return this.isResolved\n ? this.resolvedValue\n : ({ __awaited_futures__: [this.handle] } as FutureAwait);\n }\n}\n\nexport type ExtractFutureRefType<Ref extends FutureRef> =\n Ref extends FutureRef<infer T> ? T : never;\n","import {\n AnyLogHandle,\n ImportProgress,\n LocalBlobHandleAndSize,\n PColumn,\n PObject,\n RemoteBlobHandleAndSize,\n isPColumn,\n mapPObjectData\n} from '@milaboratories/pl-model-common';\nimport { getCfgRenderCtx } from '../internal';\nimport { FutureRef } from './future';\nimport { AccessorHandle } from './internal';\nimport { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';\n\nfunction ifDef<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined {\n return value === undefined ? undefined : cb(value);\n}\n\nfunction wrapBuffer(buf: ArrayBuffer | undefined): Uint8Array | undefined {\n return buf === undefined ? undefined : new Uint8Array(buf);\n}\n\nfunction wrapAccessor(handle: AccessorHandle | undefined): TreeNodeAccessor | undefined {\n return handle === undefined ? undefined : new TreeNodeAccessor(handle);\n}\n\n/** Represent resource tree node accessor */\nexport class TreeNodeAccessor {\n constructor(public readonly handle: AccessorHandle) {}\n\n public resolve(\n ...steps: [\n Omit<FieldTraversalStep, 'errorIfFieldNotSet'> & {\n errorIfFieldNotAssigned: true;\n }\n ]\n ): TreeNodeAccessor;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;\n public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {\n return this.resolveWithCommon({}, ...steps);\n }\n\n public resolveWithCommon(\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): TreeNodeAccessor | undefined {\n return wrapAccessor(getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps));\n }\n\n public get resourceType(): ResourceType {\n return getCfgRenderCtx().getResourceType(this.handle);\n }\n\n public getInputsLocked(): boolean {\n return getCfgRenderCtx().getInputsLocked(this.handle);\n }\n\n public getOutputsLocked(): boolean {\n return getCfgRenderCtx().getOutputsLocked(this.handle);\n }\n\n public getIsReadyOrError(): boolean {\n return getCfgRenderCtx().getIsReadyOrError(this.handle);\n }\n\n public getIsFinal(): boolean {\n return getCfgRenderCtx().getIsFinal(this.handle);\n }\n\n public getError(): TreeNodeAccessor | undefined {\n return wrapAccessor(getCfgRenderCtx().getError(this.handle));\n }\n\n public listInputFields(): string[] {\n return getCfgRenderCtx().listInputFields(this.handle);\n }\n\n public listOutputFields(): string[] {\n return getCfgRenderCtx().listOutputFields(this.handle);\n }\n\n public listDynamicFields(): string[] {\n return getCfgRenderCtx().listDynamicFields(this.handle);\n }\n\n public getKeyValueBase64(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueBase64(this.handle, key);\n }\n\n public getKeyValueAsString(key: string): string | undefined {\n return getCfgRenderCtx().getKeyValueAsString(this.handle, key);\n }\n\n public getKeyValueAsJson<T>(key: string): T {\n const content = this.getKeyValueAsString(key);\n if (content == undefined) throw new Error('Resource has no content.');\n return JSON.parse(content);\n }\n\n public getDataBase64(): string | undefined {\n return getCfgRenderCtx().getDataBase64(this.handle);\n }\n\n public getDataAsString(): string | undefined {\n return getCfgRenderCtx().getDataAsString(this.handle);\n }\n\n public getDataAsJson<T>(): T {\n const content = this.getDataAsString();\n if (content == undefined) throw new Error('Resource has no content.');\n return JSON.parse(content);\n }\n\n /**\n *\n */\n public getPColumns(\n errorOnUnknownField: boolean = false,\n prefix: string = ''\n ): PColumn<TreeNodeAccessor>[] | undefined {\n const result = this.parsePObjectCollection(errorOnUnknownField, prefix);\n if (result === undefined) return undefined;\n\n const pf = Object.entries(result).map(([, obj]) => {\n if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);\n return obj;\n });\n\n return pf;\n }\n\n /**\n *\n */\n public parsePObjectCollection(\n errorOnUnknownField: boolean = false,\n prefix: string = ''\n ): Record<string, PObject<TreeNodeAccessor>> | undefined {\n const pObjects = getCfgRenderCtx().parsePObjectCollection(\n this.handle,\n errorOnUnknownField,\n prefix\n );\n if (pObjects === undefined) return undefined;\n const result: Record<string, PObject<TreeNodeAccessor>> = {};\n for (const [key, value] of Object.entries(pObjects))\n result[key] = mapPObjectData(value, (c) => new TreeNodeAccessor(c));\n return result;\n }\n\n public getFileContentAsBase64(): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsBase64(this.handle));\n }\n\n public getFileContentAsString(): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle));\n }\n\n public getFileContentAsJson<T>(): FutureRef<T | undefined> {\n return new FutureRef<string | undefined>(\n getCfgRenderCtx().getBlobContentAsString(this.handle)\n ).mapDefined((v) => JSON.parse(v) as T);\n }\n\n /**\n * @deprecated use getFileContentAsBase64\n */\n public getBlobContentAsBase64(): FutureRef<string | undefined> {\n return this.getFileContentAsBase64();\n }\n\n /**\n * @deprecated use getFileContentAsString\n */\n public getBlobContentAsString(): FutureRef<string | undefined> {\n return this.getFileContentAsString();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getFileHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getFileHandle\n */\n public getDownloadedBlobHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {\n return this.getFileHandle();\n }\n\n /**\n * @returns downloaded file handle\n */\n public getRemoteFileHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return new FutureRef(getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));\n }\n\n /**\n * @deprecated use getRemoteFileHandle\n */\n public getOnDemandBlobHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {\n return this.getRemoteFileHandle();\n }\n\n public getImportProgress(): FutureRef<ImportProgress> {\n return new FutureRef(getCfgRenderCtx().getImportProgress(this.handle));\n }\n\n public getLastLogs(nLines: number): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getLastLogs(this.handle, nLines));\n }\n\n public getProgressLog(patternToSearch: string): FutureRef<string | undefined> {\n return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));\n }\n\n public getLogHandle(): FutureRef<AnyLogHandle | undefined> {\n return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));\n }\n}\n","import { Optional } from 'utility-types';\nimport { Branded } from '../branding';\nimport { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';\nimport {\n Option,\n PColumn,\n PFrameDef,\n PFrameHandle,\n PObject,\n PObjectSpec,\n PSpecPredicate,\n PTableDef,\n PTableHandle,\n ResultCollection,\n ValueOrError\n} from '@milaboratories/pl-model-common';\n\nexport const StagingAccessorName = 'staging';\nexport const MainAccessorName = 'main';\n\nexport type AccessorHandle = Branded<string, 'AccessorHandle'>;\nexport type FutureHandle = Branded<string, 'FutureHandle'>;\n\nexport interface GlobalCfgRenderCtxMethods<AHandle = AccessorHandle, FHandle = FutureHandle> {\n //\n // Root accessor creation\n //\n\n getAccessorHandleByName(name: string): AHandle | undefined;\n\n //\n // Basic resource accessor actions\n //\n\n resolveWithCommon(\n handle: AHandle,\n commonOptions: CommonFieldTraverseOps,\n ...steps: (FieldTraversalStep | string)[]\n ): AHandle | undefined;\n\n getResourceType(handle: AHandle): ResourceType;\n\n getInputsLocked(handle: AHandle): boolean;\n\n getOutputsLocked(handle: AHandle): boolean;\n\n getIsReadyOrError(handle: AHandle): boolean;\n\n getIsFinal(handle: AHandle): boolean;\n\n getError(handle: AHandle): AHandle | undefined;\n\n listInputFields(handle: AHandle): string[];\n\n listOutputFields(handle: AHandle): string[];\n\n listDynamicFields(handle: AHandle): string[];\n\n getKeyValueBase64(handle: AHandle, key: string): string | undefined;\n\n getKeyValueAsString(handle: AHandle, key: string): string | undefined;\n\n getDataBase64(handle: AHandle): string | undefined;\n\n getDataAsString(handle: AHandle): string | undefined;\n\n /** If not final returns undefined */\n parsePObjectCollection(\n handle: AHandle,\n errorOnUnknownField: boolean,\n prefix: string\n ): Record<string, PObject<AHandle>> | undefined;\n\n //\n // Blob\n //\n\n getBlobContentAsBase64(handle: AHandle): FHandle; // string | undefined\n\n getBlobContentAsString(handle: AHandle): FHandle; // string | undefined\n\n getDownloadedBlobContentHandle(handle: AHandle): FHandle; // LocalBlobHandleAndSize | undefined;\n\n getOnDemandBlobContentHandle(handle: AHandle): FHandle; // RemoteBlobHandleAndSize | undefined;\n\n //\n // Import progress\n //\n\n getImportProgress(handle: AHandle): FHandle; // ImportProgress;\n\n //\n // Logs\n //\n\n getLastLogs(handle: AHandle, nLines: number): FHandle; // string | undefined;\n\n getProgressLog(handle: AHandle, patternToSearch: string): FHandle; // string | undefined;\n\n getLogHandle(handle: AHandle): FHandle; // AnyLogHandle | undefined;\n\n //\n // Blocks\n //\n\n getBlockLabel(blockId: string): string;\n\n //\n // Result Pool\n //\n\n getDataFromResultPool(): ResultCollection<PObject<AHandle>>;\n\n getDataWithErrorsFromResultPool(): ResultCollection<\n Optional<PObject<ValueOrError<AHandle, string>>, 'id'>\n >;\n\n getSpecsFromResultPool(): ResultCollection<PObjectSpec>;\n\n calculateOptions(predicate: PSpecPredicate): Option[];\n\n //\n // PFrame / PTable\n //\n\n createPFrame(def: PFrameDef<AHandle>): PFrameHandle;\n\n createPTable(def: PTableDef<PColumn<AHandle>>): PTableHandle;\n}\n\nexport interface GlobalCfgRenderCtx extends GlobalCfgRenderCtxMethods {\n readonly args: string;\n readonly uiState?: string;\n readonly callbackRegistry: Record<string, Function>;\n}\n\nexport type FutureAwait = {\n __awaited_futures__: FutureHandle[];\n};\n\nexport function isFutureAwait(obj: unknown): obj is FutureAwait {\n return typeof obj === 'object' && obj !== null && '__awaited_futures__' in obj;\n}\n\nfunction addAllFutureAwaits(set: Set<string>, visited: Set<unknown>, node: unknown) {\n if (visited.has(node)) return;\n visited.add(node);\n\n const type = typeof node;\n if (type === 'object') {\n if (isFutureAwait(node)) node.__awaited_futures__.forEach((a) => set.add(a));\n else if (Array.isArray(node))\n for (const nested of node) addAllFutureAwaits(set, visited, nested);\n else\n for (const [, nested] of Object.entries(node as object))\n if (nested !== node) addAllFutureAwaits(set, visited, nested);\n }\n}\n\nexport function getAllFutureAwaits(obj: unknown): Set<string> {\n const set = new Set<string>();\n addAllFutureAwaits(set, new Set(), obj);\n return set;\n}\n","import {\n Option,\n PColumn,\n PFrameDef,\n PFrameHandle,\n PObject,\n PObjectSpec,\n PSpecPredicate,\n PTableDef,\n PTableHandle,\n PTableRecordFilter,\n PTableSorting,\n ResultCollection,\n ValueOrError,\n mapPObjectData,\n mapPTableDef,\n mapValueInVOE\n} from '@milaboratories/pl-model-common';\nimport { Optional } from 'utility-types';\nimport { getCfgRenderCtx } from '../internal';\nimport { TreeNodeAccessor } from './accessor';\nimport { FutureRef } from './future';\nimport { GlobalCfgRenderCtx, MainAccessorName, StagingAccessorName } from './internal';\n\nexport class ResultPool {\n private readonly ctx: GlobalCfgRenderCtx = getCfgRenderCtx();\n\n public calculateOptions(predicate: PSpecPredicate): Option[] {\n return this.ctx.calculateOptions(predicate);\n }\n\n public getDataFromResultPool(): ResultCollection<PObject<TreeNodeAccessor>> {\n const result = this.ctx.getDataFromResultPool();\n return {\n isComplete: result.isComplete,\n entries: result.entries.map((e) => ({\n ref: e.ref,\n obj: {\n ...e.obj,\n data: new TreeNodeAccessor(e.obj.data)\n }\n }))\n };\n }\n\n public getDataWithErrorsFromResultPool(): ResultCollection<\n Optional<PObject<ValueOrError<TreeNodeAccessor, string>>, 'id'>\n > {\n const result = this.ctx.getDataWithErrorsFromResultPool();\n return {\n isComplete: result.isComplete,\n entries: result.entries.map((e) => ({\n ref: e.ref,\n obj: {\n ...e.obj,\n data: mapValueInVOE(e.obj.data, (handle) => new TreeNodeAccessor(handle))\n }\n }))\n };\n }\n\n public getSpecsFromResultPool(): ResultCollection<PObjectSpec> {\n return this.ctx.getSpecsFromResultPool();\n }\n}\n\nexport class RenderCtx<Args, UiState> {\n private readonly ctx: GlobalCfgRenderCtx;\n\n public readonly args: Args;\n public readonly uiState: UiState | undefined;\n\n constructor() {\n this.ctx = getCfgRenderCtx();\n this.args = JSON.parse(this.ctx.args);\n this.uiState = this.ctx.uiState !== undefined ? JSON.parse(this.ctx.uiState) : undefined;\n }\n\n private getNamedAccessor(name: string): TreeNodeAccessor | undefined {\n const accessorId = this.ctx.getAccessorHandleByName(name);\n return accessorId ? new TreeNodeAccessor(accessorId) : undefined;\n }\n\n public get prerun(): TreeNodeAccessor | undefined {\n return this.getNamedAccessor(StagingAccessorName);\n }\n\n /**\n * @deprecated use prerun\n */\n public get precalc(): TreeNodeAccessor | undefined {\n return this.prerun;\n }\n\n /**\n * @deprecated use prerun\n */\n public get stagingOutput(): TreeNodeAccessor | undefined {\n return this.precalc;\n }\n\n public get outputs(): TreeNodeAccessor | undefined {\n return this.getNamedAccessor(MainAccessorName);\n }\n\n /**\n * @deprecated use outputs\n */\n public get mainOutput(): TreeNodeAccessor | undefined {\n return this.outputs;\n }\n\n public readonly resultPool = new ResultPool();\n\n public createPFrame(def: PFrameDef<TreeNodeAccessor>): PFrameHandle {\n return this.ctx.createPFrame(def.map((c) => mapPObjectData(c, (d) => d.handle)));\n }\n\n public createPTable(def: PTableDef<PColumn<TreeNodeAccessor>>): PTableHandle;\n public createPTable(def: {\n columns: PColumn<TreeNodeAccessor>[];\n filters?: PTableRecordFilter[];\n /** Table sorting */\n sorting?: PTableSorting[];\n }): PTableHandle;\n public createPTable(\n def:\n | PTableDef<PColumn<TreeNodeAccessor>>\n | {\n columns: PColumn<TreeNodeAccessor>[];\n filters?: PTableRecordFilter[];\n /** Table sorting */\n sorting?: PTableSorting[];\n }\n ): PTableHandle {\n var rawDef: PTableDef<PColumn<TreeNodeAccessor>>;\n if ('columns' in def) {\n rawDef = {\n src: {\n type: 'inner',\n entries: def.columns.map((c) => ({ type: 'column', column: c }))\n },\n filters: def.filters ?? [],\n sorting: def.sorting ?? []\n };\n } else {\n rawDef = def;\n }\n return this.ctx.createPTable(mapPTableDef(rawDef, (po) => mapPObjectData(po, (d) => d.handle)));\n }\n\n public getBlockLabel(blockId: string): string {\n return this.ctx.getBlockLabel(blockId);\n }\n}\n\nexport type RenderFunction<Args = unknown, UiState = unknown, Ret = unknown> = (\n rCtx: RenderCtx<Args, UiState>\n) => Ret;\n\nexport type UnwrapFutureRef<K> =\n K extends FutureRef<infer T>\n ? T\n : K extends bigint | boolean | null | number | string | symbol | undefined\n ? K\n : { [key in keyof K]: UnwrapFutureRef<K[key]> };\n\nexport type InferRenderFunctionReturn<RF extends Function> = RF extends (...args: any) => infer R\n ? UnwrapFutureRef<R>\n : never;\n","export const PlatformaSDKVersion = '1.2.29';\n","import { BlockRenderingMode, BlockSection, ValueOrErrors } from '@milaboratories/pl-model-common';\nimport { Checked, ConfigResult, getImmediate, PlResourceEntry, TypedConfig } from './config';\nimport { getPlatformaInstance, isInUI, tryRegisterCallback } from './internal';\nimport { Platforma } from './platforma';\nimport { InferRenderFunctionReturn, RenderCtx, RenderFunction } from './render';\nimport { PlatformaSDKVersion } from './version';\n\ntype StdCtxArgsOnly<Args, UiState = undefined> = {\n readonly $blockId: string;\n readonly $args: Args;\n readonly $ui: UiState;\n};\n\nexport type StdCtx<Args, UiState = undefined> = StdCtxArgsOnly<Args, UiState> & {\n readonly $prod: PlResourceEntry;\n readonly $staging: PlResourceEntry;\n};\n\nexport type ResolveCfgType<Cfg extends TypedConfig, Args, UiState = undefined> = ConfigResult<\n Cfg,\n StdCtx<Args, UiState>\n>;\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 SectionsRFChecked<RF extends Function> = Checked<\n RF,\n InferRenderFunctionReturn<RF> 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 InputsValidRFChecked<RF extends Function> = Checked<\n RF,\n InferRenderFunctionReturn<RF> extends InputsValidExpectedType ? true : false\n>;\n\nexport type Code = {\n type: 'plain';\n content: string;\n};\n\n/** Field key to attach ConfAction information to a config type. */\ndeclare const __function_handle__: unique symbol;\n\n/** Creates branded Cfg type */\nexport type FunctionHandle<Return = unknown> = string & { [__function_handle__]: Return };\n\nexport type ExtractFunctionHandleReturn<Func extends FunctionHandle> =\n Func[typeof __function_handle__];\n\nexport type TypedConfigOrFunctionHandle = TypedConfig | FunctionHandle;\n\nexport function isFunctionHandle(cfgOrFh: TypedConfigOrFunctionHandle): cfgOrFh is FunctionHandle {\n return typeof cfgOrFh === 'string';\n}\n\ntype OnlyString<S> = S extends string ? S : '';\n\n// prettier-ignore\nexport type DeriveHref<S> = S extends readonly BlockSection[]\n ? OnlyString<Extract<S[number], { type: 'link' }>['href']>\n : never;\n\n/** This structure is rendered from the configuration, type can accommodate any\n * version of config structure. */\nexport type BlockConfigUniversal<\n Args = unknown,\n Outputs extends Record<string, TypedConfigOrFunctionHandle> = Record<\n string,\n TypedConfigOrFunctionHandle\n >\n> = {\n /** SDK version used by the block */\n readonly sdkVersion: string;\n\n /** Main rendering mode for the block */\n readonly renderingMode: BlockRenderingMode;\n\n /** Initial value for the args when block is added to the project */\n readonly initialArgs: Args;\n\n /** @deprecated */\n readonly canRun?: TypedConfigOrFunctionHandle;\n\n /**\n * Config to determine whether the block can be executed with current\n * arguments.\n *\n * Optional to support earlier SDK version configs.\n * */\n readonly inputsValid?: TypedConfigOrFunctionHandle;\n\n /** Configuration to derive list of section for the left overview panel */\n readonly sections: TypedConfigOrFunctionHandle;\n\n /** Configuration for the output cells */\n readonly outputs: Outputs;\n\n /** Config code bundle */\n readonly code?: Code;\n};\n\n/** This structure is rendered from the configuration */\nexport type BlockConfig<\n Args = unknown,\n Outputs extends Record<string, TypedConfigOrFunctionHandle> = Record<\n string,\n TypedConfigOrFunctionHandle\n >\n> = Required<Omit<BlockConfigUniversal<Args, Outputs>, 'canRun' | 'code'>> &\n Pick<BlockConfigUniversal<Args, Outputs>, 'code'>;\n\n/** Takes universal config, and converts it into latest structure */\nexport function normalizeBlockConfig<\n Args,\n Outputs extends Record<string, TypedConfigOrFunctionHandle>\n>(cfg: BlockConfigUniversal<Args, Outputs>): BlockConfig<Args, Outputs> {\n if (cfg.inputsValid !== undefined) return cfg as BlockConfig<Args, Outputs>;\n else {\n if (cfg.canRun === undefined)\n throw new Error(`Malformed config, SDK version ${cfg.sdkVersion}`);\n const latest = { ...cfg, inputsValid: cfg.canRun };\n delete latest['canRun'];\n return latest;\n }\n}\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, TypedConfigOrFunctionHandle>,\n UiState,\n Href extends `/${string}` = '/'\n> {\n private constructor(\n private readonly _renderingMode: BlockRenderingMode,\n private readonly _initialArgs: Args | undefined,\n private readonly _outputs: OutputsCfg,\n private readonly _inputsValid: TypedConfigOrFunctionHandle,\n private readonly _sections: TypedConfigOrFunctionHandle\n ) { }\n\n /** Initiates configuration builder */\n public static create<Args, UiState = undefined>(\n renderingMode: BlockRenderingMode = 'Heavy'\n ): BlockModel<Args, {}, UiState> {\n return new BlockModel<Args, {}, UiState>(\n renderingMode,\n undefined,\n {},\n getImmediate(true),\n getImmediate([])\n );\n }\n\n /**\n * Add output cell to the configuration\n *\n * @param key cell name, that can be used to retrieve the rendered value\n * @param cfg configuration describing how to render cell value from the blocks\n * workflow outputs\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 public output<const Key extends string, const RF extends RenderFunction<Args, UiState>>(\n key: Key,\n rf: RF\n ): BlockModel<\n Args,\n OutputsCfg & { [K in Key]: FunctionHandle<InferRenderFunctionReturn<RF>> },\n UiState,\n Href\n >;\n public output(\n key: string,\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n if (typeof cfgOrRf === 'function') {\n const functionHandle = `output#${key}` as FunctionHandle;\n tryRegisterCallback(functionHandle, () => cfgOrRf(new RenderCtx()));\n return new BlockModel(\n this._renderingMode,\n this._initialArgs,\n {\n ...this._outputs,\n [key]: functionHandle\n },\n this._inputsValid,\n this._sections\n );\n } else\n return new BlockModel(\n this._renderingMode,\n this._initialArgs,\n {\n ...this._outputs,\n [key]: cfgOrRf\n },\n this._inputsValid,\n this._sections\n );\n }\n\n /** @deprecated */\n public canRun<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>\n ): BlockModel<Args, OutputsCfg, UiState, Href> {\n return this.inputsValid(cfg as any);\n }\n\n /** Sets custom configuration predicate on the block args at which block can be executed */\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 RenderFunction<Args, UiState, boolean>>(\n rf: RF\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public argsValid(\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n if (typeof cfgOrRf === 'function') {\n tryRegisterCallback('inputsValid', () => cfgOrRf(new RenderCtx()));\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n 'inputsValid' as FunctionHandle,\n this._sections\n );\n } else\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n cfgOrRf,\n this._sections\n );\n }\n\n /** @deprecated use argsValid() */\n public inputsValid<Cfg extends TypedConfig>(\n cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n /** @deprecated use argsValid() */\n public inputsValid<RF extends RenderFunction<Args, UiState, boolean>>(\n rf: RF\n ): BlockModel<Args, OutputsCfg, UiState, Href>;\n public inputsValid(\n cfgOrRf: TypedConfig | Function\n ): BlockModel<Args, OutputsCfg, UiState, `/${string}`> {\n return this.argsValid(cfgOrRf as any);\n }\n\n /** Sets the config to generate list of section in the left block overviews panel */\n public sections<const S extends SectionsExpectedType,>(rf: S): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;\n public sections<\n const Ret extends SectionsExpectedType,\n const RF extends RenderFunction<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 | Function\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 RenderCtx()));\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n this._inputsValid,\n 'sections' as FunctionHandle\n );\n } else\n return new BlockModel<Args, OutputsCfg, UiState>(\n this._renderingMode,\n this._initialArgs,\n this._outputs,\n this._inputsValid,\n arrOrCfgOrRf as TypedConfig\n );\n }\n\n\n /** Sets initial args for the block, this value must be specified. */\n public initialArgs(value: Args): BlockModel<Args, OutputsCfg, UiState, Href> {\n return new BlockModel<Args, OutputsCfg, UiState, Href>(\n this._renderingMode,\n value,\n this._outputs,\n this._inputsValid,\n this._sections\n );\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(): Platforma<\n Args,\n InferOutputsFromConfigs<Args, OutputsCfg, UiState>,\n UiState,\n Href\n > {\n if (this._initialArgs === undefined) throw new Error('Initial arguments not set.');\n\n const config: BlockConfig<Args, OutputsCfg> = {\n sdkVersion: PlatformaSDKVersion,\n renderingMode: this._renderingMode,\n initialArgs: this._initialArgs,\n inputsValid: this._inputsValid,\n sections: this._sections,\n outputs: this._outputs\n };\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 return getPlatformaInstance(config) as any;\n }\n}\n\nexport type InferOutputType<CfgOrFH, Args, UiState> = CfgOrFH extends TypedConfig\n ? ResolveCfgType<CfgOrFH, Args, UiState>\n : CfgOrFH extends FunctionHandle\n ? ExtractFunctionHandleReturn<CfgOrFH>\n : never;\n\ntype InferOutputsFromConfigs<\n Args,\n OutputsCfg extends Record<string, TypedConfigOrFunctionHandle>,\n UiState\n> = {\n [Key in keyof OutputsCfg]: ValueOrErrors<InferOutputType<OutputsCfg[Key], Args, UiState>>;\n};\n","import {\n CalculateTableDataRequest,\n CalculateTableDataResponse,\n FindColumnsRequest,\n FindColumnsResponse,\n PColumnIdAndSpec,\n PColumnSpec,\n PFrame,\n PFrameHandle,\n PObjectId,\n UniqueValuesRequest,\n UniqueValuesResponse\n} from '@milaboratories/pl-model-common';\n\nexport class PFrameImpl implements PFrame {\n constructor(private readonly handle: PFrameHandle) {}\n\n public async findColumns(request: FindColumnsRequest): Promise<FindColumnsResponse> {\n return await platforma.pFrameDriver.findColumns(this.handle, request);\n }\n\n public async getColumnSpec(columnId: PObjectId): Promise<PColumnSpec> {\n return await platforma.pFrameDriver.getColumnSpec(this.handle, columnId);\n }\n\n public async listColumns(): Promise<PColumnIdAndSpec[]> {\n return await platforma.pFrameDriver.listColumns(this.handle);\n }\n\n public async calculateTableData(\n request: CalculateTableDataRequest<PObjectId>\n ): Promise<CalculateTableDataResponse> {\n return await platforma.pFrameDriver.calculateTableData(this.handle, request);\n }\n\n public async getUniqueValues(request: UniqueValuesRequest): Promise<UniqueValuesResponse> {\n return await platforma.pFrameDriver.getUniqueValues(this.handle, request);\n }\n}\n","import { getJsonField, makeObject, TypedConfig } from './config';\n\nexport function fromPlRef<Source extends TypedConfig>(source: Source) {\n return makeObject({\n __isRef: true,\n blockId: getJsonField(source, 'blockId'),\n name: getJsonField(source, 'name')\n });\n}\n\nexport function fromPlOption<Source extends TypedConfig>(source: Source) {\n return makeObject({\n ref: fromPlRef(getJsonField(source, 'ref')),\n label: getJsonField(source, 'label')\n });\n}\n","import { PlatformaSDKVersion } from './version';\n\nexport type SdkInfo = {\n readonly sdkVersion: string;\n};\n\nexport const CurrentSdkInfo: SdkInfo = {\n sdkVersion: PlatformaSDKVersion\n};\n","declare global {\n function getEnvironmentValue(name: string): string | undefined;\n}\n\nexport function getEnvironmentValue(name: string): string | undefined {\n if (typeof getEnvironmentValue !== 'function') return undefined;\n else return getEnvironmentValue(name);\n}\n"],"names":["OutputError","errors","moreErrors","readOutput","outputValue","wrapOutputs","outputs","target","key","primitiveToConfig","value","getImmediate","getFromCfg","variable","isolate","cfg","Args","It","MainOutputs","StagingOutputs","UiState","makeObject","template","normalizedTemplate","k","makeArray","getJsonField","source","field","mapRecordValues","mapping","itVar","mapArrayValues","flatten","isEmpty","arg","not","operand","and","operand1","operand2","or","getResourceField","getResourceValueAsJson","mapResourceFields","getBlobContent","getBlobContentAsString","getBlobContentAsJson","getDownloadedBlobContent","getOnDemandBlobContent","getImportProgress","getLastLogs","lines","getProgressLog","patternToSearch","getLogHandle","isInUI","getPlatformaInstance","config","tryGetCfgRenderCtx","getCfgRenderCtx","tryRegisterCallback","callback","ctx","futureResolves","registerFutureAwait","handle","onResolve","res","FutureRef","postProcess","v","__publicField","vv","wrapAccessor","TreeNodeAccessor","steps","commonOptions","content","errorOnUnknownField","prefix","result","obj","isPColumn","pObjects","mapPObjectData","c","nLines","StagingAccessorName","MainAccessorName","isFutureAwait","addAllFutureAwaits","set","visited","node","a","nested","getAllFutureAwaits","ResultPool","predicate","e","mapValueInVOE","RenderCtx","name","accessorId","def","d","rawDef","mapPTableDef","po","blockId","PlatformaSDKVersion","isFunctionHandle","cfgOrFh","normalizeBlockConfig","latest","BlockModel","_renderingMode","_initialArgs","_outputs","_inputsValid","_sections","renderingMode","cfgOrRf","functionHandle","arrOrCfgOrRf","PFrameImpl","request","columnId","fromPlRef","fromPlOption","CurrentSdkInfo","getEnvironmentValue"],"mappings":";;;;;AAEO,MAAMA,UAAoB,MAAM;AA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 -1,2 +1,2 @@
|
|
|
1
|
-
export declare const PlatformaSDKVersion = "1.2.
|
|
1
|
+
export declare const PlatformaSDKVersion = "1.2.29";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
package/src/env_value.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
function getEnvironmentValue(name: string): string | undefined;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function getEnvironmentValue(name: string): string | undefined {
|
|
6
|
+
if (typeof getEnvironmentValue !== 'function') return undefined;
|
|
7
|
+
else return getEnvironmentValue(name);
|
|
8
|
+
}
|
package/src/index.ts
CHANGED
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const PlatformaSDKVersion = '1.2.
|
|
1
|
+
export const PlatformaSDKVersion = '1.2.29';
|