@osdk/react-components 0.2.1-main-20260407074313 → 0.3.0-main-20260407144723

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,15 +1,21 @@
1
1
  # @osdk/react-components
2
2
 
3
- ## 0.2.1-main-20260407074313
3
+ ## 0.3.0-main-20260407144723
4
+
5
+ ### Minor Changes
6
+
7
+ - f8b9f12: Cache results from useOsdkFunctions
8
+ - 89def41: minor bump associated with BlueprintJS upgrade
4
9
 
5
10
  ### Patch Changes
6
11
 
7
12
  - 79b001e: Add FilePickerField component for attachment and media reference form fields
13
+ - Updated dependencies [f8b9f12]
8
14
  - Updated dependencies [bcf359f]
9
15
  - Updated dependencies [51ccca8]
10
- - @osdk/client@2.8.1-main-20260407074313
11
- - @osdk/react@0.10.1-main-20260407074313
12
- - @osdk/api@2.8.1-main-20260407074313
16
+ - @osdk/client@2.9.0-main-20260407144723
17
+ - @osdk/react@0.11.0-main-20260407144723
18
+ - @osdk/api@2.9.0-main-20260407144723
13
19
 
14
20
  ## 0.2.0
15
21
 
@@ -1 +1 @@
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/unstable-do-not-use\";\nimport type * as React from \"react\";\nimport type { CellEditInfo } 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 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 editable?: boolean;\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 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\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\nexport interface 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> {\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: keyof FunctionColumns;\n queryDefinition: FunctionColumns[keyof FunctionColumns];\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[keyof FunctionColumns]>;\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\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 * 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 * 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>;\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>;\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>;\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 button Submit Edits will be shown in the table\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 * 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 * Required when row selection is controlled.\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 * 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 * The height of each row in pixels.\n *\n * @default 40\n */\n rowHeight?: number;\n\n className?: string;\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/unstable-do-not-use\";\nimport type * as React from \"react\";\nimport type { CellEditInfo } 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 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 editable?: boolean;\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 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\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\nexport interface 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> {\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: keyof FunctionColumns;\n queryDefinition: FunctionColumns[keyof FunctionColumns];\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[keyof FunctionColumns]>;\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 to maximize cache hits\n * @default 300_000 (5 minutes)\n */\n dedupeIntervalMs?: number;\n}\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 * 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 * 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>;\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>;\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>;\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 button Submit Edits will be shown in the table\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 * 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 * Required when row selection is controlled.\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 * 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 * The height of each row in pixels.\n *\n * @default 40\n */\n rowHeight?: number;\n\n className?: string;\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":[]}
@@ -14,9 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { useOsdkFunctions } from "@osdk/react/unstable-do-not-use";
17
+ import { useOsdkFunctions } from "@osdk/react/experimental";
18
18
  import { useMemo } from "react";
19
19
  import { createAsyncCellData } from "../utils/AsyncCellData.js";
20
+ // Function column data is readOnly and can be cached aggressively,
21
+ // so we set a longer dedupe interval to maximize cache hits
22
+ export const DEFAULT_DEDUPE_INTERVAL_MS = 300_000; // 5 minutes
23
+
20
24
  export function useFunctionColumnsData(objectSet, objects, columnDefinitions) {
21
25
  // Function column configurations grouped by unique query definition
22
26
  const functionColumnConfigs = useMemo(() => getFunctionColumnConfigs(columnDefinitions), [columnDefinitions]);
@@ -35,7 +39,8 @@ export function useFunctionColumnsData(objectSet, objects, columnDefinitions) {
35
39
  return functionColumnConfigs.map(config => ({
36
40
  queryDefinition: config.queryDefinition,
37
41
  options: {
38
- params: config.getParams(stableObjectSet)
42
+ params: config.getParams(stableObjectSet),
43
+ dedupeIntervalMs: config.dedupeIntervalMs ?? DEFAULT_DEDUPE_INTERVAL_MS
39
44
  }
40
45
  }));
41
46
  }, [disabled, functionColumnConfigs, stableObjectSet]);
@@ -102,6 +107,10 @@ function getFunctionColumnConfigs(columnDefinitions) {
102
107
  getValue: locator.getValue,
103
108
  getKey: locator.getKey
104
109
  });
110
+ // When multiple columns share a query, use the shortest dedupe interval
111
+ if (locator.dedupeIntervalMs != null) {
112
+ existingConfig.dedupeIntervalMs = existingConfig.dedupeIntervalMs != null ? Math.min(existingConfig.dedupeIntervalMs, locator.dedupeIntervalMs) : locator.dedupeIntervalMs;
113
+ }
105
114
  } else {
106
115
  // Create new config
107
116
  configsByApiName.set(apiName, {
@@ -111,7 +120,8 @@ function getFunctionColumnConfigs(columnDefinitions) {
111
120
  columnId: String(locator.id),
112
121
  getValue: locator.getValue,
113
122
  getKey: locator.getKey
114
- }]
123
+ }],
124
+ dedupeIntervalMs: locator.dedupeIntervalMs
115
125
  });
116
126
  }
117
127
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useFunctionColumnsData.js","names":["useOsdkFunctions","useMemo","createAsyncCellData","useFunctionColumnsData","objectSet","objects","columnDefinitions","functionColumnConfigs","getFunctionColumnConfigs","stableObjects","useStableObjects","stableObjectSet","JSON","stringify","disabled","length","queries","map","config","queryDefinition","options","params","getParams","results","enabled","data","columnData","forEach","result","index","functionsMap","columnIds","columnId","getValue","getKey","columnGetKey","obj","key","String","$primaryKey","isLoading","error","customKey","rawData","cellData","configsByApiName","Map","colDef","locator","type","apiName","existingConfig","get","push","id","set","getFunctionParams","Array","from","values","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 Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport {\n type FunctionQueryParams,\n useOsdkFunctions,\n} from \"@osdk/react/unstable-do-not-use\";\n\nimport { useMemo } from \"react\";\nimport type {\n ColumnDefinition,\n FunctionColumnLocator,\n} from \"../ObjectTableApi.js\";\nimport {\n type AsyncCellData,\n createAsyncCellData,\n} from \"../utils/AsyncCellData.js\";\n\nexport interface FunctionColumnData {\n [columnId: string]: {\n [objectPrimaryKey: string]: AsyncCellData;\n };\n}\n\ntype FunctionColumnConfig<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> = {\n queryDefinition: QueryDefinition<unknown>;\n getParams: (\n objectSet: ObjectSet<Q, RDPs>,\n ) => unknown;\n columnIds: Array<{\n columnId: string;\n getValue?: (cellData: unknown) => unknown;\n getKey: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => string;\n }>;\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 objectSet: ObjectSet<Q, RDPs> | undefined,\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n): FunctionColumnData {\n // Function column configurations grouped by unique query definition\n const functionColumnConfigs = useMemo(\n () => getFunctionColumnConfigs(columnDefinitions),\n [columnDefinitions],\n );\n\n const stableObjects = useStableObjects(objects);\n\n // TODO: replace with useDeepEqual when it's added\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableObjectSet = useMemo(() => objectSet, [JSON.stringify(objectSet)]);\n\n const disabled = !stableObjectSet || !stableObjects?.length\n || functionColumnConfigs.length === 0;\n\n // Prepare queries for useOsdkFunctions\n const queries = useMemo(\n () => {\n if (disabled) {\n return [];\n }\n\n return functionColumnConfigs.map(\n (config): FunctionQueryParams<QueryDefinition<unknown>> => ({\n queryDefinition: config.queryDefinition,\n options: {\n params: config.getParams(stableObjectSet),\n } as FunctionQueryParams<QueryDefinition<unknown>>[\"options\"],\n }),\n );\n },\n [disabled, functionColumnConfigs, stableObjectSet],\n );\n\n const results = useOsdkFunctions(\n {\n queries,\n enabled: !disabled,\n },\n );\n\n const data = useMemo(() => {\n const columnData: FunctionColumnData = {};\n\n if (disabled || !stableObjects) return columnData;\n\n results.forEach((result, index) => {\n const config = functionColumnConfigs[index];\n if (!config) return;\n\n const functionsMap = result.data as Record<string, unknown> | undefined;\n\n config.columnIds.forEach(\n ({ columnId, getValue, getKey: columnGetKey }) => {\n if (!columnData[columnId]) {\n columnData[columnId] = {};\n }\n\n stableObjects.forEach(obj => {\n const key = String(obj.$primaryKey);\n\n if (result.isLoading) {\n columnData[columnId][key] = createAsyncCellData({\n isLoading: true,\n });\n } else if (result.error) {\n columnData[columnId][key] = createAsyncCellData({\n error: result.error,\n isLoading: false,\n });\n } else if (functionsMap) {\n const customKey = columnGetKey(obj);\n const rawData = functionsMap[customKey];\n const cellData = getValue ? getValue(rawData) : rawData;\n columnData[columnId][key] = createAsyncCellData({\n data: cellData,\n isLoading: false,\n });\n }\n });\n },\n );\n });\n\n return columnData;\n }, [results, functionColumnConfigs, stableObjects, disabled]);\n\n return data;\n}\n\nfunction getFunctionColumnConfigs<\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?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n): Array<FunctionColumnConfig<Q, RDPs>> {\n if (!columnDefinitions) return [];\n\n // Group columns by their query definition apiName\n const configsByApiName = new Map<\n string,\n FunctionColumnConfig<Q, RDPs>\n >();\n\n columnDefinitions.forEach((colDef) => {\n if (colDef.locator.type === \"function\") {\n const locator = colDef.locator as FunctionColumnLocator<\n Q,\n RDPs,\n FunctionColumns\n >;\n\n const apiName = locator.queryDefinition.apiName;\n const existingConfig = configsByApiName.get(apiName);\n\n if (existingConfig) {\n // Add this column to the existing config\n existingConfig.columnIds.push({\n columnId: String(locator.id),\n getValue: locator.getValue,\n getKey: locator.getKey,\n });\n } else {\n // Create new config\n configsByApiName.set(apiName, {\n queryDefinition: locator.queryDefinition,\n getParams: locator.getFunctionParams,\n columnIds: [{\n columnId: String(locator.id),\n getValue: locator.getValue,\n getKey: locator.getKey,\n }],\n });\n }\n }\n });\n\n return Array.from(configsByApiName.values());\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;;AAUA,SAEEA,gBAAgB,QACX,iCAAiC;AAExC,SAASC,OAAO,QAAQ,OAAO;AAK/B,SAEEC,mBAAmB,QACd,2BAA2B;AAyBlC,OAAO,SAASC,sBAAsBA,CAQpCC,SAAyC,EACzCC,OAEa,EACbC,iBAAqE,EACjD;EACpB;EACA,MAAMC,qBAAqB,GAAGN,OAAO,CACnC,MAAMO,wBAAwB,CAACF,iBAAiB,CAAC,EACjD,CAACA,iBAAiB,CACpB,CAAC;EAED,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AAI,CAACrB;EACpB,CAAC,CAAC,CAAC,CAACuB,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAK;IACjB,IAAID,CAAC,CAACF,QAAQ,KAAKG,CAAC,CAACH,QAAQ,EAAE;MAC7B,OAAOE,CAAC,CAACF,QAAQ,CAACI,aAAa,CAACD,CAAC,CAACH,QAAQ,CAAC;IAC7C;IACA,OAAOvB,MAAM,CAACyB,CAAC,CAACxB,WAAW,CAAC,CAAC0B,aAAa,CAAC3B,MAAM,CAAC0B,CAAC,CAACzB,WAAW,CAAC,CAAC;EACnE,CAAC,CACH,CAAC,CACF,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"useFunctionColumnsData.js","names":["useOsdkFunctions","useMemo","createAsyncCellData","DEFAULT_DEDUPE_INTERVAL_MS","useFunctionColumnsData","objectSet","objects","columnDefinitions","functionColumnConfigs","getFunctionColumnConfigs","stableObjects","useStableObjects","stableObjectSet","JSON","stringify","disabled","length","queries","map","config","queryDefinition","options","params","getParams","dedupeIntervalMs","results","enabled","data","columnData","forEach","result","index","functionsMap","columnIds","columnId","getValue","getKey","columnGetKey","obj","key","String","$primaryKey","isLoading","error","customKey","rawData","cellData","configsByApiName","Map","colDef","locator","type","apiName","existingConfig","get","push","id","Math","min","set","getFunctionParams","Array","from","values","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 Osdk,\n PropertyKeys,\n QueryDefinition,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport {\n type FunctionQueryParams,\n useOsdkFunctions,\n} from \"@osdk/react/experimental\";\n\nimport { useMemo } from \"react\";\nimport type {\n ColumnDefinition,\n FunctionColumnLocator,\n} from \"../ObjectTableApi.js\";\nimport {\n type AsyncCellData,\n createAsyncCellData,\n} from \"../utils/AsyncCellData.js\";\n\nexport interface FunctionColumnData {\n [columnId: string]: {\n [objectPrimaryKey: string]: AsyncCellData;\n };\n}\n\ntype FunctionColumnConfig<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n> = {\n queryDefinition: QueryDefinition<unknown>;\n getParams: (\n objectSet: ObjectSet<Q, RDPs>,\n ) => unknown;\n columnIds: Array<{\n columnId: string;\n getValue?: (cellData: unknown) => unknown;\n getKey: (\n object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n ) => string;\n }>;\n dedupeIntervalMs?: number;\n};\n\n// Function column data is readOnly and can be cached aggressively,\n// so we set a longer dedupe interval to maximize cache hits\nexport const DEFAULT_DEDUPE_INTERVAL_MS = 300_000; // 5 minutes\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 objectSet: ObjectSet<Q, RDPs> | undefined,\n objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined,\n columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n): FunctionColumnData {\n // Function column configurations grouped by unique query definition\n const functionColumnConfigs = useMemo(\n () => getFunctionColumnConfigs(columnDefinitions),\n [columnDefinitions],\n );\n\n const stableObjects = useStableObjects(objects);\n\n // TODO: replace with useDeepEqual when it's added\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableObjectSet = useMemo(() => objectSet, [JSON.stringify(objectSet)]);\n\n const disabled = !stableObjectSet || !stableObjects?.length\n || functionColumnConfigs.length === 0;\n\n // Prepare queries for useOsdkFunctions\n const queries = useMemo(\n () => {\n if (disabled) {\n return [];\n }\n\n return functionColumnConfigs.map(\n (config): FunctionQueryParams<QueryDefinition<unknown>> => ({\n queryDefinition: config.queryDefinition,\n options: {\n params: config.getParams(stableObjectSet),\n dedupeIntervalMs: config.dedupeIntervalMs\n ?? DEFAULT_DEDUPE_INTERVAL_MS,\n } as FunctionQueryParams<QueryDefinition<unknown>>[\"options\"],\n }),\n );\n },\n [disabled, functionColumnConfigs, stableObjectSet],\n );\n\n const results = useOsdkFunctions(\n {\n queries,\n enabled: !disabled,\n },\n );\n\n const data = useMemo(() => {\n const columnData: FunctionColumnData = {};\n\n if (disabled || !stableObjects) return columnData;\n\n results.forEach((result, index) => {\n const config = functionColumnConfigs[index];\n if (!config) return;\n\n const functionsMap = result.data as Record<string, unknown> | undefined;\n\n config.columnIds.forEach(\n ({ columnId, getValue, getKey: columnGetKey }) => {\n if (!columnData[columnId]) {\n columnData[columnId] = {};\n }\n\n stableObjects.forEach(obj => {\n const key = String(obj.$primaryKey);\n\n if (result.isLoading) {\n columnData[columnId][key] = createAsyncCellData({\n isLoading: true,\n });\n } else if (result.error) {\n columnData[columnId][key] = createAsyncCellData({\n error: result.error,\n isLoading: false,\n });\n } else if (functionsMap) {\n const customKey = columnGetKey(obj);\n const rawData = functionsMap[customKey];\n const cellData = getValue ? getValue(rawData) : rawData;\n columnData[columnId][key] = createAsyncCellData({\n data: cellData,\n isLoading: false,\n });\n }\n });\n },\n );\n });\n\n return columnData;\n }, [results, functionColumnConfigs, stableObjects, disabled]);\n\n return data;\n}\n\nfunction getFunctionColumnConfigs<\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?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>,\n): Array<FunctionColumnConfig<Q, RDPs>> {\n if (!columnDefinitions) return [];\n\n // Group columns by their query definition apiName\n const configsByApiName = new Map<\n string,\n FunctionColumnConfig<Q, RDPs>\n >();\n\n columnDefinitions.forEach((colDef) => {\n if (colDef.locator.type === \"function\") {\n const locator = colDef.locator as FunctionColumnLocator<\n Q,\n RDPs,\n FunctionColumns\n >;\n\n const apiName = locator.queryDefinition.apiName;\n const existingConfig = configsByApiName.get(apiName);\n\n if (existingConfig) {\n // Add this column to the existing config\n existingConfig.columnIds.push({\n columnId: String(locator.id),\n getValue: locator.getValue,\n getKey: locator.getKey,\n });\n // When multiple columns share a query, use the shortest dedupe interval\n if (locator.dedupeIntervalMs != null) {\n existingConfig.dedupeIntervalMs = existingConfig.dedupeIntervalMs\n != null\n ? Math.min(\n existingConfig.dedupeIntervalMs,\n locator.dedupeIntervalMs,\n )\n : locator.dedupeIntervalMs;\n }\n } else {\n // Create new config\n configsByApiName.set(apiName, {\n queryDefinition: locator.queryDefinition,\n getParams: locator.getFunctionParams,\n columnIds: [{\n columnId: String(locator.id),\n getValue: locator.getValue,\n getKey: locator.getKey,\n }],\n dedupeIntervalMs: locator.dedupeIntervalMs,\n });\n }\n }\n });\n\n return Array.from(configsByApiName.values());\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;;AAUA,SAEEA,gBAAgB,QACX,0BAA0B;AAEjC,SAASC,OAAO,QAAQ,OAAO;AAK/B,SAEEC,mBAAmB,QACd,2BAA2B;AA0BlC;AACA;AACA,OAAO,MAAMC,0BAA0B,GAAG,OAAO,CAAC,CAAC;;AAEnD,OAAO,SAASC,sBAAsBA,CAQpCC,SAAyC,EACzCC,OAEa,EACbC,iBAAqE,EACjD;EACpB;EACA,MAAMC,qBAAqB,GAAGP,OAAO,CACnC,MAAMQ,wBAAwB,CAACF,iBAAiB,CAAC,EACjD,CAACA,iBAAiB,CACpB,CAAC;EAED,MAAMG,aAAa,GAAGC,gBAAgB,CAACL,OAAO,CAAC;;EAE/C;EACA;EACA,MAAMM,eAAe,GAAGX,OAAO,CAAC,MAAMI,SAAS,EAAE,CAACQ,IAAI,CAACC,SAAS,CAACT,SAAS,CAAC,CAAC,CAAC;EAE7E,MAAMU,QAAQ,GAAG,CAACH,eAAe,IAAI,CAACF,aAAa,EAAEM,MAAM,IACtDR,qBAAqB,CAACQ,MAAM,KAAK,CAAC;;EAEvC;EACA,MAAMC,OAAO,GAAGhB,OAAO,CACrB,MAAM;IACJ,IAAIc,QAAQ,EAAE;MACZ,OAAO,EAAE;IACX;IAEA,OAAOP,qBAAqB,CAACU,GAAG,CAC7BC,MAAM,KAAqD;MAC1DC,eAAe,EAAED,MAAM,CAACC,eAAe;MACvCC,OAAO,EAAE;QACPC,MAAM,EAAEH,MAAM,CAACI,SAAS,CAACX,eAAe,CAAC;QACzCY,gBAAgB,EAAEL,MAAM,CAACK,gBAAgB,IACpCrB;MACP;IACF,CAAC,CACH,CAAC;EACH,CAAC,EACD,CAACY,QAAQ,EAAEP,qBAAqB,EAAE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C4B,CAAC,CAAC3B,WAAW,CAAC,CAAC;EACnE,CAAC,CACH,CAAC,CACF,CAAC;AACJ,CAAC","ignoreList":[]}
@@ -19,7 +19,6 @@ var checkbox = require('@base-ui/react/checkbox');
19
19
  var combobox = require('@base-ui/react/combobox');
20
20
  var react = require('@osdk/react');
21
21
  var reactTable = require('@tanstack/react-table');
22
- var unstableDoNotUse = require('@osdk/react/unstable-do-not-use');
23
22
  var collapsible = require('@base-ui/react/collapsible');
24
23
  var reactVirtual = require('@tanstack/react-virtual');
25
24
  var reactDom = require('react-dom');
@@ -4667,6 +4666,7 @@ function useEditableTable({
4667
4666
  clearCellValidationError
4668
4667
  };
4669
4668
  }
4669
+ var DEFAULT_DEDUPE_INTERVAL_MS = 3e5;
4670
4670
  function useFunctionColumnsData(objectSet, objects, columnDefinitions) {
4671
4671
  const functionColumnConfigs = React76.useMemo(() => getFunctionColumnConfigs(columnDefinitions), [columnDefinitions]);
4672
4672
  const stableObjects = useStableObjects(objects);
@@ -4679,11 +4679,12 @@ function useFunctionColumnsData(objectSet, objects, columnDefinitions) {
4679
4679
  return functionColumnConfigs.map((config) => ({
4680
4680
  queryDefinition: config.queryDefinition,
4681
4681
  options: {
4682
- params: config.getParams(stableObjectSet)
4682
+ params: config.getParams(stableObjectSet),
4683
+ dedupeIntervalMs: config.dedupeIntervalMs ?? DEFAULT_DEDUPE_INTERVAL_MS
4683
4684
  }
4684
4685
  }));
4685
4686
  }, [disabled, functionColumnConfigs, stableObjectSet]);
4686
- const results = unstableDoNotUse.useOsdkFunctions({
4687
+ const results = experimental.useOsdkFunctions({
4687
4688
  queries,
4688
4689
  enabled: !disabled
4689
4690
  });
@@ -4743,6 +4744,9 @@ function getFunctionColumnConfigs(columnDefinitions) {
4743
4744
  getValue: locator.getValue,
4744
4745
  getKey: locator.getKey
4745
4746
  });
4747
+ if (locator.dedupeIntervalMs != null) {
4748
+ existingConfig.dedupeIntervalMs = existingConfig.dedupeIntervalMs != null ? Math.min(existingConfig.dedupeIntervalMs, locator.dedupeIntervalMs) : locator.dedupeIntervalMs;
4749
+ }
4746
4750
  } else {
4747
4751
  configsByApiName.set(apiName, {
4748
4752
  queryDefinition: locator.queryDefinition,
@@ -4751,7 +4755,8 @@ function getFunctionColumnConfigs(columnDefinitions) {
4751
4755
  columnId: String(locator.id),
4752
4756
  getValue: locator.getValue,
4753
4757
  getKey: locator.getKey
4754
- }]
4758
+ }],
4759
+ dedupeIntervalMs: locator.dedupeIntervalMs
4755
4760
  });
4756
4761
  }
4757
4762
  }