@osdk/client 2.4.0-beta.9 → 2.4.0

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 (165) hide show
  1. package/CHANGELOG.md +191 -0
  2. package/build/browser/MinimalClientContext.js.map +1 -1
  3. package/build/browser/createClient.js +5 -5
  4. package/build/browser/createClient.js.map +1 -1
  5. package/build/browser/createClient.test.js +3 -3
  6. package/build/browser/createClient.test.js.map +1 -1
  7. package/build/browser/createMinimalClient.js +1 -0
  8. package/build/browser/createMinimalClient.js.map +1 -1
  9. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +0 -17
  10. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  11. package/build/browser/fetchMetadata.test.js +7 -1
  12. package/build/browser/fetchMetadata.test.js.map +1 -1
  13. package/build/browser/index.js +2 -1
  14. package/build/browser/index.js.map +1 -1
  15. package/build/browser/object/convertWireToOsdkObjects.js +3 -2
  16. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  17. package/build/browser/object/convertWireToOsdkObjects.test.js +36 -24
  18. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  19. package/build/browser/object/fetchPage.js +9 -2
  20. package/build/browser/object/fetchPage.js.map +1 -1
  21. package/build/browser/object/mediaUpload.js +0 -3
  22. package/build/browser/object/mediaUpload.js.map +1 -1
  23. package/build/browser/objectSet/InterfaceObjectSet.test.js +5 -1
  24. package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
  25. package/build/browser/objectSet/createObjectSet.js +5 -1
  26. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  27. package/build/browser/observable/internal/ActionApplication.js +1 -1
  28. package/build/browser/observable/internal/ActionApplication.js.map +1 -1
  29. package/build/browser/observable/internal/Store.test.js +3 -0
  30. package/build/browser/observable/internal/Store.test.js.map +1 -1
  31. package/build/browser/ontology/StandardOntologyProvider.test.js +1 -1
  32. package/build/browser/ontology/StandardOntologyProvider.test.js.map +1 -1
  33. package/build/browser/public/unstable-do-not-use.js +1 -0
  34. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  35. package/build/browser/public-utils/hydrateObjectSetFromObjectRids.js +4 -1
  36. package/build/browser/public-utils/hydrateObjectSetFromObjectRids.js.map +1 -1
  37. package/build/browser/public-utils/hydrateObjectSetFromRid.js +4 -1
  38. package/build/browser/public-utils/hydrateObjectSetFromRid.js.map +1 -1
  39. package/build/browser/queries/applyQuery.js +24 -1
  40. package/build/browser/queries/applyQuery.js.map +1 -1
  41. package/build/browser/queries/queries.test.js +27 -2
  42. package/build/browser/queries/queries.test.js.map +1 -1
  43. package/build/browser/queries/types.js.map +1 -1
  44. package/build/browser/util/UserAgent.js +2 -2
  45. package/build/browser/util/UserAgent.js.map +1 -1
  46. package/build/browser/util/WireObjectSet.js +1 -1
  47. package/build/browser/util/WireObjectSet.js.map +1 -1
  48. package/build/browser/util/extractObjectOrInterfaceType.js +96 -0
  49. package/build/browser/util/extractObjectOrInterfaceType.js.map +1 -0
  50. package/build/browser/util/extractObjectOrInterfaceType.test.js +135 -0
  51. package/build/browser/util/extractObjectOrInterfaceType.test.js.map +1 -0
  52. package/build/browser/util/interfaceUtils.js +10 -0
  53. package/build/browser/util/interfaceUtils.js.map +1 -1
  54. package/build/browser/util/objectSpecifierUtils.js +12 -0
  55. package/build/browser/util/objectSpecifierUtils.js.map +1 -1
  56. package/build/browser/util/toDataValue.js +1 -15
  57. package/build/browser/util/toDataValue.js.map +1 -1
  58. package/build/browser/util/toDataValue.test.js +2 -42
  59. package/build/browser/util/toDataValue.test.js.map +1 -1
  60. package/build/browser/util/toDataValueQueries.js +11 -0
  61. package/build/browser/util/toDataValueQueries.js.map +1 -1
  62. package/build/cjs/{Client-CgL2LKN9.d.cts → Client-CF85LpFu.d.cts} +2 -2
  63. package/build/cjs/{chunk-E5BQ7757.cjs → chunk-DSQAJPW5.cjs} +120 -64
  64. package/build/cjs/chunk-DSQAJPW5.cjs.map +1 -0
  65. package/build/cjs/chunk-Q7SFCCGT.cjs +11 -0
  66. package/build/cjs/chunk-Q7SFCCGT.cjs.map +1 -0
  67. package/build/cjs/{chunk-YZHCDIYC.cjs → chunk-RLFLBDLT.cjs} +117 -85
  68. package/build/cjs/chunk-RLFLBDLT.cjs.map +1 -0
  69. package/build/cjs/createClient-BJo8T7Js.d.cts +9 -0
  70. package/build/cjs/delay-QK4T7RVX.cjs +74 -0
  71. package/build/cjs/delay-QK4T7RVX.cjs.map +1 -0
  72. package/build/cjs/index.cjs +9 -8
  73. package/build/cjs/index.cjs.map +1 -1
  74. package/build/cjs/index.d.cts +15 -8
  75. package/build/cjs/public/internal.cjs +17 -10
  76. package/build/cjs/public/internal.cjs.map +1 -1
  77. package/build/cjs/public/internal.d.cts +1 -1
  78. package/build/cjs/public/unstable-do-not-use.cjs +22 -71
  79. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  80. package/build/cjs/public/unstable-do-not-use.d.cts +2 -1
  81. package/build/esm/MinimalClientContext.js.map +1 -1
  82. package/build/esm/createClient.js +5 -5
  83. package/build/esm/createClient.js.map +1 -1
  84. package/build/esm/createClient.test.js +3 -3
  85. package/build/esm/createClient.test.js.map +1 -1
  86. package/build/esm/createMinimalClient.js +1 -0
  87. package/build/esm/createMinimalClient.js.map +1 -1
  88. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +0 -17
  89. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  90. package/build/esm/fetchMetadata.test.js +7 -1
  91. package/build/esm/fetchMetadata.test.js.map +1 -1
  92. package/build/esm/index.js +2 -1
  93. package/build/esm/index.js.map +1 -1
  94. package/build/esm/object/convertWireToOsdkObjects.js +3 -2
  95. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  96. package/build/esm/object/convertWireToOsdkObjects.test.js +36 -24
  97. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  98. package/build/esm/object/fetchPage.js +9 -2
  99. package/build/esm/object/fetchPage.js.map +1 -1
  100. package/build/esm/object/mediaUpload.js +0 -3
  101. package/build/esm/object/mediaUpload.js.map +1 -1
  102. package/build/esm/objectSet/InterfaceObjectSet.test.js +5 -1
  103. package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
  104. package/build/esm/objectSet/createObjectSet.js +5 -1
  105. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  106. package/build/esm/observable/internal/ActionApplication.js +1 -1
  107. package/build/esm/observable/internal/ActionApplication.js.map +1 -1
  108. package/build/esm/observable/internal/Store.test.js +3 -0
  109. package/build/esm/observable/internal/Store.test.js.map +1 -1
  110. package/build/esm/ontology/StandardOntologyProvider.test.js +1 -1
  111. package/build/esm/ontology/StandardOntologyProvider.test.js.map +1 -1
  112. package/build/esm/public/unstable-do-not-use.js +1 -0
  113. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  114. package/build/esm/public-utils/hydrateObjectSetFromObjectRids.js +4 -1
  115. package/build/esm/public-utils/hydrateObjectSetFromObjectRids.js.map +1 -1
  116. package/build/esm/public-utils/hydrateObjectSetFromRid.js +4 -1
  117. package/build/esm/public-utils/hydrateObjectSetFromRid.js.map +1 -1
  118. package/build/esm/queries/applyQuery.js +24 -1
  119. package/build/esm/queries/applyQuery.js.map +1 -1
  120. package/build/esm/queries/queries.test.js +27 -2
  121. package/build/esm/queries/queries.test.js.map +1 -1
  122. package/build/esm/queries/types.js.map +1 -1
  123. package/build/esm/util/UserAgent.js +2 -2
  124. package/build/esm/util/UserAgent.js.map +1 -1
  125. package/build/esm/util/WireObjectSet.js +1 -1
  126. package/build/esm/util/WireObjectSet.js.map +1 -1
  127. package/build/esm/util/extractObjectOrInterfaceType.js +96 -0
  128. package/build/esm/util/extractObjectOrInterfaceType.js.map +1 -0
  129. package/build/esm/util/extractObjectOrInterfaceType.test.js +135 -0
  130. package/build/esm/util/extractObjectOrInterfaceType.test.js.map +1 -0
  131. package/build/esm/util/interfaceUtils.js +10 -0
  132. package/build/esm/util/interfaceUtils.js.map +1 -1
  133. package/build/esm/util/objectSpecifierUtils.js +12 -0
  134. package/build/esm/util/objectSpecifierUtils.js.map +1 -1
  135. package/build/esm/util/toDataValue.js +1 -15
  136. package/build/esm/util/toDataValue.js.map +1 -1
  137. package/build/esm/util/toDataValue.test.js +2 -42
  138. package/build/esm/util/toDataValue.test.js.map +1 -1
  139. package/build/esm/util/toDataValueQueries.js +11 -0
  140. package/build/esm/util/toDataValueQueries.js.map +1 -1
  141. package/build/types/MinimalClientContext.d.ts +1 -0
  142. package/build/types/MinimalClientContext.d.ts.map +1 -1
  143. package/build/types/createClient.d.ts +1 -0
  144. package/build/types/createClient.d.ts.map +1 -1
  145. package/build/types/index.d.ts +3 -2
  146. package/build/types/index.d.ts.map +1 -1
  147. package/build/types/object/fetchPage.d.ts.map +1 -1
  148. package/build/types/object/mediaUpload.d.ts +1 -2
  149. package/build/types/object/mediaUpload.d.ts.map +1 -1
  150. package/build/types/observable/internal/ActionApplication.d.ts.map +1 -1
  151. package/build/types/public/unstable-do-not-use.d.ts +1 -0
  152. package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
  153. package/build/types/queries/applyQuery.d.ts +5 -1
  154. package/build/types/queries/applyQuery.d.ts.map +1 -1
  155. package/build/types/queries/types.d.ts +2 -2
  156. package/build/types/queries/types.d.ts.map +1 -1
  157. package/build/types/util/extractObjectOrInterfaceType.d.ts +1 -0
  158. package/build/types/util/extractObjectOrInterfaceType.d.ts.map +1 -0
  159. package/build/types/util/extractObjectOrInterfaceType.test.d.ts +1 -0
  160. package/build/types/util/extractObjectOrInterfaceType.test.d.ts.map +1 -0
  161. package/build/types/util/objectSpecifierUtils.d.ts +13 -1
  162. package/build/types/util/objectSpecifierUtils.d.ts.map +1 -1
  163. package/package.json +11 -11
  164. package/build/cjs/chunk-E5BQ7757.cjs.map +0 -1
  165. package/build/cjs/chunk-YZHCDIYC.cjs.map +0 -1
@@ -0,0 +1,96 @@
1
+ /*
2
+ * Copyright 2025 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 invariant from "tiny-invariant";
18
+ /* @internal
19
+ * Returns the resultant interface or object type of the object set
20
+ */
21
+ export async function extractObjectOrInterfaceType(clientCtx, objectSet) {
22
+ switch (objectSet.type) {
23
+ case "searchAround":
24
+ {
25
+ const def = await extractObjectOrInterfaceType(clientCtx, objectSet.objectSet);
26
+ if (def === undefined) {
27
+ return undefined;
28
+ }
29
+ const objOrInterfaceDef = def.type === "object" ? await clientCtx.ontologyProvider.getObjectDefinition(def.apiName) : await clientCtx.ontologyProvider.getInterfaceDefinition(def.apiName);
30
+ const linkDef = objOrInterfaceDef.links[objectSet.link];
31
+ !linkDef ? process.env.NODE_ENV !== "production" ? invariant(false, `Missing link definition for '${objectSet.link}'`) : invariant(false) : void 0;
32
+ return objOrInterfaceDef.type === "object" ? {
33
+ apiName: objOrInterfaceDef.links[objectSet.link].targetType,
34
+ type: "object"
35
+ } : {
36
+ apiName: objOrInterfaceDef.links[objectSet.link].targetTypeApiName,
37
+ type: objOrInterfaceDef.links[objectSet.link].targetType
38
+ };
39
+ }
40
+ case "withProperties":
41
+ {
42
+ return extractObjectOrInterfaceType(clientCtx, objectSet.objectSet);
43
+ }
44
+ case "methodInput":
45
+ return undefined;
46
+ case "base":
47
+ return {
48
+ type: "object",
49
+ apiName: objectSet.objectType
50
+ };
51
+ case "interfaceBase":
52
+ return {
53
+ type: "interface",
54
+ apiName: objectSet.interfaceType
55
+ };
56
+ case "filter":
57
+ case "asBaseObjectTypes":
58
+ case "asType":
59
+ case "nearestNeighbors":
60
+ return extractObjectOrInterfaceType(clientCtx, objectSet.objectSet);
61
+ case "intersect":
62
+ case "subtract":
63
+ case "union":
64
+ const objectSets = objectSet.objectSets;
65
+ const objectSetTypes = await Promise.all(objectSets.map(os => extractObjectOrInterfaceType(clientCtx, os)));
66
+ const filteredObjectTypes = objectSetTypes.filter(Boolean);
67
+ const firstObjectType = filteredObjectTypes[0];
68
+ !filteredObjectTypes.every(val => {
69
+ return val?.apiName === firstObjectType?.apiName && val?.type === firstObjectType?.type;
70
+ }) ? process.env.NODE_ENV !== "production" ? invariant(false, "Can only have one object type when doing intersects, subtract, union") : invariant(false) : void 0;
71
+ return filteredObjectTypes[0];
72
+ case "static":
73
+ case "reference":
74
+ // Static and reference object sets are always intersected with a base object set, so we can just return undefined.
75
+ return undefined;
76
+ case "interfaceLinkSearchAround":
77
+ const def = await extractObjectOrInterfaceType(clientCtx, objectSet.objectSet);
78
+ if (def === undefined) {
79
+ return undefined;
80
+ }
81
+ const objOrInterfaceDef = def.type === "object" ? await clientCtx.ontologyProvider.getObjectDefinition(def.apiName) : await clientCtx.ontologyProvider.getInterfaceDefinition(def.apiName);
82
+ const linkDef = objOrInterfaceDef.links[objectSet.interfaceLink];
83
+ !linkDef ? process.env.NODE_ENV !== "production" ? invariant(false, `Missing link definition for '${objectSet.interfaceLink}'`) : invariant(false) : void 0;
84
+ return objOrInterfaceDef.type === "object" ? {
85
+ apiName: objOrInterfaceDef.links[objectSet.interfaceLink].targetType,
86
+ type: "object"
87
+ } : {
88
+ apiName: objOrInterfaceDef.links[objectSet.interfaceLink].targetTypeApiName,
89
+ type: objOrInterfaceDef.links[objectSet.interfaceLink].targetType
90
+ };
91
+ // We don't have to worry about new object sets being added and doing a runtime break and breaking people since the OSDK is always constructing these.
92
+ default:
93
+ process.env.NODE_ENV !== "production" ? invariant(false, `Unsupported object set type for deriving object or interface type,`) : invariant(false);
94
+ }
95
+ }
96
+ //# sourceMappingURL=extractObjectOrInterfaceType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractObjectOrInterfaceType.js","names":["invariant","extractObjectOrInterfaceType","clientCtx","objectSet","type","def","undefined","objOrInterfaceDef","ontologyProvider","getObjectDefinition","apiName","getInterfaceDefinition","linkDef","links","link","process","env","NODE_ENV","targetType","targetTypeApiName","objectType","interfaceType","objectSets","objectSetTypes","Promise","all","map","os","filteredObjectTypes","filter","Boolean","firstObjectType","every","val","interfaceLink"],"sources":["extractObjectOrInterfaceType.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 { ObjectOrInterfaceDefinition } from \"@osdk/api\";\nimport type { ObjectSet } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\n\n/* @internal\n* Returns the resultant interface or object type of the object set\n*/\nexport async function extractObjectOrInterfaceType(\n clientCtx: MinimalClient,\n objectSet: ObjectSet,\n): Promise<\n ObjectOrInterfaceDefinition | undefined\n> {\n switch (objectSet.type) {\n case \"searchAround\": {\n const def = await extractObjectOrInterfaceType(\n clientCtx,\n objectSet.objectSet,\n );\n if (def === undefined) {\n return undefined;\n }\n const objOrInterfaceDef = def.type === \"object\"\n ? await clientCtx.ontologyProvider.getObjectDefinition(\n def.apiName,\n )\n : await clientCtx.ontologyProvider.getInterfaceDefinition(\n def.apiName,\n );\n const linkDef = objOrInterfaceDef.links[objectSet.link];\n invariant(linkDef, `Missing link definition for '${objectSet.link}'`);\n\n return objOrInterfaceDef.type === \"object\"\n ? {\n apiName: objOrInterfaceDef.links[objectSet.link].targetType,\n type: \"object\",\n }\n : {\n apiName: objOrInterfaceDef.links[objectSet.link].targetTypeApiName,\n type: objOrInterfaceDef.links[objectSet.link].targetType,\n };\n }\n case \"withProperties\": {\n return extractObjectOrInterfaceType(\n clientCtx,\n objectSet.objectSet,\n );\n }\n case \"methodInput\":\n return undefined;\n case \"base\":\n return { type: \"object\", apiName: objectSet.objectType };\n case \"interfaceBase\":\n return { type: \"interface\", apiName: objectSet.interfaceType };\n case \"filter\":\n case \"asBaseObjectTypes\":\n case \"asType\":\n case \"nearestNeighbors\":\n return extractObjectOrInterfaceType(\n clientCtx,\n objectSet.objectSet,\n );\n case \"intersect\":\n case \"subtract\":\n case \"union\":\n const objectSets = objectSet.objectSets;\n const objectSetTypes = await Promise.all(\n objectSets.map((os) =>\n extractObjectOrInterfaceType(\n clientCtx,\n os,\n )\n ),\n );\n\n const filteredObjectTypes = objectSetTypes.filter(Boolean);\n const firstObjectType = filteredObjectTypes[0];\n invariant(\n filteredObjectTypes.every(val => {\n return val?.apiName === firstObjectType?.apiName\n && val?.type === firstObjectType?.type;\n }),\n \"Can only have one object type when doing intersects, subtract, union\",\n );\n\n return filteredObjectTypes[0];\n case \"static\":\n case \"reference\":\n // Static and reference object sets are always intersected with a base object set, so we can just return undefined.\n return undefined;\n case \"interfaceLinkSearchAround\":\n const def = await extractObjectOrInterfaceType(\n clientCtx,\n objectSet.objectSet,\n );\n if (def === undefined) {\n return undefined;\n }\n const objOrInterfaceDef = def.type === \"object\"\n ? await clientCtx.ontologyProvider.getObjectDefinition(\n def.apiName,\n )\n : await clientCtx.ontologyProvider.getInterfaceDefinition(\n def.apiName,\n );\n const linkDef = objOrInterfaceDef.links[objectSet.interfaceLink];\n invariant(\n linkDef,\n `Missing link definition for '${objectSet.interfaceLink}'`,\n );\n return objOrInterfaceDef.type === \"object\"\n ? {\n apiName: objOrInterfaceDef.links[objectSet.interfaceLink].targetType,\n type: \"object\",\n }\n : {\n apiName:\n objOrInterfaceDef.links[objectSet.interfaceLink].targetTypeApiName,\n type: objOrInterfaceDef.links[objectSet.interfaceLink].targetType,\n };\n // We don't have to worry about new object sets being added and doing a runtime break and breaking people since the OSDK is always constructing these.\n default:\n const _: never = objectSet;\n invariant(\n false,\n `Unsupported object set type for deriving object or interface type,`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,SAAS,MAAM,gBAAgB;AAGtC;AACA;AACA;AACA,OAAO,eAAeC,4BAA4BA,CAChDC,SAAwB,EACxBC,SAAoB,EAGpB;EACA,QAAQA,SAAS,CAACC,IAAI;IACpB,KAAK,cAAc;MAAE;QACnB,MAAMC,GAAG,GAAG,MAAMJ,4BAA4B,CAC5CC,SAAS,EACTC,SAAS,CAACA,SACZ,CAAC;QACD,IAAIE,GAAG,KAAKC,SAAS,EAAE;UACrB,OAAOA,SAAS;QAClB;QACA,MAAMC,iBAAiB,GAAGF,GAAG,CAACD,IAAI,KAAK,QAAQ,GAC3C,MAAMF,SAAS,CAACM,gBAAgB,CAACC,mBAAmB,CACpDJ,GAAG,CAACK,OACN,CAAC,GACC,MAAMR,SAAS,CAACM,gBAAgB,CAACG,sBAAsB,CACvDN,GAAG,CAACK,OACN,CAAC;QACH,MAAME,OAAO,GAAGL,iBAAiB,CAACM,KAAK,CAACV,SAAS,CAACW,IAAI,CAAC;QACvD,CAAUF,OAAO,GAAAG,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAjBjB,SAAS,QAAU,gCAAgCG,SAAS,CAACW,IAAI,GAAG,IAApEd,SAAS;QAET,OAAOO,iBAAiB,CAACH,IAAI,KAAK,QAAQ,GACtC;UACAM,OAAO,EAAEH,iBAAiB,CAACM,KAAK,CAACV,SAAS,CAACW,IAAI,CAAC,CAACI,UAAU;UAC3Dd,IAAI,EAAE;QACR,CAAC,GACC;UACAM,OAAO,EAAE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@
1
+ /*
2
+ * Copyright 2025 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 { describe, expect, it } from "vitest";
18
+ import { extractObjectOrInterfaceType } from "./extractObjectOrInterfaceType.js";
19
+ describe("extractRdpDefinition", () => {
20
+ const mockClientCtx = {
21
+ ontologyProvider: {
22
+ getObjectDefinition: objectType => {
23
+ if (objectType === "BaseType") {
24
+ return {
25
+ links: {
26
+ testLink1: {
27
+ targetType: "SecondType",
28
+ "multiplicity": "many"
29
+ }
30
+ }
31
+ };
32
+ } else if (objectType === "SecondType") {
33
+ return {
34
+ links: {
35
+ testLink2: {
36
+ targetType: "ThirdType",
37
+ "multiplicity": "many"
38
+ }
39
+ }
40
+ };
41
+ } else if (objectType === "ThirdType") {
42
+ return {
43
+ properties: {
44
+ testProperty: {
45
+ type: "attachment"
46
+ }
47
+ }
48
+ };
49
+ } else {
50
+ throw new Error(`Missing definition for '${objectType}'`);
51
+ }
52
+ },
53
+ getInterfaceDefinition: interfaceType => {
54
+ if (interfaceType === "interface1") {
55
+ return {
56
+ links: {
57
+ linkToInterface2: {
58
+ targetType: "interface",
59
+ targetTypeApiName: "interface2",
60
+ multiplicity: false
61
+ }
62
+ }
63
+ };
64
+ } else if (interfaceType === "interface1") {
65
+ return {
66
+ links: {
67
+ linkToInterface1: {
68
+ targetType: "interface",
69
+ targetTypeApiName: "interface1",
70
+ multiplicity: false
71
+ }
72
+ }
73
+ };
74
+ } else {
75
+ throw new Error(`Missing definition for '${interfaceType}'`);
76
+ }
77
+ }
78
+ }
79
+ };
80
+ const objectSetInterfaceToInterface = {
81
+ type: "interfaceLinkSearchAround",
82
+ objectSet: {
83
+ type: "interfaceBase",
84
+ interfaceType: "interface1"
85
+ },
86
+ interfaceLink: "linkToInterface2"
87
+ };
88
+ it("handles 'withProperties' object set type", async () => {
89
+ const result = await extractObjectOrInterfaceType(mockClientCtx, objectSetInterfaceToInterface);
90
+ expect(result).toEqual({
91
+ apiName: "interface2",
92
+ type: "interface"
93
+ });
94
+ });
95
+ it("handles `intersection` object set type and nested static and reference object sets", async () => {
96
+ const result = await extractObjectOrInterfaceType(mockClientCtx, {
97
+ type: "intersect",
98
+ objectSets: [{
99
+ type: "interfaceLinkSearchAround",
100
+ objectSet: {
101
+ type: "interfaceBase",
102
+ interfaceType: "interface1"
103
+ },
104
+ interfaceLink: "linkToInterface2"
105
+ }, {
106
+ type: "static",
107
+ "objects": ["object1", "object2"]
108
+ }, {
109
+ type: "reference",
110
+ "reference": "rid.os.1234"
111
+ }]
112
+ });
113
+ expect(result).toEqual({
114
+ apiName: "interface2",
115
+ type: "interface"
116
+ });
117
+ });
118
+ it("throes with intersect, subtract, or union having different child object types", async () => {
119
+ await expect(extractObjectOrInterfaceType(mockClientCtx, {
120
+ type: "intersect",
121
+ objectSets: [{
122
+ type: "interfaceLinkSearchAround",
123
+ objectSet: {
124
+ type: "interfaceBase",
125
+ interfaceType: "interface1"
126
+ },
127
+ interfaceLink: "linkToInterface2"
128
+ }, {
129
+ type: "interfaceBase",
130
+ interfaceType: "interface1"
131
+ }]
132
+ })).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Can only have one object type when doing intersects, subtract, union]`);
133
+ });
134
+ });
135
+ //# sourceMappingURL=extractObjectOrInterfaceType.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extractObjectOrInterfaceType.test.js","names":["describe","expect","it","extractObjectOrInterfaceType","mockClientCtx","ontologyProvider","getObjectDefinition","objectType","links","testLink1","targetType","testLink2","properties","testProperty","type","Error","getInterfaceDefinition","interfaceType","linkToInterface2","targetTypeApiName","multiplicity","linkToInterface1","objectSetInterfaceToInterface","objectSet","interfaceLink","result","toEqual","apiName","objectSets","rejects","toThrowErrorMatchingInlineSnapshot"],"sources":["extractObjectOrInterfaceType.test.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 { InterfaceMetadata, ObjectMetadata } from \"@osdk/api\";\nimport type { ObjectSet } from \"@osdk/foundry.ontologies\";\nimport { describe, expect, it } from \"vitest\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { extractObjectOrInterfaceType } from \"./extractObjectOrInterfaceType.js\";\n\ndescribe(\"extractRdpDefinition\", () => {\n const mockClientCtx = {\n ontologyProvider: {\n getObjectDefinition: (objectType: string) => {\n if (objectType === \"BaseType\") {\n return {\n links: {\n testLink1: {\n targetType: \"SecondType\",\n \"multiplicity\": \"many\",\n } satisfies ObjectMetadata.Link<any, any>,\n },\n };\n } else if (objectType === \"SecondType\") {\n return {\n links: {\n testLink2: {\n targetType: \"ThirdType\",\n \"multiplicity\": \"many\",\n } satisfies ObjectMetadata.Link<any, any>,\n },\n };\n } else if (objectType === \"ThirdType\") {\n return {\n properties: {\n testProperty: {\n type: \"attachment\",\n } satisfies ObjectMetadata.Property,\n },\n };\n } else {\n throw new Error(`Missing definition for '${objectType}'`);\n }\n },\n getInterfaceDefinition: (interfaceType: string) => {\n if (interfaceType === \"interface1\") {\n return {\n links: {\n linkToInterface2: {\n targetType: \"interface\",\n targetTypeApiName: \"interface2\",\n multiplicity: false,\n } satisfies InterfaceMetadata.Link<any, any>,\n },\n };\n } else if (interfaceType === \"interface1\") {\n return {\n links: {\n linkToInterface1: {\n targetType: \"interface\",\n targetTypeApiName: \"interface1\",\n multiplicity: false,\n } satisfies InterfaceMetadata.Link<any, any>,\n },\n };\n } else {\n throw new Error(`Missing definition for '${interfaceType}'`);\n }\n },\n } as any,\n } as MinimalClient;\n\n const objectSetInterfaceToInterface: ObjectSet = {\n type: \"interfaceLinkSearchAround\",\n objectSet: {\n type: \"interfaceBase\",\n interfaceType: \"interface1\",\n },\n interfaceLink: \"linkToInterface2\",\n };\n\n it(\"handles 'withProperties' object set type\", async () => {\n const result = await extractObjectOrInterfaceType(\n mockClientCtx,\n objectSetInterfaceToInterface,\n );\n\n expect(result).toEqual({ apiName: \"interface2\", type: \"interface\" });\n });\n\n it(\"handles `intersection` object set type and nested static and reference object sets\", async () => {\n const intersectionObjectSet: ObjectSet = {\n type: \"intersect\",\n objectSets: [\n {\n type: \"interfaceLinkSearchAround\",\n objectSet: {\n type: \"interfaceBase\",\n interfaceType: \"interface1\",\n },\n interfaceLink: \"linkToInterface2\",\n },\n { type: \"static\", \"objects\": [\"object1\", \"object2\"] },\n { type: \"reference\", \"reference\": \"rid.os.1234\" },\n ],\n };\n\n const result = await extractObjectOrInterfaceType(\n mockClientCtx,\n intersectionObjectSet,\n );\n\n expect(result).toEqual({ apiName: \"interface2\", type: \"interface\" });\n });\n\n it(\"throes with intersect, subtract, or union having different child object types\", async () => {\n const intersectionObjectSet: ObjectSet = {\n type: \"intersect\",\n objectSets: [\n {\n type: \"interfaceLinkSearchAround\",\n objectSet: {\n type: \"interfaceBase\",\n interfaceType: \"interface1\",\n },\n interfaceLink: \"linkToInterface2\",\n },\n { type: \"interfaceBase\", interfaceType: \"interface1\" },\n ],\n };\n\n await expect(\n extractObjectOrInterfaceType(mockClientCtx, intersectionObjectSet),\n ).rejects.toThrowErrorMatchingInlineSnapshot(\n `[Error: Invariant failed: Can only have one object type when doing intersects, subtract, union]`,\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,4BAA4B,QAAQ,mCAAmC;AAEhFH,QAAQ,CAAC,sBAAsB,EAAE,MAAM;EACrC,MAAMI,aAAa,GAAG;IACpBC,gBAAgB,EAAE;MAChBC,mBAAmB,EAAGC,UAAkB,IAAK;QAC3C,IAAIA,UAAU,KAAK,UAAU,EAAE;UAC7B,OAAO;YACLC,KAAK,EAAE;cACLC,SAAS,EAAE;gBACTC,UAAU,EAAE,YAAY;gBACxB,cAAc,EAAE;cAClB;YACF;UACF,CAAC;QACH,CAAC,MAAM,IAAIH,UAAU,KAAK,YAAY,EAAE;UACtC,OAAO;YACLC,KAAK,EAAE;cACLG,SAAS,EAAE;gBACTD,UAAU,EAAE,WAAW;gBACvB,cAAc,EAAE;cAClB;YACF;UACF,CAAC;QACH,CAAC,MAAM,IAAIH,UAAU,KAAK,WAAW,EAAE;UACrC,OAAO;YACLK,UAAU,EAAE;cACVC,YAAY,EAAE;gBACZC,IAAI,EAAE;cACR;YACF;UACF,CAAC;QACH,CAAC,MAAM;UACL,MAAM,IAAIC,KAAK,CAAC,2BAA2BR,UAAU,GAAG,CAAC;QAC3D;MACF,CAAC;MACDS,sBAAsB,EAAGC,aAAqB,IAAK;QACjD,IAAIA,aAAa,KAAK,YAAY,EAAE;UAClC,OAAO;YACLT,KAAK,EAAE;cACLU,gBAAgB,EAAE;gBAChBR,UAAU,EAAE,WAAW;gBACvBS,iBAAiB,EAAE,YAAY;gBAC/BC,YAAY,EAAE;cAChB;YACF;UACF,CAAC;QACH,CAAC,MAAM,IAAIH,aAAa,KAAK,YAAY,EAAE;UACzC,OAAO;YACLT,KAAK,EAAE;cACLa,gBAAgB,EAAE;gBAChBX,UAAU,EAA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AAMD,MAAM,CACVE,4BAA4B,CAACC,aAAa,EAhBH;MACvCU,IAAI,EAAE,WAAW;MACjBc,UAAU,EAAE,CACV;QACEd,IAAI,EAAE,2BAA2B;QACjCS,SAAS,EAAE;UACTT,IAAI,EAAE,eAAe;UACrBG,aAAa,EAAE;QACjB,CAAC;QACDO,aAAa,EAAE;MACjB,CAAC,EACD;QAAEV,IAAI,EAAE,eAAe;QAAEG,aAAa,EAAE;MAAa,CAAC;IAE1D,CAGmE,CACnE,CAAC,CAACY,OAAO,CAACC,kCAAkC,CAC1C,iGACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -18,4 +18,14 @@
18
18
  export function isInterfaceActionParam(o) {
19
19
  return o != null && typeof o === "object" && "$objectType" in o && "$primaryKey" in o;
20
20
  }
21
+
22
+ /** @internal */
23
+ export function isInterfaceQueryParam(o) {
24
+ return o != null && typeof o === "object" && "$objectType" in o && "$primaryKey" in o;
25
+ }
26
+
27
+ /** @internal */
28
+ export function isInterfaceSpecifier(o) {
29
+ return o != null && typeof o === "object" && "$objectType" in o && "$primaryKey" in o && o.$objectType !== o.$apiName;
30
+ }
21
31
  //# sourceMappingURL=interfaceUtils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"interfaceUtils.js","names":["isInterfaceActionParam","o"],"sources":["interfaceUtils.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 { ActionParam } from \"@osdk/api\";\n\n/** @internal */\nexport function isInterfaceActionParam(\n o: any,\n): o is ActionParam.InterfaceType<any> {\n return o != null && typeof o === \"object\"\n && \"$objectType\" in o && \"$primaryKey\" in o;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA,OAAO,SAASA,sBAAsBA,CACpCC,CAAM,EAC+B;EACrC,OAAOA,CAAC,IAAI,IAAI,IAAI,OAAOA,CAAC,KAAK,QAAQ,IACpC,aAAa,IAAIA,CAAC,IAAI,aAAa,IAAIA,CAAC;AAC/C","ignoreList":[]}
1
+ {"version":3,"file":"interfaceUtils.js","names":["isInterfaceActionParam","o","isInterfaceQueryParam","isInterfaceSpecifier","$objectType","$apiName"],"sources":["interfaceUtils.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 { ActionParam, PrimaryKeyTypes, QueryParam } from \"@osdk/api\";\n\n/** @internal */\nexport function isInterfaceActionParam(\n o: any,\n): o is ActionParam.InterfaceType<any> {\n return o != null && typeof o === \"object\"\n && \"$objectType\" in o && \"$primaryKey\" in o;\n}\n\n/** @internal */\nexport function isInterfaceQueryParam(\n o: any,\n): o is QueryParam.InterfaceType<any> {\n return o != null && typeof o === \"object\"\n && \"$objectType\" in o && \"$primaryKey\" in o;\n}\n\n/** @internal */\nexport function isInterfaceSpecifier(\n o: any,\n): o is {\n $apiName: string;\n $objectType: string;\n $primaryKey: PrimaryKeyTypes;\n} {\n return o != null && typeof o === \"object\"\n && \"$objectType\" in o && \"$primaryKey\" in o && o.$objectType !== o.$apiName;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA,OAAO,SAASA,sBAAsBA,CACpCC,CAAM,EAC+B;EACrC,OAAOA,CAAC,IAAI,IAAI,IAAI,OAAOA,CAAC,KAAK,QAAQ,IACpC,aAAa,IAAIA,CAAC,IAAI,aAAa,IAAIA,CAAC;AAC/C;;AAEA;AACA,OAAO,SAASC,qBAAqBA,CACnCD,CAAM,EAC8B;EACpC,OAAOA,CAAC,IAAI,IAAI,IAAI,OAAOA,CAAC,KAAK,QAAQ,IACpC,aAAa,IAAIA,CAAC,IAAI,aAAa,IAAIA,CAAC;AAC/C;;AAEA;AACA,OAAO,SAASE,oBAAoBA,CAClCF,CAAM,EAKN;EACA,OAAOA,CAAC,IAAI,IAAI,IAAI,OAAOA,CAAC,KAAK,QAAQ,IACpC,aAAa,IAAIA,CAAC,IAAI,aAAa,IAAIA,CAAC,IAAIA,CAAC,CAACG,WAAW,KAAKH,CAAC,CAACI,QAAQ;AAC/E","ignoreList":[]}
@@ -26,6 +26,18 @@ export function createObjectSpecifierFromPrimaryKey(objectDef, primaryKey) {
26
26
  return `${objectDef.apiName}:${primaryKey}`;
27
27
  }
28
28
 
29
+ /**
30
+ * Creates an Object Specifier. An ObjectSpecifier is a string that uniquely identifies an object in the system,
31
+ * even when loading an interface object where primary key uniqueness is not guaranteed.
32
+ *
33
+ * @param objectDef - An Object Type Definition
34
+ * @param primaryKey - The value you want to use as the primary key
35
+ * @returns An Object Specifier
36
+ */
37
+ export function createObjectSpecifierFromInterfaceSpecifier(interfaceDef, interfaceSpecifier) {
38
+ return `${interfaceSpecifier.objectTypeApiName}:${interfaceSpecifier.primaryKeyValue}`;
39
+ }
40
+
29
41
  /**
30
42
  * Extracts the primary key from an ObjectSpecifier on an OSDK object.
31
43
  *
@@ -1 +1 @@
1
- {"version":3,"file":"objectSpecifierUtils.js","names":["createObjectSpecifierFromPrimaryKey","objectDef","primaryKey","apiName","extractPrimaryKeyFromObjectSpecifier","ObjectSpecifier","split","extractObjectTypeFromObjectSpecifier"],"sources":["objectSpecifierUtils.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 ObjectSpecifier,\n ObjectTypeDefinition,\n PrimaryKeyType,\n} from \"@osdk/api\";\n\n/**\n * Creates an Object Specifier. An ObjectSpecifier is a string that uniquely identifies an object in the system,\n * even when loading an interface object where primary key uniqueness is not guaranteed.\n *\n * @param objectDef - An Object Type Definition\n * @param primaryKey - The value you want to use as the primary key\n * @returns An Object Specifier\n */\nexport function createObjectSpecifierFromPrimaryKey<\n Q extends ObjectTypeDefinition,\n>(objectDef: Q, primaryKey: PrimaryKeyType<Q>): ObjectSpecifier<Q> {\n return `${objectDef.apiName}:${primaryKey}` as ObjectSpecifier<Q>;\n}\n\n/**\n * Extracts the primary key from an ObjectSpecifier on an OSDK object.\n *\n * @param ObjectSpecifier\n * @returns A string representing the primary key\n */\nexport function extractPrimaryKeyFromObjectSpecifier(\n ObjectSpecifier: ObjectSpecifier<any>,\n): string {\n return ObjectSpecifier.split(\":\")[1];\n}\n\n/**\n * Extracts the object type from an ObjectSpecifier on an OSDK object.\n *\n * @param ObjectSpecifier\n * @returns The object type extracted from the ObjectSpecifier\n */\nexport function extractObjectTypeFromObjectSpecifier(\n ObjectSpecifier: ObjectSpecifier<any>,\n): string {\n return ObjectSpecifier.split(\":\")[0];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mCAAmCA,CAEjDC,SAAY,EAAEC,UAA6B,EAAsB;EACjE,OAAO,GAAGD,SAAS,CAACE,OAAO,IAAID,UAAU,EAAE;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,oCAAoCA,CAClDC,eAAqC,EAC7B;EACR,OAAOA,eAAe,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oCAAoCA,CAClDF,eAAqC,EAC7B;EACR,OAAOA,eAAe,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtC","ignoreList":[]}
1
+ {"version":3,"file":"objectSpecifierUtils.js","names":["createObjectSpecifierFromPrimaryKey","objectDef","primaryKey","apiName","createObjectSpecifierFromInterfaceSpecifier","interfaceDef","interfaceSpecifier","objectTypeApiName","primaryKeyValue","extractPrimaryKeyFromObjectSpecifier","ObjectSpecifier","split","extractObjectTypeFromObjectSpecifier"],"sources":["objectSpecifierUtils.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 InterfaceDefinition,\n ObjectSpecifier,\n ObjectTypeDefinition,\n PrimaryKeyType,\n} from \"@osdk/api\";\n\n/**\n * Creates an Object Specifier. An ObjectSpecifier is a string that uniquely identifies an object in the system,\n * even when loading an interface object where primary key uniqueness is not guaranteed.\n *\n * @param objectDef - An Object Type Definition\n * @param primaryKey - The value you want to use as the primary key\n * @returns An Object Specifier\n */\nexport function createObjectSpecifierFromPrimaryKey<\n Q extends ObjectTypeDefinition,\n>(objectDef: Q, primaryKey: PrimaryKeyType<Q>): ObjectSpecifier<Q> {\n return `${objectDef.apiName}:${primaryKey}` as ObjectSpecifier<Q>;\n}\n\n/**\n * Creates an Object Specifier. An ObjectSpecifier is a string that uniquely identifies an object in the system,\n * even when loading an interface object where primary key uniqueness is not guaranteed.\n *\n * @param objectDef - An Object Type Definition\n * @param primaryKey - The value you want to use as the primary key\n * @returns An Object Specifier\n */\nexport function createObjectSpecifierFromInterfaceSpecifier<\n Q extends InterfaceDefinition,\n>(\n interfaceDef: Q,\n interfaceSpecifier: {\n objectTypeApiName: string;\n primaryKeyValue: PrimaryKeyType<Q>;\n },\n): ObjectSpecifier<Q> {\n return `${interfaceSpecifier.objectTypeApiName}:${interfaceSpecifier.primaryKeyValue}` as ObjectSpecifier<\n Q\n >;\n}\n\n/**\n * Extracts the primary key from an ObjectSpecifier on an OSDK object.\n *\n * @param ObjectSpecifier\n * @returns A string representing the primary key\n */\nexport function extractPrimaryKeyFromObjectSpecifier(\n ObjectSpecifier: ObjectSpecifier<any>,\n): string {\n return ObjectSpecifier.split(\":\")[1];\n}\n\n/**\n * Extracts the object type from an ObjectSpecifier on an OSDK object.\n *\n * @param ObjectSpecifier\n * @returns The object type extracted from the ObjectSpecifier\n */\nexport function extractObjectTypeFromObjectSpecifier(\n ObjectSpecifier: ObjectSpecifier<any>,\n): string {\n return ObjectSpecifier.split(\":\")[0];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mCAAmCA,CAEjDC,SAAY,EAAEC,UAA6B,EAAsB;EACjE,OAAO,GAAGD,SAAS,CAACE,OAAO,IAAID,UAAU,EAAE;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,2CAA2CA,CAGzDC,YAAe,EACfC,kBAGC,EACmB;EACpB,OAAO,GAAGA,kBAAkB,CAACC,iBAAiB,IAAID,kBAAkB,CAACE,eAAe,EAAE;AAGxF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oCAAoCA,CAClDC,eAAqC,EAC7B;EACR,OAAOA,eAAe,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oCAAoCA,CAClDF,eAAqC,EAC7B;EACR,OAAOA,eAAe,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtC","ignoreList":[]}
@@ -14,10 +14,9 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { NULL_VALUE } from "@osdk/api";
18
17
  import * as OntologiesV2 from "@osdk/foundry.ontologies";
19
18
  import { isAttachmentFile, isAttachmentUpload } from "../object/AttachmentUpload.js";
20
- import { isMediaReference, isMediaUpload } from "../object/mediaUpload.js";
19
+ import { isMediaReference } from "../object/mediaUpload.js";
21
20
  import { getWireObjectSet, isObjectSet } from "../objectSet/createObjectSet.js";
22
21
  import { isInterfaceActionParam } from "./interfaceUtils.js";
23
22
  import { isObjectSpecifiersObject } from "./isObjectSpecifiersObject.js";
@@ -38,9 +37,6 @@ export async function toDataValue(value, client, actionMetadata) {
38
37
  // Null values are not allowed with OSDK types, but leaving here as an override.
39
38
  return value;
40
39
  }
41
- if (value === NULL_VALUE) {
42
- return null;
43
- }
44
40
 
45
41
  // arrays and sets are both sent over the wire as arrays
46
42
  if (Array.isArray(value) || value instanceof Set) {
@@ -70,16 +66,6 @@ export async function toDataValue(value, client, actionMetadata) {
70
66
  return await toDataValue(attachment.rid, client, actionMetadata);
71
67
  }
72
68
 
73
- // new media item upload interface, very similar to how attachments work above
74
-
75
- if (isMediaUpload(value)) {
76
- const mediaRef = await OntologiesV2.MediaReferenceProperties.uploadMedia(client, await client.ontologyRid, actionMetadata.apiName, value.data, {
77
- mediaItemPath: value.path,
78
- preview: true
79
- });
80
- return await toDataValue(mediaRef, client, actionMetadata);
81
- }
82
-
83
69
  // objects just send the JSON'd primaryKey
84
70
  if (isOntologyObjectV2(value)) {
85
71
  return await toDataValue(value.__primaryKey, client, actionMetadata);
@@ -1 +1 @@
1
- {"version":3,"file":"toDataValue.js","names":["NULL_VALUE","OntologiesV2","isAttachmentFile","isAttachmentUpload","isMediaReference","isMediaUpload","getWireObjectSet","isObjectSet","isInterfaceActionParam","isObjectSpecifiersObject","isOntologyObjectV2","isPoint","isWireObjectSet","toDataValue","value","client","actionMetadata","Array","isArray","Set","values","from","some","dataValue","converted","push","promiseArray","innerValue","Promise","all","attachment","Attachments","upload","data","filename","name","rid","mediaRef","MediaReferenceProperties","uploadMedia","ontologyRid","apiName","mediaItemPath","path","preview","__primaryKey","$primaryKey","coordinates","objectTypeApiName","$objectType","primaryKeyValue","Object","entries","reduce","promisedAcc","key","structValue","acc","resolve"],"sources":["toDataValue.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NULL_VALUE } from \"@osdk/api\";\nimport type { ActionMetadata } from \"@osdk/api\";\nimport { type DataValue } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n isAttachmentFile,\n isAttachmentUpload,\n} from \"../object/AttachmentUpload.js\";\nimport { isMediaReference, isMediaUpload } from \"../object/mediaUpload.js\";\nimport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { isInterfaceActionParam } from \"./interfaceUtils.js\";\nimport { isObjectSpecifiersObject } from \"./isObjectSpecifiersObject.js\";\nimport { isOntologyObjectV2 } from \"./isOntologyObjectV2.js\";\nimport { isPoint } from \"./isPoint.js\";\nimport { isWireObjectSet } from \"./WireObjectSet.js\";\n\n/**\n * Marshall user-facing data into the wire DataValue type\n *\n * @see DataValue for the expected payloads\n * @internal\n */\nexport async function toDataValue(\n value: unknown,\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n): Promise<DataValue> {\n if (value == null) {\n // typeof null is 'object' so do this first\n // Sending null over the wire clears the data, whereas undefined is dropped at request time.\n // Null values are not allowed with OSDK types, but leaving here as an override.\n return value;\n }\n\n if (value === NULL_VALUE) {\n return null;\n }\n\n // arrays and sets are both sent over the wire as arrays\n if (Array.isArray(value) || value instanceof Set) {\n const values = Array.from(value);\n if (\n values.some((dataValue) =>\n isAttachmentUpload(dataValue) || isAttachmentFile(dataValue)\n )\n ) {\n const converted = [];\n for (const value of values) {\n converted.push(await toDataValue(value, client, actionMetadata));\n }\n return converted;\n }\n const promiseArray = Array.from(\n value,\n async (innerValue) =>\n await toDataValue(innerValue, client, actionMetadata),\n );\n return Promise.all(promiseArray);\n }\n\n // For uploads, we need to upload ourselves first to get the RID of the attachment\n if (isAttachmentUpload(value)) {\n const attachment = await OntologiesV2.Attachments.upload(\n client,\n value.data,\n {\n filename: value.name,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n if (isAttachmentFile(value)) {\n const attachment = await OntologiesV2.Attachments.upload(\n client,\n value,\n {\n filename: value.name as string,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n // new media item upload interface, very similar to how attachments work above\n\n if (isMediaUpload(value)) {\n const mediaRef = await OntologiesV2.MediaReferenceProperties\n .uploadMedia(\n client,\n await client.ontologyRid,\n actionMetadata.apiName,\n value.data,\n {\n mediaItemPath: value.path,\n preview: true,\n },\n );\n return await toDataValue(mediaRef, client, actionMetadata);\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return await toDataValue(value.__primaryKey, client, actionMetadata);\n }\n\n if (isObjectSpecifiersObject(value)) {\n return await toDataValue(value.$primaryKey, client, actionMetadata);\n }\n\n if (isPoint(value)) {\n return await toDataValue(\n `${value.coordinates[1]},${value.coordinates[0]}`,\n client,\n actionMetadata,\n );\n }\n\n // object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)\n if (isWireObjectSet(value)) {\n return value;\n }\n if (isObjectSet(value)) {\n return getWireObjectSet(value);\n }\n\n if (isMediaReference(value)) {\n return value;\n }\n\n if (isInterfaceActionParam(value)) {\n return {\n objectTypeApiName: value.$objectType,\n primaryKeyValue: value.$primaryKey,\n };\n }\n\n // TODO (during queries implementation)\n // two dimensional aggregation\n // three dimensional aggregation\n\n // struct\n if (typeof value === \"object\") {\n return Object.entries(value).reduce(\n async (promisedAcc, [key, structValue]) => {\n const acc = await promisedAcc;\n acc[key] = await toDataValue(structValue, client, actionMetadata);\n return acc;\n },\n Promise.resolve({} as { [key: string]: DataValue }),\n );\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp, object type reference\n return value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,QAAQ,WAAW;AAGtC,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AAExD,SACEC,gBAAgB,EAChBC,kBAAkB,QACb,+BAA+B;AACtC,SAASC,gBAAgB,EAAEC,aAAa,QAAQ,0BAA0B;AAC1E,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,iCAAiC;AAC/E,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,SAASC,wBAAwB,QAAQ,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hC,MAAM,EACNC,cACF,CAAC;EACH;;EAEA;EACA,IAAIJ,eAAe,CAACE,KAAK,CAAC,EAAE;IAC1B,OAAOA,KAAK;EACd;EACA,IAAIP,WAAW,CAACO,KAAK,CAAC,EAAE;IACtB,OAAOR,gBAAgB,CAACQ,KAAK,CAAC;EAChC;EAEA,IAAIV,gBAAgB,CAACU,KAAK,CAAC,EAAE;IAC3B,OAAOA,KAAK;EACd;EAEA,IAAIN,sBAAsB,CAACM,KAAK,CAAC,EAAE;IACjC,OAAO;MACLkC,iBAAiB,EAAElC,KAAK,CAACmC,WAAW;MACpCC,eAAe,EAAEpC,KAAK,CAACgC;IACzB,CAAC;EACH;;EAEA;EACA;EACA;;EAEA;EACA,IAAI,OAAOhC,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAOqC,MAAM,CAACC,OAAO,CAACtC,KAAK,CAAC,CAACuC,MAAM,CACjC,OAAOC,WAAW,EAAE,CAACC,GAAG,EAAEC,WAAW,CAAC,KAAK;MACzC,MAAMC,GAAG,GAAG,MAAMH,WAAW;MAC7BG,GAAG,CAACF,GAAG,CAAC,GAAG,MAAM1C,WAAW,CAAC2C,WAAW,EAAEzC,MAAM,EAAEC,cAAc,CAAC;MACjE,OAAOyC,GAAG;IACZ,CAAC,EACD7B,OAAO,CAAC8B,OAAO,CAAC,CAAC,CAAiC,CACpD,CAAC;EACH;;EAEA;EACA,OAAO5C,KAAK;AACd","ignoreList":[]}
1
+ {"version":3,"file":"toDataValue.js","names":["OntologiesV2","isAttachmentFile","isAttachmentUpload","isMediaReference","getWireObjectSet","isObjectSet","isInterfaceActionParam","isObjectSpecifiersObject","isOntologyObjectV2","isPoint","isWireObjectSet","toDataValue","value","client","actionMetadata","Array","isArray","Set","values","from","some","dataValue","converted","push","promiseArray","innerValue","Promise","all","attachment","Attachments","upload","data","filename","name","rid","__primaryKey","$primaryKey","coordinates","objectTypeApiName","$objectType","primaryKeyValue","Object","entries","reduce","promisedAcc","key","structValue","acc","resolve"],"sources":["toDataValue.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ActionMetadata } from \"@osdk/api\";\nimport { type DataValue } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n isAttachmentFile,\n isAttachmentUpload,\n} from \"../object/AttachmentUpload.js\";\nimport { isMediaReference } from \"../object/mediaUpload.js\";\nimport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { isInterfaceActionParam } from \"./interfaceUtils.js\";\nimport { isObjectSpecifiersObject } from \"./isObjectSpecifiersObject.js\";\nimport { isOntologyObjectV2 } from \"./isOntologyObjectV2.js\";\nimport { isPoint } from \"./isPoint.js\";\nimport { isWireObjectSet } from \"./WireObjectSet.js\";\n\n/**\n * Marshall user-facing data into the wire DataValue type\n *\n * @see DataValue for the expected payloads\n * @internal\n */\nexport async function toDataValue(\n value: unknown,\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n): Promise<DataValue> {\n if (value == null) {\n // typeof null is 'object' so do this first\n // Sending null over the wire clears the data, whereas undefined is dropped at request time.\n // Null values are not allowed with OSDK types, but leaving here as an override.\n return value;\n }\n\n // arrays and sets are both sent over the wire as arrays\n if (Array.isArray(value) || value instanceof Set) {\n const values = Array.from(value);\n if (\n values.some((dataValue) =>\n isAttachmentUpload(dataValue) || isAttachmentFile(dataValue)\n )\n ) {\n const converted = [];\n for (const value of values) {\n converted.push(await toDataValue(value, client, actionMetadata));\n }\n return converted;\n }\n const promiseArray = Array.from(\n value,\n async (innerValue) =>\n await toDataValue(innerValue, client, actionMetadata),\n );\n return Promise.all(promiseArray);\n }\n\n // For uploads, we need to upload ourselves first to get the RID of the attachment\n if (isAttachmentUpload(value)) {\n const attachment = await OntologiesV2.Attachments.upload(\n client,\n value.data,\n {\n filename: value.name,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n if (isAttachmentFile(value)) {\n const attachment = await OntologiesV2.Attachments.upload(\n client,\n value,\n {\n filename: value.name as string,\n },\n );\n return await toDataValue(attachment.rid, client, actionMetadata);\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return await toDataValue(value.__primaryKey, client, actionMetadata);\n }\n\n if (isObjectSpecifiersObject(value)) {\n return await toDataValue(value.$primaryKey, client, actionMetadata);\n }\n\n if (isPoint(value)) {\n return await toDataValue(\n `${value.coordinates[1]},${value.coordinates[0]}`,\n client,\n actionMetadata,\n );\n }\n\n // object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)\n if (isWireObjectSet(value)) {\n return value;\n }\n if (isObjectSet(value)) {\n return getWireObjectSet(value);\n }\n\n if (isMediaReference(value)) {\n return value;\n }\n\n if (isInterfaceActionParam(value)) {\n return {\n objectTypeApiName: value.$objectType,\n primaryKeyValue: value.$primaryKey,\n };\n }\n\n // TODO (during queries implementation)\n // two dimensional aggregation\n // three dimensional aggregation\n\n // struct\n if (typeof value === \"object\") {\n return Object.entries(value).reduce(\n async (promisedAcc, [key, structValue]) => {\n const acc = await promisedAcc;\n acc[key] = await toDataValue(structValue, client, actionMetadata);\n return acc;\n },\n Promise.resolve({} as { [key: string]: DataValue }),\n );\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp, object type reference\n return value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,KAAKA,YAAY,M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AAC,EAAE;IAC3B,OAAOA,KAAK;EACd;EAEA,IAAIN,sBAAsB,CAACM,KAAK,CAAC,EAAE;IACjC,OAAO;MACL0B,iBAAiB,EAAE1B,KAAK,CAAC2B,WAAW;MACpCC,eAAe,EAAE5B,KAAK,CAACwB;IACzB,CAAC;EACH;;EAEA;EACA;EACA;;EAEA;EACA,IAAI,OAAOxB,KAAK,KAAK,QAAQ,EAAE;IAC7B,OAAO6B,MAAM,CAACC,OAAO,CAAC9B,KAAK,CAAC,CAAC+B,MAAM,CACjC,OAAOC,WAAW,EAAE,CAACC,GAAG,EAAEC,WAAW,CAAC,KAAK;MACzC,MAAMC,GAAG,GAAG,MAAMH,WAAW;MAC7BG,GAAG,CAACF,GAAG,CAAC,GAAG,MAAMlC,WAAW,CAACmC,WAAW,EAAEjC,MAAM,EAAEC,cAAc,CAAC;MACjE,OAAOiC,GAAG;IACZ,CAAC,EACDrB,OAAO,CAACsB,OAAO,CAAC,CAAC,CAAiC,CACpD,CAAC;EACH;;EAEA;EACA,OAAOpC,KAAK;AACd","ignoreList":[]}
@@ -14,28 +14,25 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { NULL_VALUE } from "@osdk/api";
18
17
  import { Employee, Task } from "@osdk/client.test.ontology";
19
- import { LegacyFauxFoundry, MockOntologiesV2, startNodeApiServer, stubData } from "@osdk/shared.test";
18
+ import { LegacyFauxFoundry, startNodeApiServer, stubData } from "@osdk/shared.test";
20
19
  import { beforeAll, describe, expect, it, vi } from "vitest";
21
20
  import { createClient } from "../createClient.js";
22
21
  import { createMinimalClient } from "../createMinimalClient.js";
23
22
  import { createAttachmentUpload } from "../object/AttachmentUpload.js";
24
- import { isMediaReference } from "../object/mediaUpload.js";
25
23
  import { getWireObjectSet } from "../objectSet/createObjectSet.js";
26
24
  import { toDataValue } from "./toDataValue.js";
27
25
  describe(toDataValue, () => {
28
26
  let client;
29
27
  let clientCtx;
30
28
  let mockActionMetadata;
31
- let apiServer;
32
29
  vi.fn();
33
30
  beforeAll(() => {
34
31
  const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);
35
32
  ({
36
33
  client
37
34
  } = testSetup);
38
- apiServer = testSetup.apiServer;
35
+ testSetup.apiServer;
39
36
  clientCtx = createMinimalClient({
40
37
  ontologyRid: testSetup.fauxFoundry.defaultOntologyRid
41
38
  }, testSetup.fauxFoundry.baseUrl, testSetup.auth, {});
@@ -143,35 +140,6 @@ describe(toDataValue, () => {
143
140
  const converted = await toDataValue(file, clientCtx, mockActionMetadata);
144
141
  expect(converted).toMatch(/ri\.attachments.main.attachment\.[a-z0-9\-]+/i);
145
142
  });
146
- it("converts media uploads correctly", async () => {
147
- const file = {
148
- data: new Blob([JSON.stringify({
149
- name: "Hello World"
150
- }, null, 2)], {
151
- type: "application/json"
152
- }),
153
- path: "file.txt"
154
- };
155
-
156
- // TODO: Mock MediaUpload properly in FauxFoundry
157
- apiServer.boundary(async () => {
158
- apiServer.use(MockOntologiesV2.MediaReferenceProperties.uploadMedia("https://stack.palantir.com", () => {
159
- return {
160
- mimeType: "application/json",
161
- reference: {
162
- type: "mediaSetViewItem",
163
- mediaSetViewItem: {
164
- mediaItemRid: "media-item-rid",
165
- mediaSetRid: "media-set-rid",
166
- mediaSetViewRid: "media-set-view-rid"
167
- }
168
- }
169
- };
170
- }));
171
- const converted = await toDataValue(file, clientCtx, mockActionMetadata);
172
- expect(isMediaReference(converted)).toBe(true);
173
- });
174
- });
175
143
  it("converts media reference correctly", async () => {
176
144
  const mediaReference = {
177
145
  mimeType: "application/json",
@@ -187,13 +155,5 @@ describe(toDataValue, () => {
187
155
  const converted = await toDataValue(mediaReference, clientCtx, mockActionMetadata);
188
156
  expect(converted).toEqual(mediaReference);
189
157
  });
190
- it("Converts NULL_VALUE to null", async () => {
191
- const converted = await toDataValue(NULL_VALUE, clientCtx, mockActionMetadata);
192
- expect(converted).toBeNull();
193
- });
194
- it("Converts NULL_VALUE equivalents to null", async () => {
195
- const converted = await toDataValue(Symbol.for("NULL_VALUE"), clientCtx, mockActionMetadata);
196
- expect(converted).toEqual(null);
197
- });
198
158
  });
199
159
  //# sourceMappingURL=toDataValue.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"toDataValue.test.js","names":["NULL_VALUE","Employee","Task","LegacyFauxFoundry","MockOntologiesV2","startNodeApiServer","stubData","beforeAll","describe","expect","it","vi","createClient","createMinimalClient","createAttachmentUpload","isMediaReference","getWireObjectSet","toDataValue","client","clientCtx","mockActionMetadata","apiServer","fn","testSetup","ontologyRid","fauxFoundry","defaultOntologyRid","baseUrl","auth","apiName","close","basic","null","undefined","boolean","date","integer","string","timestamp","convertedBasic","toEqual","attachment","attachmentArray","attachmentSet","Set","recursiveConversion","inner","employee","employee1","ontologyConversion","__primaryKey","task","fetchOne","$primaryKey","clientObjectSet","where","id","definition","expected","objectSetConversion","toMatchInlineSnapshot","definitionConversion","blob","Blob","JSON","stringify","attachmentUpload","converted","toMatch","file","Object","assign","name","type","data","path","boundary","use","MediaReferenceProperties","uploadMedia","mimeType","reference","mediaSetViewItem","mediaItemRid","mediaSetRid","mediaSetViewRid","toBe","mediaReference","toBeNull","Symbol","for"],"sources":["toDataValue.test.ts"],"sourcesContent":["/*\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 { NULL_VALUE } from \"@osdk/api\";\nimport type { ActionMetadata, MediaUpload } from \"@osdk/api\";\nimport { Employee, Task } from \"@osdk/client.test.ontology\";\nimport type { MediaReference } from \"@osdk/foundry.core\";\nimport type { SetupServer } from \"@osdk/shared.test\";\nimport {\n LegacyFauxFoundry,\n MockOntologiesV2,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport type { MockedFunction } from \"vitest\";\nimport { beforeAll, describe, expect, it, vi } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { isMediaReference } from \"../object/mediaUpload.js\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { toDataValue } from \"./toDataValue.js\";\n\ndescribe(toDataValue, () => {\n let client: Client;\n let clientCtx: MinimalClient;\n let mockActionMetadata: ActionMetadata;\n let apiServer: SetupServer;\n\n const mockFetch: MockedFunction<typeof globalThis.fetch> = vi.fn();\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n\n apiServer = testSetup.apiServer;\n\n clientCtx = createMinimalClient(\n { ontologyRid: testSetup.fauxFoundry.defaultOntologyRid },\n testSetup.fauxFoundry.baseUrl,\n testSetup.auth,\n {},\n );\n\n // toDataValue only needs the apiName right now, update this if that changes\n const fakeActionMetadata = {\n apiName: \"createUnstructuredImageExampleObject\",\n };\n mockActionMetadata = fakeActionMetadata as ActionMetadata;\n\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"converts passthrough values correctly\", async () => {\n // basic pass through types\n const basic = {\n null: undefined,\n boolean: false,\n date: \"2024-01-01\",\n integer: 0,\n string: \"string\",\n timestamp: \"2024-01-01T00:00:00Z\",\n };\n const convertedBasic = await toDataValue(\n basic,\n clientCtx,\n mockActionMetadata,\n );\n expect(convertedBasic).toEqual(basic);\n });\n\n it(\"recursively converts arrays and sets into array types\", async () => {\n const attachment = \"rid\";\n const attachmentArray = [attachment];\n const attachmentSet = new Set(attachmentArray);\n\n const recursiveConversion = await toDataValue(\n {\n attachment,\n attachmentArray,\n attachmentSet,\n },\n clientCtx,\n mockActionMetadata,\n );\n\n expect(recursiveConversion).toEqual({\n attachment: \"rid\",\n attachmentArray: [\"rid\"],\n attachmentSet: [\"rid\"],\n });\n });\n\n it(\"recursively handles structs\", async () => {\n const struct = {\n inner: {\n attachment: \"rid\",\n },\n };\n\n const recursiveConversion = await toDataValue(\n struct,\n clientCtx,\n mockActionMetadata,\n );\n\n expect(recursiveConversion).toEqual({\n inner: { attachment: \"rid\" },\n });\n });\n\n it(\"maps an ontology object into just its primary key\", async () => {\n const employee = stubData.employee1;\n const ontologyConversion = await toDataValue(\n employee,\n clientCtx,\n mockActionMetadata,\n );\n expect(ontologyConversion).toEqual(\n stubData.employee1.__primaryKey,\n );\n });\n\n it(\"maps an ontology object into just its primary key with osdk wrapper\", async () => {\n const task = await client(Employee).fetchOne(50030);\n const ontologyConversion = await toDataValue(\n task,\n clientCtx,\n mockActionMetadata,\n );\n expect(ontologyConversion).toEqual(\n task.$primaryKey,\n );\n });\n\n it(\"passes through object set definitions\", async () => {\n const clientObjectSet = client(Task).where({ id: 0 });\n const definition = getWireObjectSet(clientObjectSet);\n\n const expected = `\n {\n \"objectSet\": {\n \"objectType\": \"Task\",\n \"type\": \"base\",\n },\n \"type\": \"filter\",\n \"where\": {\n \"field\": \"id\",\n \"type\": \"eq\",\n \"value\": 0,\n },\n }\n `;\n const objectSetConversion = await toDataValue(\n clientObjectSet,\n clientCtx,\n mockActionMetadata,\n );\n expect(objectSetConversion).toMatchInlineSnapshot(\n expected,\n );\n\n const definitionConversion = await toDataValue(\n definition,\n clientCtx,\n mockActionMetadata,\n );\n expect(definitionConversion).toMatchInlineSnapshot(expected);\n });\n\n it(\"converts blob attachment uploads correctly\", async () => {\n const blob = new Blob([JSON.stringify({ \"hi\": \"mom\" })]);\n const attachmentUpload = createAttachmentUpload(blob, \"file1.txt\");\n const converted = await toDataValue(\n attachmentUpload,\n clientCtx,\n mockActionMetadata,\n );\n\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts file attachment uploads correctly\", async () => {\n // Mimics the Web file API (https://developer.mozilla.org/en-US/docs/Web/API/File). The File constructor is only available in Node 19.2.0 and above\n const file = Object.assign(\n new Blob([\n JSON.stringify({ name: \"Hello World\" }, null, 2),\n ], {\n type: \"application/json\",\n }),\n { name: \"file1.txt\" },\n );\n\n const converted = await toDataValue(file, clientCtx, mockActionMetadata);\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts media uploads correctly\", async () => {\n const file: MediaUpload = {\n data: new Blob([\n JSON.stringify({ name: \"Hello World\" }, null, 2),\n ], {\n type: \"application/json\",\n }),\n path: \"file.txt\",\n };\n\n // TODO: Mock MediaUpload properly in FauxFoundry\n apiServer.boundary(async () => {\n apiServer.use(\n MockOntologiesV2.MediaReferenceProperties.uploadMedia(\n \"https://stack.palantir.com\",\n () => {\n return {\n mimeType: \"application/json\",\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaItemRid: \"media-item-rid\",\n mediaSetRid: \"media-set-rid\",\n mediaSetViewRid: \"media-set-view-rid\",\n },\n },\n };\n },\n ),\n );\n const converted = await toDataValue(file, clientCtx, mockActionMetadata);\n expect(isMediaReference(converted)).toBe(true);\n });\n });\n\n it(\"converts media reference correctly\", async () => {\n const mediaReference: MediaReference = {\n mimeType: \"application/json\",\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaItemRid: \"media-item-rid\",\n mediaSetRid: \"media-set-rid\",\n mediaSetViewRid: \"media-set-view-rid\",\n },\n },\n };\n\n const converted = await toDataValue(\n mediaReference,\n clientCtx,\n mockActionMetadata,\n );\n expect(converted).toEqual(mediaReference);\n });\n\n it(\"Converts NULL_VALUE to null\", async () => {\n const converted = await toDataValue(\n NULL_VALUE,\n clientCtx,\n mockActionMetadata,\n );\n expect(converted).toBeNull();\n });\n\n it(\"Converts NULL_VALUE equivalents to null\", async () => {\n const clearData = Symbol.for(\"NULL_VALUE\") as symbol & {\n __type: \"NULL_VALUE\";\n };\n const converted = await toDataValue(\n clearData,\n clientCtx,\n mockActionMetadata,\n );\n expect(converted).toEqual(null);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,QAAQ,WAAW;AAEtC,SAASC,QAAQ,EAAEC,IAAI,QAAQ,4BAA4B;AAG3D,SACEC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAE1B,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAE5D,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,QAAQ,2BAA2B;AAE/D,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,gBAAgB,QAAQ,0BAA0B;AAC3D,SAASC,gBAAgB,QAAQ,iCAAiC;AAClE,SAASC,WAAW,QAAQ,kBAAkB;AAE9CT,QAAQ,CAACS,WAAW,EAAE,MAAM;EAC1B,IAAIC,MAAc;EAClB,IAAIC,SAAwB;EAC5B,IAAIC,kBAAkC;EACtC,IAAIC,SAAsB;EAEiCV,EAAE,CAACW,EAAE,CAAC,CAAC;EAElEf,SAAS,CAAC,MAAM;IACd,MAAMgB,SAAS,GAAGlB,kBAAkB,CAAC,IAAIF,iBAAiB,CAAC,CAAC,EAAES,YAAY,CAAC;IAC3E,CAAC;MAAEM;IAAO,CAAC,GAAGK,SAAS;IAEvBF,SAAS,GAAGE,SAAS,CAACF,SAAS;IAE/BF,SAAS,GAAGN,mBAAmB,CAC7B;MAAEW,WAAW,EAAED,SAAS,CAACE,WAAW,CAACC;IAAmB,CAAC,EACzDH,SAAS,CAACE,WAAW,CAACE,OAAO,EAC7BJ,SAAS,CAACK,IAAI,EACd,CAAC,CACH,C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AAC,CAAC;EAC9B,CAAC,CAAC;EAEF9E,EAAE,CAAC,yCAAyC,EAAE,YAAY;IAIxD,MAAMyD,SAAS,GAAG,MAAMlD,WAAW,CAHjBwE,MAAM,CAACC,GAAG,CAAC,YAAY,CAAC,EAKxCvE,SAAS,EACTC,kBACF,CAAC;IACDX,MAAM,CAAC0D,SAAS,CAAC,CAAC3B,OAAO,CAAC,IAAI,CAAC;EACjC,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"toDataValue.test.js","names":["Employee","Task","LegacyFauxFoundry","startNodeApiServer","stubData","beforeAll","describe","expect","it","vi","createClient","createMinimalClient","createAttachmentUpload","getWireObjectSet","toDataValue","client","clientCtx","mockActionMetadata","fn","testSetup","apiServer","ontologyRid","fauxFoundry","defaultOntologyRid","baseUrl","auth","apiName","close","basic","null","undefined","boolean","date","integer","string","timestamp","convertedBasic","toEqual","attachment","attachmentArray","attachmentSet","Set","recursiveConversion","inner","employee","employee1","ontologyConversion","__primaryKey","task","fetchOne","$primaryKey","clientObjectSet","where","id","definition","expected","objectSetConversion","toMatchInlineSnapshot","definitionConversion","blob","Blob","JSON","stringify","attachmentUpload","converted","toMatch","file","Object","assign","name","type","mediaReference","mimeType","reference","mediaSetViewItem","mediaItemRid","mediaSetRid","mediaSetViewRid"],"sources":["toDataValue.test.ts"],"sourcesContent":["/*\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 type { ActionMetadata } from \"@osdk/api\";\nimport { Employee, Task } from \"@osdk/client.test.ontology\";\nimport type { MediaReference } from \"@osdk/foundry.core\";\nimport type { SetupServer } from \"@osdk/shared.test\";\nimport {\n LegacyFauxFoundry,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport type { MockedFunction } from \"vitest\";\nimport { beforeAll, describe, expect, it, vi } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { toDataValue } from \"./toDataValue.js\";\n\ndescribe(toDataValue, () => {\n let client: Client;\n let clientCtx: MinimalClient;\n let mockActionMetadata: ActionMetadata;\n let apiServer: SetupServer;\n\n const mockFetch: MockedFunction<typeof globalThis.fetch> = vi.fn();\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n\n apiServer = testSetup.apiServer;\n\n clientCtx = createMinimalClient(\n { ontologyRid: testSetup.fauxFoundry.defaultOntologyRid },\n testSetup.fauxFoundry.baseUrl,\n testSetup.auth,\n {},\n );\n\n // toDataValue only needs the apiName right now, update this if that changes\n const fakeActionMetadata = {\n apiName: \"createUnstructuredImageExampleObject\",\n };\n mockActionMetadata = fakeActionMetadata as ActionMetadata;\n\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"converts passthrough values correctly\", async () => {\n // basic pass through types\n const basic = {\n null: undefined,\n boolean: false,\n date: \"2024-01-01\",\n integer: 0,\n string: \"string\",\n timestamp: \"2024-01-01T00:00:00Z\",\n };\n const convertedBasic = await toDataValue(\n basic,\n clientCtx,\n mockActionMetadata,\n );\n expect(convertedBasic).toEqual(basic);\n });\n\n it(\"recursively converts arrays and sets into array types\", async () => {\n const attachment = \"rid\";\n const attachmentArray = [attachment];\n const attachmentSet = new Set(attachmentArray);\n\n const recursiveConversion = await toDataValue(\n {\n attachment,\n attachmentArray,\n attachmentSet,\n },\n clientCtx,\n mockActionMetadata,\n );\n\n expect(recursiveConversion).toEqual({\n attachment: \"rid\",\n attachmentArray: [\"rid\"],\n attachmentSet: [\"rid\"],\n });\n });\n\n it(\"recursively handles structs\", async () => {\n const struct = {\n inner: {\n attachment: \"rid\",\n },\n };\n\n const recursiveConversion = await toDataValue(\n struct,\n clientCtx,\n mockActionMetadata,\n );\n\n expect(recursiveConversion).toEqual({\n inner: { attachment: \"rid\" },\n });\n });\n\n it(\"maps an ontology object into just its primary key\", async () => {\n const employee = stubData.employee1;\n const ontologyConversion = await toDataValue(\n employee,\n clientCtx,\n mockActionMetadata,\n );\n expect(ontologyConversion).toEqual(\n stubData.employee1.__primaryKey,\n );\n });\n\n it(\"maps an ontology object into just its primary key with osdk wrapper\", async () => {\n const task = await client(Employee).fetchOne(50030);\n const ontologyConversion = await toDataValue(\n task,\n clientCtx,\n mockActionMetadata,\n );\n expect(ontologyConversion).toEqual(\n task.$primaryKey,\n );\n });\n\n it(\"passes through object set definitions\", async () => {\n const clientObjectSet = client(Task).where({ id: 0 });\n const definition = getWireObjectSet(clientObjectSet);\n\n const expected = `\n {\n \"objectSet\": {\n \"objectType\": \"Task\",\n \"type\": \"base\",\n },\n \"type\": \"filter\",\n \"where\": {\n \"field\": \"id\",\n \"type\": \"eq\",\n \"value\": 0,\n },\n }\n `;\n const objectSetConversion = await toDataValue(\n clientObjectSet,\n clientCtx,\n mockActionMetadata,\n );\n expect(objectSetConversion).toMatchInlineSnapshot(\n expected,\n );\n\n const definitionConversion = await toDataValue(\n definition,\n clientCtx,\n mockActionMetadata,\n );\n expect(definitionConversion).toMatchInlineSnapshot(expected);\n });\n\n it(\"converts blob attachment uploads correctly\", async () => {\n const blob = new Blob([JSON.stringify({ \"hi\": \"mom\" })]);\n const attachmentUpload = createAttachmentUpload(blob, \"file1.txt\");\n const converted = await toDataValue(\n attachmentUpload,\n clientCtx,\n mockActionMetadata,\n );\n\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts file attachment uploads correctly\", async () => {\n // Mimics the Web file API (https://developer.mozilla.org/en-US/docs/Web/API/File). The File constructor is only available in Node 19.2.0 and above\n const file = Object.assign(\n new Blob([\n JSON.stringify({ name: \"Hello World\" }, null, 2),\n ], {\n type: \"application/json\",\n }),\n { name: \"file1.txt\" },\n );\n\n const converted = await toDataValue(file, clientCtx, mockActionMetadata);\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts media reference correctly\", async () => {\n const mediaReference: MediaReference = {\n mimeType: \"application/json\",\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaItemRid: \"media-item-rid\",\n mediaSetRid: \"media-set-rid\",\n mediaSetViewRid: \"media-set-view-rid\",\n },\n },\n };\n\n const converted = await toDataValue(\n mediaReference,\n clientCtx,\n mockActionMetadata,\n );\n expect(converted).toEqual(mediaReference);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,EAAEC,IAAI,QAAQ,4BAA4B;AAG3D,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAE1B,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAE5D,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,QAAQ,2BAA2B;AAE/D,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,gBAAgB,QAAQ,iCAAiC;AAClE,SAASC,WAAW,QAAQ,kBAAkB;AAE9CR,QAAQ,CAACQ,WAAW,EAAE,MAAM;EAC1B,IAAIC,MAAc;EAClB,IAAIC,SAAwB;EAC5B,IAAIC,kBAAkC;EAGqBR,EAAE,CAACS,EAAE,CAAC,CAAC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IAAI,EAAElD,SAAS,EAAEC,kBAAkB,CAAC;IACxEV,MAAM,CAACyD,SAAS,CAAC,CAACC,OAAO,CAAC,+CAA+C,CAAC;EAC5E,CAAC,CAAC;EAEFzD,EAAE,CAAC,oCAAoC,EAAE,YAAY;IACnD,MAAM+D,cAA8B,GAAG;MACrCC,QAAQ,EAAE,kBAAkB;MAC5BC,SAAS,EAAE;QACTH,IAAI,EAAE,kBAAkB;QACxBI,gBAAgB,EAAE;UAChBC,YAAY,EAAE,gBAAgB;UAC9BC,WAAW,EAAE,eAAe;UAC5BC,eAAe,EAAE;QACnB;MACF;IACF,CAAC;IAED,MAAMb,SAAS,GAAG,MAAMlD,WAAW,CACjCyD,cAAc,EACdvD,SAAS,EACTC,kBACF,CAAC;IACDV,MAAM,CAACyD,SAAS,CAAC,CAAC3B,OAAO,CAACkC,cAAc,CAAC;EAC3C,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -17,6 +17,7 @@
17
17
  import * as OntologiesV2 from "@osdk/foundry.ontologies";
18
18
  import { isAttachmentFile, isAttachmentUpload } from "../object/AttachmentUpload.js";
19
19
  import { getWireObjectSet, isObjectSet } from "../objectSet/createObjectSet.js";
20
+ import { isInterfaceQueryParam, isInterfaceSpecifier } from "./interfaceUtils.js";
20
21
  import { isObjectSpecifiersObject } from "./isObjectSpecifiersObject.js";
21
22
  import { extractPrimaryKeyFromObjectSpecifier } from "./objectSpecifierUtils.js";
22
23
  import { isWireObjectSet } from "./WireObjectSet.js";
@@ -89,7 +90,17 @@ export async function toDataValueQueries(value, client, desiredType) {
89
90
  }
90
91
  break;
91
92
  }
93
+ case "interface":
94
+ {
95
+ if (isInterfaceSpecifier(value) || isInterfaceQueryParam(value)) {
96
+ return {
97
+ objectTypeApiName: value.$objectType,
98
+ primaryKeyValue: value.$primaryKey
99
+ };
100
+ }
101
+ }
92
102
  case "objectSet":
103
+ case "interfaceObjectSet":
93
104
  {
94
105
  // object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)
95
106
  if (isWireObjectSet(value)) {