@heswell/vuu-portal 2.2.3 → 2.2.4

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/195.js CHANGED
@@ -1,4 +1,4 @@
1
- import { MODULE_ADMIN_RPC, executeModuleAdminRpc, managedModuleColumnValues, managedModulePermissionValues, splitNotificationTopics, validateModuleConfig } from "@heswell/module-admin";
1
+ import { MODULE_ADMIN_RPC, deserializeModuleWorkspace, executeModuleAdminRpc, managedModuleColumnValues, managedModulePermissionValues, normalizeModuleWorkspace, splitNotificationTopics, validateModuleConfig } from "@heswell/module-admin";
2
2
  import { ConfigFactory, EditSessionRpcHandler, ModuleFactory, NotificationModule, NullProvider, PermissionFilter, Provider, TableDef, VUU_DEFAULT_COLUMNS, ViewPortDef, createConfiguredAuthProviders, createVuuServerApplication, getLogger } from "@heswell/vuu-server";
3
3
  import node_fs from "node:fs";
4
4
  import node_path from "node:path";
@@ -32,7 +32,8 @@ function readModules(table) {
32
32
  mfScope: stringValue(table, row, "mfScope"),
33
33
  mfUrl: stringValue(table, row, "mfUrl"),
34
34
  ...navIcon(table, row),
35
- ...navMetadata(table, row)
35
+ ...navMetadata(table, row),
36
+ ...workspaceMetadata(table, row)
36
37
  };
37
38
  });
38
39
  }
@@ -55,6 +56,12 @@ function navMetadata(table, row) {
55
56
  }
56
57
  return metadata;
57
58
  }
59
+ function workspaceMetadata(table, row) {
60
+ const workspace = deserializeModuleWorkspace(optionalValue(table, row, "workspace"));
61
+ return workspace ? {
62
+ workspace
63
+ } : {};
64
+ }
58
65
  function optionalValue(table, row, column) {
59
66
  const index = table.tableDef.columns.findIndex(({ name })=>name === column);
60
67
  return -1 === index ? void 0 : row[index];
@@ -188,6 +195,10 @@ const modulesTable = TableDef({
188
195
  name: "notificationTopics",
189
196
  dataType: "string"
190
197
  },
198
+ {
199
+ name: "workspace",
200
+ dataType: "string"
201
+ },
191
202
  ...VUU_DEFAULT_COLUMNS
192
203
  ],
193
204
  keyField: "id",
@@ -370,11 +381,17 @@ function readModulesFile(filePath) {
370
381
  function cloneModules(modules) {
371
382
  return modules.map((module)=>Object.fromEntries(Object.entries(module).filter(([, value])=>void 0 !== value).map(([key, value])=>[
372
383
  key,
373
- Array.isArray(value) ? [
374
- ...value
375
- ] : value
384
+ cloneValue(value)
376
385
  ])));
377
386
  }
387
+ function cloneValue(value) {
388
+ if (Array.isArray(value)) return value.map(cloneValue);
389
+ if (isRecord(value)) return Object.fromEntries(Object.entries(value).map(([key, item])=>[
390
+ key,
391
+ cloneValue(item)
392
+ ]));
393
+ return value;
394
+ }
378
395
  const managedModuleKeys = [
379
396
  "id",
380
397
  "version",
@@ -396,7 +413,8 @@ const managedModuleKeys = [
396
413
  const optionalModuleKeys = [
397
414
  "navOrder",
398
415
  "navBadge",
399
- "notificationTopics"
416
+ "notificationTopics",
417
+ "workspace"
400
418
  ];
401
419
  const retiredModuleKeys = [
402
420
  "vuuConnectionId",
@@ -424,6 +442,11 @@ function parseManagedModule(value, index) {
424
442
  for (const key of optionalModuleKeys){
425
443
  const fieldValue = value[key];
426
444
  if (null == fieldValue) continue;
445
+ if ("workspace" === key) {
446
+ if (!isRecord(fieldValue)) throw new Error(`Modules file entry ${index} field 'workspace' must be an object`);
447
+ module[key] = cloneValue(normalizeModuleWorkspace(fieldValue));
448
+ continue;
449
+ }
427
450
  const valid = "navOrder" === key ? "number" == typeof fieldValue : "navBadge" === key ? "string" == typeof fieldValue : Array.isArray(fieldValue) && fieldValue.every((topic)=>"string" == typeof topic);
428
451
  if (!valid) {
429
452
  const expected = "navOrder" === key ? "a number" : "navBadge" === key ? "a string" : "a list of strings";
@@ -12,7 +12,7 @@
12
12
  # title: "Manage remote modules"
13
13
  # description: "Create new remote module, update existing modules"
14
14
  # enabled: true
15
- # location: "/Modules/Manage Modules"
15
+ # location: "/Admin/Manage Modules"
16
16
  # path: "/modules/admin"
17
17
  # mfComponent: "ModuleAdmin"
18
18
  # mfScope: "moduleAdmin"
@@ -23,4 +23,9 @@
23
23
  # navOrder: 1
24
24
  # navBadge: "modules.pending"
25
25
  # notificationTopics: ["modules"]
26
+ # # Optional: list the module in the workspace Panels palette.
27
+ # workspace:
28
+ # paletteGroup: "Admin"
29
+ # iconUrl: "" # optional; data:image/... or http(s) URL
30
+ # defaultSize: { cols: 6, rows: 4 } # optional; positive integers
26
31
  modules: []
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@heswell/vuu-portal",
3
- "version": "2.2.3",
3
+ "version": "2.2.4",
4
4
  "description": "VUU portal server with remote module discovery",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -26,7 +26,7 @@
26
26
  "author": "heswell",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@heswell/module-admin": "^2.1.0"
29
+ "@heswell/module-admin": "^2.2.0"
30
30
  },
31
31
  "peerDependencies": {
32
32
  "@heswell/vuu-server": "^3.1.0 || ^4.0.0",