@platforma-sdk/model 1.2.22

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.
@@ -0,0 +1,197 @@
1
+ export type Cfg =
2
+ | CfgGetFromCtx
3
+ | CfgIsolate
4
+ | CfgImmediate
5
+ | CfgMakeObject
6
+ | CfgMakeArray
7
+ | CfgGetJsonField
8
+ | CfgMapRecordValues
9
+ | CfgMapArrayValues
10
+ | CfgFlatten
11
+ | CfgIsEmpty
12
+ | CfgNot
13
+ | CfgAnd
14
+ | CfgOr
15
+ | CfgMapResourceFields
16
+ | CfgGetResourceField
17
+ | CfgResourceValueAsJson
18
+ | CfgBlobContent
19
+ | CfgBlobContentAsString
20
+ | CfgBlobContentAsJson
21
+ | CfgDownloadedBlobContent
22
+ | CfgOnDemandBlobContent
23
+ | CfgImportProgress
24
+ | CfgLastLogs
25
+ | CfgProgressLog
26
+ | CfgLogHandle;
27
+
28
+ //
29
+ // Isolate / Rendering Mode
30
+ //
31
+
32
+ /** Forces wrapped config to be rendered asynchronously, using its own
33
+ * rendering cell */
34
+ export type CfgIsolate = {
35
+ type: 'Isolate';
36
+ cfg: Cfg;
37
+ };
38
+
39
+ //
40
+ // Context
41
+ //
42
+
43
+ export type CfgGetFromCtx = {
44
+ type: 'GetFromCtx';
45
+ variable: string;
46
+ };
47
+
48
+ //
49
+ // Json
50
+ //
51
+
52
+ export type CfgImmediate = {
53
+ type: 'Immediate';
54
+ value: any;
55
+ };
56
+
57
+ export type CfgGetJsonField = {
58
+ type: 'GetJsonField';
59
+ source: Cfg;
60
+ field: Cfg;
61
+ };
62
+
63
+ export type CfgMakeObject = {
64
+ type: 'MakeObject';
65
+ template: Record<string, Cfg>;
66
+ };
67
+
68
+ export type CfgMakeArray = {
69
+ type: 'MakeArray';
70
+ template: Cfg[];
71
+ };
72
+
73
+ export type CfgMapRecordValues = {
74
+ type: 'MapRecordValues';
75
+ source: Cfg;
76
+ itVar: string;
77
+ mapping: Cfg;
78
+ };
79
+
80
+ export type CfgMapArrayValues = {
81
+ type: 'MapArrayValues';
82
+ source: Cfg;
83
+ itVar: string;
84
+ mapping: Cfg;
85
+ };
86
+
87
+ export type CfgFlatten = {
88
+ type: 'Flatten';
89
+ source: Cfg;
90
+ };
91
+
92
+ //
93
+ // Boolean
94
+ //
95
+
96
+ export type CfgIsEmpty = {
97
+ type: 'IsEmpty';
98
+ arg: Cfg;
99
+ };
100
+
101
+ export type CfgNot = {
102
+ type: 'Not';
103
+ operand: Cfg;
104
+ };
105
+
106
+ export type CfgAnd = {
107
+ type: 'And';
108
+ operand1: Cfg;
109
+ operand2: Cfg;
110
+ };
111
+
112
+ export type CfgOr = {
113
+ type: 'Or';
114
+ operand1: Cfg;
115
+ operand2: Cfg;
116
+ };
117
+
118
+ //
119
+ // Resources
120
+ //
121
+
122
+ export type CfgMapResourceFields = {
123
+ type: 'MapResourceFields';
124
+ source: Cfg;
125
+ itVar: string;
126
+ mapping: Cfg;
127
+ };
128
+
129
+ export type CfgGetResourceField = {
130
+ type: 'GetResourceField';
131
+ source: Cfg;
132
+ field: Cfg;
133
+ };
134
+
135
+ export type CfgResourceValueAsJson = {
136
+ type: 'GetResourceValueAsJson';
137
+ source: Cfg;
138
+ };
139
+
140
+ //
141
+ // Download Blobs
142
+ //
143
+
144
+ export type CfgBlobContent = {
145
+ type: 'GetBlobContent';
146
+ source: Cfg;
147
+ };
148
+
149
+ export type CfgBlobContentAsString = {
150
+ type: 'GetBlobContentAsString';
151
+ source: Cfg;
152
+ };
153
+
154
+ export type CfgBlobContentAsJson = {
155
+ type: 'GetBlobContentAsJson';
156
+ source: Cfg;
157
+ };
158
+
159
+ export type CfgDownloadedBlobContent = {
160
+ type: 'GetDownloadedBlobContent';
161
+ source: Cfg;
162
+ };
163
+
164
+ export type CfgOnDemandBlobContent = {
165
+ type: 'GetOnDemandBlobContent';
166
+ source: Cfg;
167
+ };
168
+
169
+ //
170
+ // Uploads Blobs
171
+ //
172
+
173
+ export type CfgImportProgress = {
174
+ type: 'GetImportProgress';
175
+ source: Cfg;
176
+ };
177
+
178
+ //
179
+ // Logs
180
+ //
181
+
182
+ export type CfgLastLogs = {
183
+ type: 'GetLastLogs';
184
+ source: Cfg;
185
+ lines: number;
186
+ };
187
+
188
+ export type CfgProgressLog = {
189
+ type: 'GetProgressLog';
190
+ source: Cfg;
191
+ patternToSearch: string;
192
+ };
193
+
194
+ export type CfgLogHandle = {
195
+ type: 'GetLogHandle';
196
+ source: Cfg;
197
+ };
@@ -0,0 +1,5 @@
1
+ /** Divides all configurations into two broad classes. Some configs can be
2
+ * executed synchronously, given all their arguments are already rendered.
3
+ * Some require creation of a separate rendering cell, like downloading
4
+ * files. */
5
+ export type CfgRenderingMode = 'Sync' | 'Async';
@@ -0,0 +1,58 @@
1
+ import { ActGetImmediate } from './actions_kinds';
2
+ import { Cfg } from './model';
3
+
4
+ // Higher kind types pattern taken from here: https://code.lol/post/programming/higher-kinded-types/
5
+
6
+ type GenericFunction = (x: any) => unknown;
7
+
8
+ /** This is a type constructor deriving a returned type of config given the
9
+ * context type. Something like ConfAction<Cfg> -> ReturnedType. */
10
+ export interface ConfAction {
11
+ readonly ctx: unknown;
12
+ new: GenericFunction;
13
+ isSync: boolean;
14
+ }
15
+
16
+ /** This type basically sets parameter to a ConfAction kind. */
17
+ export type ActionResult<A extends ConfAction, Ctx> = ReturnType<
18
+ (A & {
19
+ readonly ctx: Ctx;
20
+ })['new']
21
+ >;
22
+
23
+ // Branding pattern taken from here: https://egghead.io/blog/using-branded-types-in-typescript
24
+
25
+ /** Field key to attach ConfAction information to a config type. */
26
+ declare const __config_action__: unique symbol;
27
+
28
+ /** Creates branded Cfg type */
29
+ export type TypedConfig<Action extends ConfAction = ConfAction> = Cfg & {
30
+ [__config_action__]: Action;
31
+ };
32
+
33
+ export type PrimitiveOrConfig = TypedConfig | string | number | boolean | null;
34
+
35
+ /** Converts primitive types to immediate config */
36
+ export type PrimitiveToCfg<T extends PrimitiveOrConfig> = T extends string | number | boolean | null
37
+ ? TypedConfig<ActGetImmediate<T>>
38
+ : T;
39
+
40
+ /** Extracts action */
41
+ export type ExtractAction<Cfg extends TypedConfig> = Cfg[typeof __config_action__];
42
+
43
+ export type POCExtractAction<T extends PrimitiveOrConfig> = ExtractAction<PrimitiveToCfg<T>>;
44
+
45
+ export type InferVarTypeSafe<Ctx, V> = V extends string
46
+ ? Ctx extends { [key in V]: infer T }
47
+ ? T
48
+ : undefined
49
+ : unknown;
50
+
51
+ export type ConfigResult<Cfg extends TypedConfig, Ctx> = ActionResult<ExtractAction<Cfg>, Ctx>;
52
+
53
+ declare const plResourceEntry: unique symbol;
54
+
55
+ /** Marks that a certain variable in context is a resource entry */
56
+ export type PlResourceEntry = typeof plResourceEntry;
57
+
58
+ export type OptionalPlResourceEntry = PlResourceEntry | undefined;
@@ -0,0 +1,25 @@
1
+ import { ExtractAction, TypedConfig } from './type_engine';
2
+
3
+ export type SyncConfAction = { isSync: true };
4
+
5
+ export type IsSyncConf<Cfg extends TypedConfig> =
6
+ ExtractAction<Cfg> extends SyncConfAction ? true : false;
7
+ export type CheckedSyncConf<Cfg extends TypedConfig> = Checked<Cfg, IsSyncConf<Cfg>>;
8
+
9
+ export type Not<T extends boolean> = T extends true ? false : true;
10
+
11
+ export type Or<A extends boolean, B extends boolean> = A extends true
12
+ ? true
13
+ : B extends true
14
+ ? true
15
+ : false;
16
+
17
+ export type And<A extends boolean, B extends boolean> = A extends true
18
+ ? B extends true
19
+ ? true
20
+ : false
21
+ : false;
22
+
23
+ export type IsA<T, E> = T extends E ? true : false;
24
+
25
+ export type Checked<Type, Condition> = Condition extends true ? Type : 'error';
package/src/index.ts ADDED
@@ -0,0 +1,15 @@
1
+ export * from './block_state_patch';
2
+ export * from './block_state_util';
3
+ export * from './builder';
4
+ export * from './components';
5
+ export * from './config';
6
+ export * from './pframe';
7
+ export * from './platforma';
8
+ export * from './ref_util';
9
+ export * from './render';
10
+ export * from './sdk_info';
11
+
12
+ // reexporting everything from SDK model
13
+ export * from '@milaboratories/pl-model-common';
14
+
15
+ export * as JsRenderInternal from './render/internal';
@@ -0,0 +1,56 @@
1
+ import { Platforma, PlatformaFactory } from './platforma';
2
+ import { BlockConfig } from './builder';
3
+ import { FutureHandle, GlobalCfgRenderCtx } from './render/internal';
4
+
5
+ declare global {
6
+ /** Global factory method returning platforma instance */
7
+ const getPlatforma: PlatformaFactory;
8
+ const platforma: Platforma;
9
+
10
+ /** Global rendering context, present only in rendering environment */
11
+ const cfgRenderCtx: GlobalCfgRenderCtx;
12
+ }
13
+
14
+ /** Utility code helping to identify whether the code is running in actual UI environment */
15
+ export function isInUI() {
16
+ return typeof getPlatforma !== 'undefined' || typeof platforma !== 'undefined';
17
+ }
18
+
19
+ /** Utility code helping to retrieve a platforma instance form the environment */
20
+ export function getPlatformaInstance(config: BlockConfig): Platforma {
21
+ if (typeof getPlatforma === 'function') return getPlatforma(config);
22
+ else if (typeof platforma !== 'undefined') return platforma;
23
+ else throw new Error("Can't get platforma instance.");
24
+ }
25
+
26
+ export function tryGetCfgRenderCtx(): GlobalCfgRenderCtx | undefined {
27
+ if (typeof cfgRenderCtx !== 'undefined') return cfgRenderCtx;
28
+ else return undefined;
29
+ }
30
+
31
+ export function getCfgRenderCtx(): GlobalCfgRenderCtx {
32
+ if (typeof cfgRenderCtx !== 'undefined') return cfgRenderCtx;
33
+ else throw new Error('Not in config rendering context');
34
+ }
35
+
36
+ export function tryRegisterCallback(key: string, callback: (...args: any[]) => any): boolean {
37
+ const ctx = tryGetCfgRenderCtx();
38
+ if (ctx === undefined) return false;
39
+ if (key in ctx.callbackRegistry) throw new Error(`Callback with key ${key} already registered.`);
40
+ ctx.callbackRegistry[key] = callback;
41
+ return true;
42
+ }
43
+
44
+ const futureResolves = new Map<string, ((value: unknown) => void)[]>();
45
+
46
+ export function registerFutureAwait(handle: FutureHandle, onResolve: (value: unknown) => void) {
47
+ if (!(handle in getCfgRenderCtx().callbackRegistry)) {
48
+ getCfgRenderCtx().callbackRegistry[handle] = (value: unknown) => {
49
+ for (const res of futureResolves.get(handle)!) {
50
+ res(value);
51
+ }
52
+ };
53
+ futureResolves.set(handle, []);
54
+ }
55
+ futureResolves.get(handle)!.push(onResolve);
56
+ }
package/src/pframe.ts ADDED
@@ -0,0 +1,39 @@
1
+ import {
2
+ CalculateTableDataRequest,
3
+ CalculateTableDataResponse,
4
+ FindColumnsRequest,
5
+ FindColumnsResponse,
6
+ PColumnIdAndSpec,
7
+ PColumnSpec,
8
+ PFrame,
9
+ PFrameHandle,
10
+ PObjectId,
11
+ UniqueValuesRequest,
12
+ UniqueValuesResponse
13
+ } from '@milaboratories/pl-model-common';
14
+
15
+ export class PFrameImpl implements PFrame {
16
+ constructor(private readonly handle: PFrameHandle) {}
17
+
18
+ public async findColumns(request: FindColumnsRequest): Promise<FindColumnsResponse> {
19
+ return await platforma.pFrameDriver.findColumns(this.handle, request);
20
+ }
21
+
22
+ public async getColumnSpec(columnId: PObjectId): Promise<PColumnSpec> {
23
+ return await platforma.pFrameDriver.getColumnSpec(this.handle, columnId);
24
+ }
25
+
26
+ public async listColumns(): Promise<PColumnIdAndSpec[]> {
27
+ return await platforma.pFrameDriver.listColumns(this.handle);
28
+ }
29
+
30
+ public async calculateTableData(
31
+ request: CalculateTableDataRequest<PObjectId>
32
+ ): Promise<CalculateTableDataResponse> {
33
+ return await platforma.pFrameDriver.calculateTableData(this.handle, request);
34
+ }
35
+
36
+ public async getUniqueValues(request: UniqueValuesRequest): Promise<UniqueValuesResponse> {
37
+ return await platforma.pFrameDriver.getUniqueValues(this.handle, request);
38
+ }
39
+ }
@@ -0,0 +1,46 @@
1
+ import { BlockApi } from './block_api';
2
+ import { BlockOutputsBase, BlockState, DriverKit, ValueOrErrors } from '@milaboratories/pl-model-common';
3
+ import { BlockConfig } from './builder';
4
+ import { SdkInfo } from './sdk_info';
5
+ import { BlockStatePatch } from './block_state_patch';
6
+
7
+ /** Defines all methods to interact with the platform environment from within a block UI. */
8
+ export interface Platforma<
9
+ Args = unknown,
10
+ Outputs extends Record<string, ValueOrErrors<unknown>> = Record<string, ValueOrErrors<unknown>>,
11
+ UiState = unknown,
12
+ Href extends `/${string}` = `/${string}`
13
+ > extends BlockApi<Args, Outputs, UiState, Href>,
14
+ DriverKit {
15
+ /** Information about SDK version current platforma environment was compiled with. */
16
+ readonly sdkInfo: SdkInfo;
17
+ }
18
+
19
+ export type InferArgsType<Pl extends Platforma> = Pl extends Platforma<infer Args> ? Args : never;
20
+
21
+ export type InferOutputsType<Pl extends Platforma> =
22
+ Pl extends Platforma<unknown, infer Outputs> ? Outputs : never;
23
+
24
+ export type InferUiState<Pl extends Platforma> =
25
+ Pl extends Platforma<unknown, Record<string, ValueOrErrors<unknown>>, infer UiState>
26
+ ? UiState
27
+ : never;
28
+
29
+ export type InferHrefType<Pl extends Platforma> =
30
+ Pl extends Platforma<unknown, BlockOutputsBase, unknown, infer Href> ? Href : never;
31
+
32
+ export type PlatformaFactory = (config: BlockConfig) => Platforma;
33
+
34
+ export type InferBlockState<Pl extends Platforma> = BlockState<
35
+ InferArgsType<Pl>,
36
+ InferOutputsType<Pl>,
37
+ InferUiState<Pl>,
38
+ InferHrefType<Pl>
39
+ >;
40
+
41
+ export type InferBlockStatePatch<Pl extends Platforma> = BlockStatePatch<
42
+ InferArgsType<Pl>,
43
+ InferOutputsType<Pl>,
44
+ InferUiState<Pl>,
45
+ InferHrefType<Pl>
46
+ >;
@@ -0,0 +1,16 @@
1
+ import { getJsonField, makeObject, TypedConfig } from './config';
2
+
3
+ export function fromPlRef<Source extends TypedConfig>(source: Source) {
4
+ return makeObject({
5
+ __isRef: true,
6
+ blockId: getJsonField(source, 'blockId'),
7
+ name: getJsonField(source, 'name')
8
+ });
9
+ }
10
+
11
+ export function fromPlOption<Source extends TypedConfig>(source: Source) {
12
+ return makeObject({
13
+ ref: fromPlRef(getJsonField(source, 'ref')),
14
+ label: getJsonField(source, 'label')
15
+ });
16
+ }
@@ -0,0 +1,223 @@
1
+ import {
2
+ AnyLogHandle,
3
+ ImportProgress,
4
+ LocalBlobHandleAndSize,
5
+ PColumn,
6
+ PObject,
7
+ RemoteBlobHandleAndSize,
8
+ isPColumn,
9
+ mapPObjectData
10
+ } from '@milaboratories/pl-model-common';
11
+ import { getCfgRenderCtx } from '../internal';
12
+ import { FutureRef } from './future';
13
+ import { AccessorHandle } from './internal';
14
+ import { CommonFieldTraverseOps, FieldTraversalStep, ResourceType } from './traversal_ops';
15
+
16
+ function ifDef<T, R>(value: T | undefined, cb: (value: T) => R): R | undefined {
17
+ return value === undefined ? undefined : cb(value);
18
+ }
19
+
20
+ function wrapBuffer(buf: ArrayBuffer | undefined): Uint8Array | undefined {
21
+ return buf === undefined ? undefined : new Uint8Array(buf);
22
+ }
23
+
24
+ function wrapAccessor(handle: AccessorHandle | undefined): TreeNodeAccessor | undefined {
25
+ return handle === undefined ? undefined : new TreeNodeAccessor(handle);
26
+ }
27
+
28
+ /** Represent resource tree node accessor */
29
+ export class TreeNodeAccessor {
30
+ constructor(public readonly handle: AccessorHandle) {}
31
+
32
+ public resolve(
33
+ ...steps: [
34
+ Omit<FieldTraversalStep, 'errorIfFieldNotSet'> & {
35
+ errorIfFieldNotAssigned: true;
36
+ }
37
+ ]
38
+ ): TreeNodeAccessor;
39
+ public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined;
40
+ public resolve(...steps: (FieldTraversalStep | string)[]): TreeNodeAccessor | undefined {
41
+ return this.resolveWithCommon({}, ...steps);
42
+ }
43
+
44
+ public resolveWithCommon(
45
+ commonOptions: CommonFieldTraverseOps,
46
+ ...steps: (FieldTraversalStep | string)[]
47
+ ): TreeNodeAccessor | undefined {
48
+ return wrapAccessor(getCfgRenderCtx().resolveWithCommon(this.handle, commonOptions, ...steps));
49
+ }
50
+
51
+ public get resourceType(): ResourceType {
52
+ return getCfgRenderCtx().getResourceType(this.handle);
53
+ }
54
+
55
+ public getInputsLocked(): boolean {
56
+ return getCfgRenderCtx().getInputsLocked(this.handle);
57
+ }
58
+
59
+ public getOutputsLocked(): boolean {
60
+ return getCfgRenderCtx().getOutputsLocked(this.handle);
61
+ }
62
+
63
+ public getIsReadyOrError(): boolean {
64
+ return getCfgRenderCtx().getIsReadyOrError(this.handle);
65
+ }
66
+
67
+ public getIsFinal(): boolean {
68
+ return getCfgRenderCtx().getIsFinal(this.handle);
69
+ }
70
+
71
+ public getError(): TreeNodeAccessor | undefined {
72
+ return wrapAccessor(getCfgRenderCtx().getError(this.handle));
73
+ }
74
+
75
+ public listInputFields(): string[] {
76
+ return getCfgRenderCtx().listInputFields(this.handle);
77
+ }
78
+
79
+ public listOutputFields(): string[] {
80
+ return getCfgRenderCtx().listOutputFields(this.handle);
81
+ }
82
+
83
+ public listDynamicFields(): string[] {
84
+ return getCfgRenderCtx().listDynamicFields(this.handle);
85
+ }
86
+
87
+ public getKeyValueBase64(key: string): string | undefined {
88
+ return getCfgRenderCtx().getKeyValueBase64(this.handle, key);
89
+ }
90
+
91
+ public getKeyValueAsString(key: string): string | undefined {
92
+ return getCfgRenderCtx().getKeyValueAsString(this.handle, key);
93
+ }
94
+
95
+ public getKeyValueAsJson<T>(key: string): T {
96
+ const content = this.getKeyValueAsString(key);
97
+ if (content == undefined) throw new Error('Resource has no content.');
98
+ return JSON.parse(content);
99
+ }
100
+
101
+ public getDataBase64(): string | undefined {
102
+ return getCfgRenderCtx().getDataBase64(this.handle);
103
+ }
104
+
105
+ public getDataAsString(): string | undefined {
106
+ return getCfgRenderCtx().getDataAsString(this.handle);
107
+ }
108
+
109
+ public getDataAsJson<T>(): T {
110
+ const content = this.getDataAsString();
111
+ if (content == undefined) throw new Error('Resource has no content.');
112
+ return JSON.parse(content);
113
+ }
114
+
115
+ /**
116
+ *
117
+ */
118
+ public getPColumns(
119
+ errorOnUnknownField: boolean = false,
120
+ prefix: string = ''
121
+ ): PColumn<TreeNodeAccessor>[] | undefined {
122
+ const result = this.parsePObjectCollection(errorOnUnknownField, prefix);
123
+ if (result === undefined) return undefined;
124
+
125
+ const pf = Object.entries(result).map(([, obj]) => {
126
+ if (!isPColumn(obj)) throw new Error(`not a PColumn (kind = ${obj.spec.kind})`);
127
+ return obj;
128
+ });
129
+
130
+ return pf;
131
+ }
132
+
133
+ /**
134
+ *
135
+ */
136
+ public parsePObjectCollection(
137
+ errorOnUnknownField: boolean = false,
138
+ prefix: string = ''
139
+ ): Record<string, PObject<TreeNodeAccessor>> | undefined {
140
+ const pObjects = getCfgRenderCtx().parsePObjectCollection(
141
+ this.handle,
142
+ errorOnUnknownField,
143
+ prefix
144
+ );
145
+ if (pObjects === undefined) return undefined;
146
+ const result: Record<string, PObject<TreeNodeAccessor>> = {};
147
+ for (const [key, value] of Object.entries(pObjects))
148
+ result[key] = mapPObjectData(value, (c) => new TreeNodeAccessor(c));
149
+ return result;
150
+ }
151
+
152
+ public getFileContentAsBase64(): FutureRef<string | undefined> {
153
+ return new FutureRef(getCfgRenderCtx().getBlobContentAsBase64(this.handle));
154
+ }
155
+
156
+ public getFileContentAsString(): FutureRef<string | undefined> {
157
+ return new FutureRef(getCfgRenderCtx().getBlobContentAsString(this.handle));
158
+ }
159
+
160
+ public getFileContentAsJson<T>(): FutureRef<T | undefined> {
161
+ return new FutureRef<string | undefined>(
162
+ getCfgRenderCtx().getBlobContentAsString(this.handle)
163
+ ).mapDefined((v) => JSON.parse(v) as T);
164
+ }
165
+
166
+ /**
167
+ * @deprecated use getFileContentAsBase64
168
+ */
169
+ public getBlobContentAsBase64(): FutureRef<string | undefined> {
170
+ return this.getFileContentAsBase64();
171
+ }
172
+
173
+ /**
174
+ * @deprecated use getFileContentAsString
175
+ */
176
+ public getBlobContentAsString(): FutureRef<string | undefined> {
177
+ return this.getFileContentAsString();
178
+ }
179
+
180
+ /**
181
+ * @returns downloaded file handle
182
+ */
183
+ public getFileHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {
184
+ return new FutureRef(getCfgRenderCtx().getDownloadedBlobContentHandle(this.handle));
185
+ }
186
+
187
+ /**
188
+ * @deprecated use getFileHandle
189
+ */
190
+ public getDownloadedBlobHandle(): FutureRef<LocalBlobHandleAndSize | undefined> {
191
+ return this.getFileHandle();
192
+ }
193
+
194
+ /**
195
+ * @returns downloaded file handle
196
+ */
197
+ public getRemoteFileHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {
198
+ return new FutureRef(getCfgRenderCtx().getOnDemandBlobContentHandle(this.handle));
199
+ }
200
+
201
+ /**
202
+ * @deprecated use getRemoteFileHandle
203
+ */
204
+ public getOnDemandBlobHandle(): FutureRef<RemoteBlobHandleAndSize | undefined> {
205
+ return this.getRemoteFileHandle();
206
+ }
207
+
208
+ public getImportProgress(): FutureRef<ImportProgress> {
209
+ return new FutureRef(getCfgRenderCtx().getImportProgress(this.handle));
210
+ }
211
+
212
+ public getLastLogs(nLines: number): FutureRef<string | undefined> {
213
+ return new FutureRef(getCfgRenderCtx().getLastLogs(this.handle, nLines));
214
+ }
215
+
216
+ public getProgressLog(patternToSearch: string): FutureRef<string | undefined> {
217
+ return new FutureRef(getCfgRenderCtx().getProgressLog(this.handle, patternToSearch));
218
+ }
219
+
220
+ public getLogHandle(): FutureRef<AnyLogHandle | undefined> {
221
+ return new FutureRef(getCfgRenderCtx().getLogHandle(this.handle));
222
+ }
223
+ }