@osdk/react-components 0.27.0-main-f30c848b76a63887b5cabedf6d80ee3e9ef4956d → 0.27.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.
Files changed (121) hide show
  1. package/CHANGELOG.md +3 -9
  2. package/build/browser/object-table/ObjectTable.js +19 -15
  3. package/build/browser/object-table/ObjectTable.js.map +1 -1
  4. package/build/browser/object-table/ObjectTableApi.js.map +1 -1
  5. package/build/browser/object-table/hooks/useFunctionColumnsData.js +10 -46
  6. package/build/browser/object-table/hooks/useFunctionColumnsData.js.map +1 -1
  7. package/build/browser/object-table/hooks/useObjectTableData.js +0 -2
  8. package/build/browser/object-table/hooks/useObjectTableData.js.map +1 -1
  9. package/build/browser/object-table/hooks/useObjectTableSnapshot.js +99 -0
  10. package/build/browser/object-table/hooks/useObjectTableSnapshot.js.map +1 -0
  11. package/build/browser/object-table/hooks/useTableSorting.js +8 -0
  12. package/build/browser/object-table/hooks/useTableSorting.js.map +1 -1
  13. package/build/browser/object-table/utils/functionColumns.js +54 -0
  14. package/build/browser/object-table/utils/functionColumns.js.map +1 -0
  15. package/build/browser/object-table/utils/objectTableSnapshot.js +150 -0
  16. package/build/browser/object-table/utils/objectTableSnapshot.js.map +1 -0
  17. package/build/browser/object-table/utils/types.js.map +1 -1
  18. package/build/browser/public/experimental/object-table.js.map +1 -1
  19. package/build/browser/util/UserAgent.js +1 -1
  20. package/build/browser/util/UserAgent.js.map +1 -1
  21. package/build/cjs/chunk-6E4GBYIW.cjs +11 -0
  22. package/build/cjs/{chunk-WPVYJ3KW.cjs.map → chunk-6E4GBYIW.cjs.map} +1 -1
  23. package/build/cjs/{chunk-477DB7H2.cjs → chunk-76WC644D.cjs} +4 -4
  24. package/build/cjs/{chunk-477DB7H2.cjs.map → chunk-76WC644D.cjs.map} +1 -1
  25. package/build/cjs/{chunk-6GGSXWL2.cjs → chunk-BPCDFFIB.cjs} +4 -4
  26. package/build/cjs/{chunk-6GGSXWL2.cjs.map → chunk-BPCDFFIB.cjs.map} +1 -1
  27. package/build/cjs/{chunk-IEWMQQQR.cjs → chunk-FO5CHXTP.cjs} +3 -3
  28. package/build/cjs/chunk-FO5CHXTP.cjs.map +1 -0
  29. package/build/cjs/{chunk-5LMNAL56.cjs → chunk-G7KK3TDF.cjs} +4 -4
  30. package/build/cjs/{chunk-5LMNAL56.cjs.map → chunk-G7KK3TDF.cjs.map} +1 -1
  31. package/build/cjs/chunk-GDEAEMAN.cjs +11 -0
  32. package/build/cjs/{chunk-6R3MRKGU.cjs.map → chunk-GDEAEMAN.cjs.map} +1 -1
  33. package/build/cjs/{chunk-RWLI6HHF.cjs → chunk-J3AQ2RZM.cjs} +4 -4
  34. package/build/cjs/{chunk-RWLI6HHF.cjs.map → chunk-J3AQ2RZM.cjs.map} +1 -1
  35. package/build/cjs/chunk-KDF6WIDM.cjs +11 -0
  36. package/build/cjs/{chunk-IP7DWEK2.cjs.map → chunk-KDF6WIDM.cjs.map} +1 -1
  37. package/build/cjs/{chunk-ADHOB7MO.cjs → chunk-LYDFGXDQ.cjs} +175 -220
  38. package/build/cjs/chunk-LYDFGXDQ.cjs.map +1 -0
  39. package/build/cjs/{chunk-R5Z4I3IJ.cjs → chunk-Q7WLFDL4.cjs} +4 -4
  40. package/build/cjs/{chunk-R5Z4I3IJ.cjs.map → chunk-Q7WLFDL4.cjs.map} +1 -1
  41. package/build/cjs/chunk-U35KSZVY.cjs +11 -0
  42. package/build/cjs/{chunk-QW7XCUA6.cjs.map → chunk-U35KSZVY.cjs.map} +1 -1
  43. package/build/cjs/{chunk-GDPJN5SA.cjs → chunk-VL4VZJ6J.cjs} +4 -4
  44. package/build/cjs/{chunk-GDPJN5SA.cjs.map → chunk-VL4VZJ6J.cjs.map} +1 -1
  45. package/build/cjs/{chunk-HVJJSDOV.cjs → chunk-WQOG6LR4.cjs} +4 -4
  46. package/build/cjs/{chunk-HVJJSDOV.cjs.map → chunk-WQOG6LR4.cjs.map} +1 -1
  47. package/build/cjs/chunk-WV267H2C.cjs +11 -0
  48. package/build/cjs/{chunk-GOFNMLU4.cjs.map → chunk-WV267H2C.cjs.map} +1 -1
  49. package/build/cjs/public/experimental/action-form.cjs +4 -4
  50. package/build/cjs/public/experimental/cbac-picker.cjs +13 -13
  51. package/build/cjs/public/experimental/document-viewer.cjs +4 -4
  52. package/build/cjs/public/experimental/email-viewer.cjs +3 -3
  53. package/build/cjs/public/experimental/excel-viewer.cjs +3 -3
  54. package/build/cjs/public/experimental/filter-list.cjs +15 -15
  55. package/build/cjs/public/experimental/image-viewer.cjs +3 -3
  56. package/build/cjs/public/experimental/markdown-renderer.cjs +3 -3
  57. package/build/cjs/public/experimental/object-table.cjs +8 -8
  58. package/build/cjs/public/experimental/object-table.d.cts +88 -69
  59. package/build/cjs/public/experimental/pdf-viewer.cjs +7 -7
  60. package/build/cjs/public/experimental/tiff-renderer.cjs +3 -3
  61. package/build/cjs/public/experimental/video-viewer.cjs +3 -3
  62. package/build/cjs/public/experimental/xml-viewer.cjs +3 -3
  63. package/build/cjs/public/experimental.cjs +60 -60
  64. package/build/cjs/public/experimental.d.cts +1 -1
  65. package/build/esm/object-table/ObjectTable.js +19 -15
  66. package/build/esm/object-table/ObjectTable.js.map +1 -1
  67. package/build/esm/object-table/ObjectTableApi.js.map +1 -1
  68. package/build/esm/object-table/hooks/useFunctionColumnsData.js +10 -46
  69. package/build/esm/object-table/hooks/useFunctionColumnsData.js.map +1 -1
  70. package/build/esm/object-table/hooks/useObjectTableData.js +0 -2
  71. package/build/esm/object-table/hooks/useObjectTableData.js.map +1 -1
  72. package/build/esm/object-table/hooks/useObjectTableSnapshot.js +99 -0
  73. package/build/esm/object-table/hooks/useObjectTableSnapshot.js.map +1 -0
  74. package/build/esm/object-table/hooks/useTableSorting.js +8 -0
  75. package/build/esm/object-table/hooks/useTableSorting.js.map +1 -1
  76. package/build/esm/object-table/utils/functionColumns.js +54 -0
  77. package/build/esm/object-table/utils/functionColumns.js.map +1 -0
  78. package/build/esm/object-table/utils/objectTableSnapshot.js +150 -0
  79. package/build/esm/object-table/utils/objectTableSnapshot.js.map +1 -0
  80. package/build/esm/object-table/utils/types.js.map +1 -1
  81. package/build/esm/public/experimental/object-table.js.map +1 -1
  82. package/build/esm/util/UserAgent.js +1 -1
  83. package/build/esm/util/UserAgent.js.map +1 -1
  84. package/build/types/object-table/ObjectTable.d.ts.map +1 -1
  85. package/build/types/object-table/ObjectTableApi.d.ts +96 -77
  86. package/build/types/object-table/ObjectTableApi.d.ts.map +1 -1
  87. package/build/types/object-table/hooks/useFunctionColumnsData.d.ts +1 -2
  88. package/build/types/object-table/hooks/useFunctionColumnsData.d.ts.map +1 -1
  89. package/build/types/object-table/hooks/useObjectTableSnapshot.d.ts +45 -0
  90. package/build/types/object-table/hooks/useObjectTableSnapshot.d.ts.map +1 -0
  91. package/build/types/object-table/hooks/useTableSorting.d.ts +7 -2
  92. package/build/types/object-table/hooks/useTableSorting.d.ts.map +1 -1
  93. package/build/types/object-table/utils/functionColumns.d.ts +30 -0
  94. package/build/types/object-table/utils/functionColumns.d.ts.map +1 -0
  95. package/build/types/object-table/utils/objectTableSnapshot.d.ts +49 -0
  96. package/build/types/object-table/utils/objectTableSnapshot.d.ts.map +1 -0
  97. package/build/types/object-table/utils/types.d.ts +5 -0
  98. package/build/types/object-table/utils/types.d.ts.map +1 -1
  99. package/build/types/public/experimental/object-table.d.ts +1 -1
  100. package/build/types/public/experimental/object-table.d.ts.map +1 -1
  101. package/docs/ObjectTable.md +67 -0
  102. package/package.json +7 -7
  103. package/build/browser/object-table/hooks/useObjectTableSnapshotHandle.js +0 -177
  104. package/build/browser/object-table/hooks/useObjectTableSnapshotHandle.js.map +0 -1
  105. package/build/browser/object-table/utils/createObjectTableSnapshot.js +0 -86
  106. package/build/browser/object-table/utils/createObjectTableSnapshot.js.map +0 -1
  107. package/build/cjs/chunk-6R3MRKGU.cjs +0 -11
  108. package/build/cjs/chunk-ADHOB7MO.cjs.map +0 -1
  109. package/build/cjs/chunk-GOFNMLU4.cjs +0 -11
  110. package/build/cjs/chunk-IEWMQQQR.cjs.map +0 -1
  111. package/build/cjs/chunk-IP7DWEK2.cjs +0 -11
  112. package/build/cjs/chunk-QW7XCUA6.cjs +0 -11
  113. package/build/cjs/chunk-WPVYJ3KW.cjs +0 -11
  114. package/build/esm/object-table/hooks/useObjectTableSnapshotHandle.js +0 -177
  115. package/build/esm/object-table/hooks/useObjectTableSnapshotHandle.js.map +0 -1
  116. package/build/esm/object-table/utils/createObjectTableSnapshot.js +0 -86
  117. package/build/esm/object-table/utils/createObjectTableSnapshot.js.map +0 -1
  118. package/build/types/object-table/hooks/useObjectTableSnapshotHandle.d.ts +0 -38
  119. package/build/types/object-table/hooks/useObjectTableSnapshotHandle.d.ts.map +0 -1
  120. package/build/types/object-table/utils/createObjectTableSnapshot.d.ts +0 -18
  121. package/build/types/object-table/utils/createObjectTableSnapshot.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,19 +1,13 @@
1
1
  # @osdk/react-components
2
2
 
3
- ## 0.27.0-main-f30c848b76a63887b5cabedf6d80ee3e9ef4956d
3
+ ## 0.27.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
+ - 820bc7b: Fix listogram bar border-radius distortion and use theme-aware background token
7
8
  - 3c39c10: Merge `@osdk/cbac-components` into `@osdk/react-components`. The CBAC picker (`CbacPicker`, `CbacPickerDialog`, `CbacBanner`, `BaseCbacPicker`, `BaseCbacBanner`, `BaseCbacPickerDialog`, `MaxClassificationField`, and selection-logic utilities) is now exported from `@osdk/react-components/experimental/cbac-picker`. The legacy `@osdk/cbac-components` package remains in the repository for reference but is no longer the source of truth.
8
9
  - f30c848: - new `focusedRow` / `onFocusedRowChanged` props expose controlled focus state (typed `PrimaryKeyType<Q> | null`).
9
-
10
- ### Patch Changes
11
-
12
- - 820bc7b: Fix listogram bar border-radius distortion and use theme-aware background token
13
- - Updated dependencies [db8df24]
14
- - @osdk/client@2.29.1-main-f30c848b76a63887b5cabedf6d80ee3e9ef4956d
15
- - @osdk/api@2.29.1-main-f30c848b76a63887b5cabedf6d80ee3e9ef4956d
16
- - @osdk/react@2.29.1-main-f30c848b76a63887b5cabedf6d80ee3e9ef4956d
10
+ - 2d40fb6: Update getSnapshot() implementation to fetch data separately from table rendering, capping concurrent function-column requests during snapshot collection
17
11
 
18
12
  ## 0.26.0
19
13
 
@@ -15,14 +15,14 @@
15
15
  */
16
16
 
17
17
  import { getCoreRowModel, useReactTable } from "@tanstack/react-table";
18
- import React, { useCallback, useMemo } from "react";
18
+ import React, { useCallback, useImperativeHandle, useMemo } from "react";
19
19
  import { useColumnDefs } from "./hooks/useColumnDefs.js";
20
20
  import { useColumnPinning } from "./hooks/useColumnPinning.js";
21
21
  import { useColumnResize } from "./hooks/useColumnResize.js";
22
22
  import { useColumnVisibility } from "./hooks/useColumnVisibility.js";
23
23
  import { useEditableTable } from "./hooks/useEditableTable.js";
24
24
  import { useObjectTableData } from "./hooks/useObjectTableData.js";
25
- import { useObjectTableSnapshotHandle } from "./hooks/useObjectTableSnapshotHandle.js";
25
+ import { useObjectTableSnapshot } from "./hooks/useObjectTableSnapshot.js";
26
26
  import { useRowSelection } from "./hooks/useRowSelection.js";
27
27
  import { useSelectionColumn } from "./hooks/useSelectionColumn.js";
28
28
  import { useTableSorting } from "./hooks/useTableSorting.js";
@@ -83,7 +83,8 @@ export function ObjectTable({
83
83
  });
84
84
  const {
85
85
  sorting,
86
- onSortingChange
86
+ onSortingChange,
87
+ orderByState
87
88
  } = useTableSorting({
88
89
  orderBy,
89
90
  defaultOrderBy,
@@ -92,7 +93,6 @@ export function ObjectTable({
92
93
  const {
93
94
  data,
94
95
  fetchMore,
95
- hasMore,
96
96
  isLoading,
97
97
  error,
98
98
  totalCount,
@@ -193,20 +193,24 @@ export function ObjectTable({
193
193
  validationErrors: editableConfig.validationErrors
194
194
  }
195
195
  });
196
+ const {
197
+ getSnapshot
198
+ } = useObjectTableSnapshot({
199
+ objectOrInterfaceType: objectType,
200
+ table,
201
+ columnDefinitions,
202
+ objectSet: resultingObjectSet,
203
+ pageSize,
204
+ totalCount,
205
+ orderBy: orderByState
206
+ });
207
+ useImperativeHandle(tableRef, () => ({
208
+ getSnapshot
209
+ }), [getSnapshot]);
196
210
  const onRenderCellContextMenu = useCallback((row, cell) => {
197
211
  return renderCellContextMenu?.(row, cell.getValue());
198
212
  }, [renderCellContextMenu]);
199
213
  const handleColumnHeaderClick = useMemo(() => onColumnHeaderClick ? columnId => onColumnHeaderClick(columnId) : undefined, [onColumnHeaderClick]);
200
- const isTableLoading = isLoading || isColumnsLoading;
201
- useObjectTableSnapshotHandle({
202
- tableRef,
203
- table,
204
- hasNextPage: hasMore,
205
- isLoading: isTableLoading,
206
- error,
207
- totalCount,
208
- fetchMore
209
- });
210
214
  const headerMenuFeatureFlags = useMemo(() => ({
211
215
  showSortingItems: enableOrdering,
212
216
  showPinningItems: enableColumnPinning,
@@ -215,7 +219,7 @@ export function ObjectTable({
215
219
  }), [enableOrdering, enableColumnPinning, enableColumnResizing, enableColumnConfig]);
216
220
  return /*#__PURE__*/React.createElement(BaseTable, {
217
221
  table: table,
218
- isLoading: isTableLoading,
222
+ isLoading: isLoading || isColumnsLoading,
219
223
  fetchNextPage: fetchMore,
220
224
  onRowClick: props.onRowClick,
221
225
  onColumnHeaderClick: handleColumnHeaderClick,
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectTable.js","names":["getCoreRowModel","useReactTable","React","useCallback","useMemo","useColumnDefs","useColumnPinning","useColumnResize","useColumnVisibility","useEditableTable","useObjectTableData","useObjectTableSnapshotHandle","useRowSelection","useSelectionColumn","useTableSorting","BaseTable","deriveSelectionObjectSet","getRowId","getRowIdFromPrimaryKey","EMPTY_ARRAY","ObjectTable","objectType","objectSet","columnDefinitions","filter","objectSetOptions","dedupeIntervalMs","pageSize","streamUpdates","orderBy","defaultOrderBy","onOrderByChanged","onColumnsPinnedChanged","onColumnResize","onRowSelection","onRowSelectionChanged","onColumnHeaderClick","renderCellContextMenu","selectionMode","selectedRows","isAllSelected","isAllSelectedProp","onColumnVisibilityChanged","onCellValueChanged","onSubmitEdits","enableOrdering","enableColumnPinning","enableColumnResizing","enableColumnConfig","editMode","focusedRow","onFocusedRowChanged","tableRef","props","columnSizing","onColumnSizingChange","sorting","onSortingChange","data","fetchMore","hasMore","isLoading","error","totalCount","resultingObjectSet","columns","loading","isColumnsLoading","handleRowSelectionChanged","change","isSelectAll","rowSelection","hasSelection","onToggleAll","onToggleRow","enableRowSelection","selectionColumn","columnVisibility","onColumnVisibilityChange","columnOrder","onColumnOrderChange","allColumns","columnPinning","onColumnPinningChange","hasSelectionColumn","editableConfig","table","state","enableSorting","columnResizeMode","columnResizeDirection","manualSorting","defaultColumn","minSize","meta","onCellEdit","onCellValidationError","clearCellValidationError","cellEdits","isInEditMode","editModeState","isActive","validationErrors","onRenderCellContextMenu","row","cell","getValue","handleColumnHeaderClick","columnId","undefined","isTableLoading","hasNextPage","headerMenuFeatureFlags","showSortingItems","showPinningItems","showResizeItem","showConfigItem","createElement","fetchNextPage","onRowClick","rowHeight","renderEmptyState","className","getRowAttributes","showEditFooter","focusedRowId"],"sources":["ObjectTable.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { Cell } from \"@tanstack/react-table\";\nimport { getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport React, { useCallback, useMemo } from \"react\";\nimport { useColumnDefs } from \"./hooks/useColumnDefs.js\";\nimport { useColumnPinning } from \"./hooks/useColumnPinning.js\";\nimport { useColumnResize } from \"./hooks/useColumnResize.js\";\nimport { useColumnVisibility } from \"./hooks/useColumnVisibility.js\";\nimport { useEditableTable } from \"./hooks/useEditableTable.js\";\nimport { useObjectTableData } from \"./hooks/useObjectTableData.js\";\nimport { useObjectTableSnapshotHandle } from \"./hooks/useObjectTableSnapshotHandle.js\";\nimport type { UseRowSelectionChange } from \"./hooks/useRowSelection.js\";\nimport { useRowSelection } from \"./hooks/useRowSelection.js\";\nimport { useSelectionColumn } from \"./hooks/useSelectionColumn.js\";\nimport { useTableSorting } from \"./hooks/useTableSorting.js\";\nimport type { ObjectTableProps } from \"./ObjectTableApi.js\";\nimport { BaseTable } from \"./Table.js\";\nimport type { HeaderMenuFeatureFlags } from \"./TableHeaderWithPopover.js\";\nimport { deriveSelectionObjectSet } from \"./utils/deriveSelectionObjectSet.js\";\nimport { getRowId, getRowIdFromPrimaryKey } from \"./utils/getRowId.js\";\nimport type { EditableConfig } from \"./utils/types.js\";\n\nconst EMPTY_ARRAY: [] = [];\n\n/**\n * ObjectTable - A headless table component for displaying OSDK object sets\n *\n * @example\n * ```tsx\n * <ObjectTable objectType={MyObjectType} />\n * ```\n */\n\nexport function ObjectTable<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>({\n objectType,\n objectSet,\n columnDefinitions,\n filter,\n objectSetOptions,\n dedupeIntervalMs,\n pageSize,\n streamUpdates,\n orderBy,\n defaultOrderBy,\n onOrderByChanged,\n onColumnsPinnedChanged,\n onColumnResize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- intentional pass-through to fire alongside onRowSelectionChanged for backwards compatibility\n onRowSelection,\n onRowSelectionChanged,\n onColumnHeaderClick,\n renderCellContextMenu,\n selectionMode = \"none\",\n selectedRows,\n isAllSelected: isAllSelectedProp,\n onColumnVisibilityChanged,\n onCellValueChanged,\n onSubmitEdits,\n enableOrdering = true,\n enableColumnPinning = true,\n enableColumnResizing = true,\n enableColumnConfig = true,\n editMode = \"manual\",\n focusedRow,\n onFocusedRowChanged,\n tableRef,\n ...props\n}: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement {\n const { columnSizing, onColumnSizingChange } = useColumnResize({\n onColumnResize,\n });\n\n const { sorting, onSortingChange } = useTableSorting<\n Q,\n RDPs,\n FunctionColumns\n >(\n {\n orderBy,\n defaultOrderBy,\n onOrderByChanged,\n },\n );\n\n const {\n data,\n fetchMore,\n hasMore,\n isLoading,\n error,\n totalCount,\n objectSet: resultingObjectSet,\n } = useObjectTableData<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n filter,\n sorting,\n objectSet,\n objectSetOptions,\n dedupeIntervalMs,\n pageSize,\n streamUpdates,\n );\n\n const { columns, loading: isColumnsLoading } = useColumnDefs<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n );\n\n const handleRowSelectionChanged = useCallback(\n (change: UseRowSelectionChange<Q, RDPs>) => {\n if (!onRowSelectionChanged) return;\n\n onRowSelectionChanged({\n selectedRows: change.selectedRows,\n isSelectAll: change.isSelectAll,\n objectSet: deriveSelectionObjectSet(resultingObjectSet, change),\n });\n },\n [\n onRowSelectionChanged,\n resultingObjectSet,\n ],\n );\n\n const {\n rowSelection,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n enableRowSelection,\n } = useRowSelection<Q, RDPs>({\n selectionMode,\n selectedRows,\n isAllSelected: isAllSelectedProp,\n onRowSelection,\n onRowSelectionChanged: handleRowSelectionChanged,\n data,\n });\n\n const selectionColumn = useSelectionColumn<Q, RDPs>(\n {\n selectionMode,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n },\n );\n\n const {\n columnVisibility,\n onColumnVisibilityChange,\n columnOrder,\n onColumnOrderChange,\n } = useColumnVisibility({\n allColumns: columns,\n onColumnVisibilityChanged,\n });\n\n const { columnPinning, onColumnPinningChange } = useColumnPinning({\n columnDefinitions,\n hasSelectionColumn: enableRowSelection,\n onColumnsPinnedChanged,\n });\n\n const allColumns = useMemo(() => {\n return selectionColumn ? [selectionColumn, ...columns] : columns;\n }, [selectionColumn, columns]);\n\n const editableConfig: EditableConfig<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n > = useEditableTable({\n editMode,\n onCellValueChanged,\n onSubmitEdits,\n });\n\n const table = useReactTable<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n >({\n data: data ?? EMPTY_ARRAY,\n columns: allColumns,\n getCoreRowModel: getCoreRowModel(),\n state: {\n columnVisibility,\n columnOrder,\n rowSelection,\n sorting,\n columnSizing,\n columnPinning,\n },\n onSortingChange,\n onColumnSizingChange,\n onColumnPinningChange,\n onColumnVisibilityChange,\n onColumnOrderChange,\n enableRowSelection,\n enableSorting: enableOrdering,\n columnResizeMode: \"onChange\",\n columnResizeDirection: \"ltr\",\n manualSorting: true, // Enable manual sorting to indicate server-side sorting\n defaultColumn: {\n minSize: 80,\n },\n getRowId,\n meta: {\n onCellEdit: editableConfig.onCellEdit,\n onCellValidationError: editableConfig.onCellValidationError,\n clearCellValidationError: editableConfig.clearCellValidationError,\n cellEdits: editableConfig.cellEdits,\n isInEditMode: editableConfig.editModeState.isActive,\n validationErrors: editableConfig.validationErrors,\n },\n });\n\n const onRenderCellContextMenu = useCallback(\n (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cell: Cell<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => {\n return renderCellContextMenu?.(row, cell.getValue());\n },\n [renderCellContextMenu],\n );\n\n const handleColumnHeaderClick = useMemo(\n () =>\n onColumnHeaderClick\n ? (columnId: string) =>\n onColumnHeaderClick(\n columnId as\n | PropertyKeys<Q>\n | keyof RDPs\n | keyof FunctionColumns,\n )\n : undefined,\n [onColumnHeaderClick],\n );\n\n const isTableLoading = isLoading || isColumnsLoading;\n\n useObjectTableSnapshotHandle({\n tableRef,\n table,\n hasNextPage: hasMore,\n isLoading: isTableLoading,\n error,\n totalCount,\n fetchMore,\n });\n\n const headerMenuFeatureFlags: HeaderMenuFeatureFlags = useMemo(() => ({\n showSortingItems: enableOrdering,\n showPinningItems: enableColumnPinning,\n showResizeItem: enableColumnResizing,\n showConfigItem: enableColumnConfig,\n }), [\n enableOrdering,\n enableColumnPinning,\n enableColumnResizing,\n enableColumnConfig,\n ]);\n\n return (\n <BaseTable<Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>>\n table={table}\n isLoading={isTableLoading}\n fetchNextPage={fetchMore}\n onRowClick={props.onRowClick}\n onColumnHeaderClick={handleColumnHeaderClick}\n rowHeight={props.rowHeight}\n renderCellContextMenu={onRenderCellContextMenu}\n renderEmptyState={props.renderEmptyState}\n className={props.className}\n error={error}\n headerMenuFeatureFlags={headerMenuFeatureFlags}\n editableConfig={editableConfig}\n getRowAttributes={props.getRowAttributes}\n showEditFooter={props.showEditFooter}\n focusedRowId={focusedRow == null\n ? focusedRow\n : getRowIdFromPrimaryKey<Q>(focusedRow)}\n onFocusedRowChanged={onFocusedRowChanged}\n />\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,eAAe,EAAEC,aAAa,QAAQ,uBAAuB;AACtE,OAAOC,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,m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sB,EAAEA,sBAAuB;IAC/C3B,cAAc,EAAEA,cAAe;IAC/BsC,gBAAgB,EAAEtE,KAAK,CAACsE,gBAAiB;IACzCC,cAAc,EAAEvE,KAAK,CAACuE,cAAe;IACrCC,YAAY,EAAE3E,UAAU,IAAI,IAAI,GAC5BA,UAAU,GACVhC,sBAAsB,CAAIgC,UAAU,CAAE;IAC1CC,mBAAmB,EAAEA;EAAoB,CAC1C,CAAC;AAEN","ignoreList":[]}
1
+ {"version":3,"file":"ObjectTable.js","names":["getCoreRowModel","useReactTable","React","useCallback","useImperativeHandle","useMemo","useColumnDefs","useColumnPinning","useColumnResize","useColumnVisibility","useEditableTable","useObjectTableData","useObjectTableSnapshot","useRowSelection","useSelectionColumn","useTableSorting","BaseTable","deriveSelectionObjectSet","getRowId","getRowIdFromPrimaryKey","EMPTY_ARRAY","ObjectTable","objectType","objectSet","columnDefinitions","filter","objectSetOptions","dedupeIntervalMs","pageSize","streamUpdates","orderBy","defaultOrderBy","onOrderByChanged","onColumnsPinnedChanged","onColumnResize","onRowSelection","onRowSelectionChanged","onColumnHeaderClick","renderCellContextMenu","selectionMode","selectedRows","isAllSelected","isAllSelectedProp","onColumnVisibilityChanged","onCellValueChanged","onSubmitEdits","enableOrdering","enableColumnPinning","enableColumnResizing","enableColumnConfig","editMode","focusedRow","onFocusedRowChanged","tableRef","props","columnSizing","onColumnSizingChange","sorting","onSortingChange","orderByState","data","fetchMore","isLoading","error","totalCount","resultingObjectSet","columns","loading","isColumnsLoading","handleRowSelectionChanged","change","isSelectAll","rowSelection","hasSelection","onToggleAll","onToggleRow","enableRowSelection","selectionColumn","columnVisibility","onColumnVisibilityChange","columnOrder","onColumnOrderChange","allColumns","columnPinning","onColumnPinningChange","hasSelectionColumn","editableConfig","table","state","enableSorting","columnResizeMode","columnResizeDirection","manualSorting","defaultColumn","minSize","meta","onCellEdit","onCellValidationError","clearCellValidationError","cellEdits","isInEditMode","editModeState","isActive","validationErrors","getSnapshot","objectOrInterfaceType","onRenderCellContextMenu","row","cell","getValue","handleColumnHeaderClick","columnId","undefined","headerMenuFeatureFlags","showSortingItems","showPinningItems","showResizeItem","showConfigItem","createElement","fetchNextPage","onRowClick","rowHeight","renderEmptyState","className","getRowAttributes","showEditFooter","focusedRowId"],"sources":["ObjectTable.tsx"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport type { Cell } from \"@tanstack/react-table\";\nimport { getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport React, { useCallback, useImperativeHandle, useMemo } from \"react\";\nimport { useColumnDefs } from \"./hooks/useColumnDefs.js\";\nimport { useColumnPinning } from \"./hooks/useColumnPinning.js\";\nimport { useColumnResize } from \"./hooks/useColumnResize.js\";\nimport { useColumnVisibility } from \"./hooks/useColumnVisibility.js\";\nimport { useEditableTable } from \"./hooks/useEditableTable.js\";\nimport { useObjectTableData } from \"./hooks/useObjectTableData.js\";\nimport { useObjectTableSnapshot } from \"./hooks/useObjectTableSnapshot.js\";\nimport type { UseRowSelectionChange } from \"./hooks/useRowSelection.js\";\nimport { useRowSelection } from \"./hooks/useRowSelection.js\";\nimport { useSelectionColumn } from \"./hooks/useSelectionColumn.js\";\nimport { useTableSorting } from \"./hooks/useTableSorting.js\";\nimport type { ObjectTableProps } from \"./ObjectTableApi.js\";\nimport { BaseTable } from \"./Table.js\";\nimport type { HeaderMenuFeatureFlags } from \"./TableHeaderWithPopover.js\";\nimport { deriveSelectionObjectSet } from \"./utils/deriveSelectionObjectSet.js\";\nimport { getRowId, getRowIdFromPrimaryKey } from \"./utils/getRowId.js\";\nimport type { EditableConfig } from \"./utils/types.js\";\n\nconst EMPTY_ARRAY: [] = [];\n\n/**\n * ObjectTable - A headless table component for displaying OSDK object sets\n *\n * @example\n * ```tsx\n * <ObjectTable objectType={MyObjectType} />\n * ```\n */\n\nexport function ObjectTable<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>({\n objectType,\n objectSet,\n columnDefinitions,\n filter,\n objectSetOptions,\n dedupeIntervalMs,\n pageSize,\n streamUpdates,\n orderBy,\n defaultOrderBy,\n onOrderByChanged,\n onColumnsPinnedChanged,\n onColumnResize,\n // eslint-disable-next-line @typescript-eslint/no-deprecated -- intentional pass-through to fire alongside onRowSelectionChanged for backwards compatibility\n onRowSelection,\n onRowSelectionChanged,\n onColumnHeaderClick,\n renderCellContextMenu,\n selectionMode = \"none\",\n selectedRows,\n isAllSelected: isAllSelectedProp,\n onColumnVisibilityChanged,\n onCellValueChanged,\n onSubmitEdits,\n enableOrdering = true,\n enableColumnPinning = true,\n enableColumnResizing = true,\n enableColumnConfig = true,\n editMode = \"manual\",\n focusedRow,\n onFocusedRowChanged,\n tableRef,\n ...props\n}: ObjectTableProps<Q, RDPs, FunctionColumns>): React.ReactElement {\n const { columnSizing, onColumnSizingChange } = useColumnResize({\n onColumnResize,\n });\n\n const { sorting, onSortingChange, orderByState } = useTableSorting<\n Q,\n RDPs,\n FunctionColumns\n >(\n {\n orderBy,\n defaultOrderBy,\n onOrderByChanged,\n },\n );\n\n const {\n data,\n fetchMore,\n isLoading,\n error,\n totalCount,\n objectSet: resultingObjectSet,\n } = useObjectTableData<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n filter,\n sorting,\n objectSet,\n objectSetOptions,\n dedupeIntervalMs,\n pageSize,\n streamUpdates,\n );\n\n const { columns, loading: isColumnsLoading } = useColumnDefs<\n Q,\n RDPs,\n FunctionColumns\n >(\n objectType,\n columnDefinitions,\n );\n\n const handleRowSelectionChanged = useCallback(\n (change: UseRowSelectionChange<Q, RDPs>) => {\n if (!onRowSelectionChanged) return;\n\n onRowSelectionChanged({\n selectedRows: change.selectedRows,\n isSelectAll: change.isSelectAll,\n objectSet: deriveSelectionObjectSet(resultingObjectSet, change),\n });\n },\n [\n onRowSelectionChanged,\n resultingObjectSet,\n ],\n );\n\n const {\n rowSelection,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n enableRowSelection,\n } = useRowSelection<Q, RDPs>({\n selectionMode,\n selectedRows,\n isAllSelected: isAllSelectedProp,\n onRowSelection,\n onRowSelectionChanged: handleRowSelectionChanged,\n data,\n });\n\n const selectionColumn = useSelectionColumn<Q, RDPs>(\n {\n selectionMode,\n isAllSelected,\n hasSelection,\n onToggleAll,\n onToggleRow,\n },\n );\n\n const {\n columnVisibility,\n onColumnVisibilityChange,\n columnOrder,\n onColumnOrderChange,\n } = useColumnVisibility({\n allColumns: columns,\n onColumnVisibilityChanged,\n });\n\n const { columnPinning, onColumnPinningChange } = useColumnPinning({\n columnDefinitions,\n hasSelectionColumn: enableRowSelection,\n onColumnsPinnedChanged,\n });\n\n const allColumns = useMemo(() => {\n return selectionColumn ? [selectionColumn, ...columns] : columns;\n }, [selectionColumn, columns]);\n\n const editableConfig: EditableConfig<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n > = useEditableTable({\n editMode,\n onCellValueChanged,\n onSubmitEdits,\n });\n\n const table = useReactTable<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n >({\n data: data ?? EMPTY_ARRAY,\n columns: allColumns,\n getCoreRowModel: getCoreRowModel(),\n state: {\n columnVisibility,\n columnOrder,\n rowSelection,\n sorting,\n columnSizing,\n columnPinning,\n },\n onSortingChange,\n onColumnSizingChange,\n onColumnPinningChange,\n onColumnVisibilityChange,\n onColumnOrderChange,\n enableRowSelection,\n enableSorting: enableOrdering,\n columnResizeMode: \"onChange\",\n columnResizeDirection: \"ltr\",\n manualSorting: true, // Enable manual sorting to indicate server-side sorting\n defaultColumn: {\n minSize: 80,\n },\n getRowId,\n meta: {\n onCellEdit: editableConfig.onCellEdit,\n onCellValidationError: editableConfig.onCellValidationError,\n clearCellValidationError: editableConfig.clearCellValidationError,\n cellEdits: editableConfig.cellEdits,\n isInEditMode: editableConfig.editModeState.isActive,\n validationErrors: editableConfig.validationErrors,\n },\n });\n\n const { getSnapshot } = useObjectTableSnapshot<Q, RDPs, FunctionColumns>({\n objectOrInterfaceType: objectType,\n table,\n columnDefinitions,\n objectSet: resultingObjectSet,\n pageSize,\n totalCount,\n orderBy: orderByState,\n });\n\n useImperativeHandle(\n tableRef,\n () => ({ getSnapshot }),\n [getSnapshot],\n );\n\n const onRenderCellContextMenu = useCallback(\n (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cell: Cell<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => {\n return renderCellContextMenu?.(row, cell.getValue());\n },\n [renderCellContextMenu],\n );\n\n const handleColumnHeaderClick = useMemo(\n () =>\n onColumnHeaderClick\n ? (columnId: string) =>\n onColumnHeaderClick(\n columnId as\n | PropertyKeys<Q>\n | keyof RDPs\n | keyof FunctionColumns,\n )\n : undefined,\n [onColumnHeaderClick],\n );\n\n const isTableLoading = isLoading || isColumnsLoading;\n\n const headerMenuFeatureFlags: HeaderMenuFeatureFlags = useMemo(() => ({\n showSortingItems: enableOrdering,\n showPinningItems: enableColumnPinning,\n showResizeItem: enableColumnResizing,\n showConfigItem: enableColumnConfig,\n }), [\n enableOrdering,\n enableColumnPinning,\n enableColumnResizing,\n enableColumnConfig,\n ]);\n\n return (\n <BaseTable<Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>>\n table={table}\n isLoading={isTableLoading}\n fetchNextPage={fetchMore}\n onRowClick={props.onRowClick}\n onColumnHeaderClick={handleColumnHeaderClick}\n rowHeight={props.rowHeight}\n renderCellContextMenu={onRenderCellContextMenu}\n renderEmptyState={props.renderEmptyState}\n className={props.className}\n error={error}\n headerMenuFeatureFlags={headerMenuFeatureFlags}\n editableConfig={editableConfig}\n getRowAttributes={props.getRowAttributes}\n showEditFooter={props.showEditFooter}\n focusedRowId={focusedRow == null\n ? focusedRow\n : getRowIdFromPrimaryKey<Q>(focusedRow)}\n onFocusedRowChanged={onFocusedRowChanged}\n />\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA,SAASA,eAAe,EAAEC,aAAa,QAAQ,uBAAuB;AACtE,OAAOC,KAAK,IAAIC,WAAW,EAAEC,mBAAmB,EAAEC,OAAO,QAAQ,OAAO;AACxE,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,mBAAmB,QAAQ,gCAAgC;AACpE,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,sBAAsB,QAAQ,mCAAmC;AAE1E,SAASC,eAAe,QAAQ,4BAA4B;AAC5D,SAASC,kBAAkB,QAAQ,+BAA+B;AAClE,SAASC,eAAe,QAAQ,4BAA4B;AAE5D,SAASC,SAAS,QAAQ,YAAY;AAEtC,SAASC,wBAAwB,QAAQ,qCAAqC;AAC9E,SAASC,QAAQ,EAAEC,sBAAsB,QAAQ,qBAAqB;AAGtE,MAAMC,WAAe,GAAG,EAAE;;AAE1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO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.js","names":[],"sources":["ObjectTableApi.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { QueryParameterType } from \"@osdk/client/observable\";\nimport type * as React from \"react\";\nimport type { CellEditInfo, EditFieldConfig } from \"./utils/types.js\";\n\nexport type { EditFieldConfig } from \"./utils/types.js\";\n\nexport interface ObjectTableHandle<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n /**\n * Returns a point-in-time snapshot of ObjectTable's currently loaded data\n * and pagination state.\n *\n * The snapshot includes visible data columns only, excludes internal control\n * columns such as row selection, and does not fetch additional pages unless\n * a positive finite `rowLimit` is provided. `rowLimit` is a pagination\n * threshold, not a hard cap: the returned snapshot can contain more rows when\n * they were already loaded or when the final fetched page crosses the\n * threshold.\n * Cell values come from the table's accessor values, not from rendered React\n * content supplied by `renderCell`.\n *\n * `getSnapshot` always resolves, even when a paginated fetch fails: it returns\n * the rows loaded so far with the failure exposed on `snapshot.error`. Callers\n * that require a complete result (e.g. exporting all rows) must inspect\n * `snapshot.error` and `snapshot.hasNextPage` rather than assuming the snapshot\n * is complete.\n */\n getSnapshot: (\n options?: ObjectTableSnapshotOptions,\n ) => Promise<ObjectTableSnapshot<Q, RDPs>>;\n}\n\nexport interface ObjectTableSnapshotOptions {\n /**\n * Fetches additional pages until at least this many rows are loaded or\n * pagination stops.\n *\n * This is not a hard maximum. The returned snapshot can contain more rows\n * because ObjectTable keeps already-loaded rows and fetches full pages.\n */\n rowLimit?: number;\n}\n\nexport interface ObjectTableSnapshot<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n columns: ObjectTableDataColumn[];\n rows: ObjectTableDataRow<Q, RDPs>[];\n hasNextPage: boolean;\n isLoading: boolean;\n error: unknown | undefined;\n totalCount: string | undefined;\n}\n\nexport interface ObjectTableDataColumn {\n id: string;\n name: string;\n}\n\nexport interface ObjectTableDataRow<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n id: string;\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>;\n getValue: (columnId: string) => ObjectTableDataCell | undefined;\n}\n\nexport type ObjectTableDataCell =\n | { status: \"ready\"; value: unknown }\n | { status: \"loading\"; value: unknown | undefined }\n | { status: \"error\"; error: unknown; value: unknown | undefined };\n\nexport type ColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> =\n | EditableColumnDefinition<Q, RDPs, FunctionColumns>\n | ReadonlyColumnDefinition<Q, RDPs, FunctionColumns>;\n\ninterface SharedColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>;\n\n /**\n * @default true\n */\n isVisible?: boolean;\n\n /**\n * @default none\n */\n pinned?: \"left\" | \"right\" | \"none\";\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n resizable?: boolean;\n orderable?: boolean;\n filterable?: boolean;\n\n /**\n * Custom renderer for the cell value.\n *\n * Interaction with `editable` columns:\n * - When `editMode: \"manual\"` (default), `renderCell` is used while the\n * table is read-only (Edit Table button visible) and the editable cell\n * takes over once the user enters edit mode.\n * - When `editMode: \"always\"`, the editable cell always wins on editable\n * columns and `renderCell` is ignored — `editMode: \"always\"` opts the\n * column into a permanently-editable surface, leaving no read-only\n * state for `renderCell` to render. Use `editMode: \"manual\"` if you\n * need a custom display alongside editing.\n */\n renderCell?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n\n /**\n * If provided, this will be used in the column header.\n * If both columnName and renderHeader are provided, renderHeader will take precedence in the table header.\n * columnName will still be used in other parts where the column name is displayed.\n *\n * If not provided,\n * for a property column, the property displayName will be used\n * for other columns, the id will be used.\n */\n columnName?: string;\n\n /**\n * If provided, this will be used to render the header component.\n * When both columnName and renderHeader are provided, renderHeader will take precedence in the table header.\n */\n renderHeader?: () => React.ReactNode;\n}\n\ninterface EditableColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> extends SharedColumnDefinition<Q, RDPs, FunctionColumns> {\n /**\n * `editable` can be a boolean or a predicate that receives the row's object\n * and returns whether the cell is editable\n */\n editable:\n | true\n | ((\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => boolean);\n\n /**\n * Configuration for the cell editor component.\n *\n * When provided, the column uses the specified field component\n * (e.g. dropdown) instead of the default auto-detected text/number input.\n *\n * `getFieldComponentProps` receives the row's object and a map of any\n * pending edits for that row (keyed by column id), and returns the props to\n * pass to the field component. Editor configuration can depend on the\n * current row or on other in-progress edits within the row.\n */\n editFieldConfig?: EditFieldConfig<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n >;\n\n /**\n * Additional function to validate the cell value during edit.\n *\n * @param value the current cell value\n * @returns a promise that resolves to an error message string if validation fails, or undefined if validation succeeds\n */\n validateEdit?: (\n value: unknown,\n ) => Promise<string | undefined>;\n}\n\n/**\n * Column definition for a read-only column (default).\n * `editFieldConfig` and `validateEdit` are not available.\n */\ninterface ReadonlyColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> extends SharedColumnDefinition<Q, RDPs, FunctionColumns> {\n editable?: false;\n}\n\nexport type ExtractQueryParameters<\n Q extends QueryDefinition,\n> = CompileTimeMetadata<Q>[\"parameters\"] extends Record<string, never>\n ? undefined\n : QueryParameterType<CompileTimeMetadata<Q>[\"parameters\"]>;\n\nexport interface PropertyColumnLocator<Q extends ObjectOrInterfaceDefinition> {\n type: \"property\";\n id: PropertyKeys<Q>;\n}\n\n/**\n * Concrete function column locator for a single key K.\n * Correlates the id, queryDefinition, and getFunctionParams types.\n */\ninterface FunctionColumnLocatorForKey<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n FunctionColumns extends Record<string, QueryDefinition<{}>>,\n K extends keyof FunctionColumns,\n> {\n /**\n * This is equivalent to workshop's function-backed columns.\n * The function needs to meet the specifications stated in https://www.palantir.com/docs/foundry/workshop/widgets-object-table/#function-backed-columns\n */\n type: \"function\";\n id: K;\n queryDefinition: FunctionColumns[K];\n\n /**\n * The function will be called with the current object set to get the input parameters for the function query.\n * @param objectSet - The current object set.\n * @returns - The function's input parameters including the object set.\n */\n getFunctionParams: (\n objectSet: ObjectSet<Q, RDPs>,\n ) => ExtractQueryParameters<FunctionColumns[K]>;\n\n /**\n * Function to generate keys for looking up results in the FunctionsMap.\n * @param object - The object instance\n * @returns - The key to use for looking up this object's result in the FunctionsMap\n */\n getKey: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => string;\n\n /**\n * Function to extract the cell value from the raw cell data returned by the function.\n * This is useful when functions return custom types with multiple properties.\n * @param cellData - The raw data returned by the function for this object\n * @returns - The value to display in the cell\n */\n getValue?: (cellData?: unknown) => unknown;\n\n /**\n * Minimum time between re-fetches of the same function with the same parameters, in milliseconds.\n * Defaults to 5 minutes as it is expensive to fetch function columns for a large object set\n * and they are expected to be relatively static in the context of an object table\n *\n * @default 300_000 (5 minutes)\n */\n dedupeIntervalMs?: number;\n\n /**\n * Object type apiNames the function reads but doesn't take as a parameter (e.g.\n * linked object types the function traverses internally). The column auto-revalidates\n * when an action edits an object of any of these types. Param-derived types are\n * tracked automatically and don't need to be listed here.\n */\n dependsOn?: string[];\n}\n\n/**\n * Distributes over each key in FunctionColumns so that id, queryDefinition,\n * and getFunctionParams are correlated per key.\n */\nexport type FunctionColumnLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> = keyof FunctionColumns extends infer K\n ? K extends keyof FunctionColumns\n ? FunctionColumnLocatorForKey<Q, RDPs, FunctionColumns, K>\n : never\n : never;\n\nexport interface RdpColumnLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n type: \"rdp\";\n id: keyof RDPs;\n creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>;\n}\n\nexport interface CustomColumnLocator {\n type: \"custom\";\n id: string;\n}\n\nexport type ColumnDefinitionLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> =\n | PropertyColumnLocator<Q>\n | FunctionColumnLocator<Q, RDPs, FunctionColumns>\n | RdpColumnLocator<Q, RDPs>\n | CustomColumnLocator;\n\nexport interface ObjectTableProps<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * The object or interface type of the object\n * If objectSet is not provided, objects will be fetched based on this type.\n */\n objectType: Q;\n\n /**\n * Ref-like handle for reading a point-in-time snapshot of the currently\n * loaded table data and pagination state.\n *\n * The handle is exposed as a named prop rather than React's reserved `ref`\n * prop so ObjectTable can preserve its generic component signature.\n */\n tableRef?: React.Ref<ObjectTableHandle<Q, RDPs>>;\n\n /**\n * The set of objects to show in the table.\n * If provided and the objectType is not an interface, the table will use objectSet to fetch objects instead of fetching based on objectType.\n */\n objectSet?: ObjectSet<Q>;\n\n objectSetOptions?: ObjectSetOptions<Q>;\n\n /**\n * Minimum time between fetch requests in milliseconds.\n * Increasing this value reduces redundant network calls when the same data\n * is requested multiple times in quick succession.\n *\n * @default 60_000 1 minute\n */\n dedupeIntervalMs?: number;\n\n /**\n * Enable streaming updates via websocket subscription.\n * When true, the table will automatically update when matching\n * objects are added, updated, or removed in Foundry.\n *\n * Limitations: `streamUpdates` cannot be used together with `pivotTo` or\n * `withProperties`. The server does not support websocket subscriptions\n * for link-traversal or derived-property queries. Those queries still\n * fetch data normally but won't receive real-time updates.\n *\n * @default false\n */\n streamUpdates?: boolean;\n\n /**\n * Number of objects to fetch per page.\n *\n * @default 50\n */\n pageSize?: number;\n\n /**\n * Ordered list of column definitions to show in the table\n *\n * If not provided, all of the properties of the object type will be shown in default order.\n */\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n\n /**\n * Whether the table is filterable by the user.\n *\n * @default true\n */\n enableFiltering?: boolean;\n\n /**\n * The current where clause to filter the objects in the table.\n * If provided, the filter is controlled.\n */\n filter?: WhereClause<Q, RDPs>;\n\n /**\n * Called when the where clause is changed.\n * Required when filter is controlled.\n *\n * @param newWhere The new where clause\n */\n onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;\n\n /**\n * Whether the table is sortable by the user.\n *\n * @default true\n */\n enableOrdering?: boolean;\n\n /**\n * Whether columns can be pinned by the user.\n *\n * @default true\n */\n enableColumnPinning?: boolean;\n\n /**\n * Whether columns can be resized by the user.\n *\n * @default true\n */\n enableColumnResizing?: boolean;\n\n /**\n * Whether the column configuration dialog for column visibility and ordering is available to the user.\n *\n * @default true\n */\n enableColumnConfig?: boolean;\n\n /**\n * Controls the edit mode behavior of the table.\n * - \"always\": Editable cells are immediately in edit mode on row clicked.\n * - \"manual\": User can toggle edit mode on/off via the Edit Table button.\n *\n * @default \"manual\"\n */\n editMode?: \"always\" | \"manual\";\n\n /**\n * Whether to render the bottom edit footer that hosts the\n * \"Edit Table\" / \"Cancel\" / \"Submit Edits\" buttons and the edit-state\n * indicators (modification count, validation errors).\n *\n * @default true whenever the table has at least one column declared\n * editable (i.e. any column with `editable: true` or `editable: (object) => boolean`).\n * When `false`, the \"Edit Table\" and \"Submit Edits\" buttons will not be shown.\n */\n showEditFooter?: boolean;\n\n /**\n * The default order by clause to sort the objects in the table.\n * If provided without orderBy prop, the sorting is uncontrolled.\n * If both orderBy and defaultOrderBy are provided, orderBy takes precedence.\n */\n defaultOrderBy?: Array<{\n property: PropertyKeys<Q> | keyof RDPs;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * The current order by clause to sort the objects in the table.\n * If provided, the sorting is controlled.\n * If both orderBy and defaultOrderBy are provided, orderBy takes precedence.\n */\n orderBy?: Array<{\n property: PropertyKeys<Q> | keyof RDPs;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * Called when the order by clause is changed.\n * Required when sorting is controlled.\n *\n * @param newOrderBy The new order by clause\n */\n onOrderByChanged?: (\n newOrderBy: Array<{\n property: PropertyKeys<Q> | keyof RDPs;\n direction: \"asc\" | \"desc\";\n }>,\n ) => void;\n\n /**\n * Called after the value of a cell is edited and committed by the user.\n *\n * @param info An object containing details about the cell that was edited,\n * including the rowId, columnId, new and old values, and the row data before the edit\n */\n onCellValueChanged?: (\n info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => void;\n\n /**\n * If provided, the \"Submit Edits\" button will be shown in the edit footer.\n *\n * @param edits an array of edit info containing details about the edited cells\n * including the rowId, columnId, new and old values, and the row data before the edit\n * @return a promise that resolves to true if the edits were successfully submitted\n */\n onSubmitEdits?: (edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]) => Promise<boolean>;\n\n /**\n * Called when the column visibility or ordering changed.\n *\n * If provided, the table will allow the user to show/hide columns.\n *\n * @param newStates The columns sorted in their display order in the table and their visibility state.\n */\n onColumnVisibilityChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Called when the pinned columns change.\n *\n * If provided, the table will allow the user to pin/unpin columns.\n *\n * @param newStates The new list of column pin states\n */\n onColumnsPinnedChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>,\n ) => void;\n\n /**\n * Called when a column is resized.\n *\n * @param columnId The ID of the resized column\n * @param newWidth The new width of the column. When newWidth = null, the column size is reset.\n */\n onColumnResize?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n newWidth: number | null,\n ) => void;\n\n /**\n * Called when a row is clicked.\n *\n * @param object The object representing the clicked row\n */\n onRowClick?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => void;\n\n /**\n * The primary key of the row to render as visually focused (the\n * \"last interacted\" row). When provided, focus state is controlled by\n * the caller.\n *\n * Stored as a primary key rather than a full object so the focus does\n * not go stale when the underlying row data changes.\n *\n * Pass `null` to render no row as focused.\n */\n focusedRow?: PrimaryKeyType<Q> | null;\n\n /**\n * Called when the focused row changes — fires in both controlled and\n * uncontrolled modes so callers can observe focus without taking it\n * over.\n *\n * @param row The newly-focused row object, or `null` if focus was\n * cleared\n */\n onFocusedRowChanged?: (\n row:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n | null,\n ) => void;\n\n /**\n * Called when a column header is clicked.\n *\n * The columnId matches the `locator.id` configured on the column definition.\n * The dropdown menu trigger is excluded — clicking the chevron opens the\n * header menu instead of firing this callback.\n *\n * @param columnId The id of the clicked column\n */\n onColumnHeaderClick?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n ) => void;\n\n /**\n * Selection mode for the table rows.\n *\n * If multiple, a checkbox will be shown for each row to allow selecting multiple rows\n * as well as a top-level checkbox in the header to select all rows.\n *\n * @default \"none\"\n */\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n\n /**\n * The currently selected rows in the table.\n * If provided, the row selection is controlled.\n */\n selectedRows?: PrimaryKeyType<Q>[];\n\n /**\n * Indicates whether all rows are selected in controlled mode.\n * When true, the table will show all rows as selected regardless of the selectedRows array.\n */\n isAllSelected?: boolean;\n\n /**\n * Called when the row selection changes.\n *\n * @deprecated Use {@link onRowSelectionChanged} instead. The new callback\n * delivers a {@link RowSelectionChange} object with `selectedRows`,\n * `isSelectAll`, and a derived `objectSet`. This legacy callback\n * continues to fire alongside the new one for backwards compatibility.\n *\n * @param selectedRowIds The primary keys of currently selected rows\n * @param isSelectAll Whether the change was triggered by a \"select all\" action. Defaults to false\n */\n onRowSelection?: (\n selectedRowIds: PrimaryKeyType<Q>[],\n isSelectAll?: boolean,\n ) => void;\n\n /**\n * Called when the row selection changes, with a {@link RowSelectionChange}\n * payload describing the new state.\n *\n * @param change The new selection state. See {@link RowSelectionChange}.\n */\n onRowSelectionChanged?: (\n change: RowSelectionChange<Q, RDPs>,\n ) => void;\n /**\n * If provided, will render this context menu when right clicking on a cell\n */\n renderCellContextMenu?: (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cellValue: unknown,\n ) => React.ReactNode;\n\n /**\n * Render override for the empty state. Called when the table has no\n * rows and no error. When omitted, a default \"No Data\" indicator is\n * rendered.\n */\n renderEmptyState?: () => React.ReactNode;\n\n /**\n * The height of each row in pixels.\n *\n * @default 40\n */\n rowHeight?: number;\n\n /**\n * Returns extra HTML attributes (typically `data-*`) to apply to each\n * row element. Use this to drive conditional row styling\n */\n getRowAttributes?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => Record<string, string | undefined>;\n\n className?: string;\n}\n\n/**\n * Payload for {@link ObjectTableProps.onRowSelectionChanged}. Consolidates\n * the loaded row instances, the `isSelectAll` semantic intent, and an\n * `ObjectSet` covering the selection.\n */\nexport interface RowSelectionChange<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n /**\n * Loaded row instances currently selected. When `isSelectAll` is true,\n * this reflects only the rows currently in the table — pages not yet\n * fetched are absent. Use `objectSet` for the cross-page view, and\n * `selectedRows.map(r => r.$primaryKey)` if you need the primary keys.\n */\n selectedRows: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[];\n\n /**\n * True when the user invoked \"select all\" (header checkbox) or when\n * controlled mode supplies `isAllSelected={true}`. Distinct from \"every\n * loaded row happens to be selected\" — that condition is reflected by\n * `selectedRows.length` matching the visible row count but does not set\n * this flag.\n */\n isSelectAll: boolean;\n\n /**\n * An `ObjectSet` representing the selection.\n *\n * - \"Select all\" → the underlying `ObjectSet` (`objectSet` prop if\n * provided, otherwise derived from `objectType` via `client(...)`).\n * This includes rows not yet loaded into the table.\n * - Partial selection → the underlying `ObjectSet` narrowed to\n * `{ $primaryKey: { $in: selectedRows.map(r => r.$primaryKey) } }`.\n * - \"Deselect all\" → an empty `ObjectSet` (`$in: []`).\n *\n * Works for both object and interface types, since the `$primaryKey`\n * special property does not require resolving the underlying primary key\n * property name. `undefined` only when there is no underlying `ObjectSet`\n * to derive from.\n */\n objectSet: ObjectSet<Q, RDPs> | undefined;\n}\n\nexport interface ObjectSetOptions<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Object sets to union with\n */\n union?: ObjectSet<Q>[];\n\n /**\n * Object sets to intersect with\n */\n intersect?: ObjectSet<Q>[];\n\n /**\n * Object sets to subtract from\n */\n subtract?: ObjectSet<Q>[];\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ObjectTableApi.js","names":[],"sources":["ObjectTableApi.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { QueryParameterType } from \"@osdk/client/observable\";\nimport type * as React from \"react\";\nimport type { CellEditInfo, EditFieldConfig } from \"./utils/types.js\";\n\nexport type { EditFieldConfig } from \"./utils/types.js\";\n\nexport type ColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> =\n | EditableColumnDefinition<Q, RDPs, FunctionColumns>\n | ReadonlyColumnDefinition<Q, RDPs, FunctionColumns>;\n\ninterface SharedColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>;\n\n /**\n * @default true\n */\n isVisible?: boolean;\n\n /**\n * @default none\n */\n pinned?: \"left\" | \"right\" | \"none\";\n width?: number;\n minWidth?: number;\n maxWidth?: number;\n resizable?: boolean;\n orderable?: boolean;\n filterable?: boolean;\n\n /**\n * Custom renderer for the cell value.\n *\n * Interaction with `editable` columns:\n * - When `editMode: \"manual\"` (default), `renderCell` is used while the\n * table is read-only (Edit Table button visible) and the editable cell\n * takes over once the user enters edit mode.\n * - When `editMode: \"always\"`, the editable cell always wins on editable\n * columns and `renderCell` is ignored — `editMode: \"always\"` opts the\n * column into a permanently-editable surface, leaving no read-only\n * state for `renderCell` to render. Use `editMode: \"manual\"` if you\n * need a custom display alongside editing.\n */\n renderCell?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>,\n ) => React.ReactNode;\n\n /**\n * If provided, this will be used in the column header.\n * If both columnName and renderHeader are provided, renderHeader will take precedence in the table header.\n * columnName will still be used in other parts where the column name is displayed.\n *\n * If not provided,\n * for a property column, the property displayName will be used\n * for other columns, the id will be used.\n */\n columnName?: string;\n\n /**\n * If provided, this will be used to render the header component.\n * When both columnName and renderHeader are provided, renderHeader will take precedence in the table header.\n */\n renderHeader?: () => React.ReactNode;\n}\n\ninterface EditableColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> extends SharedColumnDefinition<Q, RDPs, FunctionColumns> {\n /**\n * `editable` can be a boolean or a predicate that receives the row's object\n * and returns whether the cell is editable\n */\n editable:\n | true\n | ((\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => boolean);\n\n /**\n * Configuration for the cell editor component.\n *\n * When provided, the column uses the specified field component\n * (e.g. dropdown) instead of the default auto-detected text/number input.\n *\n * `getFieldComponentProps` receives the row's object and a map of any\n * pending edits for that row (keyed by column id), and returns the props to\n * pass to the field component. Editor configuration can depend on the\n * current row or on other in-progress edits within the row.\n */\n editFieldConfig?: EditFieldConfig<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n >;\n\n /**\n * Additional function to validate the cell value during edit.\n *\n * @param value the current cell value\n * @returns a promise that resolves to an error message string if validation fails, or undefined if validation succeeds\n */\n validateEdit?: (\n value: unknown,\n ) => Promise<string | undefined>;\n}\n\n/**\n * Column definition for a read-only column (default).\n * `editFieldConfig` and `validateEdit` are not available.\n */\ninterface ReadonlyColumnDefinition<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> extends SharedColumnDefinition<Q, RDPs, FunctionColumns> {\n editable?: false;\n}\n\nexport type ExtractQueryParameters<\n Q extends QueryDefinition,\n> = CompileTimeMetadata<Q>[\"parameters\"] extends Record<string, never>\n ? undefined\n : QueryParameterType<CompileTimeMetadata<Q>[\"parameters\"]>;\n\nexport interface PropertyColumnLocator<Q extends ObjectOrInterfaceDefinition> {\n type: \"property\";\n id: PropertyKeys<Q>;\n}\n\n/**\n * Concrete function column locator for a single key K.\n * Correlates the id, queryDefinition, and getFunctionParams types.\n */\ninterface FunctionColumnLocatorForKey<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n FunctionColumns extends Record<string, QueryDefinition<{}>>,\n K extends keyof FunctionColumns,\n> {\n /**\n * This is equivalent to workshop's function-backed columns.\n * The function needs to meet the specifications stated in https://www.palantir.com/docs/foundry/workshop/widgets-object-table/#function-backed-columns\n */\n type: \"function\";\n id: K;\n queryDefinition: FunctionColumns[K];\n\n /**\n * The function will be called with the current object set to get the input parameters for the function query.\n * @param objectSet - The current object set.\n * @returns - The function's input parameters including the object set.\n */\n getFunctionParams: (\n objectSet: ObjectSet<Q, RDPs>,\n ) => ExtractQueryParameters<FunctionColumns[K]>;\n\n /**\n * Function to generate keys for looking up results in the FunctionsMap.\n * @param object - The object instance\n * @returns - The key to use for looking up this object's result in the FunctionsMap\n */\n getKey: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => string;\n\n /**\n * Function to extract the cell value from the raw cell data returned by the function.\n * This is useful when functions return custom types with multiple properties.\n * @param cellData - The raw data returned by the function for this object\n * @returns - The value to display in the cell\n */\n getValue?: (cellData?: unknown) => unknown;\n\n /**\n * Minimum time between re-fetches of the same function with the same parameters, in milliseconds.\n * Defaults to 5 minutes as it is expensive to fetch function columns for a large object set\n * and they are expected to be relatively static in the context of an object table\n *\n * @default 300_000 (5 minutes)\n */\n dedupeIntervalMs?: number;\n\n /**\n * Object type apiNames the function reads but doesn't take as a parameter (e.g.\n * linked object types the function traverses internally). The column auto-revalidates\n * when an action edits an object of any of these types. Param-derived types are\n * tracked automatically and don't need to be listed here.\n */\n dependsOn?: string[];\n}\n\n/**\n * Distributes over each key in FunctionColumns so that id, queryDefinition,\n * and getFunctionParams are correlated per key.\n */\nexport type FunctionColumnLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> = keyof FunctionColumns extends infer K\n ? K extends keyof FunctionColumns\n ? FunctionColumnLocatorForKey<Q, RDPs, FunctionColumns, K>\n : never\n : never;\n\nexport interface RdpColumnLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n type: \"rdp\";\n id: keyof RDPs;\n creator: DerivedProperty.Creator<Q, RDPs[keyof RDPs]>;\n}\n\nexport interface CustomColumnLocator {\n type: \"custom\";\n id: string;\n}\n\nexport type ColumnDefinitionLocator<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> =\n | PropertyColumnLocator<Q>\n | FunctionColumnLocator<Q, RDPs, FunctionColumns>\n | RdpColumnLocator<Q, RDPs>\n | CustomColumnLocator;\n\nexport interface ObjectTableProps<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n /**\n * The object or interface type of the object\n * If objectSet is not provided, objects will be fetched based on this type.\n */\n objectType: Q;\n\n /**\n * The set of objects to show in the table.\n * If provided and the objectType is not an interface, the table will use objectSet to fetch objects instead of fetching based on objectType.\n */\n objectSet?: ObjectSet<Q>;\n\n objectSetOptions?: ObjectSetOptions<Q>;\n\n /**\n * Minimum time between fetch requests in milliseconds.\n * Increasing this value reduces redundant network calls when the same data\n * is requested multiple times in quick succession.\n *\n * @default 60_000 1 minute\n */\n dedupeIntervalMs?: number;\n\n /**\n * Enable streaming updates via websocket subscription.\n * When true, the table will automatically update when matching\n * objects are added, updated, or removed in Foundry.\n *\n * Limitations: `streamUpdates` cannot be used together with `pivotTo` or\n * `withProperties`. The server does not support websocket subscriptions\n * for link-traversal or derived-property queries. Those queries still\n * fetch data normally but won't receive real-time updates.\n *\n * @default false\n */\n streamUpdates?: boolean;\n\n /**\n * Number of objects to fetch per page.\n *\n * @default 50\n */\n pageSize?: number;\n\n /**\n * Ordered list of column definitions to show in the table\n *\n * If not provided, all of the properties of the object type will be shown in default order.\n */\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n\n /**\n * Whether the table is filterable by the user.\n *\n * @default true\n */\n enableFiltering?: boolean;\n\n /**\n * The current where clause to filter the objects in the table.\n * If provided, the filter is controlled.\n */\n filter?: WhereClause<Q, RDPs>;\n\n /**\n * Called when the where clause is changed.\n * Required when filter is controlled.\n *\n * @param newWhere The new where clause\n */\n onFilterChanged?: (newWhere: WhereClause<Q, RDPs>) => void;\n\n /**\n * Whether the table is sortable by the user.\n *\n * @default true\n */\n enableOrdering?: boolean;\n\n /**\n * Whether columns can be pinned by the user.\n *\n * @default true\n */\n enableColumnPinning?: boolean;\n\n /**\n * Whether columns can be resized by the user.\n *\n * @default true\n */\n enableColumnResizing?: boolean;\n\n /**\n * Whether the column configuration dialog for column visibility and ordering is available to the user.\n *\n * @default true\n */\n enableColumnConfig?: boolean;\n\n /**\n * Controls the edit mode behavior of the table.\n * - \"always\": Editable cells are immediately in edit mode on row clicked.\n * - \"manual\": User can toggle edit mode on/off via the Edit Table button.\n *\n * @default \"manual\"\n */\n editMode?: \"always\" | \"manual\";\n\n /**\n * Whether to render the bottom edit footer that hosts the\n * \"Edit Table\" / \"Cancel\" / \"Submit Edits\" buttons and the edit-state\n * indicators (modification count, validation errors).\n *\n * @default true whenever the table has at least one column declared\n * editable (i.e. any column with `editable: true` or `editable: (object) => boolean`).\n * When `false`, the \"Edit Table\" and \"Submit Edits\" buttons will not be shown.\n */\n showEditFooter?: boolean;\n\n /**\n * The default order by clause to sort the objects in the table.\n * If provided without orderBy prop, the sorting is uncontrolled.\n * If both orderBy and defaultOrderBy are provided, orderBy takes precedence.\n */\n defaultOrderBy?: Array<{\n property: PropertyKeys<Q> | keyof RDPs;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * The current order by clause to sort the objects in the table.\n * If provided, the sorting is controlled.\n * If both orderBy and defaultOrderBy are provided, orderBy takes precedence.\n */\n orderBy?: Array<{\n property: PropertyKeys<Q> | keyof RDPs;\n direction: \"asc\" | \"desc\";\n }>;\n\n /**\n * Called when the order by clause is changed.\n * Required when sorting is controlled.\n *\n * @param newOrderBy The new order by clause\n */\n onOrderByChanged?: (\n newOrderBy: Array<{\n property: PropertyKeys<Q> | keyof RDPs;\n direction: \"asc\" | \"desc\";\n }>,\n ) => void;\n\n /**\n * Called after the value of a cell is edited and committed by the user.\n *\n * @param info An object containing details about the cell that was edited,\n * including the rowId, columnId, new and old values, and the row data before the edit\n */\n onCellValueChanged?: (\n info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >,\n ) => void;\n\n /**\n * If provided, the \"Submit Edits\" button will be shown in the edit footer.\n *\n * @param edits an array of edit info containing details about the edited cells\n * including the rowId, columnId, new and old values, and the row data before the edit\n * @return a promise that resolves to true if the edits were successfully submitted\n */\n onSubmitEdits?: (edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]) => Promise<boolean>;\n\n /**\n * Called when the column visibility or ordering changed.\n *\n * If provided, the table will allow the user to show/hide columns.\n *\n * @param newStates The columns sorted in their display order in the table and their visibility state.\n */\n onColumnVisibilityChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>,\n ) => void;\n\n /**\n * Called when the pinned columns change.\n *\n * If provided, the table will allow the user to pin/unpin columns.\n *\n * @param newStates The new list of column pin states\n */\n onColumnsPinnedChanged?: (\n newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>,\n ) => void;\n\n /**\n * Called when a column is resized.\n *\n * @param columnId The ID of the resized column\n * @param newWidth The new width of the column. When newWidth = null, the column size is reset.\n */\n onColumnResize?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n newWidth: number | null,\n ) => void;\n\n /**\n * Called when a row is clicked.\n *\n * @param object The object representing the clicked row\n */\n onRowClick?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => void;\n\n /**\n * The primary key of the row to render as visually focused (the\n * \"last interacted\" row). When provided, focus state is controlled by\n * the caller.\n *\n * Stored as a primary key rather than a full object so the focus does\n * not go stale when the underlying row data changes.\n *\n * Pass `null` to render no row as focused.\n */\n focusedRow?: PrimaryKeyType<Q> | null;\n\n /**\n * Called when the focused row changes — fires in both controlled and\n * uncontrolled modes so callers can observe focus without taking it\n * over.\n *\n * @param row The newly-focused row object, or `null` if focus was\n * cleared\n */\n onFocusedRowChanged?: (\n row:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>\n | null,\n ) => void;\n\n /**\n * Called when a column header is clicked.\n *\n * The columnId matches the `locator.id` configured on the column definition.\n * The dropdown menu trigger is excluded — clicking the chevron opens the\n * header menu instead of firing this callback.\n *\n * @param columnId The id of the clicked column\n */\n onColumnHeaderClick?: (\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns,\n ) => void;\n\n /**\n * Selection mode for the table rows.\n *\n * If multiple, a checkbox will be shown for each row to allow selecting multiple rows\n * as well as a top-level checkbox in the header to select all rows.\n *\n * @default \"none\"\n */\n selectionMode?: \"single\" | \"multiple\" | \"none\";\n\n /**\n * The currently selected rows in the table.\n * If provided, the row selection is controlled.\n */\n selectedRows?: PrimaryKeyType<Q>[];\n\n /**\n * Indicates whether all rows are selected in controlled mode.\n * When true, the table will show all rows as selected regardless of the selectedRows array.\n */\n isAllSelected?: boolean;\n\n /**\n * Called when the row selection changes.\n *\n * @deprecated Use {@link onRowSelectionChanged} instead. The new callback\n * delivers a {@link RowSelectionChange} object with `selectedRows`,\n * `isSelectAll`, and a derived `objectSet`. This legacy callback\n * continues to fire alongside the new one for backwards compatibility.\n *\n * @param selectedRowIds The primary keys of currently selected rows\n * @param isSelectAll Whether the change was triggered by a \"select all\" action. Defaults to false\n */\n onRowSelection?: (\n selectedRowIds: PrimaryKeyType<Q>[],\n isSelectAll?: boolean,\n ) => void;\n\n /**\n * Called when the row selection changes, with a {@link RowSelectionChange}\n * payload describing the new state.\n *\n * @param change The new selection state. See {@link RowSelectionChange}.\n */\n onRowSelectionChanged?: (\n change: RowSelectionChange<Q, RDPs>,\n ) => void;\n /**\n * If provided, will render this context menu when right clicking on a cell\n */\n renderCellContextMenu?: (\n row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n cellValue: unknown,\n ) => React.ReactNode;\n\n /**\n * Render override for the empty state. Called when the table has no\n * rows and no error. When omitted, a default \"No Data\" indicator is\n * rendered.\n */\n renderEmptyState?: () => React.ReactNode;\n\n /**\n * The height of each row in pixels.\n *\n * @default 40\n */\n rowHeight?: number;\n\n /**\n * Returns extra HTML attributes (typically `data-*`) to apply to each\n * row element. Use this to drive conditional row styling\n */\n getRowAttributes?: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => Record<string, string | undefined>;\n\n /**\n * Imperative handle for programmatic table actions. Pass a ref\n * (`useRef<ObjectTableHandle<Q, RDPs>>(null)`) to call\n * {@link ObjectTableHandle} methods such as\n * {@link ObjectTableHandle.getSnapshot}.\n */\n tableRef?: React.Ref<ObjectTableHandle<Q, RDPs>>;\n\n className?: string;\n}\n\n/**\n * Imperative handle exposing programmatic actions on an {@link ObjectTable}.\n * Obtain it by passing {@link ObjectTableProps.tableRef}.\n */\nexport interface ObjectTableHandle<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n /**\n * Loads every row matching the object set and returns a format-agnostic\n * snapshot of the table's columns, row values, and total count. The caller\n * is responsible for turning the snapshot into a downloadable artifact\n * (CSV, Excel, JSON, clipboard, …).\n *\n * Property, derived-property, and function-backed columns are included.\n * Function-backed cells are fetched per page during snapshot collection;\n * when a page's fetch fails, `row.getValue(columnId)` returns the thrown\n * `Error` instance for the affected cells while the rest of the snapshot\n * resolves normally.\n * Columns defined with `locator.type === \"custom\"` are omitted because\n * they have no underlying value to export.\n *\n * The returned promise rejects up front when the object set's `totalCount`\n * exceeds `rowLimit`. When `totalCount` is unavailable, it instead rejects\n * mid-load once more than `rowLimit` rows have been pulled, so an unknown\n * count can't drain an unbounded set into the client. Otherwise every\n * matching row is loaded.\n *\n * @param options See {@link ObjectTableSnapshotOptions}.\n */\n getSnapshot: (\n options?: ObjectTableSnapshotOptions,\n ) => Promise<ObjectTableSnapshot<Q, RDPs>>;\n}\n\n/**\n * Options for {@link ObjectTableHandle[\"getSnapshot\"]}.\n */\nexport interface ObjectTableSnapshotOptions {\n /**\n * Upper bound on how many rows the snapshot may contain. When the object\n * set's total row count exceeds this value, `getSnapshot` rejects;\n * otherwise every matching row is loaded.\n *\n * @default 10_000\n */\n rowLimit?: number;\n}\n\n/**\n * A point-in-time capture of an {@link ObjectTable}'s columns and row values,\n * returned by {@link ObjectTableHandle.getSnapshot}.\n */\nexport interface ObjectTableSnapshot<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n columns: ObjectTableDataColumn[];\n rows: ObjectTableDataRow<Q, RDPs>[];\n /**\n * Total number of objects matching the underlying object set, as reported\n * by the API. `undefined` when the API did not provide a count. Encoded as\n * a string to match the underlying list-payload representation.\n */\n totalCount: string | undefined;\n}\n\n/**\n * A single column in an {@link ObjectTableSnapshot}.\n */\nexport interface ObjectTableDataColumn {\n /** Column id, matching the `locator.id` of the column definition. */\n id: string;\n /** Display name shown in the table header. */\n name: string;\n}\n\n/**\n * A single row in an {@link ObjectTableSnapshot}.\n */\nexport interface ObjectTableDataRow<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n /** Row id (the underlying object's `$primaryKey` rendered as a string). */\n id: string;\n /** The underlying loaded object. */\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>;\n /**\n * Returns the cell value for a given column id, or `undefined` when the\n * column is not part of the snapshot. Function-backed cells whose query\n * failed surface the thrown `Error` instance as their value.\n */\n getValue: (columnId: string) => unknown;\n}\n\n/**\n * Payload for {@link ObjectTableProps.onRowSelectionChanged}. Consolidates\n * the loaded row instances, the `isSelectAll` semantic intent, and an\n * `ObjectSet` covering the selection.\n */\nexport interface RowSelectionChange<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n /**\n * Loaded row instances currently selected. When `isSelectAll` is true,\n * this reflects only the rows currently in the table — pages not yet\n * fetched are absent. Use `objectSet` for the cross-page view, and\n * `selectedRows.map(r => r.$primaryKey)` if you need the primary keys.\n */\n selectedRows: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[];\n\n /**\n * True when the user invoked \"select all\" (header checkbox) or when\n * controlled mode supplies `isAllSelected={true}`. Distinct from \"every\n * loaded row happens to be selected\" — that condition is reflected by\n * `selectedRows.length` matching the visible row count but does not set\n * this flag.\n */\n isSelectAll: boolean;\n\n /**\n * An `ObjectSet` representing the selection.\n *\n * - \"Select all\" → the underlying `ObjectSet` (`objectSet` prop if\n * provided, otherwise derived from `objectType` via `client(...)`).\n * This includes rows not yet loaded into the table.\n * - Partial selection → the underlying `ObjectSet` narrowed to\n * `{ $primaryKey: { $in: selectedRows.map(r => r.$primaryKey) } }`.\n * - \"Deselect all\" → an empty `ObjectSet` (`$in: []`).\n *\n * Works for both object and interface types, since the `$primaryKey`\n * special property does not require resolving the underlying primary key\n * property name. `undefined` only when there is no underlying `ObjectSet`\n * to derive from.\n */\n objectSet: ObjectSet<Q, RDPs> | undefined;\n}\n\nexport interface ObjectSetOptions<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Object sets to union with\n */\n union?: ObjectSet<Q>[];\n\n /**\n * Object sets to intersect with\n */\n intersect?: ObjectSet<Q>[];\n\n /**\n * Object sets to subtract from\n */\n subtract?: ObjectSet<Q>[];\n}\n"],"mappings":"","ignoreList":[]}
@@ -15,39 +15,32 @@
15
15
  */
16
16
 
17
17
  import { useOsdkClient, useOsdkFunctions } from "@osdk/react";
18
- import { chunk } from "lodash-es";
19
18
  import { useMemo, useRef } from "react";
20
19
  import { createAsyncCellData } from "../utils/AsyncCellData.js";
21
20
  import { DEFAULT_FUNCTION_COLUMN_DEDUPE_INTERVAL_MS, DEFAULT_MAX_CONCURRENT_REQUESTS, DEFAULT_PAGE_SIZE } from "../utils/constants.js";
22
- const isObjectType = objectOrInterfaceType => {
23
- return objectOrInterfaceType.type === "object";
24
- };
21
+ import { buildPagedObjectSets, extractFunctionLocators } from "../utils/functionColumns.js";
25
22
  export function useFunctionColumnsData({
26
23
  objectOrInterfaceType,
27
24
  objects,
28
25
  columnDefinitions,
29
- primaryKeyApiName,
30
26
  pageSize = DEFAULT_PAGE_SIZE
31
27
  }) {
32
28
  const client = useOsdkClient();
33
29
  const prevDataRef = useRef({});
34
- const isObjectTypeDefinition = objectOrInterfaceType && isObjectType(objectOrInterfaceType);
35
30
  const stableObjects = useStableObjects(objects);
36
- const baseObjectSet = useMemo(() => {
37
- return isObjectTypeDefinition ? client(objectOrInterfaceType) : undefined;
38
- }, [client, isObjectTypeDefinition, objectOrInterfaceType]);
39
31
  const functionColDefs = useMemo(() => extractFunctionLocators(columnDefinitions), [columnDefinitions]);
40
- const disabled = !baseObjectSet || !stableObjects?.length || functionColDefs.length === 0;
41
32
 
42
- // Construct object sets using the base object set (constructed with object type only)
43
- // + filter with primary keys of each page's objects
33
+ // Construct an object set per page (base set filtered to each page's
34
+ // primary keys). `buildPagedObjectSets` returns `[]` for interfaces and
35
+ // when there's no work to do, which short-circuits the downstream queries.
44
36
  //
45
- // When a new page loads, only that page's queries fire — old pages
46
- // hit the dedupeIntervalMs cache since their params are unchanged.
37
+ // When a new page loads, only that page's queries fire — old pages hit the
38
+ // dedupeIntervalMs cache since their params are unchanged.
47
39
  const pagedObjectSets = useMemo(() => {
48
- if (!baseObjectSet || !stableObjects?.length) return [];
49
- return buildPagedObjectSets(baseObjectSet, stableObjects, primaryKeyApiName, pageSize);
50
- }, [baseObjectSet, stableObjects, primaryKeyApiName, pageSize]);
40
+ if (!stableObjects?.length) return [];
41
+ return buildPagedObjectSets(client, objectOrInterfaceType, stableObjects, pageSize);
42
+ }, [client, objectOrInterfaceType, stableObjects, pageSize]);
43
+ const disabled = pagedObjectSets.length === 0 || functionColDefs.length === 0;
51
44
  const queryGrid = useMemo(() => {
52
45
  if (pagedObjectSets.length === 0 || functionColDefs.length === 0) {
53
46
  return EMPTY_QUERY_GRID;
@@ -79,35 +72,6 @@ const EMPTY_QUERY_GRID = {
79
72
  numColumns: 0
80
73
  };
81
74
 
82
- /** Filters columnDefinitions down to only function-backed locators. */
83
- function extractFunctionLocators(columnDefinitions) {
84
- if (!columnDefinitions) return [];
85
- return columnDefinitions.filter(colDef => colDef.locator.type === "function").map(colDef => colDef.locator);
86
- }
87
-
88
- /** A page's filtered ObjectSet paired with the row objects it covers. */
89
-
90
- /** Chunks objects into pages and creates a filtered ObjectSet per page. */
91
- function buildPagedObjectSets(objectSet, objects, primaryKeyApiName, pageSize) {
92
- if (!primaryKeyApiName) {
93
- return [{
94
- objectSet,
95
- objects
96
- }];
97
- }
98
- return chunk(objects, pageSize).map(page => {
99
- const whereClause = {
100
- [primaryKeyApiName]: {
101
- $in: page.map(obj => obj.$primaryKey)
102
- }
103
- };
104
- return {
105
- objectSet: objectSet.where(whereClause),
106
- objects: page
107
- };
108
- });
109
- }
110
-
111
75
  /**
112
76
  * Builds a flat query array and the layout metadata needed to recover per-column results.
113
77
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useFunctionColumnsData.js","names":["useOsdkClient","useOsdkFunctions","chunk","useMemo","useRef","createAsyncCellData","DEFAULT_FUNCTION_COLUMN_DEDUPE_INTERVAL_MS","DEFAULT_MAX_CONCURRENT_REQUESTS","DEFAULT_PAGE_SIZE","isObjectType","objectOrInterfaceType","type","useFunctionColumnsData","objects","columnDefinitions","primaryKeyApiName","pageSize","client","prevDataRef","isObjectTypeDefinition","stableObjects","useStableObjects","baseObjectSet","undefined","functionColDefs","extractFunctionLocators","disabled","length","pagedObjectSets","buildPagedObjectSets","queryGrid","EMPTY_QUERY_GRID","buildQueryGrid","results","queries","enabled","maxConcurrent","mergedResults","mergePagedResults","numColumns","data","columnData","buildFunctionColumnData","current","filter","colDef","locator","map","objectSet","page","whereClause","$in","obj","$primaryKey","where","pagedObjects","pagedObjectSet","pageObjects","push","queryDefinition","options","params","getFunctionParams","dedupeIntervalMs","dependsOn","dependsOnObjects","merged","Array","from","isLoading","error","functionsMap","forEach","result","index","entry","pageData","Object","assign","prevColumnData","columnId","String","id","key","prevData","resolveCell","getKey","getValue","objectKey","rawData","JSON","stringify","item","$apiName","sort","a","b","localeCompare"],"sources":["useFunctionColumnsData.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport {\n type FunctionQueryParams,\n useOsdkClient,\n useOsdkFunctions,\n type UseOsdkFunctionsResult,\n} from \"@osdk/react\";\nimport { chunk } from \"lodash-es\";\nimport { useMemo, useRef } from \"react\";\nimport type {\n ColumnDefinition,\n FunctionColumnLocator,\n} from \"../ObjectTableApi.js\";\nimport {\n type AsyncCellData,\n createAsyncCellData,\n} from \"../utils/AsyncCellData.js\";\nimport {\n DEFAULT_FUNCTION_COLUMN_DEDUPE_INTERVAL_MS,\n DEFAULT_MAX_CONCURRENT_REQUESTS,\n DEFAULT_PAGE_SIZE,\n} from \"../utils/constants.js\";\n\nexport interface FunctionColumnData {\n [columnId: string]: {\n [objectPrimaryKey: string]: AsyncCellData;\n };\n}\n\nexport interface UseFunctionColumnsDataOptions<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n objectOrInterfaceType: Q;\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined;\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n primaryKeyApiName?: string;\n pageSize?: number;\n}\n\nconst isObjectType = (\n objectOrInterfaceType: ObjectOrInterfaceDefinition,\n): objectOrInterfaceType is ObjectTypeDefinition => {\n return objectOrInterfaceType.type === \"object\";\n};\n\nexport function useFunctionColumnsData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n {\n objectOrInterfaceType,\n objects,\n columnDefinitions,\n primaryKeyApiName,\n pageSize = DEFAULT_PAGE_SIZE,\n }: UseFunctionColumnsDataOptions<Q, RDPs, FunctionColumns>,\n): FunctionColumnData {\n const client = useOsdkClient();\n const prevDataRef = useRef<FunctionColumnData>({});\n\n const isObjectTypeDefinition = objectOrInterfaceType\n && isObjectType(objectOrInterfaceType);\n\n const stableObjects = useStableObjects(objects);\n\n const baseObjectSet: ObjectSet<Q, RDPs> | undefined = useMemo(\n () => {\n return isObjectTypeDefinition\n ? client(objectOrInterfaceType) as ObjectSet<Q, RDPs>\n : undefined;\n },\n [client, isObjectTypeDefinition, objectOrInterfaceType],\n );\n\n const functionColDefs = useMemo(\n () => extractFunctionLocators<Q, RDPs, FunctionColumns>(columnDefinitions),\n [columnDefinitions],\n );\n\n const disabled = !baseObjectSet || !stableObjects?.length\n || functionColDefs.length === 0;\n\n // Construct object sets using the base object set (constructed with object type only)\n // + filter with primary keys of each page's objects\n //\n // When a new page loads, only that page's queries fire — old pages\n // hit the dedupeIntervalMs cache since their params are unchanged.\n const pagedObjectSets = useMemo(() => {\n if (!baseObjectSet || !stableObjects?.length) return [];\n\n return buildPagedObjectSets(\n baseObjectSet,\n stableObjects,\n primaryKeyApiName,\n pageSize,\n );\n }, [baseObjectSet, stableObjects, primaryKeyApiName, pageSize]);\n\n const queryGrid = useMemo(() => {\n if (pagedObjectSets.length === 0 || functionColDefs.length === 0) {\n return EMPTY_QUERY_GRID;\n }\n return buildQueryGrid<Q, RDPs, FunctionColumns>(\n pagedObjectSets,\n functionColDefs,\n );\n }, [pagedObjectSets, functionColDefs]);\n\n const results = useOsdkFunctions({\n queries: queryGrid.queries,\n enabled: !disabled,\n maxConcurrent: DEFAULT_MAX_CONCURRENT_REQUESTS,\n });\n\n const mergedResults = useMemo(\n () => mergePagedResults(results, queryGrid.numColumns),\n [results, queryGrid.numColumns],\n );\n\n const data = useMemo(() => {\n const columnData = buildFunctionColumnData(\n mergedResults,\n functionColDefs,\n stableObjects,\n disabled,\n prevDataRef.current,\n );\n prevDataRef.current = columnData;\n return columnData;\n }, [mergedResults, functionColDefs, stableObjects, disabled]);\n\n return data;\n}\n\n/**\n * Pairs a flat queries array with the layout metadata needed to recover per-column\n * results back into per-column groups. The numColumns value is produced by\n * the same function that builds the queries, so the two are always in sync.\n */\ninterface QueryGrid {\n queries: FunctionQueryParams<QueryDefinition<unknown>>[];\n numColumns: number;\n}\n\ninterface MergedResult {\n isLoading: boolean;\n error: unknown;\n functionsMap: Record<string, unknown>;\n}\n\nconst EMPTY_QUERY_GRID: QueryGrid = { queries: [], numColumns: 0 };\n\n/** Filters columnDefinitions down to only function-backed locators. */\nfunction extractFunctionLocators<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n columnDefinitions:\n | Array<ColumnDefinition<Q, RDPs, FunctionColumns>>\n | undefined,\n): FunctionColumnLocator<Q, RDPs, FunctionColumns>[] {\n if (!columnDefinitions) return [];\n\n return columnDefinitions\n .filter(colDef => colDef.locator.type === \"function\")\n .map(colDef =>\n colDef.locator as FunctionColumnLocator<Q, RDPs, FunctionColumns>\n );\n}\n\n/** A page's filtered ObjectSet paired with the row objects it covers. */\ninterface PagedObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> {\n objectSet: ObjectSet<Q, RDPs>;\n objects: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[];\n}\n\n/** Chunks objects into pages and creates a filtered ObjectSet per page. */\nfunction buildPagedObjectSets<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n>(\n objectSet: ObjectSet<Q, RDPs>,\n objects: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[],\n primaryKeyApiName: string | undefined,\n pageSize: number,\n): PagedObjects<Q, RDPs>[] {\n if (!primaryKeyApiName) {\n return [{ objectSet, objects }];\n }\n\n return chunk(objects, pageSize).map(page => {\n const whereClause = {\n [primaryKeyApiName]: {\n $in: page.map(obj => obj.$primaryKey),\n },\n } as WhereClause<Q, RDPs>;\n\n return { objectSet: objectSet.where(whereClause), objects: page };\n });\n}\n\n/**\n * Builds a flat query array and the layout metadata needed to recover per-column results.\n *\n * Layout: [page0_col0, page0_col1, ..., page1_col0, page1_col1, ...]\n * Page-first ordering ensures first concurrent queries prioritizes the first page,\n * so visible rows get all their columns populated before later pages.\n *\n * Each query carries `dependsOnObjects` (the page's row instances) so that\n * editing any of those rows fans out to invalidate this function query, and\n * `dependsOn` from the locator so that linked-type edits also invalidate.\n */\nfunction buildQueryGrid<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n pagedObjects: PagedObjects<Q, RDPs>[],\n functionColDefs: FunctionColumnLocator<Q, RDPs, FunctionColumns>[],\n): QueryGrid {\n const queries: FunctionQueryParams<QueryDefinition<unknown>>[] = [];\n\n for (\n const { objectSet: pagedObjectSet, objects: pageObjects } of pagedObjects\n ) {\n for (const locator of functionColDefs) {\n queries.push({\n queryDefinition: locator.queryDefinition,\n options: {\n params: locator.getFunctionParams(pagedObjectSet),\n dedupeIntervalMs: locator.dedupeIntervalMs\n ?? DEFAULT_FUNCTION_COLUMN_DEDUPE_INTERVAL_MS,\n dependsOn: locator.dependsOn,\n dependsOnObjects: pageObjects,\n } as FunctionQueryParams<QueryDefinition<unknown>>[\"options\"],\n });\n }\n }\n\n return { queries, numColumns: functionColDefs.length };\n}\n\n/**\n * Merges paged results into one merged result per column.\n * Each column has results spread across pages — this combines their\n * functionsMaps so buildFunctionColumnData can look up any object by key.\n *\n * Relies on QueryGrid layout: results[i] belongs to column (i % numColumns).\n * i.e. the first N results are the first page of each column, the next N results are the second page, etc.\n */\nfunction mergePagedResults(\n results: UseOsdkFunctionsResult,\n numColumns: number,\n): MergedResult[] {\n if (numColumns === 0) return [];\n\n const merged: MergedResult[] = Array.from(\n { length: numColumns },\n () => ({ isLoading: false, error: undefined, functionsMap: {} }),\n );\n\n results.forEach((result, index) => {\n const columnIndex = index % numColumns;\n const entry = merged[columnIndex];\n\n if (result.isLoading) {\n entry.isLoading = true;\n }\n if (result.error) {\n entry.error = result.error;\n }\n const pageData = result.data as Record<string, unknown> | undefined;\n if (pageData) {\n Object.assign(entry.functionsMap, pageData);\n }\n });\n\n return merged;\n}\n\nfunction buildFunctionColumnData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n results: MergedResult[],\n functionColDefs: FunctionColumnLocator<Q, RDPs, FunctionColumns>[],\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n disabled: boolean,\n prevColumnData: FunctionColumnData,\n): FunctionColumnData {\n const columnData: FunctionColumnData = {};\n\n if (disabled || !objects) return columnData;\n\n results.forEach((result, index) => {\n const locator = functionColDefs[index];\n if (!locator) return;\n\n const columnId = String(locator.id);\n\n columnData[columnId] = {};\n\n objects.forEach(obj => {\n const key = String(obj.$primaryKey);\n const prevData = prevColumnData[columnId]?.[key]?.data;\n\n columnData[columnId][key] = createAsyncCellData(\n resolveCell(\n result,\n locator.getKey(obj),\n locator.getValue,\n prevData,\n ),\n );\n });\n });\n\n return columnData;\n}\n\n/** Resolves the cell state: error, loaded, or loading with previous data. */\nfunction resolveCell(\n result: MergedResult,\n objectKey: string,\n getValue: ((cellData: unknown) => unknown) | undefined,\n prevData: unknown,\n): Omit<AsyncCellData, \"__asyncCell\"> {\n if (result.error) {\n return { isLoading: false, error: result.error };\n }\n if (objectKey in result.functionsMap) {\n const rawData = result.functionsMap[objectKey];\n return { isLoading: false, data: getValue ? getValue(rawData) : rawData };\n }\n // Key not in results. While the query is still loading, keep showing the\n // previous data so the cell doesn't flash empty during a refetch. Once the\n // query has resolved without an entry for this object, its value is gone —\n // clear the cell instead of retaining the stale previous value (otherwise a\n // cell whose derived value became null keeps displaying the old value).\n return {\n isLoading: result.isLoading,\n data: result.isLoading ? prevData : undefined,\n };\n}\n\nconst useStableObjects = <\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n>(\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n):\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined =>\n{\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => objects, [\n // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(\n (objects ?? []).map(item => ({\n $apiName: item.$apiName,\n $primaryKey: item.$primaryKey,\n })).sort((a, b) => {\n if (a.$apiName !== b.$apiName) {\n return a.$apiName.localeCompare(b.$apiName);\n }\n return String(a.$primaryKey).localeCompare(String(b.$primaryKey));\n }),\n ),\n ]);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA,SAEEA,aAAa,EACbC,gBAAgB,QAEX,aAAa;AACpB,SAASC,KAAK,QAAQ,WAAW;AACjC,SAASC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAKvC,SAEEC,mBAAmB,QACd,2BAA2B;AAClC,SACEC,0CAA0C,EAC1CC,+BAA+B,EAC/BC,iBAAiB,QACZ,uBAAuB;AAyB9B,MAAMC,YAAY,GAChBC,qBAAkD,IACA;EAClD,OAAOA,qBAAqB,CAACC,IAAI,KAAK,QAAQ;AAChD,CAAC;AAED,OAAO,SAASC,sBAAsBA,CAQpC;EACEF,qBAAqB;EACrBG,OAAO;EACPC,iBAAiB;EACjBC,iBAAiB;EACjBC,QAAQ,GAAGR;AAC4C,CAAC,EACtC;EACpB,MAAMS,MAAM,GAAGjB,aAAa,CAAC,CAAC;EAC9B,MAAMkB,WAAW,GAAGd,MAAM,CAAqB,CAAC,CAAC,CAAC;EAElD,MAAMe,sBAAsB,GAAGT,qBAAqB,IAC/CD,YAAY,CAACC,qBAAqB,CAAC;EAExC,MAAMU,aAAa,GAAGC,gBAAgB,CAACR,OAAO,CAAC;EAE/C,MAAMS,aAA6C,GAAGnB,OAAO,CAC3D,MAAM;IACJ,OAAOgB,sBAAsB,GACzBF,MAAM,CAACP,qBAAqB,CAAC,GAC7Ba,SAAS;EACf,CAAC,EACD,CAACN,MAAM,EAAEE,sBAAsB,EAAET,qBAAqB,CACxD,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umnsData.js","names":["useOsdkClient","useOsdkFunctions","useMemo","useRef","createAsyncCellData","DEFAULT_FUNCTION_COLUMN_DEDUPE_INTERVAL_MS","DEFAULT_MAX_CONCURRENT_REQUESTS","DEFAULT_PAGE_SIZE","buildPagedObjectSets","extractFunctionLocators","useFunctionColumnsData","objectOrInterfaceType","objects","columnDefinitions","pageSize","client","prevDataRef","stableObjects","useStableObjects","functionColDefs","pagedObjectSets","length","disabled","queryGrid","EMPTY_QUERY_GRID","buildQueryGrid","results","queries","enabled","maxConcurrent","mergedResults","mergePagedResults","numColumns","data","columnData","buildFunctionColumnData","current","pagedObjects","objectSet","pagedObjectSet","pageObjects","locator","push","queryDefinition","options","params","getFunctionParams","dedupeIntervalMs","dependsOn","dependsOnObjects","merged","Array","from","isLoading","error","undefined","functionsMap","forEach","result","index","entry","pageData","Object","assign","prevColumnData","columnId","String","id","obj","key","$primaryKey","prevData","resolveCell","getKey","getValue","objectKey","rawData","JSON","stringify","map","item","$apiName","sort","a","b","localeCompare"],"sources":["useFunctionColumnsData.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport {\n type FunctionQueryParams,\n useOsdkClient,\n useOsdkFunctions,\n type UseOsdkFunctionsResult,\n} from \"@osdk/react\";\nimport { useMemo, useRef } from \"react\";\nimport type {\n ColumnDefinition,\n FunctionColumnLocator,\n} from \"../ObjectTableApi.js\";\nimport {\n type AsyncCellData,\n createAsyncCellData,\n} from \"../utils/AsyncCellData.js\";\nimport {\n DEFAULT_FUNCTION_COLUMN_DEDUPE_INTERVAL_MS,\n DEFAULT_MAX_CONCURRENT_REQUESTS,\n DEFAULT_PAGE_SIZE,\n} from \"../utils/constants.js\";\nimport {\n buildPagedObjectSets,\n extractFunctionLocators,\n type PagedObjects,\n} from \"../utils/functionColumns.js\";\n\nexport interface FunctionColumnData {\n [columnId: string]: {\n [objectPrimaryKey: string]: AsyncCellData;\n };\n}\n\nexport interface UseFunctionColumnsDataOptions<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n> {\n objectOrInterfaceType: Q;\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined;\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>;\n pageSize?: number;\n}\n\nexport function useFunctionColumnsData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n {\n objectOrInterfaceType,\n objects,\n columnDefinitions,\n pageSize = DEFAULT_PAGE_SIZE,\n }: UseFunctionColumnsDataOptions<Q, RDPs, FunctionColumns>,\n): FunctionColumnData {\n const client = useOsdkClient();\n const prevDataRef = useRef<FunctionColumnData>({});\n\n const stableObjects = useStableObjects(objects);\n\n const functionColDefs = useMemo(\n () => extractFunctionLocators<Q, RDPs, FunctionColumns>(columnDefinitions),\n [columnDefinitions],\n );\n\n // Construct an object set per page (base set filtered to each page's\n // primary keys). `buildPagedObjectSets` returns `[]` for interfaces and\n // when there's no work to do, which short-circuits the downstream queries.\n //\n // When a new page loads, only that page's queries fire — old pages hit the\n // dedupeIntervalMs cache since their params are unchanged.\n const pagedObjectSets = useMemo(() => {\n if (!stableObjects?.length) return [];\n return buildPagedObjectSets<Q, RDPs>(\n client,\n objectOrInterfaceType,\n stableObjects,\n pageSize,\n );\n }, [\n client,\n objectOrInterfaceType,\n stableObjects,\n pageSize,\n ]);\n\n const disabled = pagedObjectSets.length === 0\n || functionColDefs.length === 0;\n\n const queryGrid = useMemo(() => {\n if (pagedObjectSets.length === 0 || functionColDefs.length === 0) {\n return EMPTY_QUERY_GRID;\n }\n return buildQueryGrid<Q, RDPs, FunctionColumns>(\n pagedObjectSets,\n functionColDefs,\n );\n }, [pagedObjectSets, functionColDefs]);\n\n const results = useOsdkFunctions({\n queries: queryGrid.queries,\n enabled: !disabled,\n maxConcurrent: DEFAULT_MAX_CONCURRENT_REQUESTS,\n });\n\n const mergedResults = useMemo(\n () => mergePagedResults(results, queryGrid.numColumns),\n [results, queryGrid.numColumns],\n );\n\n const data = useMemo(() => {\n const columnData = buildFunctionColumnData(\n mergedResults,\n functionColDefs,\n stableObjects,\n disabled,\n prevDataRef.current,\n );\n prevDataRef.current = columnData;\n return columnData;\n }, [mergedResults, functionColDefs, stableObjects, disabled]);\n\n return data;\n}\n\n/**\n * Pairs a flat queries array with the layout metadata needed to recover per-column\n * results back into per-column groups. The numColumns value is produced by\n * the same function that builds the queries, so the two are always in sync.\n */\ninterface QueryGrid {\n queries: FunctionQueryParams<QueryDefinition<unknown>>[];\n numColumns: number;\n}\n\ninterface MergedResult {\n isLoading: boolean;\n error: unknown;\n functionsMap: Record<string, unknown>;\n}\n\nconst EMPTY_QUERY_GRID: QueryGrid = { queries: [], numColumns: 0 };\n\n/**\n * Builds a flat query array and the layout metadata needed to recover per-column results.\n *\n * Layout: [page0_col0, page0_col1, ..., page1_col0, page1_col1, ...]\n * Page-first ordering ensures first concurrent queries prioritizes the first page,\n * so visible rows get all their columns populated before later pages.\n *\n * Each query carries `dependsOnObjects` (the page's row instances) so that\n * editing any of those rows fans out to invalidate this function query, and\n * `dependsOn` from the locator so that linked-type edits also invalidate.\n */\nfunction buildQueryGrid<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n pagedObjects: PagedObjects<Q, RDPs>[],\n functionColDefs: FunctionColumnLocator<Q, RDPs, FunctionColumns>[],\n): QueryGrid {\n const queries: FunctionQueryParams<QueryDefinition<unknown>>[] = [];\n\n for (\n const { objectSet: pagedObjectSet, objects: pageObjects } of pagedObjects\n ) {\n for (const locator of functionColDefs) {\n queries.push({\n queryDefinition: locator.queryDefinition,\n options: {\n params: locator.getFunctionParams(pagedObjectSet),\n dedupeIntervalMs: locator.dedupeIntervalMs\n ?? DEFAULT_FUNCTION_COLUMN_DEDUPE_INTERVAL_MS,\n dependsOn: locator.dependsOn,\n dependsOnObjects: pageObjects,\n } as FunctionQueryParams<QueryDefinition<unknown>>[\"options\"],\n });\n }\n }\n\n return { queries, numColumns: functionColDefs.length };\n}\n\n/**\n * Merges paged results into one merged result per column.\n * Each column has results spread across pages — this combines their\n * functionsMaps so buildFunctionColumnData can look up any object by key.\n *\n * Relies on QueryGrid layout: results[i] belongs to column (i % numColumns).\n * i.e. the first N results are the first page of each column, the next N results are the second page, etc.\n */\nfunction mergePagedResults(\n results: UseOsdkFunctionsResult,\n numColumns: number,\n): MergedResult[] {\n if (numColumns === 0) return [];\n\n const merged: MergedResult[] = Array.from(\n { length: numColumns },\n () => ({ isLoading: false, error: undefined, functionsMap: {} }),\n );\n\n results.forEach((result, index) => {\n const columnIndex = index % numColumns;\n const entry = merged[columnIndex];\n\n if (result.isLoading) {\n entry.isLoading = true;\n }\n if (result.error) {\n entry.error = result.error;\n }\n const pageData = result.data as Record<string, unknown> | undefined;\n if (pageData) {\n Object.assign(entry.functionsMap, pageData);\n }\n });\n\n return merged;\n}\n\nfunction buildFunctionColumnData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n results: MergedResult[],\n functionColDefs: FunctionColumnLocator<Q, RDPs, FunctionColumns>[],\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n disabled: boolean,\n prevColumnData: FunctionColumnData,\n): FunctionColumnData {\n const columnData: FunctionColumnData = {};\n\n if (disabled || !objects) return columnData;\n\n results.forEach((result, index) => {\n const locator = functionColDefs[index];\n if (!locator) return;\n\n const columnId = String(locator.id);\n\n columnData[columnId] = {};\n\n objects.forEach(obj => {\n const key = String(obj.$primaryKey);\n const prevData = prevColumnData[columnId]?.[key]?.data;\n\n columnData[columnId][key] = createAsyncCellData(\n resolveCell(\n result,\n locator.getKey(obj),\n locator.getValue,\n prevData,\n ),\n );\n });\n });\n\n return columnData;\n}\n\n/** Resolves the cell state: error, loaded, or loading with previous data. */\nfunction resolveCell(\n result: MergedResult,\n objectKey: string,\n getValue: ((cellData: unknown) => unknown) | undefined,\n prevData: unknown,\n): Omit<AsyncCellData, \"__asyncCell\"> {\n if (result.error) {\n return { isLoading: false, error: result.error };\n }\n if (objectKey in result.functionsMap) {\n const rawData = result.functionsMap[objectKey];\n return { isLoading: false, data: getValue ? getValue(rawData) : rawData };\n }\n // Key not in results. While the query is still loading, keep showing the\n // previous data so the cell doesn't flash empty during a refetch. Once the\n // query has resolved without an entry for this object, its value is gone —\n // clear the cell instead of retaining the stale previous value (otherwise a\n // cell whose derived value became null keeps displaying the old value).\n return {\n isLoading: result.isLoading,\n data: result.isLoading ? prevData : undefined,\n };\n}\n\nconst useStableObjects = <\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n>(\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n):\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined =>\n{\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => objects, [\n // eslint-disable-next-line react-hooks/exhaustive-deps\n JSON.stringify(\n (objects ?? []).map(item => ({\n $apiName: item.$apiName,\n $primaryKey: item.$primaryKey,\n })).sort((a, b) => {\n if (a.$apiName !== b.$apiName) {\n return a.$apiName.localeCompare(b.$apiName);\n }\n return String(a.$primaryKey).localeCompare(String(b.$primaryKey));\n }),\n ),\n ]);\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAEEA,aAAa,EACbC,gBAAgB,QAEX,aAAa;AACpB,SAASC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAKvC,SAEEC,mBAAmB,QACd,2BAA2B;AAClC,SACEC,0CAA0C,EAC1CC,+BAA+B,EAC/BC,iBAAiB,QACZ,uBAAuB;AAC9B,SACEC,oBAAoB,EACpBC,uBAAuB,QAElB,6BAA6B;AAwBpC,OAAO,SAASC,sBAAsBA,CAQpC;EACEC,qBAAqB;EACrBC,OAAO;EACPC,iBAAiB;EACjBC,QAAQ,GAAGP;AAC4C,CAAC,EACtC;EACpB,MAAMQ,MAAM,GAAGf,aAAa,CAAC,CAAC;EAC9B,MAAMgB,WAAW,GAAGb,MAAM,CAAqB,CAAC,CAAC,CAAC;EAElD,MAAMc,aAAa,GAAGC,gBAAgB,CAACN,OAAO,CAAC;EAE/C,MAAMO,eAAe,GAAGjB,OAAO,CAC7B,MAAMO,uBAAuB,CAA2BI,iBAAiB,CAAC,EAC1E,CAACA,iBAAiB,CACpB,CAAC;;EAED;EACA;EACA;EACA;EACA;EACA;EACA,MAAMO,eAAe,GAAGlB,OAAO,CAAC,MAAM;IACpC,IAAI,CAACe,aAAa,EAAEI,MAAM,EAAE,OAAO,EAAE;IACrC,OAAOb,oBAAoB,CACzBO,MAAM,EACNJ,qBAAqB,EACrBM,aAAa,EACbH,QACF,CAAC;EACH,CAAC,EAAE,CACDC,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objectOrInterfaceType, columnDefinitions, fil
82
82
 
83
83
  // Get the result from the appropriate hook
84
84
  const baseResult = shouldUseObjectSet ? objectSetResult : osdkObjectsResult;
85
- const primaryKeyApiName = objectOrInterfaceType.type === "object" ? objectOrInterfaceType.primaryKeyApiName : undefined;
86
85
 
87
86
  // Call useFunctionColumnsData to get function column data
88
87
  const functionColumnData = useFunctionColumnsData({
89
88
  objectOrInterfaceType,
90
89
  objects: baseResult.data,
91
90
  columnDefinitions,
92
- primaryKeyApiName,
93
91
  pageSize
94
92
  });
95
93
 
@@ -1 +1 @@
1
- {"version":3,"file":"useObjectTableData.js","names":["useObjectSet","useOsdkObjects","useMemo","DEFAULT_OBJECT_TABLE_DEDUPE_INTERVAL_MS","DEFAULT_PAGE_SIZE","useFunctionColumnsData","useObjectTableData","objectOrInterfaceType","columnDefinitions","filter","sorting","objectSet","objectSetOptions","dedupeIntervalMs","pageSize","streamUpdates","orderBy","length","undefined","reduce","acc","sort","id","desc","withProperties","rdpColumns","map","colDef","locator","colLocator","type","cur","creator","isObjectType","shouldUseObjectSet","objectSetResult","where","enabled","osdkObjectsResult","baseResult","primaryKeyApiName","functionColumnData","objects","data","mergedData","obj","objKey","String","$primaryKey","functionData","Object","entries","forEach","columnId","columnData"],"sources":["useObjectTableData.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport {\n useObjectSet,\n type UseOsdkListResult,\n useOsdkObjects,\n} from \"@osdk/react\";\nimport type { SortingState } from \"@tanstack/react-table\";\nimport { useMemo } from \"react\";\nimport type { ColumnDefinition, ObjectSetOptions } from \"../ObjectTableApi.js\";\nimport type { AsyncCellData } from \"../utils/AsyncCellData.js\";\nimport {\n DEFAULT_OBJECT_TABLE_DEDUPE_INTERVAL_MS,\n DEFAULT_PAGE_SIZE,\n} from \"../utils/constants.js\";\nimport { useFunctionColumnsData } from \"./useFunctionColumnsData.js\";\n\ntype WithProperties<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n> = {\n [K in keyof RDPs]: DerivedProperty.Creator<Q, RDPs[K]>;\n};\n\ninterface UseObjectTableDataResult<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> extends Omit<UseOsdkListResult<Q, RDPs>, \"isOptimistic\"> {}\n/**\n * This hook is a wrapper that conditionally uses either useObjectSet or useOsdkObjects\n * based on whether an objectSet prop is provided.\n * It extracts RDP locators from columnDefinitions and applies withProperties\n * to return data containing the derived properties.\n */\nexport function useObjectTableData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n objectOrInterfaceType: Q,\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n filter?: WhereClause<Q, RDPs>,\n sorting?: SortingState,\n objectSet?: ObjectSet<Q>,\n objectSetOptions?: ObjectSetOptions<Q>,\n dedupeIntervalMs: number = DEFAULT_OBJECT_TABLE_DEDUPE_INTERVAL_MS,\n pageSize: number = DEFAULT_PAGE_SIZE,\n streamUpdates?: boolean,\n): UseObjectTableDataResult<Q, RDPs> {\n const orderBy = useMemo(() => {\n if (!sorting || sorting.length === 0) {\n return undefined;\n }\n\n return sorting.reduce<{ [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" }>(\n (acc, sort) => {\n acc[sort.id as PropertyKeys<Q>] = sort.desc ? \"desc\" : \"asc\";\n return acc;\n },\n {},\n );\n }, [sorting]);\n\n // Extract derived properties definition\n const withProperties = useMemo(() => {\n if (!columnDefinitions) {\n return;\n }\n\n const rdpColumns = columnDefinitions.map(colDef => colDef.locator).filter(\n (colLocator) => {\n return colLocator.type === \"rdp\";\n },\n );\n\n if (!rdpColumns.length) {\n return;\n }\n\n return rdpColumns.reduce<WithProperties<Q, RDPs>>(\n (acc, cur) => {\n return {\n ...acc,\n [cur.id]: cur.creator,\n };\n },\n {} as WithProperties<Q, RDPs>,\n );\n }, [columnDefinitions]);\n\n // When objectSet is provided and it's an object type, use useObjectSet. Otherwise, use useOsdkObjects.\n const isObjectType = objectOrInterfaceType.type === \"object\";\n const shouldUseObjectSet = !!objectSet && isObjectType;\n\n // When shouldUseObjectSet is true, we know objectSet is defined\n // and objectOrInterfaceType is an ObjectTypeDefinition\n const objectSetResult = useObjectSet(\n shouldUseObjectSet ? objectSet as ObjectSet<Q, RDPs> : undefined as any,\n {\n ...(objectSetOptions as ObjectSetOptions<Q>),\n withProperties: withProperties as WithProperties<\n Q,\n RDPs\n >,\n where: filter,\n orderBy,\n pageSize,\n enabled: shouldUseObjectSet,\n dedupeIntervalMs,\n streamUpdates,\n },\n );\n\n const osdkObjectsResult = useOsdkObjects<\n Q,\n RDPs\n >(\n objectOrInterfaceType,\n {\n withProperties,\n pageSize,\n where: filter,\n orderBy,\n enabled: !shouldUseObjectSet,\n dedupeIntervalMs,\n streamUpdates,\n },\n );\n\n // Get the result from the appropriate hook\n const baseResult = shouldUseObjectSet ? objectSetResult : osdkObjectsResult;\n\n const primaryKeyApiName = objectOrInterfaceType.type === \"object\"\n ? objectOrInterfaceType.primaryKeyApiName\n : undefined;\n\n // Call useFunctionColumnsData to get function column data\n const functionColumnData = useFunctionColumnsData<Q, RDPs, FunctionColumns>({\n objectOrInterfaceType,\n objects: baseResult.data,\n columnDefinitions,\n primaryKeyApiName,\n pageSize,\n });\n\n // Merge function column data into each object\n const mergedData = useMemo(() => {\n if (!baseResult.data) return baseResult.data;\n\n return baseResult.data.map(obj => {\n const objKey = String(obj.$primaryKey);\n const functionData: Record<string, AsyncCellData> = {};\n\n // Collect all function column data for this object\n Object.entries(functionColumnData).forEach(([columnId, columnData]) => {\n if (columnData[objKey]) {\n functionData[columnId] = columnData[objKey];\n }\n });\n\n // Return object with function data merged in\n return {\n ...obj,\n ...functionData,\n };\n });\n }, [baseResult.data, functionColumnData]);\n\n // Return the result with merged data\n return {\n ...baseResult,\n data: mergedData,\n } as UseObjectTableDataResult<Q, RDPs>;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SACEA,YAAY,EAEZC,cAAc,QACT,aAAa;AAEpB,SAASC,OAAO,QAAQ,OAAO;AAG/B,SACEC,uCAAuC,EACvCC,iBAAiB,QACZ,uBAAuB;AAC9B,SAASC,sBAAsB,QAAQ,6BAA6B;AAgBpE;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAWhCC,qBAAwB,EACxBC,iBAAqE,EACrEC,MAA6B,EAC7BC,OAAsB,EACtBC,SAAwB,EACxBC,gBAAsC,EACtCC,gBAAwB,GAAGV,uCAAuC,EAClEW,QAAgB,GAAGV,iBAAiB,EACpCW,aAAuB,EACY;EACnC,MAAMC,OAAO,GAAGd,OAAO,CAAC,MAAM;IAC5B,IAAI,CAACQ,OAAO,IAAIA,OAAO,CAACO,MAAM,KAAK,CAAC,EAAE;MACpC,OAAOC,SAAS;IAClB;IAEA,OAAOR,OAAO,CAACS,MAAM,CACnB,CAACC,GAAG,EAAEC,IAAI,KAAK;MACbD,GAAG,CAACC,IAAI,CAACC,EAAE,CAAoB,GAAGD,IAAI,CAACE,IAAI,GAAG,MAAM,GAAG,K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5BrB,gBAAgB;IAChBE;EACF,CACF,CAAC;;EAED;EACA,MAAMwB,UAAU,GAAGL,kBAAkB,GAAGC,eAAe,GAAGG,iBAAiB;EAE3E,MAAME,iBAAiB,GAAGjC,qBAAqB,CAACuB,IAAI,KAAK,QAAQ,GAC7DvB,qBAAqB,CAACiC,iBAAiB,GACvCtB,SAAS;;EAEb;EACA,MAAMuB,kBAAkB,GAAGpC,sBAAsB,CAA2B;IAC1EE,qBAAqB;IACrBmC,OAAO,EAAEH,UAAU,CAACI,IAAI;IACxBnC,iBAAiB;IACjBgC,iBAAiB;IACjB1B;EACF,CAAC,CAAC;;EAEF;EACA,MAAM8B,UAAU,GAAG1C,OAAO,CAAC,MAAM;IAC/B,IAAI,CAACqC,UAAU,CAACI,IAAI,EAAE,OAAOJ,UAAU,CAACI,IAAI;IAE5C,OAAOJ,UAAU,CAACI,IAAI,CAACjB,GAAG,CAACmB,GAAG,IAAI;MAChC,MAAMC,MAAM,GAAGC,MAAM,CAACF,GAAG,CAACG,WAAW,CAAC;MACtC,MAAMC,YAA2C,GAAG,CAAC,CAAC;;MAEtD;MACAC,MAAM,CAACC,OAAO,CAACV,kBAAkB,CAAC,CAACW,OAAO,CAAC,CAAC,CAACC,QAAQ,EAAEC,UAAU,CAAC,KAAK;QACrE,IAAIA,UAAU,CAACR,MAAM,CAAC,EAAE;UACtBG,YAAY,CAACI,QAAQ,CAAC,GAAGC,UAAU,CAACR,MAAM,CAAC;QAC7C;MACF,CAAC,CAAC;;MAEF;MACA,OAAO;QACL,GAAGD,GAAG;QACN,GAAGI;MACL,CAAC;IACH,CAAC,CAAC;EACJ,CAAC,EAAE,CAACV,UAAU,CAACI,IAAI,EAAEF,kBAAkB,CAAC,CAAC;;EAEzC;EACA,OAAO;IACL,GAAGF,UAAU;IACbI,IAAI,EAAEC;EACR,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"useObjectTableData.js","names":["useObjectSet","useOsdkObjects","useMemo","DEFAULT_OBJECT_TABLE_DEDUPE_INTERVAL_MS","DEFAULT_PAGE_SIZE","useFunctionColumnsData","useObjectTableData","objectOrInterfaceType","columnDefinitions","filter","sorting","objectSet","objectSetOptions","dedupeIntervalMs","pageSize","streamUpdates","orderBy","length","undefined","reduce","acc","sort","id","desc","withProperties","rdpColumns","map","colDef","locator","colLocator","type","cur","creator","isObjectType","shouldUseObjectSet","objectSetResult","where","enabled","osdkObjectsResult","baseResult","functionColumnData","objects","data","mergedData","obj","objKey","String","$primaryKey","functionData","Object","entries","forEach","columnId","columnData"],"sources":["useObjectTableData.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DerivedProperty,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport {\n useObjectSet,\n type UseOsdkListResult,\n useOsdkObjects,\n} from \"@osdk/react\";\nimport type { SortingState } from \"@tanstack/react-table\";\nimport { useMemo } from \"react\";\nimport type { ColumnDefinition, ObjectSetOptions } from \"../ObjectTableApi.js\";\nimport type { AsyncCellData } from \"../utils/AsyncCellData.js\";\nimport {\n DEFAULT_OBJECT_TABLE_DEDUPE_INTERVAL_MS,\n DEFAULT_PAGE_SIZE,\n} from \"../utils/constants.js\";\nimport { useFunctionColumnsData } from \"./useFunctionColumnsData.js\";\n\ntype WithProperties<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n> = {\n [K in keyof RDPs]: DerivedProperty.Creator<Q, RDPs[K]>;\n};\n\ninterface UseObjectTableDataResult<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> extends Omit<UseOsdkListResult<Q, RDPs>, \"isOptimistic\"> {}\n/**\n * This hook is a wrapper that conditionally uses either useObjectSet or useOsdkObjects\n * based on whether an objectSet prop is provided.\n * It extracts RDP locators from columnDefinitions and applies withProperties\n * to return data containing the derived properties.\n */\nexport function useObjectTableData<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<\n string,\n never\n >,\n FunctionColumns extends Record<string, QueryDefinition<{}>> = Record<\n string,\n never\n >,\n>(\n objectOrInterfaceType: Q,\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n filter?: WhereClause<Q, RDPs>,\n sorting?: SortingState,\n objectSet?: ObjectSet<Q>,\n objectSetOptions?: ObjectSetOptions<Q>,\n dedupeIntervalMs: number = DEFAULT_OBJECT_TABLE_DEDUPE_INTERVAL_MS,\n pageSize: number = DEFAULT_PAGE_SIZE,\n streamUpdates?: boolean,\n): UseObjectTableDataResult<Q, RDPs> {\n const orderBy = useMemo(() => {\n if (!sorting || sorting.length === 0) {\n return undefined;\n }\n\n return sorting.reduce<{ [K in PropertyKeys<Q>]?: \"asc\" | \"desc\" }>(\n (acc, sort) => {\n acc[sort.id as PropertyKeys<Q>] = sort.desc ? \"desc\" : \"asc\";\n return acc;\n },\n {},\n );\n }, [sorting]);\n\n // Extract derived properties definition\n const withProperties = useMemo(() => {\n if (!columnDefinitions) {\n return;\n }\n\n const rdpColumns = columnDefinitions.map(colDef => colDef.locator).filter(\n (colLocator) => {\n return colLocator.type === \"rdp\";\n },\n );\n\n if (!rdpColumns.length) {\n return;\n }\n\n return rdpColumns.reduce<WithProperties<Q, RDPs>>(\n (acc, cur) => {\n return {\n ...acc,\n [cur.id]: cur.creator,\n };\n },\n {} as WithProperties<Q, RDPs>,\n );\n }, [columnDefinitions]);\n\n // When objectSet is provided and it's an object type, use useObjectSet. Otherwise, use useOsdkObjects.\n const isObjectType = objectOrInterfaceType.type === \"object\";\n const shouldUseObjectSet = !!objectSet && isObjectType;\n\n // When shouldUseObjectSet is true, we know objectSet is defined\n // and objectOrInterfaceType is an ObjectTypeDefinition\n const objectSetResult = useObjectSet(\n shouldUseObjectSet ? objectSet as ObjectSet<Q, RDPs> : undefined as any,\n {\n ...(objectSetOptions as ObjectSetOptions<Q>),\n withProperties: withProperties as WithProperties<\n Q,\n RDPs\n >,\n where: filter,\n orderBy,\n pageSize,\n enabled: shouldUseObjectSet,\n dedupeIntervalMs,\n streamUpdates,\n },\n );\n\n const osdkObjectsResult = useOsdkObjects<\n Q,\n RDPs\n >(\n objectOrInterfaceType,\n {\n withProperties,\n pageSize,\n where: filter,\n orderBy,\n enabled: !shouldUseObjectSet,\n dedupeIntervalMs,\n streamUpdates,\n },\n );\n\n // Get the result from the appropriate hook\n const baseResult = shouldUseObjectSet ? objectSetResult : osdkObjectsResult;\n\n // Call useFunctionColumnsData to get function column data\n const functionColumnData = useFunctionColumnsData<Q, RDPs, FunctionColumns>({\n objectOrInterfaceType,\n objects: baseResult.data,\n columnDefinitions,\n pageSize,\n });\n\n // Merge function column data into each object\n const mergedData = useMemo(() => {\n if (!baseResult.data) return baseResult.data;\n\n return baseResult.data.map(obj => {\n const objKey = String(obj.$primaryKey);\n const functionData: Record<string, AsyncCellData> = {};\n\n // Collect all function column data for this object\n Object.entries(functionColumnData).forEach(([columnId, columnData]) => {\n if (columnData[objKey]) {\n functionData[columnId] = columnData[objKey];\n }\n });\n\n // Return object with function data merged in\n return {\n ...obj,\n ...functionData,\n };\n });\n }, [baseResult.data, functionColumnData]);\n\n // Return the result with merged data\n return {\n ...baseResult,\n data: mergedData,\n } as UseObjectTableDataResult<Q, RDPs>;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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