@osdk/client 2.3.0-beta.9 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/CHANGELOG.md +186 -0
  2. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +1 -41
  3. package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  4. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +12 -145
  5. package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  6. package/build/browser/index.js.map +1 -1
  7. package/build/browser/object/fetchPage.js +9 -7
  8. package/build/browser/object/fetchPage.js.map +1 -1
  9. package/build/browser/object/mediaUpload.js +0 -3
  10. package/build/browser/object/mediaUpload.js.map +1 -1
  11. package/build/browser/objectSet/ObjectSet.test.js +106 -85
  12. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  13. package/build/browser/objectSet/createObjectSet.js +1 -1
  14. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  15. package/build/browser/public/internal.js +1 -0
  16. package/build/browser/public/internal.js.map +1 -1
  17. package/build/browser/public-utils/hydrateObjectSetFromObjectRids.js +39 -0
  18. package/build/browser/public-utils/hydrateObjectSetFromObjectRids.js.map +1 -0
  19. package/build/browser/queries/applyQuery.js +8 -4
  20. package/build/browser/queries/applyQuery.js.map +1 -1
  21. package/build/browser/util/UserAgent.js +2 -2
  22. package/build/browser/util/UserAgent.js.map +1 -1
  23. package/build/browser/util/toDataValue.js +1 -11
  24. package/build/browser/util/toDataValue.js.map +1 -1
  25. package/build/browser/util/toDataValue.test.js +2 -33
  26. package/build/browser/util/toDataValue.test.js.map +1 -1
  27. package/build/cjs/{chunk-6OJ3OWCR.cjs → chunk-2MTGADU5.cjs} +67 -73
  28. package/build/cjs/chunk-2MTGADU5.cjs.map +1 -0
  29. package/build/cjs/{chunk-HTPVXLYY.cjs → chunk-QHPACIXZ.cjs} +34 -144
  30. package/build/cjs/chunk-QHPACIXZ.cjs.map +1 -0
  31. package/build/cjs/index.cjs +6 -6
  32. package/build/cjs/index.d.cts +1 -1
  33. package/build/cjs/public/internal.cjs +22 -7
  34. package/build/cjs/public/internal.cjs.map +1 -1
  35. package/build/cjs/public/internal.d.cts +10 -1
  36. package/build/cjs/public/unstable-do-not-use.cjs +15 -15
  37. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +1 -41
  38. package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
  39. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +12 -145
  40. package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
  41. package/build/esm/index.js.map +1 -1
  42. package/build/esm/object/fetchPage.js +9 -7
  43. package/build/esm/object/fetchPage.js.map +1 -1
  44. package/build/esm/object/mediaUpload.js +0 -3
  45. package/build/esm/object/mediaUpload.js.map +1 -1
  46. package/build/esm/objectSet/ObjectSet.test.js +106 -85
  47. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  48. package/build/esm/objectSet/createObjectSet.js +1 -1
  49. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  50. package/build/esm/public/internal.js +1 -0
  51. package/build/esm/public/internal.js.map +1 -1
  52. package/build/esm/public-utils/hydrateObjectSetFromObjectRids.js +39 -0
  53. package/build/esm/public-utils/hydrateObjectSetFromObjectRids.js.map +1 -0
  54. package/build/esm/queries/applyQuery.js +8 -4
  55. package/build/esm/queries/applyQuery.js.map +1 -1
  56. package/build/esm/util/UserAgent.js +2 -2
  57. package/build/esm/util/UserAgent.js.map +1 -1
  58. package/build/esm/util/toDataValue.js +1 -11
  59. package/build/esm/util/toDataValue.js.map +1 -1
  60. package/build/esm/util/toDataValue.test.js +2 -33
  61. package/build/esm/util/toDataValue.test.js.map +1 -1
  62. package/build/types/index.d.ts +1 -1
  63. package/build/types/index.d.ts.map +1 -1
  64. package/build/types/object/mediaUpload.d.ts +1 -2
  65. package/build/types/object/mediaUpload.d.ts.map +1 -1
  66. package/build/types/public/internal.d.ts +1 -0
  67. package/build/types/public/internal.d.ts.map +1 -1
  68. package/build/types/public-utils/hydrateObjectSetFromObjectRids.d.ts +10 -0
  69. package/build/types/public-utils/hydrateObjectSetFromObjectRids.d.ts.map +1 -0
  70. package/build/types/queries/applyQuery.d.ts.map +1 -1
  71. package/package.json +11 -11
  72. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +0 -93
  73. package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +0 -1
  74. package/build/cjs/chunk-6OJ3OWCR.cjs.map +0 -1
  75. package/build/cjs/chunk-HTPVXLYY.cjs.map +0 -1
  76. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +0 -93
  77. package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +0 -1
  78. package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts +0 -1
  79. package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,80 @@
1
1
  # @osdk/client
2
2
 
3
+ ## 2.3.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 322c5bc: Simulated release
8
+ - 43c5547: Add 'getMediaReference' method to Media
9
+ - bc0e186: Add new types mapping for internal creation workflow.
10
+ - 991dbd4: Async function metadata
11
+ - 266b756: Add consistency for async iter calls.
12
+ - 2a23cca: ObservableClient now adds to the fetch-user-agent
13
+ - 9839eab: Bumps conjure-lite
14
+ - 3736624: Ensure count operations return numbers
15
+ - 8d69555: Add hydrateObjectSetFromObjectRids util.
16
+ - f82cff2: Remove Calculated RDPs and Media
17
+ - 5a15cfd: Added fixed dependency to API for beta package.
18
+ - cd911a6: Properly handles lat,long strings in action arguments
19
+ - 2c800e5: Fix bug where we sent over longitude/latitude for geohash properties, when the backend actually expects latitude/longitude.
20
+ - cd911a6: ObservableClient can now do optimistic writes for deletes
21
+ - f8db93d: improve media upload (beta)
22
+ - 3b5ccaa: Fix orderBy argument on object load methods
23
+ - Updated dependencies [322c5bc]
24
+ - Updated dependencies [322c5bc]
25
+ - Updated dependencies [322c5bc]
26
+ - Updated dependencies [322c5bc]
27
+ - Updated dependencies [322c5bc]
28
+ - Updated dependencies [322c5bc]
29
+ - Updated dependencies [43c5547]
30
+ - Updated dependencies [43554b4]
31
+ - Updated dependencies [bc0e186]
32
+ - Updated dependencies [cc2ce5f]
33
+ - Updated dependencies [9839eab]
34
+ - Updated dependencies [e8c4aed]
35
+ - Updated dependencies [7d232fb]
36
+ - Updated dependencies [474f4ca]
37
+ - Updated dependencies [f82cff2]
38
+ - Updated dependencies [a6c01ff]
39
+ - Updated dependencies [0cc9cad]
40
+ - Updated dependencies [ef46ed6]
41
+ - Updated dependencies [12d599f]
42
+ - Updated dependencies [f8db93d]
43
+ - Updated dependencies [3408ea9]
44
+ - Updated dependencies [3b5ccaa]
45
+ - @osdk/api@2.3.0
46
+ - @osdk/client.unstable@2.3.0
47
+ - @osdk/generator-converters@2.3.0
48
+ - @osdk/shared.client.impl@1.3.0
49
+ - @osdk/shared.net.errors@2.3.0
50
+ - @osdk/shared.net.fetch@1.3.0
51
+
52
+ ## 2.3.0-rc.11
53
+
54
+ ### Patch Changes
55
+
56
+ - f82cff2: Remove Calculated RDPs and Media
57
+ - Updated dependencies [43554b4]
58
+ - Updated dependencies [f82cff2]
59
+ - @osdk/client.unstable@2.3.0-rc.11
60
+ - @osdk/api@2.3.0-rc.11
61
+ - @osdk/generator-converters@2.3.0-rc.11
62
+
63
+ ## 2.3.0-beta.10
64
+
65
+ ### Minor Changes
66
+
67
+ - 991dbd4: Async function metadata
68
+ - 266b756: Add consistency for async iter calls.
69
+ - 8d69555: Add hydrateObjectSetFromObjectRids util.
70
+
71
+ ### Patch Changes
72
+
73
+ - Updated dependencies [0cc9cad]
74
+ - @osdk/client.unstable@2.3.0-beta.10
75
+ - @osdk/api@2.3.0-beta.10
76
+ - @osdk/generator-converters@2.3.0-beta.10
77
+
3
78
  ## 2.3.0-beta.9
4
79
 
5
80
  ### Minor Changes
@@ -99,6 +174,117 @@
99
174
  - @osdk/client.unstable@2.3.0-beta.2
100
175
  - @osdk/generator-converters@2.3.0-beta.2
101
176
 
177
+ ## 2.2.0
178
+
179
+ ### Patch Changes
180
+
181
+ - 322c5bc: Simulated release
182
+ - b61e9f5: Make Query Map Types Optional
183
+ - 7416ce4: Adds deleted objects and links returned from applyAction
184
+ - 1ba3871: Support $clone for interface objects
185
+ - 12843cb: Add ability to load all underlying properties of an interface.
186
+ - 18ba34f: Adds the ability to generate and execute functions at pinned versions
187
+ - cdd3154: Revert allowing explicitly passing undefined values to reset on actions
188
+ - 56aa502: Improves exposed APIs
189
+ - abe4897: Removes support for boolean primary keys
190
+ - 63b2e63: Update Platform SDK Dependencies
191
+ - cddfbf9: Adds default value option to group by
192
+ - 5a12181: Quick fix for geohash params.
193
+ - 2ce3659: Update underlying pagination size for async iter.
194
+ - 7416ce4: Update Platform SDK Dependencies
195
+ - 26c2d95: Add experimental function to load page of objects by rid.
196
+ - 430dee3: JSdoc for object properties are generated
197
+ - 397f906: Ensure count operations return numbers
198
+ - 488b51c: Add support for using aggregations and GeoJSON types from runtime derived properties
199
+ - fccd9ac: "Allow selecting derived properties"
200
+ - 5665b18: Remove selection RDPs from the API
201
+ - 761e69d: Added type safety to createMediaReference
202
+ - 889e84b: Release
203
+ - 62e5965: Removed unneeded lint statements.
204
+ - ed69666: Update conjure-lite to 0.7.1
205
+ - c92fe73: Add OsdkConfig utils to client/unstable
206
+ - 2517750: observeList should work for interfaces and have the fully loaded content
207
+ - 4183a55: Refactor OsdkBase to avoid breaks with type not being discoverable
208
+ - 1e16dcb: Exposes MinimalLogger and BrowserLogger via @osdk/client/internal
209
+ - 70b4464: Fix types for RDPs
210
+ - 2f6206c: Improvements to @osdk/react
211
+ - 81c0d8c: Client will now provide a default logger to console.error if none is provided
212
+ - 81c0d8c: ObservableClient now queues up object loads for bulk processing
213
+ - 791e655: Add support for geoshape and geohash action parameters.
214
+ - 317b555: Release
215
+ - 879b6c3: Include a more descriptive error message for multiple filters on a single property filter clause
216
+ - 63b2e63: Supports generating queries for entrySet function types
217
+ - 2517750: Provides efficient OrderByCanonicalizer
218
+ - 1e16dcb: Default logging is error level only
219
+ - f4370e3: Fixes error when using intersection, subtraction, or union object sets
220
+ - ea4e4b1: Fix attachments to be upload sequentially rather than in parallel.
221
+ - a146ce4: Cleanup RDP API
222
+ - cc380b5: Use the latest Platform APIs
223
+ - e873024: Fixes issues requiring msw and p-defer
224
+ - 88591f7: Small fixes for ObjectSpecifier
225
+ - 751e5b3: Use client as peer dep in functions package.
226
+ - 805df40: Fix interface action types.
227
+ - fe0cc43: Experimental react changes
228
+ - 2517750: Initial internal architecture document for ObservableClient
229
+ - 5467a0f: Fix orderBy argument on object load methods
230
+ - 2517750: subscribe in ObservableClient now uses Observer
231
+ - 63b2e63: Adds ObjectSpecifiers to generated OSDK objects
232
+ - Updated dependencies [322c5bc]
233
+ - Updated dependencies [322c5bc]
234
+ - Updated dependencies [322c5bc]
235
+ - Updated dependencies [322c5bc]
236
+ - Updated dependencies [322c5bc]
237
+ - Updated dependencies [322c5bc]
238
+ - Updated dependencies [b68adea]
239
+ - Updated dependencies [c6bee50]
240
+ - Updated dependencies [7416ce4]
241
+ - Updated dependencies [6eeb423]
242
+ - Updated dependencies [7170fd1]
243
+ - Updated dependencies [12843cb]
244
+ - Updated dependencies [ad93d55]
245
+ - Updated dependencies [a08bdfb]
246
+ - Updated dependencies [18ba34f]
247
+ - Updated dependencies [6abf078]
248
+ - Updated dependencies [f82767c]
249
+ - Updated dependencies [56aa502]
250
+ - Updated dependencies [0e874b1]
251
+ - Updated dependencies [abe4897]
252
+ - Updated dependencies [63b2e63]
253
+ - Updated dependencies [cddfbf9]
254
+ - Updated dependencies [7416ce4]
255
+ - Updated dependencies [23ea0e4]
256
+ - Updated dependencies [26c2d95]
257
+ - Updated dependencies [10da391]
258
+ - Updated dependencies [488b51c]
259
+ - Updated dependencies [71462e9]
260
+ - Updated dependencies [6ac8f0b]
261
+ - Updated dependencies [fccd9ac]
262
+ - Updated dependencies [5e8e839]
263
+ - Updated dependencies [5665b18]
264
+ - Updated dependencies [46cede4]
265
+ - Updated dependencies [761e69d]
266
+ - Updated dependencies [889e84b]
267
+ - Updated dependencies [a6e5f89]
268
+ - Updated dependencies [ed69666]
269
+ - Updated dependencies [4183a55]
270
+ - Updated dependencies [70b4464]
271
+ - Updated dependencies [395ae07]
272
+ - Updated dependencies [37f8e60]
273
+ - Updated dependencies [791e655]
274
+ - Updated dependencies [317b555]
275
+ - Updated dependencies [63b2e63]
276
+ - Updated dependencies [a146ce4]
277
+ - Updated dependencies [3d0ab11]
278
+ - Updated dependencies [805df40]
279
+ - Updated dependencies [5467a0f]
280
+ - Updated dependencies [63b2e63]
281
+ - @osdk/api@2.2.0
282
+ - @osdk/client.unstable@2.2.0
283
+ - @osdk/generator-converters@2.2.0
284
+ - @osdk/shared.client.impl@1.2.0
285
+ - @osdk/shared.net.errors@2.2.0
286
+ - @osdk/shared.net.fetch@1.2.0
287
+
102
288
  ## 2.2.0-beta.23
103
289
 
104
290
  ### Minor Changes
@@ -16,7 +16,6 @@
16
16
 
17
17
  import invariant from "tiny-invariant";
18
18
  import { modernToLegacyWhereClause } from "../internal/conversions/modernToLegacyWhereClause.js";
19
- import { derivedPropertyDefinitionFactory } from "./derivedPropertyDefinitionFactory.js";
20
19
  /** @internal */
21
20
  export function createWithPropertiesObjectSet(objectType, objectSet, definitionMap, fromBaseObjectSet = false) {
22
21
  return {
@@ -81,48 +80,9 @@ export function createWithPropertiesObjectSet(objectType, objectSet, definitionM
81
80
  objectSet: objectSet,
82
81
  operation: aggregationOperationDefinition
83
82
  };
84
- const selectorResult = derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);
83
+ const selectorResult = {};
85
84
  definitionMap.set(selectorResult, wrappedObjectSet);
86
85
  return selectorResult;
87
- },
88
- selectProperty: name => {
89
- if (fromBaseObjectSet) {
90
- const wrappedObjectSet = {
91
- type: "property",
92
- apiName: name
93
- };
94
- const selectorResult = derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);
95
- definitionMap.set(selectorResult, wrappedObjectSet);
96
- return selectorResult;
97
- }
98
- const wrappedObjectSet = {
99
- type: "selection",
100
- objectSet: objectSet,
101
- operation: {
102
- type: "get",
103
- selectedPropertyApiName: name
104
- }
105
- };
106
- const selectorResult = derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);
107
- definitionMap.set(selectorResult, wrappedObjectSet);
108
- return selectorResult;
109
- },
110
- constant: {
111
- double: () => {
112
- process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
113
- },
114
- integer: () => {
115
- process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
116
- },
117
- long: () => {
118
- process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
119
- },
120
- datetime: () => {
121
- process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
122
- },
123
- timestamp: () => {
124
- process.env.NODE_ENV !== "production" ? invariant(false, "Not supported") : invariant(false);
125
- }
126
86
  }
127
87
  };
128
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createWithPropertiesObjectSet.js","names":["invariant","modernToLegacyWhereClause","derivedPropertyDefinitionFactory","createWithPropertiesObjectSet","objectType","objectSet","definitionMap","fromBaseObjectSet","pivotTo","link","type","where","clause","aggregate","aggregation","opt","splitAggregation","split","length","process","env","NODE_ENV","aggregationPropertyName","aggregationOperation","aggregationOperationDefinition","selectedPropertyApiName","approximatePercentile","percentile","limit","undefined","wrappedObjectSet","operation","selectorResult","set","selectProperty","name","apiName","constant","double","integer","long","datetime","timestamp"],"sources":["createWithPropertiesObjectSet.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty, ObjectOrInterfaceDefinition } from \"@osdk/api\";\nimport type {\n DerivedPropertyDefinition,\n ObjectSet as WireObjectSet,\n SelectedPropertyOperation,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { derivedPropertyDefinitionFactory } from \"./derivedPropertyDefinitionFactory.js\";\n\ntype WithConstSelect<Q extends ObjectOrInterfaceDefinition> =\n & DerivedProperty.SelectPropertyBuilder<Q, false>\n & {\n constant: DerivedProperty.Builder<Q, true>[\"constant\"];\n };\n\n/** @internal */\nexport function createWithPropertiesObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n>(\n objectType: Q,\n objectSet: WireObjectSet,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n fromBaseObjectSet: boolean = false,\n): WithConstSelect<Q> {\n return {\n pivotTo: (link) => {\n return createWithPropertiesObjectSet(objectType, {\n type: \"searchAround\",\n objectSet,\n link,\n }, definitionMap);\n },\n where: (clause) => {\n return createWithPropertiesObjectSet(objectType, {\n type: \"filter\",\n objectSet: objectSet,\n where: modernToLegacyWhereClause(clause, objectType),\n }, definitionMap);\n },\n aggregate: (aggregation: string, opt: any) => {\n const splitAggregation = aggregation.split(\":\");\n invariant(\n splitAggregation.length === 2 || splitAggregation[0] === \"$count\",\n \"Invalid aggregation format\",\n );\n const [aggregationPropertyName, aggregationOperation] = splitAggregation;\n let aggregationOperationDefinition: SelectedPropertyOperation;\n switch (aggregationOperation) {\n case \"sum\":\n case \"avg\":\n case \"min\":\n case \"max\":\n case \"exactDistinct\":\n case \"approximateDistinct\":\n aggregationOperationDefinition = {\n type: aggregationOperation,\n selectedPropertyApiName: aggregationPropertyName,\n };\n break;\n case \"approximatePercentile\":\n aggregationOperationDefinition = {\n type: \"approximatePercentile\",\n selectedPropertyApiName: aggregationPropertyName,\n approximatePercentile: opt?.percentile ?? .5,\n };\n break;\n case \"collectSet\":\n case \"collectList\":\n aggregationOperationDefinition = {\n type: aggregationOperation,\n selectedPropertyApiName: aggregationPropertyName,\n limit: opt?.limit ?? 100,\n };\n break;\n case undefined:\n if (aggregationPropertyName === \"$count\") {\n aggregationOperationDefinition = {\n type: \"count\",\n };\n break;\n }\n default:\n invariant(\n false,\n \"Invalid aggregation operation \" + aggregationOperation,\n );\n }\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"selection\",\n objectSet: objectSet,\n operation: aggregationOperationDefinition,\n };\n const selectorResult: DerivedProperty.Definition<any, any> =\n derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n },\n selectProperty: (name) => {\n if (fromBaseObjectSet) {\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"property\",\n apiName: name,\n };\n const selectorResult: DerivedProperty.Definition<any, any> =\n derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n }\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"selection\",\n objectSet: objectSet,\n operation: {\n type: \"get\",\n selectedPropertyApiName: name,\n },\n };\n const selectorResult: DerivedProperty.Definition<any, any> =\n derivedPropertyDefinitionFactory(wrappedObjectSet, definitionMap);\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n },\n constant: {\n double: (value) => {\n invariant(false, \"Not supported\");\n },\n integer: (value) => {\n invariant(false, \"Not supported\");\n },\n long: (value) => {\n invariant(false, \"Not supported\");\n },\n datetime: (value) => {\n invariant(false, \"Not supported\");\n },\n timestamp: (value) => {\n invariant(false, \"Not supported\");\n },\n },\n };\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MACvB;MACA,MAAMF,gBAA2C,GAAG;QAClDpB,IAAI,EAAE,WAAW;QACjBL,SAAS,EAAEA,SAAS;QACpB0B,SAAS,EAAE;UACTrB,IAAI,EAAE,KAAK;UACXe,uBAAuB,EAAEU;QAC3B;MACF,CAAC;MACD,MAAMH,cAAoD,GACxD9B,gCAAgC,CAAC4B,gBAAgB,EAAExB,aAAa,CAAC;MACnEA,aAAa,CAAC2B,GAAG,CAACD,cAAc,EAAEF,gBAAgB,CAAC;MACnD,OAAOE,cAAc;IACvB,CAAC;IACDK,QAAQ,EAAE;MACRC,MAAM,EAAEA,CAAA,KAAW;QACjBnB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAArB,SAAS,QAAQ,eAAe,IAAhCA,SAAS;MACX,CAAC;MACDuC,OAAO,EAAEA,CAAA,KAAW;QAClBpB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAArB,SAAS,QAAQ,eAAe,IAAhCA,SAAS;MACX,CAAC;MACDwC,IAAI,EAAEA,CAAA,KAAW;QACfrB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAArB,SAAS,QAAQ,eAAe,IAAhCA,SAAS;MACX,CAAC;MACDyC,QAAQ,EAAEA,CAAA,KAAW;QACnBtB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAArB,SAAS,QAAQ,eAAe,IAAhCA,SAAS;MACX,CAAC;MACD0C,SAAS,EAAEA,CAAA,KAAW;QACpBvB,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAArB,SAAS,QAAQ,eAAe,IAAhCA,SAAS;MACX;IACF;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"file":"createWithPropertiesObjectSet.js","names":["invariant","modernToLegacyWhereClause","createWithPropertiesObjectSet","objectType","objectSet","definitionMap","fromBaseObjectSet","pivotTo","link","type","where","clause","aggregate","aggregation","opt","splitAggregation","split","length","process","env","NODE_ENV","aggregationPropertyName","aggregationOperation","aggregationOperationDefinition","selectedPropertyApiName","approximatePercentile","percentile","limit","undefined","wrappedObjectSet","operation","selectorResult","set"],"sources":["createWithPropertiesObjectSet.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty, ObjectOrInterfaceDefinition } from \"@osdk/api\";\nimport type {\n DerivedPropertyDefinition,\n ObjectSet as WireObjectSet,\n SelectedPropertyOperation,\n} from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\n\ntype WithConstSelect<Q extends ObjectOrInterfaceDefinition> =\n DerivedProperty.AggregateBuilder<Q, false>;\n\n/** @internal */\nexport function createWithPropertiesObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n>(\n objectType: Q,\n objectSet: WireObjectSet,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n fromBaseObjectSet: boolean = false,\n): WithConstSelect<Q> {\n return {\n pivotTo: (link) => {\n return createWithPropertiesObjectSet(objectType, {\n type: \"searchAround\",\n objectSet,\n link,\n }, definitionMap);\n },\n where: (clause) => {\n return createWithPropertiesObjectSet(objectType, {\n type: \"filter\",\n objectSet: objectSet,\n where: modernToLegacyWhereClause(clause, objectType),\n }, definitionMap);\n },\n aggregate: (aggregation: string, opt: any) => {\n const splitAggregation = aggregation.split(\":\");\n invariant(\n splitAggregation.length === 2 || splitAggregation[0] === \"$count\",\n \"Invalid aggregation format\",\n );\n const [aggregationPropertyName, aggregationOperation] = splitAggregation;\n let aggregationOperationDefinition: SelectedPropertyOperation;\n switch (aggregationOperation) {\n case \"sum\":\n case \"avg\":\n case \"min\":\n case \"max\":\n case \"exactDistinct\":\n case \"approximateDistinct\":\n aggregationOperationDefinition = {\n type: aggregationOperation,\n selectedPropertyApiName: aggregationPropertyName,\n };\n break;\n case \"approximatePercentile\":\n aggregationOperationDefinition = {\n type: \"approximatePercentile\",\n selectedPropertyApiName: aggregationPropertyName,\n approximatePercentile: opt?.percentile ?? .5,\n };\n break;\n case \"collectSet\":\n case \"collectList\":\n aggregationOperationDefinition = {\n type: aggregationOperation,\n selectedPropertyApiName: aggregationPropertyName,\n limit: opt?.limit ?? 100,\n };\n break;\n case undefined:\n if (aggregationPropertyName === \"$count\") {\n aggregationOperationDefinition = {\n type: \"count\",\n };\n break;\n }\n default:\n invariant(\n false,\n \"Invalid aggregation operation \" + aggregationOperation,\n );\n }\n const wrappedObjectSet: DerivedPropertyDefinition = {\n type: \"selection\",\n objectSet: objectSet,\n operation: aggregationOperationDefinition,\n };\n const selectorResult = {} as DerivedProperty.Definition<any, any>;\n definitionMap.set(selectorResult, wrappedObjectSet);\n return selectorResult as any;\n },\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,yBAAyB,QAAQ,sDAAsD;AAKhG;AACA,OAAO,SAASC,6BAA6BA,CAG3CC,UAAa,EACbC,SAAwB,EACxBC,aAAkD,EAClDC,iBAA0B,GAAG,KAAK,EACd;EACpB,OAAO;IACLC,OAAO,EAAGC,IAAI,IAAK;MACjB,OAAON,6BAA6B,CAACC,UAAU,EAAE;QAC/CM,IAAI,EAAE,cAAc;QACpBL,SAAS;QACTI;MACF,CAAC,EAAEH,aAAa,CAAC;IACnB,CAAC;IACDK,KAAK,EAAGC,MAAM,IAAK;MACjB,OAAOT,6BAA6B,CAACC,UAAU,EAAE;QAC/CM,IAAI,EAAE,QAAQ;QACdL,SAAS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AA,oBAAApB,SAAS,QAEP,gCAAgC,GAAGsB,oBAAoB,IAFzDtB,SAAS;MAIb;MACA,MAAM6B,gBAA2C,GAAG;QAClDpB,IAAI,EAAE,WAAW;QACjBL,SAAS,EAAEA,SAAS;QACpB0B,SAAS,EAAEP;MACb,CAAC;MACD,MAAMQ,cAAc,GAAG,CAAC,CAAyC;MACjE1B,aAAa,CAAC2B,GAAG,CAACD,cAAc,EAAEF,gBAAgB,CAAC;MACnD,OAAOE,cAAc;IACvB;EACF,CAAC;AACH","ignoreList":[]}
@@ -24,39 +24,23 @@ describe(createWithPropertiesObjectSet, () => {
24
24
  type: "methodInput"
25
25
  }, map);
26
26
  const result = {
27
- "derivedPropertyName": base => base.pivotTo("lead").selectProperty("employeeId")
27
+ "derivedPropertyName": base => base.pivotTo("lead").aggregate("employeeId:avg")
28
28
  }["derivedPropertyName"](deriveObjectSet);
29
29
  const definition = map.get(result);
30
30
  expect(definition).toMatchInlineSnapshot(`
31
- {
31
+ {
32
+ "objectSet": {
33
+ "link": "lead",
32
34
  "objectSet": {
33
- "link": "lead",
34
- "objectSet": {
35
- "type": "methodInput",
36
- },
37
- "type": "searchAround",
35
+ "type": "methodInput",
38
36
  },
39
- "operation": {
40
- "selectedPropertyApiName": "employeeId",
41
- "type": "get",
42
- },
43
- "type": "selection",
44
- }
45
- `);
46
- });
47
- it("correctly allows select property off the base object set", () => {
48
- const map = new Map();
49
- const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
50
- type: "methodInput"
51
- }, map, true);
52
- const result = {
53
- "derivedPropertyName": base => base.selectProperty("employeeId")
54
- }["derivedPropertyName"](deriveObjectSet);
55
- const definition = map.get(result);
56
- expect(definition).toMatchInlineSnapshot(`
57
- {
58
- "apiName": "employeeId",
59
- "type": "property",
37
+ "type": "searchAround",
38
+ },
39
+ "operation": {
40
+ "selectedPropertyApiName": "employeeId",
41
+ "type": "avg",
42
+ },
43
+ "type": "selection",
60
44
  }
61
45
  `);
62
46
  });
@@ -112,122 +96,5 @@ describe(createWithPropertiesObjectSet, () => {
112
96
  }
113
97
  `);
114
98
  });
115
- describe("expressions", () => {
116
- it("can handle expressions referencing other property keys", () => {
117
- const map = new Map();
118
- const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
119
- type: "methodInput"
120
- }, map, true);
121
- const result = {
122
- "derivedPropertyName": base => base.pivotTo("lead").selectProperty("employeeId").add(base.selectProperty("employeeId"))
123
- // "secondaryDerivedPropertyName": (base) =>
124
- // base.pivotTo("lead").aggregate("employeeId:avg").divide("employeeId", 2),
125
- }["derivedPropertyName"](deriveObjectSet);
126
- const definition = map.get(result);
127
- expect(definition).toMatchInlineSnapshot(`
128
- {
129
- "properties": [
130
- {
131
- "objectSet": {
132
- "link": "lead",
133
- "objectSet": {
134
- "type": "methodInput",
135
- },
136
- "type": "searchAround",
137
- },
138
- "operation": {
139
- "selectedPropertyApiName": "employeeId",
140
- "type": "get",
141
- },
142
- "type": "selection",
143
- },
144
- {
145
- "apiName": "employeeId",
146
- "type": "property",
147
- },
148
- ],
149
- "type": "add",
150
- }
151
- `);
152
- });
153
-
154
- // TODO: Add test for literal
155
- it("can handle nested definitions in an expression", () => {
156
- const map = new Map();
157
- const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
158
- type: "methodInput"
159
- }, map);
160
- const result = {
161
- "derivedPropertyName": base => base.pivotTo("lead").selectProperty("employeeId").add(base.pivotTo("lead").selectProperty("employeeId"))
162
- }["derivedPropertyName"](deriveObjectSet);
163
- const definition = map.get(result);
164
- expect(definition).toMatchInlineSnapshot(`
165
- {
166
- "properties": [
167
- {
168
- "objectSet": {
169
- "link": "lead",
170
- "objectSet": {
171
- "type": "methodInput",
172
- },
173
- "type": "searchAround",
174
- },
175
- "operation": {
176
- "selectedPropertyApiName": "employeeId",
177
- "type": "get",
178
- },
179
- "type": "selection",
180
- },
181
- {
182
- "objectSet": {
183
- "link": "lead",
184
- "objectSet": {
185
- "type": "methodInput",
186
- },
187
- "type": "searchAround",
188
- },
189
- "operation": {
190
- "selectedPropertyApiName": "employeeId",
191
- "type": "get",
192
- },
193
- "type": "selection",
194
- },
195
- ],
196
- "type": "add",
197
- }
198
- `);
199
- });
200
- });
201
- it("handles datetime expressions", () => {
202
- const map = new Map();
203
- const deriveObjectSet = createWithPropertiesObjectSet(Employee, {
204
- type: "methodInput"
205
- }, map);
206
- const result = {
207
- "derivedPropertyName": base => base.pivotTo("lead").selectProperty("startDate").extractPart("MONTHS"),
208
- "secondaryDerivedPropertyName": base => base.pivotTo("lead").selectProperty("startDate").min(base.pivotTo("lead").selectProperty("startDate"))
209
- }["derivedPropertyName"](deriveObjectSet);
210
- const definition = map.get(result);
211
- expect(definition).toMatchInlineSnapshot(`
212
- {
213
- "part": "MONTHS",
214
- "property": {
215
- "objectSet": {
216
- "link": "lead",
217
- "objectSet": {
218
- "type": "methodInput",
219
- },
220
- "type": "searchAround",
221
- },
222
- "operation": {
223
- "selectedPropertyApiName": "startDate",
224
- "type": "get",
225
- },
226
- "type": "selection",
227
- },
228
- "type": "extract",
229
- }
230
- `);
231
- });
232
99
  });
233
100
  //# sourceMappingURL=createWithPropertiesObjectSet.test.js.map
@@ -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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CAACL,eAAe,CAAC;IAC7D,MAAMM,UAAU,GAAGR,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","aggregate","definition","get","toMatchInlineSnapshot","clause","percentile","limit","secondResult","secondDefinition"],"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\").aggregate(\"employeeId:avg\"),\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\": \"avg\",\n },\n \"type\": \"selection\",\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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,CAAC,qBAAqB,EAAE;QACpDM,KAAK,EAAE;MACT,CAAC;IACL,CAAC;IAED,MAAMT,MAAM,GAAGO,MAAM,CAAC,qBAAqB,CAAC,CAACT,eAAe,CAAC;IAC7D,MAAMM,UAAU,GAAGR,GAAG,CAACS,GAAG,CAACL,MAAM,CAAC;IAElC,MAAMU,YAAY,GAAGH,MAAM,CAAC,8BAA8B,CAAC,CACzDT,eACF,CAAC;IACD,MAAMa,gBAAgB,GAAGf,GAAG,CAACS,GAAG,CAACK,YAAY,CAAC;IAE9CjB,MAAM,CAACW,UAAU,CAAC,CAACE,qBAAqB,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IAEJb,MAAM,CAACkB,gBAAgB,CAAC,CAACL,qBAAqB,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;EACN,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.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\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n InterfaceDefinition,\n Logger,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqCA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAGrE,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.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\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n InterfaceDefinition,\n Logger,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectCreatePropertyType,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsCA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAGrE,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B","ignoreList":[]}
@@ -55,7 +55,7 @@ export function resolveInterfaceObjectSet(objectSet, interfaceTypeApiName, args)
55
55
  }]
56
56
  } : objectSet;
57
57
  }
58
- async function fetchInterfacePage(client, interfaceType, args, objectSet) {
58
+ async function fetchInterfacePage(client, interfaceType, args, objectSet, useSnapshot = false) {
59
59
  if (args.$__UNSTABLE_useOldInterfaceApis) {
60
60
  const result = await OntologiesV2.OntologyInterfaces.search(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
61
61
  augmentedProperties: {},
@@ -75,7 +75,8 @@ async function fetchInterfacePage(client, interfaceType, args, objectSet) {
75
75
  const result = await OntologiesV2.OntologyObjectSets.loadMultipleObjectTypes(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, applyFetchArgs(args, {
76
76
  objectSet: resolveInterfaceObjectSet(objectSet, interfaceType.apiName, args),
77
77
  select: args?.$select ?? [],
78
- excludeRid: !args?.$includeRid
78
+ excludeRid: !args?.$includeRid,
79
+ snapshot: useSnapshot
79
80
  }), {
80
81
  preview: true
81
82
  });
@@ -87,11 +88,11 @@ async function fetchInterfacePage(client, interfaceType, args, objectSet) {
87
88
  }
88
89
 
89
90
  /** @internal */
90
- export async function fetchPageInternal(client, objectType, objectSet, args = {}) {
91
+ export async function fetchPageInternal(client, objectType, objectSet, args = {}, useSnapshot = false) {
91
92
  if (objectType.type === "interface") {
92
- return await fetchInterfacePage(client, objectType, args, objectSet); // fixme
93
+ return await fetchInterfacePage(client, objectType, args, objectSet, useSnapshot); // fixme
93
94
  } else {
94
- return await fetchObjectPage(client, objectType, args, objectSet); // fixme
95
+ return await fetchObjectPage(client, objectType, args, objectSet, useSnapshot); // fixme
95
96
  }
96
97
  }
97
98
 
@@ -149,13 +150,14 @@ function applyFetchArgs(args, body) {
149
150
  }
150
151
 
151
152
  /** @internal */
152
- export async function fetchObjectPage(client, objectType, args, objectSet) {
153
+ export async function fetchObjectPage(client, objectType, args, objectSet, useSnapshot = false) {
153
154
  const r = await OntologiesV2.OntologyObjectSets.load(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
154
155
  objectSet,
155
156
  // We have to do the following case because LoadObjectSetRequestV2 isn't readonly
156
157
  select: args?.$select ?? [],
157
158
  // FIXME?
158
- excludeRid: !args?.$includeRid
159
+ excludeRid: !args?.$includeRid,
160
+ snapshot: useSnapshot
159
161
  }));
160
162
  return Promise.resolve({
161
163
  data: await client.objectFactory(client, r.data, undefined, undefined, await extractRdpDefinition(client, objectSet), args.$select),