@interopio/workspaces-api 3.2.1 → 3.2.3

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 (40) hide show
  1. package/dist/workspaces.es.js +4295 -4648
  2. package/dist/workspaces.es.js.map +1 -1
  3. package/dist/workspaces.umd.js +5206 -5559
  4. package/dist/workspaces.umd.js.map +1 -1
  5. package/dist/workspaces.umd.min.js +1 -1
  6. package/package.json +36 -50
  7. package/workspaces.d.ts +8 -0
  8. package/rollup.config.js +0 -54
  9. package/src/builders/baseBuilder.ts +0 -50
  10. package/src/builders/parentBuilder.ts +0 -62
  11. package/src/builders/workspaceBuilder.ts +0 -102
  12. package/src/communication/bridge.ts +0 -263
  13. package/src/communication/constants.ts +0 -202
  14. package/src/communication/interop-transport.ts +0 -175
  15. package/src/controllers/base.ts +0 -487
  16. package/src/controllers/main.ts +0 -541
  17. package/src/controllers/shortcuts.ts +0 -28
  18. package/src/index.ts +0 -23
  19. package/src/main.ts +0 -415
  20. package/src/models/base/base.ts +0 -397
  21. package/src/models/column.ts +0 -187
  22. package/src/models/frame.ts +0 -368
  23. package/src/models/group.ts +0 -237
  24. package/src/models/row.ts +0 -188
  25. package/src/models/window.ts +0 -309
  26. package/src/models/workspace.ts +0 -717
  27. package/src/shared/decoders.ts +0 -939
  28. package/src/shared/ioc.ts +0 -227
  29. package/src/shared/privateDataManager.ts +0 -93
  30. package/src/shared/promisePlus.ts +0 -34
  31. package/src/shared/promiseWrapper.ts +0 -11
  32. package/src/types/builders.ts +0 -10
  33. package/src/types/controller.ts +0 -79
  34. package/src/types/glue.ts +0 -37
  35. package/src/types/ioc.ts +0 -33
  36. package/src/types/privateData.ts +0 -92
  37. package/src/types/protocol.ts +0 -453
  38. package/src/types/subscription.ts +0 -31
  39. package/temp.d.ts +0 -49
  40. package/tsconfig.json +0 -10
@@ -1,939 +0,0 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
- /* eslint-disable @typescript-eslint/no-use-before-define */
3
- import { Decoder, object, boolean, string, optional, array, oneOf, constant, lazy, number, anyJson, intersection } from "decoder-validate";
4
- import {
5
- IsWindowInSwimlaneResult,
6
- WorkspaceSnapshotResult,
7
- ChildSnapshotResult,
8
- WorkspaceConfigResult,
9
- FrameSummaryResult,
10
- WorkspaceCreateConfigProtocol,
11
- GetFrameSummaryConfig,
12
- WorkspaceSummaryResult,
13
- LayoutSummariesResult,
14
- LayoutSummary,
15
- OpenWorkspaceConfig,
16
- FrameSummariesResult,
17
- WorkspaceSummariesResult,
18
- ExportedLayoutsResult,
19
- DeleteLayoutConfig,
20
- SimpleItemConfig,
21
- ResizeItemConfig,
22
- MoveFrameConfig,
23
- FrameSnapshotResult,
24
- BaseChildSnapshotConfig,
25
- ParentSnapshotConfig,
26
- SwimlaneWindowSnapshotConfig,
27
- SimpleWindowOperationSuccessResult,
28
- SetItemTitleConfig,
29
- MoveWindowConfig,
30
- AddWindowConfig,
31
- AddContainerConfig,
32
- AddItemResult,
33
- BundleWorkspaceConfig,
34
- WorkspaceStreamData,
35
- FrameStreamData,
36
- ContainerStreamData,
37
- ContainerSummaryResult,
38
- WindowStreamData,
39
- PingResult,
40
- FrameStateConfig,
41
- FrameStateResult,
42
- LockWorkspaceConfig,
43
- LockWindowConfig,
44
- LockContainerConfig,
45
- SubParentSnapshotResult,
46
- WindowSnapshotResult,
47
- LockRowConfig,
48
- LockColumnConfig,
49
- LockGroupConfig,
50
- FrameBoundsResult,
51
- GetWorkspaceIconResult,
52
- PinWorkspaceConfig,
53
- SetWorkspaceIconConfig,
54
- FrameInitializationConfigProtocol,
55
- WorkspaceSelector,
56
- ShortcutClickedData,
57
- ShortcutConfig,
58
- FrameSnapshotConfig,
59
- FrameBounds,
60
- SetMaximizationBoundaryConfig,
61
- LoadingAnimationConfig,
62
- GetPlatformFrameIdResult,
63
- ItemBundleConfig,
64
- OperationCheckConfig,
65
- OperationCheckResult
66
- } from "../types/protocol";
67
- import { WorkspaceEventType, WorkspaceEventAction } from "../types/subscription";
68
- import { IOConnectWorkspaces } from "../../workspaces";
69
-
70
- export const nonEmptyStringDecoder: Decoder<string> = string().where((s) => s.length > 0, "Expected a non-empty string");
71
- export const nonNegativeNumberDecoder: Decoder<number> = number().where((num) => num >= 0, "Expected a non-negative number");
72
- export const positiveNumberDecoder: Decoder<number> = number().where((num) => num > 0, "Expected a positive number");
73
-
74
-
75
- export const isWindowInSwimlaneResultDecoder: Decoder<IsWindowInSwimlaneResult> = object({
76
- inWorkspace: boolean()
77
- });
78
-
79
- export const allParentDecoder: Decoder<"workspace" | "row" | "column" | "group"> = oneOf<"workspace" | "row" | "column" | "group">(
80
- constant("workspace"),
81
- constant("row"),
82
- constant("column"),
83
- constant("group")
84
- );
85
-
86
- export const subParentDecoder: Decoder<"row" | "column" | "group"> = oneOf<"row" | "column" | "group">(
87
- constant("row"),
88
- constant("column"),
89
- constant("group")
90
- );
91
-
92
- export const frameStateDecoder: Decoder<"maximized" | "minimized" | "normal"> = oneOf<"maximized" | "minimized" | "normal">(
93
- constant("maximized"),
94
- constant("minimized"),
95
- constant("normal")
96
- );
97
-
98
- export const loadingAnimationTypeDecoder: Decoder<"workspace"> = oneOf<"workspace">(
99
- constant("workspace")
100
- );
101
-
102
- export const checkThrowCallback = (callback: unknown, allowUndefined?: boolean): void => {
103
- const argumentType = typeof callback;
104
-
105
- if (allowUndefined && argumentType !== "function" && argumentType !== "undefined") {
106
- throw new Error(`Provided argument must be either undefined or of type function, provided: ${argumentType}`);
107
- }
108
-
109
- if (!allowUndefined && argumentType !== "function") {
110
- throw new Error(`Provided argument must be of type function, provided: ${argumentType}`);
111
- }
112
- };
113
-
114
- export const workspaceBuilderCreateConfigDecoder: Decoder<IOConnectWorkspaces.WorkspaceCreateConfig> = optional(object({
115
- saveLayout: optional(boolean())
116
- }));
117
-
118
- export const deleteLayoutConfigDecoder: Decoder<DeleteLayoutConfig> = object({
119
- name: nonEmptyStringDecoder
120
- });
121
-
122
- export const windowDefinitionConfigDecoder: Decoder<IOConnectWorkspaces.WorkspaceWindowDefinitionConfig> = object({
123
- minWidth: optional(number()),
124
- maxWidth: optional(number()),
125
- minHeight: optional(number()),
126
- maxHeight: optional(number()),
127
- allowExtract: optional(boolean()),
128
- allowReorder: optional(boolean()),
129
- showCloseButton: optional(boolean())
130
- });
131
-
132
- export const groupDefinitionConfigDecoder: Decoder<IOConnectWorkspaces.GroupDefinitionConfig> = object({
133
- minWidth: optional(number()),
134
- maxWidth: optional(number()),
135
- minHeight: optional(number()),
136
- maxHeight: optional(number()),
137
- allowExtract: optional(boolean()),
138
- allowReorder: optional(boolean()),
139
- allowDrop: optional(boolean()),
140
- allowDropHeader: optional(boolean()),
141
- allowDropLeft: optional(boolean()),
142
- allowDropRight: optional(boolean()),
143
- allowDropTop: optional(boolean()),
144
- allowDropBottom: optional(boolean()),
145
- showMaximizeButton: optional(boolean()),
146
- showEjectButton: optional(boolean()),
147
- showAddWindowButton: optional(boolean())
148
- });
149
-
150
- export const rowDefinitionConfigDecoder: Decoder<IOConnectWorkspaces.RowDefinitionConfig> = object({
151
- minHeight: optional(number()),
152
- maxHeight: optional(number()),
153
- allowDrop: optional(boolean()),
154
- allowSplitters: optional(boolean()),
155
- isPinned: optional(boolean()),
156
- maximizationBoundary: optional(boolean())
157
- });
158
-
159
- export const columnDefinitionConfigDecoder: Decoder<IOConnectWorkspaces.ColumnDefinitionConfig> = object({
160
- minWidth: optional(number()),
161
- maxWidth: optional(number()),
162
- allowDrop: optional(boolean()),
163
- allowSplitters: optional(boolean()),
164
- isPinned: optional(boolean()),
165
- maximizationBoundary: optional(boolean())
166
- });
167
-
168
- export const swimlaneWindowDefinitionDecoder: Decoder<IOConnectWorkspaces.WorkspaceWindowDefinition> = object({
169
- type: optional(constant("window")),
170
- appName: optional(nonEmptyStringDecoder),
171
- windowId: optional(nonEmptyStringDecoder),
172
- context: optional(anyJson()),
173
- config: optional(windowDefinitionConfigDecoder)
174
- });
175
-
176
- export const strictSwimlaneWindowDefinitionDecoder: Decoder<IOConnectWorkspaces.WorkspaceWindowDefinition> = object({
177
- type: constant("window"),
178
- appName: optional(nonEmptyStringDecoder),
179
- windowId: optional(nonEmptyStringDecoder),
180
- context: optional(anyJson()),
181
- config: optional(windowDefinitionConfigDecoder)
182
- });
183
-
184
- export const parentDefinitionDecoder: Decoder<IOConnectWorkspaces.BoxDefinition> = optional(object({
185
- type: optional(subParentDecoder),
186
- children: optional(
187
- lazy(() => array(
188
- oneOf<IOConnectWorkspaces.WorkspaceWindowDefinition | IOConnectWorkspaces.BoxDefinition>(
189
- swimlaneWindowDefinitionDecoder,
190
- parentDefinitionDecoder
191
- )
192
- ))
193
- ),
194
- config: optional(anyJson())
195
- }));
196
-
197
-
198
- export const strictColumnDefinitionDecoder: Decoder<IOConnectWorkspaces.BoxDefinition> = object({
199
- type: constant("column"),
200
- children: optional(
201
- lazy(() => array(
202
- oneOf<IOConnectWorkspaces.WorkspaceWindowDefinition | IOConnectWorkspaces.BoxDefinition>(
203
- strictSwimlaneWindowDefinitionDecoder,
204
- strictParentDefinitionDecoder
205
- )
206
- ))
207
- ),
208
- config: optional(columnDefinitionConfigDecoder)
209
- });
210
-
211
- export const strictRowDefinitionDecoder: Decoder<IOConnectWorkspaces.BoxDefinition> = object({
212
- type: constant("row"),
213
- children: optional(
214
- lazy(() => array(
215
- oneOf<IOConnectWorkspaces.WorkspaceWindowDefinition | IOConnectWorkspaces.BoxDefinition>(
216
- strictSwimlaneWindowDefinitionDecoder,
217
- strictParentDefinitionDecoder
218
- )
219
- ))
220
- ),
221
- config: optional(rowDefinitionConfigDecoder)
222
- });
223
-
224
- export const strictGroupDefinitionDecoder: Decoder<IOConnectWorkspaces.BoxDefinition> = object({
225
- type: constant("group"),
226
- children: optional(
227
- lazy(() => array(
228
- oneOf<IOConnectWorkspaces.WorkspaceWindowDefinition | IOConnectWorkspaces.BoxDefinition>(
229
- strictSwimlaneWindowDefinitionDecoder,
230
- strictParentDefinitionDecoder
231
- )
232
- ))
233
- ),
234
- config: optional(groupDefinitionConfigDecoder)
235
- });
236
-
237
- export const strictParentDefinitionDecoder: Decoder<IOConnectWorkspaces.BoxDefinition> = oneOf(strictGroupDefinitionDecoder, strictColumnDefinitionDecoder, strictRowDefinitionDecoder);
238
-
239
- export const stateDecoder: Decoder<"maximized" | "normal"> = oneOf<"maximized" | "normal">(
240
- (string().where((s) => s.toLowerCase() === "maximized", "Expected a case insensitive variation of 'maximized'") as Decoder<"maximized">),
241
- (string().where((s) => s.toLowerCase() === "normal", "Expected a case insensitive variation of 'normal'") as Decoder<"normal">)
242
- );
243
-
244
- export const newFrameConfigDecoder: Decoder<IOConnectWorkspaces.NewFrameConfig> = object({
245
- bounds: optional(object({
246
- left: optional(number()),
247
- top: optional(number()),
248
- width: optional(nonNegativeNumberDecoder),
249
- height: optional(nonNegativeNumberDecoder)
250
- })),
251
- frameId: optional(nonEmptyStringDecoder)
252
- });
253
-
254
- export const loadingStrategyDecoder: Decoder<IOConnectWorkspaces.LoadingStrategy> = oneOf<"direct" | "delayed" | "lazy">(
255
- constant("direct"),
256
- constant("delayed"),
257
- constant("lazy")
258
- );
259
-
260
- export const restoreWorkspaceConfigDecoder: Decoder<IOConnectWorkspaces.RestoreWorkspaceConfig> = optional(object({
261
- app: optional(nonEmptyStringDecoder),
262
- context: optional(anyJson()),
263
- loadingStrategy: optional(loadingStrategyDecoder),
264
- title: optional(nonEmptyStringDecoder),
265
- reuseWorkspaceId: optional(nonEmptyStringDecoder),
266
- frameId: optional(nonEmptyStringDecoder),
267
- applicationName: optional(nonEmptyStringDecoder),
268
- lockdown: optional(boolean()),
269
- activateFrame: optional(boolean()),
270
- newFrame: optional(oneOf<IOConnectWorkspaces.NewFrameConfig | boolean>(
271
- newFrameConfigDecoder,
272
- boolean()
273
- )),
274
- noTabHeader: optional(boolean()),
275
- inMemoryLayout: optional(boolean()),
276
- icon: optional(nonEmptyStringDecoder),
277
- isPinned: optional(boolean()),
278
- isSelected: optional(boolean()),
279
- positionIndex: optional(nonNegativeNumberDecoder),
280
- allowSystemHibernation: optional(boolean())
281
- }));
282
-
283
- export const openWorkspaceConfigDecoder: Decoder<OpenWorkspaceConfig> = object({
284
- name: nonEmptyStringDecoder,
285
- restoreOptions: optional(restoreWorkspaceConfigDecoder)
286
- });
287
-
288
- export const workspaceDefinitionDecoder: Decoder<IOConnectWorkspaces.WorkspaceDefinition> = object({
289
- children: optional(array(oneOf<IOConnectWorkspaces.WorkspaceWindowDefinition | IOConnectWorkspaces.BoxDefinition>(
290
- swimlaneWindowDefinitionDecoder,
291
- strictParentDefinitionDecoder
292
- ))),
293
- context: optional(anyJson()),
294
- config: optional(object({
295
- title: optional(nonEmptyStringDecoder),
296
- position: optional(nonNegativeNumberDecoder),
297
- isFocused: optional(boolean()),
298
- noTabHeader: optional(boolean()),
299
- reuseWorkspaceId: optional(nonEmptyStringDecoder),
300
- loadingStrategy: optional(loadingStrategyDecoder),
301
- allowDrop: optional(boolean()),
302
- allowDropLeft: optional(boolean()),
303
- allowDropTop: optional(boolean()),
304
- allowDropRight: optional(boolean()),
305
- allowDropBottom: optional(boolean()),
306
- allowSystemHibernation: optional(boolean()),
307
- allowExtract: optional(boolean()),
308
- allowWindowReorder: optional(boolean()),
309
- showSaveButton: optional(boolean()),
310
- allowWorkspaceTabReorder: optional(boolean()),
311
- allowWorkspaceTabExtract: optional(boolean()),
312
- showCloseButton: optional(boolean()),
313
- allowSplitters: optional(boolean()),
314
- showWindowCloseButtons: optional(boolean()),
315
- showEjectButtons: optional(boolean()),
316
- showAddWindowButtons: optional(boolean()),
317
- icon: optional(nonEmptyStringDecoder),
318
- isPinned: optional(boolean()),
319
- isSelected: optional(boolean()),
320
- positionIndex: optional(nonNegativeNumberDecoder)
321
- })),
322
- frame: optional(object({
323
- reuseFrameId: optional(nonEmptyStringDecoder),
324
- applicationName: optional(nonEmptyStringDecoder),
325
- newFrame: optional(oneOf<boolean | IOConnectWorkspaces.NewFrameConfig>(
326
- boolean(),
327
- newFrameConfigDecoder
328
- ))
329
- }))
330
- });
331
-
332
- export const workspaceSelectorDecoder: Decoder<WorkspaceSelector> = object({
333
- workspaceId: nonEmptyStringDecoder
334
- });
335
-
336
- export const restoreWorkspaceDefinitionDecoder: Decoder<IOConnectWorkspaces.RestoreWorkspaceDefinition> = object({
337
- name: nonEmptyStringDecoder,
338
- restoreOptions: optional(restoreWorkspaceConfigDecoder)
339
- });
340
-
341
- export const emptyFrameDefinitionDecoder: Decoder<IOConnectWorkspaces.EmptyFrameDefinition> = optional(object({
342
- applicationName: optional(string()),
343
- frameConfig: optional(newFrameConfigDecoder),
344
- context: optional(object()),
345
- layoutComponentId: optional(nonEmptyStringDecoder)
346
- }));
347
-
348
- export const frameInitConfigDecoder: Decoder<IOConnectWorkspaces.FrameInitializationConfig> = object({
349
- workspaces: array(oneOf<IOConnectWorkspaces.WorkspaceDefinition | IOConnectWorkspaces.RestoreWorkspaceDefinition>(
350
- optional(workspaceDefinitionDecoder),
351
- optional(restoreWorkspaceDefinitionDecoder)
352
- ))
353
- });
354
-
355
- export const frameInitProtocolConfigDecoder: Decoder<FrameInitializationConfigProtocol> = object({
356
- frameId: nonEmptyStringDecoder,
357
- workspaces: array(oneOf<IOConnectWorkspaces.WorkspaceDefinition | IOConnectWorkspaces.RestoreWorkspaceDefinition>(
358
- workspaceDefinitionDecoder,
359
- restoreWorkspaceDefinitionDecoder
360
- ))
361
- });
362
-
363
- export const builderConfigDecoder: Decoder<IOConnectWorkspaces.BuilderConfig> = object({
364
- type: allParentDecoder,
365
- definition: optional(oneOf<IOConnectWorkspaces.WorkspaceDefinition | IOConnectWorkspaces.BoxDefinition>(
366
- workspaceDefinitionDecoder,
367
- parentDefinitionDecoder
368
- ))
369
- });
370
-
371
- export const workspaceCreateConfigDecoder: Decoder<WorkspaceCreateConfigProtocol> = intersection(
372
- workspaceDefinitionDecoder,
373
- object({
374
- saveConfig: optional(object({
375
- saveLayout: optional(boolean())
376
- }))
377
- })
378
- );
379
-
380
- export const getFrameSummaryConfigDecoder: Decoder<GetFrameSummaryConfig> = object({
381
- itemId: nonEmptyStringDecoder
382
- });
383
-
384
- export const frameInitializationContextDecoder: Decoder<IOConnectWorkspaces.FrameInitializationContext> = object({
385
- context: optional(object())
386
- });
387
-
388
- export const frameSummaryDecoder: Decoder<FrameSummaryResult> = object({
389
- id: nonEmptyStringDecoder,
390
- isFocused: optional(boolean()),
391
- isInitialized: optional(boolean()),
392
- initializationContext: optional(frameInitializationContextDecoder)
393
- });
394
-
395
- export const containerSummaryDecoder: Decoder<IOConnectWorkspaces.BoxSummary> = object({
396
- type: subParentDecoder,
397
- id: nonEmptyStringDecoder,
398
- frameId: nonEmptyStringDecoder,
399
- workspaceId: nonEmptyStringDecoder,
400
- positionIndex: number()
401
- });
402
-
403
- export const eventTypeDecoder: Decoder<WorkspaceEventType> = oneOf<"frame" | "workspace" | "container" | "window">(
404
- constant("frame"),
405
- constant("workspace"),
406
- constant("container"),
407
- constant("window")
408
- );
409
-
410
- export const streamRequestArgumentsDecoder: Decoder<{ type: WorkspaceEventType; branch: string }> = object({
411
- type: eventTypeDecoder,
412
- branch: nonEmptyStringDecoder
413
- });
414
-
415
- export const workspaceEventActionDecoder: Decoder<WorkspaceEventAction> = oneOf<"opened" | "closing" | "closed" | "focus" | "added" | "loaded" | "removed" | "childrenUpdate" | "containerChange" | "maximized" | "restored" | "minimized" | "normal" | "selected" | "lock-configuration-changed" | "hibernated" | "resumed">(
416
- constant("opened"),
417
- constant("closing"),
418
- constant("closed"),
419
- constant("focus"),
420
- constant("added"),
421
- constant("loaded"),
422
- constant("removed"),
423
- constant("childrenUpdate"),
424
- constant("containerChange"),
425
- constant("maximized"),
426
- constant("restored"),
427
- constant("minimized"),
428
- constant("normal"),
429
- constant("selected"),
430
- constant("lock-configuration-changed"),
431
- constant("hibernated"),
432
- constant("resumed")
433
- );
434
-
435
- export const workspaceConfigResultDecoder: Decoder<WorkspaceConfigResult> = object({
436
- frameId: nonEmptyStringDecoder,
437
- title: nonEmptyStringDecoder,
438
- positionIndex: nonNegativeNumberDecoder,
439
- name: nonEmptyStringDecoder,
440
- layoutName: optional(nonEmptyStringDecoder),
441
- isHibernated: optional(boolean()),
442
- isSelected: optional(boolean()),
443
- allowDrop: optional(boolean()),
444
- allowSystemHibernation: optional(boolean()),
445
- allowExtract: optional(boolean()),
446
- allowWindowReorder: optional(boolean()),
447
- allowSplitters: optional(boolean()),
448
- showCloseButton: optional(boolean()),
449
- showSaveButton: optional(boolean()),
450
- allowWorkspaceTabReorder: optional(boolean()),
451
- allowWorkspaceTabExtract: optional(boolean()),
452
- allowDropLeft: optional(boolean()),
453
- allowDropTop: optional(boolean()),
454
- allowDropRight: optional(boolean()),
455
- allowDropBottom: optional(boolean()),
456
- minWidth: optional(number()),
457
- maxWidth: optional(number()),
458
- minHeight: optional(number()),
459
- maxHeight: optional(number()),
460
- showAddWindowButtons: optional(boolean()),
461
- showEjectButtons: optional(boolean()),
462
- showWindowCloseButtons: optional(boolean()),
463
- widthInPx: optional(number()),
464
- heightInPx: optional(number()),
465
- isPinned: optional(boolean()),
466
- });
467
-
468
- // todo: remove number positionIndex when fixed
469
- export const baseChildSnapshotConfigDecoder: Decoder<BaseChildSnapshotConfig> = object({
470
- frameId: nonEmptyStringDecoder,
471
- workspaceId: nonEmptyStringDecoder,
472
- positionIndex: number(),
473
- minWidth: optional(number()),
474
- maxWidth: optional(number()),
475
- minHeight: optional(number()),
476
- maxHeight: optional(number())
477
- });
478
-
479
- export const parentSnapshotConfigDecoder: Decoder<ParentSnapshotConfig> = anyJson();
480
-
481
- export const swimlaneWindowSnapshotConfigDecoder: Decoder<SwimlaneWindowSnapshotConfig> = intersection(
482
- baseChildSnapshotConfigDecoder,
483
- object({
484
- windowId: optional(nonEmptyStringDecoder),
485
- isMaximized: optional(boolean()),
486
- isFocused: boolean(),
487
- isSelected: optional(boolean()),
488
- title: optional(string()),
489
- appName: optional(nonEmptyStringDecoder),
490
- allowExtract: optional(boolean()),
491
- allowReorder: optional(boolean()),
492
- showCloseButton: optional(boolean()),
493
- minWidth: optional(number()),
494
- minHeight: optional(number()),
495
- maxWidth: optional(number()),
496
- maxHeight: optional(number()),
497
- widthInPx: optional(number()),
498
- heightInPx: optional(number()),
499
- context: optional(anyJson())
500
- })
501
- ) as any;
502
-
503
- export const customWorkspaceSubParentSnapshotDecoder: Decoder<SubParentSnapshotResult> = object({
504
- id: optional(nonEmptyStringDecoder),
505
- config: parentSnapshotConfigDecoder,
506
- children: optional(lazy(() => array(customWorkspaceChildSnapshotDecoder))),
507
- type: oneOf<"row" | "column" | "group">(
508
- constant("row"),
509
- constant("column"),
510
- constant("group")
511
- )
512
- });
513
-
514
- export const customWorkspaceWindowSnapshotDecoder: Decoder<WindowSnapshotResult> = object({
515
- id: optional(nonEmptyStringDecoder),
516
- config: swimlaneWindowSnapshotConfigDecoder,
517
- type: constant("window")
518
- });
519
-
520
- export const customWorkspaceChildSnapshotDecoder: Decoder<ChildSnapshotResult> = oneOf<WindowSnapshotResult | SubParentSnapshotResult>(
521
- customWorkspaceWindowSnapshotDecoder,
522
- customWorkspaceSubParentSnapshotDecoder);
523
-
524
- export const childSnapshotResultDecoder: Decoder<ChildSnapshotResult> = customWorkspaceChildSnapshotDecoder;
525
-
526
- export const workspaceSnapshotResultDecoder: Decoder<WorkspaceSnapshotResult> = object({
527
- id: nonEmptyStringDecoder,
528
- config: workspaceConfigResultDecoder,
529
- children: array(childSnapshotResultDecoder),
530
- frameSummary: frameSummaryDecoder,
531
- context: optional(anyJson())
532
- });
533
-
534
- export const windowLayoutItemDecoder: Decoder<IOConnectWorkspaces.WindowLayoutItem> = object({
535
- type: constant("window"),
536
- config: object({
537
- appName: nonEmptyStringDecoder,
538
- windowId: optional(nonEmptyStringDecoder),
539
- context: optional(anyJson()),
540
- url: optional(nonEmptyStringDecoder),
541
- title: optional(string()),
542
- allowExtract: optional(boolean()),
543
- allowReorder: optional(boolean()),
544
- showCloseButton: optional(boolean()),
545
- minWidth: optional(number()),
546
- minHeight: optional(number()),
547
- maxWidth: optional(number()),
548
- maxHeight: optional(number()),
549
- isMaximized: optional(boolean())
550
- })
551
- });
552
-
553
- export const groupLayoutItemDecoder: Decoder<IOConnectWorkspaces.GroupLayoutItem> = object({
554
- type: constant("group"),
555
- config: anyJson(),
556
- children: array(oneOf<IOConnectWorkspaces.WindowLayoutItem>(
557
- windowLayoutItemDecoder
558
- ))
559
- });
560
-
561
- export const columnLayoutItemDecoder: Decoder<IOConnectWorkspaces.ColumnLayoutItem> = object({
562
- type: constant("column"),
563
- config: anyJson(),
564
- children: array(oneOf<IOConnectWorkspaces.RowLayoutItem | IOConnectWorkspaces.ColumnLayoutItem | IOConnectWorkspaces.GroupLayoutItem | IOConnectWorkspaces.WindowLayoutItem>(
565
- groupLayoutItemDecoder,
566
- windowLayoutItemDecoder,
567
- lazy(() => columnLayoutItemDecoder),
568
- lazy(() => rowLayoutItemDecoder)
569
- ))
570
- });
571
-
572
- export const rowLayoutItemDecoder: Decoder<IOConnectWorkspaces.RowLayoutItem> = object({
573
- type: constant("row"),
574
- config: anyJson(),
575
- children: array(oneOf<IOConnectWorkspaces.RowLayoutItem | IOConnectWorkspaces.ColumnLayoutItem | IOConnectWorkspaces.GroupLayoutItem | IOConnectWorkspaces.WindowLayoutItem>(
576
- columnLayoutItemDecoder,
577
- groupLayoutItemDecoder,
578
- windowLayoutItemDecoder,
579
- lazy(() => rowLayoutItemDecoder)
580
- ))
581
- });
582
-
583
- export const workspaceLayoutDecoder: Decoder<IOConnectWorkspaces.WorkspaceLayout> = object({
584
- name: nonEmptyStringDecoder,
585
- type: constant("Workspace"),
586
- metadata: optional(anyJson()),
587
- components: array(object({
588
- type: constant("Workspace"),
589
- application: optional(string()),
590
- state: object({
591
- config: anyJson(),
592
- context: anyJson(),
593
- children: array(oneOf<IOConnectWorkspaces.RowLayoutItem | IOConnectWorkspaces.ColumnLayoutItem | IOConnectWorkspaces.GroupLayoutItem | IOConnectWorkspaces.WindowLayoutItem>(
594
- rowLayoutItemDecoder,
595
- columnLayoutItemDecoder,
596
- groupLayoutItemDecoder,
597
- windowLayoutItemDecoder
598
- ))
599
- })
600
- }))
601
- });
602
-
603
- export const workspacesImportLayoutDecoder: Decoder<{ layout: IOConnectWorkspaces.WorkspaceLayout; mode: "replace" | "merge" }> = object({
604
- layout: workspaceLayoutDecoder,
605
- mode: oneOf<"replace" | "merge">(
606
- constant("replace"),
607
- constant("merge")
608
- )
609
- });
610
-
611
- export const workspacesImportLayoutsDecoder: Decoder<{ layouts: IOConnectWorkspaces.WorkspaceLayout[]; mode: "replace" | "merge" }> = object({
612
- layouts: array(workspaceLayoutDecoder),
613
- mode: oneOf<"replace" | "merge">(
614
- constant("replace"),
615
- constant("merge")
616
- )
617
- });
618
-
619
- export const exportedLayoutsResultDecoder: Decoder<ExportedLayoutsResult> = object({
620
- layouts: array(workspaceLayoutDecoder)
621
- });
622
-
623
- export const frameSummaryResultDecoder: Decoder<FrameSummaryResult> = object({
624
- id: nonEmptyStringDecoder,
625
- isFocused: optional(boolean()),
626
- isInitialized: optional(boolean()),
627
- initializationContext: optional(frameInitializationContextDecoder)
628
- });
629
-
630
- export const frameSummariesResultDecoder: Decoder<FrameSummariesResult> = object({
631
- summaries: array(frameSummaryResultDecoder)
632
- });
633
-
634
- export const workspaceSummaryResultDecoder: Decoder<WorkspaceSummaryResult> = object({
635
- id: nonEmptyStringDecoder,
636
- config: workspaceConfigResultDecoder
637
- });
638
-
639
- export const workspaceSummariesResultDecoder: Decoder<WorkspaceSummariesResult> = object({
640
- summaries: array(workspaceSummaryResultDecoder)
641
- });
642
-
643
- export const frameSnapshotResultDecoder: Decoder<FrameSnapshotResult> = object({
644
- id: nonEmptyStringDecoder,
645
- config: anyJson(),
646
- workspaces: array(workspaceSnapshotResultDecoder)
647
- });
648
-
649
- export const layoutSummaryDecoder: Decoder<LayoutSummary> = object({
650
- name: nonEmptyStringDecoder,
651
- applicationName: optional(string())
652
- });
653
-
654
- export const layoutSummariesDecoder: Decoder<LayoutSummariesResult> = object({
655
- summaries: array(layoutSummaryDecoder)
656
- });
657
-
658
- export const simpleWindowOperationSuccessResultDecoder: Decoder<SimpleWindowOperationSuccessResult> = object({
659
- windowId: nonEmptyStringDecoder
660
- });
661
-
662
- export const voidResultDecoder: Decoder<{}> = anyJson();
663
-
664
- export const frameStateResultDecoder: Decoder<FrameStateResult> = object({
665
- state: frameStateDecoder
666
- });
667
-
668
- export const frameBoundsDecoder: Decoder<FrameBounds> = object({
669
- top: number(),
670
- left: number(),
671
- width: nonNegativeNumberDecoder,
672
- height: nonNegativeNumberDecoder
673
- });
674
-
675
- export const frameBoundsResultDecoder: Decoder<FrameBoundsResult> = object({
676
- bounds: frameBoundsDecoder
677
- });
678
-
679
- export const getWorkspaceIconResultDecoder: Decoder<GetWorkspaceIconResult> = object({
680
- icon: optional(nonEmptyStringDecoder)
681
- });
682
-
683
- export const getPlatformFrameIdResultDecoder: Decoder<GetPlatformFrameIdResult> = object({
684
- id: optional(nonEmptyStringDecoder)
685
- });
686
-
687
- export const operationCheckResultDecoder: Decoder<OperationCheckResult> = object({
688
- isSupported: boolean()
689
- });
690
-
691
- export const resizeConfigDecoder: Decoder<IOConnectWorkspaces.ResizeConfig> = object({
692
- width: optional(positiveNumberDecoder),
693
- height: optional(positiveNumberDecoder),
694
- relative: optional(boolean())
695
- });
696
-
697
- export const moveConfigDecoder: Decoder<IOConnectWorkspaces.MoveConfig> = object({
698
- top: optional(number()),
699
- left: optional(number()),
700
- relative: optional(boolean())
701
- });
702
-
703
- export const simpleItemConfigDecoder: Decoder<SimpleItemConfig> = object({
704
- itemId: nonEmptyStringDecoder
705
- });
706
-
707
- export const frameSnapshotConfigDecoder: Decoder<FrameSnapshotConfig> = object({
708
- itemId: nonEmptyStringDecoder,
709
- excludeIds: optional(boolean())
710
- });
711
-
712
- export const frameStateConfigDecoder: Decoder<FrameStateConfig> = object({
713
- frameId: nonEmptyStringDecoder,
714
- requestedState: frameStateDecoder
715
- });
716
-
717
- export const setItemTitleConfigDecoder: Decoder<SetItemTitleConfig> = object({
718
- itemId: nonEmptyStringDecoder,
719
- title: nonEmptyStringDecoder
720
- });
721
-
722
- export const moveWindowConfigDecoder: Decoder<MoveWindowConfig> = object({
723
- itemId: nonEmptyStringDecoder,
724
- containerId: nonEmptyStringDecoder
725
- });
726
-
727
- export const resizeItemConfigDecoder: Decoder<ResizeItemConfig> = intersection(
728
- simpleItemConfigDecoder,
729
- resizeConfigDecoder
730
- );
731
-
732
- export const setMaximizationBoundaryConfigDecoder: Decoder<SetMaximizationBoundaryConfig> = object({
733
- itemId: nonEmptyStringDecoder,
734
- enabled: boolean()
735
- });
736
-
737
- export const moveFrameConfigDecoder: Decoder<MoveFrameConfig> = intersection(
738
- simpleItemConfigDecoder,
739
- moveConfigDecoder
740
- );
741
-
742
- export const simpleParentDecoder: Decoder<{ id: string; type: "row" | "column" | "group" }> = object({
743
- id: nonEmptyStringDecoder,
744
- type: subParentDecoder
745
- });
746
-
747
- export const addWindowConfigDecoder: Decoder<AddWindowConfig> = object({
748
- definition: swimlaneWindowDefinitionDecoder,
749
- parentId: nonEmptyStringDecoder,
750
- parentType: allParentDecoder
751
- });
752
-
753
- export const addContainerConfigDecoder: Decoder<AddContainerConfig> = object({
754
- definition: strictParentDefinitionDecoder,
755
- parentId: nonEmptyStringDecoder,
756
- parentType: allParentDecoder
757
- });
758
-
759
- export const addItemResultDecoder: Decoder<AddItemResult> = object({
760
- itemId: nonEmptyStringDecoder,
761
- windowId: optional(nonEmptyStringDecoder)
762
- });
763
-
764
- export const pingResultDecoder: Decoder<PingResult> = object({
765
- live: boolean()
766
- });
767
-
768
- export const bundleWorkspaceConfigDecoder: Decoder<BundleWorkspaceConfig> = object({
769
- type: oneOf<"row" | "column">(
770
- constant("row"),
771
- constant("column")
772
- ),
773
- workspaceId: nonEmptyStringDecoder
774
- });
775
-
776
- export const bundleItemConfigDecoder: Decoder<ItemBundleConfig> = object({
777
- type: oneOf<"row" | "column">(
778
- constant("row"),
779
- constant("column")
780
- ),
781
- itemId: nonEmptyStringDecoder
782
- });
783
-
784
- export const containerSummaryResultDecoder: Decoder<ContainerSummaryResult> = object({
785
- itemId: nonEmptyStringDecoder,
786
- config: parentSnapshotConfigDecoder
787
- });
788
-
789
- export const frameStreamDataDecoder: Decoder<FrameStreamData> = object({
790
- frameSummary: frameSummaryDecoder,
791
- frameBounds: optional(frameBoundsDecoder)
792
- });
793
-
794
- export const workspaceStreamDataDecoder: Decoder<WorkspaceStreamData> = object({
795
- workspaceSummary: workspaceSummaryResultDecoder,
796
- frameSummary: frameSummaryDecoder,
797
- workspaceSnapshot: optional(workspaceSnapshotResultDecoder),
798
- frameBounds: optional(frameBoundsDecoder)
799
- });
800
-
801
- export const containerStreamDataDecoder: Decoder<ContainerStreamData> = object({
802
- containerSummary: containerSummaryResultDecoder
803
- });
804
-
805
- export const windowStreamDataDecoder: Decoder<WindowStreamData> = object({
806
- windowSummary: object({
807
- itemId: nonEmptyStringDecoder,
808
- parentId: nonEmptyStringDecoder,
809
- config: swimlaneWindowSnapshotConfigDecoder
810
- })
811
- });
812
-
813
- export const workspaceLayoutSaveConfigDecoder: Decoder<IOConnectWorkspaces.WorkspaceLayoutSaveConfig> = object({
814
- name: nonEmptyStringDecoder,
815
- workspaceId: nonEmptyStringDecoder,
816
- saveContext: optional(boolean()),
817
- metadata: optional(object())
818
- });
819
-
820
- export const workspaceLockConfigDecoder: Decoder<IOConnectWorkspaces.WorkspaceLockConfig> = object({
821
- allowDrop: optional(boolean()),
822
- allowDropLeft: optional(boolean()),
823
- allowDropTop: optional(boolean()),
824
- allowDropRight: optional(boolean()),
825
- allowDropBottom: optional(boolean()),
826
- allowSystemHibernation: optional(boolean()),
827
- allowExtract: optional(boolean()),
828
- allowWindowReorder: optional(boolean()),
829
- allowSplitters: optional(boolean()),
830
- showCloseButton: optional(boolean()),
831
- showSaveButton: optional(boolean()),
832
- allowWorkspaceTabReorder: optional(boolean()),
833
- allowWorkspaceTabExtract: optional(boolean()),
834
- showWindowCloseButtons: optional(boolean()),
835
- showAddWindowButtons: optional(boolean()),
836
- showEjectButtons: optional(boolean()),
837
- });
838
-
839
- export const lockWorkspaceDecoder: Decoder<LockWorkspaceConfig> = object({
840
- workspaceId: nonEmptyStringDecoder,
841
- config: optional(workspaceLockConfigDecoder)
842
- });
843
-
844
- export const windowLockConfigDecoder: Decoder<IOConnectWorkspaces.WorkspaceWindowLockConfig> = object({
845
- allowExtract: optional(boolean()),
846
- allowReorder: optional(boolean()),
847
- showCloseButton: optional(boolean())
848
- });
849
-
850
- export const elementResizeConfigDecoder: Decoder<IOConnectWorkspaces.ElementResizeConfig> = object({
851
- width: optional(nonNegativeNumberDecoder),
852
- height: optional(nonNegativeNumberDecoder)
853
- });
854
-
855
- export const lockWindowDecoder: Decoder<LockWindowConfig> = object({
856
- windowPlacementId: nonEmptyStringDecoder,
857
- config: optional(windowLockConfigDecoder)
858
- });
859
-
860
- export const rowLockConfigDecoder: Decoder<IOConnectWorkspaces.RowLockConfig> = object({
861
- allowDrop: optional(boolean()),
862
- allowSplitters: optional(boolean()),
863
- });
864
-
865
- export const columnLockConfigDecoder: Decoder<IOConnectWorkspaces.ColumnLockConfig> = object({
866
- allowDrop: optional(boolean()),
867
- allowSplitters: optional(boolean()),
868
- });
869
-
870
- export const groupLockConfigDecoder: Decoder<IOConnectWorkspaces.GroupLockConfig> = object({
871
- allowExtract: optional(boolean()),
872
- allowReorder: optional(boolean()),
873
- allowDrop: optional(boolean()),
874
- allowDropLeft: optional(boolean()),
875
- allowDropRight: optional(boolean()),
876
- allowDropTop: optional(boolean()),
877
- allowDropBottom: optional(boolean()),
878
- allowDropHeader: optional(boolean()),
879
- showMaximizeButton: optional(boolean()),
880
- showEjectButton: optional(boolean()),
881
- showAddWindowButton: optional(boolean()),
882
- });
883
-
884
- export const lockRowDecoder: Decoder<LockRowConfig> = object({
885
- itemId: nonEmptyStringDecoder,
886
- type: constant("row"),
887
- config: optional(rowLockConfigDecoder)
888
- });
889
-
890
- export const lockColumnDecoder: Decoder<LockColumnConfig> = object({
891
- itemId: nonEmptyStringDecoder,
892
- type: constant("column"),
893
- config: optional(columnLockConfigDecoder)
894
- });
895
-
896
- export const lockGroupDecoder: Decoder<LockGroupConfig> = object({
897
- itemId: nonEmptyStringDecoder,
898
- type: constant("group"),
899
- config: optional(groupLockConfigDecoder)
900
- });
901
-
902
- export const lockContainerDecoder: Decoder<LockContainerConfig> = oneOf<LockGroupConfig | LockColumnConfig | LockRowConfig>(lockRowDecoder, lockColumnDecoder, lockGroupDecoder);
903
-
904
- export const pinWorkspaceDecoder: Decoder<PinWorkspaceConfig> = object({
905
- workspaceId: nonEmptyStringDecoder,
906
- icon: optional(nonEmptyStringDecoder)
907
- });
908
-
909
- export const setWorkspaceIconDecoder: Decoder<SetWorkspaceIconConfig> = object({
910
- workspaceId: nonEmptyStringDecoder,
911
- icon: optional(nonEmptyStringDecoder) // to enable the user to remove the icon from the workspace altogether
912
- });
913
-
914
- export const workspacePinOptionsDecoder: Decoder<IOConnectWorkspaces.WorkspacePinOptions> = optional(object({
915
- icon: optional(nonEmptyStringDecoder)
916
- }));
917
-
918
- export const shortcutConfigDecoder: Decoder<ShortcutConfig> = object({
919
- shortcut: nonEmptyStringDecoder,
920
- frameId: nonEmptyStringDecoder
921
- });
922
-
923
- export const shortcutClickedDataDecoder: Decoder<ShortcutClickedData> = object({
924
- shortcut: nonEmptyStringDecoder,
925
- frameId: nonEmptyStringDecoder
926
- });
927
-
928
- export const setMaximizationBoundaryAPIConfigDecoder: Decoder<IOConnectWorkspaces.SetMaximizationBoundaryConfig> = object({
929
- enabled: boolean()
930
- });
931
-
932
- export const loadingAnimationConfigDecoder: Decoder<LoadingAnimationConfig> = object({
933
- itemId: nonEmptyStringDecoder,
934
- type: loadingAnimationTypeDecoder
935
- });
936
-
937
- export const operationCheckConfigDecoder: Decoder<OperationCheckConfig> = object({
938
- operation: nonEmptyStringDecoder
939
- });