@osdk/react 2.25.0 → 2.25.1-main-90f7fb6fbd4d38d9eeb36c4bb00ec8ca7db8bd95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/browser/new/core/stableSerialize.js +42 -0
  3. package/build/browser/new/core/stableSerialize.js.map +1 -0
  4. package/build/browser/new/core/useStableObjectSet.js +5 -6
  5. package/build/browser/new/core/useStableObjectSet.js.map +1 -1
  6. package/build/browser/new/useOsdkFunction.js +11 -7
  7. package/build/browser/new/useOsdkFunction.js.map +1 -1
  8. package/build/browser/new/useOsdkFunctions.js +5 -2
  9. package/build/browser/new/useOsdkFunctions.js.map +1 -1
  10. package/build/browser/util/UserAgent.js +1 -1
  11. package/build/browser/util/UserAgent.js.map +1 -1
  12. package/build/cjs/{chunk-DQB7BTQS.cjs → chunk-OACPYYJN.cjs} +40 -21
  13. package/build/cjs/chunk-OACPYYJN.cjs.map +1 -0
  14. package/build/cjs/index.cjs +15 -15
  15. package/build/cjs/public/experimental.cjs +16 -16
  16. package/build/cjs/public/experimental.d.cts +3 -3
  17. package/build/esm/new/core/stableSerialize.js +42 -0
  18. package/build/esm/new/core/stableSerialize.js.map +1 -0
  19. package/build/esm/new/core/useStableObjectSet.js +5 -6
  20. package/build/esm/new/core/useStableObjectSet.js.map +1 -1
  21. package/build/esm/new/useOsdkFunction.js +11 -7
  22. package/build/esm/new/useOsdkFunction.js.map +1 -1
  23. package/build/esm/new/useOsdkFunctions.js +5 -2
  24. package/build/esm/new/useOsdkFunctions.js.map +1 -1
  25. package/build/esm/util/UserAgent.js +1 -1
  26. package/build/esm/util/UserAgent.js.map +1 -1
  27. package/build/types/new/core/stableSerialize.d.ts +13 -0
  28. package/build/types/new/core/stableSerialize.d.ts.map +1 -0
  29. package/build/types/new/core/useStableObjectSet.d.ts +3 -3
  30. package/build/types/new/useOsdkFunction.d.ts.map +1 -1
  31. package/package.json +6 -6
  32. package/build/browser/new/getStableQueriesKey.js +0 -31
  33. package/build/browser/new/getStableQueriesKey.js.map +0 -1
  34. package/build/cjs/chunk-DQB7BTQS.cjs.map +0 -1
  35. package/build/esm/new/getStableQueriesKey.js +0 -31
  36. package/build/esm/new/getStableQueriesKey.js.map +0 -1
  37. package/build/types/new/getStableQueriesKey.d.ts +0 -10
  38. package/build/types/new/getStableQueriesKey.d.ts.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkDQB7BTQS_cjs = require('./chunk-DQB7BTQS.cjs');
3
+ var chunkOACPYYJN_cjs = require('./chunk-OACPYYJN.cjs');
4
4
  var chunkOGP2DK2V_cjs = require('./chunk-OGP2DK2V.cjs');
5
5
  require('./chunk-UKQGMTMG.cjs');
6
6
  var chunkDO3NFBKN_cjs = require('./chunk-DO3NFBKN.cjs');
@@ -16,59 +16,59 @@ function useObservableClient() {
16
16
 
17
17
  Object.defineProperty(exports, "OsdkProvider", {
18
18
  enumerable: true,
19
- get: function () { return chunkDQB7BTQS_cjs.OsdkProvider; }
19
+ get: function () { return chunkOACPYYJN_cjs.OsdkProvider; }
20
20
  });
21
21
  Object.defineProperty(exports, "useDebouncedCallback", {
22
22
  enumerable: true,
23
- get: function () { return chunkDQB7BTQS_cjs.useDebouncedCallback; }
23
+ get: function () { return chunkOACPYYJN_cjs.useDebouncedCallback; }
24
24
  });
25
25
  Object.defineProperty(exports, "useLinks", {
26
26
  enumerable: true,
27
- get: function () { return chunkDQB7BTQS_cjs.useLinks; }
27
+ get: function () { return chunkOACPYYJN_cjs.useLinks; }
28
28
  });
29
29
  Object.defineProperty(exports, "useObjectSet", {
30
30
  enumerable: true,
31
- get: function () { return chunkDQB7BTQS_cjs.useObjectSet; }
31
+ get: function () { return chunkOACPYYJN_cjs.useObjectSet; }
32
32
  });
33
33
  Object.defineProperty(exports, "useOsdkAction", {
34
34
  enumerable: true,
35
- get: function () { return chunkDQB7BTQS_cjs.useOsdkAction; }
35
+ get: function () { return chunkOACPYYJN_cjs.useOsdkAction; }
36
36
  });
37
37
  Object.defineProperty(exports, "useOsdkAggregation", {
38
38
  enumerable: true,
39
- get: function () { return chunkDQB7BTQS_cjs.useOsdkAggregation; }
39
+ get: function () { return chunkOACPYYJN_cjs.useOsdkAggregation; }
40
40
  });
41
41
  Object.defineProperty(exports, "useOsdkClient", {
42
42
  enumerable: true,
43
- get: function () { return chunkDQB7BTQS_cjs.useOsdkClient; }
43
+ get: function () { return chunkOACPYYJN_cjs.useOsdkClient; }
44
44
  });
45
45
  Object.defineProperty(exports, "useOsdkFunction", {
46
46
  enumerable: true,
47
- get: function () { return chunkDQB7BTQS_cjs.useOsdkFunction; }
47
+ get: function () { return chunkOACPYYJN_cjs.useOsdkFunction; }
48
48
  });
49
49
  Object.defineProperty(exports, "useOsdkFunctions", {
50
50
  enumerable: true,
51
- get: function () { return chunkDQB7BTQS_cjs.useOsdkFunctions; }
51
+ get: function () { return chunkOACPYYJN_cjs.useOsdkFunctions; }
52
52
  });
53
53
  Object.defineProperty(exports, "useOsdkMetadata", {
54
54
  enumerable: true,
55
- get: function () { return chunkDQB7BTQS_cjs.useOsdkMetadata; }
55
+ get: function () { return chunkOACPYYJN_cjs.useOsdkMetadata; }
56
56
  });
57
57
  Object.defineProperty(exports, "useOsdkObject", {
58
58
  enumerable: true,
59
- get: function () { return chunkDQB7BTQS_cjs.useOsdkObject; }
59
+ get: function () { return chunkOACPYYJN_cjs.useOsdkObject; }
60
60
  });
61
61
  Object.defineProperty(exports, "useOsdkObjects", {
62
62
  enumerable: true,
63
- get: function () { return chunkDQB7BTQS_cjs.useOsdkObjects; }
63
+ get: function () { return chunkOACPYYJN_cjs.useOsdkObjects; }
64
64
  });
65
65
  Object.defineProperty(exports, "useRegisterUserAgent", {
66
66
  enumerable: true,
67
- get: function () { return chunkDQB7BTQS_cjs.useRegisterUserAgent; }
67
+ get: function () { return chunkOACPYYJN_cjs.useRegisterUserAgent; }
68
68
  });
69
69
  Object.defineProperty(exports, "useStableObjectSet", {
70
70
  enumerable: true,
71
- get: function () { return chunkDQB7BTQS_cjs.useStableObjectSet; }
71
+ get: function () { return chunkOACPYYJN_cjs.useStableObjectSet; }
72
72
  });
73
73
  Object.defineProperty(exports, "getRegisteredDevTools", {
74
74
  enumerable: true,
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var chunkDQB7BTQS_cjs = require('../chunk-DQB7BTQS.cjs');
3
+ var chunkOACPYYJN_cjs = require('../chunk-OACPYYJN.cjs');
4
4
  var chunkOGP2DK2V_cjs = require('../chunk-OGP2DK2V.cjs');
5
5
  require('../chunk-UKQGMTMG.cjs');
6
6
  require('../chunk-DO3NFBKN.cjs');
@@ -9,63 +9,63 @@ require('../chunk-DO3NFBKN.cjs');
9
9
 
10
10
  Object.defineProperty(exports, "OsdkProvider2", {
11
11
  enumerable: true,
12
- get: function () { return chunkDQB7BTQS_cjs.OsdkProvider; }
12
+ get: function () { return chunkOACPYYJN_cjs.OsdkProvider; }
13
13
  });
14
14
  Object.defineProperty(exports, "useDebouncedCallback", {
15
15
  enumerable: true,
16
- get: function () { return chunkDQB7BTQS_cjs.useDebouncedCallback; }
16
+ get: function () { return chunkOACPYYJN_cjs.useDebouncedCallback; }
17
17
  });
18
18
  Object.defineProperty(exports, "useLinks", {
19
19
  enumerable: true,
20
- get: function () { return chunkDQB7BTQS_cjs.useLinks; }
20
+ get: function () { return chunkOACPYYJN_cjs.useLinks; }
21
21
  });
22
22
  Object.defineProperty(exports, "useObjectSet", {
23
23
  enumerable: true,
24
- get: function () { return chunkDQB7BTQS_cjs.useObjectSet; }
24
+ get: function () { return chunkOACPYYJN_cjs.useObjectSet; }
25
25
  });
26
26
  Object.defineProperty(exports, "useOsdkAction", {
27
27
  enumerable: true,
28
- get: function () { return chunkDQB7BTQS_cjs.useOsdkAction; }
28
+ get: function () { return chunkOACPYYJN_cjs.useOsdkAction; }
29
29
  });
30
30
  Object.defineProperty(exports, "useOsdkAggregation", {
31
31
  enumerable: true,
32
- get: function () { return chunkDQB7BTQS_cjs.useOsdkAggregation; }
32
+ get: function () { return chunkOACPYYJN_cjs.useOsdkAggregation; }
33
33
  });
34
34
  Object.defineProperty(exports, "useOsdkClient", {
35
35
  enumerable: true,
36
- get: function () { return chunkDQB7BTQS_cjs.useOsdkClient; }
36
+ get: function () { return chunkOACPYYJN_cjs.useOsdkClient; }
37
37
  });
38
38
  Object.defineProperty(exports, "useOsdkClient2", {
39
39
  enumerable: true,
40
- get: function () { return chunkDQB7BTQS_cjs.useOsdkClient; }
40
+ get: function () { return chunkOACPYYJN_cjs.useOsdkClient; }
41
41
  });
42
42
  Object.defineProperty(exports, "useOsdkFunction", {
43
43
  enumerable: true,
44
- get: function () { return chunkDQB7BTQS_cjs.useOsdkFunction; }
44
+ get: function () { return chunkOACPYYJN_cjs.useOsdkFunction; }
45
45
  });
46
46
  Object.defineProperty(exports, "useOsdkFunctions", {
47
47
  enumerable: true,
48
- get: function () { return chunkDQB7BTQS_cjs.useOsdkFunctions; }
48
+ get: function () { return chunkOACPYYJN_cjs.useOsdkFunctions; }
49
49
  });
50
50
  Object.defineProperty(exports, "useOsdkMetadata", {
51
51
  enumerable: true,
52
- get: function () { return chunkDQB7BTQS_cjs.useOsdkMetadata; }
52
+ get: function () { return chunkOACPYYJN_cjs.useOsdkMetadata; }
53
53
  });
54
54
  Object.defineProperty(exports, "useOsdkObject", {
55
55
  enumerable: true,
56
- get: function () { return chunkDQB7BTQS_cjs.useOsdkObject; }
56
+ get: function () { return chunkOACPYYJN_cjs.useOsdkObject; }
57
57
  });
58
58
  Object.defineProperty(exports, "useOsdkObjects", {
59
59
  enumerable: true,
60
- get: function () { return chunkDQB7BTQS_cjs.useOsdkObjects; }
60
+ get: function () { return chunkOACPYYJN_cjs.useOsdkObjects; }
61
61
  });
62
62
  Object.defineProperty(exports, "useRegisterUserAgent", {
63
63
  enumerable: true,
64
- get: function () { return chunkDQB7BTQS_cjs.useRegisterUserAgent; }
64
+ get: function () { return chunkOACPYYJN_cjs.useRegisterUserAgent; }
65
65
  });
66
66
  Object.defineProperty(exports, "useStableObjectSet", {
67
67
  enumerable: true,
68
- get: function () { return chunkDQB7BTQS_cjs.useStableObjectSet; }
68
+ get: function () { return chunkOACPYYJN_cjs.useStableObjectSet; }
69
69
  });
70
70
  Object.defineProperty(exports, "getRegisteredDevTools", {
71
71
  enumerable: true,
@@ -6,9 +6,9 @@ export { DevToolsRegistry, getRegisteredDevTools, registerDevTools } from './dev
6
6
 
7
7
  /**
8
8
  * Returns a referentially stable ObjectSet that only changes when the
9
- * wire representation changes. This uses `getWireObjectSet` which includes
10
- * composed operations (where, union, intersect, etc.) in the serialized
11
- * form, unlike plain `JSON.stringify(objectSet)` which may not capture them.
9
+ * wire representation changes. This uses {@link stableSerialize} which
10
+ * includes composed operations (where, union, intersect, etc.) in the
11
+ * serialized form
12
12
  */
13
13
  declare function useStableObjectSet<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = Record<string, never>>(objectSet: ObjectSet<Q, RDPs> | undefined): ObjectSet<Q, RDPs> | undefined;
14
14
 
@@ -0,0 +1,42 @@
1
+ /*
2
+ * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { getWireObjectSet, isObjectSet } from "@osdk/client";
18
+
19
+ /**
20
+ * Serialize a value to a stable string for React.useMemo dependency arrays.
21
+ * Uses {@link stableSerializeReplacer} so OSDK `ObjectSet`s normalize to a
22
+ * discriminative wire form before stringification.
23
+ */
24
+ export function stableSerialize(value) {
25
+ return JSON.stringify(value, stableSerializeReplacer);
26
+ }
27
+
28
+ /**
29
+ * `JSON.stringify` replacer that normalizes OSDK `ObjectSet` instances to
30
+ * their wire-form definition (via `getWireObjectSet`) wrapped in
31
+ * `{ __objectSet: ... }`, so composed operations (`.where`, `.union`,
32
+ * `.intersect`, ...) participate in the key.
33
+ */
34
+ export function stableSerializeReplacer(_key, value) {
35
+ if (value != null && typeof value === "object" && isObjectSet(value)) {
36
+ return {
37
+ __objectSet: getWireObjectSet(value)
38
+ };
39
+ }
40
+ return value;
41
+ }
42
+ //# sourceMappingURL=stableSerialize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stableSerialize.js","names":["getWireObjectSet","isObjectSet","stableSerialize","value","JSON","stringify","stableSerializeReplacer","_key","__objectSet"],"sources":["stableSerialize.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { getWireObjectSet, isObjectSet } from \"@osdk/client\";\n\n/**\n * Serialize a value to a stable string for React.useMemo dependency arrays.\n * Uses {@link stableSerializeReplacer} so OSDK `ObjectSet`s normalize to a\n * discriminative wire form before stringification.\n */\nexport function stableSerialize(value: unknown): string | undefined {\n return JSON.stringify(value, stableSerializeReplacer);\n}\n\n/**\n * `JSON.stringify` replacer that normalizes OSDK `ObjectSet` instances to\n * their wire-form definition (via `getWireObjectSet`) wrapped in\n * `{ __objectSet: ... }`, so composed operations (`.where`, `.union`,\n * `.intersect`, ...) participate in the key.\n */\nexport function stableSerializeReplacer(\n _key: string,\n value: unknown,\n): unknown {\n if (value != null && typeof value === \"object\" && isObjectSet(value)) {\n return { __objectSet: getWireObjectSet(value) };\n }\n return value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,gBAAgB,EAAEC,WAAW,QAAQ,cAAc;;AAE5D;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,eAAeA,CAACC,KAAc,EAAsB;EAClE,OAAOC,IAAI,CAACC,SAAS,CAACF,KAAK,EAAEG,uBAAuB,CAAC;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,uBAAuBA,CACrCC,IAAY,EACZJ,KAAc,EACL;EACT,IAAIA,KAAK,IAAI,IAAI,IAAI,OAAOA,KAAK,KAAK,QAAQ,IAAIF,WAAW,CAACE,KAAK,CAAC,EAAE;IACpE,OAAO;MAAEK,WAAW,EAAER,gBAAgB,CAACG,KAAK;IAAE,CAAC;EACjD;EACA,OAAOA,KAAK;AACd","ignoreList":[]}
@@ -14,18 +14,17 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { getWireObjectSet } from "@osdk/client";
18
17
  import { useMemo } from "react";
18
+ import { stableSerialize } from "./stableSerialize.js";
19
19
 
20
20
  /**
21
21
  * Returns a referentially stable ObjectSet that only changes when the
22
- * wire representation changes. This uses `getWireObjectSet` which includes
23
- * composed operations (where, union, intersect, etc.) in the serialized
24
- * form, unlike plain `JSON.stringify(objectSet)` which may not capture them.
22
+ * wire representation changes. This uses {@link stableSerialize} which
23
+ * includes composed operations (where, union, intersect, etc.) in the
24
+ * serialized form
25
25
  */
26
26
  export function useStableObjectSet(objectSet) {
27
- const wireKey = objectSet ? JSON.stringify(getWireObjectSet(objectSet)) : undefined;
28
27
  // eslint-disable-next-line react-hooks/exhaustive-deps
29
- return useMemo(() => objectSet, [wireKey]);
28
+ return useMemo(() => objectSet, [stableSerialize(objectSet)]);
30
29
  }
31
30
  //# sourceMappingURL=useStableObjectSet.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useStableObjectSet.js","names":["getWireObjectSet","useMemo","useStableObjectSet","objectSet","wireKey","JSON","stringify","undefined"],"sources":["useStableObjectSet.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n ObjectSet,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport { getWireObjectSet } from \"@osdk/client\";\nimport { useMemo } from \"react\";\n\n/**\n * Returns a referentially stable ObjectSet that only changes when the\n * wire representation changes. This uses `getWireObjectSet` which includes\n * composed operations (where, union, intersect, etc.) in the serialized\n * form, unlike plain `JSON.stringify(objectSet)` which may not capture them.\n */\nexport function useStableObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n>(\n objectSet: ObjectSet<Q, RDPs> | undefined,\n): ObjectSet<Q, RDPs> | undefined {\n const wireKey = objectSet\n ? JSON.stringify(getWireObjectSet(objectSet as ObjectSet<Q>))\n : undefined;\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => objectSet, [wireKey]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,gBAAgB,QAAQ,cAAc;AAC/C,SAASC,OAAO,QAAQ,OAAO;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAIhCC,SAAyC,EACT;EAChC,MAAMC,OAAO,GAAGD,SAAS,GACrBE,IAAI,CAACC,SAAS,CAACN,gBAAgB,CAACG,SAAyB,CAAC,CAAC,GAC3DI,SAAS;EACb;EACA,OAAON,OAAO,CAAC,MAAME,SAAS,EAAE,CAACC,OAAO,CAAC,CAAC;AAC5C","ignoreList":[]}
1
+ {"version":3,"file":"useStableObjectSet.js","names":["useMemo","stableSerialize","useStableObjectSet","objectSet"],"sources":["useStableObjectSet.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ObjectOrInterfaceDefinition,\n ObjectSet,\n SimplePropertyDef,\n} from \"@osdk/api\";\nimport { useMemo } from \"react\";\nimport { stableSerialize } from \"./stableSerialize.js\";\n\n/**\n * Returns a referentially stable ObjectSet that only changes when the\n * wire representation changes. This uses {@link stableSerialize} which\n * includes composed operations (where, union, intersect, etc.) in the\n * serialized form\n */\nexport function useStableObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = Record<string, never>,\n>(\n objectSet: ObjectSet<Q, RDPs> | undefined,\n): ObjectSet<Q, RDPs> | undefined {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n return useMemo(() => objectSet, [stableSerialize(objectSet)]);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,eAAe,QAAQ,sBAAsB;;AAEtD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,kBAAkBA,CAIhCC,SAAyC,EACT;EAChC;EACA,OAAOH,OAAO,CAAC,MAAMG,SAAS,EAAE,CAACF,eAAe,CAACE,SAAS,CAAC,CAAC,CAAC;AAC/D","ignoreList":[]}
@@ -14,8 +14,8 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { getWireObjectSet } from "@osdk/client";
18
17
  import React from "react";
18
+ import { stableSerialize } from "./core/stableSerialize.js";
19
19
  import { devToolsMetadata, makeExternalStore } from "./makeExternalStore.js";
20
20
  import { OsdkContext } from "./OsdkContext.js";
21
21
  /**
@@ -62,14 +62,18 @@ export function useOsdkFunction(queryDef, options = {}) {
62
62
  dedupeIntervalMs,
63
63
  enabled = true
64
64
  } = options;
65
- const stableParams = React.useMemo(() => params, [JSON.stringify(params)]);
66
- const stableDependsOn = React.useMemo(() => dependsOn, [JSON.stringify(dependsOn?.map(d => typeof d === "string" ? d : d.apiName))]);
67
- const stableDependsOnObjects = React.useMemo(() => dependsOnObjects, [JSON.stringify(dependsOnObjects?.map(item => "$apiName" in item ? {
65
+ const stableParams = React.useMemo(() => params,
66
+ // eslint-disable-next-line react-hooks/exhaustive-deps
67
+ [stableSerialize(params)]);
68
+ const stableDependsOn = React.useMemo(() => dependsOn,
69
+ // eslint-disable-next-line react-hooks/exhaustive-deps
70
+ [stableSerialize(dependsOn?.map(d => typeof d === "string" ? d : d.apiName))]);
71
+ const stableDependsOnObjects = React.useMemo(() => dependsOnObjects,
72
+ // eslint-disable-next-line react-hooks/exhaustive-deps
73
+ [stableSerialize(dependsOnObjects?.map(item => "$apiName" in item ? {
68
74
  $apiName: item.$apiName,
69
75
  $primaryKey: item.$primaryKey
70
- } : {
71
- __objectSet: getWireObjectSet(item)
72
- }))]);
76
+ } : item))]);
73
77
 
74
78
  // Record<string, unknown> required as typing is figured out at runtime
75
79
  const paramsForApi = stableParams;
@@ -1 +1 @@
1
- {"version":3,"file":"useOsdkFunction.js","names":["getWireObjectSet","React","devToolsMetadata","makeExternalStore","OsdkContext","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","hookType","objectType","observer","observeFunction","dedupeInterval","version","payload","useSyncExternalStore","refetch","useCallback","invalidateFunction","error","status","Error","undefined","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 { getWireObjectSet } from \"@osdk/client\";\nimport type {\n ObserveFunctionCallbackArgs,\n QueryParameterType,\n} from \"@osdk/client/observable\";\nimport React from \"react\";\nimport { devToolsMetadata, makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext } from \"./OsdkContext.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: () => Promise<void>;\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(OsdkContext);\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 devToolsMetadata({\n hookType: \"useOsdkFunction\",\n objectType: queryDef.apiName,\n }),\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 devToolsMetadata({\n hookType: \"useOsdkFunction\",\n objectType: queryDef.apiName,\n }),\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 refetch = React.useCallback(async () => {\n await observableClient.invalidateFunction(queryDef, paramsForApi);\n }, [observableClient, queryDef, paramsForApi]);\n\n return React.useMemo(() => {\n const error = payload?.error\n ?? (payload?.status === \"error\"\n ? new Error(\"Failed to execute function\")\n : undefined);\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 }, [payload, refetch]);\n}\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"useOsdkFunction.js","names":["React","stableSerialize","devToolsMetadata","makeExternalStore","OsdkContext","useOsdkFunction","queryDef","options","observableClient","useContext","params","dependsOn","dependsOnObjects","dedupeIntervalMs","enabled","stableParams","useMemo","stableDependsOn","map","d","apiName","stableDependsOnObjects","item","$apiName","$primaryKey","paramsForApi","subscribe","getSnapShot","unsubscribe","hookType","objectType","observer","observeFunction","dedupeInterval","version","payload","useSyncExternalStore","refetch","useCallback","invalidateFunction","error","status","Error","undefined","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/observable\";\nimport React from \"react\";\nimport { stableSerialize } from \"./core/stableSerialize.js\";\nimport { devToolsMetadata, makeExternalStore } from \"./makeExternalStore.js\";\nimport { OsdkContext } from \"./OsdkContext.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: () => Promise<void>;\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(OsdkContext);\n const {\n params,\n dependsOn,\n dependsOnObjects,\n dedupeIntervalMs,\n enabled = true,\n } = options;\n\n const stableParams = React.useMemo(\n () => params,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [stableSerialize(params)],\n );\n const stableDependsOn = React.useMemo(\n () => dependsOn,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [stableSerialize(\n dependsOn?.map(d => typeof d === \"string\" ? d : d.apiName),\n )],\n );\n const stableDependsOnObjects = React.useMemo(\n () => dependsOnObjects,\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [stableSerialize(\n dependsOnObjects?.map(item =>\n \"$apiName\" in item\n ? { $apiName: item.$apiName, $primaryKey: item.$primaryKey }\n : 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 devToolsMetadata({\n hookType: \"useOsdkFunction\",\n objectType: queryDef.apiName,\n }),\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 devToolsMetadata({\n hookType: \"useOsdkFunction\",\n objectType: queryDef.apiName,\n }),\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 refetch = React.useCallback(async () => {\n await observableClient.invalidateFunction(queryDef, paramsForApi);\n }, [observableClient, queryDef, paramsForApi]);\n\n return React.useMemo(() => {\n const error = payload?.error\n ?? (payload?.status === \"error\"\n ? new Error(\"Failed to execute function\")\n : undefined);\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 }, [payload, refetch]);\n}\n"],"mappings":"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","ignoreList":[]}
@@ -15,8 +15,8 @@
15
15
  */
16
16
 
17
17
  import React from "react";
18
+ import { stableSerialize } from "./core/stableSerialize.js";
18
19
  import { createCompositeExternalStore, EMPTY_STORE } from "./createCompositeExternalStore.js";
19
- import { getStableQueriesKey } from "./getStableQueriesKey.js";
20
20
  import { OsdkContext } from "./OsdkContext.js";
21
21
  /**
22
22
  * React hook for executing multiple OSDK function queries in parallel.
@@ -39,7 +39,10 @@ export function useOsdkFunctions({
39
39
  const {
40
40
  observableClient
41
41
  } = React.useContext(OsdkContext);
42
- const stableQueriesKey = getStableQueriesKey(queries);
42
+ const stableQueriesKey = stableSerialize(queries.map(q => ({
43
+ apiName: q.queryDefinition.apiName,
44
+ ...q.options
45
+ })));
43
46
 
44
47
  // eslint-disable-next-line react-hooks/exhaustive-deps
45
48
  const stableQueries = React.useMemo(() => queries, [stableQueriesKey]);
@@ -1 +1 @@
1
- {"version":3,"file":"useOsdkFunctions.js","names":["React","createCompositeExternalStore","EMPTY_STORE","getStableQueriesKey","OsdkContext","useOsdkFunctions","queries","enabled","maxConcurrent","observableClient","useContext","stableQueriesKey","stableQueries","useMemo","subscribe","getSnapshot","length","payloads","useSyncExternalStore","refetches","map","query","invalidateFunction","queryDefinition","options","params","_","index","payload","error","status","Error","undefined","data","result","isLoading","lastUpdated","refetch"],"sources":["useOsdkFunctions.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { QueryDefinition } from \"@osdk/api\";\nimport React from \"react\";\nimport {\n createCompositeExternalStore,\n EMPTY_STORE,\n} from \"./createCompositeExternalStore.js\";\nimport { getStableQueriesKey } from \"./getStableQueriesKey.js\";\nimport { OsdkContext } from \"./OsdkContext.js\";\nimport type {\n UseOsdkFunctionOptions,\n UseOsdkFunctionResult,\n} from \"./useOsdkFunction.js\";\n\nexport interface FunctionQueryParams<Q extends QueryDefinition<unknown>> {\n queryDefinition: Q;\n /**\n * Only allow params and enabled options at the query level,\n * other options are not yet supported in this batch context\n */\n options?: UseOsdkFunctionOptions<Q>;\n}\n\nexport interface UseOsdkFunctionsProps {\n /**\n * Array of query configurations to execute\n */\n queries: Array<FunctionQueryParams<QueryDefinition<unknown>>>;\n\n /**\n * Whether to enable all queries. When false, no queries will execute.\n * Individual query enabled states are also respected.\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Maximum number of queries to execute concurrently.\n * When set, queries are subscribed in batches — the next query starts\n * only after a running one completes (status \"loaded\" or \"error\").\n * Useful for large payloads that may exceed server time limits.\n *\n * @default undefined (all queries run in parallel)\n */\n maxConcurrent?: number;\n}\n\nexport type UseOsdkFunctionsResult = Array<\n UseOsdkFunctionResult<QueryDefinition<unknown>>\n>;\n\n/**\n * React hook for executing multiple OSDK function queries in parallel.\n *\n * This hook executes multiple function queries with individual configurations,\n * with automatic caching and deduplication via the ObservableClient.\n * Results are returned in the same order as the input queries.\n *\n * Queries with identical function+params share cached results through the\n * Store layer, avoiding duplicate network requests across components.\n *\n * @param options - Configuration options containing the queries to execute\n * @returns Array of results in the same order as input queries, each with the same shape as useOsdkFunction\n */\nexport function useOsdkFunctions(\n { queries, enabled = true, maxConcurrent }: UseOsdkFunctionsProps,\n): UseOsdkFunctionsResult {\n const { observableClient } = React.useContext(OsdkContext);\n\n const stableQueriesKey = getStableQueriesKey(queries);\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableQueries = React.useMemo(() => queries, [stableQueriesKey]);\n\n const { subscribe, getSnapshot } = React.useMemo(\n () =>\n !enabled || stableQueries.length === 0\n ? EMPTY_STORE\n : createCompositeExternalStore(\n stableQueries,\n observableClient,\n maxConcurrent,\n ),\n [enabled, maxConcurrent, observableClient, stableQueries],\n );\n\n const payloads = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const refetches = React.useMemo(\n () =>\n stableQueries.map((query) => async () => {\n await observableClient.invalidateFunction(\n query.queryDefinition,\n query.options?.params as Record<string, unknown> | undefined,\n );\n }),\n [stableQueries, observableClient],\n );\n\n return React.useMemo(\n () =>\n stableQueries.map((_, index): UseOsdkFunctionResult<\n QueryDefinition<unknown>\n > => {\n const payload = payloads[index];\n const error = payload?.error\n ?? (payload?.status === \"error\"\n ? new Error(\"Failed to execute function\")\n : undefined);\n\n return {\n data: payload?.result as UseOsdkFunctionResult<\n QueryDefinition<unknown>\n >[\"data\"],\n isLoading: payload?.status === \"loading\",\n error,\n lastUpdated: payload?.lastUpdated ?? 0,\n refetch: refetches[index],\n };\n }),\n [stableQueries, payloads, refetches],\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,MAAM,OAAO;AACzB,SACEC,4BAA4B,EAC5BC,WAAW,QACN,mCAAmC;AAC1C,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,WAAW,QAAQ,kBAAkB;AA2C9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9B;EAAEC,OAAO;EAAEC,OAAO,GAAG,IAAI;EAAEC;AAAqC,CAAC,EACzC;EACxB,MAAM;IAAEC;EAAiB,CAAC,GAAGT,KAAK,CAACU,UAAU,CAACN,WAAW,CAAC;EAE1D,MAAMO,gBAAgB,GAAGR,mBAAmB,CAACG,OAAO,CAAC;;EAErD;EACA,MAAMM,aAAa,GAAGZ,KAAK,CAACa,OAAO,CAAC,MAAMP,OAAO,EAAE,CAACK,gBAAgB,CAAC,CAAC;EAEtE,MAAM;IAAEG,SAAS;IAAEC;EAAY,CAAC,GAAGf,KAAK,CAACa,OAAO,CAC9C,MACE,CAACN,OAAO,IAAIK,aAAa,CAACI,MAAM,KAAK,CAAC,GAClCd,WAAW,GACXD,4BAA4B,CAC5BW,aAAa,EACbH,gBAAgB,EAChBD,aACF,CAAC,EACL,CAACD,OAAO,EAAEC,aAAa,EAAEC,gBAAgB,EAAEG,aAAa,CAC1D,CAAC;EAED,MAAMK,QAAQ,GAAGjB,KAAK,CAACkB,oBAAoB,CAACJ,SAAS,EAAEC,WAAW,CAAC;EAEnE,MAAMI,SAAS,GAAGnB,KAAK,CAACa,OAAO,CAC7B,MACED,aAAa,CAACQ,GAAG,CAAEC,KAAK,IAAK,YAAY;IACvC,MAAMZ,gBAAgB,CAACa,kBAAkB,CACvCD,KAAK,CAACE,eAAe,EACrBF,KAAK,CAACG,OAAO,EAAEC,MACjB,CAAC;EACH,CAAC,CAAC,EACJ,CAACb,aAAa,EAAEH,gBAAgB,CAClC,CAAC;EAED,OAAOT,KAAK,CAACa,OAAO,CAClB,MACED,aAAa,CAACQ,GAAG,CAAC,CAACM,CAAC,EAAEC,KAAK,KAEtB;IACH,MAAMC,OAAO,GAAGX,QAAQ,CAACU,KAAK,CAAC;IAC/B,MAAME,KAAK,GAAGD,OAAO,EAAEC,KAAK,KACtBD,OAAO,EAAEE,MAAM,KAAK,OAAO,GAC3B,IAAIC,KAAK,CAAC,4BAA4B,CAAC,GACvCC,SAAS,CAAC;IAEhB,OAAO;MACLC,IAAI,EAAEL,OAAO,EAAEM,MAEN;MACTC,SAAS,EAAEP,OAAO,EAAEE,MAAM,KAAK,SAAS;MACxCD,KAAK;MACLO,WAAW,EAAER,OAAO,EAAEQ,WAAW,IAAI,CAAC;MACtCC,OAAO,EAAElB,SAAS,CAACQ,KAAK;IAC1B,CAAC;EACH,CAAC,CAAC,EACJ,CAACf,aAAa,EAAEK,QAAQ,EAAEE,SAAS,CACrC,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"useOsdkFunctions.js","names":["React","stableSerialize","createCompositeExternalStore","EMPTY_STORE","OsdkContext","useOsdkFunctions","queries","enabled","maxConcurrent","observableClient","useContext","stableQueriesKey","map","q","apiName","queryDefinition","options","stableQueries","useMemo","subscribe","getSnapshot","length","payloads","useSyncExternalStore","refetches","query","invalidateFunction","params","_","index","payload","error","status","Error","undefined","data","result","isLoading","lastUpdated","refetch"],"sources":["useOsdkFunctions.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { QueryDefinition } from \"@osdk/api\";\nimport React from \"react\";\nimport { stableSerialize } from \"./core/stableSerialize.js\";\nimport {\n createCompositeExternalStore,\n EMPTY_STORE,\n} from \"./createCompositeExternalStore.js\";\nimport { OsdkContext } from \"./OsdkContext.js\";\nimport type {\n UseOsdkFunctionOptions,\n UseOsdkFunctionResult,\n} from \"./useOsdkFunction.js\";\n\nexport interface FunctionQueryParams<Q extends QueryDefinition<unknown>> {\n queryDefinition: Q;\n /**\n * Only allow params and enabled options at the query level,\n * other options are not yet supported in this batch context\n */\n options?: UseOsdkFunctionOptions<Q>;\n}\n\nexport interface UseOsdkFunctionsProps {\n /**\n * Array of query configurations to execute\n */\n queries: Array<FunctionQueryParams<QueryDefinition<unknown>>>;\n\n /**\n * Whether to enable all queries. When false, no queries will execute.\n * Individual query enabled states are also respected.\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Maximum number of queries to execute concurrently.\n * When set, queries are subscribed in batches — the next query starts\n * only after a running one completes (status \"loaded\" or \"error\").\n * Useful for large payloads that may exceed server time limits.\n *\n * @default undefined (all queries run in parallel)\n */\n maxConcurrent?: number;\n}\n\nexport type UseOsdkFunctionsResult = Array<\n UseOsdkFunctionResult<QueryDefinition<unknown>>\n>;\n\n/**\n * React hook for executing multiple OSDK function queries in parallel.\n *\n * This hook executes multiple function queries with individual configurations,\n * with automatic caching and deduplication via the ObservableClient.\n * Results are returned in the same order as the input queries.\n *\n * Queries with identical function+params share cached results through the\n * Store layer, avoiding duplicate network requests across components.\n *\n * @param options - Configuration options containing the queries to execute\n * @returns Array of results in the same order as input queries, each with the same shape as useOsdkFunction\n */\nexport function useOsdkFunctions(\n { queries, enabled = true, maxConcurrent }: UseOsdkFunctionsProps,\n): UseOsdkFunctionsResult {\n const { observableClient } = React.useContext(OsdkContext);\n\n const stableQueriesKey = stableSerialize(queries.map(q => ({\n apiName: q.queryDefinition.apiName,\n ...q.options,\n })));\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n const stableQueries = React.useMemo(() => queries, [stableQueriesKey]);\n\n const { subscribe, getSnapshot } = React.useMemo(\n () =>\n !enabled || stableQueries.length === 0\n ? EMPTY_STORE\n : createCompositeExternalStore(\n stableQueries,\n observableClient,\n maxConcurrent,\n ),\n [enabled, maxConcurrent, observableClient, stableQueries],\n );\n\n const payloads = React.useSyncExternalStore(subscribe, getSnapshot);\n\n const refetches = React.useMemo(\n () =>\n stableQueries.map((query) => async () => {\n await observableClient.invalidateFunction(\n query.queryDefinition,\n query.options?.params as Record<string, unknown> | undefined,\n );\n }),\n [stableQueries, observableClient],\n );\n\n return React.useMemo(\n () =>\n stableQueries.map((_, index): UseOsdkFunctionResult<\n QueryDefinition<unknown>\n > => {\n const payload = payloads[index];\n const error = payload?.error\n ?? (payload?.status === \"error\"\n ? new Error(\"Failed to execute function\")\n : undefined);\n\n return {\n data: payload?.result as UseOsdkFunctionResult<\n QueryDefinition<unknown>\n >[\"data\"],\n isLoading: payload?.status === \"loading\",\n error,\n lastUpdated: payload?.lastUpdated ?? 0,\n refetch: refetches[index],\n };\n }),\n [stableQueries, payloads, refetches],\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,eAAe,QAAQ,2BAA2B;AAC3D,SACEC,4BAA4B,EAC5BC,WAAW,QACN,mCAAmC;AAC1C,SAASC,WAAW,QAAQ,kBAAkB;AA2C9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAC9B;EAAEC,OAAO;EAAEC,OAAO,GAAG,IAAI;EAAEC;AAAqC,CAAC,EACzC;EACxB,MAAM;IAAEC;EAAiB,CAAC,GAAGT,KAAK,CAACU,UAAU,CAACN,WAAW,CAAC;EAE1D,MAAMO,gBAAgB,GAAGV,eAAe,CAACK,OAAO,CAACM,GAAG,CAACC,CAAC,KAAK;IACzDC,OAAO,EAAED,CAAC,CAACE,eAAe,CAACD,OAAO;IAClC,GAAGD,CAAC,CAACG;EACP,CAAC,CAAC,CAAC,CAAC;;EAEJ;EACA,MAAMC,aAAa,GAAGjB,KAAK,CAACkB,OAAO,CAAC,MAAMZ,OAAO,EAAE,CAACK,gBAAgB,CAAC,CAAC;EAEtE,MAAM;IAAEQ,SAAS;IAAEC;EAAY,CAAC,GAAGpB,KAAK,CAACkB,OAAO,CAC9C,MACE,CAACX,OAAO,IAAIU,aAAa,CAACI,MAAM,KAAK,CAAC,GAClClB,WAAW,GACXD,4BAA4B,CAC5Be,aAAa,EACbR,gBAAgB,EAChBD,aACF,CAAC,EACL,CAACD,OAAO,EAAEC,aAAa,EAAEC,gBAAgB,EAAEQ,aAAa,CAC1D,CAAC;EAED,MAAMK,QAAQ,GAAGtB,KAAK,CAACuB,oBAAoB,CAACJ,SAAS,EAAEC,WAAW,CAAC;EAEnE,MAAMI,SAAS,GAAGxB,KAAK,CAACkB,OAAO,CAC7B,MACED,aAAa,CAACL,GAAG,CAAEa,KAAK,IAAK,YAAY;IACvC,MAAMhB,gBAAgB,CAACiB,kBAAkB,CACvCD,KAAK,CAACV,eAAe,EACrBU,KAAK,CAACT,OAAO,EAAEW,MACjB,CAAC;EACH,CAAC,CAAC,EACJ,CAACV,aAAa,EAAER,gBAAgB,CAClC,CAAC;EAED,OAAOT,KAAK,CAACkB,OAAO,CAClB,MACED,aAAa,CAACL,GAAG,CAAC,CAACgB,CAAC,EAAEC,KAAK,KAEtB;IACH,MAAMC,OAAO,GAAGR,QAAQ,CAACO,KAAK,CAAC;IAC/B,MAAME,KAAK,GAAGD,OAAO,EAAEC,KAAK,KACtBD,OAAO,EAAEE,MAAM,KAAK,OAAO,GAC3B,IAAIC,KAAK,CAAC,4BAA4B,CAAC,GACvCC,SAAS,CAAC;IAEhB,OAAO;MACLC,IAAI,EAAEL,OAAO,EAAEM,MAEN;MACTC,SAAS,EAAEP,OAAO,EAAEE,MAAM,KAAK,SAAS;MACxCD,KAAK;MACLO,WAAW,EAAER,OAAO,EAAEQ,WAAW,IAAI,CAAC;MACtCC,OAAO,EAAEf,SAAS,CAACK,KAAK;IAC1B,CAAC;EACH,CAAC,CAAC,EACJ,CAACZ,aAAa,EAAEK,QAAQ,EAAEE,SAAS,CACrC,CAAC;AACH","ignoreList":[]}
@@ -14,5 +14,5 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- export const REACT_USER_AGENT = `osdk-react/${"2.25.0"}`;
17
+ export const REACT_USER_AGENT = `osdk-react/${"2.25.1-main-90f7fb6fbd4d38d9eeb36c4bb00ec8ca7db8bd95"}`;
18
18
  //# sourceMappingURL=UserAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserAgent.js","names":["REACT_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const REACT_USER_AGENT: string =\n `osdk-react/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,gBAAwB,GACnC,wBAA2C","ignoreList":[]}
1
+ {"version":3,"file":"UserAgent.js","names":["REACT_USER_AGENT"],"sources":["UserAgent.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const REACT_USER_AGENT: string =\n `osdk-react/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMA,gBAAwB,GACnC,sEAA2C","ignoreList":[]}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Serialize a value to a stable string for React.useMemo dependency arrays.
3
+ * Uses {@link stableSerializeReplacer} so OSDK `ObjectSet`s normalize to a
4
+ * discriminative wire form before stringification.
5
+ */
6
+ export declare function stableSerialize(value: unknown): string | undefined;
7
+ /**
8
+ * `JSON.stringify` replacer that normalizes OSDK `ObjectSet` instances to
9
+ * their wire-form definition (via `getWireObjectSet`) wrapped in
10
+ * `{ __objectSet: ... }`, so composed operations (`.where`, `.union`,
11
+ * `.intersect`, ...) participate in the key.
12
+ */
13
+ export declare function stableSerializeReplacer(_key: string, value: unknown): unknown;
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;AAuBA,OAAO,iBAAS,gBAAgBA;;;;;;;AAUhC,OAAO,iBAAS,wBACdC,cACAD","names":["value: unknown","_key: string"],"sources":["../../../../src/new/core/stableSerialize.ts"],"version":3,"file":"stableSerialize.d.ts"}
@@ -1,9 +1,9 @@
1
1
  import type { ObjectOrInterfaceDefinition, ObjectSet, SimplePropertyDef } from "@osdk/api";
2
2
  /**
3
3
  * Returns a referentially stable ObjectSet that only changes when the
4
- * wire representation changes. This uses `getWireObjectSet` which includes
5
- * composed operations (where, union, intersect, etc.) in the serialized
6
- * form, unlike plain `JSON.stringify(objectSet)` which may not capture them.
4
+ * wire representation changes. This uses {@link stableSerialize} which
5
+ * includes composed operations (where, union, intersect, etc.) in the
6
+ * serialized form
7
7
  */
8
8
  export declare function useStableObjectSet<
9
9
  Q extends ObjectOrInterfaceDefinition,
@@ -1 +1 @@
1
- {"mappings":"AAgBA,cACE,qBACA,WACA,sBACA,MACA,uBACK,WAAY;AAEnB,cAEE,0BACK,yBAA0B;AAKjC,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,eAAe;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,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"}
1
+ {"mappings":"AAgBA,cACE,qBACA,WACA,sBACA,MACA,uBACK,WAAY;AACnB,cAEE,0BACK,yBAA0B;AAMjC,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,eAAe;AAChB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCD,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": "2.25.0",
3
+ "version": "2.25.1-main-90f7fb6fbd4d38d9eeb36c4bb00ec8ca7db8bd95",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -84,8 +84,8 @@
84
84
  "fast-deep-equal": "^3.1.3"
85
85
  },
86
86
  "peerDependencies": {
87
- "@osdk/api": "^2.15.0",
88
- "@osdk/client": "^2.15.0",
87
+ "@osdk/api": "^2.15.0 || >=2.25.1-beta.0",
88
+ "@osdk/client": "^2.15.0 || >=2.25.1-beta.0",
89
89
  "@osdk/foundry.admin": "*",
90
90
  "@osdk/foundry.core": "*",
91
91
  "@types/react": "^17 || ^18 || ^19",
@@ -120,9 +120,9 @@
120
120
  "tiny-invariant": "^1.3.3",
121
121
  "typescript": "~5.5.4",
122
122
  "@osdk/aip-core": "0.4.0",
123
- "@osdk/api": "2.25.0",
124
- "@osdk/client": "2.25.0",
125
- "@osdk/client.test.ontology": "2.25.0",
123
+ "@osdk/api": "2.25.1-main-90f7fb6fbd4d38d9eeb36c4bb00ec8ca7db8bd95",
124
+ "@osdk/client": "2.25.1-main-90f7fb6fbd4d38d9eeb36c4bb00ec8ca7db8bd95",
125
+ "@osdk/client.test.ontology": "2.25.1-main-90f7fb6fbd4d38d9eeb36c4bb00ec8ca7db8bd95",
126
126
  "@osdk/monorepo.api-extractor": "~0.7.0",
127
127
  "@osdk/monorepo.tsconfig": "~0.7.0"
128
128
  },
@@ -1,31 +0,0 @@
1
- /*
2
- * Copyright 2026 Palantir Technologies, Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
-
17
- import { getWireObjectSet, isObjectSet } from "@osdk/client";
18
- /**
19
- * Builds a stable string key for an array of function queries.
20
- *
21
- * Uses a JSON.stringify replacer to substitute any ObjectSet with its wire representation,
22
- * so composed operations (where/union/intersect) participate in the key
23
- * - plain JSON.stringify would not capture them.
24
- */
25
- export function getStableQueriesKey(queries) {
26
- return JSON.stringify(queries.map(q => ({
27
- apiName: q.queryDefinition.apiName,
28
- ...q.options
29
- })), (_key, value) => isObjectSet(value) ? getWireObjectSet(value) : value);
30
- }
31
- //# sourceMappingURL=getStableQueriesKey.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getStableQueriesKey.js","names":["getWireObjectSet","isObjectSet","getStableQueriesKey","queries","JSON","stringify","map","q","apiName","queryDefinition","options","_key","value"],"sources":["getStableQueriesKey.ts"],"sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { QueryDefinition } from \"@osdk/api\";\nimport { getWireObjectSet, isObjectSet } from \"@osdk/client\";\nimport type { FunctionQueryParams } from \"./useOsdkFunctions.js\";\n\n/**\n * Builds a stable string key for an array of function queries.\n *\n * Uses a JSON.stringify replacer to substitute any ObjectSet with its wire representation,\n * so composed operations (where/union/intersect) participate in the key\n * - plain JSON.stringify would not capture them.\n */\nexport function getStableQueriesKey(\n queries: ReadonlyArray<FunctionQueryParams<QueryDefinition<unknown>>>,\n): string {\n return JSON.stringify(\n queries.map(q => ({\n apiName: q.queryDefinition.apiName,\n ...q.options,\n })),\n (_key, value) => isObjectSet(value) ? getWireObjectSet(value) : value,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,EAAEC,WAAW,QAAQ,cAAc;AAG5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,mBAAmBA,CACjCC,OAAqE,EAC7D;EACR,OAAOC,IAAI,CAACC,SAAS,CACnBF,OAAO,CAACG,GAAG,CAACC,CAAC,KAAK;IAChBC,OAAO,EAAED,CAAC,CAACE,eAAe,CAACD,OAAO;IAClC,GAAGD,CAAC,CAACG;EACP,CAAC,CAAC,CAAC,EACH,CAACC,IAAI,EAAEC,KAAK,KAAKX,WAAW,CAACW,KAAK,CAAC,GAAGZ,gBAAgB,CAACY,KAAK,CAAC,GAAGA,KAClE,CAAC;AACH","ignoreList":[]}