@harborclient/sdk 1.3.2 → 1.3.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.
Files changed (102) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/AnchorMenuPanel/index.d.ts +35 -0
  3. package/dist/components/AnchorMenuPanel/index.d.ts.map +1 -0
  4. package/dist/components/AnchorMenuPanel/index.js +364 -0
  5. package/dist/components/ColorPicker/index.d.ts +5 -1
  6. package/dist/components/ColorPicker/index.d.ts.map +1 -1
  7. package/dist/components/ColorPicker/index.js +2 -2
  8. package/dist/components/FilterButton/FilterButtonIcon.d.ts +29 -0
  9. package/dist/components/FilterButton/FilterButtonIcon.d.ts.map +1 -0
  10. package/dist/components/FilterButton/FilterButtonIcon.js +18 -0
  11. package/dist/components/FilterButton/index.d.ts +26 -0
  12. package/dist/components/FilterButton/index.d.ts.map +1 -0
  13. package/dist/components/FilterButton/index.js +14 -0
  14. package/dist/components/FormGroup/index.d.ts +7 -1
  15. package/dist/components/FormGroup/index.d.ts.map +1 -1
  16. package/dist/components/FormGroup/index.js +8 -11
  17. package/dist/components/PageSidebar/index.d.ts +1 -0
  18. package/dist/components/PageSidebar/index.d.ts.map +1 -1
  19. package/dist/components/PageSidebar/index.js +4 -13
  20. package/dist/components/Resizable/applyResizableSizes.d.ts +11 -0
  21. package/dist/components/Resizable/applyResizableSizes.d.ts.map +1 -0
  22. package/dist/components/Resizable/applyResizableSizes.js +34 -0
  23. package/dist/components/Resizable/footerPanelUtils.d.ts +1 -1
  24. package/dist/components/Resizable/footerPanelUtils.js +4 -4
  25. package/dist/components/Resizable/index.d.ts +1 -0
  26. package/dist/components/Resizable/index.d.ts.map +1 -1
  27. package/dist/components/Resizable/index.js +1 -0
  28. package/dist/components/Resizable/useResizable.d.ts +7 -1
  29. package/dist/components/Resizable/useResizable.d.ts.map +1 -1
  30. package/dist/components/Resizable/useResizable.js +141 -11
  31. package/dist/components/RowActionsMenu/index.d.ts +7 -1
  32. package/dist/components/RowActionsMenu/index.d.ts.map +1 -1
  33. package/dist/components/RowActionsMenu/index.js +40 -18
  34. package/dist/components/SettingFieldActions/index.d.ts +42 -0
  35. package/dist/components/SettingFieldActions/index.d.ts.map +1 -0
  36. package/dist/components/SettingFieldActions/index.js +66 -0
  37. package/dist/components/SidebarItem/SidebarDocumentItem.d.ts +6 -6
  38. package/dist/components/SidebarItem/SidebarDocumentItem.d.ts.map +1 -1
  39. package/dist/components/SidebarItem/SidebarDocumentItem.js +4 -4
  40. package/dist/components/SidebarItem/SidebarEnvironmentItem.d.ts +4 -4
  41. package/dist/components/SidebarItem/SidebarEnvironmentItem.d.ts.map +1 -1
  42. package/dist/components/SidebarItem/SidebarEnvironmentItem.js +3 -3
  43. package/dist/components/SidebarItem/SidebarFolderItem.d.ts +5 -5
  44. package/dist/components/SidebarItem/SidebarFolderItem.d.ts.map +1 -1
  45. package/dist/components/SidebarItem/SidebarFolderItem.js +4 -4
  46. package/dist/components/SidebarItem/SidebarHistoryItem.d.ts +13 -1
  47. package/dist/components/SidebarItem/SidebarHistoryItem.d.ts.map +1 -1
  48. package/dist/components/SidebarItem/SidebarHistoryItem.js +3 -3
  49. package/dist/components/SidebarItem/SidebarMarkerDot.d.ts +22 -0
  50. package/dist/components/SidebarItem/SidebarMarkerDot.d.ts.map +1 -0
  51. package/dist/components/SidebarItem/SidebarMarkerDot.js +11 -0
  52. package/dist/components/SidebarItem/SidebarMethodBadge.d.ts +9 -1
  53. package/dist/components/SidebarItem/SidebarMethodBadge.d.ts.map +1 -1
  54. package/dist/components/SidebarItem/SidebarMethodBadge.js +7 -5
  55. package/dist/components/SidebarItem/SidebarRequestItem.d.ts +9 -5
  56. package/dist/components/SidebarItem/SidebarRequestItem.d.ts.map +1 -1
  57. package/dist/components/SidebarItem/SidebarRequestItem.js +4 -4
  58. package/dist/components/SidebarItem/SidebarRunItem.d.ts +9 -1
  59. package/dist/components/SidebarItem/SidebarRunItem.d.ts.map +1 -1
  60. package/dist/components/SidebarItem/SidebarRunItem.js +2 -2
  61. package/dist/components/SidebarItem/SidebarStatusDot.d.ts +11 -1
  62. package/dist/components/SidebarItem/SidebarStatusDot.d.ts.map +1 -1
  63. package/dist/components/SidebarItem/SidebarStatusDot.js +10 -1
  64. package/dist/components/SidebarItem/{SidebarTabGroupItem.d.ts → SidebarWorkspaceItem.d.ts} +9 -9
  65. package/dist/components/SidebarItem/SidebarWorkspaceItem.d.ts.map +1 -0
  66. package/dist/components/SidebarItem/{SidebarTabGroupItem.js → SidebarWorkspaceItem.js} +4 -4
  67. package/dist/components/SidebarItem/index.d.ts +3 -3
  68. package/dist/components/SidebarItem/index.d.ts.map +1 -1
  69. package/dist/components/SidebarItem/index.js +3 -3
  70. package/dist/components/SidebarItem/sidebarItemClasses.d.ts +17 -0
  71. package/dist/components/SidebarItem/sidebarItemClasses.d.ts.map +1 -1
  72. package/dist/components/SidebarItem/sidebarItemClasses.js +26 -2
  73. package/dist/components/SidebarSection/SectionItem.d.ts.map +1 -1
  74. package/dist/components/SidebarSection/SectionItem.js +3 -1
  75. package/dist/components/SortButton/SortButtonIcon.d.ts +29 -0
  76. package/dist/components/SortButton/SortButtonIcon.d.ts.map +1 -0
  77. package/dist/components/SortButton/SortButtonIcon.js +18 -0
  78. package/dist/components/SortButton/SortMenu.d.ts +42 -0
  79. package/dist/components/SortButton/SortMenu.d.ts.map +1 -0
  80. package/dist/components/SortButton/SortMenu.js +137 -0
  81. package/dist/components/SortButton/SortMenuOption.d.ts +35 -0
  82. package/dist/components/SortButton/SortMenuOption.d.ts.map +1 -0
  83. package/dist/components/SortButton/SortMenuOption.js +18 -0
  84. package/dist/components/SortButton/index.d.ts +32 -0
  85. package/dist/components/SortButton/index.d.ts.map +1 -0
  86. package/dist/components/SortButton/index.js +15 -0
  87. package/dist/components/SortButton/sortOptions.d.ts +14 -0
  88. package/dist/components/SortButton/sortOptions.d.ts.map +1 -0
  89. package/dist/components/SortButton/sortOptions.js +1 -0
  90. package/dist/components/TabBar/types.d.ts +1 -1
  91. package/dist/components/index.d.ts +9 -2
  92. package/dist/components/index.d.ts.map +1 -1
  93. package/dist/components/index.js +8 -2
  94. package/dist/runtime/createBridgedPluginContext.js +170 -2
  95. package/dist/snippets.d.ts +22 -0
  96. package/dist/types.d.ts +913 -1
  97. package/dist/types.d.ts.map +1 -1
  98. package/package.json +3 -3
  99. package/dist/components/SidebarItem/SidebarColorDot.d.ts +0 -22
  100. package/dist/components/SidebarItem/SidebarColorDot.d.ts.map +0 -1
  101. package/dist/components/SidebarItem/SidebarColorDot.js +0 -11
  102. package/dist/components/SidebarItem/SidebarTabGroupItem.d.ts.map +0 -1
package/dist/types.d.ts CHANGED
@@ -155,6 +155,10 @@ export interface SettingsSectionContribution extends UiContributionBase {
155
155
  * selects instead of the default collections view.
156
156
  *
157
157
  * Manifest: `contributes.sidebarPanels`. Requires the `ui` permission.
158
+ *
159
+ * To replace the built-in Collections sidebar, set `replaces: "collections"` on
160
+ * the matching manifest entry (not on this runtime object). The host copies that
161
+ * field into the registry when the panel is registered.
158
162
  */
159
163
  export interface SidebarPanelContribution extends UiContributionBase {
160
164
  /**
@@ -167,6 +171,7 @@ export interface SidebarPanelContribution extends UiContributionBase {
167
171
  Component: React.ComponentType;
168
172
  /**
169
173
  * Sort order among plugin sidebar panels. Lower values appear first.
174
+ * Also used as a tie-breaker when choosing among multiple `replaces: "collections"` panels.
170
175
  */
171
176
  order?: number;
172
177
  }
@@ -1406,6 +1411,53 @@ export interface OpenRequestDraftPayload {
1406
1411
  */
1407
1412
  bodyType?: BodyType;
1408
1413
  }
1414
+ /**
1415
+ * Payload for {@link PluginHost.openImageView}.
1416
+ *
1417
+ * Exactly one source form must be provided: a local filesystem `path`, an
1418
+ * `http(s)` `url`, an inline `dataUrl`, or `base64` with `contentType`.
1419
+ */
1420
+ export type OpenImageViewPayload = {
1421
+ /**
1422
+ * Absolute path to a local image file.
1423
+ */
1424
+ path: string;
1425
+ /**
1426
+ * Optional display filename; defaults to the path basename.
1427
+ */
1428
+ fileName?: string;
1429
+ } | {
1430
+ /**
1431
+ * Remote image URL loaded directly by the viewer.
1432
+ */
1433
+ url: string;
1434
+ /**
1435
+ * Optional display filename; defaults to the last URL path segment.
1436
+ */
1437
+ fileName?: string;
1438
+ } | {
1439
+ /**
1440
+ * Full `data:` URL for an inline image.
1441
+ */
1442
+ dataUrl: string;
1443
+ /**
1444
+ * Display filename shown in the tab header.
1445
+ */
1446
+ fileName: string;
1447
+ } | {
1448
+ /**
1449
+ * Base64-encoded image bytes (with or without a `data:` prefix).
1450
+ */
1451
+ base64: string;
1452
+ /**
1453
+ * MIME type used when building a data URL from {@link base64}.
1454
+ */
1455
+ contentType: string;
1456
+ /**
1457
+ * Display filename shown in the tab header.
1458
+ */
1459
+ fileName: string;
1460
+ };
1409
1461
  /**
1410
1462
  * Serializable payload passed to {@link PluginHost.applyRequestDraft}.
1411
1463
  *
@@ -1568,10 +1620,515 @@ export interface CreatedEnvironmentResult {
1568
1620
  */
1569
1621
  name: string;
1570
1622
  }
1623
+ /**
1624
+ * Options for library list APIs that can include archived collections.
1625
+ */
1626
+ export interface LibraryListOptions {
1627
+ /**
1628
+ * When true, include archived collections. Defaults to false (active only).
1629
+ */
1630
+ includeArchived?: boolean;
1631
+ }
1632
+ /**
1633
+ * Lightweight collection row for sidebar trees and discovery.
1634
+ */
1635
+ export interface CollectionSummary {
1636
+ /** Database id. */
1637
+ id: number;
1638
+ /** Stable portable identifier. */
1639
+ uuid: string;
1640
+ /** Display name. */
1641
+ name: string;
1642
+ /** Optional sidebar marker color. */
1643
+ marker?: string | null;
1644
+ /** ISO 8601 creation timestamp. */
1645
+ created_at: string;
1646
+ /** Storage connection id when the collection is remote-backed. */
1647
+ connectionId?: string;
1648
+ /** When true, the collection is archived. */
1649
+ archived?: boolean;
1650
+ /** When true on a team hub collection, non-admins cannot delete it. */
1651
+ deletion_locked?: boolean;
1652
+ }
1653
+ /**
1654
+ * Lightweight folder row for sidebar trees.
1655
+ */
1656
+ export interface FolderSummary {
1657
+ /** Database id. */
1658
+ id: number;
1659
+ /** Stable portable identifier. */
1660
+ uuid: string;
1661
+ /** Parent collection id. */
1662
+ collection_id: number;
1663
+ /** Parent folder id, or null at collection root. */
1664
+ parent_folder_id: number | null;
1665
+ /** Display name. */
1666
+ name: string;
1667
+ /** Sibling sort order. */
1668
+ sort_order: number;
1669
+ /** Optional sidebar marker color. */
1670
+ marker?: string | null;
1671
+ /** ISO 8601 creation timestamp. */
1672
+ created_at: string;
1673
+ }
1674
+ /**
1675
+ * Lightweight saved-request row for sidebar trees (no body/auth).
1676
+ */
1677
+ export interface SavedRequestSummary {
1678
+ /** Database id. */
1679
+ id: number;
1680
+ /** Stable portable identifier. */
1681
+ uuid: string;
1682
+ /** Parent collection id. */
1683
+ collection_id: number;
1684
+ /** Parent folder id, or null at collection root. */
1685
+ folder_id: number | null;
1686
+ /** Display name. */
1687
+ name: string;
1688
+ /** HTTP method. */
1689
+ method: HttpMethod;
1690
+ /** Sibling sort order. */
1691
+ sort_order: number;
1692
+ /** Optional sidebar marker color. */
1693
+ marker?: string | null;
1694
+ /** ISO 8601 creation timestamp. */
1695
+ created_at: string;
1696
+ }
1697
+ /**
1698
+ * Lightweight markdown document row for sidebar trees (no content body).
1699
+ */
1700
+ export interface DocumentSummary {
1701
+ /** Database id. */
1702
+ id: number;
1703
+ /** Stable portable identifier. */
1704
+ uuid: string;
1705
+ /** Parent collection id. */
1706
+ collection_id: number;
1707
+ /** Parent folder id, or null at collection root. */
1708
+ folder_id: number | null;
1709
+ /** Display file name. */
1710
+ name: string;
1711
+ /** Sibling sort order. */
1712
+ sort_order: number;
1713
+ /** Optional sidebar marker color. */
1714
+ marker?: string | null;
1715
+ /** ISO 8601 creation timestamp. */
1716
+ created_at: string;
1717
+ /** ISO 8601 last-updated timestamp. */
1718
+ updated_at: string;
1719
+ }
1720
+ /**
1721
+ * One collection node in a {@link LibraryTreeSnapshot}, including nested contents.
1722
+ */
1723
+ export interface LibraryTreeCollectionNode extends CollectionSummary {
1724
+ /** Folders in this collection (flat list; nest via parent_folder_id). */
1725
+ folders: FolderSummary[];
1726
+ /** Saved requests in this collection (flat list; nest via folder_id). */
1727
+ requests: SavedRequestSummary[];
1728
+ /** Markdown documents in this collection (flat list; nest via folder_id). */
1729
+ documents: DocumentSummary[];
1730
+ }
1731
+ /**
1732
+ * Full library snapshot suitable for building a custom collections sidebar tree.
1733
+ */
1734
+ export interface LibraryTreeSnapshot {
1735
+ /** Collections with nested folder/request/document summaries. */
1736
+ collections: LibraryTreeCollectionNode[];
1737
+ /**
1738
+ * Warnings when one or more storage backends failed while listing collections.
1739
+ * The snapshot may be incomplete when non-empty.
1740
+ */
1741
+ warnings: string[];
1742
+ }
1743
+ /**
1744
+ * Coarse reason for a {@link LibraryChangedEvent}.
1745
+ */
1746
+ export type LibraryChangedReason = 'collections' | 'folders' | 'requests' | 'documents';
1747
+ /**
1748
+ * Coarse invalidation signal so plugins can refetch library data without polling.
1749
+ */
1750
+ export interface LibraryChangedEvent {
1751
+ /** Which library slice changed. */
1752
+ reason: LibraryChangedReason;
1753
+ /** Collection id for per-collection reasons; omitted for `collections`. */
1754
+ collectionId?: number;
1755
+ }
1756
+ /**
1757
+ * Serializable sidebar focus/selection for replacement panels and host sync.
1758
+ *
1759
+ * Matches the host's "reveal in sidebar" navigation state: collection/folder
1760
+ * highlight plus the active request or document tab when one is open.
1761
+ */
1762
+ export type SidebarSelection = {
1763
+ kind: 'collection';
1764
+ collectionId: number;
1765
+ } | {
1766
+ kind: 'folder';
1767
+ collectionId: number;
1768
+ folderId: number;
1769
+ } | {
1770
+ kind: 'request';
1771
+ collectionId: number;
1772
+ folderId: number | null;
1773
+ requestId: number;
1774
+ } | {
1775
+ kind: 'document';
1776
+ collectionId: number;
1777
+ folderId: number | null;
1778
+ documentId: number;
1779
+ };
1780
+ /**
1781
+ * View context pushed to `sidebarPanels` HostedSurface mounts.
1782
+ *
1783
+ * Read via `hc.view.getContext()` on panel mount; updates arrive through
1784
+ * {@link PluginHost.onSidebarSelectionChanged}.
1785
+ */
1786
+ export interface SidebarPanelViewContext {
1787
+ /** Current host sidebar selection, or null when nothing is focused. */
1788
+ sidebarSelection: SidebarSelection | null;
1789
+ }
1790
+ /**
1791
+ * Payload for {@link PluginHost.updateCollection} — renames a collection.
1792
+ *
1793
+ * Other collection settings are preserved. Destructive host methods are silent;
1794
+ * plugins must confirm before calling delete/archive APIs.
1795
+ */
1796
+ export interface UpdateCollectionInput {
1797
+ /** Collection database id. */
1798
+ id: number;
1799
+ /** New display name. */
1800
+ name: string;
1801
+ }
1802
+ /**
1803
+ * Payload for {@link PluginHost.setCollectionArchived}.
1804
+ */
1805
+ export interface SetCollectionArchivedInput {
1806
+ /** Collection database id. */
1807
+ collectionId: number;
1808
+ /** When true, archive; when false, restore from archive. */
1809
+ archived: boolean;
1810
+ }
1811
+ /**
1812
+ * Payload for {@link PluginHost.createFolder}.
1813
+ */
1814
+ export interface CreateFolderInput {
1815
+ /** Parent collection database id. */
1816
+ collectionId: number;
1817
+ /** Display name for the new folder. */
1818
+ name: string;
1819
+ /** Parent folder id, or null/omitted for collection root. */
1820
+ parentFolderId?: number | null;
1821
+ }
1822
+ /**
1823
+ * Payload for {@link PluginHost.renameFolder}.
1824
+ */
1825
+ export interface RenameFolderInput {
1826
+ /** Folder database id. */
1827
+ folderId: number;
1828
+ /** Parent collection database id. */
1829
+ collectionId: number;
1830
+ /** New display name. */
1831
+ name: string;
1832
+ }
1833
+ /**
1834
+ * Payload for {@link PluginHost.deleteFolder}.
1835
+ *
1836
+ * Deletes the folder subtree (descendant folders, requests, and documents).
1837
+ * Silent — plugins must confirm before calling.
1838
+ */
1839
+ export interface DeleteFolderInput {
1840
+ /** Folder database id. */
1841
+ folderId: number;
1842
+ /** Parent collection database id. */
1843
+ collectionId: number;
1844
+ }
1845
+ /**
1846
+ * Payload for {@link PluginHost.moveFolder}.
1847
+ */
1848
+ export interface MoveFolderInput {
1849
+ /** Parent collection database id. */
1850
+ collectionId: number;
1851
+ /** Folder database id to move. */
1852
+ folderId: number;
1853
+ /** New parent folder id, or null for collection root. */
1854
+ parentFolderId: number | null;
1855
+ /** Optional zero-based index among new siblings. */
1856
+ sortOrder?: number;
1857
+ }
1858
+ /**
1859
+ * Payload for {@link PluginHost.reorderFolders}.
1860
+ */
1861
+ export interface ReorderFoldersInput {
1862
+ /** Parent collection database id. */
1863
+ collectionId: number;
1864
+ /** Parent folder id, or null for collection-root siblings. */
1865
+ parentFolderId: number | null;
1866
+ /** Sibling folder ids in desired order. */
1867
+ orderedFolderIds: number[];
1868
+ }
1869
+ /**
1870
+ * Payload for {@link PluginHost.createRequest}.
1871
+ *
1872
+ * Opens the new request in an editor tab (same as the built-in sidebar).
1873
+ */
1874
+ export interface CreateRequestInput {
1875
+ /** Parent collection database id. */
1876
+ collectionId: number;
1877
+ /** Parent folder id, or null/omitted for collection root. */
1878
+ folderId?: number | null;
1879
+ /** Display name; defaults to `Untitled Request`. */
1880
+ name?: string;
1881
+ /** HTTP method; defaults to `GET`. */
1882
+ method?: HttpMethod;
1883
+ /** Request URL; defaults to empty. */
1884
+ url?: string;
1885
+ }
1886
+ /**
1887
+ * Payload for {@link PluginHost.moveRequest}.
1888
+ */
1889
+ export interface MoveRequestInput {
1890
+ /** Parent collection database id. */
1891
+ collectionId: number;
1892
+ /** Saved request database id. */
1893
+ requestId: number;
1894
+ /** Target folder id, or null for collection root. */
1895
+ folderId: number | null;
1896
+ /**
1897
+ * Zero-based index among siblings in the target container.
1898
+ * When omitted, appends to the end.
1899
+ */
1900
+ index?: number;
1901
+ }
1902
+ /**
1903
+ * Payload for {@link PluginHost.reorderRequests}.
1904
+ */
1905
+ export interface ReorderRequestsInput {
1906
+ /** Parent collection database id. */
1907
+ collectionId: number;
1908
+ /** Folder id, or null for collection-root requests. */
1909
+ folderId: number | null;
1910
+ /** Request ids in desired order. */
1911
+ orderedRequestIds: number[];
1912
+ }
1913
+ /**
1914
+ * Payload for {@link PluginHost.createDocument}.
1915
+ *
1916
+ * Does not open the document in a tab — use a later host open API for that.
1917
+ */
1918
+ export interface CreateDocumentInput {
1919
+ /** Parent collection database id. */
1920
+ collectionId: number;
1921
+ /** Parent folder id, or null/omitted for collection root. */
1922
+ folderId?: number | null;
1923
+ /** Display file name. */
1924
+ name: string;
1925
+ /** Optional markdown body; defaults to empty. */
1926
+ content?: string;
1927
+ }
1928
+ /**
1929
+ * Payload for {@link PluginHost.renameDocument}.
1930
+ */
1931
+ export interface RenameDocumentInput {
1932
+ /** Document database id. */
1933
+ id: number;
1934
+ /** Parent collection database id. */
1935
+ collectionId: number;
1936
+ /** New display file name. */
1937
+ name: string;
1938
+ }
1939
+ /**
1940
+ * Payload for {@link PluginHost.deleteDocument}.
1941
+ *
1942
+ * Silent — plugins must confirm before calling.
1943
+ */
1944
+ export interface DeleteDocumentInput {
1945
+ /** Document database id. */
1946
+ id: number;
1947
+ /** Parent collection database id. */
1948
+ collectionId: number;
1949
+ }
1950
+ /**
1951
+ * Payload for {@link PluginHost.moveDocument}.
1952
+ */
1953
+ export interface MoveDocumentInput {
1954
+ /** Parent collection database id. */
1955
+ collectionId: number;
1956
+ /** Document database id. */
1957
+ documentId: number;
1958
+ /** Target folder id, or null for collection root. */
1959
+ folderId: number | null;
1960
+ /**
1961
+ * Zero-based index among siblings in the target container.
1962
+ * When omitted, appends to the end.
1963
+ */
1964
+ index?: number;
1965
+ }
1966
+ /**
1967
+ * Payload for {@link PluginHost.reorderDocuments}.
1968
+ */
1969
+ export interface ReorderDocumentsInput {
1970
+ /** Parent collection database id. */
1971
+ collectionId: number;
1972
+ /** Folder id, or null for collection-root documents. */
1973
+ folderId: number | null;
1974
+ /** Document ids in desired order. */
1975
+ orderedDocumentIds: number[];
1976
+ }
1977
+ /**
1978
+ * Kind of sidebar row that shares a collection root or folder container order.
1979
+ */
1980
+ export type ContainerItemKind = 'request' | 'document';
1981
+ /**
1982
+ * Stable reference to a request or markdown document in a shared container.
1983
+ */
1984
+ export interface ContainerItemRef {
1985
+ /** Whether this entry is a saved request or a markdown document. */
1986
+ kind: ContainerItemKind;
1987
+ /** Database id of the request or document. */
1988
+ id: number;
1989
+ }
1990
+ /**
1991
+ * Payload for {@link PluginHost.reorderContainerItems}.
1992
+ *
1993
+ * Use this when a folder or collection root interleaves requests and documents
1994
+ * in one list. Prefer {@link ReorderRequestsInput} / {@link ReorderDocumentsInput}
1995
+ * when reordering a single entity kind.
1996
+ */
1997
+ export interface ReorderContainerItemsInput {
1998
+ /** Parent collection database id. */
1999
+ collectionId: number;
2000
+ /** Folder id, or null for collection-root items. */
2001
+ folderId: number | null;
2002
+ /** Request and document refs in desired interleaved order. */
2003
+ items: ContainerItemRef[];
2004
+ }
2005
+ /**
2006
+ * Target for {@link PluginHost.showEntityContextMenu}.
2007
+ *
2008
+ * Matches built-in sidebar context menu targets (`collection` | `folder` | `request`).
2009
+ * Documents are not supported in v1.
2010
+ */
2011
+ export type EntityContextMenuTarget = {
2012
+ type: 'collection';
2013
+ collectionId: number;
2014
+ } | {
2015
+ type: 'folder';
2016
+ collectionId: number;
2017
+ folderId: number;
2018
+ } | {
2019
+ type: 'request';
2020
+ requestId: number;
2021
+ };
2022
+ /**
2023
+ * Payload for {@link PluginHost.showEntityContextMenu}.
2024
+ *
2025
+ * Coordinates are local to the plugin webview viewport; the host offsets them
2026
+ * using the HostedSurface bounds. When the surface cannot be found, `x`/`y`
2027
+ * are treated as host viewport coordinates.
2028
+ */
2029
+ export interface ShowEntityContextMenuInput {
2030
+ /** Entity the menu should act on. */
2031
+ target: EntityContextMenuTarget;
2032
+ /** X coordinate in the plugin webview viewport. */
2033
+ x: number;
2034
+ /** Y coordinate in the plugin webview viewport. */
2035
+ y: number;
2036
+ /** Plugin manifest id that owns the requesting surface. */
2037
+ pluginId: string;
2038
+ /** Sidebar panel contribution id mounted in the surface. */
2039
+ contributionId: string;
2040
+ }
2041
+ /**
2042
+ * Collection metadata returned by {@link PluginHost.getCollectionMetadata}.
2043
+ *
2044
+ * Includes settings fields plugins may read; prefer {@link CollectionSummary} for trees.
2045
+ */
2046
+ export interface HostCollection extends CollectionSummary {
2047
+ /** Collection-scoped variables. */
2048
+ variables: Variable[];
2049
+ /** Collection-level headers. */
2050
+ headers: KeyValue[];
2051
+ /** User-Agent override; empty inherits the global default. */
2052
+ userAgent: string;
2053
+ /** Default Authorization settings. */
2054
+ auth: AuthConfig;
2055
+ /** Legacy single pre-request script string. */
2056
+ pre_request_script: string;
2057
+ /** Legacy single post-request script string. */
2058
+ post_request_script: string;
2059
+ }
2060
+ /**
2061
+ * Full saved request returned by {@link PluginHost.listCollectionRequests}.
2062
+ *
2063
+ * Prefer {@link SavedRequestSummary} when only sidebar fields are needed.
2064
+ */
2065
+ export interface HostSavedRequest extends SavedRequestSummary {
2066
+ /** Request URL without query parameters. */
2067
+ url: string;
2068
+ /** Request headers. */
2069
+ headers: KeyValue[];
2070
+ /** Query parameters. */
2071
+ params: KeyValue[];
2072
+ /** Raw request body content. */
2073
+ body: string;
2074
+ /** Content type of the request body. */
2075
+ body_type: BodyType;
2076
+ /** Free-form notes. */
2077
+ comment: string;
2078
+ /** Comma-separated labels. */
2079
+ tags: string;
2080
+ /** ISO 8601 last-saved timestamp. */
2081
+ updated_at: string;
2082
+ }
2083
+ /**
2084
+ * Input for {@link PluginHost.sendHttpRequest}.
2085
+ */
2086
+ export interface PluginSendRequestInput {
2087
+ /** HTTP method to use. */
2088
+ method: HttpMethod;
2089
+ /** Request URL without query parameters. */
2090
+ url: string;
2091
+ /** Request headers. */
2092
+ headers: KeyValue[];
2093
+ /** Query parameters. */
2094
+ params: KeyValue[];
2095
+ /** Raw request body content. */
2096
+ body: string;
2097
+ /** Content type of the request body. */
2098
+ bodyType: BodyType;
2099
+ /** Optional verbatim Raw body override. */
2100
+ bodyRaw?: string;
2101
+ /** Saved request id when the send originated from a saved tab. */
2102
+ sourceRequestId?: number;
2103
+ /** Display name when {@link sourceRequestId} is set. */
2104
+ sourceRequestName?: string;
2105
+ }
2106
+ /**
2107
+ * Result of {@link PluginHost.sendHttpRequest}.
2108
+ */
2109
+ export interface PluginSendResult {
2110
+ /** HTTP status code, or 0 when the request failed before a response. */
2111
+ status: number;
2112
+ /** HTTP status text. */
2113
+ statusText: string;
2114
+ /** Response headers. */
2115
+ headers: Record<string, string>;
2116
+ /** Response body as text. */
2117
+ body: string;
2118
+ /** Base64-encoded body for image responses. */
2119
+ bodyBase64?: string;
2120
+ /** Round-trip time in milliseconds. */
2121
+ timeMs: number;
2122
+ /** Response body size in bytes. */
2123
+ sizeBytes: number;
2124
+ /** Error message when the request failed. */
2125
+ error?: string;
2126
+ }
1571
2127
  /**
1572
2128
  * Typed wrappers for built-in HarborClient request editor commands.
1573
2129
  *
1574
- * Requires the `ui` permission. Prefer these over stringly-typed
2130
+ * Requires the `ui` permission (except {@link PluginHost.sendHttpRequest}, which
2131
+ * requires `network`). Prefer these over stringly-typed
1575
2132
  * {@link PluginCommands.execute} for opening request tabs.
1576
2133
  */
1577
2134
  export interface PluginHost {
@@ -1596,9 +2153,87 @@ export interface PluginHost {
1596
2153
  /**
1597
2154
  * Opens a saved collection request or focuses an existing tab for it.
1598
2155
  *
2156
+ * Also updates host sidebar selection (collection/folder highlight) to match
2157
+ * the built-in tree click path.
2158
+ *
1599
2159
  * @param requestId - Saved request database id.
1600
2160
  */
1601
2161
  loadRequest(requestId: number): Promise<void>;
2162
+ /**
2163
+ * Opens a saved markdown document or focuses an existing tab for it.
2164
+ *
2165
+ * Requires the `ui` permission. Also updates host sidebar selection.
2166
+ *
2167
+ * @param documentId - Collection document database id.
2168
+ */
2169
+ loadDocument(documentId: number): Promise<void>;
2170
+ /**
2171
+ * Opens collection settings in a page tab.
2172
+ *
2173
+ * Requires the `ui` permission.
2174
+ *
2175
+ * @param collectionId - Collection database id.
2176
+ */
2177
+ openCollectionSettings(collectionId: number): Promise<void>;
2178
+ /**
2179
+ * Opens the collection runner for an entire collection.
2180
+ *
2181
+ * Requires the `ui` permission.
2182
+ *
2183
+ * @param collectionId - Collection database id.
2184
+ */
2185
+ openCollectionRunner(collectionId: number): Promise<void>;
2186
+ /**
2187
+ * Opens the share-collection modal for a collection.
2188
+ *
2189
+ * Requires the `ui` permission.
2190
+ *
2191
+ * @param collectionId - Collection database id.
2192
+ */
2193
+ openShareModal(collectionId: number): Promise<void>;
2194
+ /**
2195
+ * Opens the host's built-in entity context menu for a collection, folder, or request.
2196
+ *
2197
+ * Builds the same menu groups the built-in Collections tree would show
2198
+ * (including {@link PluginUi.registerContextMenuItem} contributions) and
2199
+ * positions the panel in the host window. Coordinates are webview-local;
2200
+ * the host maps them using the HostedSurface bounds.
2201
+ *
2202
+ * Requires the `ui` permission. Fire-and-forget — does not wait for the
2203
+ * user to dismiss the menu.
2204
+ *
2205
+ * Limitations: submenu positioning and focus return to the webview may be
2206
+ * imperfect; document targets are not supported.
2207
+ *
2208
+ * @param input - Target, coordinates, and requesting surface identity.
2209
+ */
2210
+ showEntityContextMenu(input: ShowEntityContextMenuInput): Promise<void>;
2211
+ /**
2212
+ * Returns the current host sidebar selection (collection/folder/request/document).
2213
+ *
2214
+ * Requires the `ui` permission.
2215
+ */
2216
+ getSidebarSelection(): Promise<SidebarSelection | null>;
2217
+ /**
2218
+ * Updates host sidebar selection the same way the built-in tree does.
2219
+ *
2220
+ * Selecting a request or document also opens/focuses its editor tab.
2221
+ * Passing `null` clears the collection/folder highlight.
2222
+ *
2223
+ * Requires the `ui` permission.
2224
+ *
2225
+ * @param selection - Target selection, or null to clear.
2226
+ */
2227
+ setSidebarSelection(selection: SidebarSelection | null): Promise<void>;
2228
+ /**
2229
+ * Subscribes to host sidebar selection changes (reveal-in-sidebar, tab focus, plugin sets).
2230
+ *
2231
+ * Requires the `ui` permission.
2232
+ *
2233
+ * @param listener - Called when selection changes.
2234
+ * @returns A {@link Disposable} that removes the listener when disposed.
2235
+ */
2236
+ onSidebarSelectionChanged(listener: (selection: SidebarSelection | null) => void): Disposable;
1602
2237
  /**
1603
2238
  * Sends the active request editor tab using the same pipeline as the Send button
1604
2239
  * (pre/post scripts, variable substitution, auth merge, and history).
@@ -1630,6 +2265,283 @@ export interface PluginHost {
1630
2265
  * @returns The database id of the created collection.
1631
2266
  */
1632
2267
  createCollection(payload: CreateCollectionPayload): Promise<CreateCollectionResult>;
2268
+ /**
2269
+ * Renames a collection while preserving its other settings.
2270
+ *
2271
+ * Requires the `ui` permission. Silent — no host confirmation dialog.
2272
+ *
2273
+ * @param input - Collection id and new name.
2274
+ */
2275
+ updateCollection(input: UpdateCollectionInput): Promise<CollectionSummary>;
2276
+ /**
2277
+ * Deletes a collection (moves it to trash when supported).
2278
+ *
2279
+ * Requires the `ui` permission. Silent — plugins must confirm first.
2280
+ *
2281
+ * @param collectionId - Collection database id.
2282
+ */
2283
+ deleteCollection(collectionId: number): Promise<void>;
2284
+ /**
2285
+ * Persists a new top-level collection order in the sidebar.
2286
+ *
2287
+ * Requires the `ui` permission.
2288
+ *
2289
+ * @param orderedIds - Collection ids in desired order.
2290
+ */
2291
+ reorderCollections(orderedIds: number[]): Promise<void>;
2292
+ /**
2293
+ * Archives or un-archives a collection.
2294
+ *
2295
+ * Requires the `ui` permission. Silent — plugins must confirm before archiving.
2296
+ *
2297
+ * @param input - Collection id and archived flag.
2298
+ */
2299
+ setCollectionArchived(input: SetCollectionArchivedInput): Promise<void>;
2300
+ /**
2301
+ * Deep-copies a collection and places the duplicate below the original.
2302
+ *
2303
+ * Requires the `ui` permission.
2304
+ *
2305
+ * @param collectionId - Collection database id to duplicate.
2306
+ */
2307
+ duplicateCollection(collectionId: number): Promise<CollectionSummary>;
2308
+ /**
2309
+ * Creates a folder inside a collection (optionally nested under a parent folder).
2310
+ *
2311
+ * Requires the `ui` permission.
2312
+ *
2313
+ * @param input - Collection id, name, and optional parent folder.
2314
+ */
2315
+ createFolder(input: CreateFolderInput): Promise<FolderSummary>;
2316
+ /**
2317
+ * Renames a folder.
2318
+ *
2319
+ * Requires the `ui` permission.
2320
+ *
2321
+ * @param input - Folder id, collection id, and new name.
2322
+ */
2323
+ renameFolder(input: RenameFolderInput): Promise<FolderSummary>;
2324
+ /**
2325
+ * Deletes a folder and its subtree (descendant folders, requests, documents).
2326
+ *
2327
+ * Requires the `ui` permission. Silent — plugins must confirm first.
2328
+ *
2329
+ * @param input - Folder id and parent collection id.
2330
+ */
2331
+ deleteFolder(input: DeleteFolderInput): Promise<void>;
2332
+ /**
2333
+ * Reparents a folder and optionally inserts it at a sibling position.
2334
+ *
2335
+ * Requires the `ui` permission.
2336
+ *
2337
+ * @param input - Move target and optional sort order.
2338
+ */
2339
+ moveFolder(input: MoveFolderInput): Promise<FolderSummary>;
2340
+ /**
2341
+ * Persists a new folder order within a collection container.
2342
+ *
2343
+ * Requires the `ui` permission.
2344
+ *
2345
+ * @param input - Collection id, parent folder, and ordered sibling ids.
2346
+ */
2347
+ reorderFolders(input: ReorderFoldersInput): Promise<void>;
2348
+ /**
2349
+ * Creates a saved request and opens it in an editor tab.
2350
+ *
2351
+ * Requires the `ui` permission.
2352
+ *
2353
+ * @param input - Collection id, optional folder, and optional draft fields.
2354
+ */
2355
+ createRequest(input: CreateRequestInput): Promise<SavedRequestSummary>;
2356
+ /**
2357
+ * Deletes a saved request.
2358
+ *
2359
+ * Requires the `ui` permission. Silent — plugins must confirm first.
2360
+ *
2361
+ * @param requestId - Saved request database id.
2362
+ */
2363
+ deleteRequest(requestId: number): Promise<void>;
2364
+ /**
2365
+ * Duplicates a saved request in the same collection/folder and opens the copy.
2366
+ *
2367
+ * Requires the `ui` permission.
2368
+ *
2369
+ * @param requestId - Saved request database id to duplicate.
2370
+ */
2371
+ duplicateRequest(requestId: number): Promise<SavedRequestSummary>;
2372
+ /**
2373
+ * Moves a saved request to another folder or the collection root.
2374
+ *
2375
+ * Requires the `ui` permission.
2376
+ *
2377
+ * @param input - Request id, target folder, and optional index.
2378
+ */
2379
+ moveRequest(input: MoveRequestInput): Promise<void>;
2380
+ /**
2381
+ * Persists a new request order within a folder or collection root.
2382
+ *
2383
+ * Requires the `ui` permission.
2384
+ *
2385
+ * @param input - Collection id, folder id, and ordered request ids.
2386
+ */
2387
+ reorderRequests(input: ReorderRequestsInput): Promise<void>;
2388
+ /**
2389
+ * Creates a markdown document in a collection (optionally inside a folder).
2390
+ *
2391
+ * Does not open the document in a tab.
2392
+ *
2393
+ * Requires the `ui` permission.
2394
+ *
2395
+ * @param input - Collection id, name, and optional folder/content.
2396
+ */
2397
+ createDocument(input: CreateDocumentInput): Promise<DocumentSummary>;
2398
+ /**
2399
+ * Renames a markdown document without changing its body.
2400
+ *
2401
+ * Requires the `ui` permission.
2402
+ *
2403
+ * @param input - Document id, collection id, and new name.
2404
+ */
2405
+ renameDocument(input: RenameDocumentInput): Promise<DocumentSummary>;
2406
+ /**
2407
+ * Deletes a markdown document.
2408
+ *
2409
+ * Requires the `ui` permission. Silent — plugins must confirm first.
2410
+ *
2411
+ * @param input - Document id and parent collection id.
2412
+ */
2413
+ deleteDocument(input: DeleteDocumentInput): Promise<void>;
2414
+ /**
2415
+ * Moves a markdown document to another folder or the collection root.
2416
+ *
2417
+ * Requires the `ui` permission.
2418
+ *
2419
+ * @param input - Document id, target folder, and optional index.
2420
+ */
2421
+ moveDocument(input: MoveDocumentInput): Promise<void>;
2422
+ /**
2423
+ * Persists a new document order within a folder or collection root.
2424
+ *
2425
+ * Requires the `ui` permission.
2426
+ *
2427
+ * @param input - Collection id, folder id, and ordered document ids.
2428
+ */
2429
+ reorderDocuments(input: ReorderDocumentsInput): Promise<void>;
2430
+ /**
2431
+ * Persists interleaved request + document order in one folder or collection root.
2432
+ *
2433
+ * Requires the `ui` permission. Prefer this over separate request/document
2434
+ * reorder APIs when the UI shows a mixed container list.
2435
+ *
2436
+ * @param input - Collection id, folder id, and ordered item refs.
2437
+ */
2438
+ reorderContainerItems(input: ReorderContainerItemsInput): Promise<void>;
2439
+ /**
2440
+ * Lists collection summaries for building a sidebar tree.
2441
+ *
2442
+ * Archived collections are omitted unless {@link LibraryListOptions.includeArchived} is true.
2443
+ *
2444
+ * Requires the `ui` permission.
2445
+ *
2446
+ * @param options - Optional archive filter.
2447
+ */
2448
+ listCollections(options?: LibraryListOptions): Promise<CollectionSummary[]>;
2449
+ /**
2450
+ * Lists folder summaries for one collection.
2451
+ *
2452
+ * Requires the `ui` permission.
2453
+ *
2454
+ * @param collectionId - Collection database id.
2455
+ */
2456
+ listFolders(collectionId: number): Promise<FolderSummary[]>;
2457
+ /**
2458
+ * Lists lightweight saved-request summaries for one collection (no body/auth).
2459
+ *
2460
+ * Distinct from {@link listCollectionRequests}, which returns full rows in run order.
2461
+ *
2462
+ * Requires the `ui` permission.
2463
+ *
2464
+ * @param collectionId - Collection database id.
2465
+ */
2466
+ listRequests(collectionId: number): Promise<SavedRequestSummary[]>;
2467
+ /**
2468
+ * Lists markdown document summaries for one collection (no content body).
2469
+ *
2470
+ * Requires the `ui` permission.
2471
+ *
2472
+ * @param collectionId - Collection database id.
2473
+ */
2474
+ listDocuments(collectionId: number): Promise<DocumentSummary[]>;
2475
+ /**
2476
+ * Returns a full library snapshot (collections + nested folders/requests/documents).
2477
+ *
2478
+ * Requires the `ui` permission.
2479
+ *
2480
+ * @param options - Optional archive filter.
2481
+ */
2482
+ listLibraryTree(options?: LibraryListOptions): Promise<LibraryTreeSnapshot>;
2483
+ /**
2484
+ * Subscribes to coarse library invalidation events so plugins can refetch without polling.
2485
+ *
2486
+ * Requires the `ui` permission.
2487
+ *
2488
+ * @param listener - Called when collections, folders, requests, or documents refresh.
2489
+ * @returns A {@link Disposable} that removes the listener when disposed.
2490
+ */
2491
+ onLibraryChanged(listener: (event: LibraryChangedEvent) => void): Disposable;
2492
+ /**
2493
+ * Returns saved requests for a collection or folder in sidebar run order.
2494
+ *
2495
+ * Requires the `ui` permission.
2496
+ *
2497
+ * @param collectionId - Collection database id.
2498
+ * @param folderId - Optional folder id; omit or null for collection-root run order.
2499
+ */
2500
+ listCollectionRequests(collectionId: number, folderId?: number | null): Promise<HostSavedRequest[]>;
2501
+ /**
2502
+ * Returns collection metadata needed to resolve saved requests in plugins.
2503
+ *
2504
+ * Requires the `ui` permission.
2505
+ *
2506
+ * @param collectionId - Collection database id.
2507
+ */
2508
+ getCollectionMetadata(collectionId: number): Promise<HostCollection>;
2509
+ /**
2510
+ * Appends one HTTP result to the footer session console from a renderer plugin.
2511
+ *
2512
+ * Requires the `ui` permission.
2513
+ *
2514
+ * @param payload - Request label and send result metadata.
2515
+ */
2516
+ logRequestToConsole(payload: {
2517
+ requestName: string;
2518
+ collectionName?: string;
2519
+ result: PluginSendResult;
2520
+ }): Promise<void>;
2521
+ /**
2522
+ * Sends one HTTP request through the main-process pipeline, bypassing the
2523
+ * renderer's CORS restrictions. Failures resolve to an error result.
2524
+ *
2525
+ * Requires the `network` permission.
2526
+ *
2527
+ * @param input - Request configuration to execute.
2528
+ */
2529
+ sendHttpRequest(input: PluginSendRequestInput): Promise<PluginSendResult>;
2530
+ /**
2531
+ * Clears the active request tab's last HTTP response so plugin-only response
2532
+ * views can take over the panel.
2533
+ *
2534
+ * Requires the `ui` permission.
2535
+ */
2536
+ clearResponse(): Promise<void>;
2537
+ /**
2538
+ * Opens (or focuses) an image viewer page tab for a local path, URL, or inline image.
2539
+ *
2540
+ * Requires the `ui` permission. Session-only — image tabs are not restored on restart.
2541
+ *
2542
+ * @param payload - Image source and optional display filename.
2543
+ */
2544
+ openImageView(payload: OpenImageViewPayload): Promise<void>;
1633
2545
  }
1634
2546
  /**
1635
2547
  * The plugin API surface passed as `hc` to your renderer entry's `activate(hc)` function.