Skip to content

Commit 194c439

Browse files
committed
Plugins Integrations in ts bindings
* Method for plugins integrations in typescript bindings delivering the values as string without parsing for now. * Create place holders for plugins types in platform
1 parent 789bb14 commit 194c439

5 files changed

Lines changed: 58 additions & 9 deletions

File tree

application/apps/rustcore/ts-bindings/src/api/jobs.ts

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,23 +65,20 @@ export class Jobs extends Base {
6565
return job;
6666
}
6767

68-
public isFileBinary(options: {
69-
filePath: string,
70-
}): CancelablePromise<boolean> {
68+
public isFileBinary(options: { filePath: string }): CancelablePromise<boolean> {
7169
const sequence = this.sequence();
7270
const job: CancelablePromise<boolean> = this.execute(
7371
(res: boolean): any | Error => {
7472
if (typeof res !== 'boolean') {
75-
return new Error(`[jobs.isFileBinary] Expecting boolean, but got: ${typeof res}`);
73+
return new Error(
74+
`[jobs.isFileBinary] Expecting boolean, but got: ${typeof res}`,
75+
);
7676
}
7777
return res;
7878
},
79-
this.native.isFileBinary(
80-
sequence,
81-
options.filePath
82-
),
79+
this.native.isFileBinary(sequence, options.filePath),
8380
sequence,
84-
'isFileBinary'
81+
'isFileBinary',
8582
);
8683
return job;
8784
}
@@ -249,4 +246,48 @@ export class Jobs extends Base {
249246
);
250247
return job;
251248
}
249+
250+
//TODO AAZ: There is no type conversion currently.
251+
//This first prototype should deliver the json values as string to
252+
//show them in the UI
253+
public getAllPlugins(): CancelablePromise<string> {
254+
const sequence = this.sequence();
255+
const job: CancelablePromise<string> = this.execute(
256+
(res: string): string | Error => {
257+
return typeof res === 'string'
258+
? res
259+
: new Error(`getAllPlugins should return string while prototyping`);
260+
},
261+
this.native.getAllPlugins(sequence),
262+
sequence,
263+
'getAllPlugins',
264+
);
265+
return job;
266+
}
267+
268+
public getActivePlugins(): CancelablePromise<string> {
269+
const sequence = this.sequence();
270+
const job: CancelablePromise<string> = this.execute(
271+
(res: string): string | Error => {
272+
return typeof res === 'string'
273+
? res
274+
: new Error(`getActivePlugins should return string while prototyping`);
275+
},
276+
this.native.getActivePlugins(sequence),
277+
sequence,
278+
'getActivePlugins',
279+
);
280+
return job;
281+
}
282+
283+
public reloadPlugins(): CancelablePromise<void> {
284+
const sequence = this.sequence();
285+
const job: CancelablePromise<void> = this.execute(
286+
(res: void): void => {},
287+
this.native.reloadPlugins(sequence),
288+
sequence,
289+
'reloadPlugins',
290+
);
291+
return job;
292+
}
252293
}

application/apps/rustcore/ts-bindings/src/native/native.jobs.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ export abstract class JobsNative {
4141
is_word: boolean;
4242
},
4343
): Promise<string | undefined | null>;
44+
public abstract getAllPlugins(sequence: number): Promise<string>;
45+
public abstract getActivePlugins(sequence: number): Promise<string>;
46+
public abstract reloadPlugins(sequence: number): Promise<void>;
4447
}
4548

4649
interface Job {

application/platform/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ export * as storage from './storage';
88
export * as github from './github';
99
export * as comment from './comment';
1010
export * as bookmark from './bookmark';
11+
export * as plugins from './plugins';
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//TODO AAZ: Place holder for now
2+
export interface PluginEntity {}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
//TODO AAZ: Place holder for now
2+
import { PluginEntity } from './entity';

0 commit comments

Comments
 (0)