@ai4b-team/fsaos-gateway-sdk 3.2.1 → 3.4.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/dist/index.d.cts CHANGED
@@ -1742,6 +1742,235 @@ declare function useRealtimeQuery<T>(options: {
1742
1742
  enabled?: boolean;
1743
1743
  debounceMs?: number;
1744
1744
  }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<T>, Error>;
1745
+ /**
1746
+ * Effective `item_arrangement` resolved for `parentPath` under the current scope.
1747
+ *
1748
+ * Wraps the kernel `get-effective-items` primitive with
1749
+ * `item_type='item_arrangement'` and selects the highest-priority arrangement
1750
+ * (smallest inheritance depth) whose `type_data.parent_path` matches
1751
+ * `parentPath`. The cascade walk — account → space → member shadow — is done
1752
+ * server-side; this hook does not invent any scope conventions.
1753
+ *
1754
+ * The `applyTo(children)` helper reorders a child list so items appear in the
1755
+ * arrangement's specified order; anything not listed is appended at the end
1756
+ * in the children's original order. Use it as a presentation-only sort.
1757
+ *
1758
+ * @example
1759
+ * const { arrangement, applyTo } = useArrangement('/root/system/dock');
1760
+ * const { data: kids } = useChildren('/root/system/dock');
1761
+ * const sorted = applyTo(kids ?? []);
1762
+ */
1763
+ declare function useArrangement(parentPath: string | null | undefined): {
1764
+ arrangement: any;
1765
+ order: string[] | null;
1766
+ sourceScopeId: any;
1767
+ sourceScopeName: any;
1768
+ applyTo: <T extends {
1769
+ id?: string;
1770
+ name?: string;
1771
+ }>(children: T[]) => T[];
1772
+ data: any;
1773
+ error: Error;
1774
+ isError: true;
1775
+ isPending: false;
1776
+ isLoading: false;
1777
+ isLoadingError: false;
1778
+ isRefetchError: true;
1779
+ isSuccess: false;
1780
+ isPlaceholderData: false;
1781
+ status: "error";
1782
+ dataUpdatedAt: number;
1783
+ errorUpdatedAt: number;
1784
+ failureCount: number;
1785
+ failureReason: Error | null;
1786
+ errorUpdateCount: number;
1787
+ isFetched: boolean;
1788
+ isFetchedAfterMount: boolean;
1789
+ isFetching: boolean;
1790
+ isInitialLoading: boolean;
1791
+ isPaused: boolean;
1792
+ isRefetching: boolean;
1793
+ isStale: boolean;
1794
+ isEnabled: boolean;
1795
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1796
+ fetchStatus: _tanstack_react_query.FetchStatus;
1797
+ promise: Promise<any>;
1798
+ } | {
1799
+ arrangement: any;
1800
+ order: string[] | null;
1801
+ sourceScopeId: any;
1802
+ sourceScopeName: any;
1803
+ applyTo: <T extends {
1804
+ id?: string;
1805
+ name?: string;
1806
+ }>(children: T[]) => T[];
1807
+ data: any;
1808
+ error: null;
1809
+ isError: false;
1810
+ isPending: false;
1811
+ isLoading: false;
1812
+ isLoadingError: false;
1813
+ isRefetchError: false;
1814
+ isSuccess: true;
1815
+ isPlaceholderData: false;
1816
+ status: "success";
1817
+ dataUpdatedAt: number;
1818
+ errorUpdatedAt: number;
1819
+ failureCount: number;
1820
+ failureReason: Error | null;
1821
+ errorUpdateCount: number;
1822
+ isFetched: boolean;
1823
+ isFetchedAfterMount: boolean;
1824
+ isFetching: boolean;
1825
+ isInitialLoading: boolean;
1826
+ isPaused: boolean;
1827
+ isRefetching: boolean;
1828
+ isStale: boolean;
1829
+ isEnabled: boolean;
1830
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1831
+ fetchStatus: _tanstack_react_query.FetchStatus;
1832
+ promise: Promise<any>;
1833
+ } | {
1834
+ arrangement: any;
1835
+ order: string[] | null;
1836
+ sourceScopeId: any;
1837
+ sourceScopeName: any;
1838
+ applyTo: <T extends {
1839
+ id?: string;
1840
+ name?: string;
1841
+ }>(children: T[]) => T[];
1842
+ data: undefined;
1843
+ error: Error;
1844
+ isError: true;
1845
+ isPending: false;
1846
+ isLoading: false;
1847
+ isLoadingError: true;
1848
+ isRefetchError: false;
1849
+ isSuccess: false;
1850
+ isPlaceholderData: false;
1851
+ status: "error";
1852
+ dataUpdatedAt: number;
1853
+ errorUpdatedAt: number;
1854
+ failureCount: number;
1855
+ failureReason: Error | null;
1856
+ errorUpdateCount: number;
1857
+ isFetched: boolean;
1858
+ isFetchedAfterMount: boolean;
1859
+ isFetching: boolean;
1860
+ isInitialLoading: boolean;
1861
+ isPaused: boolean;
1862
+ isRefetching: boolean;
1863
+ isStale: boolean;
1864
+ isEnabled: boolean;
1865
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1866
+ fetchStatus: _tanstack_react_query.FetchStatus;
1867
+ promise: Promise<any>;
1868
+ } | {
1869
+ arrangement: any;
1870
+ order: string[] | null;
1871
+ sourceScopeId: any;
1872
+ sourceScopeName: any;
1873
+ applyTo: <T extends {
1874
+ id?: string;
1875
+ name?: string;
1876
+ }>(children: T[]) => T[];
1877
+ data: undefined;
1878
+ error: null;
1879
+ isError: false;
1880
+ isPending: true;
1881
+ isLoading: true;
1882
+ isLoadingError: false;
1883
+ isRefetchError: false;
1884
+ isSuccess: false;
1885
+ isPlaceholderData: false;
1886
+ status: "pending";
1887
+ dataUpdatedAt: number;
1888
+ errorUpdatedAt: number;
1889
+ failureCount: number;
1890
+ failureReason: Error | null;
1891
+ errorUpdateCount: number;
1892
+ isFetched: boolean;
1893
+ isFetchedAfterMount: boolean;
1894
+ isFetching: boolean;
1895
+ isInitialLoading: boolean;
1896
+ isPaused: boolean;
1897
+ isRefetching: boolean;
1898
+ isStale: boolean;
1899
+ isEnabled: boolean;
1900
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1901
+ fetchStatus: _tanstack_react_query.FetchStatus;
1902
+ promise: Promise<any>;
1903
+ } | {
1904
+ arrangement: any;
1905
+ order: string[] | null;
1906
+ sourceScopeId: any;
1907
+ sourceScopeName: any;
1908
+ applyTo: <T extends {
1909
+ id?: string;
1910
+ name?: string;
1911
+ }>(children: T[]) => T[];
1912
+ data: undefined;
1913
+ error: null;
1914
+ isError: false;
1915
+ isPending: true;
1916
+ isLoadingError: false;
1917
+ isRefetchError: false;
1918
+ isSuccess: false;
1919
+ isPlaceholderData: false;
1920
+ status: "pending";
1921
+ dataUpdatedAt: number;
1922
+ errorUpdatedAt: number;
1923
+ failureCount: number;
1924
+ failureReason: Error | null;
1925
+ errorUpdateCount: number;
1926
+ isFetched: boolean;
1927
+ isFetchedAfterMount: boolean;
1928
+ isFetching: boolean;
1929
+ isLoading: boolean;
1930
+ isInitialLoading: boolean;
1931
+ isPaused: boolean;
1932
+ isRefetching: boolean;
1933
+ isStale: boolean;
1934
+ isEnabled: boolean;
1935
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1936
+ fetchStatus: _tanstack_react_query.FetchStatus;
1937
+ promise: Promise<any>;
1938
+ } | {
1939
+ arrangement: any;
1940
+ order: string[] | null;
1941
+ sourceScopeId: any;
1942
+ sourceScopeName: any;
1943
+ applyTo: <T extends {
1944
+ id?: string;
1945
+ name?: string;
1946
+ }>(children: T[]) => T[];
1947
+ data: any;
1948
+ isError: false;
1949
+ error: null;
1950
+ isPending: false;
1951
+ isLoading: false;
1952
+ isLoadingError: false;
1953
+ isRefetchError: false;
1954
+ isSuccess: true;
1955
+ isPlaceholderData: true;
1956
+ status: "success";
1957
+ dataUpdatedAt: number;
1958
+ errorUpdatedAt: number;
1959
+ failureCount: number;
1960
+ failureReason: Error | null;
1961
+ errorUpdateCount: number;
1962
+ isFetched: boolean;
1963
+ isFetchedAfterMount: boolean;
1964
+ isFetching: boolean;
1965
+ isInitialLoading: boolean;
1966
+ isPaused: boolean;
1967
+ isRefetching: boolean;
1968
+ isStale: boolean;
1969
+ isEnabled: boolean;
1970
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1971
+ fetchStatus: _tanstack_react_query.FetchStatus;
1972
+ promise: Promise<any>;
1973
+ };
1745
1974
 
1746
1975
  /**
1747
1976
  * @fsaos/gateway — Schema Interpretation Utilities
@@ -1931,4 +2160,4 @@ declare function uploadFile(file: File | Blob, options: UploadOptions, onProgres
1931
2160
  */
1932
2161
  declare function useFileUpload(): UseFileUploadReturn;
1933
2162
 
1934
- export { type AccountInfo, type Channel, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, type GatewayParams, type GatewayResponse, type InfiniteChannelMessagesOptions, type ItemVersionsOptions, type ItemVersionsResult, type ItemsFilter, KernelProvider, type LinkParams, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PrincipalData, type ResolveParams, type ResolveResponse, type ResolveResultItem, type SessionEntry, type TypeDefinition, type TypeHelpers, type TypeSchema, type UnreadCountsOptions, type UpdateParams, type UploadItem, type UploadOptions, type UploadResult, type UseFileUploadReturn, type VFSEdge, type VFSItem, auth, awaitScopeReady, callTool, clearCachedToken, clearSession, createItem, disconnectSSE, disposeVfsRealtimeWs, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAssetUrl, getDefaultSort, getRequiredFormFields, getScope, getScopeVersion, getSessionEntry, initSession, initVfsRealtimeWs, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isScopeReady, listChildren, mount, mountRealtimeScope, normalizeItem, ping, pushChanges, queryClient, readItem, registerCleanup, resetAllSdkState, resolvePrincipalId, setCachedToken, setScope, setupRequireShim, signal, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAllChannels, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useScope, useScopeReady, useSearch, useTheme, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, vfsKeys };
2163
+ export { type AccountInfo, type Channel, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, type GatewayParams, type GatewayResponse, type InfiniteChannelMessagesOptions, type ItemVersionsOptions, type ItemVersionsResult, type ItemsFilter, KernelProvider, type LinkParams, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PrincipalData, type ResolveParams, type ResolveResponse, type ResolveResultItem, type SessionEntry, type TypeDefinition, type TypeHelpers, type TypeSchema, type UnreadCountsOptions, type UpdateParams, type UploadItem, type UploadOptions, type UploadResult, type UseFileUploadReturn, type VFSEdge, type VFSItem, auth, awaitScopeReady, callTool, clearCachedToken, clearSession, createItem, disconnectSSE, disposeVfsRealtimeWs, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAssetUrl, getDefaultSort, getRequiredFormFields, getScope, getScopeVersion, getSessionEntry, initSession, initVfsRealtimeWs, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isScopeReady, listChildren, mount, mountRealtimeScope, normalizeItem, ping, pushChanges, queryClient, readItem, registerCleanup, resetAllSdkState, resolvePrincipalId, setCachedToken, setScope, setupRequireShim, signal, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAllChannels, useArrangement, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useScope, useScopeReady, useSearch, useTheme, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, vfsKeys };
package/dist/index.d.ts CHANGED
@@ -1742,6 +1742,235 @@ declare function useRealtimeQuery<T>(options: {
1742
1742
  enabled?: boolean;
1743
1743
  debounceMs?: number;
1744
1744
  }): _tanstack_react_query.UseQueryResult<_tanstack_react_query.NoInfer<T>, Error>;
1745
+ /**
1746
+ * Effective `item_arrangement` resolved for `parentPath` under the current scope.
1747
+ *
1748
+ * Wraps the kernel `get-effective-items` primitive with
1749
+ * `item_type='item_arrangement'` and selects the highest-priority arrangement
1750
+ * (smallest inheritance depth) whose `type_data.parent_path` matches
1751
+ * `parentPath`. The cascade walk — account → space → member shadow — is done
1752
+ * server-side; this hook does not invent any scope conventions.
1753
+ *
1754
+ * The `applyTo(children)` helper reorders a child list so items appear in the
1755
+ * arrangement's specified order; anything not listed is appended at the end
1756
+ * in the children's original order. Use it as a presentation-only sort.
1757
+ *
1758
+ * @example
1759
+ * const { arrangement, applyTo } = useArrangement('/root/system/dock');
1760
+ * const { data: kids } = useChildren('/root/system/dock');
1761
+ * const sorted = applyTo(kids ?? []);
1762
+ */
1763
+ declare function useArrangement(parentPath: string | null | undefined): {
1764
+ arrangement: any;
1765
+ order: string[] | null;
1766
+ sourceScopeId: any;
1767
+ sourceScopeName: any;
1768
+ applyTo: <T extends {
1769
+ id?: string;
1770
+ name?: string;
1771
+ }>(children: T[]) => T[];
1772
+ data: any;
1773
+ error: Error;
1774
+ isError: true;
1775
+ isPending: false;
1776
+ isLoading: false;
1777
+ isLoadingError: false;
1778
+ isRefetchError: true;
1779
+ isSuccess: false;
1780
+ isPlaceholderData: false;
1781
+ status: "error";
1782
+ dataUpdatedAt: number;
1783
+ errorUpdatedAt: number;
1784
+ failureCount: number;
1785
+ failureReason: Error | null;
1786
+ errorUpdateCount: number;
1787
+ isFetched: boolean;
1788
+ isFetchedAfterMount: boolean;
1789
+ isFetching: boolean;
1790
+ isInitialLoading: boolean;
1791
+ isPaused: boolean;
1792
+ isRefetching: boolean;
1793
+ isStale: boolean;
1794
+ isEnabled: boolean;
1795
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1796
+ fetchStatus: _tanstack_react_query.FetchStatus;
1797
+ promise: Promise<any>;
1798
+ } | {
1799
+ arrangement: any;
1800
+ order: string[] | null;
1801
+ sourceScopeId: any;
1802
+ sourceScopeName: any;
1803
+ applyTo: <T extends {
1804
+ id?: string;
1805
+ name?: string;
1806
+ }>(children: T[]) => T[];
1807
+ data: any;
1808
+ error: null;
1809
+ isError: false;
1810
+ isPending: false;
1811
+ isLoading: false;
1812
+ isLoadingError: false;
1813
+ isRefetchError: false;
1814
+ isSuccess: true;
1815
+ isPlaceholderData: false;
1816
+ status: "success";
1817
+ dataUpdatedAt: number;
1818
+ errorUpdatedAt: number;
1819
+ failureCount: number;
1820
+ failureReason: Error | null;
1821
+ errorUpdateCount: number;
1822
+ isFetched: boolean;
1823
+ isFetchedAfterMount: boolean;
1824
+ isFetching: boolean;
1825
+ isInitialLoading: boolean;
1826
+ isPaused: boolean;
1827
+ isRefetching: boolean;
1828
+ isStale: boolean;
1829
+ isEnabled: boolean;
1830
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1831
+ fetchStatus: _tanstack_react_query.FetchStatus;
1832
+ promise: Promise<any>;
1833
+ } | {
1834
+ arrangement: any;
1835
+ order: string[] | null;
1836
+ sourceScopeId: any;
1837
+ sourceScopeName: any;
1838
+ applyTo: <T extends {
1839
+ id?: string;
1840
+ name?: string;
1841
+ }>(children: T[]) => T[];
1842
+ data: undefined;
1843
+ error: Error;
1844
+ isError: true;
1845
+ isPending: false;
1846
+ isLoading: false;
1847
+ isLoadingError: true;
1848
+ isRefetchError: false;
1849
+ isSuccess: false;
1850
+ isPlaceholderData: false;
1851
+ status: "error";
1852
+ dataUpdatedAt: number;
1853
+ errorUpdatedAt: number;
1854
+ failureCount: number;
1855
+ failureReason: Error | null;
1856
+ errorUpdateCount: number;
1857
+ isFetched: boolean;
1858
+ isFetchedAfterMount: boolean;
1859
+ isFetching: boolean;
1860
+ isInitialLoading: boolean;
1861
+ isPaused: boolean;
1862
+ isRefetching: boolean;
1863
+ isStale: boolean;
1864
+ isEnabled: boolean;
1865
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1866
+ fetchStatus: _tanstack_react_query.FetchStatus;
1867
+ promise: Promise<any>;
1868
+ } | {
1869
+ arrangement: any;
1870
+ order: string[] | null;
1871
+ sourceScopeId: any;
1872
+ sourceScopeName: any;
1873
+ applyTo: <T extends {
1874
+ id?: string;
1875
+ name?: string;
1876
+ }>(children: T[]) => T[];
1877
+ data: undefined;
1878
+ error: null;
1879
+ isError: false;
1880
+ isPending: true;
1881
+ isLoading: true;
1882
+ isLoadingError: false;
1883
+ isRefetchError: false;
1884
+ isSuccess: false;
1885
+ isPlaceholderData: false;
1886
+ status: "pending";
1887
+ dataUpdatedAt: number;
1888
+ errorUpdatedAt: number;
1889
+ failureCount: number;
1890
+ failureReason: Error | null;
1891
+ errorUpdateCount: number;
1892
+ isFetched: boolean;
1893
+ isFetchedAfterMount: boolean;
1894
+ isFetching: boolean;
1895
+ isInitialLoading: boolean;
1896
+ isPaused: boolean;
1897
+ isRefetching: boolean;
1898
+ isStale: boolean;
1899
+ isEnabled: boolean;
1900
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1901
+ fetchStatus: _tanstack_react_query.FetchStatus;
1902
+ promise: Promise<any>;
1903
+ } | {
1904
+ arrangement: any;
1905
+ order: string[] | null;
1906
+ sourceScopeId: any;
1907
+ sourceScopeName: any;
1908
+ applyTo: <T extends {
1909
+ id?: string;
1910
+ name?: string;
1911
+ }>(children: T[]) => T[];
1912
+ data: undefined;
1913
+ error: null;
1914
+ isError: false;
1915
+ isPending: true;
1916
+ isLoadingError: false;
1917
+ isRefetchError: false;
1918
+ isSuccess: false;
1919
+ isPlaceholderData: false;
1920
+ status: "pending";
1921
+ dataUpdatedAt: number;
1922
+ errorUpdatedAt: number;
1923
+ failureCount: number;
1924
+ failureReason: Error | null;
1925
+ errorUpdateCount: number;
1926
+ isFetched: boolean;
1927
+ isFetchedAfterMount: boolean;
1928
+ isFetching: boolean;
1929
+ isLoading: boolean;
1930
+ isInitialLoading: boolean;
1931
+ isPaused: boolean;
1932
+ isRefetching: boolean;
1933
+ isStale: boolean;
1934
+ isEnabled: boolean;
1935
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1936
+ fetchStatus: _tanstack_react_query.FetchStatus;
1937
+ promise: Promise<any>;
1938
+ } | {
1939
+ arrangement: any;
1940
+ order: string[] | null;
1941
+ sourceScopeId: any;
1942
+ sourceScopeName: any;
1943
+ applyTo: <T extends {
1944
+ id?: string;
1945
+ name?: string;
1946
+ }>(children: T[]) => T[];
1947
+ data: any;
1948
+ isError: false;
1949
+ error: null;
1950
+ isPending: false;
1951
+ isLoading: false;
1952
+ isLoadingError: false;
1953
+ isRefetchError: false;
1954
+ isSuccess: true;
1955
+ isPlaceholderData: true;
1956
+ status: "success";
1957
+ dataUpdatedAt: number;
1958
+ errorUpdatedAt: number;
1959
+ failureCount: number;
1960
+ failureReason: Error | null;
1961
+ errorUpdateCount: number;
1962
+ isFetched: boolean;
1963
+ isFetchedAfterMount: boolean;
1964
+ isFetching: boolean;
1965
+ isInitialLoading: boolean;
1966
+ isPaused: boolean;
1967
+ isRefetching: boolean;
1968
+ isStale: boolean;
1969
+ isEnabled: boolean;
1970
+ refetch: (options?: _tanstack_react_query.RefetchOptions) => Promise<_tanstack_react_query.QueryObserverResult<any, Error>>;
1971
+ fetchStatus: _tanstack_react_query.FetchStatus;
1972
+ promise: Promise<any>;
1973
+ };
1745
1974
 
1746
1975
  /**
1747
1976
  * @fsaos/gateway — Schema Interpretation Utilities
@@ -1931,4 +2160,4 @@ declare function uploadFile(file: File | Blob, options: UploadOptions, onProgres
1931
2160
  */
1932
2161
  declare function useFileUpload(): UseFileUploadReturn;
1933
2162
 
1934
- export { type AccountInfo, type Channel, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, type GatewayParams, type GatewayResponse, type InfiniteChannelMessagesOptions, type ItemVersionsOptions, type ItemVersionsResult, type ItemsFilter, KernelProvider, type LinkParams, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PrincipalData, type ResolveParams, type ResolveResponse, type ResolveResultItem, type SessionEntry, type TypeDefinition, type TypeHelpers, type TypeSchema, type UnreadCountsOptions, type UpdateParams, type UploadItem, type UploadOptions, type UploadResult, type UseFileUploadReturn, type VFSEdge, type VFSItem, auth, awaitScopeReady, callTool, clearCachedToken, clearSession, createItem, disconnectSSE, disposeVfsRealtimeWs, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAssetUrl, getDefaultSort, getRequiredFormFields, getScope, getScopeVersion, getSessionEntry, initSession, initVfsRealtimeWs, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isScopeReady, listChildren, mount, mountRealtimeScope, normalizeItem, ping, pushChanges, queryClient, readItem, registerCleanup, resetAllSdkState, resolvePrincipalId, setCachedToken, setScope, setupRequireShim, signal, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAllChannels, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useScope, useScopeReady, useSearch, useTheme, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, vfsKeys };
2163
+ export { type AccountInfo, type Channel, type ChannelCard, type ChannelMessage, type ChannelMessagesOptions, type ChannelMessagesPage, type ChannelMessagesResponse, type ChannelsOptions, type ComponentOpener, ComponentRenderer, type CreateParams, type DeleteParams, EnforcementDeniedError, type EnforcementPayload, type FieldDescriptor, type FileRef, type GatewayParams, type GatewayResponse, type InfiniteChannelMessagesOptions, type ItemVersionsOptions, type ItemVersionsResult, type ItemsFilter, KernelProvider, type LinkParams, type MoveParams, type Notification, type NotificationsOptions, type OpenEnvelope, type OpenOptions, type PrincipalData, type ResolveParams, type ResolveResponse, type ResolveResultItem, type SessionEntry, type TypeDefinition, type TypeHelpers, type TypeSchema, type UnreadCountsOptions, type UpdateParams, type UploadItem, type UploadOptions, type UploadResult, type UseFileUploadReturn, type VFSEdge, type VFSItem, auth, awaitScopeReady, callTool, clearCachedToken, clearSession, createItem, disconnectSSE, disposeVfsRealtimeWs, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAssetUrl, getDefaultSort, getRequiredFormFields, getScope, getScopeVersion, getSessionEntry, initSession, initVfsRealtimeWs, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isScopeReady, listChildren, mount, mountRealtimeScope, normalizeItem, ping, pushChanges, queryClient, readItem, registerCleanup, resetAllSdkState, resolvePrincipalId, setCachedToken, setScope, setupRequireShim, signal, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAllChannels, useArrangement, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useScope, useScopeReady, useSearch, useTheme, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, vfsKeys };
package/dist/index.js CHANGED
@@ -88,6 +88,7 @@ __export(src_exports, {
88
88
  uploadFile: () => uploadFile,
89
89
  useAccounts: () => useAccounts,
90
90
  useAllChannels: () => useAllChannels,
91
+ useArrangement: () => useArrangement,
91
92
  useAsset: () => useAsset,
92
93
  useAuth: () => useAuth,
93
94
  useChannelMessages: () => useChannelMessages,
@@ -2475,6 +2476,16 @@ function useInfiniteChannelMessages(options) {
2475
2476
  qc.invalidateQueries({ queryKey: stableKey });
2476
2477
  return;
2477
2478
  }
2479
+ if (newPage.messages.length > 0) {
2480
+ const minNewSeq = Math.min(...newPage.messages.map((m) => m.seq));
2481
+ if (minNewSeq > maxSeq + 1) {
2482
+ console.warn(
2483
+ `[useInfiniteChannelMessages] sequence gap detected: maxSeq=${maxSeq}, minNewSeq=${minNewSeq}. Triggering full refetch.`
2484
+ );
2485
+ qc.invalidateQueries({ queryKey: stableKey });
2486
+ return;
2487
+ }
2488
+ }
2478
2489
  qc.setQueryData(stableKey, (old) => {
2479
2490
  if (!old) return old;
2480
2491
  const pages = [...old.pages];
@@ -2901,6 +2912,53 @@ function useRealtimeQuery(options) {
2901
2912
  }, [eventType, enabled, debounceMs, qc, JSON.stringify(queryKey)]);
2902
2913
  return query;
2903
2914
  }
2915
+ function useArrangement(parentPath) {
2916
+ useScopeKey();
2917
+ const enabled = !!parentPath;
2918
+ const query = useQuery({
2919
+ queryKey: ["vfs", getScope() ?? "__unscoped__", "arrangement", parentPath ?? ""],
2920
+ queryFn: async () => {
2921
+ const response = await gatewayCall("get-effective-items", {
2922
+ item_type: "item_arrangement"
2923
+ });
2924
+ const rows = response?.content?.items ?? response?.items ?? response?.rows ?? [];
2925
+ const matches = rows.filter(
2926
+ (r) => (r?.item_type_data?.parent_path ?? r?.type_data?.parent_path) === parentPath
2927
+ );
2928
+ return matches[0] ?? null;
2929
+ },
2930
+ enabled
2931
+ });
2932
+ const arrangement = query.data ?? null;
2933
+ const order = useMemo(() => {
2934
+ const td = arrangement?.item_type_data ?? arrangement?.type_data ?? null;
2935
+ const o = td?.order;
2936
+ return Array.isArray(o) ? o : null;
2937
+ }, [arrangement]);
2938
+ const applyTo = useCallback(
2939
+ (children) => {
2940
+ if (!order || !children?.length) return children ?? [];
2941
+ const key = (c) => c.id ?? c.name ?? "";
2942
+ const rank = new Map(order.map((k, i) => [k, i]));
2943
+ const listed = [];
2944
+ const rest = [];
2945
+ for (const c of children) {
2946
+ (rank.has(key(c)) ? listed : rest).push(c);
2947
+ }
2948
+ listed.sort((a, b) => rank.get(key(a)) - rank.get(key(b)));
2949
+ return [...listed, ...rest];
2950
+ },
2951
+ [order]
2952
+ );
2953
+ return {
2954
+ ...query,
2955
+ arrangement,
2956
+ order,
2957
+ sourceScopeId: arrangement?.source_scope_id ?? null,
2958
+ sourceScopeName: arrangement?.source_scope_name ?? null,
2959
+ applyTo
2960
+ };
2961
+ }
2904
2962
 
2905
2963
  // src/schema-utils.ts
2906
2964
  function keyToLabel(key) {
@@ -3288,6 +3346,6 @@ function useFileUpload() {
3288
3346
  // src/index.ts
3289
3347
  __registerSdkExports(src_exports);
3290
3348
 
3291
- export { ComponentRenderer, EnforcementDeniedError, KernelProvider, auth, awaitScopeReady, callTool, clearCachedToken, clearSession, createItem, disconnectSSE, disposeVfsRealtimeWs, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAssetUrl, getDefaultSort, getRequiredFormFields, getScope, getScopeVersion, getSessionEntry, initSession, initVfsRealtimeWs, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isScopeReady, listChildren, mount, mountRealtimeScope, normalizeItem, ping, pushChanges, queryClient, readItem, registerCleanup, resetAllSdkState, resolvePrincipalId, setCachedToken, setScope, setupRequireShim, signal, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAllChannels, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useScope, useScopeReady, useSearch, useTheme, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, vfsKeys };
3349
+ export { ComponentRenderer, EnforcementDeniedError, KernelProvider, auth, awaitScopeReady, callTool, clearCachedToken, clearSession, createItem, disconnectSSE, disposeVfsRealtimeWs, emitEvent, fetchChannelMessages, fetchChannelMessagesPage, fetchChannelMessagesWithCards, fetchEdgesForItem, fetchItemHistory, fetchItemVersions, fetchItems, fetchMemberFocus, fetchOpenEnvelope, fetchRecentActivity, fetchTypeDefinitions, fetchVfsChildren, fetchVfsChildrenPage, fetchVfsItem, fetchVfsItemById, fetchVfsTree, gatewayCall, getAccessToken, getAssetUrl, getDefaultSort, getRequiredFormFields, getScope, getScopeVersion, getSessionEntry, initSession, initVfsRealtimeWs, interpretSchema, invalidateAllVfs, invalidateChannelMessages, invalidateChildren, invalidateItem, invalidateOpenEnvelope, invalidatePathAndParent, invalidateSubtree, invalidateTypes, isScopeReady, listChildren, mount, mountRealtimeScope, normalizeItem, ping, pushChanges, queryClient, readItem, registerCleanup, resetAllSdkState, resolvePrincipalId, setCachedToken, setScope, setupRequireShim, signal, subscribeScope, subscribeToEvents, subscribeToPath, subscribeToScope, unmountRealtimeScope, updateItem, uploadFile, useAccounts, useAllChannels, useArrangement, useAsset, useAuth, useChannelMessages, useChannels, useChildren, useComponent, useCreate, useDelete, useDmChannels, useEdges, useEventStream, useFileUpload, useInfiniteChannelMessages, useInfiniteChildren, useInfiniteItems, useItem, useItemById, useItemHistory, useItemVersions, useItems, useLink, useList, useMemberFocus, useMove, useMutation, useNotifications, useOpen, usePermission, usePermissions, usePrincipal, useRealtimeQuery, useRecentActivity, useResolve, useScope, useScopeReady, useSearch, useTheme, useTool, useTree, useType, useTypeHelpers, useTypes, useUnreadCounts, useUpdate, vfsKeys };
3292
3350
  //# sourceMappingURL=index.js.map
3293
3351
  //# sourceMappingURL=index.js.map