@openfin/workspace-platform 5.2.0 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -4
- package/client-api/src/shapes.d.ts +597 -0
- package/{index.ts → client-api-platform/index.d.ts} +0 -0
- package/client-api-platform/src/api/app-directory.d.ts +7 -0
- package/client-api-platform/src/api/browser/browser-module.d.ts +13 -0
- package/client-api-platform/src/api/browser/index.d.ts +22 -0
- package/client-api-platform/src/api/pages/helper.d.ts +22 -0
- package/client-api-platform/src/api/pages/index.d.ts +30 -0
- package/client-api-platform/src/api/protocol.d.ts +48 -0
- package/client-api-platform/src/api/storage.d.ts +10 -0
- package/client-api-platform/src/api/theming.d.ts +5 -0
- package/client-api-platform/src/api/workspace-module.d.ts +3 -0
- package/client-api-platform/src/index.d.ts +41 -0
- package/client-api-platform/src/init/browser-window-focus.d.ts +19 -0
- package/client-api-platform/src/init/cleanup.d.ts +1 -0
- package/client-api-platform/src/init/index.d.ts +5 -0
- package/client-api-platform/src/init/override-callback.d.ts +3 -0
- package/client-api-platform/src/init/theming.d.ts +9 -0
- package/client-api-platform/src/init/utils.d.ts +45 -0
- package/client-api-platform/src/shapes.d.ts +673 -0
- package/client-api-platform/src/umd.d.ts +1 -0
- package/common/src/api/pages/attached.d.ts +101 -0
- package/common/src/api/pages/idb.d.ts +12 -0
- package/common/src/api/pages/index.d.ts +22 -0
- package/common/src/api/pages/legacy.d.ts +16 -0
- package/common/src/api/pages/shapes.d.ts +77 -0
- package/common/src/api/protocol.d.ts +64 -0
- package/common/src/api/theming.d.ts +62 -0
- package/common/src/api/workspaces/index.d.ts +7 -0
- package/common/src/utils/application.d.ts +38 -0
- package/common/src/utils/channels.d.ts +8 -0
- package/common/src/utils/debounce.d.ts +16 -0
- package/common/src/utils/defer-auto-show.d.ts +18 -0
- package/common/src/utils/env.d.ts +36 -0
- package/common/src/utils/layout.d.ts +52 -0
- package/common/src/utils/local-storage-key.d.ts +8 -0
- package/common/src/utils/logger/index.d.ts +26 -0
- package/common/src/utils/logger/manager.d.ts +35 -0
- package/common/src/utils/logger/shapes.d.ts +27 -0
- package/common/src/utils/route.d.ts +55 -0
- package/common/src/utils/shared-emitter.d.ts +10 -0
- package/common/src/utils/snapshot.d.ts +33 -0
- package/common/src/utils/strings.d.ts +5 -0
- package/common/src/utils/theming.d.ts +57 -0
- package/common/src/utils/umd.d.ts +2 -0
- package/common/src/utils/window.d.ts +150 -0
- package/index.d.ts +1 -0
- package/index.js +2 -0
- package/index.js.map +1 -0
- package/package.json +1 -34
- package/search-api/src/client/index.d.ts +6 -0
- package/search-api/src/client/internal.d.ts +38 -0
- package/search-api/src/client/remote/channel-client-factory.d.ts +2 -0
- package/search-api/src/client/remote/channel-client.d.ts +9 -0
- package/search-api/src/client/remote/data.d.ts +16 -0
- package/search-api/src/client/remote/disconnect.d.ts +7 -0
- package/search-api/src/client/remote/dispatch.d.ts +9 -0
- package/search-api/src/client/remote/requests.d.ts +5 -0
- package/search-api/src/client/remote/search-close.d.ts +14 -0
- package/search-api/src/common.d.ts +104 -0
- package/search-api/src/errors.d.ts +5 -0
- package/search-api/src/fin/index.d.ts +6 -0
- package/search-api/src/fin/shapes.d.ts +23 -0
- package/search-api/src/index.d.ts +7 -0
- package/search-api/src/internal-shapes.d.ts +134 -0
- package/search-api/src/logger.d.ts +1 -0
- package/search-api/src/provider/index.d.ts +8 -0
- package/search-api/src/provider/internal.d.ts +33 -0
- package/search-api/src/provider/remote/channel-factory.d.ts +6 -0
- package/search-api/src/provider/remote/channel.d.ts +23 -0
- package/search-api/src/provider/remote/connection.d.ts +20 -0
- package/search-api/src/provider/remote/data.d.ts +23 -0
- package/search-api/src/provider/remote/deregistration.d.ts +5 -0
- package/search-api/src/provider/remote/disconnect.d.ts +1 -0
- package/search-api/src/provider/remote/disconnection.d.ts +9 -0
- package/search-api/src/provider/remote/dispatch.d.ts +7 -0
- package/search-api/src/provider/remote/info.d.ts +5 -0
- package/search-api/src/provider/remote/registration.d.ts +23 -0
- package/search-api/src/provider/remote/search-close.d.ts +14 -0
- package/search-api/src/provider/remote/search.d.ts +8 -0
- package/search-api/src/shapes.d.ts +542 -0
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -2
- package/.prettierrc.js +0 -2
- package/babel.config.js +0 -2
- package/jest.config.js +0 -2
- package/src/api/app-directory.ts +0 -45
- package/src/api/browser/browser-module.ts +0 -65
- package/src/api/browser/index.ts +0 -46
- package/src/api/pages/helper.ts +0 -113
- package/src/api/pages/index.ts +0 -164
- package/src/api/protocol.ts +0 -60
- package/src/api/storage.ts +0 -32
- package/src/api/workspace-module.ts +0 -36
- package/src/index.ts +0 -35
- package/src/init/browser-window-focus.ts +0 -59
- package/src/init/cleanup.ts +0 -87
- package/src/init/index.ts +0 -42
- package/src/init/override-callback.ts +0 -159
- package/src/init/utils.ts +0 -164
- package/src/shapes.ts +0 -160
- package/src/umd.ts +0 -5
- package/tsconfig.json +0 -13
- package/webpack.common.config.js +0 -1
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
/// <reference types="openfin-adapter/fin" />
|
|
2
|
+
import type { InteropBroker } from 'openfin-adapter/src/api/interop';
|
|
3
|
+
import type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs } from '../../common/src/api/pages/shapes';
|
|
4
|
+
import type { CustomThemes } from '../../common/src/api/theming';
|
|
5
|
+
import type { App } from '../../client-api/src/shapes';
|
|
6
|
+
export type { CustomThemes } from '../../common/src/api/theming';
|
|
7
|
+
export type { App, Image, AppIntent } from '../../client-api/src/shapes';
|
|
8
|
+
export { AppManifestType } from '../../client-api/src/shapes';
|
|
9
|
+
export type { AttachedPage, Page, PageWithUpdatableRuntimeAttribs, PageLayout, PageLayoutDetails } from '../../common/src/api/pages/shapes';
|
|
10
|
+
/**
|
|
11
|
+
* Request for creating a saved page in persistent storage.
|
|
12
|
+
*/
|
|
13
|
+
export interface CreateSavedPageRequest {
|
|
14
|
+
/** The page to create. */
|
|
15
|
+
page: Page;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Request for updating a saved page in persistent storage.
|
|
19
|
+
*/
|
|
20
|
+
export interface UpdateSavedPageRequest {
|
|
21
|
+
/** The ID of the page to update. */
|
|
22
|
+
pageId: string;
|
|
23
|
+
/** The updated page. */
|
|
24
|
+
page: Page;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Request for reordering the pages attached to a window.
|
|
28
|
+
*/
|
|
29
|
+
export interface ReorderPagesRequest {
|
|
30
|
+
/** An array of page ids that specify the order of the pages attached to the window. */
|
|
31
|
+
pageIds: string[];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Request to update the attributes of a page in which is attached to a running browser window.
|
|
35
|
+
*/
|
|
36
|
+
export interface UpdateAttachedPageRequest {
|
|
37
|
+
/** The ID of the page to update. */
|
|
38
|
+
pageId: string;
|
|
39
|
+
/** The updated page. */
|
|
40
|
+
page: Partial<PageWithUpdatableRuntimeAttribs>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Request for creating a browser window.
|
|
44
|
+
*/
|
|
45
|
+
export interface BrowserCreateWindowRequest extends Omit<OpenFin.PlatformWindowCreationOptions, 'workspacePlatform'> {
|
|
46
|
+
/** WorkspacePlatform specific window options. These options will not work unless a workspace platform has been initialized. */
|
|
47
|
+
workspacePlatform: {
|
|
48
|
+
/** The initial set of pages to add to the created browser window. */
|
|
49
|
+
pages: Page[];
|
|
50
|
+
/** The favicon to display on the top left of the created browser window. */
|
|
51
|
+
favicon?: string;
|
|
52
|
+
/** A UI friendly title for the created browser window. */
|
|
53
|
+
title?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Landing page that shows up when you add a new tab from the plus button that exists in the tabstrip.
|
|
56
|
+
* If you do not provide a newTabUrl, then the plus button in the tabstrip will not be shown and users cannot create a new empty tab.
|
|
57
|
+
*/
|
|
58
|
+
newTabUrl?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Landing page that shows up when you add a new page from the plus button that exists in the window frame where the page selector is shown.
|
|
61
|
+
* If you do not provide a newPageUrl, then the new Page plus button will not be shown and you cannot create a new empty Page or Window.
|
|
62
|
+
*/
|
|
63
|
+
newPageUrl?: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A window that is part of a browser snapshot.
|
|
68
|
+
*/
|
|
69
|
+
export declare type BrowserSnapshotWindow = OpenFin.WindowCreationOptions & BrowserCreateWindowRequest;
|
|
70
|
+
/**
|
|
71
|
+
* A browser snapshot.
|
|
72
|
+
*/
|
|
73
|
+
export interface BrowserSnapshot {
|
|
74
|
+
/** The state of the windows that were running at the time the snapshot was taken. */
|
|
75
|
+
windows: BrowserSnapshotWindow[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Controller for interacting with a browser window.
|
|
79
|
+
*/
|
|
80
|
+
export interface BrowserWindowModule {
|
|
81
|
+
/** The identity of the browser window. */
|
|
82
|
+
identity: OpenFin.Identity;
|
|
83
|
+
/** Underlying OpenFin window Controller. */
|
|
84
|
+
openfinWindow: OpenFin.Window;
|
|
85
|
+
/**
|
|
86
|
+
* Get a page that is attached to the browser window.
|
|
87
|
+
*
|
|
88
|
+
* ```ts
|
|
89
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
90
|
+
*
|
|
91
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
92
|
+
* // assume a browser window already exists
|
|
93
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
94
|
+
* const page = await windows[0].getPage('MyPageId');
|
|
95
|
+
* ```
|
|
96
|
+
* @param id the id of the page to get.
|
|
97
|
+
*/
|
|
98
|
+
getPage(id: string): Promise<AttachedPage>;
|
|
99
|
+
/**
|
|
100
|
+
* Return all the pages that are attached to a browser window.
|
|
101
|
+
*
|
|
102
|
+
* ```ts
|
|
103
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
104
|
+
*
|
|
105
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
106
|
+
* // assume a browser window already exists
|
|
107
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
108
|
+
* const pages = await windows[0].getPages();
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
getPages(): Promise<AttachedPage[]>;
|
|
112
|
+
/**
|
|
113
|
+
* Set the active page for the browser window.
|
|
114
|
+
*
|
|
115
|
+
* ```ts
|
|
116
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
117
|
+
*
|
|
118
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
119
|
+
* // assume a browser window already exists
|
|
120
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
121
|
+
* await windows[0].setActivePage('MyPageId');
|
|
122
|
+
* ```
|
|
123
|
+
* @param id the id of the attached page to set as active.
|
|
124
|
+
*/
|
|
125
|
+
setActivePage(id: string): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Attach a page to a browser window.
|
|
128
|
+
* If a page with same id or title is attached to an existing browser window, an error will be thrown.
|
|
129
|
+
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
132
|
+
*
|
|
133
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
134
|
+
* const layout = {
|
|
135
|
+
* content: [
|
|
136
|
+
* {
|
|
137
|
+
* type: 'stack',
|
|
138
|
+
* content: [
|
|
139
|
+
* {
|
|
140
|
+
* type: 'component',
|
|
141
|
+
* componentName: 'view',
|
|
142
|
+
* componentState: {
|
|
143
|
+
* name: 'myViewName',
|
|
144
|
+
* url: 'http://google.com'
|
|
145
|
+
* }
|
|
146
|
+
* }
|
|
147
|
+
* ]
|
|
148
|
+
* }
|
|
149
|
+
* ]
|
|
150
|
+
* };
|
|
151
|
+
* const page = {
|
|
152
|
+
* title: 'myPageTitle',
|
|
153
|
+
* pageId: 'myPageId',
|
|
154
|
+
* layout
|
|
155
|
+
* };
|
|
156
|
+
* // assume a browser window already exists
|
|
157
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
158
|
+
* await windows[0].addPage(page);
|
|
159
|
+
* // focus window
|
|
160
|
+
* await windows[0].openfinWindow.focus();
|
|
161
|
+
* // restore window if minimized
|
|
162
|
+
* await windows[0].openfinWindow.restore();
|
|
163
|
+
* ```
|
|
164
|
+
* @param page the attach page to a browser window.
|
|
165
|
+
*/
|
|
166
|
+
addPage(page: PageWithUpdatableRuntimeAttribs): Promise<void>;
|
|
167
|
+
/**
|
|
168
|
+
* Remove an attached page from the browser window.
|
|
169
|
+
*
|
|
170
|
+
* ```ts
|
|
171
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
172
|
+
*
|
|
173
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
174
|
+
* // assume a browser window already exists
|
|
175
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
176
|
+
* await windows[0].removePage('myPageId');
|
|
177
|
+
* ```
|
|
178
|
+
* @param id the id of the attached page to remove from the browser window.
|
|
179
|
+
*/
|
|
180
|
+
removePage(id: string): Promise<void>;
|
|
181
|
+
/**
|
|
182
|
+
* Update a page in which is attached to the browser window.
|
|
183
|
+
*
|
|
184
|
+
* ```ts
|
|
185
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
186
|
+
*
|
|
187
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
188
|
+
* const layout = {
|
|
189
|
+
* content: [
|
|
190
|
+
* {
|
|
191
|
+
* type: 'stack',
|
|
192
|
+
* content: [
|
|
193
|
+
* {
|
|
194
|
+
* type: 'component',
|
|
195
|
+
* componentName: 'view',
|
|
196
|
+
* componentState: {
|
|
197
|
+
* name: 'myViewName',
|
|
198
|
+
* url: 'http://google.com'
|
|
199
|
+
* }
|
|
200
|
+
* }
|
|
201
|
+
* ]
|
|
202
|
+
* }
|
|
203
|
+
* ]
|
|
204
|
+
* };
|
|
205
|
+
* const page = {
|
|
206
|
+
* title: 'myPageTitle',
|
|
207
|
+
* pageId: 'myPageId',
|
|
208
|
+
* layout
|
|
209
|
+
* };
|
|
210
|
+
* // assume a browser window already exists
|
|
211
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
212
|
+
* const req = {
|
|
213
|
+
* pageId: 'myPageId',
|
|
214
|
+
* page
|
|
215
|
+
* };
|
|
216
|
+
* await windows[0].updatePage(req);
|
|
217
|
+
* ```
|
|
218
|
+
* @param req the update request.
|
|
219
|
+
*/
|
|
220
|
+
updatePage(req: UpdateAttachedPageRequest): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* Reorder pages attached to the browser window.
|
|
223
|
+
*
|
|
224
|
+
* ```ts
|
|
225
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
226
|
+
*
|
|
227
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
228
|
+
* // assume a browser window already exists and has three pages in it
|
|
229
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
230
|
+
* await windows[0].reorderPages(['myPageId2', 'myPageId1', 'myPageId3']);
|
|
231
|
+
* ```
|
|
232
|
+
* @param req the reorder pages request.
|
|
233
|
+
*/
|
|
234
|
+
reorderPages(req: ReorderPagesRequest): Promise<void>;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Factory for wrapping browser windows and global operations.
|
|
238
|
+
*/
|
|
239
|
+
export interface BrowserWindowFactory {
|
|
240
|
+
/**
|
|
241
|
+
* Synchronously returns a Browser Window object that represents an existing window
|
|
242
|
+
*
|
|
243
|
+
* @param identity of the window
|
|
244
|
+
*/
|
|
245
|
+
wrapSync: (identity: OpenFin.Identity) => BrowserWindowModule;
|
|
246
|
+
/**
|
|
247
|
+
* Get a list of all pages that are attached to any running browser window.
|
|
248
|
+
*
|
|
249
|
+
* ```ts
|
|
250
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
251
|
+
*
|
|
252
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
253
|
+
* const attachedPages = await workspacePlatform.Browser.getAllAttachedPages();
|
|
254
|
+
* ```
|
|
255
|
+
*/
|
|
256
|
+
getAllAttachedPages(): Promise<AttachedPage[]>;
|
|
257
|
+
/**
|
|
258
|
+
* Get all the Browser Windows that are running in the Workspace Platform.
|
|
259
|
+
*
|
|
260
|
+
* ```ts
|
|
261
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
262
|
+
*
|
|
263
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
264
|
+
* const windows = await workspacePlatform.Browser.getAllWindows();
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
getAllWindows(): Promise<BrowserWindowModule[]>;
|
|
268
|
+
/**
|
|
269
|
+
* Create a new browser window.
|
|
270
|
+
*
|
|
271
|
+
* ```ts
|
|
272
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
273
|
+
*
|
|
274
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
275
|
+
* const layout = {
|
|
276
|
+
* content: [
|
|
277
|
+
* {
|
|
278
|
+
* type: 'stack',
|
|
279
|
+
* content: [
|
|
280
|
+
* {
|
|
281
|
+
* type: 'component',
|
|
282
|
+
* componentName: 'view',
|
|
283
|
+
* componentState: {
|
|
284
|
+
* name: 'myViewName',
|
|
285
|
+
* url: 'http://google.com'
|
|
286
|
+
* }
|
|
287
|
+
* }
|
|
288
|
+
* ]
|
|
289
|
+
* }
|
|
290
|
+
* ]
|
|
291
|
+
* };
|
|
292
|
+
* const page = {
|
|
293
|
+
* title: 'myPageTitle',
|
|
294
|
+
* pageId: 'myPageId',
|
|
295
|
+
* layout
|
|
296
|
+
* };
|
|
297
|
+
* const options: BrowserCreateWindowRequest = {
|
|
298
|
+
* workspacePlatform {
|
|
299
|
+
* pages: [page],
|
|
300
|
+
* title: 'My Window Title',
|
|
301
|
+
* favicon: 'https://google.com/favicon.ico'
|
|
302
|
+
* }
|
|
303
|
+
* };
|
|
304
|
+
* const window = await workspacePlatform.Browser.createWindow(options);
|
|
305
|
+
* ```
|
|
306
|
+
*
|
|
307
|
+
* @param options the browser window creation options
|
|
308
|
+
*/
|
|
309
|
+
createWindow(options: BrowserCreateWindowRequest): Promise<BrowserWindowModule>;
|
|
310
|
+
/**
|
|
311
|
+
* Get a unique title for a page.
|
|
312
|
+
*
|
|
313
|
+
* ```ts
|
|
314
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
315
|
+
*
|
|
316
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
317
|
+
* const uniqueTitle = await workspacePlatform.Browser.getUniquePageTitle('myTitle');
|
|
318
|
+
* ```
|
|
319
|
+
* @param title a prefix for the title.
|
|
320
|
+
*/
|
|
321
|
+
getUniquePageTitle(title?: string): Promise<string>;
|
|
322
|
+
/**
|
|
323
|
+
* Get the identity of the last focused Browser window.
|
|
324
|
+
*
|
|
325
|
+
* ```ts
|
|
326
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
327
|
+
*
|
|
328
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
329
|
+
* const windowIdentity = await workspacePlatform.Browser.getLastFocusedWindow();
|
|
330
|
+
* ```
|
|
331
|
+
*/
|
|
332
|
+
getLastFocusedWindow(): Promise<OpenFin.Identity>;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* API for interacting with persistent storage.
|
|
336
|
+
*/
|
|
337
|
+
export interface WorkspacePlatformStorage {
|
|
338
|
+
/**
|
|
339
|
+
* Get all pages that are saved in persistent storage.
|
|
340
|
+
*
|
|
341
|
+
* ```ts
|
|
342
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
343
|
+
*
|
|
344
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
345
|
+
* const pages = await workspacePlatform.Storage.getPages();
|
|
346
|
+
* ```
|
|
347
|
+
*/
|
|
348
|
+
getPages(): Promise<Page[]>;
|
|
349
|
+
/**
|
|
350
|
+
* Get a specific page in persistent storage.
|
|
351
|
+
*
|
|
352
|
+
* ```ts
|
|
353
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
354
|
+
*
|
|
355
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
356
|
+
* const myPage = await workspacePlatform.Storage.getPage('myPageId');
|
|
357
|
+
* ```
|
|
358
|
+
* @param id the id of the page to get.
|
|
359
|
+
*/
|
|
360
|
+
getPage(id: string): Promise<Page>;
|
|
361
|
+
/**
|
|
362
|
+
* Create a page in persistent storage.
|
|
363
|
+
*
|
|
364
|
+
* ```ts
|
|
365
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
366
|
+
*
|
|
367
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
368
|
+
* const layout = {
|
|
369
|
+
* content: [
|
|
370
|
+
* {
|
|
371
|
+
* type: 'stack',
|
|
372
|
+
* content: [
|
|
373
|
+
* {
|
|
374
|
+
* type: 'component',
|
|
375
|
+
* componentName: 'view',
|
|
376
|
+
* componentState: {
|
|
377
|
+
* name: 'myViewName',
|
|
378
|
+
* url: 'http://google.com'
|
|
379
|
+
* }
|
|
380
|
+
* }
|
|
381
|
+
* ]
|
|
382
|
+
* }
|
|
383
|
+
* ]
|
|
384
|
+
* };
|
|
385
|
+
* const page = {
|
|
386
|
+
* title: 'myPageTitle',
|
|
387
|
+
* pageId: 'myPageId',
|
|
388
|
+
* layout
|
|
389
|
+
* };
|
|
390
|
+
* await workspacePlatform.Storage.createPage({page});
|
|
391
|
+
* ```
|
|
392
|
+
* @param page the page to create in persistent storage.
|
|
393
|
+
*/
|
|
394
|
+
createPage(page: CreateSavedPageRequest): Promise<void>;
|
|
395
|
+
/**
|
|
396
|
+
* Update a page in persistent storage.
|
|
397
|
+
*
|
|
398
|
+
* ```ts
|
|
399
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
400
|
+
*
|
|
401
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
402
|
+
* const layout = {
|
|
403
|
+
* content: [
|
|
404
|
+
* {
|
|
405
|
+
* type: 'stack',
|
|
406
|
+
* content: [
|
|
407
|
+
* {
|
|
408
|
+
* type: 'component',
|
|
409
|
+
* componentName: 'view',
|
|
410
|
+
* componentState: {
|
|
411
|
+
* name: 'myViewName',
|
|
412
|
+
* url: 'http://google.com'
|
|
413
|
+
* }
|
|
414
|
+
* }
|
|
415
|
+
* ]
|
|
416
|
+
* }
|
|
417
|
+
* ]
|
|
418
|
+
* };
|
|
419
|
+
* const page = {
|
|
420
|
+
* title: 'myPageTitle',
|
|
421
|
+
* pageId: 'myPageId',
|
|
422
|
+
* layout
|
|
423
|
+
* };
|
|
424
|
+
* const req = {
|
|
425
|
+
* pageId: 'myPageId',
|
|
426
|
+
* page
|
|
427
|
+
* };
|
|
428
|
+
* await workspacePlatform.Storage.updatePage(req);
|
|
429
|
+
* ```
|
|
430
|
+
* @param req the update saved page request.
|
|
431
|
+
*/
|
|
432
|
+
updatePage(req: UpdateSavedPageRequest): Promise<void>;
|
|
433
|
+
/**
|
|
434
|
+
* Delete a page from persistent storage.
|
|
435
|
+
*
|
|
436
|
+
* ```ts
|
|
437
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
438
|
+
*
|
|
439
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
440
|
+
* await workspacePlatform.Storage.deletePage('myPageId');
|
|
441
|
+
* ```
|
|
442
|
+
* @param id the id of the page to delete.
|
|
443
|
+
*/
|
|
444
|
+
deletePage(id: string): Promise<void>;
|
|
445
|
+
/**
|
|
446
|
+
* Save a page in persistent storage.
|
|
447
|
+
*
|
|
448
|
+
* This is a helper function that will call `getPage` to determine if a page is already in storage.
|
|
449
|
+
* If the page is already in storage, it will call `updatePage`.
|
|
450
|
+
* If it does not exist in storage, the function will call `createPage` instead.
|
|
451
|
+
*
|
|
452
|
+
* ```ts
|
|
453
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
454
|
+
*
|
|
455
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
456
|
+
* const layout = {
|
|
457
|
+
* content: [
|
|
458
|
+
* {
|
|
459
|
+
* type: 'stack',
|
|
460
|
+
* content: [
|
|
461
|
+
* {
|
|
462
|
+
* type: 'component',
|
|
463
|
+
* componentName: 'view',
|
|
464
|
+
* componentState: {
|
|
465
|
+
* name: 'myViewName',
|
|
466
|
+
* url: 'http://google.com'
|
|
467
|
+
* }
|
|
468
|
+
* }
|
|
469
|
+
* ]
|
|
470
|
+
* }
|
|
471
|
+
* ]
|
|
472
|
+
* };
|
|
473
|
+
* const page = {
|
|
474
|
+
* title: 'myPageTitle',
|
|
475
|
+
* pageId: 'myPageId',
|
|
476
|
+
* layout
|
|
477
|
+
* };
|
|
478
|
+
* await workspacePlatform.Storage.savePage(page);
|
|
479
|
+
* ```
|
|
480
|
+
* @param page the page to save.
|
|
481
|
+
*/
|
|
482
|
+
savePage(page: Page): Promise<void>;
|
|
483
|
+
}
|
|
484
|
+
/**
|
|
485
|
+
* Request for launching an application.
|
|
486
|
+
*/
|
|
487
|
+
export interface LaunchAppRequest {
|
|
488
|
+
target?: OpenFin.EntityInfo;
|
|
489
|
+
app: App;
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Get Themes from API
|
|
493
|
+
*/
|
|
494
|
+
export interface ThemeApi {
|
|
495
|
+
getThemes(): Promise<CustomThemes>;
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Controller for a Workspace Platform.
|
|
499
|
+
*/
|
|
500
|
+
export interface WorkspacePlatformModule extends OpenFin.Platform {
|
|
501
|
+
/**
|
|
502
|
+
* Launch a browser snapshot that contains windows with pages.
|
|
503
|
+
*
|
|
504
|
+
* @param snapshot the browser snapshot to launch or a url or filepath to retrieve a JSON snapshot.
|
|
505
|
+
*/
|
|
506
|
+
applySnapshot(snapshot: BrowserSnapshot | string): Promise<OpenFin.Platform>;
|
|
507
|
+
/**
|
|
508
|
+
* Get a snapshot that contains browser windows with pages.
|
|
509
|
+
*/
|
|
510
|
+
getSnapshot(): Promise<BrowserSnapshot>;
|
|
511
|
+
/**
|
|
512
|
+
* Launch an application.
|
|
513
|
+
* ```ts
|
|
514
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
515
|
+
*
|
|
516
|
+
* const workspacePlatform = WorkspacePlatform.getCurrentSync();
|
|
517
|
+
* const req = {
|
|
518
|
+
* app: {
|
|
519
|
+
* appId: 'myAppId',
|
|
520
|
+
* title: 'appTitle',
|
|
521
|
+
* manifest: 'http://localhost/app.json',
|
|
522
|
+
* manifestType: AppManifestType.Manifest,
|
|
523
|
+
* icons:[
|
|
524
|
+
* {
|
|
525
|
+
* icon: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
|
|
526
|
+
* src: "https://cdn.openfin.co/demos/notifications/generator/images/icon-blue.png",
|
|
527
|
+
* type: "ico",
|
|
528
|
+
* },
|
|
529
|
+
* ]
|
|
530
|
+
* }
|
|
531
|
+
* }
|
|
532
|
+
* workspacePlatform.launchApp(req);
|
|
533
|
+
*
|
|
534
|
+
* ```
|
|
535
|
+
* @param req the launch app request.
|
|
536
|
+
*/
|
|
537
|
+
launchApp(req: LaunchAppRequest): Promise<void>;
|
|
538
|
+
/**
|
|
539
|
+
* The browser window factory for the Workspace Platform.
|
|
540
|
+
*/
|
|
541
|
+
Browser: BrowserWindowFactory;
|
|
542
|
+
/**
|
|
543
|
+
* The storage API for the Workspace Platform.
|
|
544
|
+
*/
|
|
545
|
+
Storage: WorkspacePlatformStorage;
|
|
546
|
+
/**
|
|
547
|
+
* Theme API for the Workspace Platform.
|
|
548
|
+
*/
|
|
549
|
+
Theme: ThemeApi;
|
|
550
|
+
}
|
|
551
|
+
export interface WorkspacePlatformProvider extends OpenFin.PlatformProvider {
|
|
552
|
+
/**
|
|
553
|
+
* Implementation for getting a list of saved pages from persistent storage.
|
|
554
|
+
* @param query an optional query.
|
|
555
|
+
*/
|
|
556
|
+
getSavedPages(query?: string): Promise<Page[]>;
|
|
557
|
+
/**
|
|
558
|
+
* Implementation for getting a single page in persistent storage.
|
|
559
|
+
* @param id
|
|
560
|
+
*/
|
|
561
|
+
getSavedPage(id: string): Promise<Page>;
|
|
562
|
+
/**
|
|
563
|
+
* Implementation for creating a saved page in persistent storage.
|
|
564
|
+
* @param req the create saved page request.
|
|
565
|
+
*/
|
|
566
|
+
createSavedPage(req: CreateSavedPageRequest): Promise<void>;
|
|
567
|
+
/**
|
|
568
|
+
* Implementation for updating a saved page in persistent storage.
|
|
569
|
+
* @param req the update saved page request.
|
|
570
|
+
*/
|
|
571
|
+
updateSavedPage(req: UpdateSavedPageRequest): Promise<void>;
|
|
572
|
+
/**
|
|
573
|
+
* Implementation for deleting a saved page in persistent storage.
|
|
574
|
+
* @param id of the id of the page to delete.
|
|
575
|
+
*/
|
|
576
|
+
deleteSavedPage(id: string): Promise<void>;
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Configuration for initializing a Workspace platform.
|
|
580
|
+
*/
|
|
581
|
+
export interface WorkspacePlatformInitConfig {
|
|
582
|
+
/** Config for overriding browser options and behavior. */
|
|
583
|
+
browser?: BrowserInitConfig;
|
|
584
|
+
/** Custom Themes object
|
|
585
|
+
*
|
|
586
|
+
* ```ts
|
|
587
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
588
|
+
*
|
|
589
|
+
* // This is the palette used to create the OpenFin dark theme
|
|
590
|
+
* const customPalette: WorkspacePlatform.CustomPaletteSet = {
|
|
591
|
+
* brandPrimary: '#504CFF',
|
|
592
|
+
* brandSecondary: '#383A40',
|
|
593
|
+
* backgroundPrimary: '#000',
|
|
594
|
+
* background1: '#111214',
|
|
595
|
+
* background2: '#1E1F23',
|
|
596
|
+
* background3: '#24262B',
|
|
597
|
+
* background4: '#2F3136',
|
|
598
|
+
* background5: '#383A40',
|
|
599
|
+
* background6: '#53565F',
|
|
600
|
+
* statusSuccess: '#35C759',
|
|
601
|
+
* statusWarning: '#C93400',
|
|
602
|
+
* statusCritical: '#000',
|
|
603
|
+
* statusActive: '#0879C4',
|
|
604
|
+
* inputBackground: '#53565F',
|
|
605
|
+
* inputColor: '#FFFFFF',
|
|
606
|
+
* inputPlaceholder: '#C9CBD2',
|
|
607
|
+
* inputDisabled: '#7D808A',
|
|
608
|
+
* inputFocused: '#C9CBD2',
|
|
609
|
+
* textDefault: '#FFFFFF',
|
|
610
|
+
* textHelp: '#C9CBD2',
|
|
611
|
+
* textInactive: '#7D808A',
|
|
612
|
+
* };
|
|
613
|
+
*
|
|
614
|
+
* const customTheme: WorkspacePlatform.CustomThemes = [{
|
|
615
|
+
* label: "My Custom Theme",
|
|
616
|
+
* palette: customPalette
|
|
617
|
+
* }];
|
|
618
|
+
*
|
|
619
|
+
* await WorkspacePlatform.init({
|
|
620
|
+
* browser: { overrideCallback },
|
|
621
|
+
* theme: customThemes
|
|
622
|
+
* });
|
|
623
|
+
*/
|
|
624
|
+
theme?: CustomThemes;
|
|
625
|
+
}
|
|
626
|
+
/**
|
|
627
|
+
* Extend or replace default functionality in order to customize behavior of a Workspace Platform Provider.
|
|
628
|
+
*
|
|
629
|
+
* To implement your own handlers for Workspace Platform behavior, extend the provided class and override any methods you'd like to alter.
|
|
630
|
+
*
|
|
631
|
+
* ```ts
|
|
632
|
+
* import * as WorkspacePlatform from '@openfin/workspace-platform';
|
|
633
|
+
* import { UpdateSavedPageRequest } from '../../client-api-platform/src/shapes';
|
|
634
|
+
*
|
|
635
|
+
* const overrideCallback: WorkspacePlatform.BrowserOverrideCallback = async (
|
|
636
|
+
* WorkspacePlatformProvider
|
|
637
|
+
* ) => {
|
|
638
|
+
* class Override extends WorkspacePlatformProvider {
|
|
639
|
+
* updateSavedPage = async (req: UpdateSavedPageRequest): Promise<void> => {
|
|
640
|
+
* console.log(`saving page ${req.page.pageId}`);
|
|
641
|
+
* // calling custom function to the save page here
|
|
642
|
+
* };
|
|
643
|
+
* }
|
|
644
|
+
* return new Override();
|
|
645
|
+
* };
|
|
646
|
+
*
|
|
647
|
+
* await WorkspacePlatform.init({
|
|
648
|
+
* browser: { overrideCallback },
|
|
649
|
+
* });
|
|
650
|
+
*/
|
|
651
|
+
export declare type BrowserOverrideCallback = OpenFin.OverrideCallback<WorkspacePlatformProvider>;
|
|
652
|
+
/**
|
|
653
|
+
* Configuration for initializing a Browser.
|
|
654
|
+
*/
|
|
655
|
+
export interface BrowserInitConfig {
|
|
656
|
+
/**
|
|
657
|
+
* Default options for creating a new browser window. Any option not included in WorkspacePlatform.getCurrentSync().Browser.createWindow(options) call will default to the value provided in this field.
|
|
658
|
+
*/
|
|
659
|
+
defaultWindowOptions?: BrowserCreateWindowRequest;
|
|
660
|
+
/**
|
|
661
|
+
* The default options when creating a new browser window. Any option not included in WorkspacePlatform.getCurrentSync().Browser.createView(options) call will default to the value provided in this field.
|
|
662
|
+
*/
|
|
663
|
+
defaultViewOptions?: OpenFin.ViewOptions;
|
|
664
|
+
/**
|
|
665
|
+
* Override workspace platform behavior
|
|
666
|
+
*/
|
|
667
|
+
overrideCallback?: BrowserOverrideCallback;
|
|
668
|
+
/**
|
|
669
|
+
* Override workspace platform interop behavior
|
|
670
|
+
* https://cdn.openfin.co/docs/javascript/stable/InteropBroker.html
|
|
671
|
+
*/
|
|
672
|
+
interopOverride?: OpenFin.OverrideCallback<InteropBroker, InteropBroker>;
|
|
673
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|