Skip to content
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 @@ -23,12 +23,22 @@
"description": "Output description",
"type": "TIME_GRAPH"
},
{
"id": "timegraph.output.id1",
"name": "Output name (Config)",
"description": "Output description (Config)",
"type": "TIME_GRAPH",
"capabilities": {
"canCreate": true,
"canDelete": false
}
},
{
"id": "timegraph.output.id2",
"name": "Output name (Config)",
"description": "Output description (Config)",
"type": "TIME_GRAPH",
"parentId": "timegraph.output.id",
"parentId": "timegraph.output.id1",
"configuration" : {
"id": "my-config-1-id",
"name": "My configuration 1",
Expand All @@ -37,6 +47,10 @@
"parameters": {
"path": "/home/user/tmp"
}
},
"capabilities": {
"canCreate": false,
"canDelete": true
}
}
]
19 changes: 19 additions & 0 deletions tsp-typescript-client/src/models/output-capabilities.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Capabilities class indicating capabilities of a data provider, such as
* "canCreate" and "canDelete" capability.
*
* "canCreate" indicates that a given data provider can create a derived data
* provider. "canDelete" indicates that a given data provider can be deleted.
*
*/
export class OutputCapabilities {
/**
* Whether the data provider can create derived data providers. 'false' if absent.
*/
canCreate?: boolean;

/**
* Whether the data provider can be deleted. 'false' if absent.
*/
canDelete?: boolean;
}
6 changes: 6 additions & 0 deletions tsp-typescript-client/src/models/output-descriptor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { createNormalizer } from '../protocol/serialization';
import { Configuration } from './configuration';
import { OutputCapabilities } from './output-capabilities';

export const OutputDescriptor = createNormalizer<OutputDescriptor>({
end: BigInt,
Expand Down Expand Up @@ -98,4 +99,9 @@ export interface OutputDescriptor {
* Configuration used to create this data provider.
*/
configuration?: Configuration;

/**
* The output (data provider) capabilities instance. If absent all capabilities are false.
*/
capabilities?: OutputCapabilities;
}
15 changes: 14 additions & 1 deletion tsp-typescript-client/src/protocol/tsp-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,21 @@ describe('HttpTspClient Deserialization', () => {
httpRequestMock.mockReturnValueOnce(fixtures.asResponse('experiment-outputs-0.json'));
const response = await client.experimentOutputs('not-relevant');
const outputs = response.getModel()!;
expect(outputs).toHaveLength(6);

expect(outputs).toHaveLength(5);
let output = outputs.find((item) => item.id === 'timegraph.output.id1');
expect(output).toBeDefined();
expect(output?.capabilities).toBeDefined();
expect(output?.capabilities?.canCreate).toBeTruthy();
expect(output?.capabilities?.canDelete).toBeFalsy();
expect(output?.configuration).toBeUndefined();

output = outputs.find((item) => item.id === 'timegraph.output.id2');
expect(output).toBeDefined();
expect(output?.capabilities).toBeDefined();
expect(output?.capabilities?.canCreate).toBeFalsy();
expect(output?.capabilities?.canDelete).toBeTruthy();
expect(output?.configuration).toBeDefined();
});

it('fetchAnnotationsCategories', async () => {
Expand Down
Loading