@proteos/sdk 0.51.0 → 0.52.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/src/meta/types.ts CHANGED
@@ -1,6 +1,12 @@
1
1
  import { z } from 'zod'
2
2
  import type { AuditFields, ListOptions } from '../types/common.js'
3
3
  import { AuditFieldsSchema } from '../types/common.js'
4
+ import {
5
+ type LayoutElement,
6
+ LayoutElementSchema,
7
+ type LayoutTab,
8
+ LayoutTabSchema,
9
+ } from './layout/elements.js'
4
10
  import { type PageLayout, PageLayoutSchema } from './layout/page-layout.js'
5
11
 
6
12
  export type { PageLayout } from './layout/page-layout.js'
@@ -368,6 +374,13 @@ export interface Attribute {
368
374
  * Mirrors `IsPlatformManaged` in the Go `metamodel.Attribute`.
369
375
  */
370
376
  is_platform_managed?: boolean
377
+ /**
378
+ * Server-stamped back-reference to the entity extension that contributes
379
+ * this attribute to its host entity. Present only on a host's merged
380
+ * attribute list; ignored (stripped and re-derived) on writes. Mirrors
381
+ * `ExtensionKey` in the Go `metamodel.Attribute`.
382
+ */
383
+ extension_key?: string
371
384
  /**
372
385
  * Attribute-level permissions. Absent means unrestricted (today's behaviour).
373
386
  * Platform-managed attributes cannot carry restrictions.
@@ -485,6 +498,7 @@ export const AttributeSchema = z.object({
485
498
  is_nullable: z.boolean().optional(),
486
499
  is_unique: z.boolean(),
487
500
  is_read_only: z.boolean().optional(),
501
+ extension_key: z.string().optional(),
488
502
  restrictions: AttributeRestrictionsSchema.optional(),
489
503
  default_value: z.unknown().optional(),
490
504
  meta: z.unknown().optional(),
@@ -882,6 +896,12 @@ export interface Column {
882
896
  attribute: string
883
897
  label: string
884
898
  width: number
899
+ /**
900
+ * Server-stamped back-reference to the list extension that contributes this
901
+ * column to its host list. Present only on a host's merged column list;
902
+ * ignored (stripped and re-derived) on writes.
903
+ */
904
+ extension_key?: string
885
905
  }
886
906
 
887
907
  /**
@@ -948,6 +968,8 @@ export interface PageAction {
948
968
  params?: Record<string, string>
949
969
  inputs?: Record<string, string>
950
970
  skip_confirmation?: boolean
971
+ /** List-extension stamp on a toolbar action a list extension appended to its host list. */
972
+ extension_key?: string
951
973
  }
952
974
 
953
975
  export const PageActionSchema = z.object({
@@ -959,6 +981,7 @@ export const PageActionSchema = z.object({
959
981
  params: z.record(z.string()).optional(),
960
982
  inputs: z.record(z.string()).optional(),
961
983
  skip_confirmation: z.boolean().optional(),
984
+ extension_key: z.string().optional(),
962
985
  })
963
986
 
964
987
  /**
@@ -1002,6 +1025,7 @@ export const ColumnSchema = z.object({
1002
1025
  attribute: z.string(),
1003
1026
  label: z.string(),
1004
1027
  width: z.number(),
1028
+ extension_key: z.string().optional(),
1005
1029
  })
1006
1030
 
1007
1031
  export const SortConfigSchema = z.object({
@@ -1250,6 +1274,7 @@ export type MenuItemType = (typeof MenuItemType)[keyof typeof MenuItemType]
1250
1274
  * Menu item definition. Matches the backend JSON shape for nested menus.
1251
1275
  */
1252
1276
  export interface MenuItem {
1277
+ /** Stable within the menu; the menu's extension API (menu-configuration extensions anchor on it). */
1253
1278
  id: string
1254
1279
  order: number
1255
1280
  label: string
@@ -1257,6 +1282,12 @@ export interface MenuItem {
1257
1282
  icon: string
1258
1283
  reference?: string
1259
1284
  children: MenuItem[] | null
1285
+ /** Server stamp: the item was contributed by this menu-configuration extension. Never authored. */
1286
+ extension_key?: string
1287
+ /** Server stamp: a `remove` tombstone — consumers skip the item. Never authored. */
1288
+ is_hidden?: boolean
1289
+ /** Server stamp: the host's own item this stamped item displaced (`replace` / `remove`). Never authored. */
1290
+ replaced_item?: MenuItem
1260
1291
  }
1261
1292
 
1262
1293
  /**
@@ -1280,6 +1311,9 @@ export const MenuItemSchema = z.lazy(() =>
1280
1311
  icon: z.string(),
1281
1312
  reference: z.string().optional(),
1282
1313
  children: z.array(MenuItemSchema).nullable(),
1314
+ extension_key: z.string().optional(),
1315
+ is_hidden: z.boolean().optional(),
1316
+ replaced_item: z.lazy(() => MenuItemSchema).optional(),
1283
1317
  }),
1284
1318
  ) as unknown as z.ZodType<MenuItem>
1285
1319
 
@@ -1325,6 +1359,370 @@ export interface UpdateMenuConfigurationRequest {
1325
1359
  is_default?: boolean
1326
1360
  }
1327
1361
 
1362
+ // ============================================================================
1363
+ // EntityExtension Types
1364
+ // ============================================================================
1365
+
1366
+ /**
1367
+ * EntityExtension — attributes contributed to ONE existing host entity by a
1368
+ * resource that does not own it (typically a second module). The host's
1369
+ * `attributes` are the materialized merge: its own attributes plus every
1370
+ * extension's, each stamped with `extension_key`. The row itself stores the
1371
+ * author's list unstamped. `key` is the identity; `entity_slug` is immutable
1372
+ * after create (delete and recreate to re-host).
1373
+ */
1374
+ export interface EntityExtension extends AuditFields {
1375
+ key: string
1376
+ org_id: string
1377
+ name: string
1378
+ description: string
1379
+ /** The host entity the attributes are merged into. */
1380
+ entity_slug: string
1381
+ module_slug: string
1382
+ /** The contributed definitions, exactly as authored (no `extension_key`). */
1383
+ attributes: Attribute[]
1384
+ }
1385
+
1386
+ export const EntityExtensionSchema = AuditFieldsSchema.extend({
1387
+ key: z.string(),
1388
+ org_id: z.string(),
1389
+ name: z.string(),
1390
+ description: z.string(),
1391
+ entity_slug: z.string(),
1392
+ module_slug: z.string(),
1393
+ attributes: z.array(AttributeSchema),
1394
+ })
1395
+
1396
+ export interface ListEntityExtensionsOptions extends MetaListOptions {
1397
+ key?: string
1398
+ name?: string
1399
+ entity_slug?: string
1400
+ module_slug?: string
1401
+ }
1402
+
1403
+ /**
1404
+ * Request to create an entity extension: at least one attribute, no platform
1405
+ * attribute names, no `extension_key` (the server stamps it on the host).
1406
+ */
1407
+ export interface CreateEntityExtensionRequest {
1408
+ key: string
1409
+ name?: string
1410
+ description?: string
1411
+ entity_slug: string
1412
+ module_slug?: string
1413
+ attributes: Attribute[]
1414
+ }
1415
+
1416
+ /**
1417
+ * Partial update. `attributes`, when present, replaces the whole contributed
1418
+ * list. `entity_slug` is immutable — delete and recreate to re-host.
1419
+ */
1420
+ export interface UpdateEntityExtensionRequest {
1421
+ name?: string
1422
+ description?: string
1423
+ module_slug?: string
1424
+ attributes?: Attribute[]
1425
+ }
1426
+
1427
+ // ============================================================================
1428
+ // PageExtension Types
1429
+ // ============================================================================
1430
+
1431
+ /**
1432
+ * Where a placement's block goes relative to its anchor. `first` / `last`
1433
+ * mean "inside this container", `before` / `after` mean "next to this node"
1434
+ * (a sibling of the same kind: element next to element, tab next to tab).
1435
+ */
1436
+ export type ExtensionPosition = 'before' | 'after' | 'first' | 'last'
1437
+
1438
+ export const ExtensionPositionSchema = z.enum(['before', 'after', 'first', 'last'])
1439
+
1440
+ /**
1441
+ * Virtual anchors naming the layout roots (`first` / `last` only). Dots keep
1442
+ * them out of the kebab-case authored-id namespace.
1443
+ */
1444
+ export const PAGE_EXTENSION_ANCHOR_MAIN = 'layout.main'
1445
+ export const PAGE_EXTENSION_ANCHOR_SIDE_PANEL = 'layout.side_panel'
1446
+
1447
+ /**
1448
+ * One anchored block: the anchor (an element id, a tab id, or a virtual root
1449
+ * anchor) in the host's OWN layout, a position, and the payload. Exactly one
1450
+ * of `elements` / `tabs` is set; which one is right follows from the anchor —
1451
+ * a tabs element (`first` / `last`) or a tab id (`before` / `after`) takes
1452
+ * `tabs`, everything else takes `elements`. The payload lands as ONE
1453
+ * contiguous run in author order. Every element and tab needs an authored id.
1454
+ */
1455
+ export interface PageExtensionPlacement {
1456
+ anchor_id: string
1457
+ position: ExtensionPosition
1458
+ elements?: LayoutElement[]
1459
+ tabs?: LayoutTab[]
1460
+ }
1461
+
1462
+ export const PageExtensionPlacementSchema = z.object({
1463
+ anchor_id: z.string().min(1),
1464
+ position: ExtensionPositionSchema,
1465
+ elements: z.array(LayoutElementSchema).optional(),
1466
+ tabs: z.array(LayoutTabSchema).optional(),
1467
+ })
1468
+
1469
+ /**
1470
+ * PageExtension — anchored layout blocks contributed to ONE existing host page
1471
+ * by a resource that does not own it (typically a second module). The host's
1472
+ * `layout` is the materialized merge: its own tree plus every extension's
1473
+ * placements, each contributed element and tab stamped with `extension_key`.
1474
+ * The row itself stores the author's placements unstamped. `key` is the
1475
+ * identity; `page_slug` is immutable after create (delete and recreate to
1476
+ * re-host).
1477
+ */
1478
+ export interface PageExtension extends AuditFields {
1479
+ key: string
1480
+ org_id: string
1481
+ name: string
1482
+ description: string
1483
+ /** The host page the placements are merged into. */
1484
+ page_slug: string
1485
+ module_slug: string
1486
+ /** The contributed blocks, exactly as authored (no `extension_key`). */
1487
+ placements: PageExtensionPlacement[]
1488
+ }
1489
+
1490
+ export const PageExtensionSchema = AuditFieldsSchema.extend({
1491
+ key: z.string(),
1492
+ org_id: z.string(),
1493
+ name: z.string(),
1494
+ description: z.string(),
1495
+ page_slug: z.string(),
1496
+ module_slug: z.string(),
1497
+ placements: z.array(PageExtensionPlacementSchema),
1498
+ })
1499
+
1500
+ export interface ListPageExtensionsOptions extends MetaListOptions {
1501
+ key?: string
1502
+ name?: string
1503
+ page_slug?: string
1504
+ module_slug?: string
1505
+ }
1506
+
1507
+ /**
1508
+ * Request to create a page extension: at least one placement, an authored id
1509
+ * on every contributed element and tab, no `extension_key` (the server stamps
1510
+ * it on the host).
1511
+ */
1512
+ export interface CreatePageExtensionRequest {
1513
+ key: string
1514
+ name?: string
1515
+ description?: string
1516
+ page_slug: string
1517
+ module_slug?: string
1518
+ placements: PageExtensionPlacement[]
1519
+ }
1520
+
1521
+ /**
1522
+ * Partial update. `placements`, when present, replaces the whole contributed
1523
+ * list. `page_slug` is immutable — delete and recreate to re-host.
1524
+ */
1525
+ export interface UpdatePageExtensionRequest {
1526
+ name?: string
1527
+ description?: string
1528
+ module_slug?: string
1529
+ placements?: PageExtensionPlacement[]
1530
+ }
1531
+
1532
+ // ============================================================================
1533
+ // MenuConfigurationExtension Types
1534
+ // ============================================================================
1535
+
1536
+ /**
1537
+ * Where a menu placement's block goes relative to its anchor. The four insert
1538
+ * positions are the shared `ExtensionPosition`; `replace` swaps the anchor
1539
+ * (whole subtree) for the block, `remove` hides it. Both keep the host's
1540
+ * original under `replaced_item` on the materialized tree.
1541
+ */
1542
+ export type MenuConfigurationExtensionPosition = ExtensionPosition | 'replace' | 'remove'
1543
+
1544
+ export const MenuConfigurationExtensionPositionSchema = z.enum([
1545
+ 'before',
1546
+ 'after',
1547
+ 'first',
1548
+ 'last',
1549
+ 'replace',
1550
+ 'remove',
1551
+ ])
1552
+
1553
+ /** Virtual anchor naming the menu's root item list (`first` / `last` only). */
1554
+ export const MENU_CONFIGURATION_EXTENSION_ANCHOR_ITEMS = 'menu.items'
1555
+
1556
+ /**
1557
+ * One anchored block: the anchor (an item id in the host's OWN tree, or the
1558
+ * virtual root `menu.items`), a position, and the contributed items (one
1559
+ * contiguous run in author order). `remove` carries no items; every other
1560
+ * position needs at least one. `first` / `last` on an item go into its
1561
+ * children (groups only). Every contributed item needs an authored id.
1562
+ */
1563
+ export interface MenuConfigurationExtensionPlacement {
1564
+ anchor_id: string
1565
+ position: MenuConfigurationExtensionPosition
1566
+ items?: MenuItem[]
1567
+ }
1568
+
1569
+ export const MenuConfigurationExtensionPlacementSchema = z.object({
1570
+ anchor_id: z.string().min(1),
1571
+ position: MenuConfigurationExtensionPositionSchema,
1572
+ items: z.array(MenuItemSchema).optional(),
1573
+ })
1574
+
1575
+ /**
1576
+ * MenuConfigurationExtension — items contributed to ONE existing host menu
1577
+ * configuration by a resource that does not own it (typically a second
1578
+ * module). The host's `items` are the materialized merge: its own tree plus
1579
+ * every extension's placements, each contributed item stamped with
1580
+ * `extension_key` (a replaced / removed host item kept under `replaced_item`).
1581
+ * The row itself stores the author's placements unstamped. `key` is the
1582
+ * identity; `menu_slug` is immutable after create (delete and recreate to
1583
+ * re-host).
1584
+ */
1585
+ export interface MenuConfigurationExtension extends AuditFields {
1586
+ key: string
1587
+ org_id: string
1588
+ name: string
1589
+ description: string
1590
+ /** The host menu configuration the placements are merged into. */
1591
+ menu_slug: string
1592
+ module_slug: string
1593
+ /** The contributed blocks, exactly as authored (no `extension_key`). */
1594
+ placements: MenuConfigurationExtensionPlacement[]
1595
+ }
1596
+
1597
+ export const MenuConfigurationExtensionSchema = AuditFieldsSchema.extend({
1598
+ key: z.string(),
1599
+ org_id: z.string(),
1600
+ name: z.string(),
1601
+ description: z.string(),
1602
+ menu_slug: z.string(),
1603
+ module_slug: z.string(),
1604
+ placements: z.array(MenuConfigurationExtensionPlacementSchema),
1605
+ })
1606
+
1607
+ export interface ListMenuConfigurationExtensionsOptions extends MetaListOptions {
1608
+ key?: string
1609
+ name?: string
1610
+ menu_slug?: string
1611
+ module_slug?: string
1612
+ }
1613
+
1614
+ /**
1615
+ * Request to create a menu-configuration extension: at least one placement,
1616
+ * an authored id on every contributed item, no `extension_key` (the server
1617
+ * stamps it on the host).
1618
+ */
1619
+ export interface CreateMenuConfigurationExtensionRequest {
1620
+ key: string
1621
+ name?: string
1622
+ description?: string
1623
+ menu_slug: string
1624
+ module_slug?: string
1625
+ placements: MenuConfigurationExtensionPlacement[]
1626
+ }
1627
+
1628
+ /**
1629
+ * Partial update. `placements`, when present, replaces the whole contributed
1630
+ * list. `menu_slug` is immutable — delete and recreate to re-host.
1631
+ */
1632
+ export interface UpdateMenuConfigurationExtensionRequest {
1633
+ name?: string
1634
+ description?: string
1635
+ module_slug?: string
1636
+ placements?: MenuConfigurationExtensionPlacement[]
1637
+ }
1638
+
1639
+ // ============================================================================
1640
+ // ListExtension Types
1641
+ // ============================================================================
1642
+
1643
+ /**
1644
+ * One anchored run of columns. `anchor_attribute` names a column of the host's
1645
+ * OWN column list by its attribute path (a column's identity); required for
1646
+ * `before` / `after`, must be empty for `first` / `last` (the ends of the
1647
+ * list). The columns land as one contiguous run in author order.
1648
+ */
1649
+ export interface ListExtensionColumnPlacement {
1650
+ anchor_attribute?: string
1651
+ position: ExtensionPosition
1652
+ columns: Column[]
1653
+ }
1654
+
1655
+ export const ListExtensionColumnPlacementSchema = z.object({
1656
+ anchor_attribute: z.string().optional(),
1657
+ position: ExtensionPositionSchema,
1658
+ columns: z.array(ColumnSchema).min(1),
1659
+ })
1660
+
1661
+ /**
1662
+ * ListExtension — columns and toolbar actions contributed to ONE existing host
1663
+ * list by a resource that does not own it. The host's `columns` / `actions`
1664
+ * are the materialized merge, each contributed one stamped `extension_key`;
1665
+ * the row stores the author's payload unstamped. `key` is the identity;
1666
+ * `list_slug` is immutable after create. Sorting, filters and selection mode
1667
+ * stay the owner's.
1668
+ */
1669
+ export interface ListExtension extends AuditFields {
1670
+ key: string
1671
+ org_id: string
1672
+ name: string
1673
+ description: string
1674
+ /** The host list the columns and actions are merged into. */
1675
+ list_slug: string
1676
+ module_slug: string
1677
+ columns: ListExtensionColumnPlacement[]
1678
+ /** Appended after the host's own toolbar actions (no anchor). */
1679
+ actions: PageAction[]
1680
+ }
1681
+
1682
+ export const ListExtensionSchema = AuditFieldsSchema.extend({
1683
+ key: z.string(),
1684
+ org_id: z.string(),
1685
+ name: z.string(),
1686
+ description: z.string(),
1687
+ list_slug: z.string(),
1688
+ module_slug: z.string(),
1689
+ columns: z.array(ListExtensionColumnPlacementSchema),
1690
+ actions: z.array(PageActionSchema),
1691
+ })
1692
+
1693
+ export interface ListListExtensionsOptions extends MetaListOptions {
1694
+ key?: string
1695
+ name?: string
1696
+ list_slug?: string
1697
+ module_slug?: string
1698
+ }
1699
+
1700
+ /**
1701
+ * Request to create a list extension: at least one column placement or
1702
+ * action, no `extension_key` (the server stamps it on the host).
1703
+ */
1704
+ export interface CreateListExtensionRequest {
1705
+ key: string
1706
+ name?: string
1707
+ description?: string
1708
+ list_slug: string
1709
+ module_slug?: string
1710
+ columns?: ListExtensionColumnPlacement[]
1711
+ actions?: PageAction[]
1712
+ }
1713
+
1714
+ /**
1715
+ * Partial update. `columns` / `actions`, when present, each replace their
1716
+ * whole list. `list_slug` is immutable — delete and recreate to re-host.
1717
+ */
1718
+ export interface UpdateListExtensionRequest {
1719
+ name?: string
1720
+ description?: string
1721
+ module_slug?: string
1722
+ columns?: ListExtensionColumnPlacement[]
1723
+ actions?: PageAction[]
1724
+ }
1725
+
1328
1726
  // ============================================================================
1329
1727
  // AppConfiguration Types
1330
1728
  // ============================================================================