Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support filters from v2 #1896

Merged
merged 3 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { initLogger } from './logger';
initLogger();
import { Session, Factory } from '../src/api/session';
import { IGrabbedElement } from '../src/interfaces/index';
import { IGrabbedElement } from 'platform/types/content';
import { createSampleFile, finish, runner } from './common';
import { readConfigurationFile } from './config';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { initLogger } from './logger';
initLogger();
import { Session, SessionStream, Factory } from '../src/api/session';
import { IGrabbedElement } from '../src/interfaces/index';
import { IGrabbedElement } from 'platform/types/content';
import { finish, createSampleFile, runner } from './common';
import { readConfigurationFile } from './config';
import { error } from 'platform/log/utils';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { initLogger } from './logger';
initLogger();
import { Session, Factory } from '../src/api/session';
import { IGrabbedElement } from '../src/interfaces/index';
import { IGrabbedElement } from 'platform/types/content';
import { createSampleFile, finish, runner } from './common';
import { readConfigurationFile } from './config';
import { fromIndexes } from 'platform/types/range';
Expand Down
30 changes: 22 additions & 8 deletions application/apps/rustcore/ts-bindings/spec/session.map.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { initLogger } from './logger';
initLogger();
import { Session, Factory } from '../src/api/session';
import { ISearchMap } from '../src/interfaces/index';
import { ISearchMap } from 'platform/types/filter';
import { finish, createSampleFile, runner } from './common';
import { readConfigurationFile } from './config';

Expand Down Expand Up @@ -51,7 +51,9 @@ describe('Map', function () {
new Factory.File()
.asText()
.type(Factory.FileType.Text)
.file(tmpobj.name).get().sterilized(),
.file(tmpobj.name)
.get()
.sterilized(),
)
.on('confirmed', () => {
search
Expand Down Expand Up @@ -137,7 +139,9 @@ describe('Map', function () {
new Factory.File()
.asText()
.type(Factory.FileType.Text)
.file(tmpobj.name).get().sterilized(),
.file(tmpobj.name)
.get()
.sterilized(),
)
.on('confirmed', () => {
search
Expand Down Expand Up @@ -227,7 +231,9 @@ describe('Map', function () {
new Factory.File()
.asText()
.type(Factory.FileType.Text)
.file(tmpobj.name).get().sterilized(),
.file(tmpobj.name)
.get()
.sterilized(),
)
.on('confirmed', () => {
search
Expand Down Expand Up @@ -367,7 +373,9 @@ describe('Map', function () {
new Factory.File()
.asText()
.type(Factory.FileType.Text)
.file(tmpobj.name).get().sterilized(),
.file(tmpobj.name)
.get()
.sterilized(),
)
.on('confirmed', () => {
search
Expand Down Expand Up @@ -457,7 +465,9 @@ describe('Map', function () {
new Factory.File()
.asText()
.type(Factory.FileType.Text)
.file(tmpobj.name).get().sterilized(),
.file(tmpobj.name)
.get()
.sterilized(),
)
.on('confirmed', () => {
search
Expand Down Expand Up @@ -547,7 +557,9 @@ describe('Map', function () {
new Factory.File()
.asText()
.type(Factory.FileType.Text)
.file(tmpobj.name).get().sterilized(),
.file(tmpobj.name)
.get()
.sterilized(),
)
.on('confirmed', () => {
search
Expand Down Expand Up @@ -637,7 +649,9 @@ describe('Map', function () {
new Factory.File()
.asText()
.type(Factory.FileType.Text)
.file(tmpobj.name).get().sterilized(),
.file(tmpobj.name)
.get()
.sterilized(),
)
.on('confirmed', () => {
search
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { initLogger } from './logger';
initLogger();
import { Session, Factory } from '../src/api/session';
import { IGrabbedElement } from '../src/interfaces/index';
import { IGrabbedElement } from 'platform/types/content';
import { IAttachmentsUpdatedUpdated } from '../src/api/session.provider';
import { IAttachment } from 'platform/types/content';
import { createSampleFile, finish, performanceReport, setMeasurement, runner } from './common';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { initLogger } from './logger';
initLogger();
import { Session, Factory } from '../src/api/session';
import { IGrabbedElement } from '../src/interfaces/index';
import { IGrabbedElement } from 'platform/types/content';
import { createSampleFile, finish, runner } from './common';
import { readConfigurationFile } from './config';

Expand Down Expand Up @@ -44,7 +44,8 @@ describe('Grab ranges', function () {
.asText()
.type(Factory.FileType.Text)
.file(tmpobj.name)
.get().sterilized(),
.get()
.sterilized(),
)
.catch(finish.bind(null, session, done));
let grabbing: boolean = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { initLogger } from './logger';
initLogger();
import { Session, Factory } from '../src/api/session';
import { IGrabbedElement } from '../src/interfaces/index';
import { IGrabbedElement } from 'platform/types/content';
import { finish, createSampleFile, runner } from './common';
import { readConfigurationFile } from './config';

Expand Down
26 changes: 17 additions & 9 deletions application/apps/rustcore/ts-bindings/spec/session.stream.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { initLogger } from './logger';
initLogger();
import { Session, Factory } from '../src/api/session';
import { IGrabbedElement } from '../src/interfaces/index';
import { IGrabbedElement } from 'platform/types/content';
import { createSampleFile, finish, runner } from './common';
import { readConfigurationFile } from './config';
import { utils } from 'platform/log';
Expand Down Expand Up @@ -60,7 +60,8 @@ if (process.platform === 'win32') {
cwd: process.cwd(),
envs: process.env as { [key: string]: string },
})
.get().sterilized(),
.get()
.sterilized(),
)
.catch(finish.bind(null, session, done));
events.StreamUpdated.subscribe((rows: number) => {
Expand Down Expand Up @@ -127,7 +128,8 @@ if (process.platform === 'win32') {
cwd: process.cwd(),
envs: process.env as { [key: string]: string },
})
.get().sterilized(),
.get()
.sterilized(),
)
.on('confirmed', () => {
lifeCycleEvents.push('confirmed');
Expand Down Expand Up @@ -171,7 +173,8 @@ if (process.platform === 'win32') {
cwd: process.cwd(),
envs: process.env as { [key: string]: string },
})
.get().sterilized(),
.get()
.sterilized(),
)
.on('confirmed', () => {
lifeCycleEvents.push('confirmed');
Expand Down Expand Up @@ -220,7 +223,8 @@ if (process.platform === 'win32') {
cwd: process.cwd(),
envs: process.env as { [key: string]: string },
})
.get().sterilized(),
.get()
.sterilized(),
)
.catch(finish.bind(null, session, done));
const append = () => {
Expand Down Expand Up @@ -333,7 +337,8 @@ if (process.platform === 'win32') {
cwd: process.cwd(),
envs: process.env as { [key: string]: string },
})
.get().sterilized(),
.get()
.sterilized(),
)
.catch(finish.bind(null, session, done));
const filter = 'match A';
Expand Down Expand Up @@ -451,7 +456,8 @@ if (process.platform === 'win32') {
cwd: process.cwd(),
envs: process.env as { [key: string]: string },
})
.get().sterilized(),
.get()
.sterilized(),
)
.catch(finish.bind(null, session, done));
events.StreamUpdated.subscribe((rows: number) => {
Expand Down Expand Up @@ -510,7 +516,8 @@ if (process.platform === 'win32') {
cwd: process.cwd(),
envs: process.env as { [key: string]: string },
})
.get().sterilized(),
.get()
.sterilized(),
)
.on('processing', (e) => {
procceed();
Expand All @@ -526,7 +533,8 @@ if (process.platform === 'win32') {
cwd: process.cwd(),
envs: process.env as { [key: string]: string },
})
.get().sterilized(),
.get()
.sterilized(),
)
.on('processing', () => {
procceed();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
TExtractedValues,
IExtractedMatch,
IExtractedValue,
} from '../../interfaces/index';
} from 'platform/types/filter';

export const executor: TExecutor<TExtractedValues, IFilter[]> = (
session: RustSession,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TExecutor, Logger, CancelablePromise, AsyncResultsExecutor } from './executor';
import { RustSession } from '../../native/native.session';
import { EventProvider } from '../session.provider';
import { IValuesMap } from '../../interfaces/index';
import { IValuesMap } from 'platform/types/filter';
import { error } from 'platform/log/utils';

export interface IOptions {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TExecutor, Logger, CancelablePromise, AsyncResultsExecutor } from './executor';
import { RustSession } from '../../native/native.session';
import { EventProvider } from '../../api/session.provider';
import { ISearchMap } from '../../interfaces/index';
import { ISearchMap } from 'platform/types/filter';

export interface IOptions {
datasetLength: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TExecutor, Logger, CancelablePromise, AsyncResultsExecutor } from './executor';
import { RustSession } from '../../native/native.session';
import { EventProvider } from '../../api/session.provider';
import { INearest } from '../../interfaces/index';
import { INearest } from 'platform/types/filter';

export interface IExecuteNearestOptions {
positionInStream: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TExecutor, Logger, CancelablePromise, AsyncResultsExecutor } from './executor';
import { RustSession } from '../../native/native.session';
import { EventProvider } from '../../api/session.provider';
import { IFilter } from '../../interfaces/index';
import { IFilter } from 'platform/types/filter';

export const executor: TExecutor<number, IFilter[]> = (
session: RustSession,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RustSession } from '../../native/native.session';
import { ICancelablePromise } from 'platform/env/promise';
import { EventProvider } from '../../api/session.provider';
import { IFilter, TExtractedValues } from '../../interfaces/index';
import { IFilter, TExtractedValues } from 'platform/types/filter';
import { Executors } from './session.stream.executors';
import { TaskManager } from './single.task';
import { scope } from 'platform/env/scope';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { scope } from 'platform/env/scope';
import { RustSession } from '../../native/native.session';
import { ICancelablePromise } from 'platform/env/promise';
import { EventProvider } from '../../api/session.provider';
import { IFilter } from '../../interfaces/index';
import { IFilter } from 'platform/types/filter';
import { Executors } from './session.stream.executors';
import { TaskManager } from './single.task';

Expand Down
2 changes: 1 addition & 1 deletion application/apps/rustcore/ts-bindings/src/api/jobs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CancelablePromise } from 'platform/env/promise';
import { Base } from '../native/native.jobs';
import { error } from 'platform/log/utils';
import { IFilter } from '../interfaces/index';
import { IFilter } from 'platform/types/filter';
import { ShellProfile } from 'platform/types/shells';
import { SomeipStatistic } from 'platform/types/observe/parser/someip';
import { StatisticInfo } from 'platform/types/observe/parser/dlt';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Subject } from 'platform/env/subscription';
import { ISearchUpdated } from 'platform/types/filter';
import { Computation } from '../provider/provider';
import { EErrorKind, EErrorSeverity } from '../provider/provider.errors';
import { IMapEntity, IMatchEntity, IValuesMinMaxMap } from '../interfaces/index';
import { IMapEntity, IMatchEntity, IValuesMinMaxMap } from 'platform/types/filter';
import { IAttachment } from 'platform/types/content';

export interface IProgressState {
Expand Down
10 changes: 2 additions & 8 deletions application/apps/rustcore/ts-bindings/src/api/session.search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@ import { scope } from 'platform/env/scope';
import { RustSession } from '../native/native.session';
import { ICancelablePromise } from 'platform/env/promise';
import { EventProvider } from '../api/session.provider';
import {
IFilter,
IGrabbedElement,
ISearchMap,
TExtractedValues,
INearest,
IValuesMap,
} from '../interfaces/index';
import { IGrabbedElement } from 'platform/types/content';
import { IFilter, ISearchMap, TExtractedValues, INearest, IValuesMap } from 'platform/types/filter';
import { Executors } from './executors/session.stream.executors';
import { SearchTaskManager } from './executors/single.task.search';
import { ValuesTaskManager } from './executors/single.task.values';
Expand Down
43 changes: 1 addition & 42 deletions application/apps/rustcore/ts-bindings/src/api/session.stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ import { SdeRequest, SdeResponse } from 'platform/types/sde';
import { EventProvider } from '../api/session.provider';
import { Executors } from './executors/session.stream.executors';
import { EFileOptionsRequirements } from './executors/session.stream.observe.executor';
import {
IGrabbedElement,
IExtractDTFormatOptions,
IExtractDTFormatResult,
} from '../interfaces/index';
import { IGrabbedElement } from 'platform/types/content';
import { IRange } from 'platform/types/range';
import { ISourceLink } from 'platform/types/observe/types';
import { Attachment, IndexingMode } from 'platform/types/content';
import { IObserve } from 'platform/types/observe';

export { IExtractDTFormatOptions, IExtractDTFormatResult };

export class SessionStream {
private readonly _provider: EventProvider;
private readonly _session: RustSession;
Expand Down Expand Up @@ -116,41 +110,6 @@ export class SessionStream {
return Executors.exportRaw(this._session, this._provider, this._logger, { dest, ranges });
}

public extractTimeformat(options: IExtractDTFormatOptions): IExtractDTFormatResult | Error {
let results: IExtractDTFormatResult | Error = this._session.extract(options);
if (typeof results !== 'object' || results === null) {
results = new Error(
`Expecting {IExtractDTFormatOptions} as result of "extractTimeformat", but has been gotten: ${typeof results}`,
);
} else if (
typeof results === 'object' &&
(typeof (results as IExtractDTFormatResult).format !== 'string' ||
typeof (results as IExtractDTFormatResult).reg !== 'string' ||
typeof (results as IExtractDTFormatResult).timestamp !== 'number')
) {
results = new Error(
`Expecting {IExtractDTFormatOptions} as result of "extractTimeformat", but has been gotten: ${JSON.stringify(
results,
)}`,
);
}
if (results instanceof Error) {
this._logger.warn(
`Fail to apply "extractTimeformat", options: ${JSON.stringify(
options,
)} due error: ${results.message}`,
);
}
return results;
}

public connect(): {
//dlt: (options: IDLTOptions) => Connector<IDLTOptions>,
//adb: (options: IADBOptions) => Connector<IADBOptions>,
} {
return {};
}

public len(): Promise<number> {
return this._session.getStreamLen();
}
Expand Down
Loading
Loading