From 6b81dcef7d40ef39e8ebc825e90a319f800d09bf Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Mon, 29 Jul 2019 11:29:49 -0400 Subject: [PATCH] SP-152 fix F# type definition --- src/lib/api/service_compiler/templates/fs/fable.fs | 2 +- src/web/api/src/ServiceContext.ts | 2 +- src/web/ui/src/Util/StreamUtils.fs | 14 ++++++++++++++ src/web/ui/src/ui.fsproj | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/web/ui/src/Util/StreamUtils.fs diff --git a/src/lib/api/service_compiler/templates/fs/fable.fs b/src/lib/api/service_compiler/templates/fs/fable.fs index e9a7a06c8..f91357c81 100644 --- a/src/lib/api/service_compiler/templates/fs/fable.fs +++ b/src/lib/api/service_compiler/templates/fs/fable.fs @@ -69,7 +69,7 @@ type I{{name}} = {{#each method}} {{#if server_streaming}} // {{comment}} - abstract member subscribe_{{name}} : qualifier:string -> callback:(DynamicService.Update<{{output_type_full}}>->unit) -> unit + abstract member subscribe_{{name}} : qualifier:string -> callback:(StreamUtils.IUpdate<{{output_type_full}}>->unit) -> unit {{else}} // {{comment}} abstract member {{name}}: {{input_type_full}} -> Fable.Import.JS.Promise<{{output_type_full}}> diff --git a/src/web/api/src/ServiceContext.ts b/src/web/api/src/ServiceContext.ts index 607f1c464..98cbb16ef 100644 --- a/src/web/api/src/ServiceContext.ts +++ b/src/web/api/src/ServiceContext.ts @@ -107,7 +107,7 @@ class PrivateContext { onmessage(e){ const raw_buffer = new Uint8Array(e.data) const response = GatewayResponse.decode(raw_buffer) - if (response && response.callResult && response.callresults.length > 0) { + if (response && response.callResult && response.callResult.length > 0) { const call_buffer = response.callResult const header_size = call_buffer[0] const sub = call_buffer.subarray(1, header_size) diff --git a/src/web/ui/src/Util/StreamUtils.fs b/src/web/ui/src/Util/StreamUtils.fs new file mode 100644 index 000000000..76d533e65 --- /dev/null +++ b/src/web/ui/src/Util/StreamUtils.fs @@ -0,0 +1,14 @@ +module StreamUtils +open JSMap + +type Change<'a> = { + newItem : 'a + oldItem : 'a +} + +type IUpdate<'a> = + abstract member all : JSMap<'a> with get + abstract member added : JSMap<'a> with get + abstract member removed : JSMap<'a> with get + abstract member changed : JSMap> with get + diff --git a/src/web/ui/src/ui.fsproj b/src/web/ui/src/ui.fsproj index 5037286e5..58993d80d 100644 --- a/src/web/ui/src/ui.fsproj +++ b/src/web/ui/src/ui.fsproj @@ -19,6 +19,7 @@ +