@platforma-sdk/model 1.21.10 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/builder.d.ts CHANGED
@@ -40,6 +40,7 @@ export declare class BlockModel<Args, OutputsCfg extends Record<string, TypedCon
40
40
  * @param key output cell name, that can be later used to retrieve the rendered value
41
41
  * @param cfg configuration describing how to render cell value from the blocks
42
42
  * workflow outputs
43
+ * @deprecated use lambda-based API
43
44
  * */
44
45
  output<const Key extends string, const Cfg extends TypedConfig>(key: Key, cfg: Cfg): BlockModel<Args, OutputsCfg & {
45
46
  [K in Key]: Cfg;
@@ -59,20 +60,18 @@ export declare class BlockModel<Args, OutputsCfg extends Record<string, TypedCon
59
60
  retentiveOutput<const Key extends string, const RF extends RenderFunction<Args, UiState>>(key: Key, rf: RF): BlockModel<Args, OutputsCfg & {
60
61
  [K in Key]: ConfigRenderLambda<InferRenderFunctionReturn<RF>>;
61
62
  }, UiState, Href>;
62
- /** @deprecated */
63
- canRun<Cfg extends TypedConfig>(cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>): BlockModel<Args, OutputsCfg, UiState, Href>;
64
- /** Sets custom configuration predicate on the block args at which block can be executed */
63
+ /** Sets custom configuration predicate on the block args at which block can be executed
64
+ * @deprecated use lambda-based API */
65
65
  argsValid<Cfg extends TypedConfig>(cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>): BlockModel<Args, OutputsCfg, UiState, Href>;
66
66
  /** Sets custom configuration predicate on the block args at which block can be executed */
67
67
  argsValid<RF extends RenderFunction<Args, UiState, boolean>>(rf: RF): BlockModel<Args, OutputsCfg, UiState, Href>;
68
- /** @deprecated use argsValid() */
69
- inputsValid<Cfg extends TypedConfig>(cfg: Cfg & InputsValidCfgChecked<Cfg, Args, UiState>): BlockModel<Args, OutputsCfg, UiState, Href>;
70
- /** @deprecated use argsValid() */
71
- inputsValid<RF extends RenderFunction<Args, UiState, boolean>>(rf: RF): BlockModel<Args, OutputsCfg, UiState, Href>;
72
- /** Sets the config to generate list of section in the left block overviews panel */
68
+ /** Sets the config to generate list of section in the left block overviews panel
69
+ * @deprecated use lambda-based API */
73
70
  sections<const S extends SectionsExpectedType>(rf: S): BlockModel<Args, OutputsCfg, UiState, DeriveHref<S>>;
71
+ /** Sets the config to generate list of section in the left block overviews panel */
74
72
  sections<const Ret extends SectionsExpectedType, const RF extends RenderFunction<Args, UiState, Ret>>(rf: RF): BlockModel<Args, OutputsCfg, UiState, DeriveHref<ReturnType<RF>>>;
75
73
  sections<const Cfg extends TypedConfig>(cfg: Cfg & SectionsCfgChecked<Cfg, Args, UiState>): BlockModel<Args, OutputsCfg, UiState, DeriveHref<ConfigResult<Cfg, StdCtxArgsOnly<Args, UiState>>>>;
74
+ /** Sets a rendering function to derive block title, shown for the block in the left blocks-overview panel. */
76
75
  title(rf: RenderFunction<Args, UiState, string>): BlockModel<Args, OutputsCfg, UiState, Href>;
77
76
  /**
78
77
  * Sets initial args for the block, this value must be specified.
@@ -1 +1 @@
1
- {"version":3,"file":"builder.d.ts","sourceRoot":"","sources":["../src/builder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,YAAY,EAAiC,WAAW,EAAE,MAAM,UAAU,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,yBAAyB,EAAa,cAAc,EAAE,MAAM,UAAU,CAAC;AAEhF,OAAO,EACL,yBAAyB,EACzB,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,cAAc,EACd,2BAA2B,EAG3B,uBAAuB,EACxB,MAAM,WAAW,CAAC;AAEnB,KAAK,oBAAoB,GAAG,SAAS,YAAY,EAAE,CAAC;AAEpD,KAAK,kBAAkB,CAAC,GAAG,SAAS,WAAW,EAAE,IAAI,EAAE,OAAO,IAA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AChC,2BAA2B,CAAC,OAAO,CAAC,GACpC,KAAK,CAAC;AAEZ,KAAK,uBAAuB,CAC1B,IAAI,EACJ,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,yBAAyB,CAAC,EAC5D,OAAO,IACL;KACD,GAAG,IAAI,MAAM,UAAU,GAAG,aAAa,CAAC,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;CAC1F,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Pe=Object.defineProperty;var Se=(t,e,n)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var A=(t,e,n)=>Se(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@milaboratories/pl-model-common"),w=require("zod");class ne extends Error{constructor(e,n){super(`${e.length}${n?"+":""} errors, first error: `+e[0]),this.errors=e,this.moreErrors=n}}function re(t){if(!t.ok)throw new ne(t.errors,t.moreErrors);return t.value}function Ae(t){return new Proxy(t,{get(e,n){return re(e[n])}})}function y(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null?E(t):t}function R(t){return{type:"GetFromCtx",variable:t}}function Ie(t){return{type:"Isolate",cfg:t}}const Ce=R("$args"),we=R("$it"),Re=R("$prod"),Oe=R("$staging"),Te=R("$ui");function E(t){return{type:"Immediate",value:t}}function X(t){const e={};for(const[n,r]of Object.entries(t))e[n]=y(r);return{type:"MakeObject",template:e}}function Fe(...t){const e=[];for(const n of t)e.push(y(n));return{type:"MakeArray",template:e}}function k(t,e){return{type:"GetJsonField",source:y(t),field:y(e)}}function De(t,e,n="$it"){return{type:"MapRecordValues",source:t,mapping:e,itVar:n}}function Ee(t,e,n="$it"){return{type:"MapArrayValues",source:t,mapping:e,itVar:n}}function xe(t){return{type:"Flatten",source:t}}function ke(t){return{type:"IsEmpty",arg:t}}function Le(t){return{type:"Not",operand:t}}function Ve(t,e){return{type:"And",operand1:t,operand2:e}}function je(t,e){return{type:"Or",operand1:t,operand2:e}}function Ne(t,e){return{type:"GetResourceField",source:y(t),field:y(e)}}function Be(){return function(t){return{type:"GetResourceValueAsJson",source:y(t)}}}function Me(t,e,n="$it"){return{type:"MapResourceFields",source:t,mapping:e,itVar:n}}function Ue(t){return{type:"GetBlobContent",source:y(t)}}function Je(t){return{type:"GetBlobContentAsString",source:y(t)}}function $e(){return function(t){return{type:"GetBlobContentAsJson",source:y(t)}}}function Ke(t){return{type:"GetDownloadedBlobContent",source:y(t)}}function Ge(t){return{type:"GetOnDemandBlobContent",source:y(t)}}function He(t){return{type:"GetImportProgress",source:y(t)}}function We(t,e){return{type:"GetLastLogs",source:y(t),lines:e}}function ze(t,e){return{type:"GetProgressLog",source:y(t),patternToSearch:e}}function qe(t){return{type:"GetLogHandle",source:y(t)}}function Ye(){return typeof globalThis.getPlatforma<"u"||typeof globalThis.platforma<"u"}function se(t){if(t&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(t);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}function Xe(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx}function c(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx;throw new Error("Not in config rendering context")}function j(t,e){const n=Xe();if(n===void 0)return!1;if(t in n.callbackRegistry)throw new Error(`Callback with key ${t} already registered.`);return n.callbackRegistry[t]=e,!0}const H=new Map;function Qe(t,e){t in c().callbackRegistry||(c().callbackRegistry[t]=n=>{for(const r of H.get(t))r(n)},H.set(t,[])),H.get(t).push(e)}class P{constructor(e,n=r=>r){A(this,"isResolved",!1);A(this,"resolvedValue");this.handle=e,this.postProcess=n,Qe(e,r=>{this.resolvedValue=n(r),this.isResolved=!0})}map(e){return new P(this.handle,n=>e(this.postProcess(n)))}mapDefined(e){return new P(this.handle,n=>{const r=this.postProcess(n);return r?e(r):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function U(t,e){return t===void 0?void 0:e(t)}class _{constructor(e,n){this.handle=e,this.resolvePath=n}resolve(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveOutput(...e){const n=e.map(r=>({assertFieldType:"Output",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveInput(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveAny(...e){return this.resolveWithCommon({},...e)}resolveWithCommon(e,...n){const r=[...this.resolvePath,...n.map(s=>typeof s=="string"?s:s.field)];return U(c().resolveWithCommon(this.handle,e,...n),s=>new _(s,r))}get resourceType(){return c().getResourceType(this.handle)}getInputsLocked(){return c().getInputsLocked(this.handle)}getOutputsLocked(){return c().getOutputsLocked(this.handle)}getIsReadyOrError(){return c().getIsReadyOrError(this.handle)}getIsFinal(){return c().getIsFinal(this.handle)}getError(){const e=[...this.resolvePath,"error"];return U(c().getError(this.handle),n=>new _(n,e))}listInputFields(){return c().listInputFields(this.handle)}listOutputFields(){return c().listOutputFields(this.handle)}listDynamicFields(){return c().listDynamicFields(this.handle)}getKeyValueBase64(e){return c().getKeyValueBase64(this.handle,e)}getKeyValueAsString(e){return c().getKeyValueAsString(this.handle,e)}getKeyValueAsJson(e){const n=this.getKeyValueAsString(e);if(n==null)throw new Error("Resource has no content.");return JSON.parse(n)}getDataBase64(){return c().getDataBase64(this.handle)}getDataAsString(){return c().getDataAsString(this.handle)}getDataAsJson(){const e=this.getDataAsString();if(e==null)throw new Error("Resource has no content.");return JSON.parse(e)}getPColumns(e=!1,n=""){const r=this.parsePObjectCollection(e,n);return r===void 0?void 0:Object.entries(r).map(([,i])=>{if(!p.isPColumn(i))throw new Error(`not a PColumn (kind = ${i.spec.kind})`);return i})}parsePObjectCollection(e=!1,n=""){const r=c().parsePObjectCollection(this.handle,e,n,...this.resolvePath);if(r===void 0)return;const s={};for(const[i,o]of Object.entries(r)){const l=[...this.resolvePath,i];s[i]=p.mapPObjectData(o,a=>new _(a,l))}return s}getFileContentAsBase64(){return new P(c().getBlobContentAsBase64(this.handle))}getFileContentAsString(){return new P(c().getBlobContentAsString(this.handle))}getFileContentAsJson(){return new P(c().getBlobContentAsString(this.handle)).mapDefined(e=>JSON.parse(e))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new P(c().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new P(c().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}getImportProgress(){return new P(c().getImportProgress(this.handle))}getLastLogs(e){return new P(c().getLastLogs(this.handle,e))}getProgressLog(e){return new P(c().getProgressLog(this.handle,e))}getLogHandle(){return new P(c().getLogHandle(this.handle))}allFieldsResolved(e="Input"){switch(e){case"Input":return this.getInputsLocked()&&this.listInputFields().every(n=>this.resolve({field:n,assertFieldType:"Input"})!==void 0);case"Output":return this.getOutputsLocked()&&this.listOutputFields().every(n=>this.resolve({field:n,assertFieldType:"Output"})!==void 0)}}mapFields(e,n){const{fieldType:r,requireLocked:s,skipUnresolved:i}={fieldType:"Input",requireLocked:!0,skipUnresolved:!1,...n},o=e;if(s&&(r==="Input"&&!this.getInputsLocked()||r==="Output"&&!this.getOutputsLocked()))return;let a=(r==="Input"?this.listInputFields():r==="Output"?this.listOutputFields():this.listDynamicFields()).map(u=>[u,this.resolve({field:u,assertFieldType:r})]);return i&&(a=a.filter(u=>u[1]!==void 0)),a.map(([u,g])=>o(u,g))}}const ie="staging",oe="main",Ze={inlineColumnsSupport:!0};function ae(t){return typeof t=="object"&&t!==null&&"__awaited_futures__"in t}function W(t,e,n){if(e.has(n))return;if(e.add(n),typeof n==="object")if(ae(n))n.__awaited_futures__.forEach(s=>t.add(s));else if(Array.isArray(n))for(const s of n)W(t,e,s);else for(const[,s]of Object.entries(n))s!==n&&W(t,e,s)}function et(t){const e=new Set;return W(e,new Set,t),e}const tt=Object.freeze(Object.defineProperty({__proto__:null,GlobalCfgRenderCtxFeatureFlags:Ze,MainAccessorName:oe,StagingAccessorName:ie,getAllFutureAwaits:et,isFutureAwait:ae},Symbol.toStringTag,{value:"Module"})),le="pl7.app/label",ue="pl7.app/trace",ce=w.z.object({type:w.z.string(),importance:w.z.number().optional(),id:w.z.string().optional(),label:w.z.string()}),de=w.z.array(ce),nt=.001,rt="__LABEL__",Z="__LABEL__@1";function pe(t,e,n={}){const r=new Map,s=new Map,i=t.map(f=>{var T,Q;const m=e(f),h=(T=m.annotations)==null?void 0:T[le],I=(Q=m.annotations)==null?void 0:Q[ue],b=(I?de.safeParse(JSON.parse(I)).data:void 0)??[];if(h){const S={label:h,type:rt,importance:-2};n.addLabelAsSuffix?b.push(S):b.splice(0,0,S)}const O=[],V=new Map;for(let S=b.length-1;S>=0;--S){const{type:K}=b[S],ve=b[S].importance??0,G=(V.get(K)??0)+1;V.set(K,G);const F=`${K}@${G}`;s.set(F,(s.get(F)??0)+1),r.set(F,Math.max(r.get(F)??Number.NEGATIVE_INFINITY,ve-(b.length-S)*nt)),O.push({...b[S],fullType:F,occurenceIndex:G})}return O.reverse(),{value:f,spec:m,label:h,fullTrace:O}}),o=[],l=[],a=[...r];a.sort(([,f],[,m])=>m-f);for(const[f]of a)f.endsWith("@1")||s.get(f)===t.length?o.push(f):l.push(f);const u=f=>i.map(m=>{const h=m.fullTrace.filter(b=>f.has(b.fullType)).map(b=>b.label),I=n.separator??" / ";return{label:h.join(I),value:m.value}});if(o.length===0){if(l.length!==0)throw new Error("Assertion error.");return u(new Set(Z))}let g=0,d=0;for(;g<o.length;){const f=new Set;n.includeNativeLabel&&f.add(Z);for(let h=0;h<g;++h)f.add(o[h]);f.add(o[d]);const m=u(f);if(new Set(m.map(h=>h.label)).size===t.length)return m;d++,d==o.length&&(g++,d=g)}return u(new Set([...o,...l]))}class fe{constructor(){A(this,"ctx",c());A(this,"defaultLabelFn",(e,n)=>{var r;return((r=e.annotations)==null?void 0:r["pl7.app/label"])??"Unlabelled"})}calculateOptions(e){return this.ctx.calculateOptions(e)}getOptions(e,n){const r=this.getSpecs().entries.filter(s=>e(s.obj));return typeof n=="object"||typeof n>"u"?pe(r,s=>s.obj,n??{}).map(({value:{ref:s},label:i})=>({ref:s,label:i})):r.map(s=>({ref:s.ref,label:n(s.obj,s.ref)}))}getDataFromResultPool(){return this.getData()}getData(){const e=this.ctx.getDataFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:new _(n.obj.data,[n.ref.blockId,n.ref.name])}}))}}getDataWithErrorsFromResultPool(){return this.getDataWithErrors()}getDataWithErrors(){const e=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:p.mapValueInVOE(n.obj.data,r=>new _(r,[n.ref.blockId,n.ref.name]))}}))}}getSpecsFromResultPool(){return this.getSpecs()}getSpecs(){return this.ctx.getSpecsFromResultPool()}getDataByRef(e){var n;return typeof this.ctx.getDataFromResultPoolByRef>"u"?(n=this.getData().entries.find(r=>r.ref.blockId===e.blockId&&r.ref.name===e.name))==null?void 0:n.obj:p.mapPObjectData(this.ctx.getDataFromResultPoolByRef(e.blockId,e.name),r=>new _(r,[e.blockId,e.name]))}getPColumnByRef(e){const n=this.getDataByRef(e);if(n)return p.ensurePColumn(n)}getPColumnSpecByRef(e){const n=this.getSpecByRef(e);if(n){if(!p.isPColumnSpec(n))throw new Error(`not a PColumn spec (kind = ${n.kind})`);return n}}getSpecByRef(e){var n;return typeof this.ctx.getSpecFromResultPoolByRef>"u"?(n=this.getSpecs().entries.find(r=>r.ref.blockId===e.blockId&&r.ref.name===e.name))==null?void 0:n.obj:this.ctx.getSpecFromResultPoolByRef(e.blockId,e.name)}findDataWithCompatibleSpec(e){const n=[];e:for(const r of this.getData().entries){if(!p.isPColumnSpec(r.obj.spec))continue;const s=r.obj.spec;if(e.name===s.name&&e.valueType===s.valueType&&e.axesSpec.length===s.axesSpec.length&&z(e.domain,s.domain)){for(let i=0;i<e.axesSpec.length;++i){const o=e.axesSpec[i],l=s.axesSpec[i];if(o.name!==l.name||o.type!==l.type||!z(o.domain,l.domain))continue e}n.push(r.obj)}}return n}}function z(t,e){if(t===void 0)return e===void 0;if(e===void 0)return!0;for(const n in e)if(t[n]!==e[n])return!1;return!0}class D{constructor(){A(this,"ctx");A(this,"args");A(this,"uiState");A(this,"resultPool",new fe);this.ctx=c(),this.args=JSON.parse(this.ctx.args),this.uiState=this.ctx.uiState!==void 0?JSON.parse(this.ctx.uiState):{}}getNamedAccessor(e){return U(this.ctx.getAccessorHandleByName(e),n=>new _(n,[e]))}get prerun(){return this.getNamedAccessor(ie)}get precalc(){return this.prerun}get stagingOutput(){return this.precalc}get outputs(){return this.getNamedAccessor(oe)}get mainOutput(){return this.outputs}findLabels(e){const n=this.resultPool.getData();for(const r of n.entries){if(!p.isPColumn(r.obj))continue;const s=r.obj.spec;if(s.name==="pl7.app/label"&&s.axesSpec.length===1&&s.axesSpec[0].name===e.name&&s.axesSpec[0].type===e.type&&z(e.domain,s.axesSpec[0].domain)){if(r.obj.data.resourceType.name!=="PColumnData/Json")throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);return Object.fromEntries(Object.entries(r.obj.data.getDataAsJson().data).map(o=>[JSON.parse(o[0])[0],o[1]]))}}}verifyInlineColumnsSupport(e){var s;const n=e.some(i=>!(i.data instanceof _)),r=((s=this.ctx.featureFlags)==null?void 0:s.inlineColumnsSupport)===!0;if(n&&!r)throw Error("inline columns not supported")}createPFrame(e){return this.verifyInlineColumnsSupport(e),this.ctx.createPFrame(e.map(n=>p.mapPObjectData(n,r=>r instanceof _?r.handle:r)))}createPTable(e){var n;return"columns"in e?n={src:{type:"full",entries:e.columns.map(r=>({type:"column",column:r}))},filters:e.filters??[],sorting:e.sorting??[]}:n=e,this.verifyInlineColumnsSupport(p.extractAllColumns(n.src)),this.ctx.createPTable(p.mapPTableDef(n,r=>p.mapPObjectData(r,s=>s instanceof _?s.handle:s)))}getBlockLabel(e){return this.ctx.getBlockLabel(e)}getCurrentUnstableMarker(){if(!(typeof this.ctx.getCurrentUnstableMarker>"u"))return this.ctx.getCurrentUnstableMarker()}}const L="PColumnData/",J=L+"ResourceMap",$=L+"Partitioned/ResourceMap",q=L+"JsonPartitioned",N=L+"BinaryPartitioned",he=L+"Partitioned/",Y=he+"JsonPartitioned",B=he+"BinaryPartitioned";function ge(t,e,n,r=[],s){if(t===void 0)return!1;switch(t.resourceType.name){case J:{let i=t.getInputsLocked();for(const o of t.listInputFields()){const l=t.resolve({field:o,assertFieldType:"Input"}),a=[...r,...JSON.parse(o)],u=l===void 0?void 0:e(l);u===void 0&&(i=!1),(u!==void 0||s)&&n.push({key:a,value:u})}return i}case $:{let i=t.getInputsLocked();for(const o of t.listInputFields()){const l=t.resolve({field:o,assertFieldType:"Input"});if(l===void 0)i=!1;else{const a=[...r,...JSON.parse(o)],u=ge(l,e,n,a,s);i=i&&u}}return i}default:throw new Error(`Unknown resource type: ${t.resourceType.name}`)}}function st(t,e,n=!1){const r=[];return{isComplete:ge(t,e,r,[],n),data:r}}const ee=t=>{if(!t.endsWith(".index")){if(t.endsWith(".values"))return t.substring(0,t.length-7);throw Error(`key must ends on .index/.values for binary p-column, got: ${t}`)}};function me(t){if(!t)return;const e=t.resourceType.name,n=t.getDataAsJson(),r=[];let s=0;switch(e){case J:s=n.keyLength;break;case $:s=n.partitionKeyLength+n.keyLength;break;case q:case N:s=n.partitionKeyLength;break;case B:case Y:s=n.superPartitionKeyLength+n.partitionKeyLength;break}switch(e){case J:case q:case N:for(let i of t.listInputFields()){if(e===N){const l=ee(i);if(l)i=l;else continue}const o=[...JSON.parse(i)];r.push(o)}break;case $:case B:case Y:for(const i of t.listInputFields()){const o=[...JSON.parse(i)],l=t.resolve({field:i,assertFieldType:"Input"});if(l!==void 0)for(let a of l.listInputFields()){if(e===B){const g=ee(a);if(g)a=g;else continue}const u=[...o,...JSON.parse(a)];r.push(u)}}break}return{data:r,keyLength:s}}function it(t){const e=me(t);if(!e)return;const{data:n,keyLength:r}=e,s=[];for(let i=0;i<r;++i)s.push(new Set);for(const i of n){if(i.length!==r)throw new Error("key length does not match partition length");for(let o=0;o<r;++o)s[o].add(i[o])}return s.map(i=>Array.from(i.values()))}const x="1.21.10";function ye(t){return t.__renderLambda===!0}function M(t){if(t!==void 0)return ye(t)?t.handle:t}function C(t){if(t!==void 0)return typeof t=="string"?{__renderLambda:!0,handle:t,retentive:!1}:t}function ot(t){if(t.v3!==void 0){const{initialArgs:e,initialUiState:n,inputsValid:r,outputs:s,renderingMode:i,sdkVersion:o,sections:l,title:a}=t.v3,{code:u}=t;return{initialArgs:e,initialUiState:n,inputsValid:r,outputs:s,renderingMode:i,sdkVersion:o,sections:l,title:a,code:u}}else if(t.inputsValid!==void 0){const{sdkVersion:e,renderingMode:n,outputs:r,inputsValid:s,sections:i,initialArgs:o,code:l}=t,a=Object.keys(t);if(e===void 0||n===void 0||r===void 0||s===void 0||i===void 0||o===void 0)throw new Error(`Malformed config v2. SDK version ${e}; Fields = ${a.join(", ")}`);return{sdkVersion:e,renderingMode:n,initialArgs:o,outputs:Object.fromEntries(Object.entries(r).map(([u,g])=>[u,C(g)])),inputsValid:C(s),sections:C(i),initialUiState:void 0,code:l}}else if(t.renderingMode!==void 0){const{sdkVersion:e,canRun:n,renderingMode:r,outputs:s,sections:i,initialArgs:o,code:l}=t,a=Object.keys(t);if(r===void 0||s===void 0||n===void 0||i===void 0||o===void 0)throw new Error(`Malformed config v1. SDK version ${e}; Fields = ${a.join(", ")}`);return{sdkVersion:e??"unknown",renderingMode:r,initialArgs:o,outputs:Object.fromEntries(Object.entries(s).map(([u,g])=>[u,C(g)])),inputsValid:C(n),sections:C(i),initialUiState:void 0,code:l}}else{const{sdkVersion:e}=t,n=Object.keys(t);throw new Error(`Config format not supported: SDK = ${e}; Fields = ${n.join(", ")}`)}}class v{constructor(e,n,r,s,i,o,l){this._renderingMode=e,this._initialArgs=n,this._initialUiState=r,this._outputs=s,this._inputsValid=i,this._sections=o,this._title=l}static create(e="Heavy"){return new v(e,void 0,{},{},E(!0),E([]),void 0)}output(e,n,r={}){if(typeof n=="function"){const s=`output#${e}`;return j(s,()=>n(new D)),new v(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:{__renderLambda:!0,handle:s,...r}},this._inputsValid,this._sections,this._title)}else return new v(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:n},this._inputsValid,this._sections,this._title)}retentiveOutput(e,n){return this.output(e,n,{retentive:!0})}canRun(e){return this.inputsValid(e)}argsValid(e){return typeof e=="function"?(j("inputsValid",()=>e(new D)),new v(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,{__renderLambda:!0,handle:"inputsValid"},this._sections,this._title)):new v(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,e,this._sections,this._title)}inputsValid(e){return this.argsValid(e)}sections(e){return Array.isArray(e)?this.sections(E(e)):typeof e=="function"?(j("sections",()=>e(new D)),new v(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,{__renderLambda:!0,handle:"sections"},this._title)):new v(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,e,this._title)}title(e){return j("title",()=>e(new D)),new v(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,{__renderLambda:!0,handle:"title"})}initialArgs(e){return new v(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title)}withArgs(e){return new v(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title)}withUiState(e){return new v(this._renderingMode,this._initialArgs,e,this._outputs,this._inputsValid,this._sections,this._title)}done(){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const e={v3:{sdkVersion:x,renderingMode:this._renderingMode,initialArgs:this._initialArgs,initialUiState:this._initialUiState,inputsValid:this._inputsValid,sections:this._sections,title:this._title,outputs:this._outputs},sdkVersion:x,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:M(this._inputsValid),sections:M(this._sections),outputs:Object.fromEntries(Object.entries(this._outputs).map(([n,r])=>[n,M(r)]))};return Ye()?se({sdkVersion:x}):{config:e}}}function at(t,e,n,r){var u,g;Array.isArray(r)&&(r={filters:r});const s=t.resultPool.getData().entries.map(d=>d.obj).filter(p.isPColumn).filter(d=>d.spec.name==="pl7.app/label"&&d.spec.axesSpec.length===1),i=(d,f)=>{let m=d.toString();if(f)for(const h in f)m+=h,m+=f[h];return m},o=new Map;for(const d of e)for(const f of d.spec.axesSpec){const m=p.getAxisId(f);for(const h of s){const I=h.spec.axesSpec[0],b=p.getAxisId(h.spec.axesSpec[0]);if(p.matchAxisId(m,b)){const O=Object.keys(m.domain??{}).length,V=Object.keys(b.domain??{}).length;if(O>V){const T=i(h.id,m.domain);o.set(T,{id:T,spec:{...h.spec,axesSpec:[{...m,annotations:I.annotations}]},data:h.data})}else o.set(i(h.id),h)}}}if([...e,...o.values()].some(d=>d.data instanceof _&&!d.data.getIsReadyOrError()))return;let l=e;const a=[];if(r!=null&&r.coreColumnPredicate){l=[];for(const d of e)r.coreColumnPredicate(d.spec)?l.push(d):a.push(d)}return a.push(...o.values()),t.createPTable({src:{type:"outer",primary:{type:(r==null?void 0:r.coreJoinType)??"full",entries:l.map(d=>({type:"column",column:d}))},secondary:a.map(d=>({type:"column",column:d}))},filters:[...(r==null?void 0:r.filters)??[],...((u=n==null?void 0:n.pTableParams)==null?void 0:u.filters)??[]],sorting:((g=n==null?void 0:n.pTableParams)==null?void 0:g.sorting)??[]})}function lt(t,e,n){const r=t.findLabels(e);return{axis:e,options:n.map(s=>({value:s,label:(r==null?void 0:r[s])??s.toString()})),defaultValue:n[0]}}const ut=(t,e)=>{let n=t.toString();return e==null||e.forEach(r=>{if(r)for(const[s,i]of Object.entries(r))n+=s,n+=i}),n};function ct(t){if(!t.length)return[];let e=[[]];return t.forEach(n=>{const r=[];n.forEach(s=>{r.push(...e.map(i=>[...i,s]))}),e=r}),e}function te(t,e){const n=t.spec.axesSpec.map(p.getAxisId),r=e.spec.axesSpec.map(p.getAxisId);if(r.every(a=>n.some(u=>p.matchAxisId(u,a)&&p.matchAxisId(a,u))))return[];if(!r.every(a=>n.some(u=>p.matchAxisId(u,a))))return[];const o=r.map(a=>n.filter(u=>p.matchAxisId(u,a)));return ct(o).map(a=>({id:ut(e.id,a.map(g=>g.domain)),spec:{...e.spec,axesSpec:a.map((g,d)=>({...g,annotations:e.spec.axesSpec[d].annotations}))},data:e.data}))}function be(t){const e=[];for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){const s=t[n],i=t[r];e.push(...te(s,i),...te(i,s))}return e}function dt(t,e){const n=[...e,...be(e)];if(!n.some(r=>r.data instanceof _&&!r.data.getIsReadyOrError()))return t.createPFrame(n)}class pt{constructor(e){this.handle=e}async findColumns(e){return await platforma.pFrameDriver.findColumns(this.handle,e)}async getColumnSpec(e){return await platforma.pFrameDriver.getColumnSpec(this.handle,e)}async listColumns(){return await platforma.pFrameDriver.listColumns(this.handle)}async calculateTableData(e){return await platforma.pFrameDriver.calculateTableData(this.handle,e)}async getUniqueValues(e){return await platforma.pFrameDriver.getUniqueValues(this.handle,e)}}function _e(t){return X({__isRef:!0,blockId:k(t,"blockId"),name:k(t,"name")})}function ft(t){return X({ref:_e(k(t,"ref")),label:k(t,"label")})}const ht={sdkVersion:x};function gt(){return se({sdkVersion:x})}function mt(t){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(t)}exports.Args=Ce;exports.BlockModel=v;exports.CurrentSdkInfo=ht;exports.FutureRef=P;exports.It=we;exports.JsRenderInternal=tt;exports.MainOutputs=Re;exports.OutputError=ne;exports.PAnnotationLabel=le;exports.PAnnotationTrace=ue;exports.PFrameImpl=pt;exports.RT_BINARY_PARTITIONED=N;exports.RT_BINARY_SUPER_PARTITIONED=B;exports.RT_JSON_PARTITIONED=q;exports.RT_JSON_SUPER_PARTITIONED=Y;exports.RT_RESOURCE_MAP=J;exports.RT_RESOURCE_MAP_PARTITIONED=$;exports.RenderCtx=D;exports.ResultPool=fe;exports.StagingOutputs=Oe;exports.Trace=de;exports.TraceEntry=ce;exports.TreeNodeAccessor=_;exports.UiState=Te;exports.and=Ve;exports.createPFrameForGraphs=dt;exports.createPlDataTable=at;exports.createPlDataTableSheet=lt;exports.deriveLabels=pe;exports.downgradeCfgOrLambda=M;exports.extractConfig=ot;exports.flatten=xe;exports.fromPlOption=ft;exports.fromPlRef=_e;exports.getAdditionalColumns=be;exports.getBlobContent=Ue;exports.getBlobContentAsJson=$e;exports.getBlobContentAsString=Je;exports.getDownloadedBlobContent=Ke;exports.getEnvironmentValue=mt;exports.getFromCfg=R;exports.getImmediate=E;exports.getImportProgress=He;exports.getJsonField=k;exports.getLastLogs=We;exports.getLogHandle=qe;exports.getOnDemandBlobContent=Ge;exports.getPartitionKeysList=me;exports.getProgressLog=ze;exports.getRawPlatformaInstance=gt;exports.getResourceField=Ne;exports.getResourceValueAsJson=Be;exports.getUniquePartitionKeys=it;exports.ifDef=U;exports.isConfigLambda=ye;exports.isEmpty=ke;exports.isolate=Ie;exports.makeArray=Fe;exports.makeObject=X;exports.mapArrayValues=Ee;exports.mapRecordValues=De;exports.mapResourceFields=Me;exports.not=Le;exports.or=je;exports.parseResourceMap=st;exports.readOutput=re;exports.wrapOutputs=Ae;Object.keys(p).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>p[t]})});
1
+ "use strict";var Pe=Object.defineProperty;var Ae=(t,e,n)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var A=(t,e,n)=>Ae(t,typeof e!="symbol"?e+"":e,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@milaboratories/pl-model-common"),w=require("zod");class ne extends Error{constructor(e,n){super(`${e.length}${n?"+":""} errors, first error: `+e[0]),this.errors=e,this.moreErrors=n}}function re(t){if(!t.ok)throw new ne(t.errors,t.moreErrors);return t.value}function Se(t){return new Proxy(t,{get(e,n){return re(e[n])}})}function y(t){return typeof t=="string"||typeof t=="number"||typeof t=="boolean"||t===null?D(t):t}function R(t){return{type:"GetFromCtx",variable:t}}function Ce(t){return{type:"Isolate",cfg:t}}const Ie=R("$args"),we=R("$it"),Re=R("$prod"),Oe=R("$staging"),Te=R("$ui");function D(t){return{type:"Immediate",value:t}}function X(t){const e={};for(const[n,r]of Object.entries(t))e[n]=y(r);return{type:"MakeObject",template:e}}function Fe(...t){const e=[];for(const n of t)e.push(y(n));return{type:"MakeArray",template:e}}function k(t,e){return{type:"GetJsonField",source:y(t),field:y(e)}}function xe(t,e,n="$it"){return{type:"MapRecordValues",source:t,mapping:e,itVar:n}}function De(t,e,n="$it"){return{type:"MapArrayValues",source:t,mapping:e,itVar:n}}function Ee(t){return{type:"Flatten",source:t}}function ke(t){return{type:"IsEmpty",arg:t}}function Le(t){return{type:"Not",operand:t}}function je(t,e){return{type:"And",operand1:t,operand2:e}}function Ve(t,e){return{type:"Or",operand1:t,operand2:e}}function Ne(t,e){return{type:"GetResourceField",source:y(t),field:y(e)}}function Be(){return function(t){return{type:"GetResourceValueAsJson",source:y(t)}}}function Me(t,e,n="$it"){return{type:"MapResourceFields",source:t,mapping:e,itVar:n}}function Ue(t){return{type:"GetBlobContent",source:y(t)}}function Je(t){return{type:"GetBlobContentAsString",source:y(t)}}function $e(){return function(t){return{type:"GetBlobContentAsJson",source:y(t)}}}function Ke(t){return{type:"GetDownloadedBlobContent",source:y(t)}}function Ge(t){return{type:"GetOnDemandBlobContent",source:y(t)}}function He(t){return{type:"GetImportProgress",source:y(t)}}function We(t,e){return{type:"GetLastLogs",source:y(t),lines:e}}function ze(t,e){return{type:"GetProgressLog",source:y(t),patternToSearch:e}}function qe(t){return{type:"GetLogHandle",source:y(t)}}function Ye(){return typeof globalThis.getPlatforma<"u"||typeof globalThis.platforma<"u"}function se(t){if(t&&typeof globalThis.getPlatforma=="function")return globalThis.getPlatforma(t);if(typeof globalThis.platforma<"u")return globalThis.platforma;throw new Error("Can't get platforma instance.")}function Xe(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx}function c(){if(typeof globalThis.cfgRenderCtx<"u")return globalThis.cfgRenderCtx;throw new Error("Not in config rendering context")}function V(t,e){const n=Xe();if(n===void 0)return!1;if(t in n.callbackRegistry)throw new Error(`Callback with key ${t} already registered.`);return n.callbackRegistry[t]=e,!0}const H=new Map;function Qe(t,e){t in c().callbackRegistry||(c().callbackRegistry[t]=n=>{for(const r of H.get(t))r(n)},H.set(t,[])),H.get(t).push(e)}class P{constructor(e,n=r=>r){A(this,"isResolved",!1);A(this,"resolvedValue");this.handle=e,this.postProcess=n,Qe(e,r=>{this.resolvedValue=n(r),this.isResolved=!0})}map(e){return new P(this.handle,n=>e(this.postProcess(n)))}mapDefined(e){return new P(this.handle,n=>{const r=this.postProcess(n);return r?e(r):void 0})}toJSON(){return this.isResolved?this.resolvedValue:{__awaited_futures__:[this.handle]}}}function U(t,e){return t===void 0?void 0:e(t)}class v{constructor(e,n){this.handle=e,this.resolvePath=n}resolve(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveOutput(...e){const n=e.map(r=>({assertFieldType:"Output",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveInput(...e){const n=e.map(r=>({assertFieldType:"Input",...typeof r=="string"?{field:r}:r}));return this.resolveWithCommon({},...n)}resolveAny(...e){return this.resolveWithCommon({},...e)}resolveWithCommon(e,...n){const r=[...this.resolvePath,...n.map(s=>typeof s=="string"?s:s.field)];return U(c().resolveWithCommon(this.handle,e,...n),s=>new v(s,r))}get resourceType(){return c().getResourceType(this.handle)}getInputsLocked(){return c().getInputsLocked(this.handle)}getOutputsLocked(){return c().getOutputsLocked(this.handle)}getIsReadyOrError(){return c().getIsReadyOrError(this.handle)}getIsFinal(){return c().getIsFinal(this.handle)}getError(){const e=[...this.resolvePath,"error"];return U(c().getError(this.handle),n=>new v(n,e))}listInputFields(){return c().listInputFields(this.handle)}listOutputFields(){return c().listOutputFields(this.handle)}listDynamicFields(){return c().listDynamicFields(this.handle)}getKeyValueBase64(e){return c().getKeyValueBase64(this.handle,e)}getKeyValueAsString(e){return c().getKeyValueAsString(this.handle,e)}getKeyValueAsJson(e){const n=this.getKeyValueAsString(e);if(n==null)throw new Error("Resource has no content.");return JSON.parse(n)}getDataBase64(){return c().getDataBase64(this.handle)}getDataAsString(){return c().getDataAsString(this.handle)}getDataAsJson(){const e=this.getDataAsString();if(e==null)throw new Error("Resource has no content.");return JSON.parse(e)}getPColumns(e=!1,n=""){const r=this.parsePObjectCollection(e,n);return r===void 0?void 0:Object.entries(r).map(([,i])=>{if(!p.isPColumn(i))throw new Error(`not a PColumn (kind = ${i.spec.kind})`);return i})}parsePObjectCollection(e=!1,n=""){const r=c().parsePObjectCollection(this.handle,e,n,...this.resolvePath);if(r===void 0)return;const s={};for(const[i,o]of Object.entries(r)){const l=[...this.resolvePath,i];s[i]=p.mapPObjectData(o,a=>new v(a,l))}return s}getFileContentAsBase64(){return new P(c().getBlobContentAsBase64(this.handle))}getFileContentAsString(){return new P(c().getBlobContentAsString(this.handle))}getFileContentAsJson(){return new P(c().getBlobContentAsString(this.handle)).mapDefined(e=>JSON.parse(e))}getBlobContentAsBase64(){return this.getFileContentAsBase64()}getBlobContentAsString(){return this.getFileContentAsString()}getFileHandle(){return new P(c().getDownloadedBlobContentHandle(this.handle))}getDownloadedBlobHandle(){return this.getFileHandle()}getRemoteFileHandle(){return new P(c().getOnDemandBlobContentHandle(this.handle))}getOnDemandBlobHandle(){return this.getRemoteFileHandle()}getImportProgress(){return new P(c().getImportProgress(this.handle))}getLastLogs(e){return new P(c().getLastLogs(this.handle,e))}getProgressLog(e){return new P(c().getProgressLog(this.handle,e))}getLogHandle(){return new P(c().getLogHandle(this.handle))}allFieldsResolved(e="Input"){switch(e){case"Input":return this.getInputsLocked()&&this.listInputFields().every(n=>this.resolve({field:n,assertFieldType:"Input"})!==void 0);case"Output":return this.getOutputsLocked()&&this.listOutputFields().every(n=>this.resolve({field:n,assertFieldType:"Output"})!==void 0)}}mapFields(e,n){const{fieldType:r,requireLocked:s,skipUnresolved:i}={fieldType:"Input",requireLocked:!0,skipUnresolved:!1,...n},o=e;if(s&&(r==="Input"&&!this.getInputsLocked()||r==="Output"&&!this.getOutputsLocked()))return;let a=(r==="Input"?this.listInputFields():r==="Output"?this.listOutputFields():this.listDynamicFields()).map(u=>[u,this.resolve({field:u,assertFieldType:r})]);return i&&(a=a.filter(u=>u[1]!==void 0)),a.map(([u,g])=>o(u,g))}}const ie="staging",oe="main",Ze={inlineColumnsSupport:!0,activeArgs:!0};function ae(t){return typeof t=="object"&&t!==null&&"__awaited_futures__"in t}function W(t,e,n){if(e.has(n))return;if(e.add(n),typeof n==="object")if(ae(n))n.__awaited_futures__.forEach(s=>t.add(s));else if(Array.isArray(n))for(const s of n)W(t,e,s);else for(const[,s]of Object.entries(n))s!==n&&W(t,e,s)}function et(t){const e=new Set;return W(e,new Set,t),e}const tt=Object.freeze(Object.defineProperty({__proto__:null,GlobalCfgRenderCtxFeatureFlags:Ze,MainAccessorName:oe,StagingAccessorName:ie,getAllFutureAwaits:et,isFutureAwait:ae},Symbol.toStringTag,{value:"Module"})),le="pl7.app/label",ue="pl7.app/trace",ce=w.z.object({type:w.z.string(),importance:w.z.number().optional(),id:w.z.string().optional(),label:w.z.string()}),de=w.z.array(ce),nt=.001,rt="__LABEL__",Z="__LABEL__@1";function pe(t,e,n={}){const r=new Map,s=new Map,i=t.map(f=>{var T,Q;const m=e(f),h=(T=m.annotations)==null?void 0:T[le],C=(Q=m.annotations)==null?void 0:Q[ue],b=(C?de.safeParse(JSON.parse(C)).data:void 0)??[];if(h){const S={label:h,type:rt,importance:-2};n.addLabelAsSuffix?b.push(S):b.splice(0,0,S)}const O=[],j=new Map;for(let S=b.length-1;S>=0;--S){const{type:K}=b[S],_e=b[S].importance??0,G=(j.get(K)??0)+1;j.set(K,G);const F=`${K}@${G}`;s.set(F,(s.get(F)??0)+1),r.set(F,Math.max(r.get(F)??Number.NEGATIVE_INFINITY,_e-(b.length-S)*nt)),O.push({...b[S],fullType:F,occurenceIndex:G})}return O.reverse(),{value:f,spec:m,label:h,fullTrace:O}}),o=[],l=[],a=[...r];a.sort(([,f],[,m])=>m-f);for(const[f]of a)f.endsWith("@1")||s.get(f)===t.length?o.push(f):l.push(f);const u=f=>i.map(m=>{const h=m.fullTrace.filter(b=>f.has(b.fullType)).map(b=>b.label),C=n.separator??" / ";return{label:h.join(C),value:m.value}});if(o.length===0){if(l.length!==0)throw new Error("Assertion error.");return u(new Set(Z))}let g=0,d=0;for(;g<o.length;){const f=new Set;n.includeNativeLabel&&f.add(Z);for(let h=0;h<g;++h)f.add(o[h]);f.add(o[d]);const m=u(f);if(new Set(m.map(h=>h.label)).size===t.length)return m;d++,d==o.length&&(g++,d=g)}return u(new Set([...o,...l]))}class fe{constructor(){A(this,"ctx",c());A(this,"defaultLabelFn",(e,n)=>{var r;return((r=e.annotations)==null?void 0:r["pl7.app/label"])??"Unlabelled"})}calculateOptions(e){return this.ctx.calculateOptions(e)}getOptions(e,n){const r=this.getSpecs().entries.filter(s=>e(s.obj));return typeof n=="object"||typeof n>"u"?pe(r,s=>s.obj,n??{}).map(({value:{ref:s},label:i})=>({ref:s,label:i})):r.map(s=>({ref:s.ref,label:n(s.obj,s.ref)}))}getDataFromResultPool(){return this.getData()}getData(){const e=this.ctx.getDataFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:new v(n.obj.data,[n.ref.blockId,n.ref.name])}}))}}getDataWithErrorsFromResultPool(){return this.getDataWithErrors()}getDataWithErrors(){const e=this.ctx.getDataWithErrorsFromResultPool();return{isComplete:e.isComplete,entries:e.entries.map(n=>({ref:n.ref,obj:{...n.obj,data:p.mapValueInVOE(n.obj.data,r=>new v(r,[n.ref.blockId,n.ref.name]))}}))}}getSpecsFromResultPool(){return this.getSpecs()}getSpecs(){return this.ctx.getSpecsFromResultPool()}getDataByRef(e){var n;return typeof this.ctx.getDataFromResultPoolByRef>"u"?(n=this.getData().entries.find(r=>r.ref.blockId===e.blockId&&r.ref.name===e.name))==null?void 0:n.obj:p.mapPObjectData(this.ctx.getDataFromResultPoolByRef(e.blockId,e.name),r=>new v(r,[e.blockId,e.name]))}getPColumnByRef(e){const n=this.getDataByRef(e);if(n)return p.ensurePColumn(n)}getPColumnSpecByRef(e){const n=this.getSpecByRef(e);if(n){if(!p.isPColumnSpec(n))throw new Error(`not a PColumn spec (kind = ${n.kind})`);return n}}getSpecByRef(e){var n;return typeof this.ctx.getSpecFromResultPoolByRef>"u"?(n=this.getSpecs().entries.find(r=>r.ref.blockId===e.blockId&&r.ref.name===e.name))==null?void 0:n.obj:this.ctx.getSpecFromResultPoolByRef(e.blockId,e.name)}findDataWithCompatibleSpec(e){const n=[];e:for(const r of this.getData().entries){if(!p.isPColumnSpec(r.obj.spec))continue;const s=r.obj.spec;if(e.name===s.name&&e.valueType===s.valueType&&e.axesSpec.length===s.axesSpec.length&&z(e.domain,s.domain)){for(let i=0;i<e.axesSpec.length;++i){const o=e.axesSpec[i],l=s.axesSpec[i];if(o.name!==l.name||o.type!==l.type||!z(o.domain,l.domain))continue e}n.push(r.obj)}}return n}}function z(t,e){if(t===void 0)return e===void 0;if(e===void 0)return!0;for(const n in e)if(t[n]!==e[n])return!1;return!0}class x{constructor(){A(this,"ctx");A(this,"args");A(this,"uiState");A(this,"_activeArgsCache");A(this,"resultPool",new fe);this.ctx=c(),this.args=JSON.parse(this.ctx.args),this.uiState=this.ctx.uiState!==void 0?JSON.parse(this.ctx.uiState):{}}get activeArgs(){return this._activeArgsCache===void 0&&(this._activeArgsCache={v:this.ctx.activeArgs?JSON.parse(this.ctx.activeArgs):void 0}),this._activeArgsCache.v}getNamedAccessor(e){return U(this.ctx.getAccessorHandleByName(e),n=>new v(n,[e]))}get prerun(){return this.getNamedAccessor(ie)}get outputs(){return this.getNamedAccessor(oe)}findLabels(e){const n=this.resultPool.getData();for(const r of n.entries){if(!p.isPColumn(r.obj))continue;const s=r.obj.spec;if(s.name==="pl7.app/label"&&s.axesSpec.length===1&&s.axesSpec[0].name===e.name&&s.axesSpec[0].type===e.type&&z(e.domain,s.axesSpec[0].domain)){if(r.obj.data.resourceType.name!=="PColumnData/Json")throw Error(`Expected JSON column for labels, got: ${r.obj.data.resourceType.name}`);return Object.fromEntries(Object.entries(r.obj.data.getDataAsJson().data).map(o=>[JSON.parse(o[0])[0],o[1]]))}}}verifyInlineColumnsSupport(e){var s;const n=e.some(i=>!(i.data instanceof v)),r=((s=this.ctx.featureFlags)==null?void 0:s.inlineColumnsSupport)===!0;if(n&&!r)throw Error("inline columns not supported")}createPFrame(e){return this.verifyInlineColumnsSupport(e),this.ctx.createPFrame(e.map(n=>p.mapPObjectData(n,r=>r instanceof v?r.handle:r)))}createPTable(e){var n;return"columns"in e?n={src:{type:"full",entries:e.columns.map(r=>({type:"column",column:r}))},filters:e.filters??[],sorting:e.sorting??[]}:n=e,this.verifyInlineColumnsSupport(p.extractAllColumns(n.src)),this.ctx.createPTable(p.mapPTableDef(n,r=>p.mapPObjectData(r,s=>s instanceof v?s.handle:s)))}getBlockLabel(e){return this.ctx.getBlockLabel(e)}getCurrentUnstableMarker(){if(!(typeof this.ctx.getCurrentUnstableMarker>"u"))return this.ctx.getCurrentUnstableMarker()}}const L="PColumnData/",J=L+"ResourceMap",$=L+"Partitioned/ResourceMap",q=L+"JsonPartitioned",N=L+"BinaryPartitioned",he=L+"Partitioned/",Y=he+"JsonPartitioned",B=he+"BinaryPartitioned";function ge(t,e,n,r=[],s){if(t===void 0)return!1;switch(t.resourceType.name){case J:{let i=t.getInputsLocked();for(const o of t.listInputFields()){const l=t.resolve({field:o,assertFieldType:"Input"}),a=[...r,...JSON.parse(o)],u=l===void 0?void 0:e(l);u===void 0&&(i=!1),(u!==void 0||s)&&n.push({key:a,value:u})}return i}case $:{let i=t.getInputsLocked();for(const o of t.listInputFields()){const l=t.resolve({field:o,assertFieldType:"Input"});if(l===void 0)i=!1;else{const a=[...r,...JSON.parse(o)],u=ge(l,e,n,a,s);i=i&&u}}return i}default:throw new Error(`Unknown resource type: ${t.resourceType.name}`)}}function st(t,e,n=!1){const r=[];return{isComplete:ge(t,e,r,[],n),data:r}}const ee=t=>{if(!t.endsWith(".index")){if(t.endsWith(".values"))return t.substring(0,t.length-7);throw Error(`key must ends on .index/.values for binary p-column, got: ${t}`)}};function me(t){if(!t)return;const e=t.resourceType.name,n=t.getDataAsJson(),r=[];let s=0;switch(e){case J:s=n.keyLength;break;case $:s=n.partitionKeyLength+n.keyLength;break;case q:case N:s=n.partitionKeyLength;break;case B:case Y:s=n.superPartitionKeyLength+n.partitionKeyLength;break}switch(e){case J:case q:case N:for(let i of t.listInputFields()){if(e===N){const l=ee(i);if(l)i=l;else continue}const o=[...JSON.parse(i)];r.push(o)}break;case $:case B:case Y:for(const i of t.listInputFields()){const o=[...JSON.parse(i)],l=t.resolve({field:i,assertFieldType:"Input"});if(l!==void 0)for(let a of l.listInputFields()){if(e===B){const g=ee(a);if(g)a=g;else continue}const u=[...o,...JSON.parse(a)];r.push(u)}}break}return{data:r,keyLength:s}}function it(t){const e=me(t);if(!e)return;const{data:n,keyLength:r}=e,s=[];for(let i=0;i<r;++i)s.push(new Set);for(const i of n){if(i.length!==r)throw new Error("key length does not match partition length");for(let o=0;o<r;++o)s[o].add(i[o])}return s.map(i=>Array.from(i.values()))}const E="1.22.0";function ye(t){return t.__renderLambda===!0}function M(t){if(t!==void 0)return ye(t)?t.handle:t}function I(t){if(t!==void 0)return typeof t=="string"?{__renderLambda:!0,handle:t,retentive:!1}:t}function ot(t){if(t.v3!==void 0){const{initialArgs:e,initialUiState:n,inputsValid:r,outputs:s,renderingMode:i,sdkVersion:o,sections:l,title:a}=t.v3,{code:u}=t;return{initialArgs:e,initialUiState:n,inputsValid:r,outputs:s,renderingMode:i,sdkVersion:o,sections:l,title:a,code:u}}else if(t.inputsValid!==void 0){const{sdkVersion:e,renderingMode:n,outputs:r,inputsValid:s,sections:i,initialArgs:o,code:l}=t,a=Object.keys(t);if(e===void 0||n===void 0||r===void 0||s===void 0||i===void 0||o===void 0)throw new Error(`Malformed config v2. SDK version ${e}; Fields = ${a.join(", ")}`);return{sdkVersion:e,renderingMode:n,initialArgs:o,outputs:Object.fromEntries(Object.entries(r).map(([u,g])=>[u,I(g)])),inputsValid:I(s),sections:I(i),initialUiState:void 0,code:l}}else if(t.renderingMode!==void 0){const{sdkVersion:e,canRun:n,renderingMode:r,outputs:s,sections:i,initialArgs:o,code:l}=t,a=Object.keys(t);if(r===void 0||s===void 0||n===void 0||i===void 0||o===void 0)throw new Error(`Malformed config v1. SDK version ${e}; Fields = ${a.join(", ")}`);return{sdkVersion:e??"unknown",renderingMode:r,initialArgs:o,outputs:Object.fromEntries(Object.entries(s).map(([u,g])=>[u,I(g)])),inputsValid:I(n),sections:I(i),initialUiState:void 0,code:l}}else{const{sdkVersion:e}=t,n=Object.keys(t);throw new Error(`Config format not supported: SDK = ${e}; Fields = ${n.join(", ")}`)}}class _{constructor(e,n,r,s,i,o,l){this._renderingMode=e,this._initialArgs=n,this._initialUiState=r,this._outputs=s,this._inputsValid=i,this._sections=o,this._title=l}static create(e="Heavy"){return new _(e,void 0,{},{},D(!0),D([]),void 0)}output(e,n,r={}){if(typeof n=="function"){const s=`output#${e}`;return V(s,()=>n(new x)),new _(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:{__renderLambda:!0,handle:s,...r}},this._inputsValid,this._sections,this._title)}else return new _(this._renderingMode,this._initialArgs,this._initialUiState,{...this._outputs,[e]:n},this._inputsValid,this._sections,this._title)}retentiveOutput(e,n){return this.output(e,n,{retentive:!0})}argsValid(e){return typeof e=="function"?(V("inputsValid",()=>e(new x)),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,{__renderLambda:!0,handle:"inputsValid"},this._sections,this._title)):new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,e,this._sections,this._title)}sections(e){return Array.isArray(e)?this.sections(D(e)):typeof e=="function"?(V("sections",()=>e(new x)),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,{__renderLambda:!0,handle:"sections"},this._title)):new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,e,this._title)}title(e){return V("title",()=>e(new x)),new _(this._renderingMode,this._initialArgs,this._initialUiState,this._outputs,this._inputsValid,this._sections,{__renderLambda:!0,handle:"title"})}initialArgs(e){return new _(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title)}withArgs(e){return new _(this._renderingMode,e,this._initialUiState,this._outputs,this._inputsValid,this._sections,this._title)}withUiState(e){return new _(this._renderingMode,this._initialArgs,e,this._outputs,this._inputsValid,this._sections,this._title)}done(){if(this._initialArgs===void 0)throw new Error("Initial arguments not set.");const e={v3:{sdkVersion:E,renderingMode:this._renderingMode,initialArgs:this._initialArgs,initialUiState:this._initialUiState,inputsValid:this._inputsValid,sections:this._sections,title:this._title,outputs:this._outputs},sdkVersion:E,renderingMode:this._renderingMode,initialArgs:this._initialArgs,inputsValid:M(this._inputsValid),sections:M(this._sections),outputs:Object.fromEntries(Object.entries(this._outputs).map(([n,r])=>[n,M(r)]))};return Ye()?se({sdkVersion:E}):{config:e}}}function at(t,e,n,r){var u,g;Array.isArray(r)&&(r={filters:r});const s=t.resultPool.getData().entries.map(d=>d.obj).filter(p.isPColumn).filter(d=>d.spec.name==="pl7.app/label"&&d.spec.axesSpec.length===1),i=(d,f)=>{let m=d.toString();if(f)for(const h in f)m+=h,m+=f[h];return m},o=new Map;for(const d of e)for(const f of d.spec.axesSpec){const m=p.getAxisId(f);for(const h of s){const C=h.spec.axesSpec[0],b=p.getAxisId(h.spec.axesSpec[0]);if(p.matchAxisId(m,b)){const O=Object.keys(m.domain??{}).length,j=Object.keys(b.domain??{}).length;if(O>j){const T=i(h.id,m.domain);o.set(T,{id:T,spec:{...h.spec,axesSpec:[{...m,annotations:C.annotations}]},data:h.data})}else o.set(i(h.id),h)}}}if([...e,...o.values()].some(d=>d.data instanceof v&&!d.data.getIsReadyOrError()))return;let l=e;const a=[];if(r!=null&&r.coreColumnPredicate){l=[];for(const d of e)r.coreColumnPredicate(d.spec)?l.push(d):a.push(d)}return a.push(...o.values()),t.createPTable({src:{type:"outer",primary:{type:(r==null?void 0:r.coreJoinType)??"full",entries:l.map(d=>({type:"column",column:d}))},secondary:a.map(d=>({type:"column",column:d}))},filters:[...(r==null?void 0:r.filters)??[],...((u=n==null?void 0:n.pTableParams)==null?void 0:u.filters)??[]],sorting:((g=n==null?void 0:n.pTableParams)==null?void 0:g.sorting)??[]})}function lt(t,e,n){const r=t.findLabels(e);return{axis:e,options:n.map(s=>({value:s,label:(r==null?void 0:r[s])??s.toString()})),defaultValue:n[0]}}const ut=(t,e)=>{let n=t.toString();return e==null||e.forEach(r=>{if(r)for(const[s,i]of Object.entries(r))n+=s,n+=i}),n};function ct(t){if(!t.length)return[];let e=[[]];return t.forEach(n=>{const r=[];n.forEach(s=>{r.push(...e.map(i=>[...i,s]))}),e=r}),e}function te(t,e){const n=t.spec.axesSpec.map(p.getAxisId),r=e.spec.axesSpec.map(p.getAxisId);if(r.every(a=>n.some(u=>p.matchAxisId(u,a)&&p.matchAxisId(a,u))))return[];if(!r.every(a=>n.some(u=>p.matchAxisId(u,a))))return[];const o=r.map(a=>n.filter(u=>p.matchAxisId(u,a)));return ct(o).map(a=>({id:ut(e.id,a.map(g=>g.domain)),spec:{...e.spec,axesSpec:a.map((g,d)=>({...g,annotations:e.spec.axesSpec[d].annotations}))},data:e.data}))}function be(t){const e=[];for(let n=0;n<t.length;n++)for(let r=n+1;r<t.length;r++){const s=t[n],i=t[r];e.push(...te(s,i),...te(i,s))}return e}function dt(t,e){const n=[...e,...be(e)];if(!n.some(r=>r.data instanceof v&&!r.data.getIsReadyOrError()))return t.createPFrame(n)}class pt{constructor(e){this.handle=e}async findColumns(e){return await platforma.pFrameDriver.findColumns(this.handle,e)}async getColumnSpec(e){return await platforma.pFrameDriver.getColumnSpec(this.handle,e)}async listColumns(){return await platforma.pFrameDriver.listColumns(this.handle)}async calculateTableData(e){return await platforma.pFrameDriver.calculateTableData(this.handle,e)}async getUniqueValues(e){return await platforma.pFrameDriver.getUniqueValues(this.handle,e)}}function ve(t){return X({__isRef:!0,blockId:k(t,"blockId"),name:k(t,"name")})}function ft(t){return X({ref:ve(k(t,"ref")),label:k(t,"label")})}const ht={sdkVersion:E};function gt(){return se({sdkVersion:E})}function mt(t){if(typeof globalThis.getEnvironmentValue=="function")return globalThis.getEnvironmentValue(t)}exports.Args=Ie;exports.BlockModel=_;exports.CurrentSdkInfo=ht;exports.FutureRef=P;exports.It=we;exports.JsRenderInternal=tt;exports.MainOutputs=Re;exports.OutputError=ne;exports.PAnnotationLabel=le;exports.PAnnotationTrace=ue;exports.PFrameImpl=pt;exports.RT_BINARY_PARTITIONED=N;exports.RT_BINARY_SUPER_PARTITIONED=B;exports.RT_JSON_PARTITIONED=q;exports.RT_JSON_SUPER_PARTITIONED=Y;exports.RT_RESOURCE_MAP=J;exports.RT_RESOURCE_MAP_PARTITIONED=$;exports.RenderCtx=x;exports.ResultPool=fe;exports.StagingOutputs=Oe;exports.Trace=de;exports.TraceEntry=ce;exports.TreeNodeAccessor=v;exports.UiState=Te;exports.and=je;exports.createPFrameForGraphs=dt;exports.createPlDataTable=at;exports.createPlDataTableSheet=lt;exports.deriveLabels=pe;exports.downgradeCfgOrLambda=M;exports.extractConfig=ot;exports.flatten=Ee;exports.fromPlOption=ft;exports.fromPlRef=ve;exports.getAdditionalColumns=be;exports.getBlobContent=Ue;exports.getBlobContentAsJson=$e;exports.getBlobContentAsString=Je;exports.getDownloadedBlobContent=Ke;exports.getEnvironmentValue=mt;exports.getFromCfg=R;exports.getImmediate=D;exports.getImportProgress=He;exports.getJsonField=k;exports.getLastLogs=We;exports.getLogHandle=qe;exports.getOnDemandBlobContent=Ge;exports.getPartitionKeysList=me;exports.getProgressLog=ze;exports.getRawPlatformaInstance=gt;exports.getResourceField=Ne;exports.getResourceValueAsJson=Be;exports.getUniquePartitionKeys=it;exports.ifDef=U;exports.isConfigLambda=ye;exports.isEmpty=ke;exports.isolate=Ce;exports.makeArray=Fe;exports.makeObject=X;exports.mapArrayValues=De;exports.mapRecordValues=xe;exports.mapResourceFields=Me;exports.not=Le;exports.or=Ve;exports.parseResourceMap=st;exports.readOutput=re;exports.wrapOutputs=Se;Object.keys(p).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>p[t]})});
2
2
  //# sourceMappingURL=index.js.map