@vuu-ui/vuu-protocol-types 0.8.73 → 0.8.74

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 (2) hide show
  1. package/index.d.ts +185 -127
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -26,18 +26,45 @@ export interface VuuServerToClientMessage<
26
26
  user: string;
27
27
  }
28
28
 
29
- export interface ServerToClientTableMeta extends VuuTableMeta {
29
+ /**
30
+ * Metadata messages
31
+ *
32
+ * There are four metadata requests
33
+ * - retrieve a list of all available tables.
34
+ * - retrieve schema information for a given table.
35
+ * - retrieve any menu defined on a given table
36
+ * - retrieve any available Visual Links for a specific viewport
37
+ *
38
+ * Visual Links differ in one impoortant regard from the other three
39
+ * forms of metadata in that they are not static. The take into
40
+ * account existing active subscriptions within the users session
41
+ * and can therefore change from one call to another.
42
+ */
43
+ export interface ClientToServerTableList {
44
+ type: "GET_TABLE_LIST";
45
+ }
46
+
47
+ export interface ServerToClientTableList {
48
+ type: "TABLE_LIST_RESP";
49
+ tables: VuuTable[];
50
+ }
51
+
52
+ export interface ClientToServerTableMeta {
53
+ type: "GET_TABLE_META";
54
+ table: VuuTable;
55
+ }
56
+
57
+ export interface ServerToClientTableMeta {
30
58
  columns: VuuColumns;
31
59
  dataTypes: VuuColumnDataType[];
32
60
  key: string;
33
61
  table: VuuTable;
34
62
  type: "TABLE_META_RESP";
35
63
  }
36
-
37
- export type VuuTableMeta = Pick<
38
- ServerToClientTableMeta,
39
- "columns" | "dataTypes" | "table"
40
- >;
64
+ export interface ClientToServerMenus {
65
+ type: "GET_VIEW_PORT_MENUS";
66
+ vpId: string;
67
+ }
41
68
 
42
69
  export interface ServerToClientMenus {
43
70
  type: "VIEW_PORT_MENUS_RESP";
@@ -45,38 +72,21 @@ export interface ServerToClientMenus {
45
72
  vpId: string;
46
73
  }
47
74
 
48
- export interface OpenDialogAction {
49
- type: "OPEN_DIALOG_ACTION";
50
- table: VuuTable;
51
- }
52
- export interface NoAction {
53
- type: "NO_ACTION";
54
- }
55
-
56
- export interface ServerToClientMenu {
57
- rpcName: string;
58
- type: "VIEW_PORT_MENU_RESP";
59
- action: OpenDialogAction | NoAction;
60
- vpId: string;
61
- }
62
-
63
- export interface ServerToClientMenuReject {
64
- error: string;
65
- rpcName: string;
66
- type: "VIEW_PORT_MENU_REJ";
75
+ export interface ClientToServerVisualLinks {
76
+ type: "GET_VP_VISUAL_LINKS";
67
77
  vpId: string;
68
78
  }
69
79
 
70
- export interface ServerToClientMenuSessionTableAction
71
- extends ServerToClientMenu {
72
- action: OpenDialogAction;
73
- }
74
-
75
80
  export interface ServerToClientViewPortVisualLinks {
76
81
  type: "VP_VISUAL_LINKS_RESP";
77
82
  links: VuuLinkDescriptor[];
78
83
  vpId: string;
79
84
  }
85
+
86
+ /**
87
+ * Viewport manipulation messages
88
+ *
89
+ */
80
90
  export interface ServerToClientCreateViewPortSuccess {
81
91
  aggregations: VuuAggregation[];
82
92
  columns: VuuColumns;
@@ -97,6 +107,7 @@ export interface ServerToClientChangeViewPortSuccess {
97
107
  type: "CHANGE_VP_SUCCESS";
98
108
  viewPortId: string;
99
109
  }
110
+
100
111
  export interface ServerToClientChangeViewPortRangeSuccess {
101
112
  type: "CHANGE_VP_RANGE_SUCCESS";
102
113
  viewPortId: string;
@@ -119,25 +130,6 @@ export interface ServerToClientSelectSuccess {
119
130
  type: "SET_SELECTION_SUCCESS";
120
131
  vpId: string;
121
132
  }
122
- export interface ServerToClientRPC {
123
- type: "RPC_RESP";
124
- method: string;
125
- result: any;
126
- }
127
-
128
- // TODO flesh out as we know more
129
- export interface ServerToClientViewportRpcResponse {
130
- action: {
131
- key?: string;
132
- msg?: string;
133
- type: "VP_RPC_FAILURE" | "VP_RPC_SUCCESS" | "VP_CREATE_SUCCESS";
134
- };
135
- type: "VIEW_PORT_RPC_REPONSE";
136
- method: string;
137
- namedParams: { [key: string]: VuuRowDataItemType };
138
- params: string[];
139
- vpId: string;
140
- }
141
133
 
142
134
  export interface ServerToClientEditRPC {
143
135
  action: unknown;
@@ -193,7 +185,7 @@ export declare type ServerToClientBody =
193
185
  | ServerToClientTableList
194
186
  | ServerToClientTableRows
195
187
  | ServerToClientMenus
196
- | ServerToClientMenu
188
+ | ServerToClientMenuResponse
197
189
  | ServerToClientMenuReject
198
190
  | ServerToClientMenuSessionTableAction
199
191
  | ServerToClientRPC
@@ -229,13 +221,6 @@ export interface ClientToServerEnable {
229
221
  type: "ENABLE_VP";
230
222
  viewPortId: string;
231
223
  }
232
- export interface ClientToServerTableList {
233
- type: "GET_TABLE_LIST";
234
- }
235
- export interface ClientToServerTableMeta {
236
- type: "GET_TABLE_META";
237
- table: VuuTable;
238
- }
239
224
  export interface ClientToServerCreateViewPort {
240
225
  columns: VuuColumns;
241
226
  filterSpec: VuuFilter;
@@ -269,14 +254,6 @@ export interface ClientToServerViewPortRange {
269
254
  type: "CHANGE_VP_RANGE";
270
255
  viewPortId: string;
271
256
  }
272
- export interface ClientToServerVisualLinks {
273
- type: "GET_VP_VISUAL_LINKS";
274
- vpId: string;
275
- }
276
- export interface ClientToServerMenus {
277
- type: "GET_VIEW_PORT_MENUS";
278
- vpId: string;
279
- }
280
257
  export interface ClientToServerOpenTreeNode {
281
258
  type: "OPEN_TREE_NODE";
282
259
  vpId: string;
@@ -310,56 +287,6 @@ export declare type TypeAheadMethod =
310
287
 
311
288
  export declare type RpcMethod = TypeAheadMethod | "addRowsFromInstruments";
312
289
 
313
- export interface ClientToServerViewportRpcCall {
314
- type: "VIEW_PORT_RPC_CALL";
315
- rpcName: string;
316
- namedParams: { [key: string]: VuuRowDataItemType };
317
- params: string[];
318
- vpId: string;
319
- }
320
-
321
- export interface ClientToServerGetUniqueValues {
322
- type: "RPC_CALL";
323
- method: "getUniqueFieldValues";
324
- service: "TypeAheadRpcHandler";
325
- params: [VuuTable, string];
326
- }
327
- export interface ClientToServerGetUniqueValuesStartingWith {
328
- type: "RPC_CALL";
329
- method: "getUniqueFieldValuesStartingWith";
330
- service: "TypeAheadRpcHandler";
331
- params: [VuuTable, string, string];
332
- }
333
-
334
- export declare type VuuRpcRequest =
335
- | ClientToServerGetUniqueValues
336
- | ClientToServerGetUniqueValuesStartingWith;
337
- // add remaining Rpc calls here
338
-
339
- export interface ClientToServerMenuBaseRPC {
340
- rpcName: string;
341
- vpId: string;
342
- }
343
- export interface ClientToServerMenuSelectRPC extends ClientToServerMenuBaseRPC {
344
- type: "VIEW_PORT_MENUS_SELECT_RPC";
345
- }
346
- export interface ClientToServerMenuTableRPC extends ClientToServerMenuBaseRPC {
347
- type: "VIEW_PORT_MENU_TABLE_RPC";
348
- }
349
-
350
- export type VuuRowRecord = { [key: string]: VuuRowDataItemType };
351
- export interface ClientToServerMenuRowRPC extends ClientToServerMenuBaseRPC {
352
- type: "VIEW_PORT_MENU_ROW_RPC";
353
- rowKey: string;
354
- row: VuuRowRecord;
355
- }
356
- export interface ClientToServerMenuCellRPC extends ClientToServerMenuBaseRPC {
357
- field: string;
358
- rowKey: string;
359
- value: VuuColumnDataType;
360
- type: "VIEW_PORT_MENU_CELL_RPC";
361
- }
362
-
363
290
  export interface ClientToServerEditCellRpc {
364
291
  rowKey: string;
365
292
  type: "VP_EDIT_CELL_RPC";
@@ -393,12 +320,6 @@ export type ClientToServerEditRpc =
393
320
  | ClientToServerEditRowRpc
394
321
  | ClientToServerSubmitFormRpc;
395
322
 
396
- export type ClientToServerMenuRPC =
397
- | ClientToServerMenuRowRPC
398
- | ClientToServerMenuCellRPC
399
- | ClientToServerMenuSelectRPC
400
- | ClientToServerMenuTableRPC;
401
-
402
323
  export type ClientToServerMenuRPCType =
403
324
  | "VIEW_PORT_MENUS_SELECT_RPC"
404
325
  | "VIEW_PORT_MENU_TABLE_RPC"
@@ -430,9 +351,131 @@ export declare type ClientToServerBody =
430
351
  | ClientToServerRemoveLink
431
352
  | ClientToServerMenuRPC
432
353
  | ClientToServerViewportRpcCall
433
- | VuuRpcRequest;
354
+ | ClientToServerRpcRequest;
355
+
356
+ /**
357
+ * RPC type messages
358
+ *
359
+ * Vuu supports three distinct class of RPC message
360
+ *
361
+ * 1) RPC
362
+ * This is a 'standalone' RPC call unrelated to any particular viewport. The only example
363
+ * right now is the typeahead service
364
+ *
365
+ * 2) Viewport RPC
366
+ *
367
+ * There are no generic messages in this category, they will tend to be specific to a
368
+ * business module. Examples found in the Vuu project include rpcNames "createBasket",
369
+ * "addConstituent", "sendToMarket" etc in the BASKET module.
370
+ *
371
+ * There is a new proposed set of generic rpc calls, related to bulk edit operations
372
+ * - "VP_BULK_EDIT_SUBMIT_RPC"
373
+ * - "VP_BULK_EDIT_COLUMN_CELLS_RPC"
374
+ * These are not yet impelmented in the Vuu server and liable to change
375
+ *
376
+ * 3) Menu RPC
377
+ *
378
+ * These are RPC calls submitted when user clicks a menu item from the menu structure
379
+ * defined on the server (see VIEW_PORT_MENUS_RESP above). There are 4 categories of
380
+ * Menu RPC calls, corresponding to the four values of the menu 'context' property
381
+ * - grid
382
+ * - row
383
+ * - cell
384
+ * - selected-rows
385
+ *
386
+ */
387
+
388
+ // RPC
389
+ export declare type ClientToServerRpcRequest = {
390
+ type: "RPC_CALL";
391
+ service: "TypeAheadRpcHandler";
392
+ } & (
393
+ | {
394
+ method: "getUniqueFieldValues";
395
+ params: [VuuTable, string];
396
+ }
397
+ | {
398
+ method: "getUniqueFieldValuesStartingWith";
399
+ params: [VuuTable, string, string];
400
+ }
401
+ );
434
402
 
435
- /** Menu RPC services */
403
+ export interface ServerToClientRPC {
404
+ error: null | unknown;
405
+ type: "RPC_RESP";
406
+ method: "getUniqueFieldValues" | "getUniqueFieldValuesStartingWith";
407
+ result: string[];
408
+ }
409
+
410
+ // ViewportRPC
411
+ export interface ClientToServerViewportRpcCall {
412
+ type: "VIEW_PORT_RPC_CALL";
413
+ rpcName: string;
414
+ namedParams: { [key: string]: VuuRowDataItemType };
415
+ params: string[];
416
+ vpId: string;
417
+ }
418
+
419
+ export interface ServerToClientViewportRpcResponse {
420
+ action: {
421
+ key?: string;
422
+ msg?: string;
423
+ type: "VP_RPC_FAILURE" | "VP_RPC_SUCCESS" | "VP_CREATE_SUCCESS";
424
+ };
425
+ type: "VIEW_PORT_RPC_REPONSE";
426
+ method: string;
427
+ namedParams: { [key: string]: VuuRowDataItemType };
428
+ params: string[];
429
+ vpId: string;
430
+ }
431
+
432
+ // MenuRPC
433
+ export type ClientToServerMenuRPC =
434
+ | ClientToServerMenuRowRPC
435
+ | ClientToServerMenuCellRPC
436
+ | ClientToServerMenuSelectRPC
437
+ | ClientToServerMenuGridRPC;
438
+
439
+ export interface ClientToServerMenuSelectRPC {
440
+ rpcName: string;
441
+ type: "VIEW_PORT_MENUS_SELECT_RPC";
442
+ vpId: string;
443
+ }
444
+ export interface ClientToServerMenuGridRPC {
445
+ rpcName: string;
446
+ type: "VIEW_PORT_MENU_TABLE_RPC";
447
+ vpId: string;
448
+ }
449
+
450
+ export interface ClientToServerMenuRowRPC {
451
+ row: VuuRowRecord;
452
+ rowKey: string;
453
+ rpcName: string;
454
+ type: "VIEW_PORT_MENU_ROW_RPC";
455
+ vpId: string;
456
+ }
457
+ export interface ClientToServerMenuCellRPC {
458
+ field: string;
459
+ rpcName: string;
460
+ rowKey: string;
461
+ type: "VIEW_PORT_MENU_CELL_RPC";
462
+ value: VuuColumnDataType;
463
+ vpId: string;
464
+ }
465
+
466
+ export interface ServerToClientMenuResponse {
467
+ action: OpenDialogAction | NoAction | ShowNotificationAction;
468
+ rpcName: string;
469
+ type: "VIEW_PORT_MENU_RESP";
470
+ vpId: string;
471
+ }
472
+
473
+ export interface ServerToClientMenuReject {
474
+ error: string;
475
+ rpcName: string;
476
+ type: "VIEW_PORT_MENU_REJ";
477
+ vpId: string;
478
+ }
436
479
 
437
480
  // prettier-ignore
438
481
  export declare type VuuColumnDataType = "int" | "long" | "double" | "string" | "char" | "boolean";
@@ -514,6 +557,9 @@ export declare type VuuLinkDescriptor = {
514
557
  link: VuuLink;
515
558
  };
516
559
 
560
+ // used in MenuRPC row message
561
+ export type VuuRowRecord = { [key: string]: VuuRowDataItemType };
562
+
517
563
  /**
518
564
  * LinkDescriptor with label is not strictly part of the Vuu Protocol
519
565
  *
@@ -538,9 +584,21 @@ export interface ServerToClientLoginSuccess {
538
584
  type: "LOGIN_SUCCESS";
539
585
  token: string;
540
586
  }
541
- export interface ServerToClientTableList {
542
- type: "TABLE_LIST_RESP";
543
- tables: VuuTable[];
544
- }
545
587
 
546
588
  export type VuuTableList = Pick<ServerToClientTableList, "tables">;
589
+
590
+ // Menu Response Actions
591
+ export interface ShowNotificationAction {
592
+ type: "SHOW_NOTIFICATION_ACTION";
593
+ message: string;
594
+ title?: string;
595
+ }
596
+
597
+ export interface OpenDialogAction {
598
+ renderComponent?: string;
599
+ type: "OPEN_DIALOG_ACTION";
600
+ table: VuuTable;
601
+ }
602
+ export interface NoAction {
603
+ type: "NO_ACTION";
604
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vuu-ui/vuu-protocol-types",
3
- "version": "0.8.73",
3
+ "version": "0.8.74",
4
4
  "author": "heswell",
5
5
  "license": "Apache-2.0",
6
6
  "dependencies": {},