Skip to content

Commit

Permalink
Plugins Integrations in ts bindings
Browse files Browse the repository at this point in the history
* Method for plugins integrations in typescript bindings delivering the
  values as string without parsing for now.
* Create place holders for plugins types in platform
  • Loading branch information
AmmarAbouZor committed Dec 6, 2024
1 parent db8b1cb commit 74f20c8
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 9 deletions.
59 changes: 50 additions & 9 deletions application/apps/rustcore/ts-bindings/src/api/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,20 @@ export class Jobs extends Base {
return job;
}

public isFileBinary(options: {
filePath: string,
}): CancelablePromise<boolean> {
public isFileBinary(options: { filePath: string }): CancelablePromise<boolean> {
const sequence = this.sequence();
const job: CancelablePromise<boolean> = this.execute(
(res: boolean): any | Error => {
if (typeof res !== 'boolean') {
return new Error(`[jobs.isFileBinary] Expecting boolean, but got: ${typeof res}`);
return new Error(
`[jobs.isFileBinary] Expecting boolean, but got: ${typeof res}`,
);
}
return res;
},
this.native.isFileBinary(
sequence,
options.filePath
),
this.native.isFileBinary(sequence, options.filePath),
sequence,
'isFileBinary'
'isFileBinary',
);
return job;
}
Expand Down Expand Up @@ -249,4 +246,48 @@ export class Jobs extends Base {
);
return job;
}

//TODO AAZ: There is no type conversion currently.
//This first prototype should deliver the json values as string to
//show them in the UI
public getAllPlugins(): CancelablePromise<string> {
const sequence = this.sequence();
const job: CancelablePromise<string> = this.execute(
(res: string): string | Error => {
return typeof res === 'string'
? res
: new Error(`getAllPlugins should return string while prototyping`);
},
this.native.getAllPlugins(sequence),
sequence,
'getAllPlugins',
);
return job;
}

public getActivePlugins(): CancelablePromise<string> {
const sequence = this.sequence();
const job: CancelablePromise<string> = this.execute(
(res: string): string | Error => {
return typeof res === 'string'
? res
: new Error(`getActivePlugins should return string while prototyping`);
},
this.native.getActivePlugins(sequence),
sequence,
'getActivePlugins',
);
return job;
}

public reloadPlugins(): CancelablePromise<void> {
const sequence = this.sequence();
const job: CancelablePromise<void> = this.execute(
(res: void): void => {},
this.native.reloadPlugins(sequence),
sequence,
'reloadPlugins',
);
return job;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ export abstract class JobsNative {
is_word: boolean;
},
): Promise<string | undefined | null>;
public abstract getAllPlugins(sequence: number): Promise<string>;
public abstract getActivePlugins(sequence: number): Promise<string>;
public abstract reloadPlugins(sequence: number): Promise<void>;
}

interface Job {
Expand Down
1 change: 1 addition & 0 deletions application/platform/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export * as storage from './storage';
export * as github from './github';
export * as comment from './comment';
export * as bookmark from './bookmark';
export * as plugins from './plugins';
2 changes: 2 additions & 0 deletions application/platform/types/plugins/entity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//TODO AAZ: Place holder for now
export interface PluginEntity {}
2 changes: 2 additions & 0 deletions application/platform/types/plugins/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
//TODO AAZ: Place holder for now
import { PluginEntity } from './entity';

0 comments on commit 74f20c8

Please sign in to comment.