Skip to content

Commit

Permalink
Update TS types
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAstafyev committed Dec 19, 2024
1 parent 285b82c commit ce49c19
Show file tree
Hide file tree
Showing 3 changed files with 173 additions and 189 deletions.
158 changes: 66 additions & 92 deletions application/apps/indexer/stypes/bindings/command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,150 +5,124 @@
* At the core level, this type is used for all commands invoked within an `UnboundSession`.
* It is only used to indicate the successful completion or interruption of a command.
*/
export type CommandOutcomeBool = { "Finished": boolean } | "Cancelled";
export type CommandOutcomeBool = { Finished: boolean } | 'Cancelled';

/**
* Represents the result of a command execution.
* At the core level, this type is used for all commands invoked within an `UnboundSession`.
* It is only used to indicate the successful completion or interruption of a command.
*/
export type CommandOutcomeFoldersScanningResult = { "Finished": FoldersScanningResult } | "Cancelled";
export type CommandOutcomeFoldersScanningResult = { Finished: FoldersScanningResult } | 'Cancelled';

/**
* Represents the result of a command execution.
* At the core level, this type is used for all commands invoked within an `UnboundSession`.
* It is only used to indicate the successful completion or interruption of a command.
*/
export type CommandOutcomeOptionalString = { "Finished": string | null } | "Cancelled";
export type CommandOutcomeOptionalString = { Finished: string | null } | 'Cancelled';

/**
* Represents the result of a command execution.
* At the core level, this type is used for all commands invoked within an `UnboundSession`.
* It is only used to indicate the successful completion or interruption of a command.
*/
export type CommandOutcomeProfilesResult = { "Finished": ProfileList } | "Cancelled";
export type CommandOutcomeSerialPortsList = { Finished: SerialPortsList } | 'Cancelled';

/**
* Represents the result of a command execution.
* At the core level, this type is used for all commands invoked within an `UnboundSession`.
* It is only used to indicate the successful completion or interruption of a command.
*/
export type CommandOutcomeSerialPortsList = { "Finished": SerialPortsList } | "Cancelled";
export type CommandOutcomeString = { Finished: string } | 'Cancelled';

/**
* Represents the result of a command execution.
* At the core level, this type is used for all commands invoked within an `UnboundSession`.
* It is only used to indicate the successful completion or interruption of a command.
*/
export type CommandOutcomeString = { "Finished": string } | "Cancelled";
export type CommandOutcomeVoid = 'Finished' | 'Cancelled';

/**
* Represents the result of a command execution.
* At the core level, this type is used for all commands invoked within an `UnboundSession`.
* It is only used to indicate the successful completion or interruption of a command.
*/
export type CommandOutcomeVoid = "Finished" | "Cancelled";

/**
* Represents the result of a command execution.
* At the core level, this type is used for all commands invoked within an `UnboundSession`.
* It is only used to indicate the successful completion or interruption of a command.
*/
export type CommandOutcomei64 = { "Finished": number } | "Cancelled";
export type CommandOutcomei64 = { Finished: number } | 'Cancelled';

/**
* Represents a folder entity in the file system.
*/
export type FolderEntity = {
/**
* The name of the entity (file or folder).
*/
name: string,
/**
* The full path of the entity.
*/
fullname: string,
/**
* The type of the entity (e.g., file, directory, symbolic link).
*/
kind: FolderEntityType,
/**
* Optional detailed information about the entity.
*/
details: FolderEntityDetails | null, };
export type FolderEntity = {
/**
* The name of the entity (file or folder).
*/
name: string;
/**
* The full path of the entity.
*/
fullname: string;
/**
* The type of the entity (e.g., file, directory, symbolic link).
*/
kind: FolderEntityType;
/**
* Optional detailed information about the entity.
*/
details: FolderEntityDetails | null;
};

/**
* Contains detailed information about a folder entity.
*/
export type FolderEntityDetails = {
/**
* The name of the file or folder.
*/
filename: string,
/**
* The full path to the file or folder.
*/
full: string,
/**
* The directory path containing the file or folder.
*/
path: string,
/**
* The base name of the file or folder.
*/
basename: string,
/**
* The file extension, if applicable.
*/
ext: string, };
export type FolderEntityDetails = {
/**
* The name of the file or folder.
*/
filename: string;
/**
* The full path to the file or folder.
*/
full: string;
/**
* The directory path containing the file or folder.
*/
path: string;
/**
* The base name of the file or folder.
*/
basename: string;
/**
* The file extension, if applicable.
*/
ext: string;
};

/**
* Represents the type of a folder entity in the file system.
*/
export type FolderEntityType = "BlockDevice" | "CharacterDevice" | "Directory" | "FIFO" | "File" | "Socket" | "SymbolicLink";
export enum FolderEntityType {
BlockDevice = 'BlockDevice',
CharacterDevice = 'CharacterDevice',
Directory = 'Directory',
FIFO = 'FIFO',
File = 'File',
Socket = 'Socket',
SymbolicLink = 'SymbolicLink',
}

/**
* Represents the result of scanning a folder.
*/
export type FoldersScanningResult = {
/**
* A list of folder entities found during the scan.
*/
list: Array<FolderEntity>,
/**
* Indicates whether the maximum length of results was reached.
*/
max_len_reached: boolean, };

export type Profile = {
/**
* Suggested name of shell. For unix based systems it will be name of executable file,
* like "bash", "fish" etc. For windows it will be names like "GitBash", "PowerShell"
* etc.
*/
name: string,
/**
* Path to executable file of shell
*/
path: string,
/**
* List of environment variables. Because extracting operation could take some time
* by default `envvars = None`. To load data should be used method `load`, which will
* make attempt to detect environment variables.
*/
envvars: Map<string, string>,
/**
* true - if path to executable file of shell is symlink to another location.
*/
symlink: boolean, };

/**
* Represents a list of serial ports.
*
* This structure contains a vector of strings, where each string represents the name
* or identifier of a serial port available on the system.
*/
export type ProfileList = Array<Profile>;
export type FoldersScanningResult = {
/**
* A list of folder entities found during the scan.
*/
list: Array<FolderEntity>;
/**
* Indicates whether the maximum length of results was reached.
*/
max_len_reached: boolean;
};

/**
* Represents a list of serial ports.
Expand Down
102 changes: 53 additions & 49 deletions application/apps/indexer/stypes/bindings/miscellaneous.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@ export type AroundIndexes = [number | undefined | null, number | undefined | nul
/**
* Describes a match for a search condition.
*/
export type FilterMatch = {
/**
* The index (number) of the matching log entry.
*/
index: number,
/**
* The identifiers of the filters (search conditions) that matched
* the specified log entry.
*/
filters: Array<number>, };
export type FilterMatch = {
/**
* The index (number) of the matching log entry.
*/
index: number;
/**
* The identifiers of the filters (search conditions) that matched
* the specified log entry.
*/
filters: Array<number>;
};

/**
* A list of matches for a search condition.
Expand All @@ -28,41 +29,42 @@ export type FilterMatchList = Array<FilterMatch>;
/**
* Information about a log entry.
*/
export type GrabbedElement = {
/**
* The unique identifier of the source.
*/
source_id: number,
/**
* The textual content of the log entry.
*/
content: string,
/**
* The position of the log entry in the overall stream.
*/
pos: number,
/**
* The nature of the log entry, represented as a bitmask. Possible values include:
* - `SEARCH`: Nature = Nature(1)
* - `BOOKMARK`: Nature = Nature(1 << 1)
* - `EXPANDED`: Nature = Nature(1 << 5)
* - `BREADCRUMB`: Nature = Nature(1 << 6)
* - `BREADCRUMB_SEPARATOR`: Nature = Nature(1 << 7)
*/
nature: number, };
export type GrabbedElement = {
/**
* The unique identifier of the source.
*/
source_id: number;
/**
* The textual content of the log entry.
*/
content: string;
/**
* The position of the log entry in the overall stream.
*/
pos: number;
/**
* The nature of the log entry, represented as a bitmask. Possible values include:
* - `SEARCH`: Nature = Nature(1)
* - `BOOKMARK`: Nature = Nature(1 << 1)
* - `EXPANDED`: Nature = Nature(1 << 5)
* - `BREADCRUMB`: Nature = Nature(1 << 6)
* - `BREADCRUMB_SEPARATOR`: Nature = Nature(1 << 7)
*/
nature: number;
};

/**
* A list of log entries.
*/
export type GrabbedElementList = Array<GrabbedElement>;

export type MapKeyValue = { [key in string]?: string };
export type MapKeyValue = Map<string, string>;

/**
* Representation of ranges. We cannot use std ranges as soon as no way
* to derive Serialize, Deserialize
*/
export type Range = { start: number, end: number, };
export type Range = { start: number; end: number };

/**
* A list of ranges to read.
Expand All @@ -73,31 +75,33 @@ export type Ranges = Array<Range>;
* A request to a stream that supports feedback, such as a terminal command
* that accepts input through `stdin`.
*/
export type SdeRequest = { "WriteText": string } | { "WriteBytes": Array<number> };
export type SdeRequest = { WriteText: string } | { WriteBytes: Array<number> };

/**
* The response from a source to a sent `SdeRequest`. Note that sending data
* with `SdeRequest` does not guarantee a response, as the behavior depends
* on the source.
*/
export type SdeResponse = {
/**
* The number of bytes received.
*/
bytes: number, };
export type SdeResponse = {
/**
* The number of bytes received.
*/
bytes: number;
};

/**
* Describes a data source.
*/
export type SourceDefinition = {
/**
* The unique identifier of the source.
*/
id: number,
/**
* The user-friendly name of the source for display purposes.
*/
alias: string, };
export type SourceDefinition = {
/**
* The unique identifier of the source.
*/
id: number;
/**
* The user-friendly name of the source for display purposes.
*/
alias: string;
};

/**
* A list of data sources.
Expand Down
Loading

0 comments on commit ce49c19

Please sign in to comment.