Skip to content

Commit 91b64fd

Browse files
rafaellehmkuhlArturoManzoli
authored andcommitted
cosmos: Add JSDocs for the global Cockpit APIs
1 parent a9e1fd5 commit 91b64fd

File tree

1 file changed

+79
-2
lines changed

1 file changed

+79
-2
lines changed

src/libs/cosmos.ts

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,26 +82,104 @@ declare global {
8282
sum(): number
8383
}
8484

85-
/* eslint-disable jsdoc/require-jsdoc */
85+
/**
86+
* Extended Window interface with custom dedicated dedicated APIs.
87+
*/
8688
interface Window {
89+
/**
90+
* Exposed Cockpit APIs
91+
* E.g. data-lake, cockpit actions, etc.
92+
*/
8793
cockpit: {
8894
// Data lake:
95+
96+
/**
97+
* The object that holds the data-lake variables data
98+
*/
8999
dataLakeVariableData: typeof dataLakeVariableData
100+
/**
101+
* Get data from an specific data lake variable
102+
* @param id - The id of the data to retrieve
103+
* @returns The data or undefined if not available
104+
*/
90105
getDataLakeVariableData: typeof getDataLakeVariableData
106+
/**
107+
* Listen to data changes on a specific data lake variable
108+
* @param id - The id of the data to listen to
109+
* @param listener - The listener callback
110+
*/
91111
listenDataLakeVariable: typeof listenDataLakeVariable
112+
/**
113+
* Stop listening to data changes on a specific data lake variable
114+
* @param id - The id of the data to stop listening to
115+
*/
92116
unlistenDataLakeVariable: typeof unlistenDataLakeVariable
117+
/**
118+
* Get info about all variables in the data lake
119+
* @returns Data lake data
120+
*/
93121
getAllDataLakeVariablesInfo: typeof getAllDataLakeVariablesInfo
122+
/**
123+
* Get info about a specific variable in the data lake
124+
* @param id - The id of the data to retrieve
125+
* @returns The data info or undefined if not available
126+
*/
94127
getDataLakeVariableInfo: typeof getDataLakeVariableInfo
128+
/**
129+
* Set the value of an specific data lake variable
130+
* @param id - The id of the data to set
131+
* @param value - The value to set
132+
*/
95133
setDataLakeVariableData: typeof setDataLakeVariableData
134+
/**
135+
* Create a new variable in the data lake
136+
* @param variable - The variable to create
137+
* @param initialValue - The initial value for the variable
138+
*/
96139
createDataLakeVariable: typeof createDataLakeVariable
140+
/**
141+
* Update information about an specific data lake variable
142+
* @param variable - The variable to update
143+
*/
97144
updateDataLakeVariableInfo: typeof updateDataLakeVariableInfo
145+
/**
146+
* Delete a variable from the data lake
147+
* @param id - The id of the variable to delete
148+
*/
98149
deleteDataLakeVariable: typeof deleteDataLakeVariable
150+
99151
// Cockpit actions:
152+
153+
/**
154+
* Get all available cockpit actions
155+
* @returns Available cockpit actions
156+
*/
100157
availableCockpitActions: typeof availableCockpitActions
158+
/**
159+
* Register a new cockpit action
160+
* @param action - The action to register
161+
*/
101162
registerNewAction: typeof registerNewAction
163+
/**
164+
* Delete a cockpit action
165+
* @param id - The id of the action to delete
166+
*/
102167
deleteAction: typeof deleteAction
168+
/**
169+
* Register a callback for a cockpit action
170+
* @param action - The action to register the callback for
171+
* @param callback - The callback to register
172+
*/
103173
registerActionCallback: typeof registerActionCallback
174+
/**
175+
* Unregister a callback for a cockpit action
176+
* @param id - The id of the action to unregister the callback for
177+
*/
104178
unregisterActionCallback: typeof unregisterActionCallback
179+
/**
180+
* Execute the callback for a cockpit action
181+
* @param id - The id of the action to execute the callback for
182+
*/
105183
executeActionCallback: typeof executeActionCallback
106184
}
107185
/**
@@ -115,7 +193,6 @@ declare global {
115193
getInfoOnSubnets: () => Promise<NetworkInfo[]>
116194
}
117195
}
118-
/* eslint-enable jsdoc/require-jsdoc */
119196
}
120197

121198
// Use global as window when running for browsers

0 commit comments

Comments
 (0)