Next Iteration

This commit is contained in:
Henning Dieterichs
2019-07-31 11:41:10 +02:00
parent 6175e8f55e
commit 922eb0b845
71 changed files with 19606 additions and 14862 deletions

39
shared/src/contract.ts Normal file
View File

@@ -0,0 +1,39 @@
import { contract, notificationContract, types } from "@hediet/typed-json-rpc";
import { DataExtractionResult } from "@hediet/debug-visualizer-data-extraction";
function unchecked<T>(): types.Type<T, T, unknown> {
return new types.Type<T, T, unknown>(
"unchecked",
(u): u is T => true,
value => types.success(value as T),
value => value
);
}
export type DataExtractionState =
| { kind: "loading" }
| { kind: "error"; message: string }
| { kind: "noDebugSession" }
| {
kind: "data";
result: DataExtractionResult;
};
export const debugVisualizerUIContract = contract({
client: {
updateState: notificationContract({
params: types.type({
newState: unchecked<DataExtractionState>(),
}),
}),
},
server: {
setExpression: notificationContract({
params: types.type({
newExpression: types.string,
}),
}),
refresh: notificationContract({}),
openInBrowser: notificationContract({}),
},
});

1
shared/src/index.ts Normal file
View File

@@ -0,0 +1 @@
export * from "./contract";