@osdk/react 0.15.0 → 0.16.0-main-7b457a54c3844cd5799738f99f15333d4f8cc39e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/build/browser/new/useOsdkObject.js +2 -1
- package/build/browser/new/useOsdkObject.js.map +1 -1
- package/build/browser/public/experimental.js +1 -1
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/useOsdkClient.js +4 -0
- package/build/browser/useOsdkClient.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/chunk-2Y5CIQPC.cjs +35 -0
- package/build/cjs/chunk-2Y5CIQPC.cjs.map +1 -0
- package/build/cjs/{chunk-OVBG5VXE.cjs → chunk-MERQDEQC.cjs} +13 -9
- package/build/cjs/chunk-MERQDEQC.cjs.map +1 -0
- package/build/cjs/{chunk-MKAFMZF7.cjs → chunk-UKQGMTMG.cjs} +3 -26
- package/build/cjs/chunk-UKQGMTMG.cjs.map +1 -0
- package/build/cjs/index.cjs +5 -4
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +1 -1
- package/build/cjs/public/experimental/admin.cjs +14 -13
- package/build/cjs/public/experimental/admin.cjs.map +1 -1
- package/build/cjs/public/experimental.cjs +47 -41
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.d.cts +1 -1
- package/build/cjs/{useOsdkMetadata-BElt3F5s.d.cts → useOsdkMetadata-CRTcdg-a.d.cts} +2 -1
- package/build/esm/new/useOsdkObject.js +2 -1
- package/build/esm/new/useOsdkObject.js.map +1 -1
- package/build/esm/public/experimental.js +1 -1
- package/build/esm/public/experimental.js.map +1 -1
- package/build/esm/useOsdkClient.js +4 -0
- package/build/esm/useOsdkClient.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/types/public/experimental.d.ts +1 -1
- package/build/types/public/experimental.d.ts.map +1 -1
- package/build/types/useOsdkClient.d.ts +1 -0
- package/build/types/useOsdkClient.d.ts.map +1 -1
- package/package.json +8 -8
- package/build/cjs/chunk-MKAFMZF7.cjs.map +0 -1
- package/build/cjs/chunk-OVBG5VXE.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @osdkkit/react
|
|
2
2
|
|
|
3
|
+
## 0.16.0-main-7b457a54c3844cd5799738f99f15333d4f8cc39e
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7b457a5: Fix function column with derived properties
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- aa78c78: surface fetch errors through useOsdkObject's `error` and clear `isLoading`
|
|
12
|
+
|
|
13
|
+
When the underlying fetch fails (e.g. `PalantirApiError: Object not found`), `useOsdkObject` now returns the error through `error` and exits the loading state so consumers can render their error UI instead of waiting forever.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies [7b457a5]
|
|
16
|
+
- @osdk/client@2.13.0-main-7b457a54c3844cd5799738f99f15333d4f8cc39e
|
|
17
|
+
- @osdk/api@2.13.0-main-7b457a54c3844cd5799738f99f15333d4f8cc39e
|
|
18
|
+
|
|
3
19
|
## 0.15.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -104,7 +104,8 @@ export function useOsdkObject(...args) {
|
|
|
104
104
|
}
|
|
105
105
|
return {
|
|
106
106
|
object: payload?.object,
|
|
107
|
-
|
|
107
|
+
// Errors take precedence over loading state.
|
|
108
|
+
isLoading: enabled && error == null ? payload?.status === "loading" || payload?.status === "init" || !payload : false,
|
|
108
109
|
isOptimistic: !!payload?.isOptimistic,
|
|
109
110
|
error,
|
|
110
111
|
forceUpdate
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObject.js","names":["React","devToolsMetadata","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","hookType","objectType","String","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 { devToolsMetadata, 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 devToolsMetadata({\n hookType: \"useOsdkObject\",\n objectType: apiNameString,\n primaryKey: String(primaryKey),\n }),\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 devToolsMetadata({\n hookType: \"useOsdkObject\",\n objectType: apiNameString,\n primaryKey: String(primaryKey),\n }),\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,gBAAgB,EAAEC,iBAAiB,QAAQ,wBAAwB;AAC5E,SAASC,YAAY,QAAQ,mBAAmB;;AAiBhD;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA,OAAO,SAASC,aAAaA,CAG3B,GAAGC,IAWA,EACqB;EACxB,MAAM;IAAEC;EAAiB,CAAC,GAAGN,KAAK,CAACO,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,IAAI,CAAC,CAAC,CAAC,GAKPK,SAAS;;EAEb;EACA,MAAMC,OAAO,GAAGH,mBAAmB,GAC9B,OAAOH,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,GAAGA,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAC9CI,UAAU,GACTA,UAAU,CAACE,OAAO,IAAI,IAAI,GAC1B,OAAON,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS,GAAGA,IAAI,CAAC,CAAC,CAAC,GAAG,IAAK;EAEnD,MAAMO,SAAS,GAAGH,UAAU,EAAEI,OAAO;EACrC,MAAMC,4BAA4B,GAAGL,UAAU,EAC3CM,6BAA6B;EAEjC,MAAMC,IAAI,GAAG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,CAACb,UAAU;IAC/B,CAAC,CACH,CAAC;EACH,CAAC,EACD,CACER,OAAO,EACPL,gBAAgB,EAChBW,aAAa,EACbI,aAAa,EACbF,UAAU,EACVH,IAAI,EACJO,YAAY,EACZT,4BAA4B,CAEhC,CAAC;EAED,MAAMsB,OAAO,GAAGpC,KAAK,CAACqC,oBAAoB,CAACV,SAAS,EAAEC,WAAW,CAAC;EAElE,MAAMU,WAAW,GAAGtC,KAAK,CAACuC,WAAW,CAAC,MAAM;IAC1C,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACpC,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOxC,KAAK,CAACwB,OAAO,CAAC,MAAM;IACzB,IAAIiB,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,EAAEjC,OAAO,GACbyB,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,EAAEzB,OAAO,EAAE2B,WAAW,CAAC,CAAC;AACrC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useOsdkObject.js","names":["React","devToolsMetadata","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","hookType","objectType","String","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 { devToolsMetadata, 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 devToolsMetadata({\n hookType: \"useOsdkObject\",\n objectType: apiNameString,\n primaryKey: String(primaryKey),\n }),\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 devToolsMetadata({\n hookType: \"useOsdkObject\",\n objectType: apiNameString,\n primaryKey: String(primaryKey),\n }),\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 // Errors take precedence over loading state.\n isLoading: enabled && error == null\n ? (payload?.status === \"loading\" || payload?.status === \"init\"\n || !payload)\n : false,\n isOptimistic: !!payload?.isOptimistic,\n error,\n forceUpdate,\n };\n }, [payload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Aa,EACbF,UAAU,EACVH,IAAI,EACJO,YAAY,EACZT,4BAA4B,CAEhC,CAAC;EAED,MAAMsB,OAAO,GAAGpC,KAAK,CAACqC,oBAAoB,CAACV,SAAS,EAAEC,WAAW,CAAC;EAElE,MAAMU,WAAW,GAAGtC,KAAK,CAACuC,WAAW,CAAC,MAAM;IAC1C,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACpC,CAAC,EAAE,EAAE,CAAC;EAEN,OAAOxC,KAAK,CAACwB,OAAO,CAAC,MAAM;IACzB,IAAIiB,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;MACvD;MACAC,SAAS,EAAEjC,OAAO,IAAI8B,KAAK,IAAI,IAAI,GAC9BL,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,EAAEzB,OAAO,EAAE2B,WAAW,CAAC,CAAC;AACrC","ignoreList":[]}
|
|
@@ -25,7 +25,7 @@ export { useOsdkFunctions } from "../new/useOsdkFunctions.js";
|
|
|
25
25
|
export { useOsdkObject } from "../new/useOsdkObject.js";
|
|
26
26
|
export { useOsdkObjects } from "../new/useOsdkObjects.js";
|
|
27
27
|
export { useRegisterUserAgent } from "../new/useRegisterUserAgent.js";
|
|
28
|
-
export { useOsdkClient } from "../useOsdkClient.js";
|
|
28
|
+
export { useOsdkClient, useOsdkClient2 } from "../useOsdkClient.js";
|
|
29
29
|
export { useOsdkMetadata } from "../useOsdkMetadata.js";
|
|
30
30
|
export { useDebouncedCallback } from "../utils/useDebouncedCallback.js";
|
|
31
31
|
export { getRegisteredDevTools, registerDevTools } from "./devtools-registry.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"experimental.js","names":["useStableObjectSet","OsdkProvider2","useLinks","useObjectSet","useOsdkAction","useOsdkAggregation","useOsdkFunction","useOsdkFunctions","useOsdkObject","useOsdkObjects","useRegisterUserAgent","useOsdkClient","useOsdkMetadata","useDebouncedCallback","getRegisteredDevTools","registerDevTools"],"sources":["experimental.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 { useStableObjectSet } from \"../new/core/useStableObjectSet.js\";\nexport { OsdkProvider2 } from \"../new/OsdkProvider2.js\";\nexport { useLinks } from \"../new/useLinks.js\";\nexport { useObjectSet } from \"../new/useObjectSet.js\";\nexport { useOsdkAction } from \"../new/useOsdkAction.js\";\nexport type { UseOsdkAggregationResult } from \"../new/useOsdkAggregation.js\";\nexport { useOsdkAggregation } from \"../new/useOsdkAggregation.js\";\nexport type {\n UseOsdkFunctionOptions,\n UseOsdkFunctionResult,\n} from \"../new/useOsdkFunction.js\";\nexport { useOsdkFunction } from \"../new/useOsdkFunction.js\";\nexport { useOsdkFunctions } from \"../new/useOsdkFunctions.js\";\nexport type {\n FunctionQueryParams,\n UseOsdkFunctionsProps,\n UseOsdkFunctionsResult,\n} from \"../new/useOsdkFunctions.js\";\nexport { useOsdkObject } from \"../new/useOsdkObject.js\";\nexport type {\n UseOsdkListResult,\n UseOsdkObjectsOptions,\n} from \"../new/useOsdkObjects.js\";\nexport { useOsdkObjects } from \"../new/useOsdkObjects.js\";\nexport { useRegisterUserAgent } from \"../new/useRegisterUserAgent.js\";\nexport { useOsdkClient } from \"../useOsdkClient.js\";\nexport { useOsdkMetadata } from \"../useOsdkMetadata.js\";\nexport type { UseOsdkMetadataResult } from \"../useOsdkMetadata.js\";\nexport { useDebouncedCallback } from \"../utils/useDebouncedCallback.js\";\nexport type { DevToolsRegistry } from \"./devtools-registry.js\";\nexport {\n getRegisteredDevTools,\n registerDevTools,\n} from \"./devtools-registry.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,kBAAkB,QAAQ,mCAAmC;AACtE,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,aAAa,QAAQ,yBAAyB;AAEvD,SAASC,kBAAkB,QAAQ,8BAA8B;AAKjE,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,gBAAgB,QAAQ,4BAA4B;AAM7D,SAASC,aAAa,QAAQ,yBAAyB;AAKvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,oBAAoB,QAAQ,gCAAgC;AACrE,SAASC,aAAa,QAAQ,qBAAqB;
|
|
1
|
+
{"version":3,"file":"experimental.js","names":["useStableObjectSet","OsdkProvider2","useLinks","useObjectSet","useOsdkAction","useOsdkAggregation","useOsdkFunction","useOsdkFunctions","useOsdkObject","useOsdkObjects","useRegisterUserAgent","useOsdkClient","useOsdkClient2","useOsdkMetadata","useDebouncedCallback","getRegisteredDevTools","registerDevTools"],"sources":["experimental.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 { useStableObjectSet } from \"../new/core/useStableObjectSet.js\";\nexport { OsdkProvider2 } from \"../new/OsdkProvider2.js\";\nexport { useLinks } from \"../new/useLinks.js\";\nexport { useObjectSet } from \"../new/useObjectSet.js\";\nexport { useOsdkAction } from \"../new/useOsdkAction.js\";\nexport type { UseOsdkAggregationResult } from \"../new/useOsdkAggregation.js\";\nexport { useOsdkAggregation } from \"../new/useOsdkAggregation.js\";\nexport type {\n UseOsdkFunctionOptions,\n UseOsdkFunctionResult,\n} from \"../new/useOsdkFunction.js\";\nexport { useOsdkFunction } from \"../new/useOsdkFunction.js\";\nexport { useOsdkFunctions } from \"../new/useOsdkFunctions.js\";\nexport type {\n FunctionQueryParams,\n UseOsdkFunctionsProps,\n UseOsdkFunctionsResult,\n} from \"../new/useOsdkFunctions.js\";\nexport { useOsdkObject } from \"../new/useOsdkObject.js\";\nexport type {\n UseOsdkListResult,\n UseOsdkObjectsOptions,\n} from \"../new/useOsdkObjects.js\";\nexport { useOsdkObjects } from \"../new/useOsdkObjects.js\";\nexport { useRegisterUserAgent } from \"../new/useRegisterUserAgent.js\";\nexport { useOsdkClient, useOsdkClient2 } from \"../useOsdkClient.js\";\nexport { useOsdkMetadata } from \"../useOsdkMetadata.js\";\nexport type { UseOsdkMetadataResult } from \"../useOsdkMetadata.js\";\nexport { useDebouncedCallback } from \"../utils/useDebouncedCallback.js\";\nexport type { DevToolsRegistry } from \"./devtools-registry.js\";\nexport {\n getRegisteredDevTools,\n registerDevTools,\n} from \"./devtools-registry.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,kBAAkB,QAAQ,mCAAmC;AACtE,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,YAAY,QAAQ,wBAAwB;AACrD,SAASC,aAAa,QAAQ,yBAAyB;AAEvD,SAASC,kBAAkB,QAAQ,8BAA8B;AAKjE,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SAASC,gBAAgB,QAAQ,4BAA4B;AAM7D,SAASC,aAAa,QAAQ,yBAAyB;AAKvD,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,oBAAoB,QAAQ,gCAAgC;AACrE,SAASC,aAAa,EAAEC,cAAc,QAAQ,qBAAqB;AACnE,SAASC,eAAe,QAAQ,uBAAuB;AAEvD,SAASC,oBAAoB,QAAQ,kCAAkC;AAEvE,SACEC,qBAAqB,EACrBC,gBAAgB,QACX,wBAAwB","ignoreList":[]}
|
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import React from "react";
|
|
18
|
+
import { OsdkContext2 } from "./new/OsdkContext2.js";
|
|
18
19
|
import { OsdkContext } from "./OsdkContext.js";
|
|
19
20
|
export function useOsdkClient() {
|
|
20
21
|
return React.useContext(OsdkContext).client;
|
|
21
22
|
}
|
|
23
|
+
export function useOsdkClient2() {
|
|
24
|
+
return React.useContext(OsdkContext2).client;
|
|
25
|
+
}
|
|
22
26
|
//# sourceMappingURL=useOsdkClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkClient.js","names":["React","OsdkContext","useOsdkClient","useContext","client"],"sources":["useOsdkClient.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Client } from \"@osdk/client\";\nimport React from \"react\";\nimport { OsdkContext } from \"./OsdkContext.js\";\n\nexport function useOsdkClient(): Client {\n return React.useContext(OsdkContext).client;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,OAAO,SAASC,aAAaA,CAAA,EAAW;EACtC,
|
|
1
|
+
{"version":3,"file":"useOsdkClient.js","names":["React","OsdkContext2","OsdkContext","useOsdkClient","useContext","client","useOsdkClient2"],"sources":["useOsdkClient.ts"],"sourcesContent":["/*\n * Copyright 2024 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 { Client } from \"@osdk/client\";\nimport React from \"react\";\nimport { OsdkContext2 } from \"./new/OsdkContext2.js\";\nimport { OsdkContext } from \"./OsdkContext.js\";\n\nexport function useOsdkClient(): Client {\n return React.useContext(OsdkContext).client;\n}\n\nexport function useOsdkClient2(): Client {\n return React.useContext(OsdkContext2).client;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,YAAY,QAAQ,uBAAuB;AACpD,SAASC,WAAW,QAAQ,kBAAkB;AAE9C,OAAO,SAASC,aAAaA,CAAA,EAAW;EACtC,OAAOH,KAAK,CAACI,UAAU,CAACF,WAAW,CAAC,CAACG,MAAM;AAC7C;AAEA,OAAO,SAASC,cAAcA,CAAA,EAAW;EACvC,OAAON,KAAK,CAACI,UAAU,CAACH,YAAY,CAAC,CAACI,MAAM;AAC9C","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UserAgent.js","names":["REACT_USER_AGENT"],"sources":["UserAgent.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 const REACT_USER_AGENT: string =\n `osdk-react/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,gBAAwB,GACnC,
|
|
1
|
+
{"version":3,"file":"UserAgent.js","names":["REACT_USER_AGENT"],"sources":["UserAgent.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 const REACT_USER_AGENT: string =\n `osdk-react/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,gBAAwB,GACnC,sEAA2C","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
8
|
+
|
|
9
|
+
// src/new/OsdkContext2.ts
|
|
10
|
+
var MISSING_PROVIDER_MESSAGE = "No OsdkProvider2 found. Did you forget to wrap your component tree with <OsdkProvider2>?";
|
|
11
|
+
function fakeClientFn(..._args) {
|
|
12
|
+
throw new Error(MISSING_PROVIDER_MESSAGE);
|
|
13
|
+
}
|
|
14
|
+
var fakeClient = Object.assign(fakeClientFn, {
|
|
15
|
+
fetchMetadata: fakeClientFn
|
|
16
|
+
});
|
|
17
|
+
var fakeObservableClient = new Proxy({}, {
|
|
18
|
+
get(_target, prop) {
|
|
19
|
+
if (prop === Symbol.toPrimitive || prop === Symbol.toStringTag) {
|
|
20
|
+
return void 0;
|
|
21
|
+
}
|
|
22
|
+
return (..._args) => {
|
|
23
|
+
throw new Error(MISSING_PROVIDER_MESSAGE);
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
var OsdkContext2 = /* @__PURE__ */ React__default.default.createContext({
|
|
28
|
+
client: fakeClient,
|
|
29
|
+
observableClient: fakeObservableClient,
|
|
30
|
+
devtoolsEnabled: false
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
exports.OsdkContext2 = OsdkContext2;
|
|
34
|
+
//# sourceMappingURL=chunk-2Y5CIQPC.cjs.map
|
|
35
|
+
//# sourceMappingURL=chunk-2Y5CIQPC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/new/OsdkContext2.ts"],"names":[],"mappings":";;;;;;;;;AAiBO,IAAM,wBAAA,GAA2B,0FAAA;AACxC,SAAS,gBAAgB,KAAA,EAAO;AAC9B,EAAA,MAAM,IAAI,MAAM,wBAAwB,CAAA;AAC1C;AACA,IAAM,UAAA,GAAa,MAAA,CAAO,MAAA,CAAO,YAAA,EAAc;AAAA,EAC7C,aAAA,EAAe;AACjB,CAAC,CAAA;AAUD,IAAM,oBAAA,GAAuB,IAAI,KAAA,CAAM,EAAC,EAAG;AAAA,EACzC,GAAA,CAAI,SAAS,IAAA,EAAM;AACjB,IAAA,IAAI,IAAA,KAAS,MAAA,CAAO,WAAA,IAAe,IAAA,KAAS,OAAO,WAAA,EAAa;AAC9D,MAAA,OAAO,MAAA;AAAA,IACT;AACA,IAAA,OAAO,IAAI,KAAA,KAAU;AACnB,MAAA,MAAM,IAAI,MAAM,wBAAwB,CAAA;AAAA,IAC1C,CAAA;AAAA,EACF;AACF,CAAC,CAAA;AACM,IAAM,YAAA,0CAAkC,aAAA,CAAc;AAAA,EAC3D,MAAA,EAAQ,UAAA;AAAA,EACR,gBAAA,EAAkB,oBAAA;AAAA,EAClB,eAAA,EAAiB;AACnB,CAAC","file":"chunk-2Y5CIQPC.cjs","sourcesContent":["/*\n * Copyright 2024 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 React from \"react\";\nexport const MISSING_PROVIDER_MESSAGE = \"No OsdkProvider2 found. Did you forget to wrap your component tree with <OsdkProvider2>?\";\nfunction fakeClientFn(..._args) {\n throw new Error(MISSING_PROVIDER_MESSAGE);\n}\nconst fakeClient = Object.assign(fakeClientFn, {\n fetchMetadata: fakeClientFn\n});\n\n// Proxy that throws a clear error when any method is called, so hooks like\n// useOsdkObjects get \"Did you forget <OsdkProvider2>?\" instead of\n// \"cannot read canonicalizeWhereClause of undefined\".\n// We intercept `get` so every property access returns a throwing function,\n// without needing to enumerate every ObservableClient method.\n// Symbol.toPrimitive and Symbol.toStringTag are accessed by React/devtools\n// during rendering and logging — returning undefined for these avoids\n// spurious throws in contexts unrelated to the user's code.\nconst fakeObservableClient = new Proxy({}, {\n get(_target, prop) {\n if (prop === Symbol.toPrimitive || prop === Symbol.toStringTag) {\n return undefined;\n }\n return (..._args) => {\n throw new Error(MISSING_PROVIDER_MESSAGE);\n };\n }\n});\nexport const OsdkContext2 = /*#__PURE__*/React.createContext({\n client: fakeClient,\n observableClient: fakeObservableClient,\n devtoolsEnabled: false\n});"]}
|
|
@@ -1,30 +1,33 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2Y5CIQPC_cjs = require('./chunk-2Y5CIQPC.cjs');
|
|
4
|
+
var React2 = require('react');
|
|
4
5
|
|
|
5
6
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
7
|
|
|
7
|
-
var
|
|
8
|
+
var React2__default = /*#__PURE__*/_interopDefault(React2);
|
|
8
9
|
|
|
9
|
-
// src/useOsdkClient.ts
|
|
10
10
|
function fakeClientFn(..._args) {
|
|
11
11
|
throw new Error("This is not a real client. Did you forget to <OsdkContext.Provider>?");
|
|
12
12
|
}
|
|
13
13
|
var fakeClient = Object.assign(fakeClientFn, {
|
|
14
14
|
fetchMetadata: fakeClientFn
|
|
15
15
|
});
|
|
16
|
-
var OsdkContext = /* @__PURE__ */
|
|
16
|
+
var OsdkContext = /* @__PURE__ */ React2__default.default.createContext({
|
|
17
17
|
client: fakeClient
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
// src/useOsdkClient.ts
|
|
21
21
|
function useOsdkClient() {
|
|
22
|
-
return
|
|
22
|
+
return React2__default.default.useContext(OsdkContext).client;
|
|
23
|
+
}
|
|
24
|
+
function useOsdkClient2() {
|
|
25
|
+
return React2__default.default.useContext(chunk2Y5CIQPC_cjs.OsdkContext2).client;
|
|
23
26
|
}
|
|
24
27
|
function useOsdkMetadata(type) {
|
|
25
28
|
const client = useOsdkClient();
|
|
26
|
-
const [metadata, setMetadata] =
|
|
27
|
-
const [error, setError] =
|
|
29
|
+
const [metadata, setMetadata] = React2__default.default.useState(void 0);
|
|
30
|
+
const [error, setError] = React2__default.default.useState();
|
|
28
31
|
if (!metadata && !error) {
|
|
29
32
|
client.fetchMetadata(type).then((fetchedMetadata) => {
|
|
30
33
|
setMetadata(fetchedMetadata);
|
|
@@ -45,6 +48,7 @@ function useOsdkMetadata(type) {
|
|
|
45
48
|
|
|
46
49
|
exports.OsdkContext = OsdkContext;
|
|
47
50
|
exports.useOsdkClient = useOsdkClient;
|
|
51
|
+
exports.useOsdkClient2 = useOsdkClient2;
|
|
48
52
|
exports.useOsdkMetadata = useOsdkMetadata;
|
|
49
|
-
//# sourceMappingURL=chunk-
|
|
50
|
-
//# sourceMappingURL=chunk-
|
|
53
|
+
//# sourceMappingURL=chunk-MERQDEQC.cjs.map
|
|
54
|
+
//# sourceMappingURL=chunk-MERQDEQC.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/OsdkContext.ts","../../src/useOsdkClient.ts","../../src/useOsdkMetadata.ts"],"names":["React","OsdkContext2","error"],"mappings":";;;;;;;;;AAiBA,SAAS,gBAAgB,KAAA,EAAO;AAC9B,EAAA,MAAM,IAAI,MAAM,sEAAsE,CAAA;AACxF;AACA,IAAM,UAAA,GAAa,MAAA,CAAO,MAAA,CAAO,YAAA,EAAc;AAAA,EAC7C,aAAA,EAAe;AACjB,CAAC,CAAA;AACM,IAAM,WAAA,2CAAiC,aAAA,CAAc;AAAA,EAC1D,MAAA,EAAQ;AACV,CAAC;;;ACNM,SAAS,aAAA,GAAgB;AAC9B,EAAA,OAAOA,uBAAAA,CAAM,UAAA,CAAW,WAAW,CAAA,CAAE,MAAA;AACvC;AACO,SAAS,cAAA,GAAiB;AAC/B,EAAA,OAAOA,uBAAAA,CAAM,UAAA,CAAWC,8BAAY,CAAA,CAAE,MAAA;AACxC;ACNO,SAAS,gBAAgB,IAAA,EAAM;AACpC,EAAA,MAAM,SAAS,aAAA,EAAc;AAC7B,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAID,uBAAAA,CAAM,SAAS,MAAS,CAAA;AACxD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIA,wBAAM,QAAA,EAAS;AACzC,EAAA,IAAI,CAAC,QAAA,IAAY,CAAC,KAAA,EAAO;AACvB,IAAA,MAAA,CAAO,aAAA,CAAc,IAAI,CAAA,CAAE,IAAA,CAAK,CAAA,eAAA,KAAmB;AACjD,MAAA,WAAA,CAAY,eAAe,CAAA;AAAA,IAC7B,CAAC,CAAA,CAAE,KAAA,CAAM,CAAAE,MAAAA,KAAS;AAChB,MAAA,MAAM,eAAeA,MAAAA,YAAiB,KAAA,GAAQA,MAAAA,CAAM,OAAA,GAAU,OAAOA,MAAK,CAAA;AAC1E,MAAA,QAAA,CAAS,YAAY,CAAA;AAAA,IACvB,CAAC,CAAA;AACD,IAAA,OAAO;AAAA,MACL,OAAA,EAAS;AAAA,KACX;AAAA,EACF;AACA,EAAA,OAAO;AAAA,IACL,OAAA,EAAS,KAAA;AAAA,IACT,QAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-MERQDEQC.cjs","sourcesContent":["/*\n * Copyright 2024 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 React from \"react\";\nfunction fakeClientFn(..._args) {\n throw new Error(\"This is not a real client. Did you forget to <OsdkContext.Provider>?\");\n}\nconst fakeClient = Object.assign(fakeClientFn, {\n fetchMetadata: fakeClientFn\n});\nexport const OsdkContext = /*#__PURE__*/React.createContext({\n client: fakeClient\n});","/*\n * Copyright 2024 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 React from \"react\";\nimport { OsdkContext2 } from \"./new/OsdkContext2.js\";\nimport { OsdkContext } from \"./OsdkContext.js\";\nexport function useOsdkClient() {\n return React.useContext(OsdkContext).client;\n}\nexport function useOsdkClient2() {\n return React.useContext(OsdkContext2).client;\n}","/*\n * Copyright 2024 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 React from \"react\";\nimport { useOsdkClient } from \"./useOsdkClient.js\";\nexport function useOsdkMetadata(type) {\n const client = useOsdkClient();\n const [metadata, setMetadata] = React.useState(undefined);\n const [error, setError] = React.useState();\n if (!metadata && !error) {\n client.fetchMetadata(type).then(fetchedMetadata => {\n setMetadata(fetchedMetadata);\n }).catch(error => {\n const errorMessage = error instanceof Error ? error.message : String(error);\n setError(errorMessage);\n });\n return {\n loading: true\n };\n }\n return {\n loading: false,\n metadata,\n error\n };\n}"]}
|
|
@@ -6,29 +6,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
6
6
|
|
|
7
7
|
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
8
8
|
|
|
9
|
-
// src/new/
|
|
10
|
-
var MISSING_PROVIDER_MESSAGE = "No OsdkProvider2 found. Did you forget to wrap your component tree with <OsdkProvider2>?";
|
|
11
|
-
function fakeClientFn(..._args) {
|
|
12
|
-
throw new Error(MISSING_PROVIDER_MESSAGE);
|
|
13
|
-
}
|
|
14
|
-
var fakeClient = Object.assign(fakeClientFn, {
|
|
15
|
-
fetchMetadata: fakeClientFn
|
|
16
|
-
});
|
|
17
|
-
var fakeObservableClient = new Proxy({}, {
|
|
18
|
-
get(_target, prop) {
|
|
19
|
-
if (prop === Symbol.toPrimitive || prop === Symbol.toStringTag) {
|
|
20
|
-
return void 0;
|
|
21
|
-
}
|
|
22
|
-
return (..._args) => {
|
|
23
|
-
throw new Error(MISSING_PROVIDER_MESSAGE);
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
var OsdkContext2 = /* @__PURE__ */ React__default.default.createContext({
|
|
28
|
-
client: fakeClient,
|
|
29
|
-
observableClient: fakeObservableClient,
|
|
30
|
-
devtoolsEnabled: false
|
|
31
|
-
});
|
|
9
|
+
// src/new/makeExternalStore.ts
|
|
32
10
|
var __DEV__ = typeof process === "undefined" || process.env.NODE_ENV !== "production";
|
|
33
11
|
var OSDK_HOOK_METADATA = Symbol.for("__OSDK_HOOK_METADATA__");
|
|
34
12
|
var devToolsMetadata = __DEV__ ? (meta) => meta : (_meta) => void 0;
|
|
@@ -145,10 +123,9 @@ function makeExternalStoreAsync(createObservation, _metadata, initialValue) {
|
|
|
145
123
|
return store;
|
|
146
124
|
}
|
|
147
125
|
|
|
148
|
-
exports.OsdkContext2 = OsdkContext2;
|
|
149
126
|
exports.devToolsMetadata = devToolsMetadata;
|
|
150
127
|
exports.makeExternalStore = makeExternalStore;
|
|
151
128
|
exports.makeExternalStoreAsync = makeExternalStoreAsync;
|
|
152
129
|
exports.useDevToolsMetadata = useDevToolsMetadata;
|
|
153
|
-
//# sourceMappingURL=chunk-
|
|
154
|
-
//# sourceMappingURL=chunk-
|
|
130
|
+
//# sourceMappingURL=chunk-UKQGMTMG.cjs.map
|
|
131
|
+
//# sourceMappingURL=chunk-UKQGMTMG.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/new/makeExternalStore.ts"],"names":["React"],"mappings":";;;;;;;;;AAiBA,IAAM,UAAU,OAAO,OAAA,KAAY,WAAA,IAAe,OAAA,CAAQ,IAAI,QAAA,KAAa,YAAA;AACpE,IAAM,kBAAA,GAAqB,MAAA,CAAO,GAAA,CAAI,wBAAwB,CAAA;AAC9D,IAAM,gBAAA,GAAmB,OAAA,GAAU,CAAA,IAAA,KAAQ,IAAA,GAAO,CAAA,KAAA,KAAS;AAC3D,SAAS,mBAAA,CAAoB,eAAA,EAAiB,QAAA,EAAU,GAAA,EAAK;AAClE,EAAA,MAAM,GAAA,GAAMA,sBAAA,CAAM,MAAA,CAAO,IAAI,CAAA;AAC7B,EAAA,IAAI,eAAA,EAAiB;AACnB,IAAA,IAAI,IAAI,OAAA,IAAW,IAAA,IAAQ,GAAA,CAAI,OAAA,CAAQ,QAAQ,GAAA,EAAK;AAClD,MAAA,GAAA,CAAI,OAAA,GAAU;AAAA,QACZ,CAAC,kBAAkB,GAAG,IAAA;AAAA,QACtB,QAAA;AAAA,QACA;AAAA,OACF;AAAA,IACF;AAAA,EACF,CAAA,MAAA,IAAW,GAAA,CAAI,OAAA,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A,CAAoB,WAAA,EAAY;AAAA,MAClC;AAAA,IACF,CAAA;AAAA,EACF;AACA,EAAA,MAAM,KAAA,GAAQ;AAAA,IACZ,SAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,IAAI,OAAA,IAAW,aAAa,IAAA,EAAM;AAChC,IAAA,MAAA,CAAO,cAAA,CAAe,OAAO,kBAAA,EAAoB;AAAA,MAC/C,KAAA,EAAO,SAAA;AAAA,MACP,UAAA,EAAY;AAAA,KACb,CAAA;AAAA,EACH;AACA,EAAA,OAAO,KAAA;AACT","file":"chunk-UKQGMTMG.cjs","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 React from \"react\";\nconst __DEV__ = typeof process === \"undefined\" || process.env.NODE_ENV !== \"production\";\nexport const OSDK_HOOK_METADATA = Symbol.for(\"__OSDK_HOOK_METADATA__\");\nexport const devToolsMetadata = __DEV__ ? meta => meta : _meta => undefined;\nexport function useDevToolsMetadata(devtoolsEnabled, hookType, key) {\n const ref = React.useRef(null);\n if (devtoolsEnabled) {\n if (ref.current == null || ref.current.key !== key) {\n ref.current = {\n [OSDK_HOOK_METADATA]: true,\n hookType,\n key\n };\n }\n } else if (ref.current != null) {\n ref.current = null;\n }\n}\nexport function makeExternalStore(createObservation, _metadata, initialValue) {\n let lastResult = initialValue;\n function getSnapShot() {\n return lastResult;\n }\n function subscribe(notifyUpdate) {\n const obs = createObservation({\n next: payload => {\n lastResult = payload;\n notifyUpdate();\n },\n error: error => {\n lastResult = {\n ...(lastResult ?? {}),\n error: error instanceof Error ? error : new Error(String(error))\n };\n notifyUpdate();\n },\n complete: () => {}\n });\n return () => {\n obs.unsubscribe();\n };\n }\n const store = {\n subscribe,\n getSnapShot\n };\n if (__DEV__ && _metadata != null) {\n Object.defineProperty(store, OSDK_HOOK_METADATA, {\n value: _metadata,\n enumerable: false\n });\n }\n return store;\n}\n\n/**\n * Like makeExternalStore but for async subscription creation.\n *\n * Uses an isActive flag to handle race conditions:\n * If cleanup runs before promise resolves, the stale subscription is\n * immediately unsubscribed when it eventually resolves\n */\nexport function makeExternalStoreAsync(createObservation, _metadata, initialValue) {\n let lastResult = initialValue;\n function getSnapShot() {\n return lastResult;\n }\n function subscribe(notifyUpdate) {\n let isActive = true;\n let currentSubscription;\n const subscriptionPromise = createObservation({\n next: payload => {\n if (isActive) {\n lastResult = payload;\n notifyUpdate();\n }\n },\n error: error => {\n if (isActive) {\n lastResult = {\n ...(lastResult ?? {}),\n error: error instanceof Error ? error : new Error(String(error))\n };\n notifyUpdate();\n }\n },\n complete: () => {}\n });\n subscriptionPromise.then(sub => {\n if (isActive) {\n currentSubscription = sub;\n } else {\n sub.unsubscribe();\n }\n }).catch(error => {\n if (isActive) {\n lastResult = {\n ...(lastResult ?? {}),\n error: error instanceof Error ? error : new Error(String(error))\n };\n notifyUpdate();\n }\n });\n return () => {\n isActive = false;\n if (currentSubscription) {\n currentSubscription.unsubscribe();\n }\n };\n }\n const store = {\n subscribe,\n getSnapShot\n };\n if (__DEV__ && _metadata != null) {\n Object.defineProperty(store, OSDK_HOOK_METADATA, {\n value: _metadata,\n enumerable: false\n });\n }\n return store;\n}"]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkMERQDEQC_cjs = require('./chunk-MERQDEQC.cjs');
|
|
4
|
+
require('./chunk-2Y5CIQPC.cjs');
|
|
4
5
|
var React = require('react');
|
|
5
6
|
|
|
6
7
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -11,7 +12,7 @@ function OsdkProvider({
|
|
|
11
12
|
children,
|
|
12
13
|
client
|
|
13
14
|
}) {
|
|
14
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
15
|
+
return /* @__PURE__ */ React__default.default.createElement(chunkMERQDEQC_cjs.OsdkContext.Provider, {
|
|
15
16
|
value: {
|
|
16
17
|
client
|
|
17
18
|
}
|
|
@@ -20,11 +21,11 @@ function OsdkProvider({
|
|
|
20
21
|
|
|
21
22
|
Object.defineProperty(exports, "useOsdkClient", {
|
|
22
23
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
24
|
+
get: function () { return chunkMERQDEQC_cjs.useOsdkClient; }
|
|
24
25
|
});
|
|
25
26
|
Object.defineProperty(exports, "useOsdkMetadata", {
|
|
26
27
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
28
|
+
get: function () { return chunkMERQDEQC_cjs.useOsdkMetadata; }
|
|
28
29
|
});
|
|
29
30
|
exports.OsdkProvider = OsdkProvider;
|
|
30
31
|
//# sourceMappingURL=index.cjs.map
|
package/build/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/OsdkProvider.tsx"],"names":["React","OsdkContext"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../src/OsdkProvider.tsx"],"names":["React","OsdkContext"],"mappings":";;;;;;;;;;AAkBO,SAAS,YAAA,CAAa;AAAA,EAC3B,QAAA;AAAA,EACA;AACF,CAAA,EAAG;AACD,EAAA,uBAAoBA,sBAAA,CAAM,aAAA,CAAcC,6BAAA,CAAY,QAAA,EAAU;AAAA,IAC5D,KAAA,EAAO;AAAA,MACL;AAAA;AACF,KACC,QAAQ,CAAA;AACb","file":"index.cjs","sourcesContent":["/*\n * Copyright 2024 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 React from \"react\";\nimport { OsdkContext } from \"./OsdkContext.js\";\nexport function OsdkProvider({\n children,\n client\n}) {\n return /*#__PURE__*/React.createElement(OsdkContext.Provider, {\n value: {\n client\n }\n }, children);\n}"]}
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Client } from '@osdk/client';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
export { u as useOsdkClient, a as useOsdkMetadata } from './useOsdkMetadata-
|
|
3
|
+
export { u as useOsdkClient, a as useOsdkMetadata } from './useOsdkMetadata-CRTcdg-a.cjs';
|
|
4
4
|
import '@osdk/api';
|
|
5
5
|
|
|
6
6
|
declare function OsdkProvider({ children, client, }: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkUKQGMTMG_cjs = require('../../chunk-UKQGMTMG.cjs');
|
|
4
|
+
var chunk2Y5CIQPC_cjs = require('../../chunk-2Y5CIQPC.cjs');
|
|
4
5
|
var foundry_admin = require('@osdk/foundry.admin');
|
|
5
6
|
var React = require('react');
|
|
6
7
|
|
|
@@ -35,15 +36,15 @@ function usePlatformQuery({
|
|
|
35
36
|
getSnapShot
|
|
36
37
|
} = React__default.default.useMemo(() => {
|
|
37
38
|
if (!enabled) {
|
|
38
|
-
return
|
|
39
|
+
return chunkUKQGMTMG_cjs.makeExternalStore(() => ({
|
|
39
40
|
unsubscribe: () => {
|
|
40
41
|
}
|
|
41
|
-
}),
|
|
42
|
+
}), chunkUKQGMTMG_cjs.devToolsMetadata({
|
|
42
43
|
hookType: "usePlatformQuery",
|
|
43
44
|
objectType: queryName
|
|
44
45
|
}));
|
|
45
46
|
}
|
|
46
|
-
return
|
|
47
|
+
return chunkUKQGMTMG_cjs.makeExternalStore((observer) => {
|
|
47
48
|
observerRef.current = observer;
|
|
48
49
|
handleQuery();
|
|
49
50
|
return {
|
|
@@ -51,7 +52,7 @@ function usePlatformQuery({
|
|
|
51
52
|
observerRef.current = void 0;
|
|
52
53
|
}
|
|
53
54
|
};
|
|
54
|
-
},
|
|
55
|
+
}, chunkUKQGMTMG_cjs.devToolsMetadata({
|
|
55
56
|
hookType: "usePlatformQuery",
|
|
56
57
|
objectType: queryName
|
|
57
58
|
}));
|
|
@@ -78,7 +79,7 @@ function useCbacBanner({
|
|
|
78
79
|
}) {
|
|
79
80
|
const {
|
|
80
81
|
client
|
|
81
|
-
} = React__default.default.useContext(
|
|
82
|
+
} = React__default.default.useContext(chunk2Y5CIQPC_cjs.OsdkContext2);
|
|
82
83
|
const stableMarkingIds = React__default.default.useMemo(() => markingIds, [JSON.stringify(markingIds)]);
|
|
83
84
|
const enabled = stableMarkingIds.length > 0 && externalEnabled;
|
|
84
85
|
const handleQuery = React__default.default.useCallback(() => {
|
|
@@ -116,7 +117,7 @@ function useCbacMarkingRestrictions({
|
|
|
116
117
|
}) {
|
|
117
118
|
const {
|
|
118
119
|
client
|
|
119
|
-
} = React__default.default.useContext(
|
|
120
|
+
} = React__default.default.useContext(chunk2Y5CIQPC_cjs.OsdkContext2);
|
|
120
121
|
const stableMarkingIds = React__default.default.useMemo(() => markingIds, [JSON.stringify(markingIds)]);
|
|
121
122
|
const enabled = stableMarkingIds.length > 0 && externalEnabled;
|
|
122
123
|
const handleQuery = React__default.default.useCallback(() => {
|
|
@@ -154,7 +155,7 @@ function useCurrentFoundryUser({
|
|
|
154
155
|
} = {}) {
|
|
155
156
|
const {
|
|
156
157
|
client
|
|
157
|
-
} = React__default.default.useContext(
|
|
158
|
+
} = React__default.default.useContext(chunk2Y5CIQPC_cjs.OsdkContext2);
|
|
158
159
|
const handleQuery = React__default.default.useCallback(() => foundry_admin.Users.getCurrent(client), [client]);
|
|
159
160
|
const query = usePlatformQuery({
|
|
160
161
|
query: handleQuery,
|
|
@@ -174,7 +175,7 @@ function useFoundryUser(userId, {
|
|
|
174
175
|
} = {}) {
|
|
175
176
|
const {
|
|
176
177
|
client
|
|
177
|
-
} = React__default.default.useContext(
|
|
178
|
+
} = React__default.default.useContext(chunk2Y5CIQPC_cjs.OsdkContext2);
|
|
178
179
|
const handleQuery = React__default.default.useCallback(() => {
|
|
179
180
|
return foundry_admin.Users.get(client, userId, {
|
|
180
181
|
status
|
|
@@ -200,7 +201,7 @@ function useFoundryUsersList({
|
|
|
200
201
|
} = {}) {
|
|
201
202
|
const {
|
|
202
203
|
client
|
|
203
|
-
} = React__default.default.useContext(
|
|
204
|
+
} = React__default.default.useContext(chunk2Y5CIQPC_cjs.OsdkContext2);
|
|
204
205
|
const handleQuery = React__default.default.useCallback(() => {
|
|
205
206
|
return foundry_admin.Users.list(client, {
|
|
206
207
|
include,
|
|
@@ -226,7 +227,7 @@ function useMarkingCategories({
|
|
|
226
227
|
} = {}) {
|
|
227
228
|
const {
|
|
228
229
|
client
|
|
229
|
-
} = React__default.default.useContext(
|
|
230
|
+
} = React__default.default.useContext(chunk2Y5CIQPC_cjs.OsdkContext2);
|
|
230
231
|
const handleQuery = React__default.default.useCallback(() => {
|
|
231
232
|
return foundry_admin.MarkingCategories.list(client);
|
|
232
233
|
}, [client]);
|
|
@@ -247,7 +248,7 @@ function useMarkings({
|
|
|
247
248
|
} = {}) {
|
|
248
249
|
const {
|
|
249
250
|
client
|
|
250
|
-
} = React__default.default.useContext(
|
|
251
|
+
} = React__default.default.useContext(chunk2Y5CIQPC_cjs.OsdkContext2);
|
|
251
252
|
const handleQuery = React__default.default.useCallback(() => {
|
|
252
253
|
return foundry_admin.Markings.list(client);
|
|
253
254
|
}, [client]);
|
|
@@ -269,7 +270,7 @@ function useUserViewMarkings({
|
|
|
269
270
|
} = {}) {
|
|
270
271
|
const {
|
|
271
272
|
client
|
|
272
|
-
} = React__default.default.useContext(
|
|
273
|
+
} = React__default.default.useContext(chunk2Y5CIQPC_cjs.OsdkContext2);
|
|
273
274
|
const handleQuery = React__default.default.useCallback(async () => {
|
|
274
275
|
const resolvedUserId = userId ?? (await foundry_admin.Users.getCurrent(client)).id;
|
|
275
276
|
return foundry_admin.Users.getMarkings(client, resolvedUserId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/utils/usePlatformQuery.ts","../../../../src/new/platform-apis/admin/useCbacBanner.ts","../../../../src/new/platform-apis/admin/useCbacMarkingRestrictions.ts","../../../../src/new/platform-apis/admin/useCurrentFoundryUser.ts","../../../../src/new/platform-apis/admin/useFoundryUser.ts","../../../../src/new/platform-apis/admin/useFoundryUsersList.ts","../../../../src/new/platform-apis/admin/useMarkingCategories.ts","../../../../src/new/platform-apis/admin/useMarkings.ts","../../../../src/new/platform-apis/admin/useUserMarkings.ts"],"names":["React","makeExternalStore","devToolsMetadata","OsdkContext2","CbacBanners","CbacMarkingRestrictionsObjects","Users","MarkingCategories","Markings"],"mappings":";;;;;;;;;;AAkBO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,KAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA,GAAU;AACZ,CAAA,EAAG;AACD,EAAA,MAAM,WAAA,GAAcA,uBAAM,MAAA,EAAO;AACjC,EAAA,MAAM,WAAA,GAAcA,sBAAA,CAAM,WAAA,CAAY,MAAM;AAC1C,IAAA,MAAM,WAAW,WAAA,CAAY,OAAA;AAC7B,IAAA,IAAI,YAAY,IAAA,EAAM;AACtB,IAAA,QAAA,CAAS,IAAA,CAAK;AAAA,MACZ,MAAA,EAAQ,SAAA;AAAA,MACR,IAAA,EAAM;AAAA,KACP,CAAA;AACD,IAAA,KAAA,EAAM,CAAE,KAAK,CAAA,IAAA,KAAQ;AACnB,MAAA,QAAA,CAAS,IAAA,CAAK;AAAA,QACZ,MAAA,EAAQ,SAAA;AA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jB,OAAO,KAAA,CAAM,KAAA;AAAA,IACb,SAAS,KAAA,CAAM;AAAA,GACjB;AACF","file":"admin.cjs","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 React from \"react\";\nimport { devToolsMetadata, makeExternalStore } from \"../new/makeExternalStore.js\";\nexport function usePlatformQuery({\n query,\n queryName,\n enabled = true\n}) {\n const observerRef = React.useRef();\n const handleQuery = React.useCallback(() => {\n const observer = observerRef.current;\n if (observer == null) return;\n observer.next({\n status: \"loading\",\n data: undefined\n });\n query().then(data => {\n observer.next({\n status: \"success\",\n data\n });\n }).catch(err => {\n observer.error(err);\n });\n }, [query]);\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), devToolsMetadata({\n hookType: \"usePlatformQuery\",\n objectType: queryName\n }));\n }\n return makeExternalStore(observer => {\n observerRef.current = observer;\n handleQuery();\n return {\n unsubscribe: () => {\n observerRef.current = undefined;\n }\n };\n }, devToolsMetadata({\n hookType: \"usePlatformQuery\",\n objectType: queryName\n }));\n }, [enabled, queryName, handleQuery]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n let error;\n if (payload && \"error\" in payload && payload.error != null) {\n error = payload.error;\n } else if (payload?.status === \"error\") {\n error = new Error(`Failed to query platform API: ${queryName}`);\n }\n return {\n data: payload?.data,\n isLoading: enabled ? payload?.status === \"loading\" || !payload : false,\n error,\n refetch: handleQuery\n };\n}","/*\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 { CbacBanners } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Get the CBAC banner data for the given marking IDs.\n * @param options Options to control the query.\n */\nexport function useCbacBanner({\n markingIds,\n enabled: externalEnabled = true\n}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const stableMarkingIds = React.useMemo(() => markingIds, [JSON.stringify(markingIds)]);\n const enabled = stableMarkingIds.length > 0 && externalEnabled;\n const handleQuery = React.useCallback(() => {\n return CbacBanners.get(client, {\n markingIds: stableMarkingIds,\n preview: true\n });\n }, [client, stableMarkingIds]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"cbac-banner\"\n });\n const banner = React.useMemo(() => {\n if (query.data == null) {\n return undefined;\n }\n return {\n classificationString: query.data.classificationString,\n textColor: query.data.textColor,\n backgroundColors: query.data.backgroundColors,\n markingIds: query.data.markings\n };\n }, [query.data]);\n return {\n banner,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { CbacMarkingRestrictionsObjects } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Get CBAC marking restrictions (implied, disallowed, required) for the given marking IDs.\n * @param options Options to control the query.\n */\nexport function useCbacMarkingRestrictions({\n markingIds,\n enabled: externalEnabled = true\n}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const stableMarkingIds = React.useMemo(() => markingIds, [JSON.stringify(markingIds)]);\n const enabled = stableMarkingIds.length > 0 && externalEnabled;\n const handleQuery = React.useCallback(() => {\n return CbacMarkingRestrictionsObjects.get(client, {\n markingIds: stableMarkingIds,\n preview: true\n });\n }, [client, stableMarkingIds]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"cbac-marking-restrictions\"\n });\n const restrictions = React.useMemo(() => {\n if (query.data == null) {\n return undefined;\n }\n return {\n disallowedMarkings: query.data.disallowedMarkings.map(String),\n impliedMarkings: query.data.impliedMarkings.map(String),\n requiredMarkings: query.data.requiredMarkings.map(group => group.map(String)),\n userSatisfiesMarkings: query.data.userSatisfiesMarkings,\n isValid: query.data.isValid\n };\n }, [query.data]);\n return {\n restrictions,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { Users } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Get the currently signed in User.\n * @param options Options to control the query.\n */\nexport function useCurrentFoundryUser({\n enabled = true\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => Users.getCurrent(client), [client]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"foundry-current-user\"\n });\n return {\n currentUser: query.data,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { Users } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Get the User with the specified id.\n * @param userId A Foundry User ID.\n * @param options Options to control the query.\n */\nexport function useFoundryUser(userId, {\n enabled = true,\n status = \"ACTIVE\"\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => {\n return Users.get(client, userId, {\n status\n });\n }, [client, userId, status]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"foundry-user\"\n });\n return {\n user: query.data,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { Users } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Lists all Users. This is a paged endpoint. Each page may be smaller or larger than the requested page size.\n * @param options Options to control the query.\n */\nexport function useFoundryUsersList({\n enabled = true,\n include = \"ACTIVE\",\n pageSize = 1000,\n pageToken\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => {\n return Users.list(client, {\n include,\n pageSize,\n pageToken\n });\n }, [client, include, pageSize, pageToken]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"foundry-users-list\"\n });\n return {\n users: query.data?.data,\n nextPageToken: query.data?.nextPageToken,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { MarkingCategories } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * List all marking categories.\n * @param options Options to control the query.\n */\nexport function useMarkingCategories({\n enabled = true\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => {\n return MarkingCategories.list(client);\n }, [client]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"marking-categories\"\n });\n return {\n categories: query.data?.data,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { Markings } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * List all markings.\n * @param options Options to control the query.\n */\nexport function useMarkings({\n enabled = true\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => {\n return Markings.list(client);\n }, [client]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"markings\"\n });\n return {\n markings: query.data?.data,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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/**\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,\n enabled = true\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(async () => {\n const resolvedUserId = userId ?? (await Users.getCurrent(client)).id;\n return Users.getMarkings(client, resolvedUserId);\n }, [client, userId]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"user-view-markings\"\n });\n return {\n markingIds: query.data?.view,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/usePlatformQuery.ts","../../../../src/new/platform-apis/admin/useCbacBanner.ts","../../../../src/new/platform-apis/admin/useCbacMarkingRestrictions.ts","../../../../src/new/platform-apis/admin/useCurrentFoundryUser.ts","../../../../src/new/platform-apis/admin/useFoundryUser.ts","../../../../src/new/platform-apis/admin/useFoundryUsersList.ts","../../../../src/new/platform-apis/admin/useMarkingCategories.ts","../../../../src/new/platform-apis/admin/useMarkings.ts","../../../../src/new/platform-apis/admin/useUserMarkings.ts"],"names":["React","makeExternalStore","devToolsMetadata","OsdkContext2","CbacBanners","CbacMarkingRestrictionsObjects","Users","MarkingCategories","Markings"],"mappings":";;;;;;;;;;;AAkBO,SAAS,gBAAA,CAAiB;AAAA,EAC/B,KAAA;AAAA,EACA,SAAA;AAAA,EACA,OAAA,GAAU;AACZ,CAAA,EAAG;AACD,EAAA,MAAM,WAAA,GAAcA,uBAAM,MAAA,EAAO;AACjC,EAAA,MAAM,WAAA,GAAcA,sBAAA,CAAM,WAAA,CAAY,MAAM;AAC1C,IAAA,MAAM,WAAW,WAAA,CAAY,OAAA;AAC7B,IAAA,IAAI,YAAY,IAAA,EAAM;AACtB,IAAA,QAAA,CAAS,IAAA,CAAK;AAAA,MACZ,MAAA,EAAQ,SAAA;AAAA,MACR,IAAA,EAAM;AA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SAAA,EAAW;AAAA,GACZ,CAAA;AACD,EAAA,OAAO;AAAA,IACL,UAAA,EAAY,MAAM,IAAA,EAAM,IAAA;AAAA,IACxB,WAAW,KAAA,CAAM,SAAA;AAAA,IACjB,OAAO,KAAA,CAAM,KAAA;AAAA,IACb,SAAS,KAAA,CAAM;AAAA,GACjB;AACF","file":"admin.cjs","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 React from \"react\";\nimport { devToolsMetadata, makeExternalStore } from \"../new/makeExternalStore.js\";\nexport function usePlatformQuery({\n query,\n queryName,\n enabled = true\n}) {\n const observerRef = React.useRef();\n const handleQuery = React.useCallback(() => {\n const observer = observerRef.current;\n if (observer == null) return;\n observer.next({\n status: \"loading\",\n data: undefined\n });\n query().then(data => {\n observer.next({\n status: \"success\",\n data\n });\n }).catch(err => {\n observer.error(err);\n });\n }, [query]);\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), devToolsMetadata({\n hookType: \"usePlatformQuery\",\n objectType: queryName\n }));\n }\n return makeExternalStore(observer => {\n observerRef.current = observer;\n handleQuery();\n return {\n unsubscribe: () => {\n observerRef.current = undefined;\n }\n };\n }, devToolsMetadata({\n hookType: \"usePlatformQuery\",\n objectType: queryName\n }));\n }, [enabled, queryName, handleQuery]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n let error;\n if (payload && \"error\" in payload && payload.error != null) {\n error = payload.error;\n } else if (payload?.status === \"error\") {\n error = new Error(`Failed to query platform API: ${queryName}`);\n }\n return {\n data: payload?.data,\n isLoading: enabled ? payload?.status === \"loading\" || !payload : false,\n error,\n refetch: handleQuery\n };\n}","/*\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 { CbacBanners } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Get the CBAC banner data for the given marking IDs.\n * @param options Options to control the query.\n */\nexport function useCbacBanner({\n markingIds,\n enabled: externalEnabled = true\n}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const stableMarkingIds = React.useMemo(() => markingIds, [JSON.stringify(markingIds)]);\n const enabled = stableMarkingIds.length > 0 && externalEnabled;\n const handleQuery = React.useCallback(() => {\n return CbacBanners.get(client, {\n markingIds: stableMarkingIds,\n preview: true\n });\n }, [client, stableMarkingIds]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"cbac-banner\"\n });\n const banner = React.useMemo(() => {\n if (query.data == null) {\n return undefined;\n }\n return {\n classificationString: query.data.classificationString,\n textColor: query.data.textColor,\n backgroundColors: query.data.backgroundColors,\n markingIds: query.data.markings\n };\n }, [query.data]);\n return {\n banner,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { CbacMarkingRestrictionsObjects } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Get CBAC marking restrictions (implied, disallowed, required) for the given marking IDs.\n * @param options Options to control the query.\n */\nexport function useCbacMarkingRestrictions({\n markingIds,\n enabled: externalEnabled = true\n}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const stableMarkingIds = React.useMemo(() => markingIds, [JSON.stringify(markingIds)]);\n const enabled = stableMarkingIds.length > 0 && externalEnabled;\n const handleQuery = React.useCallback(() => {\n return CbacMarkingRestrictionsObjects.get(client, {\n markingIds: stableMarkingIds,\n preview: true\n });\n }, [client, stableMarkingIds]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"cbac-marking-restrictions\"\n });\n const restrictions = React.useMemo(() => {\n if (query.data == null) {\n return undefined;\n }\n return {\n disallowedMarkings: query.data.disallowedMarkings.map(String),\n impliedMarkings: query.data.impliedMarkings.map(String),\n requiredMarkings: query.data.requiredMarkings.map(group => group.map(String)),\n userSatisfiesMarkings: query.data.userSatisfiesMarkings,\n isValid: query.data.isValid\n };\n }, [query.data]);\n return {\n restrictions,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { Users } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Get the currently signed in User.\n * @param options Options to control the query.\n */\nexport function useCurrentFoundryUser({\n enabled = true\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => Users.getCurrent(client), [client]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"foundry-current-user\"\n });\n return {\n currentUser: query.data,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { Users } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Get the User with the specified id.\n * @param userId A Foundry User ID.\n * @param options Options to control the query.\n */\nexport function useFoundryUser(userId, {\n enabled = true,\n status = \"ACTIVE\"\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => {\n return Users.get(client, userId, {\n status\n });\n }, [client, userId, status]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"foundry-user\"\n });\n return {\n user: query.data,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { Users } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * Lists all Users. This is a paged endpoint. Each page may be smaller or larger than the requested page size.\n * @param options Options to control the query.\n */\nexport function useFoundryUsersList({\n enabled = true,\n include = \"ACTIVE\",\n pageSize = 1000,\n pageToken\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => {\n return Users.list(client, {\n include,\n pageSize,\n pageToken\n });\n }, [client, include, pageSize, pageToken]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"foundry-users-list\"\n });\n return {\n users: query.data?.data,\n nextPageToken: query.data?.nextPageToken,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { MarkingCategories } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * List all marking categories.\n * @param options Options to control the query.\n */\nexport function useMarkingCategories({\n enabled = true\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => {\n return MarkingCategories.list(client);\n }, [client]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"marking-categories\"\n });\n return {\n categories: query.data?.data,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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 { Markings } from \"@osdk/foundry.admin\";\nimport React from \"react\";\nimport { usePlatformQuery } from \"../../../utils/usePlatformQuery.js\";\nimport { OsdkContext2 } from \"../../OsdkContext2.js\";\n/**\n * List all markings.\n * @param options Options to control the query.\n */\nexport function useMarkings({\n enabled = true\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(() => {\n return Markings.list(client);\n }, [client]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"markings\"\n });\n return {\n markings: query.data?.data,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}","/*\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/**\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,\n enabled = true\n} = {}) {\n const {\n client\n } = React.useContext(OsdkContext2);\n const handleQuery = React.useCallback(async () => {\n const resolvedUserId = userId ?? (await Users.getCurrent(client)).id;\n return Users.getMarkings(client, resolvedUserId);\n }, [client, userId]);\n const query = usePlatformQuery({\n query: handleQuery,\n enabled,\n queryName: \"user-view-markings\"\n });\n return {\n markingIds: query.data?.view,\n isLoading: query.isLoading,\n error: query.error,\n refetch: query.refetch\n };\n}"]}
|