@interopio/browser-platform 3.0.1

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.
Files changed (97) hide show
  1. package/browser.platform.d.ts +455 -0
  2. package/changelog.md +69 -0
  3. package/dist/browser.platform.es.js +46074 -0
  4. package/dist/browser.platform.es.js.map +1 -0
  5. package/dist/browser.platform.umd.js +46082 -0
  6. package/dist/browser.platform.umd.js.map +1 -0
  7. package/license.md +21 -0
  8. package/package.json +78 -0
  9. package/readme.md +9 -0
  10. package/rollup.config.js +45 -0
  11. package/src/common/constants.ts +46 -0
  12. package/src/common/defaultConfig.ts +56 -0
  13. package/src/common/gateway.d.ts +32 -0
  14. package/src/common/types.ts +222 -0
  15. package/src/connection/gateway.ts +132 -0
  16. package/src/connection/no-gateway.ts +1 -0
  17. package/src/connection/portsBridge.ts +441 -0
  18. package/src/connection/preferred.ts +247 -0
  19. package/src/controllers/domains.ts +156 -0
  20. package/src/controllers/glue.ts +604 -0
  21. package/src/controllers/interception.ts +53 -0
  22. package/src/controllers/license.ts +50 -0
  23. package/src/controllers/main.ts +256 -0
  24. package/src/controllers/plugins.ts +121 -0
  25. package/src/controllers/serviceWorker.ts +193 -0
  26. package/src/controllers/state.ts +84 -0
  27. package/src/controllers/system.ts +99 -0
  28. package/src/controllers/transactions.ts +80 -0
  29. package/src/factory.ts +40 -0
  30. package/src/fallbacks/browser.ts +47 -0
  31. package/src/fallbacks/dekstop.ts +21 -0
  32. package/src/index.ts +18 -0
  33. package/src/libs/applications/appStore/directory.ts +235 -0
  34. package/src/libs/applications/appStore/remoteWatcher.ts +112 -0
  35. package/src/libs/applications/controller.ts +469 -0
  36. package/src/libs/applications/decoders.ts +98 -0
  37. package/src/libs/applications/defaults.ts +6 -0
  38. package/src/libs/applications/types.ts +98 -0
  39. package/src/libs/channels/controller.ts +109 -0
  40. package/src/libs/channels/decoders.ts +19 -0
  41. package/src/libs/extension/controller.ts +120 -0
  42. package/src/libs/extension/decoders.ts +18 -0
  43. package/src/libs/extension/types.ts +11 -0
  44. package/src/libs/intents/constants.ts +9 -0
  45. package/src/libs/intents/controller.ts +500 -0
  46. package/src/libs/intents/decoders.ts +96 -0
  47. package/src/libs/intents/resolverHelper.ts +264 -0
  48. package/src/libs/intents/types.ts +119 -0
  49. package/src/libs/layouts/constants.ts +3 -0
  50. package/src/libs/layouts/controller.ts +476 -0
  51. package/src/libs/layouts/decoders.ts +132 -0
  52. package/src/libs/layouts/global/builder.ts +400 -0
  53. package/src/libs/layouts/global/resetter.ts +116 -0
  54. package/src/libs/layouts/global/restorer.ts +217 -0
  55. package/src/libs/layouts/global/validator.ts +169 -0
  56. package/src/libs/layouts/idbStore.ts +63 -0
  57. package/src/libs/layouts/types.ts +133 -0
  58. package/src/libs/manager/controller.ts +175 -0
  59. package/src/libs/manager/decoders.ts +6 -0
  60. package/src/libs/manager/defaults.ts +5 -0
  61. package/src/libs/manager/identity.ts +92 -0
  62. package/src/libs/manager/session.ts +195 -0
  63. package/src/libs/manager/types.ts +51 -0
  64. package/src/libs/notifications/controller.ts +447 -0
  65. package/src/libs/notifications/decoders.ts +166 -0
  66. package/src/libs/notifications/types.ts +49 -0
  67. package/src/libs/notifications/utils.ts +7 -0
  68. package/src/libs/search/controller.ts +232 -0
  69. package/src/libs/search/decoders.ts +6 -0
  70. package/src/libs/search/repositories/applications.ts +62 -0
  71. package/src/libs/search/repositories/layouts.ts +48 -0
  72. package/src/libs/search/repositories/workspaces.ts +47 -0
  73. package/src/libs/search/types.ts +9 -0
  74. package/src/libs/themes/constants.ts +9 -0
  75. package/src/libs/themes/controller.ts +153 -0
  76. package/src/libs/themes/decoders.ts +28 -0
  77. package/src/libs/themes/types.ts +28 -0
  78. package/src/libs/windows/controller.ts +498 -0
  79. package/src/libs/windows/decoders.ts +64 -0
  80. package/src/libs/windows/types.ts +59 -0
  81. package/src/libs/workspaces/controller.ts +922 -0
  82. package/src/libs/workspaces/decoders.ts +868 -0
  83. package/src/libs/workspaces/defaultConfig.ts +11 -0
  84. package/src/libs/workspaces/frames.ts +239 -0
  85. package/src/libs/workspaces/hibernationWatcher.ts +231 -0
  86. package/src/libs/workspaces/types.ts +506 -0
  87. package/src/platform.ts +156 -0
  88. package/src/shared/decoders.ts +479 -0
  89. package/src/shared/fetchTimeout.ts +25 -0
  90. package/src/shared/ioc.ts +580 -0
  91. package/src/shared/logger.ts +19 -0
  92. package/src/shared/promisePlus.ts +62 -0
  93. package/src/shared/sequelizer.ts +48 -0
  94. package/src/shared/utils.ts +86 -0
  95. package/src/storage/local.ts +111 -0
  96. package/src/storage/session.ts +436 -0
  97. package/tsconfig.json +16 -0
@@ -0,0 +1,455 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { IOConnectCore } from "@interopio/core";
3
+ import { IOConnectBrowser } from "@interopio/browser";
4
+ import { Glue42 } from "@glue42/desktop";
5
+
6
+ export namespace IOConnectBrowserPlatform {
7
+
8
+ export type LibDomains = "system" | "windows" | "appManager" | "layouts" | "workspaces" | "intents" | "channels" | "notifications" | "extension" | "search" | "themes" | "manager";
9
+
10
+ export interface RemoteStore {
11
+ /**
12
+ * The url of the remote source of application definitions. The remote source needs to follow the [FDC3 AppDirectory standard](https://github.com/finos/FDC3). The applications provided by the remote need to either be IOConnectApplicationConfig or FDC3ApplicationConfig.
13
+ */
14
+ url: string;
15
+
16
+ /**
17
+ * The polling interval for fetching from the remote source. If no pollingInterval is provided, the platform will fetch the definitions just once during startup.
18
+ */
19
+ pollingInterval?: number;
20
+
21
+ /**
22
+ * The request timeout for fetching application definitions from the remote source in milliseconds.
23
+ * @default 3000
24
+ */
25
+ requestTimeout?: number;
26
+
27
+ /**
28
+ * Name-value pairs of headers, which will be appended to every request to the provided url.
29
+ */
30
+ customHeaders?: {
31
+ [key: string]: string;
32
+ };
33
+ }
34
+
35
+ export interface Supplier<T> {
36
+ fetch(): Promise<T>;
37
+ save?(elements: T): Promise<void>;
38
+ delete?(elements: T): Promise<void>;
39
+ timeout?: number;
40
+ pollingInterval?: number;
41
+ }
42
+
43
+ export namespace Applications {
44
+
45
+ export interface FDC3Definition {
46
+ /**
47
+ * Application name. Should be unique.
48
+ */
49
+ name: string;
50
+
51
+ /**
52
+ * The title of the application. Sets the window's title.
53
+ */
54
+ title?: string;
55
+
56
+ /**
57
+ * Application version.
58
+ */
59
+ version?: string;
60
+
61
+ /**
62
+ * The unique application identifier located within a specific application directory instance.
63
+ */
64
+ appId: string;
65
+
66
+ /**
67
+ * URI or full JSON of the application manifest providing all details related to launch and use requirements as described by the vendor.
68
+ * The format of this manifest is vendor specific, but can be identified by the manifestType attribute.
69
+ */
70
+ manifest: string;
71
+
72
+ /**
73
+ * The manifest type which relates to the format and structure of the manifest content. The definition is based on the vendor specific format and definition outside of this specification.
74
+ */
75
+ manifestType: string;
76
+
77
+ /**
78
+ * Optional tooltip description e.g. for a launcher.
79
+ */
80
+ tooltip?: string;
81
+
82
+ /**
83
+ * Description of the application.This will typically be a 1 - 2 paragraph style blurb about the application.Allow mark up language.
84
+ */
85
+ description?: string;
86
+
87
+ /**
88
+ * Optional e - mail to receive queries about the application.
89
+ */
90
+ contactEmail?: string;
91
+
92
+ /**
93
+ * Optional e - mail to receive support requests for the application.
94
+ */
95
+ supportEmail?: string;
96
+
97
+ /**
98
+ * The name of the company that owns the application.The publisher has control over their namespace / app / signature.
99
+ */
100
+ publisher?: string;
101
+
102
+ /**
103
+ * Array of images to show the user when they are looking at app description.Each image can have an optional description / tooltip.
104
+ */
105
+ images?: Image[];
106
+
107
+ /**
108
+ * Holds Icons used for the application, a Launcher may be able to use multiple Icon sizes or there may be a 'button' Icon.
109
+ */
110
+ icons?: Icon[];
111
+
112
+ /**
113
+ * An optional set of name value pairs that can be used to deliver custom data from an App Directory to a launcher.
114
+ */
115
+ customConfig?: PropertiesObject;
116
+
117
+ /**
118
+ * The list of intents implemented by the Application
119
+ */
120
+ intents?: Intent[];
121
+ }
122
+
123
+ /** App Image holder */
124
+ export interface Image {
125
+ /**
126
+ * App Image URL.
127
+ */
128
+ url?: string;
129
+ }
130
+
131
+ /** Icon holder */
132
+ export interface Icon {
133
+ /**
134
+ * Icon URL.
135
+ */
136
+ icon?: string;
137
+ }
138
+
139
+ /**
140
+ * An intent definition.
141
+ */
142
+ export interface Intent {
143
+ /**
144
+ * The name of the intent to 'launch'. In this case the name of an Intent supported by an Application.
145
+ */
146
+ name: string;
147
+
148
+ /**
149
+ * An optional display name for the intent that may be used in UI instead of the name.
150
+ */
151
+ displayName?: string;
152
+
153
+ /**
154
+ * A comma separated list of the types of contexts the intent offered by the application can process, here the first part of the context type is the namespace e.g."fdc3.contact, org.symphony.contact".
155
+ */
156
+ contexts?: string[];
157
+
158
+ /**
159
+ * Custom configuration for the intent that may be required for a particular desktop agent.
160
+ */
161
+ customConfig?: object;
162
+
163
+ /**
164
+ * Result type may be a type name, the string "channel" (which indicates that the app will return a channel) or a string indicating a channel that returns a specific type, e.g. "channel<fdc3.instrument>"
165
+ */
166
+
167
+ resultType?: string;
168
+ }
169
+
170
+ /** Generic object for passing properties, settings, etc., in the for of key/value pairs. */
171
+ export interface PropertiesObject {
172
+ [key: string]: unknown;
173
+ }
174
+
175
+ export interface Config {
176
+ local?: Array<IOConnectBrowser.AppManager.Definition | FDC3Definition>;
177
+ remote?: RemoteStore;
178
+ }
179
+ }
180
+
181
+ export namespace Layouts {
182
+ export interface Config {
183
+ mode?: "idb" | "session";
184
+ local?: IOConnectBrowser.Layouts.Layout[];
185
+ }
186
+ }
187
+
188
+ export namespace Channels {
189
+ export interface ChannelMeta {
190
+ color: string;
191
+ [key: string]: any;
192
+ }
193
+
194
+ export interface ChannelDefinition {
195
+ name: string;
196
+ meta: ChannelMeta;
197
+ data?: any;
198
+ }
199
+
200
+ export interface Config {
201
+ definitions: ChannelDefinition[];
202
+ }
203
+ }
204
+
205
+ export namespace ServiceWorker {
206
+ export interface Config {
207
+ url?: string;
208
+ registrationPromise?: Promise<ServiceWorkerRegistration>;
209
+ }
210
+ }
211
+
212
+ export namespace Plugins {
213
+
214
+ export interface InterceptorRegistrationRequest {
215
+ callInterceptor: (config: ControlMessage) => Promise<any>;
216
+ interceptions: Array<{ domain: LibDomains, operation: string }>;
217
+ }
218
+
219
+ export interface BaseControlMessage {
220
+ domain: LibDomains;
221
+ operation: string;
222
+ data: any;
223
+ settings?: ControlSettings;
224
+ }
225
+
226
+ export interface ControlSettings {
227
+ skipInterception?: boolean;
228
+ }
229
+
230
+ export interface PluginInterception {
231
+ register: (request: InterceptorRegistrationRequest) => Promise<void>
232
+ }
233
+
234
+ export interface PlatformControls {
235
+ control: (args: BaseControlMessage) => Promise<any>;
236
+ interception: PluginInterception;
237
+ platformApi: API;
238
+ logger?: IOConnectBrowser.Logger.API;
239
+ system: {
240
+ sendControl: (args: BaseControlMessage) => Promise<any>;
241
+ }
242
+ }
243
+
244
+ export interface PluginDefinition {
245
+ name: string;
246
+ start: (io: IOConnectBrowser.API, config: any, platform: PlatformControls) => Promise<void> | void;
247
+ version?: string;
248
+ config?: any;
249
+ critical?: boolean;
250
+ stop?: () => void;
251
+ }
252
+
253
+ export interface Config {
254
+ definitions: PluginDefinition[];
255
+ }
256
+ }
257
+
258
+ export namespace Gateway {
259
+
260
+ export type LogLevel = "trace" | "debug" | "info" | "warn" | "error";
261
+
262
+ export type LogAppender = (logInfo: LogInfo) => void;
263
+
264
+ export interface LogInfo {
265
+ time: Date;
266
+ output: string;
267
+ level: string;
268
+ line: number;
269
+ message: string;
270
+ namespace: string;
271
+ stacktrace: string;
272
+ }
273
+
274
+ export interface Config {
275
+ logging?: {
276
+ level?: LogLevel;
277
+ appender?: LogAppender;
278
+ };
279
+ clients?: {
280
+ buffer_size?: number
281
+ }
282
+ }
283
+ }
284
+
285
+ export namespace Connection {
286
+
287
+ export interface PreferredConnectionSettings {
288
+ url: string;
289
+ auth?: IOConnectCore.Auth;
290
+ forceIncompleteSwitch?: boolean;
291
+ discoveryIntervalMS?: number;
292
+ }
293
+
294
+ export interface Config {
295
+ preferred?: PreferredConnectionSettings;
296
+ enableManualSwitching?: boolean;
297
+ }
298
+ }
299
+
300
+ export namespace Workspaces {
301
+ export interface MaximumActiveWorkspacesRule {
302
+ threshold: number;
303
+ }
304
+
305
+ export interface IdleWorkspacesRule {
306
+ idleMSThreshold: number;
307
+ }
308
+
309
+ export interface HibernationConfig {
310
+ maximumActiveWorkspaces?: MaximumActiveWorkspacesRule;
311
+ idleWorkspaces?: IdleWorkspacesRule;
312
+ }
313
+
314
+ export interface LoadingConfig {
315
+ /**
316
+ * Default restore strategy when opening Workspaces.
317
+ */
318
+ defaultStrategy?: "direct" | "delayed" | "lazy";
319
+ delayed?: {
320
+ /**
321
+ * Valid only in `delayed` mode. Initial period after which to start loading applications in batches. Defaults to 1000.
322
+ */
323
+ initialOffsetInterval?: number;
324
+ /**
325
+ * Valid only in `delayed` mode. Interval in minutes at which to load the application batches. Defaults to 5000.
326
+ */
327
+ interval?: number;
328
+ /**
329
+ * Valid only in `delayed` mode. Number of applications in a batch to be loaded at each interval. Defaults to 1.
330
+ */
331
+ batch?: number;
332
+ };
333
+ /**
334
+ * Visual indicator `Zzz` on tabs of apps which are not loaded yet. Useful for developing and testing purposes.
335
+ */
336
+ showDelayedIndicator?: boolean;
337
+ }
338
+
339
+ export interface Config {
340
+ src: string;
341
+ hibernation?: HibernationConfig;
342
+ loadingStrategy?: LoadingConfig;
343
+ isFrame?: boolean;
344
+ initAsEmpty?: boolean;
345
+ frameCache?: boolean;
346
+ }
347
+ }
348
+
349
+ export namespace Windows {
350
+ export interface Config {
351
+ windowResponseTimeoutMs?: number;
352
+ defaultWindowOpenBounds?: IOConnectBrowser.Windows.Bounds;
353
+ }
354
+ }
355
+
356
+ export namespace Notifications {
357
+ export interface Config {
358
+ enable?: boolean;
359
+ enableToasts?: boolean;
360
+ clearNotificationOnClick?: boolean;
361
+ }
362
+ }
363
+
364
+ export namespace Manager {
365
+ export interface AuthConfig {
366
+ basic?: {
367
+ username: string;
368
+ password: string;
369
+ };
370
+ username?: string;
371
+ token?: {
372
+ bearer?: string;
373
+ };
374
+ includeCredentials?: boolean;
375
+ }
376
+
377
+ export interface Config {
378
+ url: string;
379
+ auth: AuthConfig;
380
+ critical?: boolean;
381
+ headers?: {
382
+ [key: string]: string;
383
+ };
384
+ fetchIntervalMS?: number;
385
+ tokenRefreshIntervalMS?: number;
386
+ }
387
+ }
388
+
389
+ export namespace Themes {
390
+ export interface Config {
391
+ defaultTheme?: "os" | "light" | "dark"
392
+ }
393
+ }
394
+
395
+ export namespace User {
396
+ export interface Config {
397
+ username: string;
398
+ }
399
+ }
400
+
401
+ export interface ControlMessage extends Plugins.BaseControlMessage {
402
+ callerType: "plugin" | "client";
403
+ callerId: string;
404
+ commandId: string;
405
+ }
406
+
407
+ export interface Config {
408
+ licenseKey: string;
409
+ clientOnly?: boolean;
410
+ windows?: Windows.Config;
411
+ notifications?: Notifications.Config;
412
+ applications?: Applications.Config;
413
+ layouts?: Layouts.Config;
414
+ channels?: Channels.Config;
415
+ plugins?: Plugins.Config;
416
+ serviceWorker?: ServiceWorker.Config;
417
+ gateway?: Gateway.Config;
418
+ connection?: Connection.Config;
419
+ browser?: IOConnectBrowser.Config;
420
+ workspaces?: Workspaces.Config;
421
+ manager?: Manager.Config;
422
+ themes?: Themes.Config;
423
+ user?: User.Config;
424
+ environment?: any;
425
+ browserFactory?: (config?: IOConnectBrowser.Config) => Promise<IOConnectBrowser.API>;
426
+ }
427
+
428
+ export interface API {
429
+ version: string;
430
+ corePlus?: { version: string };
431
+ system: {
432
+ shutdown(): Promise<void>
433
+ }
434
+ }
435
+
436
+ export interface SystemInfo {
437
+ web: {
438
+ version: string;
439
+ };
440
+ platform: {
441
+ version: string;
442
+ plugins: Array<{ name: string, version: string }>;
443
+ };
444
+ workspaces?: {
445
+ version: string;
446
+ frameUrl?: string;
447
+ };
448
+ }
449
+ }
450
+
451
+ export type IOConnectBrowserPlatformFactoryFunction = (config: IOConnectBrowserPlatform.Config) => Promise<{ io: IOConnectBrowser.API | Glue42.Glue; platform?: IOConnectBrowserPlatform.API }>;
452
+
453
+ declare const IOConnectBrowserPlatformFactory: IOConnectBrowserPlatformFactoryFunction;
454
+
455
+ export default IOConnectBrowserPlatformFactory;
package/changelog.md ADDED
@@ -0,0 +1,69 @@
1
+ 3.0.0
2
+ feat: Introduce the new IO Connect Browser Platform
3
+ 1.8.1
4
+ chore: bump due to core@5.12.0
5
+ 1.8.0
6
+ feat: added getDefaultGlobal, setDefaultGlobal and clearDefaultGlobal methods to the Layouts API
7
+ feat: now sets default notification timestamp if no timestamp provided to notifications.raise(). Desired web package ^2.24.0.
8
+ 1.7.2
9
+ fix: added missing core-plus type aliases
10
+ 1.7.1
11
+ fix: fixed config breaking change
12
+ 1.7.0
13
+ feat: unified with the Glue42 Core web platform
14
+ 1.6.2
15
+ chore: web-platform update to 1.27.2
16
+ 1.6.1
17
+ chore: updated the web-platform with exposed gw switching
18
+ 1.6.0
19
+ chore: updated all glue42 deps, including the switch in core to lodash cloneDeep
20
+ 1.5.7
21
+ chore: handles the case where the server responds with layouts definitions, which are not a string
22
+ 1.5.6
23
+ chore: improved error logging when importing layouts from the server
24
+ 1.5.5
25
+ fix: updated the platform config decoder
26
+ 1.5.4
27
+ chore: updated all glue42 deps
28
+ 1.5.3
29
+ chore: updated all glue42 deps
30
+ 1.5.2
31
+ chore: updated all glue42 deps
32
+ 1.5.1
33
+ chore: updated all glue42 deps
34
+ 1.5.0
35
+ chore: updated all glue42 deps to support recursive discovery of gw
36
+ 1.4.0
37
+ feat: added shutdown feature
38
+ 1.3.1
39
+ fix: added support for query limits
40
+ 1.3.0
41
+ feat: added Search API and the platform is now a provider for applications, layouts and workspaces
42
+ 1.2.1
43
+ chore: update @glue42/web@2.16.0 and @glue42/web-platform@1.22.0 to include extended Notifications API
44
+ 1.2.0
45
+ feat: added Themes API
46
+ 1.1.2
47
+ chore: updated all glue dependencies
48
+ 1.1.1
49
+ fix: updated to platform 1.19.1
50
+ 1.1.0
51
+ fix: enabled proper behavior of global layouts when the platform is a workspace frame
52
+ 1.0.11
53
+ chore: updated glue42 libs to platform 1.18.3 and web 2.11.3 - fixes the build issue in react projects
54
+ 1.0.10
55
+ chore: updated glue42 libs to platform 1.18.2 and web 2.11.2
56
+ 1.0.9
57
+ chore: updated glue42 libs to platform 1.18 and web 2.11
58
+ 1.0.6
59
+ fix: the license information is now being printed correctly
60
+ 1.0.5
61
+ chore: added the newest Glue42 packages with support for correct raising of intents
62
+ 1.0.4
63
+ fix: fixed an issue with importing layouts received from Glue42 server
64
+ 1.0.3
65
+ chore: improved the error message when the license key is not valid
66
+ 1.0.2
67
+ fix: improved the error message when an empty string is given as a license key
68
+ 1.0.1
69
+ feat: initial release