@osdk/react 0.10.0-beta.10 → 0.10.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/build/browser/new/platform-apis/admin/useCbacBanner.js +63 -0
  3. package/build/browser/new/platform-apis/admin/useCbacBanner.js.map +1 -0
  4. package/build/browser/new/platform-apis/admin/useCbacMarkingRestrictions.js +64 -0
  5. package/build/browser/new/platform-apis/admin/useCbacMarkingRestrictions.js.map +1 -0
  6. package/build/browser/new/platform-apis/admin/useMarkingCategories.js +46 -0
  7. package/build/browser/new/platform-apis/admin/useMarkingCategories.js.map +1 -0
  8. package/build/browser/new/platform-apis/admin/useMarkings.js +46 -0
  9. package/build/browser/new/platform-apis/admin/useMarkings.js.map +1 -0
  10. package/build/browser/new/platform-apis/admin/useUserMarkings.js +50 -0
  11. package/build/browser/new/platform-apis/admin/useUserMarkings.js.map +1 -0
  12. package/build/browser/new/useOsdkAction.js +1 -0
  13. package/build/browser/new/useOsdkAction.js.map +1 -1
  14. package/build/browser/new/useOsdkObject.js +6 -2
  15. package/build/browser/new/useOsdkObject.js.map +1 -1
  16. package/build/browser/new/useOsdkObjects.js +6 -2
  17. package/build/browser/new/useOsdkObjects.js.map +1 -1
  18. package/build/browser/public/experimental/admin.js +5 -0
  19. package/build/browser/public/experimental/admin.js.map +1 -1
  20. package/build/cjs/public/experimental/admin.cjs +148 -1
  21. package/build/cjs/public/experimental/admin.cjs.map +1 -1
  22. package/build/cjs/public/experimental/admin.d.cts +159 -2
  23. package/build/cjs/public/experimental.cjs +12 -3
  24. package/build/cjs/public/experimental.cjs.map +1 -1
  25. package/build/cjs/public/experimental.d.cts +8 -1
  26. package/build/esm/new/platform-apis/admin/useCbacBanner.js +63 -0
  27. package/build/esm/new/platform-apis/admin/useCbacBanner.js.map +1 -0
  28. package/build/esm/new/platform-apis/admin/useCbacMarkingRestrictions.js +64 -0
  29. package/build/esm/new/platform-apis/admin/useCbacMarkingRestrictions.js.map +1 -0
  30. package/build/esm/new/platform-apis/admin/useMarkingCategories.js +46 -0
  31. package/build/esm/new/platform-apis/admin/useMarkingCategories.js.map +1 -0
  32. package/build/esm/new/platform-apis/admin/useMarkings.js +46 -0
  33. package/build/esm/new/platform-apis/admin/useMarkings.js.map +1 -0
  34. package/build/esm/new/platform-apis/admin/useUserMarkings.js +50 -0
  35. package/build/esm/new/platform-apis/admin/useUserMarkings.js.map +1 -0
  36. package/build/esm/new/useOsdkAction.js +1 -0
  37. package/build/esm/new/useOsdkAction.js.map +1 -1
  38. package/build/esm/new/useOsdkObject.js +6 -2
  39. package/build/esm/new/useOsdkObject.js.map +1 -1
  40. package/build/esm/new/useOsdkObjects.js +6 -2
  41. package/build/esm/new/useOsdkObjects.js.map +1 -1
  42. package/build/esm/public/experimental/admin.js +5 -0
  43. package/build/esm/public/experimental/admin.js.map +1 -1
  44. package/build/types/new/platform-apis/admin/useCbacBanner.d.ts +33 -0
  45. package/build/types/new/platform-apis/admin/useCbacBanner.d.ts.map +1 -0
  46. package/build/types/new/platform-apis/admin/useCbacMarkingRestrictions.d.ts +34 -0
  47. package/build/types/new/platform-apis/admin/useCbacMarkingRestrictions.d.ts.map +1 -0
  48. package/build/types/new/platform-apis/admin/useMarkingCategories.d.ts +27 -0
  49. package/build/types/new/platform-apis/admin/useMarkingCategories.d.ts.map +1 -0
  50. package/build/types/new/platform-apis/admin/useMarkings.d.ts +27 -0
  51. package/build/types/new/platform-apis/admin/useMarkings.d.ts.map +1 -0
  52. package/build/types/new/platform-apis/admin/useUserMarkings.d.ts +33 -0
  53. package/build/types/new/platform-apis/admin/useUserMarkings.d.ts.map +1 -0
  54. package/build/types/new/useOsdkObject.d.ts +2 -1
  55. package/build/types/new/useOsdkObject.d.ts.map +1 -1
  56. package/build/types/new/useOsdkObjects.d.ts +6 -0
  57. package/build/types/new/useOsdkObjects.d.ts.map +1 -1
  58. package/build/types/public/experimental/admin.d.ts +8 -0
  59. package/build/types/public/experimental/admin.d.ts.map +1 -1
  60. package/package.json +7 -7
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useUserMarkings.js","names":["Users","React","usePlatformQuery","OsdkContext2","useUserViewMarkings","userId","enabled","client","useContext","handleQuery","useCallback","resolvedUserId","getCurrent","id","getMarkings","query","queryName","markingIds","data","view","isLoading","error","refetch"],"sources":["useUserMarkings.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 { Users } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n\nexport interface UseUserViewMarkingsOptions {\n /**\n * The user ID to fetch view markings for.\n * When omitted, fetches markings for the current user.\n */\n userId?: string;\n /**\n * Enable or disable the query.\n *\n * When `false`, the query will not automatically execute.\n *\n * This is useful for:\n * - Lazy/on-demand queries that should wait for user interaction\n * - Dependent queries that need data from another query first\n * - Conditional queries based on component state\n *\n * @default true\n */\n enabled?: boolean;\n}\n\nexport interface UseUserViewMarkingsResult {\n markingIds: string[] | undefined;\n isLoading: boolean;\n\n error: Error | undefined;\n\n refetch: () => void;\n}\n\n/**\n * Get view-accessible markings for a user.\n * When `userId` is provided, fetches markings for that user.\n * When omitted, fetches markings for the current user.\n * @param options Options to control the query.\n */\nexport function useUserViewMarkings(\n { userId, enabled = true }: UseUserViewMarkingsOptions = {},\n): UseUserViewMarkingsResult {\n const { client } = React.useContext(OsdkContext2);\n\n const handleQuery = React.useCallback(async () => {\n const resolvedUserId = userId\n ?? (await Users.getCurrent(client)).id;\n return Users.getMarkings(client, resolvedUserId);\n }, [client, userId]);\n\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"user-view-markings\",\n });\n\n return {\n markingIds: query.data?.view,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,qBAAqB;AAC3C,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,YAAY,QAAQ,uBAAuB;AAgCpD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjC;EAAEC,MAAM;EAAEC,OAAO,GAAG;AAAiC,CAAC,GAAG,CAAC,CAAC,EAChC;EAC3B,MAAM;IAAEC;EAAO,CAAC,GAAGN,KAAK,CAACO,UAAU,CAACL,YAAY,CAAC;EAEjD,MAAMM,WAAW,GAAGR,KAAK,CAACS,WAAW,CAAC,YAAY;IAChD,MAAMC,cAAc,GAAGN,MAAM,IACxB,CAAC,MAAML,KAAK,CAACY,UAAU,CAACL,MAAM,CAAC,EAAEM,EAAE;IACxC,OAAOb,KAAK,CAACc,WAAW,CAACP,MAAM,EAAEI,cAAc,CAAC;EAClD,CAAC,EAAE,CAACJ,MAAM,EAAEF,MAAM,CAAC,CAAC;EAEpB,MAAMU,KAAK,GAAGb,gBAAgB,CAAC;IAC7Ba,KAAK,EAAEN,WAAW;IAClBH,OAAO;IACPU,SAAS,EAAE;EACb,CAAC,CAAC;EAEF,OAAO;IACLC,UAAU,EAAEF,KAAK,CAACG,IAAI,EAAEC,IAAI;IAC5BC,SAAS,EAAEL,KAAK,CAACK,SAAS;IAC1BC,KAAK,EAAEN,KAAK,CAACM,KAAK;IAClBC,OAAO,EAAEP,KAAK,CAACO;EACjB,CAAC;AACH","ignoreList":[]}
@@ -78,6 +78,7 @@ export function useOsdkAction(actionDef) {
78
78
  unknown: e
79
79
  });
80
80
  }
81
+ throw e;
81
82
  } finally {
82
83
  setPending(false);
83
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"useOsdkAction.js","names":["ActionValidationError","React","OsdkContext2","useOsdkAction","actionDef","observableClient","useContext","error","setError","useState","data","setData","isPending","setPending","isValidating","setValidating","validationResult","setValidationResult","abortControllerRef","useRef","applyAction","useCallback","hookArgs","current","abort","undefined","Array","isArray","updates","args","map","a","$optimisticUpdate","push","r","optimisticUpdate","ctx","update","e","actionValidation","unknown","validateAction","abortController","AbortController","result","signal","aborted","Error","name","useEffect","useMemo"],"sources":["useOsdkAction.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 ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n} from \"@osdk/client\";\nimport { ActionValidationError } from \"@osdk/client\";\nimport type {\n ActionSignatureFromDef,\n ObservableClient,\n} from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\ntype ApplyActionParams<Q extends ActionDefinition<any>> =\n & Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n & {\n [K in keyof ObservableClient.ApplyActionOptions as `$${K}`]:\n ObservableClient.ApplyActionOptions[K];\n };\n\nexport interface UseOsdkActionResult<Q extends ActionDefinition<any>> {\n applyAction: (\n args: ApplyActionParams<Q> | Array<ApplyActionParams<Q>>,\n ) => Promise<ActionEditResponse | undefined>;\n\n error:\n | undefined\n | Partial<{\n actionValidation: ActionValidationError;\n unknown: unknown;\n }>;\n data: ActionEditResponse | undefined;\n\n isPending: boolean;\n isValidating: boolean;\n\n /**\n * Validates the action with the provided arguments without executing it.\n * Calling this function again before the previous validation finishes will cancel\n * the first validation and start a new one.\n * @param args The action arguments to validate\n * @returns A promise that resolves to the validation response, or undefined if aborted\n */\n validateAction: (\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse | undefined>;\n\n validationResult?: ActionValidationResponse;\n}\n\nexport function useOsdkAction<Q extends ActionDefinition<any>>(\n actionDef: Q,\n): UseOsdkActionResult<Q> {\n const { observableClient } = React.useContext(OsdkContext2);\n const [error, setError] = React.useState<UseOsdkActionResult<Q>[\"error\"]>();\n const [data, setData] = React.useState<ActionEditResponse | undefined>();\n const [isPending, setPending] = React.useState(false);\n const [isValidating, setValidating] = React.useState(false);\n const [validationResult, setValidationResult] = React.useState<\n ActionValidationResponse | undefined\n >();\n const abortControllerRef = React.useRef<AbortController | null>(null);\n\n const applyAction = React.useCallback(async function applyAction(\n hookArgs: ApplyActionParams<Q> | Array<ApplyActionParams<Q>>,\n ) {\n try {\n // If validation is in progress, abort it\n if (isValidating && abortControllerRef.current) {\n abortControllerRef.current.abort();\n setValidating(false);\n }\n\n setPending(true);\n setError(undefined);\n\n if (Array.isArray(hookArgs)) {\n const updates: Array<\n ObservableClient.ApplyActionOptions[\"optimisticUpdate\"]\n > = [];\n const args = hookArgs.map(a => {\n const { $optimisticUpdate, ...args } = a;\n if ($optimisticUpdate) {\n updates.push($optimisticUpdate);\n }\n return args;\n });\n\n const r = await observableClient.applyAction(actionDef, args, {\n optimisticUpdate: (ctx) => {\n for (const update of updates) {\n update?.(ctx);\n }\n },\n });\n setData(r);\n return r;\n } else {\n const { $optimisticUpdate, ...args } = hookArgs;\n\n const r = await observableClient.applyAction(actionDef, args, {\n optimisticUpdate: $optimisticUpdate,\n });\n setData(r);\n return r;\n }\n } catch (e) {\n if (e instanceof ActionValidationError) {\n setError({\n actionValidation: e,\n });\n } else {\n setError({ unknown: e });\n }\n } finally {\n setPending(false);\n }\n }, [observableClient, actionDef, isValidating]);\n\n const validateAction = React.useCallback(async function validateAction(\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ): Promise<ActionValidationResponse | undefined> {\n try {\n // Check if action is being applied\n if (isPending) {\n return undefined;\n }\n\n // Abort any existing validation\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n\n // Create new AbortController\n const abortController = new AbortController();\n abortControllerRef.current = abortController;\n\n setValidating(true);\n setError(undefined);\n\n const result = await observableClient.validateAction(actionDef, args);\n\n // Check if aborted\n if (abortController.signal.aborted) {\n return undefined;\n }\n\n setValidationResult(result);\n return result;\n } catch (e) {\n // Check if it was aborted\n if (e instanceof Error && e.name === \"AbortError\") {\n return undefined;\n }\n\n if (e instanceof ActionValidationError) {\n setError({\n actionValidation: e,\n });\n } else {\n setError({ unknown: e });\n }\n throw e;\n } finally {\n setValidating(false);\n }\n }, [observableClient, actionDef, isPending]);\n\n // Cleanup on unmount\n React.useEffect(() => {\n return () => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n };\n }, []);\n\n return React.useMemo(() => ({\n applyAction,\n validateAction,\n error,\n data,\n isPending,\n isValidating,\n validationResult,\n }), [\n applyAction,\n validateAction,\n error,\n data,\n isPending,\n isValidating,\n validationResult,\n ]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,qBAAqB,QAAQ,cAAc;AAKpD,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,QAAQ,mBAAmB;AAuChD,OAAO,SAASC,aAAaA,CAC3BC,SAAY,EACY;EACxB,MAAM;IAAEC;EAAiB,CAAC,GAAGJ,KAAK,CAACK,UAA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","React","OsdkContext2","useOsdkAction","actionDef","observableClient","useContext","error","setError","useState","data","setData","isPending","setPending","isValidating","setValidating","validationResult","setValidationResult","abortControllerRef","useRef","applyAction","useCallback","hookArgs","current","abort","undefined","Array","isArray","updates","args","map","a","$optimisticUpdate","push","r","optimisticUpdate","ctx","update","e","actionValidation","unknown","validateAction","abortController","AbortController","result","signal","aborted","Error","name","useEffect","useMemo"],"sources":["useOsdkAction.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 ActionDefinition,\n ActionEditResponse,\n ActionValidationResponse,\n} from \"@osdk/client\";\nimport { ActionValidationError } from \"@osdk/client\";\nimport type {\n ActionSignatureFromDef,\n ObservableClient,\n} from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\ntype ApplyActionParams<Q extends ActionDefinition<any>> =\n & Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]\n & {\n [K in keyof ObservableClient.ApplyActionOptions as `$${K}`]:\n ObservableClient.ApplyActionOptions[K];\n };\n\nexport interface UseOsdkActionResult<Q extends ActionDefinition<any>> {\n applyAction: (\n args: ApplyActionParams<Q> | Array<ApplyActionParams<Q>>,\n ) => Promise<ActionEditResponse | undefined>;\n\n error:\n | undefined\n | Partial<{\n actionValidation: ActionValidationError;\n unknown: unknown;\n }>;\n data: ActionEditResponse | undefined;\n\n isPending: boolean;\n isValidating: boolean;\n\n /**\n * Validates the action with the provided arguments without executing it.\n * Calling this function again before the previous validation finishes will cancel\n * the first validation and start a new one.\n * @param args The action arguments to validate\n * @returns A promise that resolves to the validation response, or undefined if aborted\n */\n validateAction: (\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ) => Promise<ActionValidationResponse | undefined>;\n\n validationResult?: ActionValidationResponse;\n}\n\nexport function useOsdkAction<Q extends ActionDefinition<any>>(\n actionDef: Q,\n): UseOsdkActionResult<Q> {\n const { observableClient } = React.useContext(OsdkContext2);\n const [error, setError] = React.useState<UseOsdkActionResult<Q>[\"error\"]>();\n const [data, setData] = React.useState<ActionEditResponse | undefined>();\n const [isPending, setPending] = React.useState(false);\n const [isValidating, setValidating] = React.useState(false);\n const [validationResult, setValidationResult] = React.useState<\n ActionValidationResponse | undefined\n >();\n const abortControllerRef = React.useRef<AbortController | null>(null);\n\n const applyAction = React.useCallback(async function applyAction(\n hookArgs: ApplyActionParams<Q> | Array<ApplyActionParams<Q>>,\n ) {\n try {\n // If validation is in progress, abort it\n if (isValidating && abortControllerRef.current) {\n abortControllerRef.current.abort();\n setValidating(false);\n }\n\n setPending(true);\n setError(undefined);\n\n if (Array.isArray(hookArgs)) {\n const updates: Array<\n ObservableClient.ApplyActionOptions[\"optimisticUpdate\"]\n > = [];\n const args = hookArgs.map(a => {\n const { $optimisticUpdate, ...args } = a;\n if ($optimisticUpdate) {\n updates.push($optimisticUpdate);\n }\n return args;\n });\n\n const r = await observableClient.applyAction(actionDef, args, {\n optimisticUpdate: (ctx) => {\n for (const update of updates) {\n update?.(ctx);\n }\n },\n });\n setData(r);\n return r;\n } else {\n const { $optimisticUpdate, ...args } = hookArgs;\n\n const r = await observableClient.applyAction(actionDef, args, {\n optimisticUpdate: $optimisticUpdate,\n });\n setData(r);\n return r;\n }\n } catch (e) {\n if (e instanceof ActionValidationError) {\n setError({\n actionValidation: e,\n });\n } else {\n setError({ unknown: e });\n }\n throw e;\n } finally {\n setPending(false);\n }\n }, [observableClient, actionDef, isValidating]);\n\n const validateAction = React.useCallback(async function validateAction(\n args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0],\n ): Promise<ActionValidationResponse | undefined> {\n try {\n // Check if action is being applied\n if (isPending) {\n return undefined;\n }\n\n // Abort any existing validation\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n\n // Create new AbortController\n const abortController = new AbortController();\n abortControllerRef.current = abortController;\n\n setValidating(true);\n setError(undefined);\n\n const result = await observableClient.validateAction(actionDef, args);\n\n // Check if aborted\n if (abortController.signal.aborted) {\n return undefined;\n }\n\n setValidationResult(result);\n return result;\n } catch (e) {\n // Check if it was aborted\n if (e instanceof Error && e.name === \"AbortError\") {\n return undefined;\n }\n\n if (e instanceof ActionValidationError) {\n setError({\n actionValidation: e,\n });\n } else {\n setError({ unknown: e });\n }\n throw e;\n } finally {\n setValidating(false);\n }\n }, [observableClient, actionDef, isPending]);\n\n // Cleanup on unmount\n React.useEffect(() => {\n return () => {\n if (abortControllerRef.current) {\n abortControllerRef.current.abort();\n }\n };\n }, []);\n\n return React.useMemo(() => ({\n applyAction,\n validateAction,\n error,\n data,\n isPending,\n isValidating,\n validationResult,\n }), [\n applyAction,\n validateAction,\n error,\n data,\n isPending,\n isValidating,\n validationResult,\n ]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,qBAAqB,QAAQ,cAAc;AAKpD,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,QAAQ,mBAAmB;AAuChD,OAAO,SAASC,aAAaA,CAC3BC,SAAY,EACY;EACxB,MAAM;IAAEC;EAAiB,CAAC,GAAGJ,KAAK,CAACK,UAAU,CAACJ,YAAY,CAAC;EAC3D,MAAM,CAACK,KAAK,EAAEC,QAAQ,CAAC,GAAGP,KAAK,CAACQ,QAAQ,CAAkC,CAAC;EAC3E,MAAM,CAACC,IAAI,EAAEC,OAAO,CAAC,GAAGV,KAAK,CAACQ,QAAQ,CAAiC,CAAC;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,SAAS;MAClB;MAEAR,mBAAmB,CAAC2B,MAAM,CAAC;MAC3B,OAAOA,MAAM;IACf,CAAC,CAAC,OAAON,CAAC,EAAE;MACV;MACA,IAAIA,CAAC,YAAYS,KAAK,IAAIT,CAAC,CAACU,IAAI,KAAK,YAAY,EAAE;QACjD,OAAOvB,SAAS;MAClB;MAEA,IAAIa,CAAC,YAAYtC,qBAAqB,EAAE;QACtCQ,QAAQ,CAAC;UACP+B,gBAAgB,EAAED;QACpB,CAAC,CAAC;MACJ,CAAC,MAAM;QACL9B,QAAQ,CAAC;UAAEgC,OAAO,EAAEF;QAAE,CAAC,CAAC;MAC1B;MACA,MAAMA,CAAC;IACT,CAAC,SAAS;MACRvB,aAAa,CAAC,KAAK,CAAC;IACtB;EACF,CAAC,EAAE,CAACV,gBAAgB,EAAED,SAAS,EAAEQ,SAAS,CAAC,CAAC;;EAE5C;EACAX,KAAK,CAACgD,SAAS,CAAC,MAAM;IACpB,OAAO,MAAM;MACX,IAAI/B,kBAAkB,CAACK,OAAO,EAAE;QAC9BL,kBAAkB,CAACK,OAAO,CAACC,KAAK,CAAC,CAAC;MACpC;IACF,CAAC;EACH,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOvB,KAAK,CAACiD,OAAO,CAAC,OAAO;IAC1B9B,WAAW;IACXqB,cAAc;IACdlC,KAAK;IACLG,IAAI;IACJE,SAAS;IACTE,YAAY;IACZE;EACF,CAAC,CAAC,EAAE,CACFI,WAAW,EACXqB,cAAc,EACdlC,KAAK,EACLG,IAAI,EACJE,SAAS,EACTE,YAAY,EACZE,gBAAgB,CACjB,CAAC;AACJ","ignoreList":[]}
@@ -36,7 +36,7 @@ import { OsdkContext2 } from "./OsdkContext2.js";
36
36
  *
37
37
  * @param type The object type or interface definition
38
38
  * @param primaryKey The primary key of the object
39
- * @param options Options including $select and enabled
39
+ * @param options Options including $select, enabled, and $loadPropertySecurityMetadata
40
40
  */
41
41
 
42
42
  /*
@@ -58,6 +58,7 @@ export function useOsdkObject(...args) {
58
58
  // Extract enabled flag - 2nd param for instance signature, 3rd for type signature
59
59
  const enabled = isInstanceSignature ? typeof args[1] === "boolean" ? args[1] : true : optionsArg ? optionsArg.enabled ?? true : typeof args[2] === "boolean" ? args[2] : true;
60
60
  const selectArg = optionsArg?.$select;
61
+ const loadPropertySecurityMetadata = optionsArg?.$loadPropertySecurityMetadata;
61
62
  const mode = isInstanceSignature ? "offline" : undefined;
62
63
  const typeOrApiName = isInstanceSignature ? args[0].$objectType : args[0];
63
64
  const primaryKey = isInstanceSignature ? args[0].$primaryKey : args[1];
@@ -76,9 +77,12 @@ export function useOsdkObject(...args) {
76
77
  mode,
77
78
  ...(stableSelect ? {
78
79
  select: stableSelect
80
+ } : {}),
81
+ ...(loadPropertySecurityMetadata ? {
82
+ $loadPropertySecurityMetadata: loadPropertySecurityMetadata
79
83
  } : {})
80
84
  }, observer), `object ${apiNameString} ${primaryKey}`);
81
- }, [enabled, observableClient, typeOrApiName, apiNameString, primaryKey, mode, stableSelect]);
85
+ }, [enabled, observableClient, typeOrApiName, apiNameString, primaryKey, mode, stableSelect, loadPropertySecurityMetadata]);
82
86
  const payload = React.useSyncExternalStore(subscribe, getSnapShot);
83
87
  const forceUpdate = React.useCallback(() => {
84
88
  throw new Error("not implemented");
@@ -1 +1 @@
1
- {"version":3,"file":"useOsdkObject.js","names":["React","makeExternalStore","OsdkContext2","useOsdkObject","args","observableClient","useContext","isInstanceSignature","optionsArg","undefined","enabled","selectArg","$select","mode","typeOrApiName","$objectType","primaryKey","$primaryKey","apiNameString","apiName","stableSelect","useMemo","JSON","stringify","subscribe","getSnapShot","unsubscribe","observer","observeObject","select","payload","useSyncExternalStore","forceUpdate","useCallback","Error","error","status","object","isLoading","isOptimistic"],"sources":["useOsdkObject.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 ObjectOrInterfaceDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n} from \"@osdk/api\";\nimport type { ObserveObjectCallbackArgs } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkObjectResult<\n Q extends ObjectOrInterfaceDefinition,\n> {\n object: Osdk.Instance<Q> | undefined;\n isLoading: boolean;\n\n error: Error | undefined;\n\n /**\n * Refers to whether the object is optimistic or not.\n */\n isOptimistic: boolean;\n forceUpdate: () => void;\n}\n\n/**\n * @param obj an existing `Osdk.Instance` object to get metadata for.\n * @param enabled Enable or disable the query (defaults to true)\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n obj: Osdk.Instance<Q>,\n enabled?: boolean,\n): UseOsdkObjectResult<Q>;\n/**\n * Loads an object or interface instance by type and primary key.\n *\n * @param type The object type or interface definition\n * @param primaryKey The primary key of the object\n * @param enabled Enable or disable the query (defaults to true)\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n type: Q,\n primaryKey: PrimaryKeyType<Q>,\n enabled?: boolean,\n): UseOsdkObjectResult<Q>;\n/**\n * Loads an object or interface instance by type and primary key with options.\n *\n * @param type The object type or interface definition\n * @param primaryKey The primary key of the object\n * @param options Options including $select and enabled\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n type: Q,\n primaryKey: PrimaryKeyType<Q>,\n options?: { $select?: readonly PropertyKeys<Q>[]; enabled?: boolean },\n): UseOsdkObjectResult<Q>;\n/*\n Implementation of useOsdkObject\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n ...args:\n | [obj: Osdk.Instance<Q>, enabled?: boolean]\n | [type: Q, primaryKey: PrimaryKeyType<Q>, enabled?: boolean]\n | [\n type: Q,\n primaryKey: PrimaryKeyType<Q>,\n options?: { $select?: readonly PropertyKeys<Q>[]; enabled?: boolean },\n ]\n): UseOsdkObjectResult<Q> {\n const { observableClient } = React.useContext(OsdkContext2);\n\n // Check if first arg is an instance to discriminate signatures\n // TypeScript cannot narrow rest parameter unions with optional parameters,\n // so we must use type assertions after runtime discrimination\n const isInstanceSignature = \"$objectType\" in args[0];\n\n // Extract options object if provided (3rd arg is an object with $select or enabled)\n const optionsArg = !isInstanceSignature\n && args[2] != null\n && typeof args[2] === \"object\"\n ? args[2] as { $select?: readonly string[]; enabled?: boolean }\n : undefined;\n\n // Extract enabled flag - 2nd param for instance signature, 3rd for type signature\n const enabled = isInstanceSignature\n ? (typeof args[1] === \"boolean\" ? args[1] : true)\n : optionsArg\n ? (optionsArg.enabled ?? true)\n : (typeof args[2] === \"boolean\" ? args[2] : true);\n\n const selectArg = optionsArg?.$select;\n\n const mode = isInstanceSignature ? \"offline\" : undefined;\n\n const typeOrApiName = isInstanceSignature\n ? (args[0] as Osdk.Instance<Q>).$objectType\n : (args[0] as Q);\n\n const primaryKey = isInstanceSignature\n ? (args[0] as Osdk.Instance<Q>).$primaryKey\n : (args[1] as PrimaryKeyType<Q>);\n\n const apiNameString = typeof typeOrApiName === \"string\"\n ? typeOrApiName\n : typeOrApiName.apiName;\n\n const stableSelect = React.useMemo(\n () => selectArg,\n [JSON.stringify(selectArg)],\n );\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<ObserveObjectCallbackArgs<Q>>(\n () => ({ unsubscribe: () => {} }),\n `object ${apiNameString} ${primaryKey} [DISABLED]`,\n );\n }\n return makeExternalStore<ObserveObjectCallbackArgs<Q>>(\n (observer) =>\n observableClient.observeObject(\n typeOrApiName,\n primaryKey,\n {\n mode,\n ...(stableSelect ? { select: stableSelect } : {}),\n },\n observer,\n ),\n `object ${apiNameString} ${primaryKey}`,\n );\n },\n [\n enabled,\n observableClient,\n typeOrApiName,\n apiNameString,\n primaryKey,\n mode,\n stableSelect,\n ],\n );\n\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n const forceUpdate = React.useCallback(() => {\n throw new Error(\"not implemented\");\n }, []);\n\n return React.useMemo(() => {\n let error: Error | undefined;\n if (payload && \"error\" in payload && payload.error) {\n error = payload.error;\n } else if (payload?.status === \"error\") {\n error = new Error(\"Failed to load object\");\n }\n\n return {\n object: payload?.object as Osdk.Instance<Q> | undefined,\n isLoading: enabled\n ? (payload?.status === \"loading\" || payload?.status === \"init\"\n || !payload)\n : false,\n isOptimistic: !!payload?.isOptimistic,\n error,\n forceUpdate,\n };\n }, [payload, enabled, forceUpdate]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,YAAY,QAAQ,mBAAmB;;AAiBhD;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAG3B,GAAGC,IAOA,EACqB;EACxB,MAAM;IAAEC;EAAiB,CAAC,GAAGL,KAAK,CAACM,UAAU,CAACJ,YAAY,CAAC;;EAE3D;EACA;EACA;EACA,MAAMK,mBAAmB,GAAG,aAAa,IAAIH,IAAI,CAAC,CAAC,CAAC;;EAEpD;EACA,MAAMI,UAAU,GAAG,CAACD,mBAAmB,IAChCH,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,IACf,OAAOA,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,GAC9BA,IAA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IAAIO,YAAY,GAAG;QAAES,MAAM,EAAET;MAAa,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC,EACDO,QACF,CAAC,EACH,UAAUT,aAAa,IAAIF,UAAU,EACvC,CAAC;EACH,CAAC,EACD,CACEN,OAAO,EACPL,gBAAgB,EAChBS,aAAa,EACbI,aAAa,EACbF,UAAU,EACVH,IAAI,EACJO,YAAY,CAEhB,CAAC;EAED,MAAMU,OAAO,GAAG9B,KAAK,CAAC+B,oBAAoB,CAACP,SAAS,EAAEC,WAAW,CAAC;EAElE,MAAMO,WAAW,GAAGhC,KAAK,CAACiC,WAAW,CAAC,MAAM;IAC1C,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACpC,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOlC,KAAK,CAACqB,OAAO,CAAC,MAAM;IACzB,IAAIc,KAAwB;IAC5B,IAAIL,OAAO,IAAI,OAAO,IAAIA,OAAO,IAAIA,OAAO,CAACK,KAAK,EAAE;MAClDA,KAAK,GAAGL,OAAO,CAACK,KAAK;IACvB,CAAC,MAAM,IAAIL,OAAO,EAAEM,MAAM,KAAK,OAAO,EAAE;MACtCD,KAAK,GAAG,IAAID,KAAK,CAAC,uBAAuB,CAAC;IAC5C;IAEA,OAAO;MACLG,MAAM,EAAEP,OAAO,EAAEO,MAAsC;MACvDC,SAAS,EAAE5B,OAAO,GACboB,OAAO,EAAEM,MAAM,KAAK,SAAS,IAAIN,OAAO,EAAEM,MAAM,KAAK,MAAM,IACzD,CAACN,OAAO,GACX,KAAK;MACTS,YAAY,EAAE,CAAC,CAACT,OAAO,EAAES,YAAY;MACrCJ,KAAK;MACLH;IACF,CAAC;EACH,CAAC,EAAE,CAACF,OAAO,EAAEpB,OAAO,EAAEsB,WAAW,CAAC,CAAC;AACrC","ignoreList":[]}
1
+ {"version":3,"file":"useOsdkObject.js","names":["React","makeExternalStore","OsdkContext2","useOsdkObject","args","observableClient","useContext","isInstanceSignature","optionsArg","undefined","enabled","selectArg","$select","loadPropertySecurityMetadata","$loadPropertySecurityMetadata","mode","typeOrApiName","$objectType","primaryKey","$primaryKey","apiNameString","apiName","stableSelect","useMemo","JSON","stringify","subscribe","getSnapShot","unsubscribe","observer","observeObject","select","payload","useSyncExternalStore","forceUpdate","useCallback","Error","error","status","object","isLoading","isOptimistic"],"sources":["useOsdkObject.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 ObjectOrInterfaceDefinition,\n Osdk,\n PrimaryKeyType,\n PropertyKeys,\n} from \"@osdk/api\";\nimport type { ObserveObjectCallbackArgs } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkObjectResult<\n Q extends ObjectOrInterfaceDefinition,\n> {\n object: Osdk.Instance<Q> | undefined;\n isLoading: boolean;\n\n error: Error | undefined;\n\n /**\n * Refers to whether the object is optimistic or not.\n */\n isOptimistic: boolean;\n forceUpdate: () => void;\n}\n\n/**\n * @param obj an existing `Osdk.Instance` object to get metadata for.\n * @param enabled Enable or disable the query (defaults to true)\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n obj: Osdk.Instance<Q>,\n enabled?: boolean,\n): UseOsdkObjectResult<Q>;\n/**\n * Loads an object or interface instance by type and primary key.\n *\n * @param type The object type or interface definition\n * @param primaryKey The primary key of the object\n * @param enabled Enable or disable the query (defaults to true)\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n type: Q,\n primaryKey: PrimaryKeyType<Q>,\n enabled?: boolean,\n): UseOsdkObjectResult<Q>;\n/**\n * Loads an object or interface instance by type and primary key with options.\n *\n * @param type The object type or interface definition\n * @param primaryKey The primary key of the object\n * @param options Options including $select, enabled, and $loadPropertySecurityMetadata\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n type: Q,\n primaryKey: PrimaryKeyType<Q>,\n options?: {\n $select?: readonly PropertyKeys<Q>[];\n enabled?: boolean;\n $loadPropertySecurityMetadata?: boolean;\n },\n): UseOsdkObjectResult<Q>;\n/*\n Implementation of useOsdkObject\n */\nexport function useOsdkObject<\n Q extends ObjectOrInterfaceDefinition,\n>(\n ...args:\n | [obj: Osdk.Instance<Q>, enabled?: boolean]\n | [type: Q, primaryKey: PrimaryKeyType<Q>, enabled?: boolean]\n | [\n type: Q,\n primaryKey: PrimaryKeyType<Q>,\n options?: {\n $select?: readonly PropertyKeys<Q>[];\n enabled?: boolean;\n $loadPropertySecurityMetadata?: boolean;\n },\n ]\n): UseOsdkObjectResult<Q> {\n const { observableClient } = React.useContext(OsdkContext2);\n\n // Check if first arg is an instance to discriminate signatures\n // TypeScript cannot narrow rest parameter unions with optional parameters,\n // so we must use type assertions after runtime discrimination\n const isInstanceSignature = \"$objectType\" in args[0];\n\n // Extract options object if provided (3rd arg is an object with $select or enabled)\n const optionsArg = !isInstanceSignature\n && args[2] != null\n && typeof args[2] === \"object\"\n ? args[2] as {\n $select?: readonly string[];\n enabled?: boolean;\n $loadPropertySecurityMetadata?: boolean;\n }\n : undefined;\n\n // Extract enabled flag - 2nd param for instance signature, 3rd for type signature\n const enabled = isInstanceSignature\n ? (typeof args[1] === \"boolean\" ? args[1] : true)\n : optionsArg\n ? (optionsArg.enabled ?? true)\n : (typeof args[2] === \"boolean\" ? args[2] : true);\n\n const selectArg = optionsArg?.$select;\n const loadPropertySecurityMetadata = optionsArg\n ?.$loadPropertySecurityMetadata;\n\n const mode = isInstanceSignature ? \"offline\" : undefined;\n\n const typeOrApiName = isInstanceSignature\n ? (args[0] as Osdk.Instance<Q>).$objectType\n : (args[0] as Q);\n\n const primaryKey = isInstanceSignature\n ? (args[0] as Osdk.Instance<Q>).$primaryKey\n : (args[1] as PrimaryKeyType<Q>);\n\n const apiNameString = typeof typeOrApiName === \"string\"\n ? typeOrApiName\n : typeOrApiName.apiName;\n\n const stableSelect = React.useMemo(\n () => selectArg,\n [JSON.stringify(selectArg)],\n );\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<ObserveObjectCallbackArgs<Q>>(\n () => ({ unsubscribe: () => {} }),\n `object ${apiNameString} ${primaryKey} [DISABLED]`,\n );\n }\n return makeExternalStore<ObserveObjectCallbackArgs<Q>>(\n (observer) =>\n observableClient.observeObject(\n typeOrApiName,\n primaryKey,\n {\n mode,\n ...(stableSelect ? { select: stableSelect } : {}),\n ...(loadPropertySecurityMetadata\n ? {\n $loadPropertySecurityMetadata: loadPropertySecurityMetadata,\n }\n : {}),\n },\n observer,\n ),\n `object ${apiNameString} ${primaryKey}`,\n );\n },\n [\n enabled,\n observableClient,\n typeOrApiName,\n apiNameString,\n primaryKey,\n mode,\n stableSelect,\n loadPropertySecurityMetadata,\n ],\n );\n\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n const forceUpdate = React.useCallback(() => {\n throw new Error(\"not implemented\");\n }, []);\n\n return React.useMemo(() => {\n let error: Error | undefined;\n if (payload && \"error\" in payload && payload.error) {\n error = payload.error;\n } else if (payload?.status === \"error\") {\n error = new Error(\"Failed to load object\");\n }\n\n return {\n object: payload?.object as Osdk.Instance<Q> | undefined,\n isLoading: enabled\n ? (payload?.status === \"loading\" || payload?.status === \"init\"\n || !payload)\n : false,\n isOptimistic: !!payload?.isOptimistic,\n error,\n forceUpdate,\n };\n }, [payload, enabled, forceUpdate]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA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AE,EAAE,CAAC;EAEN,OAAOpC,KAAK,CAACuB,OAAO,CAAC,MAAM;IACzB,IAAIc,KAAwB;IAC5B,IAAIL,OAAO,IAAI,OAAO,IAAIA,OAAO,IAAIA,OAAO,CAACK,KAAK,EAAE;MAClDA,KAAK,GAAGL,OAAO,CAACK,KAAK;IACvB,CAAC,MAAM,IAAIL,OAAO,EAAEM,MAAM,KAAK,OAAO,EAAE;MACtCD,KAAK,GAAG,IAAID,KAAK,CAAC,uBAAuB,CAAC;IAC5C;IAEA,OAAO;MACLG,MAAM,EAAEP,OAAO,EAAEO,MAAsC;MACvDC,SAAS,EAAE9B,OAAO,GACbsB,OAAO,EAAEM,MAAM,KAAK,SAAS,IAAIN,OAAO,EAAEM,MAAM,KAAK,MAAM,IACzD,CAACN,OAAO,GACX,KAAK;MACTS,YAAY,EAAE,CAAC,CAACT,OAAO,EAAES,YAAY;MACrCJ,KAAK;MACLH;IACF,CAAC;EACH,CAAC,EAAE,CAACF,OAAO,EAAEtB,OAAO,EAAEwB,WAAW,CAAC,CAAC;AACrC","ignoreList":[]}
@@ -34,7 +34,8 @@ export function useOsdkObjects(type, options) {
34
34
  autoFetchMore,
35
35
  intersectWith,
36
36
  pivotTo,
37
- $select
37
+ $select,
38
+ $loadPropertySecurityMetadata
38
39
  } = options ?? {};
39
40
  const canonWhere = observableClient.canonicalizeWhereClause(where ?? EMPTY_WHERE);
40
41
  const stableCanonWhere = React.useMemo(() => canonWhere, [JSON.stringify(canonWhere)]);
@@ -70,9 +71,12 @@ export function useOsdkObjects(type, options) {
70
71
  } : {}),
71
72
  ...(stableSelect ? {
72
73
  select: stableSelect
74
+ } : {}),
75
+ ...($loadPropertySecurityMetadata ? {
76
+ $loadPropertySecurityMetadata
73
77
  } : {})
74
78
  }, observer), process.env.NODE_ENV !== "production" ? `list ${type.apiName} ${stableRids ? `[${stableRids.length} rids]` : ""} ${JSON.stringify(stableCanonWhere)}` : void 0);
75
- }, [enabled, observableClient, type.apiName, type.type, stableRids, stableCanonWhere, dedupeIntervalMs, pageSize, stableOrderBy, streamUpdates, stableWithProperties, autoFetchMore, stableIntersectWith, pivotTo, stableSelect]);
79
+ }, [enabled, observableClient, type.apiName, type.type, stableRids, stableCanonWhere, dedupeIntervalMs, pageSize, stableOrderBy, streamUpdates, stableWithProperties, autoFetchMore, stableIntersectWith, pivotTo, stableSelect, $loadPropertySecurityMetadata]);
76
80
  const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);
77
81
  return React.useMemo(() => {
78
82
  let error;
@@ -1 +1 @@
1
- {"version":3,"file":"useOsdkObjects.js","names":["React","makeExternalStore","OsdkContext2","EMPTY_WHERE","useOsdkObjects","type","options","observableClient","useContext","pageSize","dedupeIntervalMs","withProperties","enabled","rids","where","orderBy","streamUpdates","autoFetchMore","intersectWith","pivotTo","$select","canonWhere","canonicalizeWhereClause","stableCanonWhere","useMemo","JSON","stringify","stableRids","stableWithProperties","stableIntersectWith","stableOrderBy","stableSelect","subscribe","getSnapShot","unsubscribe","process","env","NODE_ENV","apiName","observer","observeList","dedupeInterval","select","length","listPayload","useSyncExternalStore","error","status","Error","fetchMore","hasMore","undefined","data","resolvedList","isLoading","isOptimistic","totalCount"],"sources":["useOsdkObjects.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DerivedProperty,\n LinkedType,\n LinkNames,\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { ObserveObjectsCallbackArgs } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkObjectsOptions<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Fetch objects by their RIDs (Resource Identifiers).\n * When provided, starts with a static objectset containing these RIDs.\n * Can be combined with `where` to filter the RID set, and with `orderBy` to sort results.\n *\n * @example\n * // Fetch specific objects by RID\n * useOsdkObjects(Employee, { rids: ['ri.foo.123', 'ri.foo.456'] })\n *\n * @example\n * // Fetch specific objects by RID, filtered by status\n * useOsdkObjects(Employee, {\n * rids: ['ri.foo.123', 'ri.foo.456', 'ri.foo.789'],\n * where: { status: 'active' }\n * })\n */\n rids?: readonly string[];\n\n /**\n * Standard OSDK Where clause with RDP support.\n * When used with `rids`, filters the RID set.\n * When used alone, filters all objects of the type.\n */\n where?: WhereClause<T, RDPs>;\n\n /**\n * Sort results by one or more properties.\n */\n orderBy?: {\n [K in PropertyKeys<T>]?: \"asc\" | \"desc\";\n };\n\n /**\n * The preferred page size for the list.\n */\n pageSize?: number;\n\n /**\n * Define derived properties (RDPs) to be computed server-side and attached to each object.\n * These properties will be available on the returned objects alongside their regular properties.\n */\n withProperties?: { [K in keyof RDPs]: DerivedProperty.Creator<T, RDPs[K]> };\n\n /**\n * The number of milliseconds to wait after the last observed list change.\n *\n * Two uses of `useOsdkObjects` with the same parameters will only trigger one\n * network request if the second is within `dedupeIntervalMs`.\n */\n dedupeIntervalMs?: number;\n\n /**\n * Enable or disable the query.\n *\n * When `false`, the query will not automatically execute. It will still\n * return any cached data, but will not fetch from the server.\n *\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Intersect the results with additional object sets.\n * Each element defines a where clause for an object set to intersect with.\n * The final result will only include objects that match ALL conditions.\n */\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n\n /**\n * Pivot to related objects through a link.\n * This changes the return type from T to the linked object type.\n */\n pivotTo?: LinkNames<T>;\n\n /**\n * Causes the list to automatically fetch more as soon as the previous page\n * has been loaded. If a number is provided, it will continue to automatically\n * fetch more until the list is at least that long.\n *\n * - `true`: Fetch all available pages automatically\n * - `number`: Fetch pages until at least this many items are loaded\n * - `undefined` (default): Only fetch the first page, user must call fetchMore()\n */\n autoFetchMore?: boolean | number;\n\n streamUpdates?: boolean;\n\n /**\n * Restrict which properties are returned for each object.\n * When provided, only the specified properties will be fetched,\n * reducing payload sizes for list views.\n *\n * @example\n * // Only fetch name and status properties\n * useOsdkObjects(Employee, { $select: [\"name\", \"status\"] })\n */\n $select?: readonly PropertyKeys<T>[];\n}\n\nexport interface UseOsdkListResult<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n EXTRA_OPTIONS extends never | \"$rid\" = never,\n> {\n /**\n * Function to fetch more pages (undefined if no more pages)\n */\n fetchMore: (() => Promise<void>) | undefined;\n\n /**\n * The fetched data with derived properties\n */\n data:\n | Osdk.Instance<\n T,\n \"$allBaseProperties\" | EXTRA_OPTIONS,\n PropertyKeys<T>,\n RDPs\n >[]\n | undefined;\n\n /**\n * Whether data is currently being loaded\n */\n isLoading: boolean;\n\n /**\n * Any error that occurred during fetching\n */\n error: Error | undefined;\n\n /**\n * Refers to whether the ordered list of objects (only considering the $primaryKey)\n * is optimistic or not.\n *\n * If you need to know if the contents of the list are optimistic you can\n * do that on a per object basis with useOsdkObject\n */\n isOptimistic: boolean;\n\n /**\n * The total count of objects matching the query (if available from the API)\n */\n totalCount?: string;\n}\n\nconst EMPTY_WHERE = {};\n\ndeclare const process: {\n env: {\n NODE_ENV: \"development\" | \"production\";\n };\n};\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n L extends LinkNames<Q>,\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q> & { pivotTo: L; rids: readonly string[] },\n): UseOsdkListResult<LinkedType<Q, L>, {}, \"$rid\">;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n L extends LinkNames<Q>,\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q> & { pivotTo: L },\n): UseOsdkListResult<LinkedType<Q, L>>;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q, RDPs> & { rids: readonly string[] },\n): UseOsdkListResult<Q, RDPs, \"$rid\">;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options?: UseOsdkObjectsOptions<Q, RDPs>,\n): UseOsdkListResult<Q, RDPs>;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options?: UseOsdkObjectsOptions<Q, RDPs>,\n):\n | UseOsdkListResult<Q, RDPs>\n | UseOsdkListResult<Q, RDPs, \"$rid\">\n | UseOsdkListResult<LinkedType<Q, LinkNames<Q>>>\n | UseOsdkListResult<LinkedType<Q, LinkNames<Q>>, {}, \"$rid\">\n{\n const { observableClient } = React.useContext(OsdkContext2);\n\n const {\n pageSize,\n dedupeIntervalMs,\n withProperties,\n enabled = true,\n rids,\n where,\n orderBy,\n streamUpdates,\n autoFetchMore,\n intersectWith,\n pivotTo,\n $select,\n } = options ?? {};\n\n const canonWhere = observableClient.canonicalizeWhereClause<\n Q,\n RDPs\n >(where ?? EMPTY_WHERE);\n\n const stableCanonWhere = React.useMemo(\n () => canonWhere,\n [JSON.stringify(canonWhere)],\n );\n\n const stableRids = React.useMemo(\n () => rids,\n [JSON.stringify(rids)],\n );\n\n const stableWithProperties = React.useMemo(\n () => withProperties,\n [JSON.stringify(withProperties)],\n );\n\n const stableIntersectWith = React.useMemo(\n () => intersectWith,\n [JSON.stringify(intersectWith)],\n );\n\n const stableOrderBy = React.useMemo(\n () => orderBy,\n [JSON.stringify(orderBy)],\n );\n\n const stableSelect = React.useMemo(\n () => $select,\n [JSON.stringify($select)],\n );\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<\n ObserveObjectsCallbackArgs<Q, RDPs>\n >(\n () => ({ unsubscribe: () => {} }),\n process.env.NODE_ENV !== \"production\"\n ? `list ${type.apiName} [DISABLED]`\n : void 0,\n );\n }\n\n return makeExternalStore<\n ObserveObjectsCallbackArgs<Q, RDPs>\n >(\n (observer) =>\n observableClient.observeList({\n type,\n rids: stableRids,\n where: stableCanonWhere,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n pageSize,\n orderBy: stableOrderBy,\n streamUpdates,\n withProperties: stableWithProperties,\n autoFetchMore,\n ...(stableIntersectWith\n ? { intersectWith: stableIntersectWith }\n : {}),\n ...(pivotTo ? { pivotTo } : {}),\n ...(stableSelect ? { select: stableSelect } : {}),\n }, observer),\n process.env.NODE_ENV !== \"production\"\n ? `list ${type.apiName} ${\n stableRids ? `[${stableRids.length} rids]` : \"\"\n } ${JSON.stringify(stableCanonWhere)}`\n : void 0,\n );\n },\n [\n enabled,\n observableClient,\n type.apiName,\n type.type,\n stableRids,\n stableCanonWhere,\n dedupeIntervalMs,\n pageSize,\n stableOrderBy,\n streamUpdates,\n stableWithProperties,\n autoFetchMore,\n stableIntersectWith,\n pivotTo,\n stableSelect,\n ],\n );\n\n const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n return React.useMemo(() => {\n let error: Error | undefined;\n if (listPayload && \"error\" in listPayload && listPayload.error) {\n error = listPayload.error;\n } else if (listPayload?.status === \"error\") {\n error = new Error(\"Failed to load objects\");\n }\n\n return {\n fetchMore: listPayload?.hasMore ? listPayload.fetchMore : undefined,\n error,\n data: listPayload?.resolvedList,\n isLoading: enabled\n ? (listPayload?.status === \"loading\" || listPayload?.status === \"init\"\n || !listPayload)\n : false,\n isOptimistic: listPayload?.isOptimistic ?? false,\n totalCount: listPayload?.totalCount,\n };\n }, [listPayload, enabled]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,YAAY,QAAQ,mBAAmB;AA0JhD,MAAMC,WAAW,GAAG,CAAC,CAAC;AAwCtB,OAAO,SAASC,cAAcA,CAI5BC,IAAO,EACPC,OAAwC,EAM1C;EACE,MAAM;IAAEC;EAAiB,CAAC,GAAGP,KAAK,CAACQ,UAAU,CAACN,YAAY,CAAC;EAE3D,MAAM;IACJO,QAAQ;IACRC,gBAAgB;IAChBC,cAAc;IACdC,OAAO,GAAG,IAAI;IACdC,IAAI;IACJC,KAAK;IACLC,OAAO;IACPC,aAAa;IACbC,aAAa;IACbC,aAAa;IACbC,OAAO;IACPC;EACF,CAAC,GAAGd,OAAO,IAAI,CAAC,CAAC;EAEjB,MAAMe,UAAU,GAAGd,gBAAgB,CAACe,uBAAuB,CAGzDR,KAAK,IAAIX,WAAW,CAAC;EAEvB,MAAMoB,gBAAgB,GAAGvB,KAAK,CAACwB,OAAO,CACpC,MAAMH,UAAU,EAChB,CAACI,IAAI,CAACC,SAAS,CAACL,UAAU,CAAC,CAC7B,CAAC;EAED,MAAMM,UAAU,GAAG3B,KAAK,CAACwB,OAAO,CAC9B,MAAMX,IAAI,EACV,CAACY,IAAI,CAACC,SAAS,CAACb,IAAI,CAAC,CACvB,CAAC;EAED,MAAMe,oBAAoB,GAAG5B,KAAK,CAACwB,OAAO,CACxC,MAAMb,cAAc,EACpB,CAACc,IAAI,CAACC,SAAS,CAACf,cAAc,CAAC,CACjC,CAAC;EAED,MAAMkB,mBAAmB,GAAG7B,KAAK,CAACwB,OAAO,CACvC,MAAMN,aAAa,EACnB,CAACO,IAAI,CAACC,SAAS,CAACR,aAAa,CAAC,CAChC,CAAC;EAED,MAAM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ects.js","names":["React","makeExternalStore","OsdkContext2","EMPTY_WHERE","useOsdkObjects","type","options","observableClient","useContext","pageSize","dedupeIntervalMs","withProperties","enabled","rids","where","orderBy","streamUpdates","autoFetchMore","intersectWith","pivotTo","$select","$loadPropertySecurityMetadata","canonWhere","canonicalizeWhereClause","stableCanonWhere","useMemo","JSON","stringify","stableRids","stableWithProperties","stableIntersectWith","stableOrderBy","stableSelect","subscribe","getSnapShot","unsubscribe","process","env","NODE_ENV","apiName","observer","observeList","dedupeInterval","select","length","listPayload","useSyncExternalStore","error","status","Error","fetchMore","hasMore","undefined","data","resolvedList","isLoading","isOptimistic","totalCount"],"sources":["useOsdkObjects.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DerivedProperty,\n LinkedType,\n LinkNames,\n ObjectOrInterfaceDefinition,\n Osdk,\n PropertyKeys,\n SimplePropertyDef,\n WhereClause,\n} from \"@osdk/api\";\nimport type { ObserveObjectsCallbackArgs } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkObjectsOptions<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Fetch objects by their RIDs (Resource Identifiers).\n * When provided, starts with a static objectset containing these RIDs.\n * Can be combined with `where` to filter the RID set, and with `orderBy` to sort results.\n *\n * @example\n * // Fetch specific objects by RID\n * useOsdkObjects(Employee, { rids: ['ri.foo.123', 'ri.foo.456'] })\n *\n * @example\n * // Fetch specific objects by RID, filtered by status\n * useOsdkObjects(Employee, {\n * rids: ['ri.foo.123', 'ri.foo.456', 'ri.foo.789'],\n * where: { status: 'active' }\n * })\n */\n rids?: readonly string[];\n\n /**\n * Standard OSDK Where clause with RDP support.\n * When used with `rids`, filters the RID set.\n * When used alone, filters all objects of the type.\n */\n where?: WhereClause<T, RDPs>;\n\n /**\n * Sort results by one or more properties.\n */\n orderBy?: {\n [K in PropertyKeys<T>]?: \"asc\" | \"desc\";\n };\n\n /**\n * The preferred page size for the list.\n */\n pageSize?: number;\n\n /**\n * Define derived properties (RDPs) to be computed server-side and attached to each object.\n * These properties will be available on the returned objects alongside their regular properties.\n */\n withProperties?: { [K in keyof RDPs]: DerivedProperty.Creator<T, RDPs[K]> };\n\n /**\n * The number of milliseconds to wait after the last observed list change.\n *\n * Two uses of `useOsdkObjects` with the same parameters will only trigger one\n * network request if the second is within `dedupeIntervalMs`.\n */\n dedupeIntervalMs?: number;\n\n /**\n * Enable or disable the query.\n *\n * When `false`, the query will not automatically execute. It will still\n * return any cached data, but will not fetch from the server.\n *\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Intersect the results with additional object sets.\n * Each element defines a where clause for an object set to intersect with.\n * The final result will only include objects that match ALL conditions.\n */\n intersectWith?: Array<{\n where: WhereClause<T, RDPs>;\n }>;\n\n /**\n * Pivot to related objects through a link.\n * This changes the return type from T to the linked object type.\n */\n pivotTo?: LinkNames<T>;\n\n /**\n * Causes the list to automatically fetch more as soon as the previous page\n * has been loaded. If a number is provided, it will continue to automatically\n * fetch more until the list is at least that long.\n *\n * - `true`: Fetch all available pages automatically\n * - `number`: Fetch pages until at least this many items are loaded\n * - `undefined` (default): Only fetch the first page, user must call fetchMore()\n */\n autoFetchMore?: boolean | number;\n\n streamUpdates?: boolean;\n\n /**\n * Restrict which properties are returned for each object.\n * When provided, only the specified properties will be fetched,\n * reducing payload sizes for list views.\n *\n * @example\n * // Only fetch name and status properties\n * useOsdkObjects(Employee, { $select: [\"name\", \"status\"] })\n */\n $select?: readonly PropertyKeys<T>[];\n\n /**\n * When true, loads per-property security metadata (marking requirements)\n * alongside each object. The returned objects will have `$propertySecurities`\n * populated with conjunctive/disjunctive marking requirements per property.\n */\n $loadPropertySecurityMetadata?: boolean;\n}\n\nexport interface UseOsdkListResult<\n T extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n EXTRA_OPTIONS extends never | \"$rid\" = never,\n> {\n /**\n * Function to fetch more pages (undefined if no more pages)\n */\n fetchMore: (() => Promise<void>) | undefined;\n\n /**\n * The fetched data with derived properties\n */\n data:\n | Osdk.Instance<\n T,\n \"$allBaseProperties\" | EXTRA_OPTIONS,\n PropertyKeys<T>,\n RDPs\n >[]\n | undefined;\n\n /**\n * Whether data is currently being loaded\n */\n isLoading: boolean;\n\n /**\n * Any error that occurred during fetching\n */\n error: Error | undefined;\n\n /**\n * Refers to whether the ordered list of objects (only considering the $primaryKey)\n * is optimistic or not.\n *\n * If you need to know if the contents of the list are optimistic you can\n * do that on a per object basis with useOsdkObject\n */\n isOptimistic: boolean;\n\n /**\n * The total count of objects matching the query (if available from the API)\n */\n totalCount?: string;\n}\n\nconst EMPTY_WHERE = {};\n\ndeclare const process: {\n env: {\n NODE_ENV: \"development\" | \"production\";\n };\n};\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n L extends LinkNames<Q>,\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q> & { pivotTo: L; rids: readonly string[] },\n): UseOsdkListResult<LinkedType<Q, L>, {}, \"$rid\">;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n L extends LinkNames<Q>,\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q> & { pivotTo: L },\n): UseOsdkListResult<LinkedType<Q, L>>;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options: UseOsdkObjectsOptions<Q, RDPs> & { rids: readonly string[] },\n): UseOsdkListResult<Q, RDPs, \"$rid\">;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options?: UseOsdkObjectsOptions<Q, RDPs>,\n): UseOsdkListResult<Q, RDPs>;\n\nexport function useOsdkObjects<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n>(\n type: Q,\n options?: UseOsdkObjectsOptions<Q, RDPs>,\n):\n | UseOsdkListResult<Q, RDPs>\n | UseOsdkListResult<Q, RDPs, \"$rid\">\n | UseOsdkListResult<LinkedType<Q, LinkNames<Q>>>\n | UseOsdkListResult<LinkedType<Q, LinkNames<Q>>, {}, \"$rid\">\n{\n const { observableClient } = React.useContext(OsdkContext2);\n\n const {\n pageSize,\n dedupeIntervalMs,\n withProperties,\n enabled = true,\n rids,\n where,\n orderBy,\n streamUpdates,\n autoFetchMore,\n intersectWith,\n pivotTo,\n $select,\n $loadPropertySecurityMetadata,\n } = options ?? {};\n\n const canonWhere = observableClient.canonicalizeWhereClause<\n Q,\n RDPs\n >(where ?? EMPTY_WHERE);\n\n const stableCanonWhere = React.useMemo(\n () => canonWhere,\n [JSON.stringify(canonWhere)],\n );\n\n const stableRids = React.useMemo(\n () => rids,\n [JSON.stringify(rids)],\n );\n\n const stableWithProperties = React.useMemo(\n () => withProperties,\n [JSON.stringify(withProperties)],\n );\n\n const stableIntersectWith = React.useMemo(\n () => intersectWith,\n [JSON.stringify(intersectWith)],\n );\n\n const stableOrderBy = React.useMemo(\n () => orderBy,\n [JSON.stringify(orderBy)],\n );\n\n const stableSelect = React.useMemo(\n () => $select,\n [JSON.stringify($select)],\n );\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<\n ObserveObjectsCallbackArgs<Q, RDPs>\n >(\n () => ({ unsubscribe: () => {} }),\n process.env.NODE_ENV !== \"production\"\n ? `list ${type.apiName} [DISABLED]`\n : void 0,\n );\n }\n\n return makeExternalStore<\n ObserveObjectsCallbackArgs<Q, RDPs>\n >(\n (observer) =>\n observableClient.observeList({\n type,\n rids: stableRids,\n where: stableCanonWhere,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n pageSize,\n orderBy: stableOrderBy,\n streamUpdates,\n withProperties: stableWithProperties,\n autoFetchMore,\n ...(stableIntersectWith\n ? { intersectWith: stableIntersectWith }\n : {}),\n ...(pivotTo ? { pivotTo } : {}),\n ...(stableSelect ? { select: stableSelect } : {}),\n ...($loadPropertySecurityMetadata\n ? { $loadPropertySecurityMetadata }\n : {}),\n }, observer),\n process.env.NODE_ENV !== \"production\"\n ? `list ${type.apiName} ${\n stableRids ? `[${stableRids.length} rids]` : \"\"\n } ${JSON.stringify(stableCanonWhere)}`\n : void 0,\n );\n },\n [\n enabled,\n observableClient,\n type.apiName,\n type.type,\n stableRids,\n stableCanonWhere,\n dedupeIntervalMs,\n pageSize,\n stableOrderBy,\n streamUpdates,\n stableWithProperties,\n autoFetchMore,\n stableIntersectWith,\n pivotTo,\n stableSelect,\n $loadPropertySecurityMetadata,\n ],\n );\n\n const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n return React.useMemo(() => {\n let error: Error | undefined;\n if (listPayload && \"error\" in listPayload && listPayload.error) {\n error = listPayload.error;\n } else if (listPayload?.status === \"error\") {\n error = new Error(\"Failed to load objects\");\n }\n\n return {\n fetchMore: listPayload?.hasMore ? listPayload.fetchMore : undefined,\n error,\n data: listPayload?.resolvedList,\n isLoading: enabled\n ? (listPayload?.status === \"loading\" || listPayload?.status === \"init\"\n || !listPayload)\n : false,\n isOptimistic: listPayload?.isOptimistic ?? false,\n totalCount: listPayload?.totalCount,\n };\n }, [listPayload, enabled]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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*/
16
16
 
17
+ export { useCbacBanner } from "../../new/platform-apis/admin/useCbacBanner.js";
18
+ export { useCbacMarkingRestrictions } from "../../new/platform-apis/admin/useCbacMarkingRestrictions.js";
17
19
  export { useCurrentFoundryUser } from "../../new/platform-apis/admin/useCurrentFoundryUser.js";
18
20
  export { useFoundryUser } from "../../new/platform-apis/admin/useFoundryUser.js";
19
21
  export { useFoundryUsersList } from "../../new/platform-apis/admin/useFoundryUsersList.js";
22
+ export { useMarkingCategories } from "../../new/platform-apis/admin/useMarkingCategories.js";
23
+ export { useMarkings } from "../../new/platform-apis/admin/useMarkings.js";
24
+ export { useUserViewMarkings } from "../../new/platform-apis/admin/useUserMarkings.js";
20
25
  //# sourceMappingURL=admin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin.js","names":["useCurrentFoundryUser","useFoundryUser","useFoundryUsersList"],"sources":["admin.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\nexport { useCurrentFoundryUser } from \"../../new/platform-apis/admin/useCurrentFoundryUser.js\";\nexport { useFoundryUser } from \"../../new/platform-apis/admin/useFoundryUser.js\";\nexport { useFoundryUsersList } from \"../../new/platform-apis/admin/useFoundryUsersList.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,qBAAqB,QAAQ,wDAAwD;AAC9F,SAASC,cAAc,QAAQ,iDAAiD;AAChF,SAASC,mBAAmB,QAAQ,sDAAsD","ignoreList":[]}
1
+ {"version":3,"file":"admin.js","names":["useCbacBanner","useCbacMarkingRestrictions","useCurrentFoundryUser","useFoundryUser","useFoundryUsersList","useMarkingCategories","useMarkings","useUserViewMarkings"],"sources":["admin.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\nexport { useCbacBanner } from \"../../new/platform-apis/admin/useCbacBanner.js\";\nexport type {\n CbacBannerData,\n UseCbacBannerOptions,\n UseCbacBannerResult,\n} from \"../../new/platform-apis/admin/useCbacBanner.js\";\nexport { useCbacMarkingRestrictions } from \"../../new/platform-apis/admin/useCbacMarkingRestrictions.js\";\nexport type {\n CbacMarkingRestrictionsData,\n UseCbacMarkingRestrictionsOptions,\n UseCbacMarkingRestrictionsResult,\n} from \"../../new/platform-apis/admin/useCbacMarkingRestrictions.js\";\nexport { useCurrentFoundryUser } from \"../../new/platform-apis/admin/useCurrentFoundryUser.js\";\nexport { useFoundryUser } from \"../../new/platform-apis/admin/useFoundryUser.js\";\nexport { useFoundryUsersList } from \"../../new/platform-apis/admin/useFoundryUsersList.js\";\nexport { useMarkingCategories } from \"../../new/platform-apis/admin/useMarkingCategories.js\";\nexport { useMarkings } from \"../../new/platform-apis/admin/useMarkings.js\";\nexport { useUserViewMarkings } from \"../../new/platform-apis/admin/useUserMarkings.js\";\nexport type {\n UseUserViewMarkingsOptions,\n UseUserViewMarkingsResult,\n} from \"../../new/platform-apis/admin/useUserMarkings.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,aAAa,QAAQ,gDAAgD;AAM9E,SAASC,0BAA0B,QAAQ,6DAA6D;AAMxG,SAASC,qBAAqB,QAAQ,wDAAwD;AAC9F,SAASC,cAAc,QAAQ,iDAAiD;AAChF,SAASC,mBAAmB,QAAQ,sDAAsD;AAC1F,SAASC,oBAAoB,QAAQ,uDAAuD;AAC5F,SAASC,WAAW,QAAQ,8CAA8C;AAC1E,SAASC,mBAAmB,QAAQ,kDAAkD","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ export interface CbacBannerData {
2
+ classificationString: string;
3
+ textColor: string;
4
+ backgroundColors: string[];
5
+ markingIds: string[];
6
+ }
7
+ export interface UseCbacBannerOptions {
8
+ markingIds: string[];
9
+ /**
10
+ * Enable or disable the query.
11
+ *
12
+ * When `false`, the query will not automatically execute.
13
+ *
14
+ * This is useful for:
15
+ * - Lazy/on-demand queries that should wait for user interaction
16
+ * - Dependent queries that need data from another query first
17
+ * - Conditional queries based on component state
18
+ *
19
+ * @default true
20
+ */
21
+ enabled?: boolean;
22
+ }
23
+ export interface UseCbacBannerResult {
24
+ banner: CbacBannerData | undefined;
25
+ isLoading: boolean;
26
+ error: Error | undefined;
27
+ refetch: () => void;
28
+ }
29
+ /**
30
+ * Get the CBAC banner data for the given marking IDs.
31
+ * @param options Options to control the query.
32
+ */
33
+ export declare function useCbacBanner({ markingIds, enabled: externalEnabled }: UseCbacBannerOptions): UseCbacBannerResult;
@@ -0,0 +1 @@
1
+ {"mappings":"AAqBA,iBAAiB,eAAe;CAC9B;CACA;CACA;CACA;AACD;AAED,iBAAiB,qBAAqB;CACpC;;;;;;;;;;;;;CAaA;AACD;AAED,iBAAiB,oBAAoB;CACnC,QAAQ;CACR;CAEA,OAAO;CAEP;AACD;;;;;AAMD,OAAO,iBAAS,cACd,EAAE,YAAY,SAAS,iBAA8C,EAApB,uBAChD","names":[],"sources":["../../../../../src/new/platform-apis/admin/useCbacBanner.ts"],"version":3,"file":"useCbacBanner.d.ts"}
@@ -0,0 +1,34 @@
1
+ export interface CbacMarkingRestrictionsData {
2
+ disallowedMarkings: string[];
3
+ impliedMarkings: string[];
4
+ requiredMarkings: string[][];
5
+ userSatisfiesMarkings: boolean;
6
+ isValid: boolean;
7
+ }
8
+ export interface UseCbacMarkingRestrictionsOptions {
9
+ markingIds: string[];
10
+ /**
11
+ * Enable or disable the query.
12
+ *
13
+ * When `false`, the query will not automatically execute.
14
+ *
15
+ * This is useful for:
16
+ * - Lazy/on-demand queries that should wait for user interaction
17
+ * - Dependent queries that need data from another query first
18
+ * - Conditional queries based on component state
19
+ *
20
+ * @default true
21
+ */
22
+ enabled?: boolean;
23
+ }
24
+ export interface UseCbacMarkingRestrictionsResult {
25
+ restrictions: CbacMarkingRestrictionsData | undefined;
26
+ isLoading: boolean;
27
+ error: Error | undefined;
28
+ refetch: () => void;
29
+ }
30
+ /**
31
+ * Get CBAC marking restrictions (implied, disallowed, required) for the given marking IDs.
32
+ * @param options Options to control the query.
33
+ */
34
+ export declare function useCbacMarkingRestrictions({ markingIds, enabled: externalEnabled }: UseCbacMarkingRestrictionsOptions): UseCbacMarkingRestrictionsResult;
@@ -0,0 +1 @@
1
+ {"mappings":"AAqBA,iBAAiB,4BAA4B;CAC3C;CACA;CACA;CACA;CACA;AACD;AAED,iBAAiB,kCAAkC;CACjD;;;;;;;;;;;;;CAaA;AACD;AAED,iBAAiB,iCAAiC;CAChD,cAAc;CACd;CAEA,OAAO;CAEP;AACD;;;;;AAMD,OAAO,iBAAS,2BACd,EAAE,YAAY,SAAS,iBACY,EAAjC,oCACD","names":[],"sources":["../../../../../src/new/platform-apis/admin/useCbacMarkingRestrictions.ts"],"version":3,"file":"useCbacMarkingRestrictions.d.ts"}
@@ -0,0 +1,27 @@
1
+ import type { MarkingCategory } from "@osdk/foundry.admin";
2
+ export interface UseMarkingCategoriesOptions {
3
+ /**
4
+ * Enable or disable the query.
5
+ *
6
+ * When `false`, the query will not automatically execute.
7
+ *
8
+ * This is useful for:
9
+ * - Lazy/on-demand queries that should wait for user interaction
10
+ * - Dependent queries that need data from another query first
11
+ * - Conditional queries based on component state
12
+ *
13
+ * @default true
14
+ */
15
+ enabled?: boolean;
16
+ }
17
+ export interface UseMarkingCategoriesResult {
18
+ categories: MarkingCategory[] | undefined;
19
+ isLoading: boolean;
20
+ error: Error | undefined;
21
+ refetch: () => void;
22
+ }
23
+ /**
24
+ * List all marking categories.
25
+ * @param options Options to control the query.
26
+ */
27
+ export declare function useMarkingCategories({ enabled }?: UseMarkingCategoriesOptions): UseMarkingCategoriesResult;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,uBAAuB,qBAAsB;AAM3D,iBAAiB,4BAA4B;;;;;;;;;;;;;CAa3C;AACD;AAED,iBAAiB,2BAA2B;CAC1C,YAAY;CACZ;CAEA,OAAO;CAEP;AACD;;;;;AAMD,OAAO,iBAAS,qBACd,EAAE,SAA6C,GAA3B,8BACnB","names":[],"sources":["../../../../../src/new/platform-apis/admin/useMarkingCategories.ts"],"version":3,"file":"useMarkingCategories.d.ts"}
@@ -0,0 +1,27 @@
1
+ import type { Marking } from "@osdk/foundry.admin";
2
+ export interface UseMarkingsOptions {
3
+ /**
4
+ * Enable or disable the query.
5
+ *
6
+ * When `false`, the query will not automatically execute.
7
+ *
8
+ * This is useful for:
9
+ * - Lazy/on-demand queries that should wait for user interaction
10
+ * - Dependent queries that need data from another query first
11
+ * - Conditional queries based on component state
12
+ *
13
+ * @default true
14
+ */
15
+ enabled?: boolean;
16
+ }
17
+ export interface UseMarkingsResult {
18
+ markings: Marking[] | undefined;
19
+ isLoading: boolean;
20
+ error: Error | undefined;
21
+ refetch: () => void;
22
+ }
23
+ /**
24
+ * List all markings.
25
+ * @param options Options to control the query.
26
+ */
27
+ export declare function useMarkings({ enabled }?: UseMarkingsOptions): UseMarkingsResult;
@@ -0,0 +1 @@
1
+ {"mappings":"AAgBA,cAAc,eAAe,qBAAsB;AAMnD,iBAAiB,mBAAmB;;;;;;;;;;;;;CAalC;AACD;AAED,iBAAiB,kBAAkB;CACjC,UAAU;CACV;CAEA,OAAO;CAEP;AACD;;;;;AAMD,OAAO,iBAAS,YACd,EAAE,SAAoC,GAAlB,qBACnB","names":[],"sources":["../../../../../src/new/platform-apis/admin/useMarkings.ts"],"version":3,"file":"useMarkings.d.ts"}
@@ -0,0 +1,33 @@
1
+ export interface UseUserViewMarkingsOptions {
2
+ /**
3
+ * The user ID to fetch view markings for.
4
+ * When omitted, fetches markings for the current user.
5
+ */
6
+ userId?: string;
7
+ /**
8
+ * Enable or disable the query.
9
+ *
10
+ * When `false`, the query will not automatically execute.
11
+ *
12
+ * This is useful for:
13
+ * - Lazy/on-demand queries that should wait for user interaction
14
+ * - Dependent queries that need data from another query first
15
+ * - Conditional queries based on component state
16
+ *
17
+ * @default true
18
+ */
19
+ enabled?: boolean;
20
+ }
21
+ export interface UseUserViewMarkingsResult {
22
+ markingIds: string[] | undefined;
23
+ isLoading: boolean;
24
+ error: Error | undefined;
25
+ refetch: () => void;
26
+ }
27
+ /**
28
+ * Get view-accessible markings for a user.
29
+ * When `userId` is provided, fetches markings for that user.
30
+ * When omitted, fetches markings for the current user.
31
+ * @param options Options to control the query.
32
+ */
33
+ export declare function useUserViewMarkings({ userId, enabled }?: UseUserViewMarkingsOptions): UseUserViewMarkingsResult;
@@ -0,0 +1 @@
1
+ {"mappings":"AAqBA,iBAAiB,2BAA2B;;;;;CAK1C;;;;;;;;;;;;;CAaA;AACD;AAED,iBAAiB,0BAA0B;CACzC;CACA;CAEA,OAAO;CAEP;AACD;;;;;;;AAQD,OAAO,iBAAS,oBACd,EAAE,QAAQ,SAA4C,GAA1B,6BAC3B","names":[],"sources":["../../../../../src/new/platform-apis/admin/useUserMarkings.ts"],"version":3,"file":"useUserMarkings.d.ts"}
@@ -27,9 +27,10 @@ export declare function useOsdkObject<Q extends ObjectOrInterfaceDefinition>(typ
27
27
  *
28
28
  * @param type The object type or interface definition
29
29
  * @param primaryKey The primary key of the object
30
- * @param options Options including $select and enabled
30
+ * @param options Options including $select, enabled, and $loadPropertySecurityMetadata
31
31
  */
32
32
  export declare function useOsdkObject<Q extends ObjectOrInterfaceDefinition>(type: Q, primaryKey: PrimaryKeyType<Q>, options?: {
33
33
  $select?: readonly PropertyKeys<Q>[]
34
34
  enabled?: boolean
35
+ $loadPropertySecurityMetadata?: boolean
35
36
  }): UseOsdkObjectResult<Q>;
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,6BACA,MACA,gBACA,oBACK,WAAY;AAMnB,iBAAiB,oBACf,UAAU,6BACV;CACA,QAAQ,KAAK,SAAS;CACtB;CAEA,OAAO;;;;CAKP;CACA;AACD;;;;;AAMD,OAAO,iBAAS,cACd,UAAU,6BAEVA,KAAK,KAAK,SAAS,IACnBC,oBACC,oBAAoB;;;;;;;;AAQvB,OAAO,iBAAS,cACd,UAAU,6BAEVC,MAAM,GACNC,YAAY,eAAe,IAC3BF,oBACC,oBAAoB;;;;;;;;AAQvB,OAAO,iBAAS,cACd,UAAU,6BAEVC,MAAM,GACNC,YAAY,eAAe,IAC3BC,UAAU;CAAE,mBAAmB,aAAa;CAAM;AAAmB,IACpE,oBAAoB","names":["obj: Osdk.Instance<Q>","enabled?: boolean","type: Q","primaryKey: PrimaryKeyType<Q>","options?: { $select?: readonly PropertyKeys<Q>[]; enabled?: boolean }"],"sources":["../../../src/new/useOsdkObject.ts"],"version":3,"file":"useOsdkObject.d.ts"}
1
+ {"mappings":"AAgBA,cACE,6BACA,MACA,gBACA,oBACK,WAAY;AAMnB,iBAAiB,oBACf,UAAU,6BACV;CACA,QAAQ,KAAK,SAAS;CACtB;CAEA,OAAO;;;;CAKP;CACA;AACD;;;;;AAMD,OAAO,iBAAS,cACd,UAAU,6BAEVA,KAAK,KAAK,SAAS,IACnBC,oBACC,oBAAoB;;;;;;;;AAQvB,OAAO,iBAAS,cACd,UAAU,6BAEVC,MAAM,GACNC,YAAY,eAAe,IAC3BF,oBACC,oBAAoB;;;;;;;;AAQvB,OAAO,iBAAS,cACd,UAAU,6BAEVC,MAAM,GACNC,YAAY,eAAe,IAC3BC,UAAU;CACR,mBAAmB,aAAa;CAChC;CACA;AACD,IACA,oBAAoB","names":["obj: Osdk.Instance<Q>","enabled?: boolean","type: Q","primaryKey: PrimaryKeyType<Q>","options?: {\n $select?: readonly PropertyKeys<Q>[];\n enabled?: boolean;\n $loadPropertySecurityMetadata?: boolean;\n }"],"sources":["../../../src/new/useOsdkObject.ts"],"version":3,"file":"useOsdkObject.d.ts"}
@@ -89,6 +89,12 @@ export interface UseOsdkObjectsOptions<
89
89
  * useOsdkObjects(Employee, { $select: ["name", "status"] })
90
90
  */
91
91
  $select?: readonly PropertyKeys<T>[];
92
+ /**
93
+ * When true, loads per-property security metadata (marking requirements)
94
+ * alongside each object. The returned objects will have `$propertySecurities`
95
+ * populated with conjunctive/disjunctive marking requirements per property.
96
+ */
97
+ $loadPropertySecurityMetadata?: boolean;
92
98
  }
93
99
  export interface UseOsdkListResult<
94
100
  T extends ObjectOrInterfaceDefinition,
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,iBACA,YACA,WACA,6BACA,MACA,cACA,mBACA,mBACK,WAAY;AAMnB,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EACnD;;;;;;;;;;;;;;;;;CAiBA;;;;;;CAOA,QAAQ,YAAY,GAAG;;;;CAKvB,aACG,KAAK,aAAa,OAAM,QAAQ;;;;CAMnC;;;;;CAMA,oBAAoB,WAAW,QAAO,gBAAgB,QAAQ,GAAG,KAAK;;;;;;;CAQtE;;;;;;;;;CAUA;;;;;;CAOA,gBAAgB,MAAM;EACpB,OAAO,YAAY,GAAG;CACvB;;;;;CAMD,UAAU,UAAU;;;;;;;;;;CAWpB;CAEA;;;;;;;;;;CAWA,mBAAmB,aAAa;AACjC;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,8BAA8B;EAC9B;;;;CAIA,kBAAkB;;;;CAKlB,MACI,KAAK,SACL,GACA,uBAAuB,eACvB,aAAa,IACb;;;;CAOJ;;;;CAKA,OAAO;;;;;;;;CASP;;;;CAKA;AACD;AAUD,OAAO,iBAAS;CACd,UAAU;CACV,UAAU,UAAU;EAEpBA,MAAM,GACNC,SAAS,sBAAsB,KAAK;CAAE,SAAS;CAAG;AAAyB,IAC1E,kBAAkB,WAAW,GAAG,IAAI,CAAE,GAAE;AAE3C,OAAO,iBAAS;CACd,UAAU;CACV,UAAU,UAAU;EAEpBD,MAAM,GACNE,SAAS,sBAAsB,KAAK;CAAE,SAAS;AAAG,IACjD,kBAAkB,WAAW,GAAG;AAEnC,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EAEnDF,MAAM,GACNG,SAAS,sBAAsB,GAAG,QAAQ;CAAE;AAAyB,IACpE,kBAAkB,GAAG,MAAM;AAE9B,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EAEnDH,MAAM,GACNI,UAAU,sBAAsB,GAAG,QAClC,kBAAkB,GAAG","names":["type: Q","options: UseOsdkObjectsOptions<Q> & { pivotTo: L; rids: readonly string[] }","options: UseOsdkObjectsOptions<Q> & { pivotTo: L }","options: UseOsdkObjectsOptions<Q, RDPs> & { rids: readonly string[] }","options?: UseOsdkObjectsOptions<Q, RDPs>"],"sources":["../../../src/new/useOsdkObjects.ts"],"version":3,"file":"useOsdkObjects.d.ts"}
1
+ {"mappings":"AAgBA,cACE,iBACA,YACA,WACA,6BACA,MACA,cACA,mBACA,mBACK,WAAY;AAMnB,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EACnD;;;;;;;;;;;;;;;;;CAiBA;;;;;;CAOA,QAAQ,YAAY,GAAG;;;;CAKvB,aACG,KAAK,aAAa,OAAM,QAAQ;;;;CAMnC;;;;;CAMA,oBAAoB,WAAW,QAAO,gBAAgB,QAAQ,GAAG,KAAK;;;;;;;CAQtE;;;;;;;;;CAUA;;;;;;CAOA,gBAAgB,MAAM;EACpB,OAAO,YAAY,GAAG;CACvB;;;;;CAMD,UAAU,UAAU;;;;;;;;;;CAWpB;CAEA;;;;;;;;;;CAWA,mBAAmB,aAAa;;;;;;CAOhC;AACD;AAED,iBAAiB;CACf,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;CACnD,8BAA8B;EAC9B;;;;CAIA,kBAAkB;;;;CAKlB,MACI,KAAK,SACL,GACA,uBAAuB,eACvB,aAAa,IACb;;;;CAOJ;;;;CAKA,OAAO;;;;;;;;CASP;;;;CAKA;AACD;AAUD,OAAO,iBAAS;CACd,UAAU;CACV,UAAU,UAAU;EAEpBA,MAAM,GACNC,SAAS,sBAAsB,KAAK;CAAE,SAAS;CAAG;AAAyB,IAC1E,kBAAkB,WAAW,GAAG,IAAI,CAAE,GAAE;AAE3C,OAAO,iBAAS;CACd,UAAU;CACV,UAAU,UAAU;EAEpBD,MAAM,GACNE,SAAS,sBAAsB,KAAK;CAAE,SAAS;AAAG,IACjD,kBAAkB,WAAW,GAAG;AAEnC,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EAEnDF,MAAM,GACNG,SAAS,sBAAsB,GAAG,QAAQ;CAAE;AAAyB,IACpE,kBAAkB,GAAG,MAAM;AAE9B,OAAO,iBAAS;CACd,UAAU;CACV,aAAa,eAAe,qBAAqB,CAAE;EAEnDH,MAAM,GACNI,UAAU,sBAAsB,GAAG,QAClC,kBAAkB,GAAG","names":["type: Q","options: UseOsdkObjectsOptions<Q> & { pivotTo: L; rids: readonly string[] }","options: UseOsdkObjectsOptions<Q> & { pivotTo: L }","options: UseOsdkObjectsOptions<Q, RDPs> & { rids: readonly string[] }","options?: UseOsdkObjectsOptions<Q, RDPs>"],"sources":["../../../src/new/useOsdkObjects.ts"],"version":3,"file":"useOsdkObjects.d.ts"}
@@ -1,3 +1,11 @@
1
+ export { useCbacBanner } from "../../new/platform-apis/admin/useCbacBanner.js";
2
+ export type { CbacBannerData, UseCbacBannerOptions, UseCbacBannerResult } from "../../new/platform-apis/admin/useCbacBanner.js";
3
+ export { useCbacMarkingRestrictions } from "../../new/platform-apis/admin/useCbacMarkingRestrictions.js";
4
+ export type { CbacMarkingRestrictionsData, UseCbacMarkingRestrictionsOptions, UseCbacMarkingRestrictionsResult } from "../../new/platform-apis/admin/useCbacMarkingRestrictions.js";
1
5
  export { useCurrentFoundryUser } from "../../new/platform-apis/admin/useCurrentFoundryUser.js";
2
6
  export { useFoundryUser } from "../../new/platform-apis/admin/useFoundryUser.js";
3
7
  export { useFoundryUsersList } from "../../new/platform-apis/admin/useFoundryUsersList.js";
8
+ export { useMarkingCategories } from "../../new/platform-apis/admin/useMarkingCategories.js";
9
+ export { useMarkings } from "../../new/platform-apis/admin/useMarkings.js";
10
+ export { useUserViewMarkings } from "../../new/platform-apis/admin/useUserMarkings.js";
11
+ export type { UseUserViewMarkingsOptions, UseUserViewMarkingsResult } from "../../new/platform-apis/admin/useUserMarkings.js";
@@ -1 +1 @@
1
- {"mappings":"AAgBA,SAAS,6BAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B","names":[],"sources":["../../../../src/public/experimental/admin.ts"],"version":3,"file":"admin.d.ts"}
1
+ {"mappings":"AAgBA,SAAS,qBAAqB;AAC9B,cACE,gBACA,sBACA,2BACK;AACP,SAAS,kCAAkC;AAC3C,cACE,6BACA,mCACA,wCACK;AACP,SAAS,6BAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AACpC,SAAS,4BAA4B;AACrC,SAAS,mBAAmB;AAC5B,SAAS,2BAA2B;AACpC,cACE,4BACA,iCACK","names":[],"sources":["../../../../src/public/experimental/admin.ts"],"version":3,"file":"admin.d.ts"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osdk/react",
3
- "version": "0.10.0-beta.10",
3
+ "version": "0.10.0-beta.12",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -62,8 +62,8 @@
62
62
  }
63
63
  },
64
64
  "devDependencies": {
65
- "@osdk/foundry.admin": "2.50.0",
66
- "@osdk/foundry.core": "2.50.0",
65
+ "@osdk/foundry.admin": "2.54.0",
66
+ "@osdk/foundry.core": "2.54.0",
67
67
  "@testing-library/react": "^16.3.0",
68
68
  "@types/react": "^18.3.24",
69
69
  "find-up": "^8.0.0",
@@ -76,11 +76,11 @@
76
76
  "react": "^18.3.1",
77
77
  "tiny-invariant": "^1.3.3",
78
78
  "typescript": "~5.5.4",
79
- "@osdk/api": "2.8.0-beta.22",
80
- "@osdk/client": "2.8.0-beta.22",
81
- "@osdk/client.test.ontology": "2.8.0-beta.22",
79
+ "@osdk/api": "2.8.0-beta.27",
80
+ "@osdk/client.test.ontology": "2.8.0-beta.27",
81
+ "@osdk/monorepo.api-extractor": "~0.7.0-beta.1",
82
82
  "@osdk/monorepo.tsconfig": "~0.7.0-beta.1",
83
- "@osdk/monorepo.api-extractor": "~0.7.0-beta.1"
83
+ "@osdk/client": "2.8.0-beta.27"
84
84
  },
85
85
  "publishConfig": {
86
86
  "access": "public"