From e6d2bdc7068fddd1dde6555ce9e03a91f4a072f2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Loi=CC=88c=20Correnson?= <loic.correnson@cea.fr>
Date: Tue, 7 Jul 2020 09:54:05 +0200
Subject: [PATCH] [ivette] hide object fields in api documentation

---
 ivette/api/dive/index.ts              | 41 ++++++++++-----
 ivette/api/kernel/ast/index.ts        | 76 ++++++++++++++++++---------
 ivette/api/kernel/project/index.ts    | 35 +++++++-----
 ivette/api/kernel/properties/index.ts | 34 +++++++-----
 ivette/api/kernel/services/index.ts   | 28 ++++++----
 ivette/api/server_tsc.ml              | 42 +++++++++++----
 6 files changed, 171 insertions(+), 85 deletions(-)

diff --git a/ivette/api/dive/index.ts b/ivette/api/dive/index.ts
index d7e56288870..ddcb8432973 100644
--- a/ivette/api/dive/index.ts
+++ b/ivette/api/dive/index.ts
@@ -43,32 +43,34 @@ export const byVariableName: Compare.Order<variableName> =
     varName: Compare.alpha,
   });
 
-/** Retrieve the whole graph */
-export const graph: Server.GetRequest<null,Json.json> = {
+const graph_internal: Server.GetRequest<null,Json.json> = {
   kind: Server.RqKind.GET,
   name:   'dive.graph',
   input:  Json.jNull,
   output: Json.jAny,
 };
+/** Retrieve the whole graph */
+export const graph: Server.GetRequest<null,Json.json>= graph_internal;
 
-/** Erase the graph and start over with an empty one */
-export const clear: Server.ExecRequest<null,null> = {
+const clear_internal: Server.ExecRequest<null,null> = {
   kind: Server.RqKind.EXEC,
   name:   'dive.clear',
   input:  Json.jNull,
   output: Json.jNull,
 };
+/** Erase the graph and start over with an empty one */
+export const clear: Server.ExecRequest<null,null>= clear_internal;
 
-/** Add a variable to the graph */
-export const addVar: Server.ExecRequest<variableName,Json.json> = {
+const addVar_internal: Server.ExecRequest<variableName,Json.json> = {
   kind: Server.RqKind.EXEC,
   name:   'dive.addVar',
   input:  jVariableName,
   output: Json.jAny,
 };
+/** Add a variable to the graph */
+export const addVar: Server.ExecRequest<variableName,Json.json>= addVar_internal;
 
-/** Add all alarms of the given function */
-export const addFunctionAlarms: Server.ExecRequest<
+const addFunctionAlarms_internal: Server.ExecRequest<
   Json.key<'#fct'>,
   Json.json
   > = {
@@ -77,29 +79,40 @@ export const addFunctionAlarms: Server.ExecRequest<
   input:  Json.jKey<'#fct'>('#fct'),
   output: Json.jAny,
 };
+/** Add all alarms of the given function */
+export const addFunctionAlarms: Server.ExecRequest<
+  Json.key<'#fct'>,
+  Json.json
+  >= addFunctionAlarms_internal;
 
-/** Explore the graph starting from an existing vertex */
-export const explore: Server.ExecRequest<Json.index<'#dive-node'>,Json.json> = {
+const explore_internal: Server.ExecRequest<
+  Json.index<'#dive-node'>,
+  Json.json
+  > = {
   kind: Server.RqKind.EXEC,
   name:   'dive.explore',
   input:  Json.jIndex<'#dive-node'>('#dive-node'),
   output: Json.jAny,
 };
+/** Explore the graph starting from an existing vertex */
+export const explore: Server.ExecRequest<Json.index<'#dive-node'>,Json.json>= explore_internal;
 
-/** Show the dependencies of an existing vertex */
-export const show: Server.ExecRequest<Json.index<'#dive-node'>,Json.json> = {
+const show_internal: Server.ExecRequest<Json.index<'#dive-node'>,Json.json> = {
   kind: Server.RqKind.EXEC,
   name:   'dive.show',
   input:  Json.jIndex<'#dive-node'>('#dive-node'),
   output: Json.jAny,
 };
+/** Show the dependencies of an existing vertex */
+export const show: Server.ExecRequest<Json.index<'#dive-node'>,Json.json>= show_internal;
 
-/** Hide the dependencies of an existing vertex */
-export const hide: Server.ExecRequest<Json.index<'#dive-node'>,Json.json> = {
+const hide_internal: Server.ExecRequest<Json.index<'#dive-node'>,Json.json> = {
   kind: Server.RqKind.EXEC,
   name:   'dive.hide',
   input:  Json.jIndex<'#dive-node'>('#dive-node'),
   output: Json.jAny,
 };
+/** Hide the dependencies of an existing vertex */
+export const hide: Server.ExecRequest<Json.index<'#dive-node'>,Json.json>= hide_internal;
 
 /* ------------------------------------- */
diff --git a/ivette/api/kernel/ast/index.ts b/ivette/api/kernel/ast/index.ts
index decd0bc05e0..27e84f57231 100644
--- a/ivette/api/kernel/ast/index.ts
+++ b/ivette/api/kernel/ast/index.ts
@@ -32,13 +32,14 @@ import { tag } from 'api/kernel/data';
 //@ts-ignore
 import { text } from 'api/kernel/data';
 
-/** Ensures that AST is computed */
-export const compute: Server.ExecRequest<null,null> = {
+const compute_internal: Server.ExecRequest<null,null> = {
   kind: Server.RqKind.EXEC,
   name:   'kernel.ast.compute',
   input:  Json.jNull,
   output: Json.jNull,
 };
+/** Ensures that AST is computed */
+export const compute: Server.ExecRequest<null,null>= compute_internal;
 
 /** Marker kind */
 export enum markerKind {
@@ -73,13 +74,14 @@ export const jMarkerKindSafe: Json.Safe<markerKind> =
 export const byMarkerKind: Compare.Order<markerKind> =
   Compare.byEnum(markerKind);
 
-/** Registered tags for the above type. */
-export const markerKindTags: Server.GetRequest<null,tag[]> = {
+const markerKindTags_internal: Server.GetRequest<null,tag[]> = {
   kind: Server.RqKind.GET,
   name:   'kernel.ast.markerKindTags',
   input:  Json.jNull,
   output: Json.jList(jTag),
 };
+/** Registered tags for the above type. */
+export const markerKindTags: Server.GetRequest<null,tag[]>= markerKindTags_internal;
 
 /** Data for array rows [`markerInfo`](#markerinfo)  */
 export interface markerInfoData {
@@ -123,16 +125,16 @@ export const signalMarkerInfo: Server.Signal = {
   name: 'kernel.ast.signalMarkerInfo',
 };
 
-/** Force full reload for array [`markerInfo`](#markerinfo)  */
-export const reloadMarkerInfo: Server.GetRequest<null,null> = {
+const reloadMarkerInfo_internal: Server.GetRequest<null,null> = {
   kind: Server.RqKind.GET,
   name:   'kernel.ast.reloadMarkerInfo',
   input:  Json.jNull,
   output: Json.jNull,
 };
+/** Force full reload for array [`markerInfo`](#markerinfo)  */
+export const reloadMarkerInfo: Server.GetRequest<null,null>= reloadMarkerInfo_internal;
 
-/** Data fetcher for array [`markerInfo`](#markerinfo)  */
-export const fetchMarkerInfo: Server.GetRequest<
+const fetchMarkerInfo_internal: Server.GetRequest<
   number,
   { pending: number, updated: markerInfoData[],
     removed: Json.key<'#markerInfo'>[], reload: boolean }
@@ -147,9 +149,17 @@ export const fetchMarkerInfo: Server.GetRequest<
             reload: Json.jFail(Json.jBoolean,'Boolean expected'),
           }),
 };
+/** Data fetcher for array [`markerInfo`](#markerinfo)  */
+export const fetchMarkerInfo: Server.GetRequest<
+  number,
+  { pending: number, updated: markerInfoData[],
+    removed: Json.key<'#markerInfo'>[], reload: boolean }
+  >= fetchMarkerInfo_internal;
 
-/** Marker informations */
-export const markerInfo: State.Array<Json.key<'#markerInfo'>,markerInfoData> = {
+const markerInfo_internal: State.Array<
+  Json.key<'#markerInfo'>,
+  markerInfoData
+  > = {
   name: 'kernel.ast.markerInfo',
   getkey: ((d:markerInfoData) => d.key),
   signal: signalMarkerInfo,
@@ -157,6 +167,8 @@ export const markerInfo: State.Array<Json.key<'#markerInfo'>,markerInfoData> = {
   reload: reloadMarkerInfo,
   order: byMarkerInfoData,
 };
+/** Marker informations */
+export const markerInfo: State.Array<Json.key<'#markerInfo'>,markerInfoData> = markerInfo_internal;
 
 /** Localizable AST markers */
 export type marker =
@@ -185,21 +197,23 @@ export const jMarkerSafe: Json.Safe<marker> =
 /** Natural order for `marker` */
 export const byMarker: Compare.Order<marker> = Compare.structural;
 
-/** Collect all functions in the AST */
-export const getFunctions: Server.GetRequest<null,Json.key<'#fct'>[]> = {
+const getFunctions_internal: Server.GetRequest<null,Json.key<'#fct'>[]> = {
   kind: Server.RqKind.GET,
   name:   'kernel.ast.getFunctions',
   input:  Json.jNull,
   output: Json.jList(Json.jKey<'#fct'>('#fct')),
 };
+/** Collect all functions in the AST */
+export const getFunctions: Server.GetRequest<null,Json.key<'#fct'>[]>= getFunctions_internal;
 
-/** Print the AST of a function */
-export const printFunction: Server.GetRequest<Json.key<'#fct'>,text> = {
+const printFunction_internal: Server.GetRequest<Json.key<'#fct'>,text> = {
   kind: Server.RqKind.GET,
   name:   'kernel.ast.printFunction',
   input:  Json.jKey<'#fct'>('#fct'),
   output: jText,
 };
+/** Print the AST of a function */
+export const printFunction: Server.GetRequest<Json.key<'#fct'>,text>= printFunction_internal;
 
 /** Data for array rows [`functions`](#functions)  */
 export interface functionsData {
@@ -238,16 +252,16 @@ export const signalFunctions: Server.Signal = {
   name: 'kernel.ast.signalFunctions',
 };
 
-/** Force full reload for array [`functions`](#functions)  */
-export const reloadFunctions: Server.GetRequest<null,null> = {
+const reloadFunctions_internal: Server.GetRequest<null,null> = {
   kind: Server.RqKind.GET,
   name:   'kernel.ast.reloadFunctions',
   input:  Json.jNull,
   output: Json.jNull,
 };
+/** Force full reload for array [`functions`](#functions)  */
+export const reloadFunctions: Server.GetRequest<null,null>= reloadFunctions_internal;
 
-/** Data fetcher for array [`functions`](#functions)  */
-export const fetchFunctions: Server.GetRequest<
+const fetchFunctions_internal: Server.GetRequest<
   number,
   { pending: number, updated: functionsData[],
     removed: Json.key<'#functions'>[], reload: boolean }
@@ -262,9 +276,14 @@ export const fetchFunctions: Server.GetRequest<
             reload: Json.jFail(Json.jBoolean,'Boolean expected'),
           }),
 };
+/** Data fetcher for array [`functions`](#functions)  */
+export const fetchFunctions: Server.GetRequest<
+  number,
+  { pending: number, updated: functionsData[],
+    removed: Json.key<'#functions'>[], reload: boolean }
+  >= fetchFunctions_internal;
 
-/** AST Functions */
-export const functions: State.Array<Json.key<'#functions'>,functionsData> = {
+const functions_internal: State.Array<Json.key<'#functions'>,functionsData> = {
   name: 'kernel.ast.functions',
   getkey: ((d:functionsData) => d.key),
   signal: signalFunctions,
@@ -272,29 +291,34 @@ export const functions: State.Array<Json.key<'#functions'>,functionsData> = {
   reload: reloadFunctions,
   order: byFunctionsData,
 };
+/** AST Functions */
+export const functions: State.Array<Json.key<'#functions'>,functionsData> = functions_internal;
 
-/** Get textual information about a marker */
-export const getInfo: Server.GetRequest<marker,text> = {
+const getInfo_internal: Server.GetRequest<marker,text> = {
   kind: Server.RqKind.GET,
   name:   'kernel.ast.getInfo',
   input:  jMarker,
   output: jText,
 };
+/** Get textual information about a marker */
+export const getInfo: Server.GetRequest<marker,text>= getInfo_internal;
 
-/** Get the currently analyzed source file names */
-export const getFiles: Server.GetRequest<null,string[]> = {
+const getFiles_internal: Server.GetRequest<null,string[]> = {
   kind: Server.RqKind.GET,
   name:   'kernel.ast.getFiles',
   input:  Json.jNull,
   output: Json.jList(Json.jString),
 };
+/** Get the currently analyzed source file names */
+export const getFiles: Server.GetRequest<null,string[]>= getFiles_internal;
 
-/** Set the source file names to analyze. */
-export const setFiles: Server.SetRequest<string[],null> = {
+const setFiles_internal: Server.SetRequest<string[],null> = {
   kind: Server.RqKind.SET,
   name:   'kernel.ast.setFiles',
   input:  Json.jList(Json.jString),
   output: Json.jNull,
 };
+/** Set the source file names to analyze. */
+export const setFiles: Server.SetRequest<string[],null>= setFiles_internal;
 
 /* ------------------------------------- */
diff --git a/ivette/api/kernel/project/index.ts b/ivette/api/kernel/project/index.ts
index e77efa142f1..6674b144671 100644
--- a/ivette/api/kernel/project/index.ts
+++ b/ivette/api/kernel/project/index.ts
@@ -67,60 +67,67 @@ export const byProjectRequest: Compare.Order<projectRequest> =
     data: Compare.structural,
   });
 
-/** Returns the current project */
-export const getCurrent: Server.GetRequest<null,projectInfo> = {
+const getCurrent_internal: Server.GetRequest<null,projectInfo> = {
   kind: Server.RqKind.GET,
   name:   'kernel.project.getCurrent',
   input:  Json.jNull,
   output: jProjectInfo,
 };
+/** Returns the current project */
+export const getCurrent: Server.GetRequest<null,projectInfo>= getCurrent_internal;
 
-/** Switches the current project */
-export const setCurrent: Server.SetRequest<Json.key<'#project'>,null> = {
+const setCurrent_internal: Server.SetRequest<Json.key<'#project'>,null> = {
   kind: Server.RqKind.SET,
   name:   'kernel.project.setCurrent',
   input:  Json.jKey<'#project'>('#project'),
   output: Json.jNull,
 };
+/** Switches the current project */
+export const setCurrent: Server.SetRequest<Json.key<'#project'>,null>= setCurrent_internal;
 
-/** Returns the list of all projects */
-export const getList: Server.GetRequest<null,projectInfo[]> = {
+const getList_internal: Server.GetRequest<null,projectInfo[]> = {
   kind: Server.RqKind.GET,
   name:   'kernel.project.getList',
   input:  Json.jNull,
   output: Json.jList(jProjectInfo),
 };
+/** Returns the list of all projects */
+export const getList: Server.GetRequest<null,projectInfo[]>= getList_internal;
 
-/** Execute a GET request within the given project */
-export const getOn: Server.GetRequest<projectRequest,Json.json> = {
+const getOn_internal: Server.GetRequest<projectRequest,Json.json> = {
   kind: Server.RqKind.GET,
   name:   'kernel.project.getOn',
   input:  jProjectRequest,
   output: Json.jAny,
 };
+/** Execute a GET request within the given project */
+export const getOn: Server.GetRequest<projectRequest,Json.json>= getOn_internal;
 
-/** Execute a SET request within the given project */
-export const setOn: Server.SetRequest<projectRequest,Json.json> = {
+const setOn_internal: Server.SetRequest<projectRequest,Json.json> = {
   kind: Server.RqKind.SET,
   name:   'kernel.project.setOn',
   input:  jProjectRequest,
   output: Json.jAny,
 };
+/** Execute a SET request within the given project */
+export const setOn: Server.SetRequest<projectRequest,Json.json>= setOn_internal;
 
-/** Execute an EXEC request within the given project */
-export const execOn: Server.ExecRequest<projectRequest,Json.json> = {
+const execOn_internal: Server.ExecRequest<projectRequest,Json.json> = {
   kind: Server.RqKind.EXEC,
   name:   'kernel.project.execOn',
   input:  jProjectRequest,
   output: Json.jAny,
 };
+/** Execute an EXEC request within the given project */
+export const execOn: Server.ExecRequest<projectRequest,Json.json>= execOn_internal;
 
-/** Create a new project */
-export const create: Server.SetRequest<string,projectInfo> = {
+const create_internal: Server.SetRequest<string,projectInfo> = {
   kind: Server.RqKind.SET,
   name:   'kernel.project.create',
   input:  Json.jString,
   output: jProjectInfo,
 };
+/** Create a new project */
+export const create: Server.SetRequest<string,projectInfo>= create_internal;
 
 /* ------------------------------------- */
diff --git a/ivette/api/kernel/properties/index.ts b/ivette/api/kernel/properties/index.ts
index 0d415ee563d..92d7cc4a130 100644
--- a/ivette/api/kernel/properties/index.ts
+++ b/ivette/api/kernel/properties/index.ts
@@ -108,13 +108,14 @@ export const jPropKindSafe: Json.Safe<propKind> =
 /** Natural order for `propKind` */
 export const byPropKind: Compare.Order<propKind> = Compare.byEnum(propKind);
 
-/** Registered tags for the above type. */
-export const propKindTags: Server.GetRequest<null,tag[]> = {
+const propKindTags_internal: Server.GetRequest<null,tag[]> = {
   kind: Server.RqKind.GET,
   name:   'kernel.properties.propKindTags',
   input:  Json.jNull,
   output: Json.jList(jTag),
 };
+/** Registered tags for the above type. */
+export const propKindTags: Server.GetRequest<null,tag[]>= propKindTags_internal;
 
 /** Property Status (consolidated) */
 export enum propStatus {
@@ -153,13 +154,14 @@ export const jPropStatusSafe: Json.Safe<propStatus> =
 export const byPropStatus: Compare.Order<propStatus> =
   Compare.byEnum(propStatus);
 
-/** Registered tags for the above type. */
-export const propStatusTags: Server.GetRequest<null,tag[]> = {
+const propStatusTags_internal: Server.GetRequest<null,tag[]> = {
   kind: Server.RqKind.GET,
   name:   'kernel.properties.propStatusTags',
   input:  Json.jNull,
   output: Json.jList(jTag),
 };
+/** Registered tags for the above type. */
+export const propStatusTags: Server.GetRequest<null,tag[]>= propStatusTags_internal;
 
 /** Alarm Kinds */
 export enum alarms {
@@ -211,13 +213,14 @@ export const jAlarmsSafe: Json.Safe<alarms> =
 /** Natural order for `alarms` */
 export const byAlarms: Compare.Order<alarms> = Compare.byEnum(alarms);
 
-/** Registered tags for the above type. */
-export const alarmsTags: Server.GetRequest<null,tag[]> = {
+const alarmsTags_internal: Server.GetRequest<null,tag[]> = {
   kind: Server.RqKind.GET,
   name:   'kernel.properties.alarmsTags',
   input:  Json.jNull,
   output: Json.jList(jTag),
 };
+/** Registered tags for the above type. */
+export const alarmsTags: Server.GetRequest<null,tag[]>= alarmsTags_internal;
 
 /** Data for array rows [`status`](#status)  */
 export interface statusData {
@@ -290,16 +293,16 @@ export const signalStatus: Server.Signal = {
   name: 'kernel.properties.signalStatus',
 };
 
-/** Force full reload for array [`status`](#status)  */
-export const reloadStatus: Server.GetRequest<null,null> = {
+const reloadStatus_internal: Server.GetRequest<null,null> = {
   kind: Server.RqKind.GET,
   name:   'kernel.properties.reloadStatus',
   input:  Json.jNull,
   output: Json.jNull,
 };
+/** Force full reload for array [`status`](#status)  */
+export const reloadStatus: Server.GetRequest<null,null>= reloadStatus_internal;
 
-/** Data fetcher for array [`status`](#status)  */
-export const fetchStatus: Server.GetRequest<
+const fetchStatus_internal: Server.GetRequest<
   number,
   { pending: number, updated: statusData[], removed: Json.key<'#status'>[],
     reload: boolean }
@@ -314,9 +317,14 @@ export const fetchStatus: Server.GetRequest<
             reload: Json.jFail(Json.jBoolean,'Boolean expected'),
           }),
 };
+/** Data fetcher for array [`status`](#status)  */
+export const fetchStatus: Server.GetRequest<
+  number,
+  { pending: number, updated: statusData[], removed: Json.key<'#status'>[],
+    reload: boolean }
+  >= fetchStatus_internal;
 
-/** Status of Registered Properties */
-export const status: State.Array<Json.key<'#status'>,statusData> = {
+const status_internal: State.Array<Json.key<'#status'>,statusData> = {
   name: 'kernel.properties.status',
   getkey: ((d:statusData) => d.key),
   signal: signalStatus,
@@ -324,5 +332,7 @@ export const status: State.Array<Json.key<'#status'>,statusData> = {
   reload: reloadStatus,
   order: byStatusData,
 };
+/** Status of Registered Properties */
+export const status: State.Array<Json.key<'#status'>,statusData> = status_internal;
 
 /* ------------------------------------- */
diff --git a/ivette/api/kernel/services/index.ts b/ivette/api/kernel/services/index.ts
index 87c76269438..cdc371d34b5 100644
--- a/ivette/api/kernel/services/index.ts
+++ b/ivette/api/kernel/services/index.ts
@@ -24,8 +24,7 @@ import { jTagSafe } from 'api/kernel/data';
 //@ts-ignore
 import { tag } from 'api/kernel/data';
 
-/** Frama-C Kernel configuration */
-export const getConfig: Server.GetRequest<
+const getConfig_internal: Server.GetRequest<
   null,
   { pluginpath: string[], libdir: string, datadir: string, version: string }
   > = {
@@ -39,14 +38,20 @@ export const getConfig: Server.GetRequest<
             version: Json.jFail(Json.jString,'String expected'),
           }),
 };
+/** Frama-C Kernel configuration */
+export const getConfig: Server.GetRequest<
+  null,
+  { pluginpath: string[], libdir: string, datadir: string, version: string }
+  >= getConfig_internal;
 
-/** Load a save file. Returns an error, if not successfull. */
-export const load: Server.SetRequest<string,string | undefined> = {
+const load_internal: Server.SetRequest<string,string | undefined> = {
   kind: Server.RqKind.SET,
   name:   'kernel.services.load',
   input:  Json.jString,
   output: Json.jString,
 };
+/** Load a save file. Returns an error, if not successfull. */
+export const load: Server.SetRequest<string,string | undefined>= load_internal;
 
 /** Source file positions. */
 export type source =
@@ -101,13 +106,14 @@ export const jLogkindSafe: Json.Safe<logkind> =
 /** Natural order for `logkind` */
 export const byLogkind: Compare.Order<logkind> = Compare.byEnum(logkind);
 
-/** Registered tags for the above type. */
-export const logkindTags: Server.GetRequest<null,tag[]> = {
+const logkindTags_internal: Server.GetRequest<null,tag[]> = {
   kind: Server.RqKind.GET,
   name:   'kernel.services.logkindTags',
   input:  Json.jNull,
   output: Json.jList(jTag),
 };
+/** Registered tags for the above type. */
+export const logkindTags: Server.GetRequest<null,tag[]>= logkindTags_internal;
 
 /** Message event record. */
 export interface log {
@@ -148,20 +154,22 @@ export const byLog: Compare.Order<log> =
     source: Compare.defined(bySource),
   });
 
-/** Turn logs monitoring on/off */
-export const setLogs: Server.SetRequest<boolean,null> = {
+const setLogs_internal: Server.SetRequest<boolean,null> = {
   kind: Server.RqKind.SET,
   name:   'kernel.services.setLogs',
   input:  Json.jBoolean,
   output: Json.jNull,
 };
+/** Turn logs monitoring on/off */
+export const setLogs: Server.SetRequest<boolean,null>= setLogs_internal;
 
-/** Flush the last emitted logs since last call (max 100) */
-export const getLogs: Server.GetRequest<null,log[]> = {
+const getLogs_internal: Server.GetRequest<null,log[]> = {
   kind: Server.RqKind.GET,
   name:   'kernel.services.getLogs',
   input:  Json.jNull,
   output: Json.jList(jLog),
 };
+/** Flush the last emitted logs since last call (max 100) */
+export const getLogs: Server.GetRequest<null,log[]>= getLogs_internal;
 
 /* ------------------------------------- */
diff --git a/ivette/api/server_tsc.ml b/ivette/api/server_tsc.ml
index 77a6f11beb0..8f5eb6e829b 100644
--- a/ivette/api/server_tsc.ml
+++ b/ivette/api/server_tsc.ml
@@ -269,15 +269,16 @@ let makeRecursive2 fn fmt js =
 let makeDeclaration fmt names d =
   let open Pkg in
   Format.pp_print_newline fmt () ;
-  makeDescr fmt d.d_descr ;
   let self = d.d_ident in
   let jtype = makeJtype ~self ~names in
   match d.d_kind with
 
   | D_type js ->
+    makeDescr fmt d.d_descr ;
     Format.fprintf fmt "@[<hv 2>export type %s =@ %a;@]@\n" self.name jtype js
 
   | D_record fjs ->
+    makeDescr fmt d.d_descr ;
     Format.fprintf fmt "export interface %s {@\n" self.name ;
     List.iter
       (fun { fd_name = fd ; fd_type = js ; fd_descr = doc } ->
@@ -291,6 +292,7 @@ let makeDeclaration fmt names d =
     Format.fprintf fmt "}@\n"
 
   | D_enum tgs ->
+    makeDescr fmt d.d_descr ;
     Format.fprintf fmt "export enum %s {@\n" self.name ;
     List.iter
       (fun { tg_name = tag ; tg_descr = doc } ->
@@ -300,6 +302,7 @@ let makeDeclaration fmt names d =
     Format.fprintf fmt "}@\n"
 
   | D_signal ->
+    makeDescr fmt d.d_descr ;
     Format.fprintf fmt "export const %s: Server.Signal = {@\n" self.name ;
     Format.fprintf fmt "  name: '%s',@\n" (Pkg.name_of_ident d.d_ident) ;
     Format.fprintf fmt "};@\n"
@@ -311,28 +314,37 @@ let makeDeclaration fmt names d =
     let output = typeOfParam rq.rq_output in
     let makeParam fmt js = makeDecoder ~safe:false ~names fmt js in
     Format.fprintf fmt
-      "@[<hv 2>export const %s: Server.%sRequest<@,%a,@,%a@,>@] = {@\n"
+      "@[<hv 2>const %s_internal: Server.%sRequest<@,%a,@,%a@,>@] = {@\n"
       self.name prefix jtype input jtype output ;
     Format.fprintf fmt "  kind: Server.RqKind.%s,@\n" kind ;
     Format.fprintf fmt "  name:   '%s',@\n" (Pkg.name_of_ident d.d_ident) ;
     Format.fprintf fmt "  input:  %a,@\n" makeParam input ;
     Format.fprintf fmt "  output: %a,@\n" makeParam output ;
-    Format.fprintf fmt "};@\n"
+    Format.fprintf fmt "};@\n" ;
+    makeDescr fmt d.d_descr ;
+    Format.fprintf fmt
+      "@[<hv 2>export const %s: Server.%sRequest<@,%a,@,%a@,>@]\
+       = %s_internal;@\n"
+      self.name prefix jtype input jtype output self.name ;
 
   | D_value js ->
     Format.fprintf fmt
-      "@[<hv 2>export const %s: State.Value<@,%a@,>@] = {\n"
+      "@[<hv 2>const %s_internal: State.Value<@,%a@,>@] = {\n"
       self.name jtype js ;
     Format.fprintf fmt "  name: '%s',@\n" (Pkg.name_of_ident self) ;
     Format.fprintf fmt "  signal: %a,@\n"
       (jcall names) (Pkg.Derived.signal self) ;
     Format.fprintf fmt "  getter: %a,@\n"
       (jcall names) (Pkg.Derived.getter self) ;
-    Format.fprintf fmt "};@\n"
+    Format.fprintf fmt "};@\n" ;
+    makeDescr fmt d.d_descr ;
+    Format.fprintf fmt
+      "@[<hv 2>export const %s: State.Value<@,%a@,>@] = %s_internal;\n"
+      self.name jtype js self.name ;
 
   | D_state js ->
     Format.fprintf fmt
-      "@[<hv 2>export const %s: State.State<@,%a@,>@] = {@\n"
+      "@[<hv 2>const %s_internal: State.State<@,%a@,>@] = {@\n"
       self.name jtype js ;
     Format.fprintf fmt "  name: '%s',@\n" (Pkg.name_of_ident self) ;
     Format.fprintf fmt "  signal: %a,@\n"
@@ -341,14 +353,19 @@ let makeDeclaration fmt names d =
       (jcall names) (Pkg.Derived.getter self) ;
     Format.fprintf fmt "  setter: %a,@\n"
       (jcall names) (Pkg.Derived.setter self) ;
-    Format.fprintf fmt "};@\n"
+    Format.fprintf fmt "};@\n" ;
+    makeDescr fmt d.d_descr ;
+    Format.fprintf fmt
+      "@[<hv 2>export const %s: State.State<@,%a@,>@] = %s_internal;@\n"
+      self.name jtype js self.name;
+
 
   | D_array { arr_key ; arr_kind } ->
     let data = Pkg.Derived.data self in
     let jkey = (Pkg.Jkey arr_kind) in
     let jrow = (Pkg.Jdata data) in
     Format.fprintf fmt
-      "@[<hv 2>export const %s: State.Array<@,%a,@,%a@,>@] = {@\n"
+      "@[<hv 2>const %s_internal: State.Array<@,%a,@,%a@,>@] = {@\n"
       self.name jtype jkey jtype jrow ;
     Format.fprintf fmt "  name: '%s',@\n" (Pkg.name_of_ident self) ;
     Format.fprintf fmt "  getkey: ((d:%a) => d.%s),@\n" jtype jrow arr_key ;
@@ -360,21 +377,28 @@ let makeDeclaration fmt names d =
       (jcall names) (Pkg.Derived.reload self) ;
     Format.fprintf fmt "  order: %a,@\n"
       (jcall names) (Pkg.Derived.order data) ;
-    Format.fprintf fmt "};@\n"
+    Format.fprintf fmt "};@\n" ;
+    makeDescr fmt d.d_descr ;
+    Format.fprintf fmt
+      "@[<hv 2>export const %s: State.Array<@,%a,@,%a@,>@] = %s_internal;@\n"
+      self.name jtype jkey jtype jrow self.name ;
 
   | D_safe(id,js) ->
+    makeDescr fmt d.d_descr ;
     Format.fprintf fmt
       "@[<hov 2>@[<hv 0>export const %s: Json.Safe<@,%a@,>@] =@ %a;@]\n"
       self.name (jcall names) id
       (makeRecursive (makeRootDecoder ~safe:true ~self:id ~names)) js
 
   | D_loose(id,js) ->
+    makeDescr fmt d.d_descr ;
     Format.fprintf fmt
       "@[<hov 2>@[<hv 0>export const %s: Json.Loose<@,%a@,>@] =@ %a;@]\n"
       self.name (jcall names) id
       (makeRecursive (makeRootDecoder ~safe:false ~self:id ~names)) js
 
   | D_order(id,js) ->
+    makeDescr fmt d.d_descr ;
     Format.fprintf fmt
       "@[<hov 2>@[<hv 0>export const %s: Compare.Order<@,%a@,>@] =@ %a;@]\n"
       self.name (jcall names) id
-- 
GitLab