@osdk/client 2.8.0-beta.1 → 2.8.0-beta.10

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 (291) hide show
  1. package/CHANGELOG.md +108 -0
  2. package/build/browser/Client.js +1 -1
  3. package/build/browser/Client.js.map +1 -1
  4. package/build/browser/actions/applyAction.js +2 -1
  5. package/build/browser/actions/applyAction.js.map +1 -1
  6. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +101 -0
  7. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  8. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +1 -1
  9. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -1
  10. package/build/browser/internal/conversions/modernToLegacyWhereClause.js +1 -1
  11. package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  12. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +2 -2
  13. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  14. package/build/browser/objectSet/createObjectSet.js +0 -4
  15. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  16. package/build/browser/observable/ObservableClient/ObserveLink.js.map +1 -1
  17. package/build/browser/observable/ObservableClient.js +11 -0
  18. package/build/browser/observable/ObservableClient.js.map +1 -1
  19. package/build/browser/observable/internal/AbstractHelper.js +56 -3
  20. package/build/browser/observable/internal/AbstractHelper.js.map +1 -1
  21. package/build/browser/observable/internal/AbstractHelper.test.js +114 -0
  22. package/build/browser/observable/internal/AbstractHelper.test.js.map +1 -0
  23. package/build/browser/observable/internal/BulkObjectLoader.js +71 -9
  24. package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -1
  25. package/build/browser/observable/internal/BulkObjectLoader.test.js +79 -0
  26. package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -1
  27. package/build/browser/observable/internal/CacheKeys.js +19 -8
  28. package/build/browser/observable/internal/CacheKeys.js.map +1 -1
  29. package/build/browser/observable/internal/ListQueryView.js +120 -0
  30. package/build/browser/observable/internal/ListQueryView.js.map +1 -0
  31. package/build/browser/observable/internal/ObservableClientImpl.js +136 -24
  32. package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
  33. package/build/browser/observable/internal/PivotCanonicalizer.js +4 -4
  34. package/build/browser/observable/internal/PivotCanonicalizer.js.map +1 -1
  35. package/build/browser/observable/internal/Query.js +7 -5
  36. package/build/browser/observable/internal/Query.js.map +1 -1
  37. package/build/browser/observable/internal/RdpCanonicalizer.test.js +23 -7
  38. package/build/browser/observable/internal/RdpCanonicalizer.test.js.map +1 -1
  39. package/build/browser/observable/internal/Store.js +19 -2
  40. package/build/browser/observable/internal/Store.js.map +1 -1
  41. package/build/browser/observable/internal/Store.test.js +327 -1
  42. package/build/browser/observable/internal/Store.test.js.map +1 -1
  43. package/build/browser/observable/internal/actions/ActionApplication.js +8 -6
  44. package/build/browser/observable/internal/actions/ActionApplication.js.map +1 -1
  45. package/build/browser/observable/internal/aggregation/AggregationCacheKey.js +5 -3
  46. package/build/browser/observable/internal/aggregation/AggregationCacheKey.js.map +1 -1
  47. package/build/browser/observable/internal/aggregation/AggregationQuery.js +28 -2
  48. package/build/browser/observable/internal/aggregation/AggregationQuery.js.map +1 -1
  49. package/build/browser/observable/internal/aggregation/AggregationsHelper.js +18 -2
  50. package/build/browser/observable/internal/aggregation/AggregationsHelper.js.map +1 -1
  51. package/build/browser/observable/internal/aggregation/AggregationsHelper.test.js +103 -0
  52. package/build/browser/observable/internal/aggregation/AggregationsHelper.test.js.map +1 -0
  53. package/build/browser/observable/internal/aggregation/ObjectAggregationQuery.js +22 -3
  54. package/build/browser/observable/internal/aggregation/ObjectAggregationQuery.js.map +1 -1
  55. package/build/browser/observable/internal/base-list/BaseListQuery.js +73 -6
  56. package/build/browser/observable/internal/base-list/BaseListQuery.js.map +1 -1
  57. package/build/browser/observable/internal/function/FunctionQuery.js +27 -1
  58. package/build/browser/observable/internal/function/FunctionQuery.js.map +1 -1
  59. package/build/browser/observable/internal/function/FunctionsHelper.js +2 -1
  60. package/build/browser/observable/internal/function/FunctionsHelper.js.map +1 -1
  61. package/build/browser/observable/internal/getObjectTypesThatInvalidate.js +2 -2
  62. package/build/browser/observable/internal/getObjectTypesThatInvalidate.js.map +1 -1
  63. package/build/browser/observable/internal/links/LinksHelper.js +3 -2
  64. package/build/browser/observable/internal/links/LinksHelper.js.map +1 -1
  65. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js +7 -5
  66. package/build/browser/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  67. package/build/browser/observable/internal/links/SpecificLinkQuery.js +97 -62
  68. package/build/browser/observable/internal/links/SpecificLinkQuery.js.map +1 -1
  69. package/build/browser/observable/internal/list/InterfaceListQuery.js +19 -1
  70. package/build/browser/observable/internal/list/InterfaceListQuery.js.map +1 -1
  71. package/build/browser/observable/internal/list/ListQuery.js +30 -10
  72. package/build/browser/observable/internal/list/ListQuery.js.map +1 -1
  73. package/build/browser/observable/internal/list/ListQuery.test.js +262 -1
  74. package/build/browser/observable/internal/list/ListQuery.test.js.map +1 -1
  75. package/build/browser/observable/internal/list/ListsHelper.js +1 -1
  76. package/build/browser/observable/internal/list/ListsHelper.js.map +1 -1
  77. package/build/browser/observable/internal/list/ObjectListQuery.js +22 -21
  78. package/build/browser/observable/internal/list/ObjectListQuery.js.map +1 -1
  79. package/build/browser/observable/internal/object/ObjectQuery.js +23 -6
  80. package/build/browser/observable/internal/object/ObjectQuery.js.map +1 -1
  81. package/build/browser/observable/internal/object/ObjectsHelper.js +12 -3
  82. package/build/browser/observable/internal/object/ObjectsHelper.js.map +1 -1
  83. package/build/browser/observable/internal/object/ObjectsHelper.test.js +200 -0
  84. package/build/browser/observable/internal/object/ObjectsHelper.test.js.map +1 -0
  85. package/build/browser/observable/internal/objectset/ObjectSetCacheKey.js.map +1 -1
  86. package/build/browser/observable/internal/objectset/ObjectSetHelper.js +3 -2
  87. package/build/browser/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
  88. package/build/browser/observable/internal/objectset/ObjectSetHelper.test.js +94 -0
  89. package/build/browser/observable/internal/objectset/ObjectSetHelper.test.js.map +1 -0
  90. package/build/browser/observable/internal/objectset/ObjectSetQuery.js +4 -1
  91. package/build/browser/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
  92. package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -0
  93. package/build/browser/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
  94. package/build/browser/observable/internal/testUtils.js.map +1 -1
  95. package/build/browser/observable/internal/utils/rdpFieldOperations.js +7 -2
  96. package/build/browser/observable/internal/utils/rdpFieldOperations.js.map +1 -1
  97. package/build/browser/observable/internal/utils/rdpFieldOperations.test.js +55 -0
  98. package/build/browser/observable/internal/utils/rdpFieldOperations.test.js.map +1 -1
  99. package/build/browser/public/unstable-do-not-use.js +1 -0
  100. package/build/browser/public/unstable-do-not-use.js.map +1 -1
  101. package/build/browser/util/UserAgent.js +2 -2
  102. package/build/browser/util/UserAgent.js.map +1 -1
  103. package/build/browser/util/interfaceUtils.js +7 -0
  104. package/build/browser/util/interfaceUtils.js.map +1 -1
  105. package/build/cjs/{chunk-7543GRIE.cjs → chunk-6VOFZIIJ.cjs} +79 -69
  106. package/build/cjs/chunk-6VOFZIIJ.cjs.map +1 -0
  107. package/build/cjs/{chunk-VVKEXIIO.cjs → chunk-YVZM2JPW.cjs} +164 -155
  108. package/build/cjs/chunk-YVZM2JPW.cjs.map +1 -0
  109. package/build/cjs/index.cjs +8 -8
  110. package/build/cjs/public/internal.cjs +8 -8
  111. package/build/cjs/public/unstable-do-not-use.cjs +928 -361
  112. package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
  113. package/build/cjs/public/unstable-do-not-use.d.cts +64 -26
  114. package/build/esm/Client.js +1 -1
  115. package/build/esm/Client.js.map +1 -1
  116. package/build/esm/actions/applyAction.js +2 -1
  117. package/build/esm/actions/applyAction.js.map +1 -1
  118. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +101 -0
  119. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  120. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +1 -1
  121. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -1
  122. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +1 -1
  123. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  124. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +2 -2
  125. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  126. package/build/esm/objectSet/createObjectSet.js +0 -4
  127. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  128. package/build/esm/observable/ObservableClient/ObserveLink.js.map +1 -1
  129. package/build/esm/observable/ObservableClient.js +11 -0
  130. package/build/esm/observable/ObservableClient.js.map +1 -1
  131. package/build/esm/observable/internal/AbstractHelper.js +56 -3
  132. package/build/esm/observable/internal/AbstractHelper.js.map +1 -1
  133. package/build/esm/observable/internal/AbstractHelper.test.js +114 -0
  134. package/build/esm/observable/internal/AbstractHelper.test.js.map +1 -0
  135. package/build/esm/observable/internal/BulkObjectLoader.js +71 -9
  136. package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -1
  137. package/build/esm/observable/internal/BulkObjectLoader.test.js +79 -0
  138. package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -1
  139. package/build/esm/observable/internal/CacheKeys.js +19 -8
  140. package/build/esm/observable/internal/CacheKeys.js.map +1 -1
  141. package/build/esm/observable/internal/ListQueryView.js +120 -0
  142. package/build/esm/observable/internal/ListQueryView.js.map +1 -0
  143. package/build/esm/observable/internal/ObservableClientImpl.js +136 -24
  144. package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
  145. package/build/esm/observable/internal/PivotCanonicalizer.js +4 -4
  146. package/build/esm/observable/internal/PivotCanonicalizer.js.map +1 -1
  147. package/build/esm/observable/internal/Query.js +7 -5
  148. package/build/esm/observable/internal/Query.js.map +1 -1
  149. package/build/esm/observable/internal/RdpCanonicalizer.test.js +23 -7
  150. package/build/esm/observable/internal/RdpCanonicalizer.test.js.map +1 -1
  151. package/build/esm/observable/internal/Store.js +19 -2
  152. package/build/esm/observable/internal/Store.js.map +1 -1
  153. package/build/esm/observable/internal/Store.test.js +327 -1
  154. package/build/esm/observable/internal/Store.test.js.map +1 -1
  155. package/build/esm/observable/internal/actions/ActionApplication.js +8 -6
  156. package/build/esm/observable/internal/actions/ActionApplication.js.map +1 -1
  157. package/build/esm/observable/internal/aggregation/AggregationCacheKey.js +5 -3
  158. package/build/esm/observable/internal/aggregation/AggregationCacheKey.js.map +1 -1
  159. package/build/esm/observable/internal/aggregation/AggregationQuery.js +28 -2
  160. package/build/esm/observable/internal/aggregation/AggregationQuery.js.map +1 -1
  161. package/build/esm/observable/internal/aggregation/AggregationsHelper.js +18 -2
  162. package/build/esm/observable/internal/aggregation/AggregationsHelper.js.map +1 -1
  163. package/build/esm/observable/internal/aggregation/AggregationsHelper.test.js +103 -0
  164. package/build/esm/observable/internal/aggregation/AggregationsHelper.test.js.map +1 -0
  165. package/build/esm/observable/internal/aggregation/ObjectAggregationQuery.js +22 -3
  166. package/build/esm/observable/internal/aggregation/ObjectAggregationQuery.js.map +1 -1
  167. package/build/esm/observable/internal/base-list/BaseListQuery.js +73 -6
  168. package/build/esm/observable/internal/base-list/BaseListQuery.js.map +1 -1
  169. package/build/esm/observable/internal/function/FunctionQuery.js +27 -1
  170. package/build/esm/observable/internal/function/FunctionQuery.js.map +1 -1
  171. package/build/esm/observable/internal/function/FunctionsHelper.js +2 -1
  172. package/build/esm/observable/internal/function/FunctionsHelper.js.map +1 -1
  173. package/build/esm/observable/internal/getObjectTypesThatInvalidate.js +2 -2
  174. package/build/esm/observable/internal/getObjectTypesThatInvalidate.js.map +1 -1
  175. package/build/esm/observable/internal/links/LinksHelper.js +3 -2
  176. package/build/esm/observable/internal/links/LinksHelper.js.map +1 -1
  177. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js +7 -5
  178. package/build/esm/observable/internal/links/SpecificLinkCacheKey.js.map +1 -1
  179. package/build/esm/observable/internal/links/SpecificLinkQuery.js +97 -62
  180. package/build/esm/observable/internal/links/SpecificLinkQuery.js.map +1 -1
  181. package/build/esm/observable/internal/list/InterfaceListQuery.js +19 -1
  182. package/build/esm/observable/internal/list/InterfaceListQuery.js.map +1 -1
  183. package/build/esm/observable/internal/list/ListQuery.js +30 -10
  184. package/build/esm/observable/internal/list/ListQuery.js.map +1 -1
  185. package/build/esm/observable/internal/list/ListQuery.test.js +262 -1
  186. package/build/esm/observable/internal/list/ListQuery.test.js.map +1 -1
  187. package/build/esm/observable/internal/list/ListsHelper.js +1 -1
  188. package/build/esm/observable/internal/list/ListsHelper.js.map +1 -1
  189. package/build/esm/observable/internal/list/ObjectListQuery.js +22 -21
  190. package/build/esm/observable/internal/list/ObjectListQuery.js.map +1 -1
  191. package/build/esm/observable/internal/object/ObjectQuery.js +23 -6
  192. package/build/esm/observable/internal/object/ObjectQuery.js.map +1 -1
  193. package/build/esm/observable/internal/object/ObjectsHelper.js +12 -3
  194. package/build/esm/observable/internal/object/ObjectsHelper.js.map +1 -1
  195. package/build/esm/observable/internal/object/ObjectsHelper.test.js +200 -0
  196. package/build/esm/observable/internal/object/ObjectsHelper.test.js.map +1 -0
  197. package/build/esm/observable/internal/objectset/ObjectSetCacheKey.js.map +1 -1
  198. package/build/esm/observable/internal/objectset/ObjectSetHelper.js +3 -2
  199. package/build/esm/observable/internal/objectset/ObjectSetHelper.js.map +1 -1
  200. package/build/esm/observable/internal/objectset/ObjectSetHelper.test.js +94 -0
  201. package/build/esm/observable/internal/objectset/ObjectSetHelper.test.js.map +1 -0
  202. package/build/esm/observable/internal/objectset/ObjectSetQuery.js +4 -1
  203. package/build/esm/observable/internal/objectset/ObjectSetQuery.js.map +1 -1
  204. package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js +1 -0
  205. package/build/esm/observable/internal/testUtils/observeLink/expectStandardObserveLink.js.map +1 -1
  206. package/build/esm/observable/internal/testUtils.js.map +1 -1
  207. package/build/esm/observable/internal/utils/rdpFieldOperations.js +7 -2
  208. package/build/esm/observable/internal/utils/rdpFieldOperations.js.map +1 -1
  209. package/build/esm/observable/internal/utils/rdpFieldOperations.test.js +55 -0
  210. package/build/esm/observable/internal/utils/rdpFieldOperations.test.js.map +1 -1
  211. package/build/esm/public/unstable-do-not-use.js +1 -0
  212. package/build/esm/public/unstable-do-not-use.js.map +1 -1
  213. package/build/esm/util/UserAgent.js +2 -2
  214. package/build/esm/util/UserAgent.js.map +1 -1
  215. package/build/esm/util/interfaceUtils.js +7 -0
  216. package/build/esm/util/interfaceUtils.js.map +1 -1
  217. package/build/types/Client.d.ts +1 -1
  218. package/build/types/objectSet/createObjectSet.d.ts +5 -1
  219. package/build/types/objectSet/createObjectSet.d.ts.map +1 -1
  220. package/build/types/observable/ObservableClient/ObserveLink.d.ts +2 -1
  221. package/build/types/observable/ObservableClient/ObserveLink.d.ts.map +1 -1
  222. package/build/types/observable/ObservableClient.d.ts +71 -25
  223. package/build/types/observable/ObservableClient.d.ts.map +1 -1
  224. package/build/types/observable/internal/AbstractHelper.d.ts +1 -1
  225. package/build/types/observable/internal/AbstractHelper.d.ts.map +1 -1
  226. package/build/types/observable/internal/AbstractHelper.test.d.ts +1 -0
  227. package/build/types/observable/internal/AbstractHelper.test.d.ts.map +1 -0
  228. package/build/types/observable/internal/BulkObjectLoader.d.ts +2 -1
  229. package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -1
  230. package/build/types/observable/internal/CacheKeys.d.ts +5 -0
  231. package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
  232. package/build/types/observable/internal/ListQueryView.d.ts +21 -0
  233. package/build/types/observable/internal/ListQueryView.d.ts.map +1 -0
  234. package/build/types/observable/internal/PivotCanonicalizer.d.ts +2 -2
  235. package/build/types/observable/internal/PivotCanonicalizer.d.ts.map +1 -1
  236. package/build/types/observable/internal/Query.d.ts.map +1 -1
  237. package/build/types/observable/internal/Store.d.ts.map +1 -1
  238. package/build/types/observable/internal/Store.test.d.ts.map +1 -1
  239. package/build/types/observable/internal/actions/ActionApplication.d.ts.map +1 -1
  240. package/build/types/observable/internal/aggregation/AggregationCacheKey.d.ts +6 -4
  241. package/build/types/observable/internal/aggregation/AggregationCacheKey.d.ts.map +1 -1
  242. package/build/types/observable/internal/aggregation/AggregationQuery.d.ts +8 -3
  243. package/build/types/observable/internal/aggregation/AggregationQuery.d.ts.map +1 -1
  244. package/build/types/observable/internal/aggregation/AggregationsHelper.d.ts +19 -14
  245. package/build/types/observable/internal/aggregation/AggregationsHelper.d.ts.map +1 -1
  246. package/build/types/observable/internal/aggregation/AggregationsHelper.test.d.ts +1 -0
  247. package/build/types/observable/internal/aggregation/AggregationsHelper.test.d.ts.map +1 -0
  248. package/build/types/observable/internal/aggregation/ObjectAggregationQuery.d.ts.map +1 -1
  249. package/build/types/observable/internal/base-list/BaseListQuery.d.ts +47 -2
  250. package/build/types/observable/internal/base-list/BaseListQuery.d.ts.map +1 -1
  251. package/build/types/observable/internal/function/FunctionQuery.d.ts +1 -1
  252. package/build/types/observable/internal/function/FunctionQuery.d.ts.map +1 -1
  253. package/build/types/observable/internal/function/FunctionsHelper.d.ts +1 -0
  254. package/build/types/observable/internal/function/FunctionsHelper.d.ts.map +1 -1
  255. package/build/types/observable/internal/links/LinksHelper.d.ts +5 -5
  256. package/build/types/observable/internal/links/LinksHelper.d.ts.map +1 -1
  257. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts +8 -6
  258. package/build/types/observable/internal/links/SpecificLinkCacheKey.d.ts.map +1 -1
  259. package/build/types/observable/internal/links/SpecificLinkQuery.d.ts +3 -4
  260. package/build/types/observable/internal/links/SpecificLinkQuery.d.ts.map +1 -1
  261. package/build/types/observable/internal/list/InterfaceListQuery.d.ts.map +1 -1
  262. package/build/types/observable/internal/list/ListQuery.d.ts +0 -3
  263. package/build/types/observable/internal/list/ListQuery.d.ts.map +1 -1
  264. package/build/types/observable/internal/list/ListsHelper.d.ts +4 -4
  265. package/build/types/observable/internal/list/ListsHelper.d.ts.map +1 -1
  266. package/build/types/observable/internal/list/ObjectListQuery.d.ts.map +1 -1
  267. package/build/types/observable/internal/object/ObjectQuery.d.ts +2 -1
  268. package/build/types/observable/internal/object/ObjectQuery.d.ts.map +1 -1
  269. package/build/types/observable/internal/object/ObjectsHelper.d.ts +8 -4
  270. package/build/types/observable/internal/object/ObjectsHelper.d.ts.map +1 -1
  271. package/build/types/observable/internal/object/ObjectsHelper.test.d.ts +1 -0
  272. package/build/types/observable/internal/object/ObjectsHelper.test.d.ts.map +1 -0
  273. package/build/types/observable/internal/objectset/ObjectSetCacheKey.d.ts +2 -1
  274. package/build/types/observable/internal/objectset/ObjectSetCacheKey.d.ts.map +1 -1
  275. package/build/types/observable/internal/objectset/ObjectSetHelper.d.ts +3 -1
  276. package/build/types/observable/internal/objectset/ObjectSetHelper.d.ts.map +1 -1
  277. package/build/types/observable/internal/objectset/ObjectSetHelper.test.d.ts +1 -0
  278. package/build/types/observable/internal/objectset/ObjectSetHelper.test.d.ts.map +1 -0
  279. package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts +2 -0
  280. package/build/types/observable/internal/objectset/ObjectSetQuery.d.ts.map +1 -1
  281. package/build/types/observable/internal/testUtils.d.ts +2 -2
  282. package/build/types/observable/internal/testUtils.d.ts.map +1 -1
  283. package/build/types/public/unstable-do-not-use.d.ts +1 -0
  284. package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
  285. package/build/types/util/interfaceUtils.d.ts +2 -1
  286. package/build/types/util/interfaceUtils.d.ts.map +1 -1
  287. package/package.json +12 -12
  288. package/build/cjs/chunk-7543GRIE.cjs.map +0 -1
  289. package/build/cjs/chunk-VVKEXIIO.cjs.map +0 -1
  290. package/build/cjs/delay-W2TSML2P.cjs +0 -75
  291. package/build/cjs/delay-W2TSML2P.cjs.map +0 -1
@@ -1,13 +1,17 @@
1
- import { ObjectOrInterfaceDefinition, PropertyKeys, Augment, ObjectTypeDefinition, InterfaceDefinition, WirePropertyTypes, WhereClause, DerivedProperty, ObjectSet, LinkNames, BaseObjectSet, CompileTimeMetadata, PrimaryKeyType, Osdk, SimplePropertyDef, AggregateOpts, AggregationsResults, QueryDefinition, ActionDefinition, ActionEditResponse, ActionValidationResponse } from '@osdk/api';
1
+ import { ObjectOrInterfaceDefinition, PropertyKeys, Augment, ObjectSet, ObjectTypeDefinition, InterfaceDefinition, WirePropertyTypes, WhereClause, DerivedProperty, LinkNames, BaseObjectSet, CompileTimeMetadata, PrimaryKeyType, Osdk, SimplePropertyDef, AggregateOpts, AggregationsResults, QueryDefinition, ActionDefinition, ActionEditResponse, ActionValidationResponse } from '@osdk/api';
2
+ import { MinimalObjectSet } from '@osdk/api/unstable';
3
+ import { ObjectSet as ObjectSet$1 } from '@osdk/foundry.ontologies';
2
4
  import { C as Client, Q as QueryReturnType, A as ActionSignatureFromDef } from '../Client-Cmx6x_V1.cjs';
3
5
  export { a as QueryParameterType } from '../Client-Cmx6x_V1.cjs';
4
6
  export { a as createClientWithTransaction } from '../createClient-BPK4om7e.cjs';
5
7
  import '@osdk/shared.client';
6
- import '@osdk/api/unstable';
7
8
  import '@osdk/shared.client2';
8
9
 
9
10
  declare function augment<Q extends ObjectOrInterfaceDefinition, T extends PropertyKeys<Q>>(type: Q, ...properties: T[]): Augment<Q, T>;
10
11
 
12
+ declare function isObjectSet(o: object): o is ObjectSet<ObjectOrInterfaceDefinition>;
13
+ declare function getWireObjectSet(objectSet: ObjectSet<any> | MinimalObjectSet<any>): ObjectSet$1;
14
+
11
15
  /**
12
16
  * Represents the current state of an observation.
13
17
  *
@@ -130,6 +134,7 @@ interface Unsubscribable$1 {
130
134
  declare namespace ObserveLinks {
131
135
  interface Options<Q extends ObjectTypeDefinition | InterfaceDefinition, L extends keyof CompileTimeMetadata<Q>["links"] & string> extends CommonObserveOptions, ObserveOptions {
132
136
  srcType: Pick<Q, "type" | "apiName">;
137
+ sourceUnderlyingObjectType: string;
133
138
  pk: PrimaryKeyType<Q>;
134
139
  linkName: L;
135
140
  where?: WhereClause<CompileTimeMetadata<Q>["links"][L]["targetType"]>;
@@ -148,7 +153,7 @@ declare namespace ObserveLinks {
148
153
  }
149
154
  }
150
155
  interface ObserveLinks {
151
- observeLinks<T extends ObjectTypeDefinition | InterfaceDefinition, L extends keyof CompileTimeMetadata<T>["links"] & string>(objects: Osdk.Instance<T> | ReadonlyArray<Osdk.Instance<T>>, linkName: L, options: Omit<ObserveLinks.Options<T, L>, "srcType" | "pk">, subFn: Observer<ObserveLinks.CallbackArgs<CompileTimeMetadata<T>["links"][L]["targetType"]>>): Unsubscribable$1;
156
+ observeLinks<T extends ObjectTypeDefinition | InterfaceDefinition, L extends keyof CompileTimeMetadata<T>["links"] & string>(objects: Osdk.Instance<T> | ReadonlyArray<Osdk.Instance<T>>, linkName: L, options: Omit<ObserveLinks.Options<T, L>, "srcType" | "pk" | "sourceUnderlyingObjectType">, subFn: Observer<ObserveLinks.CallbackArgs<CompileTimeMetadata<T>["links"][L]["targetType"]>>): Unsubscribable$1;
152
157
  }
153
158
 
154
159
  interface OptimisticBuilder {
@@ -157,7 +162,7 @@ interface OptimisticBuilder {
157
162
  deleteObject: <T extends ObjectTypeDefinition>(value: Osdk.Instance<T>) => this;
158
163
  }
159
164
 
160
- type OrderBy<Q extends ObjectTypeDefinition | InterfaceDefinition> = {
165
+ type OrderBy<Q extends ObjectOrInterfaceDefinition> = {
161
166
  [K in PropertyKeys<Q>]?: "asc" | "desc" | undefined;
162
167
  };
163
168
  interface ObserveListOptions<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> extends CommonObserveOptions, ObserveOptions {
@@ -208,13 +213,13 @@ interface ObserveListOptions<Q extends ObjectOrInterfaceDefinition, RDPs extends
208
213
  }>;
209
214
  pivotTo?: string;
210
215
  }
211
- interface ObserveObjectCallbackArgs<T extends ObjectTypeDefinition> {
216
+ interface ObserveObjectCallbackArgs<T extends ObjectOrInterfaceDefinition> {
212
217
  object: Osdk.Instance<T> | undefined;
213
218
  isOptimistic: boolean;
214
219
  status: Status;
215
220
  lastUpdated: number;
216
221
  }
217
- interface ObserveObjectsCallbackArgs<T extends ObjectTypeDefinition | InterfaceDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}> {
222
+ interface ObserveObjectsCallbackArgs<T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}> {
218
223
  resolvedList: Array<Osdk.Instance<T, "$allBaseProperties", PropertyKeys<T>, RDPs>>;
219
224
  isOptimistic: boolean;
220
225
  lastUpdated: number;
@@ -223,7 +228,7 @@ interface ObserveObjectsCallbackArgs<T extends ObjectTypeDefinition | InterfaceD
223
228
  status: Status;
224
229
  totalCount?: string;
225
230
  }
226
- interface ObserveObjectSetArgs<T extends ObjectTypeDefinition | InterfaceDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}> {
231
+ interface ObserveObjectSetArgs<T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}> {
227
232
  resolvedList: Array<Osdk.Instance<T, "$allBaseProperties", PropertyKeys<T>, RDPs>>;
228
233
  isOptimistic: boolean;
229
234
  lastUpdated: number;
@@ -233,7 +238,7 @@ interface ObserveObjectSetArgs<T extends ObjectTypeDefinition | InterfaceDefinit
233
238
  objectSet: ObjectSet<T, RDPs>;
234
239
  totalCount?: string;
235
240
  }
236
- interface ObserveAggregationOptions<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}> extends CommonObserveOptions, ObserveOptions {
241
+ interface ObserveAggregationBaseOptions<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}> extends CommonObserveOptions, ObserveOptions {
237
242
  type: T;
238
243
  where?: WhereClause<T, RDPs>;
239
244
  withProperties?: DerivedProperty.Clause<T>;
@@ -242,6 +247,21 @@ interface ObserveAggregationOptions<T extends ObjectOrInterfaceDefinition, A ext
242
247
  }>;
243
248
  aggregate: A;
244
249
  }
250
+ /**
251
+ * Options for observeAggregation without an ObjectSet (synchronous).
252
+ */
253
+ interface ObserveAggregationOptions<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}> extends ObserveAggregationBaseOptions<T, A, RDPs> {
254
+ objectSet?: undefined;
255
+ }
256
+ /**
257
+ * Options for observeAggregation with an ObjectSet (asynchronous).
258
+ *
259
+ * When objectSet is provided, the aggregation is performed on that ObjectSet
260
+ * instead of the base type, enabling aggregation on pivoted or filtered sets.
261
+ */
262
+ interface ObserveAggregationOptionsWithObjectSet<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}> extends ObserveAggregationBaseOptions<T, A, RDPs> {
263
+ objectSet: ObjectSet<T>;
264
+ }
245
265
  interface ObserveAggregationArgs<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>> {
246
266
  result: AggregationsResults<T, A> | undefined;
247
267
  status: Status;
@@ -255,10 +275,14 @@ interface ObserveFunctionOptions extends CommonObserveOptions {
255
275
  */
256
276
  dependsOn?: Array<ObjectTypeDefinition | string>;
257
277
  /**
258
- * Specific object instances this function depends on.
278
+ * Specific object instances or ObjectSets this function depends on.
259
279
  * When these objects change, the function will refetch.
280
+ *
281
+ * For ObjectSets, the object type is extracted asynchronously and added
282
+ * to the dependency list. Changes to any object of that type will trigger
283
+ * a refetch.
260
284
  */
261
- dependsOnObjects?: Array<Osdk.Instance<ObjectTypeDefinition>>;
285
+ dependsOnObjects?: Array<Osdk.Instance<ObjectTypeDefinition> | ObjectSet<ObjectTypeDefinition>>;
262
286
  }
263
287
  interface ObserveFunctionCallbackArgs<Q extends QueryDefinition<unknown>> {
264
288
  result: QueryReturnType<CompileTimeMetadata<Q>["output"]> | undefined;
@@ -283,9 +307,9 @@ declare namespace ObservableClient {
283
307
  */
284
308
  interface ObservableClient extends ObserveLinks {
285
309
  /**
286
- * Observe a single object with automatic updates when it changes.
310
+ * Observe a single object or interface instance with automatic updates when it changes.
287
311
  *
288
- * @param apiName - The object type definition or name
312
+ * @param apiName - The object type or interface definition, or its API name
289
313
  * @param pk - The object's primary key
290
314
  * @param options - Observation options including deduplication interval
291
315
  * @param subFn - Observer that receives object state updates
@@ -297,7 +321,7 @@ interface ObservableClient extends ObserveLinks {
297
321
  * - Updates when the object changes
298
322
  * - Error state if fetch fails
299
323
  */
300
- observeObject<T extends ObjectTypeDefinition>(apiName: T["apiName"] | T, pk: PrimaryKeyType<T>, options: ObserveOptions, subFn: Observer<ObserveObjectCallbackArgs<T>>): Unsubscribable;
324
+ observeObject<T extends ObjectOrInterfaceDefinition>(apiName: T["apiName"] | T, pk: PrimaryKeyType<T>, options: ObserveOptions, subFn: Observer<ObserveObjectCallbackArgs<T>>): Unsubscribable;
301
325
  /**
302
326
  * Observe a filtered and sorted collection of objects.
303
327
  *
@@ -311,7 +335,7 @@ interface ObservableClient extends ObserveLinks {
311
335
  * - Pagination via fetchMore() in the payload
312
336
  * - Automatic updates when any matching object changes
313
337
  */
314
- observeList<T extends ObjectTypeDefinition | InterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}>(options: ObserveListOptions<T, RDPs>, subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>): Unsubscribable;
338
+ observeList<T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}>(options: ObserveListOptions<T, RDPs>, subFn: Observer<ObserveObjectsCallbackArgs<T, RDPs>>): Unsubscribable;
315
339
  /**
316
340
  * Observe an ObjectSet with automatic updates when matching objects change.
317
341
  *
@@ -329,20 +353,34 @@ interface ObservableClient extends ObserveLinks {
329
353
  */
330
354
  observeObjectSet<T extends ObjectTypeDefinition, RDPs extends Record<string, WirePropertyTypes | undefined | Array<WirePropertyTypes>> = {}>(baseObjectSet: ObjectSet<T>, options: ObserveObjectSetOptions<T, RDPs>, subFn: Observer<ObserveObjectSetArgs<T, RDPs>>): Unsubscribable;
331
355
  /**
332
- * Observe an aggregation query with automatic updates when underlying data changes.
356
+ * @deprecated Use the async overload with `objectSet` parameter instead.
357
+ * Pass `objectSet: client(YourType)` to get the base object set.
358
+ */
359
+ observeAggregation<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}>(options: ObserveAggregationOptions<T, A, RDPs>, subFn: Observer<ObserveAggregationArgs<T, A>>): Unsubscribable;
360
+ /**
361
+ * Observe an aggregation query on a custom ObjectSet with automatic updates.
333
362
  *
334
- * @param options - Aggregation configuration including where, aggregate spec, and derived properties
363
+ * This overload accepts an ObjectSet parameter, enabling aggregation on pivoted,
364
+ * filtered, or composed ObjectSets. Returns a Promise because invalidation type
365
+ * computation is async (requires lookups for link targets).
366
+ *
367
+ * @param options - Aggregation configuration including objectSet, where, aggregate spec
335
368
  * @param subFn - Observer that receives aggregation result updates
336
- * @returns Subscription that can be unsubscribed to stop updates
369
+ * @returns Promise resolving to subscription that can be unsubscribed
337
370
  *
338
- * Supports:
339
- * - Filtering with where clauses
340
- * - Derived properties (RDPs) via withProperties
341
- * - Set intersections
342
- * - GroupBy and metric aggregations
343
- * - Automatic updates when source data changes
371
+ * @example
372
+ * ```typescript
373
+ * const sub = await observableClient.observeAggregation(
374
+ * {
375
+ * type: Office,
376
+ * objectSet: $(Employee).pivotTo("primaryOffice"),
377
+ * aggregate: { $select: { $count: "unordered" } }
378
+ * },
379
+ * observer
380
+ * );
381
+ * ```
344
382
  */
345
- observeAggregation<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}>(options: ObserveAggregationOptions<T, A, RDPs>, subFn: Observer<ObserveAggregationArgs<T, A>>): Unsubscribable;
383
+ observeAggregation<T extends ObjectOrInterfaceDefinition, A extends AggregateOpts<T>, RDPs extends Record<string, SimplePropertyDef> = {}>(options: ObserveAggregationOptionsWithObjectSet<T, A, RDPs>, subFn: Observer<ObserveAggregationArgs<T, A>>): Promise<Unsubscribable>;
346
384
  /**
347
385
  * Observe a function execution with automatic updates.
348
386
  *
@@ -424,7 +462,7 @@ interface ObservableClient extends ObserveLinks {
424
462
  * @param primaryKey - Object primary key
425
463
  */
426
464
  invalidateFunctionsByObject(apiName: string, primaryKey: string | number): Promise<void>;
427
- canonicalizeWhereClause: <T extends ObjectTypeDefinition | InterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}>(where: WhereClause<T, RDPs>) => Canonical<WhereClause<T, RDPs>>;
465
+ canonicalizeWhereClause: <T extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}>(where: WhereClause<T, RDPs>) => Canonical<WhereClause<T, RDPs>>;
428
466
  }
429
467
  declare function createObservableClient(client: Client): ObservableClient;
430
468
  interface Unsubscribable {
@@ -440,4 +478,4 @@ interface OsdkConfig {
440
478
  }
441
479
  declare function getOsdkConfig(ontologyRid: string): OsdkConfig;
442
480
 
443
- export { ActionSignatureFromDef, ObservableClient, type ObserveAggregationArgs, type ObserveFunctionCallbackArgs, type ObserveFunctionOptions, ObserveLinks, type ObserveObjectCallbackArgs, type ObserveObjectSetArgs, type ObserveObjectsCallbackArgs, type Observer, type OsdkConfig, QueryReturnType, type Unsubscribable, augment, computeObjectSetCacheKey, createObservableClient, getMetaTagContent, getOsdkConfig };
481
+ export { ActionSignatureFromDef, ObservableClient, type ObserveAggregationArgs, type ObserveFunctionCallbackArgs, type ObserveFunctionOptions, ObserveLinks, type ObserveObjectCallbackArgs, type ObserveObjectSetArgs, type ObserveObjectsCallbackArgs, type Observer, type OsdkConfig, QueryReturnType, type Unsubscribable, augment, computeObjectSetCacheKey, createObservableClient, getMetaTagContent, getOsdkConfig, getWireObjectSet, isObjectSet };
@@ -21,7 +21,7 @@
21
21
  export const additionalContext = Symbol("additionalContext");
22
22
 
23
23
  // BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
24
- const MaxOsdkVersion = "2.7.0";
24
+ const MaxOsdkVersion = "2.8.0";
25
25
  // END: THIS IS GENERATED CODE. DO NOT EDIT.
26
26
 
27
27
  const ErrorMessage = Symbol("ErrorMessage");
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.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 {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n )\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends (InterfaceDefinition)>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends ActionDefinition<any>>(\n o: Q,\n ): ActionSignatureFromDef<Q>;\n\n <Q extends QueryDefinition<any>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n <Q extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\"> | Experiment<\"2.2.0\">>(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n fetchMetadata<\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n >(o: Q): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.7.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA;;AAsDA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,OAAO;AAC9B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.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 {\n ActionDefinition,\n ActionMetadata,\n CompileTimeMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n VersionBound,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport type { SharedClient } from \"@osdk/shared.client2\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\nimport type { SatisfiesSemver } from \"./SatisfiesSemver.js\";\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-imports\ntype OldSharedClient = import(\"@osdk/shared.client\").SharedClient;\n\nexport type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (\n SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q\n : Q & {\n [ErrorMessage]:\n `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;\n }\n )\n : Q;\n\nexport interface Client extends SharedClient, OldSharedClient {\n <Q extends ObjectTypeDefinition>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? ObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends (InterfaceDefinition)>(\n o: Q,\n ): unknown extends CompileTimeMetadata<Q>[\"objectSet\"] ? MinimalObjectSet<Q>\n : CompileTimeMetadata<Q>[\"objectSet\"];\n\n <Q extends ActionDefinition<any>>(\n o: Q,\n ): ActionSignatureFromDef<Q>;\n\n <Q extends QueryDefinition<any>>(\n o: Q,\n ): QuerySignatureFromDef<Q>;\n\n <Q extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\"> | Experiment<\"2.2.0\">>(\n experiment: Q,\n ): ExperimentFns<Q>;\n\n fetchMetadata<\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n >(o: Q): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n >;\n\n /** @internal */\n [additionalContext]: MinimalClient;\n}\n\n// DO NOT EXPORT FROM PACKAGE\n/** @internal */\nexport const additionalContext: unique symbol = Symbol(\"additionalContext\");\n\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.8.0\";\n// END: THIS IS GENERATED CODE. DO NOT EDIT.\nexport type MaxOsdkVersion = typeof MaxOsdkVersion;\nconst ErrorMessage: unique symbol = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA0BA;;AAsDA;AACA;AACA,OAAO,MAAMA,iBAAgC,GAAGC,MAAM,CAAC,mBAAmB,CAAC;;AAE3E;AACA,MAAMC,cAAc,GAAG,OAAO;AAC9B;;AAEA,MAAMC,YAA2B,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
@@ -42,7 +42,8 @@ export async function applyAction(client, action, parameters, options = {}) {
42
42
  returnEdits: options?.$returnEdits ? "ALL_V2_WITH_DELETIONS" : "NONE"
43
43
  }
44
44
  }, {
45
- branch: client.branch
45
+ branch: client.branch,
46
+ transactionId: client.transactionId
46
47
  });
47
48
  if (options?.$validateOnly) {
48
49
  return response.validation;
@@ -1 +1 @@
1
- {"version":3,"file":"applyAction.js","names":["OntologiesV2","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","ontologyProvider","getActionDefinition","returnEdits","$returnEdits","branch","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","actionMetadata","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","deletedLinks","addedObjects","deletedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","osdkEdit","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","push","add","objectType","primaryKey","process","env","NODE_ENV","console","warn","JSON","stringify"],"sources":["applyAction.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 {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n CompileTimeMetadata as CompileTimeActionMetadata,\n DataValueClientToWire,\n} from \"@osdk/api\";\nimport type {\n BatchApplyActionResponseV2,\n DataValue,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport type { NOOP } from \"../util/NOOP.js\";\nimport type { NullableProps } from \"../util/NullableProps.js\";\nimport type { PartialBy } from \"../util/partialBy.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\ntype BaseType<APD extends Pick<ActionMetadata.Parameter<any>, \"type\">> =\n APD[\"type\"] extends ActionMetadata.DataType.Object<infer TTargetType>\n ? ActionParam.ObjectType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer TTargetType>\n ? ActionParam.ObjectSetType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.Struct<infer TStructType>\n ? ActionParam.StructType<TStructType>\n : APD[\"type\"] extends keyof DataValueClientToWire\n ? ActionParam.PrimitiveType<APD[\"type\"]>\n : never;\n\ntype MaybeArrayType<APD extends ActionMetadata.Parameter<any>> =\n APD[\"multiplicity\"] extends true ? Array<BaseType<APD>>\n : BaseType<APD>;\n\ntype NotOptionalParams<X extends ActionParametersDefinition> = {\n [P in keyof X]: MaybeArrayType<X[P]>;\n};\n\nexport type OsdkActionParameters<\n X extends ActionParametersDefinition,\n> = NullableProps<X> extends never ? NotOptionalParams<X>\n : PartialBy<NotOptionalParams<X>, NullableProps<X>>;\n\nexport type ActionSignatureFromDef<\n T extends ActionDefinition<any>,\n> = {\n applyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"]] extends [never]\n ? ActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"];\n\n batchApplyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"]] extends\n [never] ? BatchActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"];\n};\n\ntype ActionParametersDefinition = Record<\n any,\n ActionMetadata.Parameter<any>\n>;\n\nexport type ActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>,\n OP extends ApplyActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport type BatchActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>[],\n OP extends ApplyBatchActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport async function applyAction<\n AD extends ActionDefinition<any>,\n P extends\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n Op extends P extends OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >[] ? ApplyBatchActionOptions\n : ApplyActionOptions,\n>(\n client: MinimalClient,\n action: AD,\n parameters?: P,\n options: Op = {} as Op,\n): Promise<\n ActionReturnTypeForOptions<Op>\n> {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })),\n action,\n );\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n requests: parameters\n ? await remapBatchActionParams(\n parameters,\n client,\n await client.ontologyProvider.getActionDefinition(action.apiName),\n )\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n },\n { branch: client.branch },\n );\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n } else {\n const response = await OntologiesV2.Actions.apply(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n parameters: await remapActionParams(\n parameters as OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >,\n client,\n await client.ontologyProvider.getActionDefinition(action.apiName),\n ),\n options: {\n mode: (options as ApplyActionOptions)?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL_V2_WITH_DELETIONS\"\n : \"NONE\",\n },\n },\n { branch: client.branch },\n );\n\n if ((options as ApplyActionOptions)?.$validateOnly) {\n return response.validation as ActionReturnTypeForOptions<Op>;\n }\n\n if (response.validation && response.validation?.result === \"INVALID\") {\n const validation = response.validation;\n throw new ActionValidationError(validation);\n }\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n }\n}\n\nasync function remapActionParams<AD extends ActionDefinition<any>>(\n params:\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | undefined,\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n): Promise<Record<string, DataValue>> {\n if (params == null) {\n return {};\n }\n\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client, actionMetadata);\n }\n\n return parameterMap;\n}\n\nasync function remapBatchActionParams<\n AD extends ActionDefinition<any>,\n>(\n params: OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n) {\n const remappedParams = await Promise.all(params.map(\n async param => {\n return {\n parameters: await remapActionParams<AD>(param, client, actionMetadata),\n };\n },\n ));\n\n return remappedParams;\n}\n\nexport function remapActionResponse(\n response: SyncApplyActionResponseV2 | BatchApplyActionResponseV2,\n): ActionEditResponse | undefined {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse: ActionEditResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n deletedLinks: [],\n addedObjects: [],\n deletedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n\n const editedObjectTypesSet = new Set<string>();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\" || edit.type === \"deleteLink\") {\n const osdkEdit = {\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n };\n edit.type === \"addLink\"\n ? remappedActionResponse.addedLinks.push(\n osdkEdit,\n )\n : remappedActionResponse.deletedLinks?.push(osdkEdit);\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n } else if (\n edit.type === \"addObject\" || edit.type === \"deleteObject\"\n || edit.type === \"modifyObject\"\n ) {\n const osdkEdit = {\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n };\n if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push(osdkEdit);\n } else if (edit.type === \"deleteObject\") {\n remappedActionResponse.deletedObjects?.push(osdkEdit);\n } else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push(osdkEdit);\n }\n editedObjectTypesSet.add(edit.objectType);\n } else {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `Unexpected edit type: ${JSON.stringify(edit)}`,\n );\n }\n }\n }\n remappedActionResponse.editedObjectTyp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IAAI,CACV,yBAAyBC,IAAI,CAACC,SAAS,CAAChB,IAAI,CAAC,EAC/C,CAAC;QACH;MACF;IACF;IACAX,sBAAsB,CAACQ,iBAAiB,GAAG,CAAC,GAAGC,oBAAoB,CAAC;IACpE,OAAOT,sBAAsB;EAC/B;AACF","ignoreList":[]}
1
+ {"version":3,"file":"applyAction.js","names":["OntologiesV2","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","ontologyProvider","getActionDefinition","returnEdits","$returnEdits","branch","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","transactionId","validation","result","params","actionMetadata","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","deletedLinks","addedObjects","deletedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","osdkEdit","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","push","add","objectType","primaryKey","process","env","NODE_ENV","console","warn","JSON","stringify"],"sources":["applyAction.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 {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n CompileTimeMetadata as CompileTimeActionMetadata,\n DataValueClientToWire,\n} from \"@osdk/api\";\nimport type {\n BatchApplyActionResponseV2,\n DataValue,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport type { NOOP } from \"../util/NOOP.js\";\nimport type { NullableProps } from \"../util/NullableProps.js\";\nimport type { PartialBy } from \"../util/partialBy.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\ntype BaseType<APD extends Pick<ActionMetadata.Parameter<any>, \"type\">> =\n APD[\"type\"] extends ActionMetadata.DataType.Object<infer TTargetType>\n ? ActionParam.ObjectType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer TTargetType>\n ? ActionParam.ObjectSetType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.Struct<infer TStructType>\n ? ActionParam.StructType<TStructType>\n : APD[\"type\"] extends keyof DataValueClientToWire\n ? ActionParam.PrimitiveType<APD[\"type\"]>\n : never;\n\ntype MaybeArrayType<APD extends ActionMetadata.Parameter<any>> =\n APD[\"multiplicity\"] extends true ? Array<BaseType<APD>>\n : BaseType<APD>;\n\ntype NotOptionalParams<X extends ActionParametersDefinition> = {\n [P in keyof X]: MaybeArrayType<X[P]>;\n};\n\nexport type OsdkActionParameters<\n X extends ActionParametersDefinition,\n> = NullableProps<X> extends never ? NotOptionalParams<X>\n : PartialBy<NotOptionalParams<X>, NullableProps<X>>;\n\nexport type ActionSignatureFromDef<\n T extends ActionDefinition<any>,\n> = {\n applyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"]] extends [never]\n ? ActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"];\n\n batchApplyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"]] extends\n [never] ? BatchActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"];\n};\n\ntype ActionParametersDefinition = Record<\n any,\n ActionMetadata.Parameter<any>\n>;\n\nexport type ActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>,\n OP extends ApplyActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport type BatchActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>[],\n OP extends ApplyBatchActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport async function applyAction<\n AD extends ActionDefinition<any>,\n P extends\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n Op extends P extends OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >[] ? ApplyBatchActionOptions\n : ApplyActionOptions,\n>(\n client: MinimalClient,\n action: AD,\n parameters?: P,\n options: Op = {} as Op,\n): Promise<\n ActionReturnTypeForOptions<Op>\n> {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })),\n action,\n );\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n requests: parameters\n ? await remapBatchActionParams(\n parameters,\n client,\n await client.ontologyProvider.getActionDefinition(action.apiName),\n )\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n },\n { branch: client.branch },\n );\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n } else {\n const response = await OntologiesV2.Actions.apply(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n parameters: await remapActionParams(\n parameters as OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >,\n client,\n await client.ontologyProvider.getActionDefinition(action.apiName),\n ),\n options: {\n mode: (options as ApplyActionOptions)?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL_V2_WITH_DELETIONS\"\n : \"NONE\",\n },\n },\n { branch: client.branch, transactionId: client.transactionId },\n );\n\n if ((options as ApplyActionOptions)?.$validateOnly) {\n return response.validation as ActionReturnTypeForOptions<Op>;\n }\n\n if (response.validation && response.validation?.result === \"INVALID\") {\n const validation = response.validation;\n throw new ActionValidationError(validation);\n }\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n }\n}\n\nasync function remapActionParams<AD extends ActionDefinition<any>>(\n params:\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | undefined,\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n): Promise<Record<string, DataValue>> {\n if (params == null) {\n return {};\n }\n\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client, actionMetadata);\n }\n\n return parameterMap;\n}\n\nasync function remapBatchActionParams<\n AD extends ActionDefinition<any>,\n>(\n params: OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n client: MinimalClient,\n actionMetadata: ActionMetadata,\n) {\n const remappedParams = await Promise.all(params.map(\n async param => {\n return {\n parameters: await remapActionParams<AD>(param, client, actionMetadata),\n };\n },\n ));\n\n return remappedParams;\n}\n\nexport function remapActionResponse(\n response: SyncApplyActionResponseV2 | BatchApplyActionResponseV2,\n): ActionEditResponse | undefined {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse: ActionEditResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n deletedLinks: [],\n addedObjects: [],\n deletedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n\n const editedObjectTypesSet = new Set<string>();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\" || edit.type === \"deleteLink\") {\n const osdkEdit = {\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n };\n edit.type === \"addLink\"\n ? remappedActionResponse.addedLinks.push(\n osdkEdit,\n )\n : remappedActionResponse.deletedLinks?.push(osdkEdit);\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n } else if (\n edit.type === \"addObject\" || edit.type === \"deleteObject\"\n || edit.type === \"modifyObject\"\n ) {\n const osdkEdit = {\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n };\n if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push(osdkEdit);\n } else if (edit.type === \"deleteObject\") {\n remappedActionResponse.deletedObjects?.push(osdkEdit);\n } else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push(osdkEdit);\n }\n editedObjectTypesSet.add(edit.objectType);\n } else {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `Unexpected edit type: ${JSON.stringify(edit)}`,\n );\n }\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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;MACF;IACF;IACAX,sBAAsB,CAACQ,iBAAiB,GAAG,CAAC,GAAGC,oBAAoB,CAAC;IACpE,OAAOT,sBAAsB;EAC/B;AACF","ignoreList":[]}
@@ -150,6 +150,107 @@ describe(createWithPropertiesObjectSet, () => {
150
150
  }
151
151
  `);
152
152
  });
153
+ it("subtract produces correct wire format", () => {
154
+ const map = new Map();
155
+ const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
156
+ type: "methodInput"
157
+ }, map, true);
158
+ const result = {
159
+ "derivedPropertyName": base => base.pivotTo("lead").selectProperty("employeeId").subtract(base.selectProperty("employeeId"))
160
+ }["derivedPropertyName"](deriveObjectSet);
161
+ const definition = map.get(result);
162
+ expect(definition).toMatchInlineSnapshot(`
163
+ {
164
+ "left": {
165
+ "objectSet": {
166
+ "link": "lead",
167
+ "objectSet": {
168
+ "type": "methodInput",
169
+ },
170
+ "type": "searchAround",
171
+ },
172
+ "operation": {
173
+ "selectedPropertyApiName": "employeeId",
174
+ "type": "get",
175
+ },
176
+ "type": "selection",
177
+ },
178
+ "right": {
179
+ "apiName": "employeeId",
180
+ "type": "property",
181
+ },
182
+ "type": "subtract",
183
+ }
184
+ `);
185
+ });
186
+ it("divide produces correct wire format", () => {
187
+ const map = new Map();
188
+ const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
189
+ type: "methodInput"
190
+ }, map, true);
191
+ const result = {
192
+ "derivedPropertyName": base => base.pivotTo("lead").selectProperty("employeeId").divide(base.selectProperty("employeeId"))
193
+ }["derivedPropertyName"](deriveObjectSet);
194
+ const definition = map.get(result);
195
+ expect(definition).toMatchInlineSnapshot(`
196
+ {
197
+ "left": {
198
+ "objectSet": {
199
+ "link": "lead",
200
+ "objectSet": {
201
+ "type": "methodInput",
202
+ },
203
+ "type": "searchAround",
204
+ },
205
+ "operation": {
206
+ "selectedPropertyApiName": "employeeId",
207
+ "type": "get",
208
+ },
209
+ "type": "selection",
210
+ },
211
+ "right": {
212
+ "apiName": "employeeId",
213
+ "type": "property",
214
+ },
215
+ "type": "divide",
216
+ }
217
+ `);
218
+ });
219
+ it("multiply produces correct wire format", () => {
220
+ const map = new Map();
221
+ const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
222
+ type: "methodInput"
223
+ }, map, true);
224
+ const result = {
225
+ "derivedPropertyName": base => base.pivotTo("lead").selectProperty("employeeId").multiply(base.selectProperty("employeeId"))
226
+ }["derivedPropertyName"](deriveObjectSet);
227
+ const definition = map.get(result);
228
+ expect(definition).toMatchInlineSnapshot(`
229
+ {
230
+ "properties": [
231
+ {
232
+ "objectSet": {
233
+ "link": "lead",
234
+ "objectSet": {
235
+ "type": "methodInput",
236
+ },
237
+ "type": "searchAround",
238
+ },
239
+ "operation": {
240
+ "selectedPropertyApiName": "employeeId",
241
+ "type": "get",
242
+ },
243
+ "type": "selection",
244
+ },
245
+ {
246
+ "apiName": "employeeId",
247
+ "type": "property",
248
+ },
249
+ ],
250
+ "type": "multiply",
251
+ }
252
+ `);
253
+ });
153
254
 
154
255
  // TODO: Add test for literal
155
256
  it("can handle nested definitions in an expression", () => {
@@ -1 +1 @@
1
- {"version":3,"file":"createWithPropertiesObjectSet.test.js","names":["Employee","describe","expect","it","createWithPropertiesObjectSet","map","Map","deriveObjectSet","type","result","base","pivotTo","selectProperty","definition","get","toMatchInlineSnapshot","clause","aggregate","percentile","limit","secondResult","secondDefinition","add","extractPart","min"],"sources":["createWithPropertiesObjectSet.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 { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport { describe, expect, it } from \"vitest\";\nimport { createWithPropertiesObjectSet } from \"./createWithPropertiesObjectSet.js\";\n\ndescribe(createWithPropertiesObjectSet, () => {\n it(\"correctly creates basic object set with derived properties\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n it(\"correctly allows select property off the base object set\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(\n Employee,\n {\n type: \"methodInput\",\n },\n map,\n true,\n );\n\n const clause = {\n \"derivedPropertyName\": (base) => base.selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"apiName\": \"employeeId\",\n \"type\": \"property\",\n }\n `);\n });\n\n it(\"correctly handles multiple definitions in one clause\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:approximatePercentile\", {\n percentile: 0.5,\n }),\n\n \"secondaryDerivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"fullName:collectSet\", {\n limit: 10,\n }),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n const secondResult = clause[\"secondaryDerivedPropertyName\"](\n deriveObjectSet,\n );\n const secondDefinition = map.get(secondResult);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"approximatePercentile\": 0.5,\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"approximatePercentile\",\n },\n \"type\": \"selection\",\n }\n `);\n\n expect(secondDefinition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"limit\": 10,\n \"selectedPropertyApiName\": \"fullName\",\n \"type\": \"collectSet\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n describe(\"expressions\", () => {\n it(\"can handle expressions referencing other property keys\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(\n Employee,\n {\n type: \"methodInput\",\n },\n map,\n true,\n );\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\").add(\n base.selectProperty(\"employeeId\"),\n ),\n // \"secondaryDerivedPropertyName\": (base) =>\n // base.pivotTo(\"lead\").aggregate(\"employeeId:avg\").divide(\"employeeId\", 2),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"properties\": [\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n {\n \"apiName\": \"employeeId\",\n \"type\": \"property\",\n },\n ],\n \"type\": \"add\",\n }\n `);\n });\n\n // TODO: Add test for literal\n it(\"can handle nested definitions in an expression\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\").add(\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n ),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"properties\": [\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n ],\n \"type\": \"add\",\n }\n `);\n });\n });\n\n it(\"handles datetime expressions\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"startDate\").extractPart(\"MONTHS\"),\n \"secondaryDerivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"startDate\").min(\n base.pivotTo(\"lead\").selectProperty(\"startDate\"),\n ),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"part\": \"MONTHS\",\n \"property\": {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"startDate\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n \"type\": \"extract\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,6BAA6B,QAAQ,oCAAoC;AAElFH,QAAQ,CAACG,6BAA6B,EAAE,MAAM;EAC5CD,EAAE,CAAC,4DAA4D,EAAE,MAAM;IACrE,MAAME,GAAG,GAAG,IAAIC,GAAG,CAAiC,CAAC;IACrD,MAAMC,eAAe,GAAGH,6BAA6B,CAACJ,QAAQ,EAAE;MAC9DQ,IAAI,EAAE;IACR,CAAC,EAAEH,GAAG,CAAC;IAOP,MAAMI,MAAM,GALG;MACb,qBAAqB,EAAGC,IAAI,IAC1BA,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,CAAC,YAAY;IACpD,CAAC,CAEqB,qBAAqB,CAAC,CAACL,eAAe,CAAC;IAC7D,MAAMM,UAAU,GAAGR,GAAG,CAACS,GAAG,CAACL,MAAM,CAAC;IAClCP,MAAM,CAACW,UAAU,CAAC,CAACE,qBAAqB,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;EACN,CAAC,CAAC;EAEFZ,EAAE,CAAC,0DAA0D,EAAE,MAAM;IACnE,MAAME,GAAG,GAAG,IAAIC,GAAG,CAAiC,CAAC;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GAAG,CAACS,GAAG,CAACL,MAAM,CAAC;IAElCP,MAAM,CAACW,UAAU,CAAC,CAACE,qBAAqB,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"createWithPropertiesObjectSet.test.js","names":["Employee","describe","expect","it","createWithPropertiesObjectSet","map","Map","deriveObjectSet","type","result","base","pivotTo","selectProperty","definition","get","toMatchInlineSnapshot","clause","aggregate","percentile","limit","secondResult","secondDefinition","add","subtract","divide","multiply","extractPart","min"],"sources":["createWithPropertiesObjectSet.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 { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport { describe, expect, it } from \"vitest\";\nimport { createWithPropertiesObjectSet } from \"./createWithPropertiesObjectSet.js\";\n\ndescribe(createWithPropertiesObjectSet, () => {\n it(\"correctly creates basic object set with derived properties\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n it(\"correctly allows select property off the base object set\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(\n Employee,\n {\n type: \"methodInput\",\n },\n map,\n true,\n );\n\n const clause = {\n \"derivedPropertyName\": (base) => base.selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"apiName\": \"employeeId\",\n \"type\": \"property\",\n }\n `);\n });\n\n it(\"correctly handles multiple definitions in one clause\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:approximatePercentile\", {\n percentile: 0.5,\n }),\n\n \"secondaryDerivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"fullName:collectSet\", {\n limit: 10,\n }),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n const secondResult = clause[\"secondaryDerivedPropertyName\"](\n deriveObjectSet,\n );\n const secondDefinition = map.get(secondResult);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"approximatePercentile\": 0.5,\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"approximatePercentile\",\n },\n \"type\": \"selection\",\n }\n `);\n\n expect(secondDefinition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"limit\": 10,\n \"selectedPropertyApiName\": \"fullName\",\n \"type\": \"collectSet\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n describe(\"expressions\", () => {\n it(\"can handle expressions referencing other property keys\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(\n Employee,\n {\n type: \"methodInput\",\n },\n map,\n true,\n );\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\").add(\n base.selectProperty(\"employeeId\"),\n ),\n // \"secondaryDerivedPropertyName\": (base) =>\n // base.pivotTo(\"lead\").aggregate(\"employeeId:avg\").divide(\"employeeId\", 2),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"properties\": [\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n {\n \"apiName\": \"employeeId\",\n \"type\": \"property\",\n },\n ],\n \"type\": \"add\",\n }\n `);\n });\n\n it(\"subtract produces correct wire format\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(\n Employee,\n { type: \"methodInput\" },\n map,\n true,\n );\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\").subtract(\n base.selectProperty(\"employeeId\"),\n ),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"left\": {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n \"right\": {\n \"apiName\": \"employeeId\",\n \"type\": \"property\",\n },\n \"type\": \"subtract\",\n }\n `);\n });\n\n it(\"divide produces correct wire format\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(\n Employee,\n { type: \"methodInput\" },\n map,\n true,\n );\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\").divide(\n base.selectProperty(\"employeeId\"),\n ),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"left\": {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n \"right\": {\n \"apiName\": \"employeeId\",\n \"type\": \"property\",\n },\n \"type\": \"divide\",\n }\n `);\n });\n\n it(\"multiply produces correct wire format\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(\n Employee,\n { type: \"methodInput\" },\n map,\n true,\n );\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\").multiply(\n base.selectProperty(\"employeeId\"),\n ),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"properties\": [\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n {\n \"apiName\": \"employeeId\",\n \"type\": \"property\",\n },\n ],\n \"type\": \"multiply\",\n }\n `);\n });\n\n // TODO: Add test for literal\n it(\"can handle nested definitions in an expression\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\").add(\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n ),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"properties\": [\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n ],\n \"type\": \"add\",\n }\n `);\n });\n });\n\n it(\"handles datetime expressions\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"startDate\").extractPart(\"MONTHS\"),\n \"secondaryDerivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"startDate\").min(\n base.pivotTo(\"lead\").selectProperty(\"startDate\"),\n ),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"part\": \"MONTHS\",\n \"property\": {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"startDate\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n },\n \"type\": \"extract\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,6BAA6B,QAAQ,oCAAoC;AAElFH,QAAQ,CAACG,6BAA6B,EAAE,MAAM;EAC5CD,EAAE,CAAC,4DAA4D,EAAE,MAAM;IACrE,MAAME,GAAG,GAAG,IAAIC,GAAG,CAAiC,CAAC;IACrD,MAAMC,eAAe,GAAGH,6BAA6B,CAACJ,QAAQ,EAAE;MAC9DQ,IAAI,EAAE;IACR,CAAC,EAAEH,GAAG,CAAC;IAOP,MAAMI,MAAM,GALG;MACb,qBAAqB,EAAGC,IAAI,IAC1BA,IAAI,CAACC,OAAO,CAAC,MAAM,CAAC,CAACC,cAAc,CAAC,YAAY;IACpD,CAAC,CAEqB,qBAAqB,CAAC,CAACL,eAAe,CAAC;IAC7D,MAAMM,UAAU,GAAGR,GAAG,CAACS,GAAG,CAACL,MAAM,CAAC;IAClCP,MAAM,CAACW,UAAU,CAAC,CAACE,qBAAqB,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;EACN,CAA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7 @@ export function derivedPropertyDefinitionFactory(wireDefinition, definitionMap)
64
64
  },
65
65
  divide(value) {
66
66
  return derivedPropertyDefinitionFactory({
67
- "type": "subtract",
67
+ "type": "divide",
68
68
  "left": wireDefinition,
69
69
  "right": getDefinitionFromMap(value, definitionMap)
70
70
  }, definitionMap);
@@ -1 +1 @@
1
- {"version":3,"file":"derivedPropertyDefinitionFactory.js","names":["invariant","derivedPropertyDefinitionFactory","wireDefinition","definitionMap","definition","abs","type","property","negate","max","value","properties","getDefinitionFromMap","min","add","subtract","multiply","divide","extractPart","part","set","arg","get","process","env","NODE_ENV"],"sources":["derivedPropertyDefinitionFactory.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 { DerivedProperty } from \"@osdk/api\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\n\n/** @internal */\nexport function derivedPropertyDefinitionFactory(\n wireDefinition: DerivedPropertyDefinition,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n): DerivedProperty.NumericPropertyDefinition<any, any> & {\n extractPart: DerivedProperty.DatetimePropertyDefinition<\n any,\n any\n >[\"extractPart\"];\n} {\n type RemoveSymbolKeys<T> = {\n [K in keyof T as K extends symbol ? never : K]: T[K];\n };\n\n const definition:\n & RemoveSymbolKeys<DerivedProperty.NumericPropertyDefinition<any, any>>\n & {\n extractPart: DerivedProperty.DatetimePropertyDefinition<\n any,\n any\n >[\"extractPart\"];\n } = {\n abs() {\n return derivedPropertyDefinitionFactory({\n type: \"absoluteValue\",\n property: wireDefinition,\n }, definitionMap);\n },\n negate() {\n return derivedPropertyDefinitionFactory({\n type: \"negate\",\n property: wireDefinition,\n }, definitionMap);\n },\n max(value) {\n return derivedPropertyDefinitionFactory({\n type: \"greatest\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n min(value) {\n return derivedPropertyDefinitionFactory({\n type: \"least\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n add(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n type: \"add\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n subtract(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n \"type\": \"subtract\",\n \"left\": wireDefinition,\n \"right\": getDefinitionFromMap(value, definitionMap),\n }, definitionMap);\n },\n multiply(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n type: \"multiply\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n divide(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n \"type\": \"subtract\",\n \"left\": wireDefinition,\n \"right\": getDefinitionFromMap(value, definitionMap),\n }, definitionMap);\n },\n extractPart: (part) => {\n return derivedPropertyDefinitionFactory({\n type: \"extract\",\n part,\n property: wireDefinition,\n }, definitionMap);\n },\n };\n\n definitionMap.set(definition, wireDefinition);\n return definition as any;\n}\n\nconst getDefinitionFromMap = (\n arg: string | number | DerivedProperty.Definition<any, any>,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n): DerivedPropertyDefinition => {\n if (typeof arg === \"object\") {\n const definition = definitionMap.get(arg);\n invariant(definition, \"Derived Property is not defined\");\n return definition;\n } else if (typeof arg === \"number\") {\n invariant(false, \"Literals for derived properties are not yet supported\");\n }\n invariant(false, \"Invalid argument type for a derived property\");\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA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DA,SAAS;AACX,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"derivedPropertyDefinitionFactory.js","names":["invariant","derivedPropertyDefinitionFactory","wireDefinition","definitionMap","definition","abs","type","property","negate","max","value","properties","getDefinitionFromMap","min","add","subtract","multiply","divide","extractPart","part","set","arg","get","process","env","NODE_ENV"],"sources":["derivedPropertyDefinitionFactory.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 { DerivedProperty } from \"@osdk/api\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\n\n/** @internal */\nexport function derivedPropertyDefinitionFactory(\n wireDefinition: DerivedPropertyDefinition,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n): DerivedProperty.NumericPropertyDefinition<any, any> & {\n extractPart: DerivedProperty.DatetimePropertyDefinition<\n any,\n any\n >[\"extractPart\"];\n} {\n type RemoveSymbolKeys<T> = {\n [K in keyof T as K extends symbol ? never : K]: T[K];\n };\n\n const definition:\n & RemoveSymbolKeys<DerivedProperty.NumericPropertyDefinition<any, any>>\n & {\n extractPart: DerivedProperty.DatetimePropertyDefinition<\n any,\n any\n >[\"extractPart\"];\n } = {\n abs() {\n return derivedPropertyDefinitionFactory({\n type: \"absoluteValue\",\n property: wireDefinition,\n }, definitionMap);\n },\n negate() {\n return derivedPropertyDefinitionFactory({\n type: \"negate\",\n property: wireDefinition,\n }, definitionMap);\n },\n max(value) {\n return derivedPropertyDefinitionFactory({\n type: \"greatest\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n min(value) {\n return derivedPropertyDefinitionFactory({\n type: \"least\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n add(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n type: \"add\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n subtract(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n \"type\": \"subtract\",\n \"left\": wireDefinition,\n \"right\": getDefinitionFromMap(value, definitionMap),\n }, definitionMap);\n },\n multiply(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n type: \"multiply\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n divide(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n \"type\": \"divide\",\n \"left\": wireDefinition,\n \"right\": getDefinitionFromMap(value, definitionMap),\n }, definitionMap);\n },\n extractPart: (part) => {\n return derivedPropertyDefinitionFactory({\n type: \"extract\",\n part,\n property: wireDefinition,\n }, definitionMap);\n },\n };\n\n definitionMap.set(definition, wireDefinition);\n return definition as any;\n}\n\nconst getDefinitionFromMap = (\n arg: string | number | DerivedProperty.Definition<any, any>,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n): DerivedPropertyDefinition => {\n if (typeof arg === \"object\") {\n const definition = definitionMap.get(arg);\n invariant(definition, \"Derived Property is not defined\");\n return definition;\n } else if (typeof arg === \"number\") {\n invariant(false, \"Literals for derived properties are not yet supported\");\n }\n invariant(false, \"Invalid argument type for a derived property\");\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAOA,SAAS,MAAM,gBAAgB;;AAEtC;AACA,OAAO,SAASC,gCAAgCA,CAC9CC,cAAyC,EACzCC,aAAkD,EAMlD;EAKA,MAAMC,UAOH,GAAG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F,KAAK,EAAEP,aAAa,CAAC;MAE9C,CAAC,EAAEA,aAAa,CAAC;IACnB,CAAC;IACDc,MAAMA,CACJP,KAAK,EACL;MACA,OAAOT,gCAAgC,CAAC;QACtC,MAAM,EAAE,QAAQ;QAChB,MAAM,EAAEC,cAAc;QACtB,OAAO,EAAEU,oBAAoB,CAACF,KAAK,EAAEP,aAAa;MACpD,CAAC,EAAEA,aAAa,CAAC;IACnB,CAAC;IACDe,WAAW,EAAGC,IAAI,IAAK;MACrB,OAAOlB,gCAAgC,CAAC;QACtCK,IAAI,EAAE,SAAS;QACfa,IAAI;QACJZ,QAAQ,EAAEL;MACZ,CAAC,EAAEC,aAAa,CAAC;IACnB;EACF,CAAC;EAEHA,aAAa,CAACiB,GAAG,CAAChB,UAAU,EAAEF,cAAc,CAAC;EAC7C,OAAOE,UAAU;AACnB;AAEA,MAAMQ,oBAAoB,GAAGA,CAC3BS,GAA2D,EAC3DlB,aAAkD,KACpB;EAC9B,IAAI,OAAOkB,GAAG,KAAK,QAAQ,EAAE;IAC3B,MAAMjB,UAAU,GAAGD,aAAa,CAACmB,GAAG,CAACD,GAAG,CAAC;IACzC,CAAUjB,UAAU,GAAAmB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAApBzB,SAAS,QAAa,iCAAiC,IAAvDA,SAAS;IACT,OAAOI,UAAU;EACnB,CAAC,MAAM,IAAI,OAAOiB,GAAG,KAAK,QAAQ,EAAE;IAClCE,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAzB,SAAS,QAAQ,uDAAuD,IAAxEA,SAAS;EACX;EACAuB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAAzB,SAAS,QAAQ,8CAA8C,IAA/DA,SAAS;AACX,CAAC","ignoreList":[]}
@@ -65,7 +65,7 @@ export function modernToLegacyWhereClauseInner(whereClause, objectOrInterface, r
65
65
  return handleWherePair(parts[0], objectOrInterface, undefined, rdpNames);
66
66
  }
67
67
  function handleWherePair([fieldName, filter], objectOrInterface, structFieldSelector, rdpNames) {
68
- !(filter != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Defined key values are only allowed when they are not undefined.") : invariant(false) : void 0;
68
+ !(filter != null) ? process.env.NODE_ENV !== "production" ? invariant(false, `Cannot filter on property "${fieldName}" with an undefined or null value. ` + `If the value might be undefined, check it before adding to the where clause.`) : invariant(false) : void 0;
69
69
  const isRdp = !structFieldSelector && rdpNames?.has(fieldName);
70
70
  const propertyIdentifier = isRdp ? {
71
71
  type: "property",