@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.
@@ -632,7 +632,13 @@ interface FunctionColumnLocator<Q extends ObjectOrInterfaceDefinition, RDPs exte
632
632
  * @param cellData - The raw data returned by the function for this object
633
633
  * @returns - The value to display in the cell
634
634
  */
635
- getValue?: (cellData: unknown) => unknown;
635
+ getValue?: (cellData?: unknown) => unknown;
636
+ /**
637
+ * Minimum time between re-fetches of the same function with the same parameters, in milliseconds.
638
+ * Defaults to 5 minutes to maximize cache hits
639
+ * @default 300_000 (5 minutes)
640
+ */
641
+ dedupeIntervalMs?: number;
636
642
  }
637
643
  interface RdpColumnLocator<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = Record<string, never>> {
638
644
  type: "rdp";
@@ -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,MAAMG,aAAa,GAAGC,gBAAgB,CAACL,OAAO,CAAC;;EAE/C;EACA;EACA,MAAMM,eAAe,GAAGV,OAAO,CAAC,MAAMG,SAAS,EAAE,CAACQ,IAAI,CAACC,SAAS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Q,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;AAC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param cellData - The raw data returned by the function for this object
83
83
  * @returns - The value to display in the cell
84
84
  */
85
- getValue?: (cellData: unknown) => unknown;
85
+ getValue?: (cellData?: unknown) => unknown;
86
+ /**
87
+ * Minimum time between re-fetches of the same function with the same parameters, in milliseconds.
88
+ * Defaults to 5 minutes to maximize cache hits
89
+ * @default 300_000 (5 minutes)
90
+ */
91
+ dedupeIntervalMs?: number;
86
92
  }
87
93
  export interface RdpColumnLocator<
88
94
  Q extends ObjectOrInterfaceDefinition,
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,qBACA,iBACA,6BACA,WACA,MACA,gBACA,cACA,iBACA,mBACA,mBACK,WAAY;AACnB,cAAc,0BAA0B,kCAAmC;AAC3E,iBAAiB,WAAW,OAAQ;AACpC,cAAc,oBAAoB,kBAAmB;AAErD,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAI5D;CACF,SAAS,wBAAwB,GAAG,MAAM;;;;CAK1C;;;;CAKA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;CAQA,gBACEA,mBACG;CAEL,cACEC,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAChEC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;;;;;;;;;;CAWX;;;;;CAMA,qBAAqB,MAAM;AAC5B;AAED,YAAY,uBACV,UAAU,mBACR,oBAAoB,GAAG,sBAAsB,oCAE7C,mBAAmB,oBAAoB,GAAG;AAE9C,iBAAiB,sBAAsB,UAAU,6BAA6B;CAC5E,MAAM;CACN,IAAI,aAAa;AAClB;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;;;;;CAKA,MAAM;CACN,UAAU;CACV,iBAAiB,sBAAsB;;;;;;CAOvC,oBACEC,WAAW,UAAU,GAAG,UACrB,uBAA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CACD;;;;;;;;CAUH,0BACEC,WAAW,MAAM;EACf,UAAU,aAAa,WAAW,aAAa;EAC/C,QAAQ,SAAS,UAAU;CAC5B;;;;;;;CASH,kBACEC,UAAU,aAAa,WAAW,aAAa,iBAC/CC;;;;;;CAQF,cACEX,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;;;CAWlE,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;CAM9B;;;;;;;;CASA,kBACEY,gBAAgB,eAAe,MAC/BC;;;;CAKF,yBACEC,KAAK,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAC7DC,uBACG,MAAM;;;;;;CAOX;CAEA;AACD;AAED,iBAAiB,iBACf,UAAU,6BACV;;;;CAIA,QAAQ,UAAU;;;;CAKlB,YAAY,UAAU;;;;CAKtB,WAAW,UAAU;AACtB","names":["value: unknown","object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>","objectSet: ObjectSet<Q, RDPs>","cellData: unknown","newWhere: WhereClause<Q, RDPs>","newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>","info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >","edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>","columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns","newWidth: number | null","selectedRowIds: PrimaryKeyType<Q>[]","isSelectAll?: boolean","row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","cellValue: unknown"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
1
+ {"mappings":"AAgBA,cACE,qBACA,iBACA,6BACA,WACA,MACA,gBACA,cACA,iBACA,mBACA,mBACK,WAAY;AACnB,cAAc,0BAA0B,kCAAmC;AAC3E,iBAAiB,WAAW,OAAQ;AACpC,cAAc,oBAAoB,kBAAmB;AAErD,YAAY;CACV,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;IAI5D;CACF,SAAS,wBAAwB,GAAG,MAAM;;;;CAK1C;;;;CAKA,SAAS,SAAS,UAAU;CAC5B;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;CAQA,gBACEA,mBACG;CAEL,cACEC,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAChEC,SAAS,wBAAwB,GAAG,MAAM,qBACvC,MAAM;;;;;;;;;;CAWX;;;;;CAMA,qBAAqB,MAAM;AAC5B;AAED,YAAY,uBACV,UAAU,mBACR,oBAAoB,GAAG,sBAAsB,oCAE7C,mBAAmB,oBAAoB,GAAG;AAE9C,iBAAiB,sBAAsB,UAAU,6BAA6B;CAC5E,MAAM;CACN,IAAI,aAAa;AAClB;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAI9D;;;;;CAKA,MAAM;CACN,UAAU;CACV,iBAAiB,sBAAsB;;;;;;CAOvC,oBACEC,WAAW,UAAU,GAAG,UACrB,uBAAuB,sBAAsB;;;;;;CAOlD,SACEF,QAAQ,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;;;;;;;CASlE,YAAYG;;;;;;CAOZ;AACD;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB;EACjD;CACA,MAAM;CACN,UAAU;CACV,SAAS,gBAAgB,QAAQ,GAAG,WAAW;AAChD;AAED,iBA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E,gBAAgB,WAAW,aAAa;;;;;CAMxC,eAAe,eAAe;;;;;CAM9B;;;;;;;;CASA,kBACEY,gBAAgB,eAAe,MAC/BC;;;;CAKF,yBACEC,KAAK,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,OAC7DC,uBACG,MAAM;;;;;;CAOX;CAEA;AACD;AAED,iBAAiB,iBACf,UAAU,6BACV;;;;CAIA,QAAQ,UAAU;;;;CAKlB,YAAY,UAAU;;;;CAKtB,WAAW,UAAU;AACtB","names":["value: unknown","object: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","locator: ColumnDefinitionLocator<Q, RDPs, FunctionColumns>","objectSet: ObjectSet<Q, RDPs>","cellData?: unknown","newWhere: WhereClause<Q, RDPs>","newOrderBy: Array<{\n property: PropertyKeys<Q>;\n direction: \"asc\" | \"desc\";\n }>","info: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >","edits: CellEditInfo<\n Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>,\n unknown\n >[]","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n isVisible: boolean;\n }>","newStates: Array<{\n columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns;\n pinned: \"left\" | \"right\" | \"none\";\n }>","columnId: PropertyKeys<Q> | keyof RDPs | keyof FunctionColumns","newWidth: number | null","selectedRowIds: PrimaryKeyType<Q>[]","isSelectAll?: boolean","row: Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>","cellValue: unknown"],"sources":["../../../src/object-table/ObjectTableApi.ts"],"version":3,"file":"ObjectTableApi.d.ts"}
@@ -6,6 +6,7 @@ export interface FunctionColumnData {
6
6
  [objectPrimaryKey: string]: AsyncCellData
7
7
  };
8
8
  }
9
+ export declare const DEFAULT_DEDUPE_INTERVAL_MS = 3e5;
9
10
  export declare function useFunctionColumnsData<
10
11
  Q extends ObjectOrInterfaceDefinition,
11
12
  RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,6BACA,WACA,MACA,cACA,iBACA,yBACK,WAAY;AAOnB,cACE,wBAEK,sBAAuB;AAC9B,cACO,qBAEA,2BAA4B;AAEnC,iBAAiB,mBAAmB;qBACd;8BACU;CAC7B;AACF;AAmBD,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9DA,WAAW,UAAU,GAAG,mBACxBC,SACI,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,qBAE5DC,oBAAoB,MAAM,iBAAiB,GAAG,MAAM,oBACnD","names":["objectSet: ObjectSet<Q, RDPs> | undefined","objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined","columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>"],"sources":["../../../../src/object-table/hooks/useFunctionColumnsData.ts"],"version":3,"file":"useFunctionColumnsData.d.ts"}
1
+ {"mappings":"AAgBA,cACE,6BACA,WACA,MACA,cACA,iBACA,yBACK,WAAY;AAOnB,cACE,wBAEK,sBAAuB;AAC9B,cACO,qBAEA,2BAA4B;AAEnC,iBAAiB,mBAAmB;qBACd;8BACU;CAC7B;AACF;AAsBD,OAAO,cAAM,6BAA6B;AAE1C,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,wBAAwB,eAAe,gBAAgB,CAAE,MAAK;EAK9DA,WAAW,UAAU,GAAG,mBACxBC,SACI,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI,qBAE5DC,oBAAoB,MAAM,iBAAiB,GAAG,MAAM,oBACnD","names":["objectSet: ObjectSet<Q, RDPs> | undefined","objects:\n | Osdk.Instance<Q, \"$allBaseProperties\", PropertyKeys<Q>, RDPs>[]\n | undefined","columnDefinitions?: Array<ColumnDefinition<Q, RDPs, FunctionColumns>>"],"sources":["../../../../src/object-table/hooks/useFunctionColumnsData.ts"],"version":3,"file":"useFunctionColumnsData.d.ts"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/react-components",
3
- "version": "0.2.1-main-20260407074313",
3
+ "version": "0.3.0-main-20260407144723",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@base-ui/react": "^1.0.0",
50
- "@blueprintjs/icons": "^6.0.0",
50
+ "@blueprintjs/icons": "^6.7.0",
51
51
  "@dnd-kit/core": "^6.3.1",
52
52
  "@dnd-kit/sortable": "^10.0.0",
53
53
  "@dnd-kit/utilities": "^3.2.2",
@@ -59,9 +59,9 @@
59
59
  "react-hook-form": "^7.54.0"
60
60
  },
61
61
  "peerDependencies": {
62
- "@osdk/api": "^2.8.0 || >=2.8.1-beta.0",
63
- "@osdk/client": "^2.8.0 || >=2.8.1-beta.0",
64
- "@osdk/react": "^0.10.0 || >=0.10.1-beta.0",
62
+ "@osdk/api": ">=2.9.0-beta.0",
63
+ "@osdk/client": ">=2.9.0-beta.0",
64
+ "@osdk/react": ">=0.11.0-beta.0",
65
65
  "@types/react": "^17 || ^18 || ^19",
66
66
  "classnames": "^2.0.0",
67
67
  "react": "^17 || ^18 || ^19",
@@ -78,11 +78,11 @@
78
78
  "react": "^18.3.1",
79
79
  "react-dom": "^18.3.1",
80
80
  "typescript": "~5.5.4",
81
- "@osdk/api": "2.8.1-main-20260407074313",
82
- "@osdk/client": "2.8.1-main-20260407074313",
81
+ "@osdk/api": "2.9.0-main-20260407144723",
82
+ "@osdk/client": "2.9.0-main-20260407144723",
83
83
  "@osdk/monorepo.api-extractor": "~0.7.0",
84
84
  "@osdk/monorepo.tsconfig": "~0.7.0",
85
- "@osdk/react": "0.10.1-main-20260407074313"
85
+ "@osdk/react": "0.11.0-main-20260407144723"
86
86
  },
87
87
  "publishConfig": {
88
88
  "access": "public"