@osdk/react 0.9.0-rc.11 → 0.10.0-beta.2
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 +9 -25
- package/build/browser/intellisense.test.helpers/useOsdkObjectsWithProperties.js +1 -1
- package/build/browser/intellisense.test.helpers/useOsdkObjectsWithProperties.js.map +1 -1
- package/build/browser/new/useOsdkFunction.js +7 -4
- package/build/browser/new/useOsdkFunction.js.map +1 -1
- package/build/cjs/{chunk-V32JHU3O.cjs → chunk-OVBG5VXE.cjs} +3 -8
- package/build/cjs/chunk-OVBG5VXE.cjs.map +1 -0
- package/build/cjs/index.cjs +4 -4
- package/build/cjs/public/experimental.cjs +14 -154
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.d.cts +10 -4
- package/build/esm/intellisense.test.helpers/useOsdkObjectsWithProperties.js +1 -1
- package/build/esm/intellisense.test.helpers/useOsdkObjectsWithProperties.js.map +1 -1
- package/build/esm/new/useOsdkFunction.js +7 -4
- package/build/esm/new/useOsdkFunction.js.map +1 -1
- package/build/types/new/useOsdkFunction.d.ts +11 -5
- package/build/types/new/useOsdkFunction.d.ts.map +1 -1
- package/package.json +18 -8
- package/build/cjs/chunk-V32JHU3O.cjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
# @osdkkit/react
|
|
2
2
|
|
|
3
|
-
## 0.
|
|
3
|
+
## 0.10.0-beta.2
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0d174a2: useOsdkFunction typing updates
|
|
4
8
|
|
|
5
9
|
### Patch Changes
|
|
6
10
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- Updated dependencies [eb3a556]
|
|
12
|
-
- Updated dependencies [31cd835]
|
|
13
|
-
- Updated dependencies [0dbd0d0]
|
|
14
|
-
- @osdk/client@2.7.0-rc.15
|
|
15
|
-
- @osdk/api@2.7.0-rc.15
|
|
11
|
+
- Updated dependencies [26cec61]
|
|
12
|
+
- Updated dependencies [0d174a2]
|
|
13
|
+
- @osdk/client@2.8.0-beta.3
|
|
14
|
+
- @osdk/api@2.8.0-beta.3
|
|
16
15
|
|
|
17
16
|
## 0.9.0-beta.10
|
|
18
17
|
|
|
@@ -132,21 +131,6 @@
|
|
|
132
131
|
- @osdk/client@2.7.0-beta.2
|
|
133
132
|
- @osdk/api@2.7.0-beta.2
|
|
134
133
|
|
|
135
|
-
## 0.8.0
|
|
136
|
-
|
|
137
|
-
### Patch Changes
|
|
138
|
-
|
|
139
|
-
- 322c5bc: Simulated release
|
|
140
|
-
- 13f229d: preserve object set data on rid change
|
|
141
|
-
- c5a3815: Add new auto fetch more behavior to useOsdkObjects
|
|
142
|
-
- 4b13323: update OSDK toolkit docs
|
|
143
|
-
- 9961f06: fix order by via key stabilization
|
|
144
|
-
- e7bf02a: Add RDP support to React toolkit
|
|
145
|
-
- af4f3bf: Remove the following features for RC:
|
|
146
|
-
- Property formatting
|
|
147
|
-
- Branching
|
|
148
|
-
- Constant RDPs
|
|
149
|
-
|
|
150
134
|
## 0.8.0-beta.5
|
|
151
135
|
|
|
152
136
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObjectsWithProperties.js","names":["Employee","useOsdkObjects","TestComponent","data","withProperties","constantValue","employee","
|
|
1
|
+
{"version":3,"file":"useOsdkObjectsWithProperties.js","names":["Employee","useOsdkObjects","TestComponent","data","withProperties","constantValue","employee","constant","integer"],"sources":["useOsdkObjectsWithProperties.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\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction TestComponent() {\n const withProps: DerivedProperty.Clause<typeof Employee> = {\n constantValue: (employee) => employee.constant.integer(42),\n };\n\n const { data } = useOsdkObjects(Employee, {\n withProperties: withProps,\n });\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AACrD,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,SAASC,aAAaA,CAAA,EAAG;EAKvB,MAAM;IAAEC;EAAK,CAAC,GAAGF,cAAc,CAACD,QAAQ,EAAE;IACxCI,cAAc,EAL2C;MACzDC,aAAa,EAAGC,QAAQ,IAAKA,QAAQ,CAACC,QAAQ,CAACC,OAAO,CAAC,EAAE;IAC3D;EAIA,CAAC,CAAC;EAEF,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { getWireObjectSet } from "@osdk/client/unstable-do-not-use";
|
|
17
18
|
import React from "react";
|
|
18
19
|
import { makeExternalStore } from "./makeExternalStore.js";
|
|
19
20
|
import { OsdkContext2 } from "./OsdkContext2.js";
|
|
@@ -63,10 +64,12 @@ export function useOsdkFunction(queryDef, options = {}) {
|
|
|
63
64
|
} = options;
|
|
64
65
|
const stableParams = React.useMemo(() => params, [JSON.stringify(params)]);
|
|
65
66
|
const stableDependsOn = React.useMemo(() => dependsOn, [JSON.stringify(dependsOn?.map(d => typeof d === "string" ? d : d.apiName))]);
|
|
66
|
-
const stableDependsOnObjects = React.useMemo(() => dependsOnObjects, [JSON.stringify(dependsOnObjects?.map(
|
|
67
|
-
$apiName:
|
|
68
|
-
$primaryKey:
|
|
69
|
-
}
|
|
67
|
+
const stableDependsOnObjects = React.useMemo(() => dependsOnObjects, [JSON.stringify(dependsOnObjects?.map(item => "$apiName" in item ? {
|
|
68
|
+
$apiName: item.$apiName,
|
|
69
|
+
$primaryKey: item.$primaryKey
|
|
70
|
+
} : {
|
|
71
|
+
__objectSet: getWireObjectSet(item)
|
|
72
|
+
}))]);
|
|
70
73
|
|
|
71
74
|
// Record<string, unknown> required as typing is figured out at runtime
|
|
72
75
|
const paramsForApi = stableParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkFunction.js","names":["React","makeExternalStore","OsdkContext2","useOsdkFunction","queryDef","options","observableClient","useContext","params","dependsOn","dependsOnObjects","dedupeIntervalMs","enabled","stableParams","useMemo","JSON","stringify","stableDependsOn","map","d","apiName","stableDependsOnObjects","o","$apiName","$primaryKey","paramsForApi","subscribe","getSnapShot","unsubscribe","process","env","NODE_ENV","observer","observeFunction","dedupeInterval","version","payload","useSyncExternalStore","error","status","Error","undefined","refetch","useCallback","invalidateFunction","data","result","isLoading","lastUpdated"],"sources":["useOsdkFunction.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n ObjectTypeDefinition,\n Osdk,\n QueryDefinition,\n} from \"@osdk/api\";\nimport type {\n ObserveFunctionCallbackArgs,\n QueryParameterType,\n QueryReturnType,\n} from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkFunctionOptions<Q extends QueryDefinition<unknown>> {\n /**\n * Parameters to pass to the function.\n * Must include all required parameters; optional parameters can be omitted.\n */\n params?: CompileTimeMetadata<Q>[\"parameters\"] extends Record<string, never>\n ? undefined\n : QueryParameterType<CompileTimeMetadata<Q>[\"parameters\"]>;\n\n /**\n * Object types this function depends on.\n * When actions modify objects of these types, the function will automatically refetch.\n *\n * @example\n * ```tsx\n * // Refetch when any Employee object changes\n * { dependsOn: [Employee] }\n * ```\n */\n dependsOn?: Array<ObjectTypeDefinition | string>;\n\n /**\n * Specific object instances this function depends on.\n * When any of these specific objects change, the function will refetch.\n * More fine-grained than dependsOn for precise invalidation control.\n *\n * @example\n * ```tsx\n * // Refetch when this specific employee changes\n * { dependsOnObjects: [employee] }\n * ```\n */\n dependsOnObjects?: Array<Osdk.Instance<ObjectTypeDefinition>>;\n\n /**\n * The number of milliseconds to dedupe identical function calls.\n * Two calls with the same function and params will share results\n * if the second call is within this interval of the first.\n * @default 2000\n */\n dedupeIntervalMs?: number;\n\n /**\n * Whether to enable the query. When false, the query will not execute.\n * Useful for:\n * - Dependent queries that need to wait for other data\n * - Conditional queries based on component state\n *\n * @default true\n * @example\n * // Dependent query - wait for required data\n * const { data: employee } = useOsdkObject(Employee, employeeId);\n * const { data: report } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee?.$primaryKey },\n * enabled: !!employee\n * });\n */\n enabled?: boolean;\n}\n\nexport interface UseOsdkFunctionResult<Q extends QueryDefinition<unknown>> {\n /**\n * The function result, or undefined if not yet loaded or on error.\n */\n data: QueryReturnType<CompileTimeMetadata<Q>[\"output\"]> | undefined;\n\n /**\n * True while the function is executing.\n */\n isLoading: boolean;\n\n /**\n * Error if the function execution failed.\n */\n error: Error | undefined;\n\n /**\n * Timestamp (ms since epoch) of when the result was last fetched.\n */\n lastUpdated: number;\n\n /**\n * Manually refetch the function.\n * Useful for \"pull to refresh\" or retry patterns.\n */\n refetch: () => void;\n}\n\ndeclare const process: {\n env: {\n NODE_ENV: \"development\" | \"production\";\n };\n};\n\n/**\n * React hook for executing and observing OSDK functions.\n *\n * Provides automatic caching, deduplication, and reactive updates for function calls.\n * Functions are automatically re-fetched when dependencies change (configured via options).\n *\n * @param queryDef - The QueryDefinition to execute\n * @param options - Configuration options for the function call\n * @returns Object containing result, loading state, error, and refetch function\n *\n * @example Basic usage\n * ```tsx\n * const { data, isLoading, error } = useOsdkFunction(getEmployeeStats, {\n * params: { departmentId: \"engineering\" }\n * });\n * ```\n *\n * @example With dependency tracking\n * ```tsx\n * const { data, refetch } = useOsdkFunction(calculateMetrics, {\n * params: { startDate, endDate },\n * dependsOn: [Employee, Project],\n * });\n * ```\n *\n * @example With specific object dependencies\n * ```tsx\n * const { data } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee.$primaryKey },\n * dependsOnObjects: [employee],\n * });\n * ```\n */\nexport function useOsdkFunction<Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n options: UseOsdkFunctionOptions<Q> = {},\n): UseOsdkFunctionResult<Q> {\n const { observableClient } = React.useContext(OsdkContext2);\n const {\n params,\n dependsOn,\n dependsOnObjects,\n dedupeIntervalMs,\n enabled = true,\n } = options;\n\n const stableParams = React.useMemo(\n () => params,\n [JSON.stringify(params)],\n );\n const stableDependsOn = React.useMemo(\n () => dependsOn,\n [JSON.stringify(\n dependsOn?.map(d => typeof d === \"string\" ? d : d.apiName),\n )],\n );\n const stableDependsOnObjects = React.useMemo(\n () => dependsOnObjects,\n [JSON.stringify(\n dependsOnObjects?.map(o => ({\n $apiName: o.$apiName,\n $primaryKey: o.$primaryKey,\n })),\n )],\n );\n\n // Record<string, unknown> required as typing is figured out at runtime\n const paramsForApi = stableParams as Record<string, unknown> | undefined;\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<ObserveFunctionCallbackArgs<Q>>(\n () => ({ unsubscribe: () => {} }),\n process.env.NODE_ENV !== \"production\"\n ? `function ${queryDef.apiName} ${\n JSON.stringify(stableParams)\n } [DISABLED]`\n : void 0,\n );\n }\n return makeExternalStore<ObserveFunctionCallbackArgs<Q>>(\n (observer) =>\n observableClient.observeFunction(\n queryDef,\n paramsForApi,\n {\n dependsOn: stableDependsOn,\n dependsOnObjects: stableDependsOnObjects,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n },\n observer,\n ),\n process.env.NODE_ENV !== \"production\"\n ? `function ${queryDef.apiName} ${JSON.stringify(stableParams)}`\n : void 0,\n );\n },\n [\n observableClient,\n queryDef.apiName,\n queryDef.version,\n paramsForApi,\n stableDependsOn,\n stableDependsOnObjects,\n dedupeIntervalMs,\n enabled,\n ],\n );\n\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n const error = payload?.error\n ?? (payload?.status === \"error\"\n ? new Error(\"Failed to execute function\")\n : undefined);\n\n const refetch = React.useCallback(() => {\n void observableClient.invalidateFunction(queryDef, paramsForApi);\n }, [observableClient, queryDef, paramsForApi]);\n\n return {\n data: payload?.result as\n | QueryReturnType<CompileTimeMetadata<Q>[\"output\"]>\n | undefined,\n isLoading: payload?.status === \"loading\",\n error,\n lastUpdated: payload?.lastUpdated ?? 0,\n refetch,\n };\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;AAgGhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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ACxCD,KAAK;IACLU,WAAW,EAAEZ,OAAO,EAAEY,WAAW,IAAI,CAAC;IACtCN;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useOsdkFunction.js","names":["getWireObjectSet","React","makeExternalStore","OsdkContext2","useOsdkFunction","queryDef","options","observableClient","useContext","params","dependsOn","dependsOnObjects","dedupeIntervalMs","enabled","stableParams","useMemo","JSON","stringify","stableDependsOn","map","d","apiName","stableDependsOnObjects","item","$apiName","$primaryKey","__objectSet","paramsForApi","subscribe","getSnapShot","unsubscribe","process","env","NODE_ENV","observer","observeFunction","dedupeInterval","version","payload","useSyncExternalStore","error","status","Error","undefined","refetch","useCallback","invalidateFunction","data","result","isLoading","lastUpdated"],"sources":["useOsdkFunction.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n QueryDefinition,\n} from \"@osdk/api\";\nimport type {\n ObserveFunctionCallbackArgs,\n QueryParameterType,\n} from \"@osdk/client/unstable-do-not-use\";\nimport { getWireObjectSet } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkFunctionOptions<Q extends QueryDefinition<unknown>> {\n /**\n * Parameters to pass to the function.\n * Must include all required parameters; optional parameters can be omitted.\n */\n params?: CompileTimeMetadata<Q>[\"parameters\"] extends Record<string, never>\n ? undefined\n : QueryParameterType<CompileTimeMetadata<Q>[\"parameters\"]>;\n\n /**\n * Object types this function depends on.\n * When actions modify objects of these types, the function will automatically refetch.\n *\n * @example\n * ```tsx\n * // Refetch when any Employee object changes\n * { dependsOn: [Employee] }\n * ```\n */\n dependsOn?: Array<ObjectTypeDefinition | string>;\n\n /**\n * Specific object instances or ObjectSets this function depends on.\n * When any of these specific objects change, the function will refetch.\n * More fine-grained than dependsOn for precise invalidation control.\n *\n * For ObjectSets, the object type is extracted asynchronously and changes\n * to any object of that type will trigger a refetch.\n *\n * @example\n * ```tsx\n * // Refetch when this specific employee changes\n * { dependsOnObjects: [employee] }\n *\n * // Refetch when any object in the ObjectSet's type changes\n * { dependsOnObjects: [employeeObjectSet] }\n * ```\n */\n dependsOnObjects?: Array<\n Osdk.Instance<ObjectTypeDefinition> | ObjectSet<ObjectTypeDefinition>\n >;\n\n /**\n * The number of milliseconds to dedupe identical function calls.\n * Two calls with the same function and params will share results\n * if the second call is within this interval of the first.\n * @default 2000\n */\n dedupeIntervalMs?: number;\n\n /**\n * Whether to enable the query. When false, the query will not execute.\n * Useful for:\n * - Dependent queries that need to wait for other data\n * - Conditional queries based on component state\n *\n * @default true\n * @example\n * // Dependent query - wait for required data\n * const { data: employee } = useOsdkObject(Employee, employeeId);\n * const { data: report } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee?.$primaryKey },\n * enabled: !!employee\n * });\n */\n enabled?: boolean;\n}\n\nexport interface UseOsdkFunctionResult<Q extends QueryDefinition<unknown>> {\n /**\n * The function result, or undefined if not yet loaded or on error.\n */\n data:\n | (CompileTimeMetadata<Q>[\"signature\"] extends (...args: never[]) => infer R\n ? Awaited<R>\n : never)\n | undefined;\n\n /**\n * True while the function is executing.\n */\n isLoading: boolean;\n\n /**\n * Error if the function execution failed.\n */\n error: Error | undefined;\n\n /**\n * Timestamp (ms since epoch) of when the result was last fetched.\n */\n lastUpdated: number;\n\n /**\n * Manually refetch the function.\n * Useful for \"pull to refresh\" or retry patterns.\n */\n refetch: () => void;\n}\n\ndeclare const process: {\n env: {\n NODE_ENV: \"development\" | \"production\";\n };\n};\n\n/**\n * React hook for executing and observing OSDK functions.\n *\n * Provides automatic caching, deduplication, and reactive updates for function calls.\n * Functions are automatically re-fetched when dependencies change (configured via options).\n *\n * @param queryDef - The QueryDefinition to execute\n * @param options - Configuration options for the function call\n * @returns Object containing result, loading state, error, and refetch function\n *\n * @example Basic usage\n * ```tsx\n * const { data, isLoading, error } = useOsdkFunction(getEmployeeStats, {\n * params: { departmentId: \"engineering\" }\n * });\n * ```\n *\n * @example With dependency tracking\n * ```tsx\n * const { data, refetch } = useOsdkFunction(calculateMetrics, {\n * params: { startDate, endDate },\n * dependsOn: [Employee, Project],\n * });\n * ```\n *\n * @example With specific object dependencies\n * ```tsx\n * const { data } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee.$primaryKey },\n * dependsOnObjects: [employee],\n * });\n * ```\n */\nexport function useOsdkFunction<Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n options: UseOsdkFunctionOptions<Q> = {},\n): UseOsdkFunctionResult<Q> {\n const { observableClient } = React.useContext(OsdkContext2);\n const {\n params,\n dependsOn,\n dependsOnObjects,\n dedupeIntervalMs,\n enabled = true,\n } = options;\n\n const stableParams = React.useMemo(\n () => params,\n [JSON.stringify(params)],\n );\n const stableDependsOn = React.useMemo(\n () => dependsOn,\n [JSON.stringify(\n dependsOn?.map(d => typeof d === \"string\" ? d : d.apiName),\n )],\n );\n const stableDependsOnObjects = React.useMemo(\n () => dependsOnObjects,\n [JSON.stringify(\n dependsOnObjects?.map(item =>\n \"$apiName\" in item\n ? { $apiName: item.$apiName, $primaryKey: item.$primaryKey }\n : { __objectSet: getWireObjectSet(item) }\n ),\n )],\n );\n\n // Record<string, unknown> required as typing is figured out at runtime\n const paramsForApi = stableParams as Record<string, unknown> | undefined;\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<ObserveFunctionCallbackArgs<Q>>(\n () => ({ unsubscribe: () => {} }),\n process.env.NODE_ENV !== \"production\"\n ? `function ${queryDef.apiName} ${\n JSON.stringify(stableParams)\n } [DISABLED]`\n : void 0,\n );\n }\n return makeExternalStore<ObserveFunctionCallbackArgs<Q>>(\n (observer) =>\n observableClient.observeFunction(\n queryDef,\n paramsForApi,\n {\n dependsOn: stableDependsOn,\n dependsOnObjects: stableDependsOnObjects,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n },\n observer,\n ),\n process.env.NODE_ENV !== \"production\"\n ? `function ${queryDef.apiName} ${JSON.stringify(stableParams)}`\n : void 0,\n );\n },\n [\n observableClient,\n queryDef.apiName,\n queryDef.version,\n paramsForApi,\n stableDependsOn,\n stableDependsOnObjects,\n dedupeIntervalMs,\n enabled,\n ],\n );\n\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n const error = payload?.error\n ?? (payload?.status === \"error\"\n ? new Error(\"Failed to execute function\")\n : undefined);\n\n const refetch = React.useCallback(() => {\n void observableClient.invalidateFunction(queryDef, paramsForApi);\n }, [observableClient, queryDef, paramsForApi]);\n\n return {\n data: payload?.result as UseOsdkFunctionResult<Q>[\"data\"],\n isLoading: payload?.status === \"loading\",\n error,\n lastUpdated: payload?.lastUpdated ?? 0,\n refetch,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,SAASA,gBAAgB,QAAQ,kCAAkC;AACnE,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,YAAY,QAAQ,mBAAmB;AA4GhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAC7BC,QAAW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AW,IAAI,CAAC;IACtCN;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -6,11 +6,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
6
6
|
|
|
7
7
|
var React3__default = /*#__PURE__*/_interopDefault(React3);
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
var __export = (target, all) => {
|
|
11
|
-
for (var name in all)
|
|
12
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
-
};
|
|
9
|
+
// src/useOsdkClient.ts
|
|
14
10
|
function fakeClientFn(..._args) {
|
|
15
11
|
throw new Error("This is not a real client. Did you forget to <OsdkContext.Provider>?");
|
|
16
12
|
}
|
|
@@ -48,8 +44,7 @@ function useOsdkMetadata(type) {
|
|
|
48
44
|
}
|
|
49
45
|
|
|
50
46
|
exports.OsdkContext = OsdkContext;
|
|
51
|
-
exports.__export = __export;
|
|
52
47
|
exports.useOsdkClient = useOsdkClient;
|
|
53
48
|
exports.useOsdkMetadata = useOsdkMetadata;
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
55
|
-
//# sourceMappingURL=chunk-
|
|
49
|
+
//# sourceMappingURL=chunk-OVBG5VXE.cjs.map
|
|
50
|
+
//# sourceMappingURL=chunk-OVBG5VXE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/OsdkContext.ts","../../src/useOsdkClient.ts","../../src/useOsdkMetadata.ts"],"names":["React","error"],"mappings":";;;;;;;;;AAiBA,SAAS,gBAAgB,KAAO,EAAA;AAC9B,EAAM,MAAA,IAAI,MAAM,sEAAsE,CAAA;AACxF;AACA,IAAM,UAAA,GAAa,MAAO,CAAA,MAAA,CAAO,YAAc,EAAA;AAAA,EAC7C,aAAe,EAAA;AACjB,CAAC,CAAA;AACY,IAAA,WAAA,2CAAiC,aAAc,CAAA;AAAA,EAC1D,MAAQ,EAAA;AACV,CAAC;;;ACPM,SAAS,aAAgB,GAAA;AAC9B,EAAOA,OAAAA,uBAAAA,CAAM,UAAW,CAAA,WAAW,CAAE,CAAA,MAAA;AACvC;ACFO,SAAS,gBAAgB,IAAM,EAAA;AACpC,EAAA,MAAM,SAAS,aAAc,EAAA;AAC7B,EAAA,MAAM,CAAC,QAAU,EAAA,WAAW,CAAIA,GAAAA,uBAAAA,CAAM,SAAS,MAAS,CAAA;AACxD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIA,wBAAM,QAAS,EAAA;AACzC,EAAI,IAAA,CAAC,QAAY,IAAA,CAAC,KAAO,EAAA;AACvB,IAAA,MAAA,CAAO,aAAc,CAAA,IAAI,CAAE,CAAA,IAAA,CAAK,CAAmB,eAAA,KAAA;AACjD,MAAA,WAAA,CAAY,eAAe,CAAA;AAAA,KAC5B,CAAA,CAAE,KAAM,CAAA,CAAAC,MAAS,KAAA;AAChB,MAAA,MAAM,eAAeA,MAAiB,YAAA,KAAA,GAAQA,MAAM,CAAA,OAAA,GAAU,OAAOA,MAAK,CAAA;AAC1E,MAAA,QAAA,CAAS,YAAY,CAAA;AAAA,KACtB,CAAA;AACD,IAAO,OAAA;AAAA,MACL,OAAS,EAAA;AAAA,KACX;AAAA;AAEF,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,KAAA;AAAA,IACT,QAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-OVBG5VXE.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 { OsdkContext } from \"./OsdkContext.js\";\nexport function useOsdkClient() {\n return React.useContext(OsdkContext).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}"]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOVBG5VXE_cjs = require('./chunk-OVBG5VXE.cjs');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
|
|
6
6
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -11,7 +11,7 @@ function OsdkProvider({
|
|
|
11
11
|
children,
|
|
12
12
|
client
|
|
13
13
|
}) {
|
|
14
|
-
return /* @__PURE__ */ React__default.default.createElement(
|
|
14
|
+
return /* @__PURE__ */ React__default.default.createElement(chunkOVBG5VXE_cjs.OsdkContext.Provider, {
|
|
15
15
|
value: {
|
|
16
16
|
client
|
|
17
17
|
}
|
|
@@ -20,11 +20,11 @@ function OsdkProvider({
|
|
|
20
20
|
|
|
21
21
|
Object.defineProperty(exports, "useOsdkClient", {
|
|
22
22
|
enumerable: true,
|
|
23
|
-
get: function () { return
|
|
23
|
+
get: function () { return chunkOVBG5VXE_cjs.useOsdkClient; }
|
|
24
24
|
});
|
|
25
25
|
Object.defineProperty(exports, "useOsdkMetadata", {
|
|
26
26
|
enumerable: true,
|
|
27
|
-
get: function () { return
|
|
27
|
+
get: function () { return chunkOVBG5VXE_cjs.useOsdkMetadata; }
|
|
28
28
|
});
|
|
29
29
|
exports.OsdkProvider = OsdkProvider;
|
|
30
30
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkOVBG5VXE_cjs = require('../chunk-OVBG5VXE.cjs');
|
|
4
4
|
var unstableDoNotUse = require('@osdk/client/unstable-do-not-use');
|
|
5
5
|
var React9 = require('react');
|
|
6
|
+
var foundry_admin = require('@osdk/foundry.admin');
|
|
6
7
|
var client = require('@osdk/client');
|
|
7
8
|
|
|
8
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
@@ -32,156 +33,13 @@ function OsdkProvider2({
|
|
|
32
33
|
client,
|
|
33
34
|
observableClient
|
|
34
35
|
}
|
|
35
|
-
}, /* @__PURE__ */ React9__default.default.createElement(
|
|
36
|
+
}, /* @__PURE__ */ React9__default.default.createElement(chunkOVBG5VXE_cjs.OsdkContext.Provider, {
|
|
36
37
|
value: {
|
|
37
38
|
client
|
|
38
39
|
}
|
|
39
40
|
}, children));
|
|
40
41
|
}
|
|
41
42
|
|
|
42
|
-
// ../../node_modules/.pnpm/@osdk+shared.client@1.0.1/node_modules/@osdk/shared.client/index.js
|
|
43
|
-
var symbolClientContext = Symbol("ClientContext");
|
|
44
|
-
|
|
45
|
-
// ../../node_modules/.pnpm/@osdk+shared.client2@1.0.0/node_modules/@osdk/shared.client2/index.js
|
|
46
|
-
var symbolClientContext2 = "__osdkClientContext";
|
|
47
|
-
|
|
48
|
-
// ../../node_modules/.pnpm/@osdk+shared.net.errors@2.5.0-beta.2/node_modules/@osdk/shared.net.errors/build/esm/PalantirApiError.js
|
|
49
|
-
var PalantirApiError = class extends Error {
|
|
50
|
-
constructor(message, errorName, errorCode, errorDescription, statusCode, errorInstanceId, parameters) {
|
|
51
|
-
super(message);
|
|
52
|
-
this.message = message;
|
|
53
|
-
this.errorName = errorName;
|
|
54
|
-
this.errorCode = errorCode;
|
|
55
|
-
this.errorDescription = errorDescription;
|
|
56
|
-
this.statusCode = statusCode;
|
|
57
|
-
this.errorInstanceId = errorInstanceId;
|
|
58
|
-
this.parameters = parameters;
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// ../../node_modules/.pnpm/@osdk+shared.net.errors@2.5.0-beta.2/node_modules/@osdk/shared.net.errors/build/esm/UnknownError.js
|
|
63
|
-
var UnknownError = class extends PalantirApiError {
|
|
64
|
-
constructor(message, errorName, originalError, statusCode) {
|
|
65
|
-
super(message, errorName, void 0, void 0, statusCode);
|
|
66
|
-
this.originalError = originalError;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
// ../../node_modules/.pnpm/@osdk+shared.net.platformapi@1.5.0/node_modules/@osdk/shared.net.platformapi/build/esm/foundryPlatformFetch.js
|
|
71
|
-
async function foundryPlatformFetch(client, [httpMethodNum, origPath, flags, contentType, responseContentType], ...args) {
|
|
72
|
-
const path = origPath.replace(/\{([^}]+)\}/g, () => encodeURIComponent(args.shift()));
|
|
73
|
-
const body = flags & 1 ? args.shift() : void 0;
|
|
74
|
-
const queryArgs = flags & 2 ? args.shift() : void 0;
|
|
75
|
-
const headerArgs = flags & 4 ? args.shift() : void 0;
|
|
76
|
-
const method = ["GET", "POST", "PUT", "DELETE", "PATCH"][httpMethodNum];
|
|
77
|
-
return await apiFetch(client[symbolClientContext2] ?? client[symbolClientContext] ?? client, method, path, body, queryArgs, headerArgs, contentType, responseContentType);
|
|
78
|
-
}
|
|
79
|
-
async function apiFetch(clientCtx, method, endpointPath, data, queryArguments, headers, requestMediaType, responseMediaType) {
|
|
80
|
-
const url = parseUrl(clientCtx.baseUrl, endpointPath);
|
|
81
|
-
for (const [key, value] of Object.entries(queryArguments || {})) {
|
|
82
|
-
if (value == null) {
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
if (Array.isArray(value)) {
|
|
86
|
-
for (const item of value) {
|
|
87
|
-
url.searchParams.append(key, item);
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
url.searchParams.append(key, value);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
const headersInit = new Headers();
|
|
94
|
-
headersInit.set("Content-Type", requestMediaType ?? "application/json");
|
|
95
|
-
headersInit.set("Accept", responseMediaType ?? "application/json");
|
|
96
|
-
Object.entries(headers || {}).forEach(([key, value]) => {
|
|
97
|
-
if (key === "Content-Type" && typeof value === "string") {
|
|
98
|
-
headersInit.set("Content-Type", value);
|
|
99
|
-
} else if (key === "Accept" && typeof value === "string") {
|
|
100
|
-
headersInit.set("Accept", value);
|
|
101
|
-
} else if (value != null) {
|
|
102
|
-
headersInit.append(key, value.toString());
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
const body = data == null || data instanceof globalThis.Blob ? data : JSON.stringify(data);
|
|
106
|
-
const response = await clientCtx.fetch(url.toString(), {
|
|
107
|
-
body,
|
|
108
|
-
method,
|
|
109
|
-
headers: headersInit
|
|
110
|
-
});
|
|
111
|
-
if (!response.ok) {
|
|
112
|
-
try {
|
|
113
|
-
const convertedError = await response.json();
|
|
114
|
-
return new PalantirApiError(convertedError.message, convertedError.errorName, convertedError.errorCode, convertedError.errorDescription, response.status, convertedError.errorInstanceId, convertedError.parameters);
|
|
115
|
-
} catch (e) {
|
|
116
|
-
if (e instanceof Error) {
|
|
117
|
-
return new UnknownError(e.message, "UNKNOWN");
|
|
118
|
-
}
|
|
119
|
-
return new UnknownError("Unable to parse error response", "UNKNOWN");
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
if (response.status === 204) {
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
if (responseMediaType == null || responseMediaType === "application/json") {
|
|
126
|
-
return await response.json();
|
|
127
|
-
}
|
|
128
|
-
return response;
|
|
129
|
-
}
|
|
130
|
-
function parseUrl(baseUrl, endpointPath) {
|
|
131
|
-
baseUrl += baseUrl.endsWith("/") ? "" : "/";
|
|
132
|
-
return new URL(`api${endpointPath}`, baseUrl);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// ../../node_modules/.pnpm/@osdk+foundry.admin@2.44.0/node_modules/@osdk/foundry.admin/build/esm/public/User.js
|
|
136
|
-
var User_exports = {};
|
|
137
|
-
chunkV32JHU3O_cjs.__export(User_exports, {
|
|
138
|
-
deleteUser: () => deleteUser,
|
|
139
|
-
get: () => get,
|
|
140
|
-
getBatch: () => getBatch,
|
|
141
|
-
getCurrent: () => getCurrent,
|
|
142
|
-
getMarkings: () => getMarkings,
|
|
143
|
-
list: () => list,
|
|
144
|
-
profilePicture: () => profilePicture,
|
|
145
|
-
revokeAllTokens: () => revokeAllTokens,
|
|
146
|
-
search: () => search
|
|
147
|
-
});
|
|
148
|
-
var _deleteUser = [3, "/v2/admin/users/{0}"];
|
|
149
|
-
function deleteUser($ctx, ...args) {
|
|
150
|
-
return foundryPlatformFetch($ctx, _deleteUser, ...args);
|
|
151
|
-
}
|
|
152
|
-
var _list = [0, "/v2/admin/users", 2];
|
|
153
|
-
function list($ctx, ...args) {
|
|
154
|
-
return foundryPlatformFetch($ctx, _list, ...args);
|
|
155
|
-
}
|
|
156
|
-
var _get = [0, "/v2/admin/users/{0}", 2];
|
|
157
|
-
function get($ctx, ...args) {
|
|
158
|
-
return foundryPlatformFetch($ctx, _get, ...args);
|
|
159
|
-
}
|
|
160
|
-
var _getBatch = [1, "/v2/admin/users/getBatch", 1];
|
|
161
|
-
function getBatch($ctx, ...args) {
|
|
162
|
-
return foundryPlatformFetch($ctx, _getBatch, ...args);
|
|
163
|
-
}
|
|
164
|
-
var _getCurrent = [0, "/v2/admin/users/getCurrent"];
|
|
165
|
-
function getCurrent($ctx, ...args) {
|
|
166
|
-
return foundryPlatformFetch($ctx, _getCurrent, ...args);
|
|
167
|
-
}
|
|
168
|
-
var _getMarkings = [0, "/v2/admin/users/{0}/getMarkings", 2];
|
|
169
|
-
function getMarkings($ctx, ...args) {
|
|
170
|
-
return foundryPlatformFetch($ctx, _getMarkings, ...args);
|
|
171
|
-
}
|
|
172
|
-
var _profilePicture = [0, "/v2/admin/users/{0}/profilePicture", , , "application/octet-stream"];
|
|
173
|
-
function profilePicture($ctx, ...args) {
|
|
174
|
-
return foundryPlatformFetch($ctx, _profilePicture, ...args);
|
|
175
|
-
}
|
|
176
|
-
var _search = [1, "/v2/admin/users/search", 1];
|
|
177
|
-
function search($ctx, ...args) {
|
|
178
|
-
return foundryPlatformFetch($ctx, _search, ...args);
|
|
179
|
-
}
|
|
180
|
-
var _revokeAllTokens = [1, "/v2/admin/users/{0}/revokeAllTokens", 2];
|
|
181
|
-
function revokeAllTokens($ctx, ...args) {
|
|
182
|
-
return foundryPlatformFetch($ctx, _revokeAllTokens, ...args);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
43
|
// src/new/makeExternalStore.ts
|
|
186
44
|
function makeExternalStore(createObservation, _name, initialValue) {
|
|
187
45
|
let lastResult = initialValue;
|
|
@@ -279,7 +137,7 @@ function useCurrentFoundryUser({
|
|
|
279
137
|
const {
|
|
280
138
|
client
|
|
281
139
|
} = React9__default.default.useContext(OsdkContext2);
|
|
282
|
-
const handleQuery = React9__default.default.useCallback(() =>
|
|
140
|
+
const handleQuery = React9__default.default.useCallback(() => foundry_admin.Users.getCurrent(client), [client]);
|
|
283
141
|
const query = usePlatformQuery({
|
|
284
142
|
query: handleQuery,
|
|
285
143
|
enabled,
|
|
@@ -300,7 +158,7 @@ function useFoundryUser(userId, {
|
|
|
300
158
|
client
|
|
301
159
|
} = React9__default.default.useContext(OsdkContext2);
|
|
302
160
|
const handleQuery = React9__default.default.useCallback(() => {
|
|
303
|
-
return
|
|
161
|
+
return foundry_admin.Users.get(client, userId, {
|
|
304
162
|
status
|
|
305
163
|
});
|
|
306
164
|
}, [client, userId, status]);
|
|
@@ -326,7 +184,7 @@ function useFoundryUsersList({
|
|
|
326
184
|
client
|
|
327
185
|
} = React9__default.default.useContext(OsdkContext2);
|
|
328
186
|
const handleQuery = React9__default.default.useCallback(() => {
|
|
329
|
-
return
|
|
187
|
+
return foundry_admin.Users.list(client, {
|
|
330
188
|
include,
|
|
331
189
|
pageSize,
|
|
332
190
|
pageToken
|
|
@@ -630,10 +488,12 @@ function useOsdkFunction(queryDef, options = {}) {
|
|
|
630
488
|
} = options;
|
|
631
489
|
const stableParams = React9__default.default.useMemo(() => params, [JSON.stringify(params)]);
|
|
632
490
|
const stableDependsOn = React9__default.default.useMemo(() => dependsOn, [JSON.stringify(dependsOn?.map((d) => typeof d === "string" ? d : d.apiName))]);
|
|
633
|
-
const stableDependsOnObjects = React9__default.default.useMemo(() => dependsOnObjects, [JSON.stringify(dependsOnObjects?.map((
|
|
634
|
-
$apiName:
|
|
635
|
-
$primaryKey:
|
|
636
|
-
}
|
|
491
|
+
const stableDependsOnObjects = React9__default.default.useMemo(() => dependsOnObjects, [JSON.stringify(dependsOnObjects?.map((item) => "$apiName" in item ? {
|
|
492
|
+
$apiName: item.$apiName,
|
|
493
|
+
$primaryKey: item.$primaryKey
|
|
494
|
+
} : {
|
|
495
|
+
__objectSet: unstableDoNotUse.getWireObjectSet(item)
|
|
496
|
+
}))]);
|
|
637
497
|
const paramsForApi = stableParams;
|
|
638
498
|
const {
|
|
639
499
|
subscribe,
|
|
@@ -808,11 +668,11 @@ function useDebouncedCallback(callback, delay) {
|
|
|
808
668
|
|
|
809
669
|
Object.defineProperty(exports, "useOsdkClient", {
|
|
810
670
|
enumerable: true,
|
|
811
|
-
get: function () { return
|
|
671
|
+
get: function () { return chunkOVBG5VXE_cjs.useOsdkClient; }
|
|
812
672
|
});
|
|
813
673
|
Object.defineProperty(exports, "useOsdkMetadata", {
|
|
814
674
|
enumerable: true,
|
|
815
|
-
get: function () { return
|
|
675
|
+
get: function () { return chunkOVBG5VXE_cjs.useOsdkMetadata; }
|
|
816
676
|
});
|
|
817
677
|
exports.OsdkProvider2 = OsdkProvider2;
|
|
818
678
|
exports.useCurrentFoundryUser = useCurrentFoundryUser;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/new/OsdkContext2.ts","../../../src/new/OsdkProvider2.tsx","../../../../../node_modules/.pnpm/@osdk+shared.client@1.0.1/node_modules/@osdk/shared.client/index.js","../../../../../node_modules/.pnpm/@osdk+shared.client2@1.0.0/node_modules/@osdk/shared.client2/index.js","../../../../../node_modules/.pnpm/@osdk+shared.net.errors@2.5.0-beta.2/node_modules/@osdk/shared.net.errors/build/esm/PalantirApiError.js","../../../../../node_modules/.pnpm/@osdk+shared.net.errors@2.5.0-beta.2/node_modules/@osdk/shared.net.errors/build/esm/UnknownError.js","../../../../../node_modules/.pnpm/@osdk+shared.net.platformapi@1.5.0/node_modules/@osdk/shared.net.platformapi/build/esm/foundryPlatformFetch.js","../../../../../node_modules/.pnpm/@osdk+foundry.admin@2.44.0/node_modules/@osdk/foundry.admin/build/esm/public/User.js","../../../src/new/makeExternalStore.ts","../../../src/utils/usePlatformQuery.ts","../../../src/new/platform-apis/admin/useCurrentFoundryUser.ts","../../../src/new/platform-apis/admin/useFoundryUser.ts","../../../src/new/platform-apis/admin/useFoundryUsersList.ts","../../../src/new/useLinks.ts","../../../src/new/useObjectSet.tsx","../../../src/new/useOsdkAction.ts","../../../src/new/useOsdkAggregation.ts","../../../src/new/useOsdkFunction.ts","../../../src/new/useOsdkObject.ts","../../../src/new/useOsdkObjects.ts","../../../src/utils/useDebouncedCallback.ts"],"names":["useMemo","createObservableClient","React","OsdkContext","symbolClientContext","__export","computeObjectSetCacheKey","applyAction","args","ActionValidationError","validateAction"],"mappings":";;;;;;;;;;;AAiBA,SAAS,gBAAgB,KAAO,EAAA;AAC9B,EAAM,MAAA,IAAI,MAAM,sEAAsE,CAAA;AACxF;AACA,IAAM,UAAA,GAAa,MAAO,CAAA,MAAA,CAAO,YAAc,EAAA;AAAA,EAC7C,aAAe,EAAA;AACjB,CAAC,CAAA;AACM,IAAM,YAAA,2CAAkC,aAAc,CAAA;AAAA,EAC3D,MAAQ,EAAA,UAAA;AAAA,EACR,gBAAkB,EAAA;AACpB,CAAC,CAAA;;;ACNM,SAAS,aAAc,CAAA;AAAA,EAC5B,QAAA;AAAA,EACA,MAAA;AAAA,EACA;AACF,CAAG,EAAA;AACD,EAAmB,gBAAA,GAAAA,cAAA,CAAQ,MAAM,gBAAoB,IAAAC,uCAAA,CAAuB,MAAM,CAAG,EAAA,CAAC,MAAQ,EAAA,gBAAgB,CAAC,CAAA;AAC/G,EAAA,uBAAoBC,uBAAAA,CAAM,aAAc,CAAA,YAAA,CAAa,QAAU,EAAA;AAAA,IAC7D,KAAO,EAAA;AAAA,MACL,MAAA;AAAA,MACA;AAAA;AACF,GACc,kBAAAA,uBAAM,CAAA,aAAA,CAAcC,8BAAY,QAAU,EAAA;AAAA,IACxD,KAAO,EAAA;AAAA,MACL;AA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AAa,WAAW,OAAO,CAAA;AAC/B,MAAA,UAAA,CAAW,OAAU,GAAA,MAAA;AAAA;AACvB,GACF,EAAG,EAAE,CAAA;AACL,EAAM,MAAA,KAAA,GAAQA,uBAAM,CAAA,WAAA,CAAY,MAAM;AACpC,IAAI,IAAA,UAAA,CAAW,OAAW,IAAA,WAAA,CAAY,OAAS,EAAA;AAC7C,MAAA,YAAA,CAAa,WAAW,OAAO,CAAA;AAC/B,MAAA,UAAA,CAAW,OAAU,GAAA,MAAA;AACrB,MAAA,KAAK,WAAY,CAAA,OAAA,CAAQ,GAAG,WAAA,CAAY,OAAO,CAAA;AAAA;AACjD,GACF,EAAG,EAAE,CAAA;AACL,EAAA,MAAM,iBAAoBA,GAAAA,uBAAAA,CAAM,WAAY,CAAA,CAAA,GAAI,IAAS,KAAA;AACvD,IAAA,WAAA,CAAY,OAAU,GAAA,IAAA;AACtB,IAAO,MAAA,EAAA;AACP,IAAW,UAAA,CAAA,OAAA,GAAU,WAAW,MAAM;AACpC,MAAK,KAAA,WAAA,CAAY,OAAQ,CAAA,GAAG,IAAI,CAAA;AAAA,OAC/B,KAAK,CAAA;AAAA,GACP,EAAA,CAAC,KAAO,EAAA,MAAM,CAAC,CAAA;AAClB,EAAAA,uBAAAA,CAAM,UAAU,MAAM;AACpB,IAAA,OAAO,MAAM;AACX,MAAO,MAAA,EAAA;AAAA,KACT;AAAA,GACF,EAAG,CAAC,MAAM,CAAC,CAAA;AACX,EAAO,OAAA,MAAA,CAAO,OAAO,iBAAmB,EAAA;AAAA,IACtC,MAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH","file":"experimental.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 OsdkContext2 = /*#__PURE__*/React.createContext({\n client: fakeClient,\n observableClient: undefined\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 { createObservableClient } from \"@osdk/client/unstable-do-not-use\";\nimport React, { useMemo } from \"react\";\nimport { OsdkContext } from \"../OsdkContext.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function OsdkProvider2({\n children,\n client,\n observableClient\n}) {\n observableClient = useMemo(() => observableClient ?? createObservableClient(client), [client, observableClient]);\n return /*#__PURE__*/React.createElement(OsdkContext2.Provider, {\n value: {\n client,\n observableClient\n }\n }, /*#__PURE__*/React.createElement(OsdkContext.Provider, {\n value: {\n client\n }\n }, children));\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\nexport const symbolClientContext = Symbol(\"ClientContext\");","/*\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\nexport const symbolClientContext = \"__osdkClientContext\";","/*\n * Copyright 2023 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 class PalantirApiError extends Error {\n constructor(message, errorName, errorCode, errorDescription, statusCode, errorInstanceId, parameters) {\n super(message);\n this.message = message;\n this.errorName = errorName;\n this.errorCode = errorCode;\n this.errorDescription = errorDescription;\n this.statusCode = statusCode;\n this.errorInstanceId = errorInstanceId;\n this.parameters = parameters;\n }\n}","/*\n * Copyright 2023 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 { PalantirApiError } from \"./PalantirApiError.js\";\nexport class UnknownError extends PalantirApiError {\n constructor(message, errorName, originalError, statusCode) {\n super(message, errorName, undefined, undefined, statusCode);\n this.originalError = originalError;\n }\n}","/*\n * Copyright 2023 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 */\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { symbolClientContext } from \"@osdk/shared.client2\";\nimport { PalantirApiError, UnknownError } from \"@osdk/shared.net.errors\";\nexport async function foundryPlatformFetch(client, [httpMethodNum, origPath, flags, contentType, responseContentType], ...args) {\n const path = origPath.replace(/\\{([^}]+)\\}/g, () => encodeURIComponent(args.shift()));\n const body = flags & 1 ? args.shift() : undefined;\n const queryArgs = flags & 2 ? args.shift() : undefined;\n const headerArgs = flags & 4 ? args.shift() : undefined;\n const method = [\"GET\", \"POST\", \"PUT\", \"DELETE\", \"PATCH\"][httpMethodNum];\n return await apiFetch(client[symbolClientContext] ?? client[oldSymbolClientContext] ?? client, method, path, body, queryArgs, headerArgs, contentType, responseContentType);\n}\nasync function apiFetch(clientCtx, method, endpointPath, data, queryArguments, headers, requestMediaType, responseMediaType) {\n const url = parseUrl(clientCtx.baseUrl, endpointPath);\n for (const [key, value] of Object.entries(queryArguments || {})) {\n if (value == null) {\n continue;\n }\n if (Array.isArray(value)) {\n for (const item of value) {\n url.searchParams.append(key, item);\n }\n } else {\n url.searchParams.append(key, value);\n }\n }\n const headersInit = new Headers();\n headersInit.set(\"Content-Type\", requestMediaType ?? \"application/json\");\n headersInit.set(\"Accept\", responseMediaType ?? \"application/json\");\n Object.entries(headers || {}).forEach(([key, value]) => {\n if (key === \"Content-Type\" && typeof value === \"string\") {\n headersInit.set(\"Content-Type\", value);\n } else if (key === \"Accept\" && typeof value === \"string\") {\n headersInit.set(\"Accept\", value);\n } else if (value != null) {\n headersInit.append(key, value.toString());\n }\n });\n const body = data == null || data instanceof globalThis.Blob ? data : JSON.stringify(data);\n // Because this uses the client's fetch, there is a 99.99% chance that it is already going\n // to handle the error case and throw a PalantirApiError since its wrapped in a\n // createFetchOrThrow.\n const response = await clientCtx.fetch(url.toString(), {\n body,\n method: method,\n headers: headersInit\n });\n // However, if we ended up using a \"regular\" fetch, the\n // error status codes are not thrown by fetch automatically,\n // we have to look at the ok property and behave accordingly\n if (!response.ok) {\n try {\n const convertedError = await response.json();\n return new PalantirApiError(convertedError.message, convertedError.errorName, convertedError.errorCode, convertedError.errorDescription, response.status, convertedError.errorInstanceId, convertedError.parameters);\n } catch (e) {\n if (e instanceof Error) {\n return new UnknownError(e.message, \"UNKNOWN\");\n }\n return new UnknownError(\"Unable to parse error response\", \"UNKNOWN\");\n }\n }\n // Do not return anything if its a 204. Do not parse either!\n if (response.status === 204) {\n return;\n }\n if (responseMediaType == null || responseMediaType === \"application/json\") {\n return await response.json();\n }\n return response;\n}\nexport function parseUrl(baseUrl, endpointPath) {\n baseUrl += baseUrl.endsWith(\"/\") ? \"\" : \"/\";\n return new URL(`api${endpointPath}`, baseUrl);\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 */\nimport { foundryPlatformFetch as $foundryPlatformFetch } from \"@osdk/shared.net.platformapi\";\n//\nconst _deleteUser = [3, \"/v2/admin/users/{0}\"];\n/**\n * Delete the User with the specified id.\n *\n * @public\n *\n * Required Scopes: [api:admin-write]\n * URL: /v2/admin/users/{userId}\n */\nexport function deleteUser($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _deleteUser, ...args);\n}\nconst _list = [0, \"/v2/admin/users\", 2];\n/**\n * Lists all Users.\n *\n * This is a paged endpoint. Each page may be smaller or larger than the requested page size. However, it is guaranteed that if there are more results available, the `nextPageToken` field will be populated. To get the next page, make the same request again, but set the value of the `pageToken` query parameter to be value of the `nextPageToken` value of the previous response. If there is no `nextPageToken` field in the response, you are on the last page.\n *\n * @public\n *\n * Required Scopes: [api:admin-read]\n * URL: /v2/admin/users\n */\nexport function list($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _list, ...args);\n}\nconst _get = [0, \"/v2/admin/users/{0}\", 2];\n/**\n * Get the User with the specified id.\n *\n * @public\n *\n * Required Scopes: [api:admin-read]\n * URL: /v2/admin/users/{userId}\n */\nexport function get($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _get, ...args);\n}\nconst _getBatch = [1, \"/v2/admin/users/getBatch\", 1];\n/**\n * Execute multiple get requests on User.\n *\n * The maximum batch size for this endpoint is 500.\n *\n * @public\n *\n * Required Scopes: [api:admin-read]\n * URL: /v2/admin/users/getBatch\n */\nexport function getBatch($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getBatch, ...args);\n}\nconst _getCurrent = [0, \"/v2/admin/users/getCurrent\"];\n/**\n * @public\n *\n * Required Scopes: [api:admin-read]\n * URL: /v2/admin/users/getCurrent\n */\nexport function getCurrent($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getCurrent, ...args);\n}\nconst _getMarkings = [0, \"/v2/admin/users/{0}/getMarkings\", 2];\n/**\n * Retrieve Markings that the user is currently a member of.\n *\n * @beta\n *\n * Required Scopes: [api:admin-read]\n * URL: /v2/admin/users/{userId}/getMarkings\n */\nexport function getMarkings($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _getMarkings, ...args);\n}\nconst _profilePicture = [0, \"/v2/admin/users/{0}/profilePicture\",,, \"application/octet-stream\"];\n/**\n * @public\n *\n * Required Scopes: [api:admin-read]\n * URL: /v2/admin/users/{userId}/profilePicture\n */\nexport function profilePicture($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _profilePicture, ...args);\n}\nconst _search = [1, \"/v2/admin/users/search\", 1];\n/**\n * Perform a case-insensitive prefix search for users based on username, given name and family name.\n *\n * @public\n *\n * Required Scopes: [api:admin-read]\n * URL: /v2/admin/users/search\n */\nexport function search($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _search, ...args);\n}\nconst _revokeAllTokens = [1, \"/v2/admin/users/{0}/revokeAllTokens\", 2];\n/**\n * Revoke all active authentication tokens for the user including active browser sessions and long-lived\n * development tokens. If the user has active sessions in a browser, this will force re-authentication.\n *\n * The caller must have permission to manage users for the target user's organization.\n *\n * @beta\n *\n * Required Scopes: [api:admin-write]\n * URL: /v2/admin/users/{userId}/revokeAllTokens\n */\nexport function revokeAllTokens($ctx, ...args) {\n return $foundryPlatformFetch($ctx, _revokeAllTokens, ...args);\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\nexport function makeExternalStore(createObservation, _name, 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 return {\n subscribe,\n getSnapShot\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 React from \"react\";\nimport { 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 }), process.env.NODE_ENV !== \"production\" ? `${queryName} Query [DISABLED]` : undefined);\n }\n return makeExternalStore(observer => {\n observerRef.current = observer;\n handleQuery();\n return {\n unsubscribe: () => {\n observerRef.current = undefined;\n }\n };\n }, queryName);\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 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 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 { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nconst emptyArray = Object.freeze([]);\n\n/**\n * Hook to observe links from an object or array of objects.\n *\n * @param objects The source object(s) to observe links from\n * @param linkName The name of the link to observe\n * @param options Optional configuration for the link query\n * @returns UseLinksResult with links data and metadata\n */\nexport function useLinks(objects, linkName, options = {}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const {\n enabled = true,\n ...otherOptions\n } = options;\n const stableWhere = React.useMemo(() => otherOptions.where, [JSON.stringify(otherOptions.where)]);\n const stableOrderBy = React.useMemo(() => otherOptions.orderBy, [JSON.stringify(otherOptions.orderBy)]);\n const objectsKey = React.useMemo(() => {\n if (objects === undefined) return \"\";\n const arr = Array.isArray(objects) ? objects : [objects];\n return arr.map(obj => `${obj.$apiName}:${obj.$primaryKey}`).join(\",\");\n }, [objects]);\n\n // Convert single object to array for consistent handling\n const objectsArray = React.useMemo(() => {\n return objects === undefined ? emptyArray : Array.isArray(objects) ? objects : [objects];\n }, [objectsKey, objects]);\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), `links ${linkName} for ${objectsKey} [DISABLED]`);\n }\n return makeExternalStore(observer => observableClient.observeLinks(objectsArray, linkName, {\n linkName,\n where: stableWhere,\n pageSize: otherOptions.pageSize,\n orderBy: stableOrderBy,\n mode: otherOptions.mode\n }, observer), `links ${linkName} for ${objectsKey}`);\n }, [enabled, observableClient, objectsArray, objectsKey, linkName, stableWhere, otherOptions.pageSize, stableOrderBy, otherOptions.mode]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n return {\n links: payload?.resolvedList,\n isLoading: enabled ? payload?.status === \"loading\" || payload?.status === \"init\" || !payload : false,\n isOptimistic: payload?.isOptimistic ?? false,\n error: payload?.error,\n fetchMore: payload?.hasMore ? payload?.fetchMore : undefined,\n hasMore: payload?.hasMore ?? false\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 { computeObjectSetCacheKey } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n/**\n * React hook for observing and interacting with OSDK object sets.\n *\n * @typeParam Q - The object type definition\n * @typeParam BaseRDPs - Derived properties that already exist on the input ObjectSet\n * @typeParam RDPs - New derived properties to be added via options.withProperties\n *\n * @param baseObjectSet - The ObjectSet to observe (may already have derived properties)\n * @param options - Options for filtering, sorting, and adding new derived properties\n * @returns Object set data with both existing and new derived properties\n */\nexport function useObjectSet(baseObjectSet, options = {}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const {\n enabled = true,\n streamUpdates,\n ...otherOptions\n } = options;\n\n // Track object type to detect when we switch to a different object type\n const objectTypeKey = baseObjectSet.$objectSetInternals.def.apiName;\n const previousObjectTypeRef = React.useRef(objectTypeKey);\n const previousPayloadRef = React.useRef();\n const objectTypeChanged = previousObjectTypeRef.current !== objectTypeKey;\n if (objectTypeChanged) {\n previousObjectTypeRef.current = objectTypeKey;\n }\n\n // Compute a stable cache key for the ObjectSet and options\n // dedupeIntervalMs and enabled are excluded as they don't affect the data\n const stableKey = computeObjectSetCacheKey(baseObjectSet, {\n where: otherOptions.where,\n withProperties: otherOptions.withProperties,\n union: otherOptions.union,\n intersect: otherOptions.intersect,\n subtract: otherOptions.subtract,\n pivotTo: otherOptions.pivotTo,\n pageSize: otherOptions.pageSize,\n orderBy: otherOptions.orderBy\n });\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), process.env.NODE_ENV !== \"production\" ? `objectSet ${stableKey} [DISABLED]` : void 0);\n }\n const initialValue = objectTypeChanged ? undefined : previousPayloadRef.current;\n return makeExternalStore(observer => {\n const subscription = observableClient.observeObjectSet(baseObjectSet, {\n where: otherOptions.where,\n withProperties: otherOptions.withProperties,\n union: otherOptions.union,\n intersect: otherOptions.intersect,\n subtract: otherOptions.subtract,\n pivotTo: otherOptions.pivotTo,\n pageSize: otherOptions.pageSize,\n orderBy: otherOptions.orderBy,\n dedupeInterval: otherOptions.dedupeIntervalMs ?? 2_000,\n autoFetchMore: otherOptions.autoFetchMore,\n streamUpdates\n }, observer);\n return subscription;\n }, process.env.NODE_ENV !== \"production\" ? `objectSet ${stableKey}` : void 0, initialValue);\n }, [enabled, observableClient, stableKey, streamUpdates, objectTypeChanged]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n React.useEffect(() => {\n if (payload) {\n previousPayloadRef.current = payload;\n }\n }, [payload]);\n return {\n data: payload?.resolvedList,\n isLoading: payload?.status === \"loading\" || !payload && true || false,\n error: payload && \"error\" in payload ? payload.error : undefined,\n fetchMore: payload?.hasMore ? payload.fetchMore : undefined,\n objectSet: payload?.objectSet || baseObjectSet,\n totalCount: payload?.totalCount\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 { ActionValidationError } from \"@osdk/client\";\nimport React from \"react\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function useOsdkAction(actionDef) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const [error, setError] = React.useState();\n const [data, setData] = React.useState();\n const [isPending, setPending] = React.useState(false);\n const [isValidating, setValidating] = React.useState(false);\n const [validationResult, setValidationResult] = React.useState();\n const abortControllerRef = React.useRef(null);\n const applyAction = React.useCallback(async function applyAction(hookArgs) {\n try {\n // If validation is in progress, abort it\n if (isValidating && abortControllerRef.current) {\n abortControllerRef.current.abort();\n setValidating(false);\n }\n setPending(true);\n setError(undefined);\n if (Array.isArray(hookArgs)) {\n const updates = [];\n const args = hookArgs.map(a => {\n const {\n $optimisticUpdate,\n ...args\n } = a;\n if ($optimisticUpdate) {\n updates.push($optimisticUpdate);\n }\n return args;\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 {\n $optimisticUpdate,\n ...args\n } = hookArgs;\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({\n unknown: e\n });\n }\n } finally {\n setPending(false);\n }\n }, [observableClient, actionDef, isValidating]);\n const validateAction = React.useCallback(async function validateAction(args) {\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 setValidating(true);\n setError(undefined);\n const result = await observableClient.validateAction(actionDef, args);\n\n // Check if aborted\n if (abortController.signal.aborted) {\n return undefined;\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 if (e instanceof ActionValidationError) {\n setError({\n actionValidation: e\n });\n } else {\n setError({\n unknown: e\n });\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 return {\n applyAction,\n validateAction,\n error,\n data,\n isPending,\n isValidating,\n validationResult\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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n/**\n * React hook for performing aggregations on OSDK object sets.\n *\n * Executes server-side aggregations with groupBy and metric calculations on filtered object sets.\n * Supports runtime derived properties and where clauses.\n *\n * @param type - The object or interface type to aggregate\n * @param options - Aggregation configuration including where clause, aggregation spec, and optional derived properties\n * @returns Object containing aggregation results, loading state, error state, and refetch function\n *\n * @example\n * ```tsx\n * const { data, isLoading, error } = useOsdkAggregation(Employee, {\n * where: { department: \"Engineering\" },\n * aggregate: {\n * groupBy: { department: \"exact\" },\n * select: {\n * avgSalary: { $avg: \"salary\" },\n * count: { $count: {} }\n * }\n * }\n * });\n * ```\n */\nexport function useOsdkAggregation(type, {\n where = {},\n withProperties,\n aggregate,\n dedupeIntervalMs\n}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const canonWhere = observableClient.canonicalizeWhereClause(where ?? {});\n const stableWithProperties = React.useMemo(() => withProperties, [JSON.stringify(withProperties)]);\n const stableAggregate = React.useMemo(() => aggregate, [JSON.stringify(aggregate)]);\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => makeExternalStore(observer => observableClient.observeAggregation({\n type: type,\n where: canonWhere,\n withProperties: stableWithProperties,\n aggregate: stableAggregate,\n dedupeInterval: dedupeIntervalMs ?? 2_000\n }, observer), process.env.NODE_ENV !== \"production\" ? `aggregation ${type.apiName} ${JSON.stringify(canonWhere)}` : void 0), [observableClient, type.apiName, type.type, canonWhere, stableWithProperties, stableAggregate, dedupeIntervalMs]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n let error;\n if (payload && \"error\" in payload && payload.error) {\n error = payload.error;\n } else if (payload?.status === \"error\") {\n error = new Error(\"Failed to execute aggregation\");\n }\n const refetch = React.useCallback(async () => {\n await observableClient.invalidateObjectType(type.apiName);\n }, [observableClient, type.apiName]);\n return {\n data: payload?.result,\n isLoading: payload?.status === \"loading\" || payload?.status === \"init\" || !payload,\n error,\n 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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n/**\n * React hook for executing and observing OSDK functions.\n *\n * Provides automatic caching, deduplication, and reactive updates for function calls.\n * Functions are automatically re-fetched when dependencies change (configured via options).\n *\n * @param queryDef - The QueryDefinition to execute\n * @param options - Configuration options for the function call\n * @returns Object containing result, loading state, error, and refetch function\n *\n * @example Basic usage\n * ```tsx\n * const { data, isLoading, error } = useOsdkFunction(getEmployeeStats, {\n * params: { departmentId: \"engineering\" }\n * });\n * ```\n *\n * @example With dependency tracking\n * ```tsx\n * const { data, refetch } = useOsdkFunction(calculateMetrics, {\n * params: { startDate, endDate },\n * dependsOn: [Employee, Project],\n * });\n * ```\n *\n * @example With specific object dependencies\n * ```tsx\n * const { data } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee.$primaryKey },\n * dependsOnObjects: [employee],\n * });\n * ```\n */\nexport function useOsdkFunction(queryDef, options = {}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const {\n params,\n dependsOn,\n dependsOnObjects,\n dedupeIntervalMs,\n enabled = true\n } = options;\n const stableParams = React.useMemo(() => params, [JSON.stringify(params)]);\n const stableDependsOn = React.useMemo(() => dependsOn, [JSON.stringify(dependsOn?.map(d => typeof d === \"string\" ? d : d.apiName))]);\n const stableDependsOnObjects = React.useMemo(() => dependsOnObjects, [JSON.stringify(dependsOnObjects?.map(o => ({\n $apiName: o.$apiName,\n $primaryKey: o.$primaryKey\n })))]);\n\n // Record<string, unknown> required as typing is figured out at runtime\n const paramsForApi = stableParams;\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), process.env.NODE_ENV !== \"production\" ? `function ${queryDef.apiName} ${JSON.stringify(stableParams)} [DISABLED]` : void 0);\n }\n return makeExternalStore(observer => observableClient.observeFunction(queryDef, paramsForApi, {\n dependsOn: stableDependsOn,\n dependsOnObjects: stableDependsOnObjects,\n dedupeInterval: dedupeIntervalMs ?? 2_000\n }, observer), process.env.NODE_ENV !== \"production\" ? `function ${queryDef.apiName} ${JSON.stringify(stableParams)}` : void 0);\n }, [observableClient, queryDef.apiName, queryDef.version, paramsForApi, stableDependsOn, stableDependsOnObjects, dedupeIntervalMs, enabled]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n const error = payload?.error ?? (payload?.status === \"error\" ? new Error(\"Failed to execute function\") : undefined);\n const refetch = React.useCallback(() => {\n void observableClient.invalidateFunction(queryDef, paramsForApi);\n }, [observableClient, queryDef, paramsForApi]);\n return {\n data: payload?.result,\n isLoading: payload?.status === \"loading\",\n error,\n lastUpdated: payload?.lastUpdated ?? 0,\n 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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\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 */\n\n/**\n * Loads an object by type and primary key.\n *\n * @param type\n * @param primaryKey\n * @param enabled Enable or disable the query (defaults to true)\n */\n\n/*\n Implementation of useOsdkObject\n */\nexport function useOsdkObject(...args) {\n const {\n observableClient\n } = 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 enabled flag - 2nd param for instance signature, 3rd for type signature\n const enabled = isInstanceSignature ? typeof args[1] === \"boolean\" ? args[1] : true : typeof args[2] === \"boolean\" ? args[2] : true;\n\n // TODO: Figure out what the correct default behavior is for the various scenarios\n const mode = isInstanceSignature ? \"offline\" : undefined;\n const objectType = isInstanceSignature ? args[0].$objectType : args[0].apiName;\n const primaryKey = isInstanceSignature ? args[0].$primaryKey : args[1];\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), `object ${objectType} ${primaryKey} [DISABLED]`);\n }\n return makeExternalStore(observer => observableClient.observeObject(objectType, primaryKey, {\n mode\n }, observer), `object ${objectType} ${primaryKey}`);\n }, [enabled, observableClient, objectType, primaryKey, mode]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n let error;\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 return {\n object: payload?.object,\n isLoading: enabled ? payload?.status === \"loading\" || payload?.status === \"init\" || !payload : false,\n isOptimistic: !!payload?.isOptimistic,\n error,\n forceUpdate: () => {\n throw new Error(\"not implemented\");\n }\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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function useOsdkObjects(type, options) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\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 } = options ?? {};\n const canonWhere = observableClient.canonicalizeWhereClause(where ?? {});\n const stableRids = React.useMemo(() => rids, [JSON.stringify(rids)]);\n const stableWithProperties = React.useMemo(() => withProperties, [JSON.stringify(withProperties)]);\n const stableIntersectWith = React.useMemo(() => intersectWith, [JSON.stringify(intersectWith)]);\n const stableOrderBy = React.useMemo(() => orderBy, [JSON.stringify(orderBy)]);\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), process.env.NODE_ENV !== \"production\" ? `list ${type.apiName} [DISABLED]` : void 0);\n }\n return makeExternalStore(observer => observableClient.observeList({\n type,\n rids: stableRids,\n where: canonWhere,\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 ? {\n pivotTo\n } : {})\n }, observer), process.env.NODE_ENV !== \"production\" ? `list ${type.apiName} ${stableRids ? `[${stableRids.length} rids]` : \"\"} ${JSON.stringify(canonWhere)}` : void 0);\n }, [enabled, observableClient, type, stableRids, canonWhere, dedupeIntervalMs, pageSize, stableOrderBy, streamUpdates, stableWithProperties, autoFetchMore, stableIntersectWith, pivotTo]);\n const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);\n let error;\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 return {\n fetchMore: listPayload?.hasMore ? listPayload.fetchMore : undefined,\n error,\n data: listPayload?.resolvedList,\n isLoading: enabled ? listPayload?.status === \"loading\" || listPayload?.status === \"init\" || !listPayload : false,\n isOptimistic: listPayload?.isOptimistic ?? false,\n totalCount: listPayload?.totalCount\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 React from \"react\";\n/**\n * Creates a debounced version of a callback function.\n *\n * @param callback The function to debounce\n * @param delay The delay in milliseconds\n * @returns A debounced function with cancel() and flush() methods\n *\n * @example\n * ```tsx\n * const { applyAction } = useOsdkAction(editOffice);\n *\n * const debouncedSave = useDebouncedCallback(\n * async (name: string) => {\n * await applyAction({\n * Office: office,\n * name,\n * location: office.location!,\n * $optimisticUpdate: (ctx) => {\n * ctx.updateObject(office.$clone({ name }));\n * },\n * });\n * },\n * 1000\n * );\n *\n * <input onChange={(e) => debouncedSave(e.target.value)} />\n * ```\n */\nexport function useDebouncedCallback(callback, delay) {\n const timeoutRef = React.useRef();\n const callbackRef = React.useRef(callback);\n const lastArgsRef = React.useRef();\n callbackRef.current = callback;\n const cancel = React.useCallback(() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n }, []);\n const flush = React.useCallback(() => {\n if (timeoutRef.current && lastArgsRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n void callbackRef.current(...lastArgsRef.current);\n }\n }, []);\n const debouncedCallback = React.useCallback((...args) => {\n lastArgsRef.current = args;\n cancel();\n timeoutRef.current = setTimeout(() => {\n void callbackRef.current(...args);\n }, delay);\n }, [delay, cancel]);\n React.useEffect(() => {\n return () => {\n cancel();\n };\n }, [cancel]);\n return Object.assign(debouncedCallback, {\n cancel,\n flush\n });\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/new/OsdkContext2.ts","../../../src/new/OsdkProvider2.tsx","../../../src/new/makeExternalStore.ts","../../../src/utils/usePlatformQuery.ts","../../../src/new/platform-apis/admin/useCurrentFoundryUser.ts","../../../src/new/platform-apis/admin/useFoundryUser.ts","../../../src/new/platform-apis/admin/useFoundryUsersList.ts","../../../src/new/useLinks.ts","../../../src/new/useObjectSet.tsx","../../../src/new/useOsdkAction.ts","../../../src/new/useOsdkAggregation.ts","../../../src/new/useOsdkFunction.ts","../../../src/new/useOsdkObject.ts","../../../src/new/useOsdkObjects.ts","../../../src/utils/useDebouncedCallback.ts"],"names":["useMemo","createObservableClient","React","OsdkContext","Users","computeObjectSetC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Y,OAAU,GAAA,IAAA;AACtB,IAAO,MAAA,EAAA;AACP,IAAW,UAAA,CAAA,OAAA,GAAU,WAAW,MAAM;AACpC,MAAK,KAAA,WAAA,CAAY,OAAQ,CAAA,GAAG,IAAI,CAAA;AAAA,OAC/B,KAAK,CAAA;AAAA,GACP,EAAA,CAAC,KAAO,EAAA,MAAM,CAAC,CAAA;AAClB,EAAAA,uBAAAA,CAAM,UAAU,MAAM;AACpB,IAAA,OAAO,MAAM;AACX,MAAO,MAAA,EAAA;AAAA,KACT;AAAA,GACF,EAAG,CAAC,MAAM,CAAC,CAAA;AACX,EAAO,OAAA,MAAA,CAAO,OAAO,iBAAmB,EAAA;AAAA,IACtC,MAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH","file":"experimental.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 OsdkContext2 = /*#__PURE__*/React.createContext({\n client: fakeClient,\n observableClient: undefined\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 { createObservableClient } from \"@osdk/client/unstable-do-not-use\";\nimport React, { useMemo } from \"react\";\nimport { OsdkContext } from \"../OsdkContext.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function OsdkProvider2({\n children,\n client,\n observableClient\n}) {\n observableClient = useMemo(() => observableClient ?? createObservableClient(client), [client, observableClient]);\n return /*#__PURE__*/React.createElement(OsdkContext2.Provider, {\n value: {\n client,\n observableClient\n }\n }, /*#__PURE__*/React.createElement(OsdkContext.Provider, {\n value: {\n client\n }\n }, children));\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\nexport function makeExternalStore(createObservation, _name, 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 return {\n subscribe,\n getSnapShot\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 React from \"react\";\nimport { 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 }), process.env.NODE_ENV !== \"production\" ? `${queryName} Query [DISABLED]` : undefined);\n }\n return makeExternalStore(observer => {\n observerRef.current = observer;\n handleQuery();\n return {\n unsubscribe: () => {\n observerRef.current = undefined;\n }\n };\n }, queryName);\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 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 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 { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nconst emptyArray = Object.freeze([]);\n\n/**\n * Hook to observe links from an object or array of objects.\n *\n * @param objects The source object(s) to observe links from\n * @param linkName The name of the link to observe\n * @param options Optional configuration for the link query\n * @returns UseLinksResult with links data and metadata\n */\nexport function useLinks(objects, linkName, options = {}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const {\n enabled = true,\n ...otherOptions\n } = options;\n const stableWhere = React.useMemo(() => otherOptions.where, [JSON.stringify(otherOptions.where)]);\n const stableOrderBy = React.useMemo(() => otherOptions.orderBy, [JSON.stringify(otherOptions.orderBy)]);\n const objectsKey = React.useMemo(() => {\n if (objects === undefined) return \"\";\n const arr = Array.isArray(objects) ? objects : [objects];\n return arr.map(obj => `${obj.$apiName}:${obj.$primaryKey}`).join(\",\");\n }, [objects]);\n\n // Convert single object to array for consistent handling\n const objectsArray = React.useMemo(() => {\n return objects === undefined ? emptyArray : Array.isArray(objects) ? objects : [objects];\n }, [objectsKey, objects]);\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), `links ${linkName} for ${objectsKey} [DISABLED]`);\n }\n return makeExternalStore(observer => observableClient.observeLinks(objectsArray, linkName, {\n linkName,\n where: stableWhere,\n pageSize: otherOptions.pageSize,\n orderBy: stableOrderBy,\n mode: otherOptions.mode\n }, observer), `links ${linkName} for ${objectsKey}`);\n }, [enabled, observableClient, objectsArray, objectsKey, linkName, stableWhere, otherOptions.pageSize, stableOrderBy, otherOptions.mode]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n return {\n links: payload?.resolvedList,\n isLoading: enabled ? payload?.status === \"loading\" || payload?.status === \"init\" || !payload : false,\n isOptimistic: payload?.isOptimistic ?? false,\n error: payload?.error,\n fetchMore: payload?.hasMore ? payload?.fetchMore : undefined,\n hasMore: payload?.hasMore ?? false\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 { computeObjectSetCacheKey } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n/**\n * React hook for observing and interacting with OSDK object sets.\n *\n * @typeParam Q - The object type definition\n * @typeParam BaseRDPs - Derived properties that already exist on the input ObjectSet\n * @typeParam RDPs - New derived properties to be added via options.withProperties\n *\n * @param baseObjectSet - The ObjectSet to observe (may already have derived properties)\n * @param options - Options for filtering, sorting, and adding new derived properties\n * @returns Object set data with both existing and new derived properties\n */\nexport function useObjectSet(baseObjectSet, options = {}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const {\n enabled = true,\n streamUpdates,\n ...otherOptions\n } = options;\n\n // Track object type to detect when we switch to a different object type\n const objectTypeKey = baseObjectSet.$objectSetInternals.def.apiName;\n const previousObjectTypeRef = React.useRef(objectTypeKey);\n const previousPayloadRef = React.useRef();\n const objectTypeChanged = previousObjectTypeRef.current !== objectTypeKey;\n if (objectTypeChanged) {\n previousObjectTypeRef.current = objectTypeKey;\n }\n\n // Compute a stable cache key for the ObjectSet and options\n // dedupeIntervalMs and enabled are excluded as they don't affect the data\n const stableKey = computeObjectSetCacheKey(baseObjectSet, {\n where: otherOptions.where,\n withProperties: otherOptions.withProperties,\n union: otherOptions.union,\n intersect: otherOptions.intersect,\n subtract: otherOptions.subtract,\n pivotTo: otherOptions.pivotTo,\n pageSize: otherOptions.pageSize,\n orderBy: otherOptions.orderBy\n });\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), process.env.NODE_ENV !== \"production\" ? `objectSet ${stableKey} [DISABLED]` : void 0);\n }\n const initialValue = objectTypeChanged ? undefined : previousPayloadRef.current;\n return makeExternalStore(observer => {\n const subscription = observableClient.observeObjectSet(baseObjectSet, {\n where: otherOptions.where,\n withProperties: otherOptions.withProperties,\n union: otherOptions.union,\n intersect: otherOptions.intersect,\n subtract: otherOptions.subtract,\n pivotTo: otherOptions.pivotTo,\n pageSize: otherOptions.pageSize,\n orderBy: otherOptions.orderBy,\n dedupeInterval: otherOptions.dedupeIntervalMs ?? 2_000,\n autoFetchMore: otherOptions.autoFetchMore,\n streamUpdates\n }, observer);\n return subscription;\n }, process.env.NODE_ENV !== \"production\" ? `objectSet ${stableKey}` : void 0, initialValue);\n }, [enabled, observableClient, stableKey, streamUpdates, objectTypeChanged]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n React.useEffect(() => {\n if (payload) {\n previousPayloadRef.current = payload;\n }\n }, [payload]);\n return {\n data: payload?.resolvedList,\n isLoading: payload?.status === \"loading\" || !payload && true || false,\n error: payload && \"error\" in payload ? payload.error : undefined,\n fetchMore: payload?.hasMore ? payload.fetchMore : undefined,\n objectSet: payload?.objectSet || baseObjectSet,\n totalCount: payload?.totalCount\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 { ActionValidationError } from \"@osdk/client\";\nimport React from \"react\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function useOsdkAction(actionDef) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const [error, setError] = React.useState();\n const [data, setData] = React.useState();\n const [isPending, setPending] = React.useState(false);\n const [isValidating, setValidating] = React.useState(false);\n const [validationResult, setValidationResult] = React.useState();\n const abortControllerRef = React.useRef(null);\n const applyAction = React.useCallback(async function applyAction(hookArgs) {\n try {\n // If validation is in progress, abort it\n if (isValidating && abortControllerRef.current) {\n abortControllerRef.current.abort();\n setValidating(false);\n }\n setPending(true);\n setError(undefined);\n if (Array.isArray(hookArgs)) {\n const updates = [];\n const args = hookArgs.map(a => {\n const {\n $optimisticUpdate,\n ...args\n } = a;\n if ($optimisticUpdate) {\n updates.push($optimisticUpdate);\n }\n return args;\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 {\n $optimisticUpdate,\n ...args\n } = hookArgs;\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({\n unknown: e\n });\n }\n } finally {\n setPending(false);\n }\n }, [observableClient, actionDef, isValidating]);\n const validateAction = React.useCallback(async function validateAction(args) {\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 setValidating(true);\n setError(undefined);\n const result = await observableClient.validateAction(actionDef, args);\n\n // Check if aborted\n if (abortController.signal.aborted) {\n return undefined;\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 if (e instanceof ActionValidationError) {\n setError({\n actionValidation: e\n });\n } else {\n setError({\n unknown: e\n });\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 return {\n applyAction,\n validateAction,\n error,\n data,\n isPending,\n isValidating,\n validationResult\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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n/**\n * React hook for performing aggregations on OSDK object sets.\n *\n * Executes server-side aggregations with groupBy and metric calculations on filtered object sets.\n * Supports runtime derived properties and where clauses.\n *\n * @param type - The object or interface type to aggregate\n * @param options - Aggregation configuration including where clause, aggregation spec, and optional derived properties\n * @returns Object containing aggregation results, loading state, error state, and refetch function\n *\n * @example\n * ```tsx\n * const { data, isLoading, error } = useOsdkAggregation(Employee, {\n * where: { department: \"Engineering\" },\n * aggregate: {\n * groupBy: { department: \"exact\" },\n * select: {\n * avgSalary: { $avg: \"salary\" },\n * count: { $count: {} }\n * }\n * }\n * });\n * ```\n */\nexport function useOsdkAggregation(type, {\n where = {},\n withProperties,\n aggregate,\n dedupeIntervalMs\n}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const canonWhere = observableClient.canonicalizeWhereClause(where ?? {});\n const stableWithProperties = React.useMemo(() => withProperties, [JSON.stringify(withProperties)]);\n const stableAggregate = React.useMemo(() => aggregate, [JSON.stringify(aggregate)]);\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => makeExternalStore(observer => observableClient.observeAggregation({\n type: type,\n where: canonWhere,\n withProperties: stableWithProperties,\n aggregate: stableAggregate,\n dedupeInterval: dedupeIntervalMs ?? 2_000\n }, observer), process.env.NODE_ENV !== \"production\" ? `aggregation ${type.apiName} ${JSON.stringify(canonWhere)}` : void 0), [observableClient, type.apiName, type.type, canonWhere, stableWithProperties, stableAggregate, dedupeIntervalMs]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n let error;\n if (payload && \"error\" in payload && payload.error) {\n error = payload.error;\n } else if (payload?.status === \"error\") {\n error = new Error(\"Failed to execute aggregation\");\n }\n const refetch = React.useCallback(async () => {\n await observableClient.invalidateObjectType(type.apiName);\n }, [observableClient, type.apiName]);\n return {\n data: payload?.result,\n isLoading: payload?.status === \"loading\" || payload?.status === \"init\" || !payload,\n error,\n 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 { getWireObjectSet } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n/**\n * React hook for executing and observing OSDK functions.\n *\n * Provides automatic caching, deduplication, and reactive updates for function calls.\n * Functions are automatically re-fetched when dependencies change (configured via options).\n *\n * @param queryDef - The QueryDefinition to execute\n * @param options - Configuration options for the function call\n * @returns Object containing result, loading state, error, and refetch function\n *\n * @example Basic usage\n * ```tsx\n * const { data, isLoading, error } = useOsdkFunction(getEmployeeStats, {\n * params: { departmentId: \"engineering\" }\n * });\n * ```\n *\n * @example With dependency tracking\n * ```tsx\n * const { data, refetch } = useOsdkFunction(calculateMetrics, {\n * params: { startDate, endDate },\n * dependsOn: [Employee, Project],\n * });\n * ```\n *\n * @example With specific object dependencies\n * ```tsx\n * const { data } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee.$primaryKey },\n * dependsOnObjects: [employee],\n * });\n * ```\n */\nexport function useOsdkFunction(queryDef, options = {}) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\n const {\n params,\n dependsOn,\n dependsOnObjects,\n dedupeIntervalMs,\n enabled = true\n } = options;\n const stableParams = React.useMemo(() => params, [JSON.stringify(params)]);\n const stableDependsOn = React.useMemo(() => dependsOn, [JSON.stringify(dependsOn?.map(d => typeof d === \"string\" ? d : d.apiName))]);\n const stableDependsOnObjects = React.useMemo(() => dependsOnObjects, [JSON.stringify(dependsOnObjects?.map(item => \"$apiName\" in item ? {\n $apiName: item.$apiName,\n $primaryKey: item.$primaryKey\n } : {\n __objectSet: getWireObjectSet(item)\n }))]);\n\n // Record<string, unknown> required as typing is figured out at runtime\n const paramsForApi = stableParams;\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), process.env.NODE_ENV !== \"production\" ? `function ${queryDef.apiName} ${JSON.stringify(stableParams)} [DISABLED]` : void 0);\n }\n return makeExternalStore(observer => observableClient.observeFunction(queryDef, paramsForApi, {\n dependsOn: stableDependsOn,\n dependsOnObjects: stableDependsOnObjects,\n dedupeInterval: dedupeIntervalMs ?? 2_000\n }, observer), process.env.NODE_ENV !== \"production\" ? `function ${queryDef.apiName} ${JSON.stringify(stableParams)}` : void 0);\n }, [observableClient, queryDef.apiName, queryDef.version, paramsForApi, stableDependsOn, stableDependsOnObjects, dedupeIntervalMs, enabled]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n const error = payload?.error ?? (payload?.status === \"error\" ? new Error(\"Failed to execute function\") : undefined);\n const refetch = React.useCallback(() => {\n void observableClient.invalidateFunction(queryDef, paramsForApi);\n }, [observableClient, queryDef, paramsForApi]);\n return {\n data: payload?.result,\n isLoading: payload?.status === \"loading\",\n error,\n lastUpdated: payload?.lastUpdated ?? 0,\n 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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\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 */\n\n/**\n * Loads an object by type and primary key.\n *\n * @param type\n * @param primaryKey\n * @param enabled Enable or disable the query (defaults to true)\n */\n\n/*\n Implementation of useOsdkObject\n */\nexport function useOsdkObject(...args) {\n const {\n observableClient\n } = 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 enabled flag - 2nd param for instance signature, 3rd for type signature\n const enabled = isInstanceSignature ? typeof args[1] === \"boolean\" ? args[1] : true : typeof args[2] === \"boolean\" ? args[2] : true;\n\n // TODO: Figure out what the correct default behavior is for the various scenarios\n const mode = isInstanceSignature ? \"offline\" : undefined;\n const objectType = isInstanceSignature ? args[0].$objectType : args[0].apiName;\n const primaryKey = isInstanceSignature ? args[0].$primaryKey : args[1];\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), `object ${objectType} ${primaryKey} [DISABLED]`);\n }\n return makeExternalStore(observer => observableClient.observeObject(objectType, primaryKey, {\n mode\n }, observer), `object ${objectType} ${primaryKey}`);\n }, [enabled, observableClient, objectType, primaryKey, mode]);\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n let error;\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 return {\n object: payload?.object,\n isLoading: enabled ? payload?.status === \"loading\" || payload?.status === \"init\" || !payload : false,\n isOptimistic: !!payload?.isOptimistic,\n error,\n forceUpdate: () => {\n throw new Error(\"not implemented\");\n }\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 React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\nexport function useOsdkObjects(type, options) {\n const {\n observableClient\n } = React.useContext(OsdkContext2);\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 } = options ?? {};\n const canonWhere = observableClient.canonicalizeWhereClause(where ?? {});\n const stableRids = React.useMemo(() => rids, [JSON.stringify(rids)]);\n const stableWithProperties = React.useMemo(() => withProperties, [JSON.stringify(withProperties)]);\n const stableIntersectWith = React.useMemo(() => intersectWith, [JSON.stringify(intersectWith)]);\n const stableOrderBy = React.useMemo(() => orderBy, [JSON.stringify(orderBy)]);\n const {\n subscribe,\n getSnapShot\n } = React.useMemo(() => {\n if (!enabled) {\n return makeExternalStore(() => ({\n unsubscribe: () => {}\n }), process.env.NODE_ENV !== \"production\" ? `list ${type.apiName} [DISABLED]` : void 0);\n }\n return makeExternalStore(observer => observableClient.observeList({\n type,\n rids: stableRids,\n where: canonWhere,\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 ? {\n pivotTo\n } : {})\n }, observer), process.env.NODE_ENV !== \"production\" ? `list ${type.apiName} ${stableRids ? `[${stableRids.length} rids]` : \"\"} ${JSON.stringify(canonWhere)}` : void 0);\n }, [enabled, observableClient, type, stableRids, canonWhere, dedupeIntervalMs, pageSize, stableOrderBy, streamUpdates, stableWithProperties, autoFetchMore, stableIntersectWith, pivotTo]);\n const listPayload = React.useSyncExternalStore(subscribe, getSnapShot);\n let error;\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 return {\n fetchMore: listPayload?.hasMore ? listPayload.fetchMore : undefined,\n error,\n data: listPayload?.resolvedList,\n isLoading: enabled ? listPayload?.status === \"loading\" || listPayload?.status === \"init\" || !listPayload : false,\n isOptimistic: listPayload?.isOptimistic ?? false,\n totalCount: listPayload?.totalCount\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 React from \"react\";\n/**\n * Creates a debounced version of a callback function.\n *\n * @param callback The function to debounce\n * @param delay The delay in milliseconds\n * @returns A debounced function with cancel() and flush() methods\n *\n * @example\n * ```tsx\n * const { applyAction } = useOsdkAction(editOffice);\n *\n * const debouncedSave = useDebouncedCallback(\n * async (name: string) => {\n * await applyAction({\n * Office: office,\n * name,\n * location: office.location!,\n * $optimisticUpdate: (ctx) => {\n * ctx.updateObject(office.$clone({ name }));\n * },\n * });\n * },\n * 1000\n * );\n *\n * <input onChange={(e) => debouncedSave(e.target.value)} />\n * ```\n */\nexport function useDebouncedCallback(callback, delay) {\n const timeoutRef = React.useRef();\n const callbackRef = React.useRef(callback);\n const lastArgsRef = React.useRef();\n callbackRef.current = callback;\n const cancel = React.useCallback(() => {\n if (timeoutRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n }\n }, []);\n const flush = React.useCallback(() => {\n if (timeoutRef.current && lastArgsRef.current) {\n clearTimeout(timeoutRef.current);\n timeoutRef.current = undefined;\n void callbackRef.current(...lastArgsRef.current);\n }\n }, []);\n const debouncedCallback = React.useCallback((...args) => {\n lastArgsRef.current = args;\n cancel();\n timeoutRef.current = setTimeout(() => {\n void callbackRef.current(...args);\n }, delay);\n }, [delay, cancel]);\n React.useEffect(() => {\n return () => {\n cancel();\n };\n }, [cancel]);\n return Object.assign(debouncedCallback, {\n cancel,\n flush\n });\n}"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Client, Osdk, WhereClause, PropertyKeys, ActionDefinition, ActionEditResponse, ActionValidationError, ActionValidationResponse } from '@osdk/client';
|
|
2
|
-
import { ObservableClient, ActionSignatureFromDef, QueryParameterType
|
|
2
|
+
import { ObservableClient, ActionSignatureFromDef, QueryParameterType } from '@osdk/client/unstable-do-not-use';
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import { User, ListUsersResponse } from '@osdk/foundry.admin';
|
|
5
5
|
import { UserStatus } from '@osdk/foundry.core';
|
|
@@ -410,17 +410,23 @@ interface UseOsdkFunctionOptions<Q extends QueryDefinition<unknown>> {
|
|
|
410
410
|
*/
|
|
411
411
|
dependsOn?: Array<ObjectTypeDefinition | string>;
|
|
412
412
|
/**
|
|
413
|
-
* Specific object instances this function depends on.
|
|
413
|
+
* Specific object instances or ObjectSets this function depends on.
|
|
414
414
|
* When any of these specific objects change, the function will refetch.
|
|
415
415
|
* More fine-grained than dependsOn for precise invalidation control.
|
|
416
416
|
*
|
|
417
|
+
* For ObjectSets, the object type is extracted asynchronously and changes
|
|
418
|
+
* to any object of that type will trigger a refetch.
|
|
419
|
+
*
|
|
417
420
|
* @example
|
|
418
421
|
* ```tsx
|
|
419
422
|
* // Refetch when this specific employee changes
|
|
420
423
|
* { dependsOnObjects: [employee] }
|
|
424
|
+
*
|
|
425
|
+
* // Refetch when any object in the ObjectSet's type changes
|
|
426
|
+
* { dependsOnObjects: [employeeObjectSet] }
|
|
421
427
|
* ```
|
|
422
428
|
*/
|
|
423
|
-
dependsOnObjects?: Array<Osdk$1.Instance<ObjectTypeDefinition>>;
|
|
429
|
+
dependsOnObjects?: Array<Osdk$1.Instance<ObjectTypeDefinition> | ObjectSet<ObjectTypeDefinition>>;
|
|
424
430
|
/**
|
|
425
431
|
* The number of milliseconds to dedupe identical function calls.
|
|
426
432
|
* Two calls with the same function and params will share results
|
|
@@ -449,7 +455,7 @@ interface UseOsdkFunctionResult<Q extends QueryDefinition<unknown>> {
|
|
|
449
455
|
/**
|
|
450
456
|
* The function result, or undefined if not yet loaded or on error.
|
|
451
457
|
*/
|
|
452
|
-
data:
|
|
458
|
+
data: (CompileTimeMetadata<Q>["signature"] extends (...args: never[]) => infer R ? Awaited<R> : never) | undefined;
|
|
453
459
|
/**
|
|
454
460
|
* True while the function is executing.
|
|
455
461
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkObjectsWithProperties.js","names":["Employee","useOsdkObjects","TestComponent","data","withProperties","constantValue","employee","
|
|
1
|
+
{"version":3,"file":"useOsdkObjectsWithProperties.js","names":["Employee","useOsdkObjects","TestComponent","data","withProperties","constantValue","employee","constant","integer"],"sources":["useOsdkObjectsWithProperties.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\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction TestComponent() {\n const withProps: DerivedProperty.Clause<typeof Employee> = {\n constantValue: (employee) => employee.constant.integer(42),\n };\n\n const { data } = useOsdkObjects(Employee, {\n withProperties: withProps,\n });\n\n return null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AACrD,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,SAASC,aAAaA,CAAA,EAAG;EAKvB,MAAM;IAAEC;EAAK,CAAC,GAAGF,cAAc,CAACD,QAAQ,EAAE;IACxCI,cAAc,EAL2C;MACzDC,aAAa,EAAGC,QAAQ,IAAKA,QAAQ,CAACC,QAAQ,CAACC,OAAO,CAAC,EAAE;IAC3D;EAIA,CAAC,CAAC;EAEF,OAAO,IAAI;AACb","ignoreList":[]}
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import { getWireObjectSet } from "@osdk/client/unstable-do-not-use";
|
|
17
18
|
import React from "react";
|
|
18
19
|
import { makeExternalStore } from "./makeExternalStore.js";
|
|
19
20
|
import { OsdkContext2 } from "./OsdkContext2.js";
|
|
@@ -63,10 +64,12 @@ export function useOsdkFunction(queryDef, options = {}) {
|
|
|
63
64
|
} = options;
|
|
64
65
|
const stableParams = React.useMemo(() => params, [JSON.stringify(params)]);
|
|
65
66
|
const stableDependsOn = React.useMemo(() => dependsOn, [JSON.stringify(dependsOn?.map(d => typeof d === "string" ? d : d.apiName))]);
|
|
66
|
-
const stableDependsOnObjects = React.useMemo(() => dependsOnObjects, [JSON.stringify(dependsOnObjects?.map(
|
|
67
|
-
$apiName:
|
|
68
|
-
$primaryKey:
|
|
69
|
-
}
|
|
67
|
+
const stableDependsOnObjects = React.useMemo(() => dependsOnObjects, [JSON.stringify(dependsOnObjects?.map(item => "$apiName" in item ? {
|
|
68
|
+
$apiName: item.$apiName,
|
|
69
|
+
$primaryKey: item.$primaryKey
|
|
70
|
+
} : {
|
|
71
|
+
__objectSet: getWireObjectSet(item)
|
|
72
|
+
}))]);
|
|
70
73
|
|
|
71
74
|
// Record<string, unknown> required as typing is figured out at runtime
|
|
72
75
|
const paramsForApi = stableParams;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOsdkFunction.js","names":["React","makeExternalStore","OsdkContext2","useOsdkFunction","queryDef","options","observableClient","useContext","params","dependsOn","dependsOnObjects","dedupeIntervalMs","enabled","stableParams","useMemo","JSON","stringify","stableDependsOn","map","d","apiName","stableDependsOnObjects","o","$apiName","$primaryKey","paramsForApi","subscribe","getSnapShot","unsubscribe","process","env","NODE_ENV","observer","observeFunction","dedupeInterval","version","payload","useSyncExternalStore","error","status","Error","undefined","refetch","useCallback","invalidateFunction","data","result","isLoading","lastUpdated"],"sources":["useOsdkFunction.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n ObjectTypeDefinition,\n Osdk,\n QueryDefinition,\n} from \"@osdk/api\";\nimport type {\n ObserveFunctionCallbackArgs,\n QueryParameterType,\n QueryReturnType,\n} from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkFunctionOptions<Q extends QueryDefinition<unknown>> {\n /**\n * Parameters to pass to the function.\n * Must include all required parameters; optional parameters can be omitted.\n */\n params?: CompileTimeMetadata<Q>[\"parameters\"] extends Record<string, never>\n ? undefined\n : QueryParameterType<CompileTimeMetadata<Q>[\"parameters\"]>;\n\n /**\n * Object types this function depends on.\n * When actions modify objects of these types, the function will automatically refetch.\n *\n * @example\n * ```tsx\n * // Refetch when any Employee object changes\n * { dependsOn: [Employee] }\n * ```\n */\n dependsOn?: Array<ObjectTypeDefinition | string>;\n\n /**\n * Specific object instances this function depends on.\n * When any of these specific objects change, the function will refetch.\n * More fine-grained than dependsOn for precise invalidation control.\n *\n * @example\n * ```tsx\n * // Refetch when this specific employee changes\n * { dependsOnObjects: [employee] }\n * ```\n */\n dependsOnObjects?: Array<Osdk.Instance<ObjectTypeDefinition>>;\n\n /**\n * The number of milliseconds to dedupe identical function calls.\n * Two calls with the same function and params will share results\n * if the second call is within this interval of the first.\n * @default 2000\n */\n dedupeIntervalMs?: number;\n\n /**\n * Whether to enable the query. When false, the query will not execute.\n * Useful for:\n * - Dependent queries that need to wait for other data\n * - Conditional queries based on component state\n *\n * @default true\n * @example\n * // Dependent query - wait for required data\n * const { data: employee } = useOsdkObject(Employee, employeeId);\n * const { data: report } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee?.$primaryKey },\n * enabled: !!employee\n * });\n */\n enabled?: boolean;\n}\n\nexport interface UseOsdkFunctionResult<Q extends QueryDefinition<unknown>> {\n /**\n * The function result, or undefined if not yet loaded or on error.\n */\n data: QueryReturnType<CompileTimeMetadata<Q>[\"output\"]> | undefined;\n\n /**\n * True while the function is executing.\n */\n isLoading: boolean;\n\n /**\n * Error if the function execution failed.\n */\n error: Error | undefined;\n\n /**\n * Timestamp (ms since epoch) of when the result was last fetched.\n */\n lastUpdated: number;\n\n /**\n * Manually refetch the function.\n * Useful for \"pull to refresh\" or retry patterns.\n */\n refetch: () => void;\n}\n\ndeclare const process: {\n env: {\n NODE_ENV: \"development\" | \"production\";\n };\n};\n\n/**\n * React hook for executing and observing OSDK functions.\n *\n * Provides automatic caching, deduplication, and reactive updates for function calls.\n * Functions are automatically re-fetched when dependencies change (configured via options).\n *\n * @param queryDef - The QueryDefinition to execute\n * @param options - Configuration options for the function call\n * @returns Object containing result, loading state, error, and refetch function\n *\n * @example Basic usage\n * ```tsx\n * const { data, isLoading, error } = useOsdkFunction(getEmployeeStats, {\n * params: { departmentId: \"engineering\" }\n * });\n * ```\n *\n * @example With dependency tracking\n * ```tsx\n * const { data, refetch } = useOsdkFunction(calculateMetrics, {\n * params: { startDate, endDate },\n * dependsOn: [Employee, Project],\n * });\n * ```\n *\n * @example With specific object dependencies\n * ```tsx\n * const { data } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee.$primaryKey },\n * dependsOnObjects: [employee],\n * });\n * ```\n */\nexport function useOsdkFunction<Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n options: UseOsdkFunctionOptions<Q> = {},\n): UseOsdkFunctionResult<Q> {\n const { observableClient } = React.useContext(OsdkContext2);\n const {\n params,\n dependsOn,\n dependsOnObjects,\n dedupeIntervalMs,\n enabled = true,\n } = options;\n\n const stableParams = React.useMemo(\n () => params,\n [JSON.stringify(params)],\n );\n const stableDependsOn = React.useMemo(\n () => dependsOn,\n [JSON.stringify(\n dependsOn?.map(d => typeof d === \"string\" ? d : d.apiName),\n )],\n );\n const stableDependsOnObjects = React.useMemo(\n () => dependsOnObjects,\n [JSON.stringify(\n dependsOnObjects?.map(o => ({\n $apiName: o.$apiName,\n $primaryKey: o.$primaryKey,\n })),\n )],\n );\n\n // Record<string, unknown> required as typing is figured out at runtime\n const paramsForApi = stableParams as Record<string, unknown> | undefined;\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<ObserveFunctionCallbackArgs<Q>>(\n () => ({ unsubscribe: () => {} }),\n process.env.NODE_ENV !== \"production\"\n ? `function ${queryDef.apiName} ${\n JSON.stringify(stableParams)\n } [DISABLED]`\n : void 0,\n );\n }\n return makeExternalStore<ObserveFunctionCallbackArgs<Q>>(\n (observer) =>\n observableClient.observeFunction(\n queryDef,\n paramsForApi,\n {\n dependsOn: stableDependsOn,\n dependsOnObjects: stableDependsOnObjects,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n },\n observer,\n ),\n process.env.NODE_ENV !== \"production\"\n ? `function ${queryDef.apiName} ${JSON.stringify(stableParams)}`\n : void 0,\n );\n },\n [\n observableClient,\n queryDef.apiName,\n queryDef.version,\n paramsForApi,\n stableDependsOn,\n stableDependsOnObjects,\n dedupeIntervalMs,\n enabled,\n ],\n );\n\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n const error = payload?.error\n ?? (payload?.status === \"error\"\n ? new Error(\"Failed to execute function\")\n : undefined);\n\n const refetch = React.useCallback(() => {\n void observableClient.invalidateFunction(queryDef, paramsForApi);\n }, [observableClient, queryDef, paramsForApi]);\n\n return {\n data: payload?.result as\n | QueryReturnType<CompileTimeMetadata<Q>[\"output\"]>\n | undefined,\n isLoading: payload?.status === \"loading\",\n error,\n lastUpdated: payload?.lastUpdated ?? 0,\n refetch,\n };\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;AAgGhD;AACA;AACA;AACA;AACA;AACA;AAC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AAEX,OAAO,EAAEG,MAAM,KAAK,SAAS;IACxCD,KAAK;IACLU,WAAW,EAAEZ,OAAO,EAAEY,WAAW,IAAI,CAAC;IACtCN;EACF,CAAC;AACH","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"useOsdkFunction.js","names":["getWireObjectSet","React","makeExternalStore","OsdkContext2","useOsdkFunction","queryDef","options","observableClient","useContext","params","dependsOn","dependsOnObjects","dedupeIntervalMs","enabled","stableParams","useMemo","JSON","stringify","stableDependsOn","map","d","apiName","stableDependsOnObjects","item","$apiName","$primaryKey","__objectSet","paramsForApi","subscribe","getSnapShot","unsubscribe","process","env","NODE_ENV","observer","observeFunction","dedupeInterval","version","payload","useSyncExternalStore","error","status","Error","undefined","refetch","useCallback","invalidateFunction","data","result","isLoading","lastUpdated"],"sources":["useOsdkFunction.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n CompileTimeMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n QueryDefinition,\n} from \"@osdk/api\";\nimport type {\n ObserveFunctionCallbackArgs,\n QueryParameterType,\n} from \"@osdk/client/unstable-do-not-use\";\nimport { getWireObjectSet } from \"@osdk/client/unstable-do-not-use\";\nimport React from \"react\";\nimport { makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext2 } from \"./OsdkContext2.js\";\n\nexport interface UseOsdkFunctionOptions<Q extends QueryDefinition<unknown>> {\n /**\n * Parameters to pass to the function.\n * Must include all required parameters; optional parameters can be omitted.\n */\n params?: CompileTimeMetadata<Q>[\"parameters\"] extends Record<string, never>\n ? undefined\n : QueryParameterType<CompileTimeMetadata<Q>[\"parameters\"]>;\n\n /**\n * Object types this function depends on.\n * When actions modify objects of these types, the function will automatically refetch.\n *\n * @example\n * ```tsx\n * // Refetch when any Employee object changes\n * { dependsOn: [Employee] }\n * ```\n */\n dependsOn?: Array<ObjectTypeDefinition | string>;\n\n /**\n * Specific object instances or ObjectSets this function depends on.\n * When any of these specific objects change, the function will refetch.\n * More fine-grained than dependsOn for precise invalidation control.\n *\n * For ObjectSets, the object type is extracted asynchronously and changes\n * to any object of that type will trigger a refetch.\n *\n * @example\n * ```tsx\n * // Refetch when this specific employee changes\n * { dependsOnObjects: [employee] }\n *\n * // Refetch when any object in the ObjectSet's type changes\n * { dependsOnObjects: [employeeObjectSet] }\n * ```\n */\n dependsOnObjects?: Array<\n Osdk.Instance<ObjectTypeDefinition> | ObjectSet<ObjectTypeDefinition>\n >;\n\n /**\n * The number of milliseconds to dedupe identical function calls.\n * Two calls with the same function and params will share results\n * if the second call is within this interval of the first.\n * @default 2000\n */\n dedupeIntervalMs?: number;\n\n /**\n * Whether to enable the query. When false, the query will not execute.\n * Useful for:\n * - Dependent queries that need to wait for other data\n * - Conditional queries based on component state\n *\n * @default true\n * @example\n * // Dependent query - wait for required data\n * const { data: employee } = useOsdkObject(Employee, employeeId);\n * const { data: report } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee?.$primaryKey },\n * enabled: !!employee\n * });\n */\n enabled?: boolean;\n}\n\nexport interface UseOsdkFunctionResult<Q extends QueryDefinition<unknown>> {\n /**\n * The function result, or undefined if not yet loaded or on error.\n */\n data:\n | (CompileTimeMetadata<Q>[\"signature\"] extends (...args: never[]) => infer R\n ? Awaited<R>\n : never)\n | undefined;\n\n /**\n * True while the function is executing.\n */\n isLoading: boolean;\n\n /**\n * Error if the function execution failed.\n */\n error: Error | undefined;\n\n /**\n * Timestamp (ms since epoch) of when the result was last fetched.\n */\n lastUpdated: number;\n\n /**\n * Manually refetch the function.\n * Useful for \"pull to refresh\" or retry patterns.\n */\n refetch: () => void;\n}\n\ndeclare const process: {\n env: {\n NODE_ENV: \"development\" | \"production\";\n };\n};\n\n/**\n * React hook for executing and observing OSDK functions.\n *\n * Provides automatic caching, deduplication, and reactive updates for function calls.\n * Functions are automatically re-fetched when dependencies change (configured via options).\n *\n * @param queryDef - The QueryDefinition to execute\n * @param options - Configuration options for the function call\n * @returns Object containing result, loading state, error, and refetch function\n *\n * @example Basic usage\n * ```tsx\n * const { data, isLoading, error } = useOsdkFunction(getEmployeeStats, {\n * params: { departmentId: \"engineering\" }\n * });\n * ```\n *\n * @example With dependency tracking\n * ```tsx\n * const { data, refetch } = useOsdkFunction(calculateMetrics, {\n * params: { startDate, endDate },\n * dependsOn: [Employee, Project],\n * });\n * ```\n *\n * @example With specific object dependencies\n * ```tsx\n * const { data } = useOsdkFunction(getEmployeeReport, {\n * params: { employeeId: employee.$primaryKey },\n * dependsOnObjects: [employee],\n * });\n * ```\n */\nexport function useOsdkFunction<Q extends QueryDefinition<unknown>>(\n queryDef: Q,\n options: UseOsdkFunctionOptions<Q> = {},\n): UseOsdkFunctionResult<Q> {\n const { observableClient } = React.useContext(OsdkContext2);\n const {\n params,\n dependsOn,\n dependsOnObjects,\n dedupeIntervalMs,\n enabled = true,\n } = options;\n\n const stableParams = React.useMemo(\n () => params,\n [JSON.stringify(params)],\n );\n const stableDependsOn = React.useMemo(\n () => dependsOn,\n [JSON.stringify(\n dependsOn?.map(d => typeof d === \"string\" ? d : d.apiName),\n )],\n );\n const stableDependsOnObjects = React.useMemo(\n () => dependsOnObjects,\n [JSON.stringify(\n dependsOnObjects?.map(item =>\n \"$apiName\" in item\n ? { $apiName: item.$apiName, $primaryKey: item.$primaryKey }\n : { __objectSet: getWireObjectSet(item) }\n ),\n )],\n );\n\n // Record<string, unknown> required as typing is figured out at runtime\n const paramsForApi = stableParams as Record<string, unknown> | undefined;\n\n const { subscribe, getSnapShot } = React.useMemo(\n () => {\n if (!enabled) {\n return makeExternalStore<ObserveFunctionCallbackArgs<Q>>(\n () => ({ unsubscribe: () => {} }),\n process.env.NODE_ENV !== \"production\"\n ? `function ${queryDef.apiName} ${\n JSON.stringify(stableParams)\n } [DISABLED]`\n : void 0,\n );\n }\n return makeExternalStore<ObserveFunctionCallbackArgs<Q>>(\n (observer) =>\n observableClient.observeFunction(\n queryDef,\n paramsForApi,\n {\n dependsOn: stableDependsOn,\n dependsOnObjects: stableDependsOnObjects,\n dedupeInterval: dedupeIntervalMs ?? 2_000,\n },\n observer,\n ),\n process.env.NODE_ENV !== \"production\"\n ? `function ${queryDef.apiName} ${JSON.stringify(stableParams)}`\n : void 0,\n );\n },\n [\n observableClient,\n queryDef.apiName,\n queryDef.version,\n paramsForApi,\n stableDependsOn,\n stableDependsOnObjects,\n dedupeIntervalMs,\n enabled,\n ],\n );\n\n const payload = React.useSyncExternalStore(subscribe, getSnapShot);\n\n const error = payload?.error\n ?? (payload?.status === \"error\"\n ? new Error(\"Failed to execute function\")\n : undefined);\n\n const refetch = React.useCallback(() => {\n void observableClient.invalidateFunction(queryDef, paramsForApi);\n }, [observableClient, queryDef, paramsForApi]);\n\n return {\n data: payload?.result as UseOsdkFunctionResult<Q>[\"data\"],\n isLoading: payload?.status === \"loading\",\n error,\n lastUpdated: payload?.lastUpdated ?? 0,\n refetch,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,SAASA,gBAAgB,QAAQ,kCAAkC;AACnE,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,YAAY,QAAQ,mBAAmB;AA4GhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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K;IACLU,WAAW,EAAEZ,OAAO,EAAEY,WAAW,IAAI,CAAC;IACtCN;EACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { CompileTimeMetadata, ObjectTypeDefinition, Osdk, QueryDefinition } from "@osdk/api";
|
|
2
|
-
import type { QueryParameterType
|
|
1
|
+
import type { CompileTimeMetadata, ObjectSet, ObjectTypeDefinition, Osdk, QueryDefinition } from "@osdk/api";
|
|
2
|
+
import type { QueryParameterType } from "@osdk/client/unstable-do-not-use";
|
|
3
3
|
export interface UseOsdkFunctionOptions<Q extends QueryDefinition<unknown>> {
|
|
4
4
|
/**
|
|
5
5
|
* Parameters to pass to the function.
|
|
@@ -18,17 +18,23 @@ export interface UseOsdkFunctionOptions<Q extends QueryDefinition<unknown>> {
|
|
|
18
18
|
*/
|
|
19
19
|
dependsOn?: Array<ObjectTypeDefinition | string>;
|
|
20
20
|
/**
|
|
21
|
-
* Specific object instances this function depends on.
|
|
21
|
+
* Specific object instances or ObjectSets this function depends on.
|
|
22
22
|
* When any of these specific objects change, the function will refetch.
|
|
23
23
|
* More fine-grained than dependsOn for precise invalidation control.
|
|
24
24
|
*
|
|
25
|
+
* For ObjectSets, the object type is extracted asynchronously and changes
|
|
26
|
+
* to any object of that type will trigger a refetch.
|
|
27
|
+
*
|
|
25
28
|
* @example
|
|
26
29
|
* ```tsx
|
|
27
30
|
* // Refetch when this specific employee changes
|
|
28
31
|
* { dependsOnObjects: [employee] }
|
|
32
|
+
*
|
|
33
|
+
* // Refetch when any object in the ObjectSet's type changes
|
|
34
|
+
* { dependsOnObjects: [employeeObjectSet] }
|
|
29
35
|
* ```
|
|
30
36
|
*/
|
|
31
|
-
dependsOnObjects?: Array<Osdk.Instance<ObjectTypeDefinition>>;
|
|
37
|
+
dependsOnObjects?: Array<Osdk.Instance<ObjectTypeDefinition> | ObjectSet<ObjectTypeDefinition>>;
|
|
32
38
|
/**
|
|
33
39
|
* The number of milliseconds to dedupe identical function calls.
|
|
34
40
|
* Two calls with the same function and params will share results
|
|
@@ -57,7 +63,7 @@ export interface UseOsdkFunctionResult<Q extends QueryDefinition<unknown>> {
|
|
|
57
63
|
/**
|
|
58
64
|
* The function result, or undefined if not yet loaded or on error.
|
|
59
65
|
*/
|
|
60
|
-
data:
|
|
66
|
+
data: (CompileTimeMetadata<Q>["signature"] extends (...args: never[]) => infer R ? Awaited<R> : never) | undefined;
|
|
61
67
|
/**
|
|
62
68
|
* True while the function is executing.
|
|
63
69
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,qBACA,sBACA,MACA,uBACK,WAAY;AACnB,cAEE,
|
|
1
|
+
{"mappings":"AAgBA,cACE,qBACA,WACA,sBACA,MACA,uBACK,WAAY;AACnB,cAEE,0BACK,kCAAmC;AAM1C,iBAAiB,uBAAuB,UAAU,0BAA0B;;;;;CAK1E,SAAS,oBAAoB,GAAG,sBAAsB,oCAElD,mBAAmB,oBAAoB,GAAG;;;;;;;;;;;CAY9C,YAAY,MAAM;;;;;;;;;;;;;;;;;;CAmBlB,mBAAmB,MACjB,KAAK,SAAS,wBAAwB,UAAU;;;;;;;CASlD;;;;;;;;;;;;;;;;CAiBA;AACD;AAED,iBAAiB,sBAAsB,UAAU,0BAA0B;;;;CAIzE,OACK,oBAAoB,GAAG,sBAAsB,GAAG,wBAAwB,IACvE,QAAQ;;;;CAOd;;;;CAKA,OAAO;;;;CAKP;;;;;CAMA;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCD,OAAO,iBAAS,gBAAgB,UAAU,0BACxCA,UAAU,GACVC,UAAS,uBAAuB,KAC/B,sBAAsB","names":["queryDef: Q","options: UseOsdkFunctionOptions<Q>"],"sources":["../../../src/new/useOsdkFunction.ts"],"version":3,"file":"useOsdkFunction.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0-beta.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,13 +38,23 @@
|
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"@osdk/api": "*",
|
|
40
40
|
"@osdk/client": "*",
|
|
41
|
+
"@osdk/foundry.admin": "*",
|
|
42
|
+
"@osdk/foundry.core": "*",
|
|
41
43
|
"@types/react": "^17 || ^18 || ^19",
|
|
42
44
|
"react": "^17 || ^18 || ^19",
|
|
43
45
|
"react-dom": "^17 || ^18 || ^19"
|
|
44
46
|
},
|
|
47
|
+
"peerDependenciesMeta": {
|
|
48
|
+
"@osdk/foundry.admin": {
|
|
49
|
+
"optional": true
|
|
50
|
+
},
|
|
51
|
+
"@osdk/foundry.core": {
|
|
52
|
+
"optional": true
|
|
53
|
+
}
|
|
54
|
+
},
|
|
45
55
|
"devDependencies": {
|
|
46
|
-
"@osdk/foundry.admin": "2.
|
|
47
|
-
"@osdk/foundry.core": "2.
|
|
56
|
+
"@osdk/foundry.admin": "2.45.0",
|
|
57
|
+
"@osdk/foundry.core": "2.45.0",
|
|
48
58
|
"@testing-library/react": "^16.3.0",
|
|
49
59
|
"@types/react": "^18.3.24",
|
|
50
60
|
"find-up": "^8.0.0",
|
|
@@ -57,11 +67,11 @@
|
|
|
57
67
|
"react": "^18.3.1",
|
|
58
68
|
"tiny-invariant": "^1.3.3",
|
|
59
69
|
"typescript": "~5.5.4",
|
|
60
|
-
"@osdk/api": "2.
|
|
61
|
-
"@osdk/client": "2.
|
|
62
|
-
"@osdk/
|
|
63
|
-
"@osdk/monorepo.
|
|
64
|
-
"@osdk/
|
|
70
|
+
"@osdk/api": "2.8.0-beta.3",
|
|
71
|
+
"@osdk/client": "2.8.0-beta.3",
|
|
72
|
+
"@osdk/client.test.ontology": "2.8.0-beta.3",
|
|
73
|
+
"@osdk/monorepo.api-extractor": "~0.7.0-beta.1",
|
|
74
|
+
"@osdk/monorepo.tsconfig": "~0.7.0-beta.1"
|
|
65
75
|
},
|
|
66
76
|
"publishConfig": {
|
|
67
77
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/OsdkContext.ts","../../src/useOsdkClient.ts","../../src/useOsdkMetadata.ts"],"names":["React","error"],"mappings":";;;;;;;;;;;;;AAiBA,SAAS,gBAAgB,KAAO,EAAA;AAC9B,EAAM,MAAA,IAAI,MAAM,sEAAsE,CAAA;AACxF;AACA,IAAM,UAAA,GAAa,MAAO,CAAA,MAAA,CAAO,YAAc,EAAA;AAAA,EAC7C,aAAe,EAAA;AACjB,CAAC,CAAA;AACY,IAAA,WAAA,2CAAiC,aAAc,CAAA;AAAA,EAC1D,MAAQ,EAAA;AACV,CAAC;;;ACPM,SAAS,aAAgB,GAAA;AAC9B,EAAOA,OAAAA,uBAAAA,CAAM,UAAW,CAAA,WAAW,CAAE,CAAA,MAAA;AACvC;ACFO,SAAS,gBAAgB,IAAM,EAAA;AACpC,EAAA,MAAM,SAAS,aAAc,EAAA;AAC7B,EAAA,MAAM,CAAC,QAAU,EAAA,WAAW,CAAIA,GAAAA,uBAAAA,CAAM,SAAS,MAAS,CAAA;AACxD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIA,wBAAM,QAAS,EAAA;AACzC,EAAI,IAAA,CAAC,QAAY,IAAA,CAAC,KAAO,EAAA;AACvB,IAAA,MAAA,CAAO,aAAc,CAAA,IAAI,CAAE,CAAA,IAAA,CAAK,CAAmB,eAAA,KAAA;AACjD,MAAA,WAAA,CAAY,eAAe,CAAA;AAAA,KAC5B,CAAA,CAAE,KAAM,CAAA,CAAAC,MAAS,KAAA;AAChB,MAAA,MAAM,eAAeA,MAAiB,YAAA,KAAA,GAAQA,MAAM,CAAA,OAAA,GAAU,OAAOA,MAAK,CAAA;AAC1E,MAAA,QAAA,CAAS,YAAY,CAAA;AAAA,KACtB,CAAA;AACD,IAAO,OAAA;AAAA,MACL,OAAS,EAAA;AAAA,KACX;AAAA;AAEF,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,KAAA;AAAA,IACT,QAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-V32JHU3O.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 { OsdkContext } from \"./OsdkContext.js\";\nexport function useOsdkClient() {\n return React.useContext(OsdkContext).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}"]}
|