@osdk/client 2.1.0-beta.2 → 2.1.0-beta.20

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 (248) hide show
  1. package/CHANGELOG.md +276 -0
  2. package/build/browser/Client.d.ts +8 -21
  3. package/build/browser/Client.d.ts.map +1 -1
  4. package/build/browser/Client.js +2 -1
  5. package/build/browser/Client.js.map +1 -1
  6. package/build/browser/MinimalClientContext.d.ts +1 -1
  7. package/build/browser/MinimalClientContext.d.ts.map +1 -1
  8. package/build/browser/__unstable/ConjureSupport.js +5 -5
  9. package/build/browser/__unstable/ConjureSupport.js.map +1 -1
  10. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
  11. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
  12. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js +2 -2
  13. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
  14. package/build/browser/actions/actions.test.js +19 -0
  15. package/build/browser/actions/actions.test.js.map +1 -1
  16. package/build/browser/actions/applyAction.js +1 -1
  17. package/build/browser/actions/applyAction.js.map +1 -1
  18. package/build/browser/createClient.d.ts +1 -1
  19. package/build/browser/createClient.d.ts.map +1 -1
  20. package/build/browser/createClient.js +53 -19
  21. package/build/browser/createClient.js.map +1 -1
  22. package/build/browser/createClient.test.js +24 -0
  23. package/build/browser/createClient.test.js.map +1 -1
  24. package/build/browser/createGeotimeSeriesProperty.d.ts +1 -1
  25. package/build/browser/createGeotimeSeriesProperty.d.ts.map +1 -1
  26. package/build/browser/createGeotimeSeriesProperty.js +4 -1
  27. package/build/browser/createGeotimeSeriesProperty.js.map +1 -1
  28. package/build/browser/createMinimalClient.js +9 -4
  29. package/build/browser/createMinimalClient.js.map +1 -1
  30. package/build/browser/createPlatformClient.d.ts +1 -1
  31. package/build/browser/createPlatformClient.d.ts.map +1 -1
  32. package/build/browser/createTimeseriesProperty.d.ts.map +1 -1
  33. package/build/browser/fetchMetadata.test.js +14 -0
  34. package/build/browser/fetchMetadata.test.js.map +1 -1
  35. package/build/browser/index.d.ts +2 -2
  36. package/build/browser/index.d.ts.map +1 -1
  37. package/build/browser/index.js +1 -1
  38. package/build/browser/index.js.map +1 -1
  39. package/build/browser/intellisense.test.js +1 -1
  40. package/build/browser/intellisense.test.js.map +1 -1
  41. package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
  42. package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
  43. package/build/browser/internal/conversions/modernToLegacyWhereClause.js +11 -3
  44. package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  45. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +208 -7
  46. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  47. package/build/browser/object/AttachmentUpload.d.ts.map +1 -1
  48. package/build/browser/object/AttachmentUpload.js +6 -0
  49. package/build/browser/object/AttachmentUpload.js.map +1 -1
  50. package/build/browser/object/aggregate.js +4 -5
  51. package/build/browser/object/aggregate.js.map +1 -1
  52. package/build/browser/object/aggregate.test.js +6 -9
  53. package/build/browser/object/aggregate.test.js.map +1 -1
  54. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
  55. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
  56. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
  57. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  58. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +4 -3
  59. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  60. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +41 -85
  61. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  62. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js +0 -6
  63. package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
  64. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +57 -86
  65. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  66. package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js +2 -2
  67. package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
  68. package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js +14 -38
  69. package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
  70. package/build/browser/object/convertWireToOsdkObjects.js +42 -6
  71. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  72. package/build/browser/object/convertWireToOsdkObjects.test.js +177 -45
  73. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  74. package/build/browser/object/fetchPage.d.ts.map +1 -1
  75. package/build/browser/object/fetchPage.js +34 -23
  76. package/build/browser/object/fetchPage.js.map +1 -1
  77. package/build/browser/object/fetchPage.test.js +75 -1
  78. package/build/browser/object/fetchPage.test.js.map +1 -1
  79. package/build/browser/object/object.test.d.ts.map +1 -1
  80. package/build/browser/object/object.test.js +25 -1
  81. package/build/browser/object/object.test.js.map +1 -1
  82. package/build/browser/object/timeseries.test.js +10 -0
  83. package/build/browser/object/timeseries.test.js.map +1 -1
  84. package/build/browser/objectSet/InterfaceObjectSet.test.d.ts +2 -0
  85. package/build/browser/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
  86. package/build/browser/objectSet/InterfaceObjectSet.test.js +61 -0
  87. package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -0
  88. package/build/browser/objectSet/ObjectSet.test.js +149 -48
  89. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  90. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +136 -74
  91. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  92. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +150 -42
  93. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  94. package/build/browser/objectSet/createObjectSet.js +10 -8
  95. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  96. package/build/browser/objectSet/toConjureObjectSet.js +2 -0
  97. package/build/browser/objectSet/toConjureObjectSet.js.map +1 -1
  98. package/build/browser/ontology/makeConjureContext.d.ts +1 -1
  99. package/build/browser/ontology/makeConjureContext.d.ts.map +1 -1
  100. package/build/browser/queries/applyQuery.d.ts.map +1 -1
  101. package/build/browser/queries/applyQuery.js +1 -2
  102. package/build/browser/queries/applyQuery.js.map +1 -1
  103. package/build/browser/queries/queries.test.js +30 -2
  104. package/build/browser/queries/queries.test.js.map +1 -1
  105. package/build/browser/tsserver.js +1 -1
  106. package/build/browser/tsserver.js.map +1 -1
  107. package/build/browser/util/UserAgent.js +1 -1
  108. package/build/browser/util/UserAgent.js.map +1 -1
  109. package/build/browser/util/datetimeConverters.d.ts +22 -0
  110. package/build/browser/util/datetimeConverters.d.ts.map +1 -0
  111. package/build/browser/util/datetimeConverters.js +55 -0
  112. package/build/browser/util/datetimeConverters.js.map +1 -0
  113. package/build/browser/util/datetimeConverters.test.d.ts +2 -0
  114. package/build/browser/util/datetimeConverters.test.d.ts.map +1 -0
  115. package/build/browser/util/datetimeConverters.test.js +75 -0
  116. package/build/browser/util/datetimeConverters.test.js.map +1 -0
  117. package/build/browser/util/objectSetUtils.d.ts +4 -0
  118. package/build/browser/util/objectSetUtils.d.ts.map +1 -0
  119. package/build/browser/util/objectSetUtils.js +25 -0
  120. package/build/browser/util/objectSetUtils.js.map +1 -0
  121. package/build/browser/util/timeseriesUtils.d.ts +1 -1
  122. package/build/browser/util/timeseriesUtils.d.ts.map +1 -1
  123. package/build/browser/util/timeseriesUtils.js +1 -1
  124. package/build/browser/util/timeseriesUtils.js.map +1 -1
  125. package/build/esm/Client.d.ts +8 -21
  126. package/build/esm/Client.d.ts.map +1 -1
  127. package/build/esm/Client.js +2 -1
  128. package/build/esm/Client.js.map +1 -1
  129. package/build/esm/MinimalClientContext.d.ts +1 -1
  130. package/build/esm/MinimalClientContext.d.ts.map +1 -1
  131. package/build/esm/__unstable/ConjureSupport.js +5 -5
  132. package/build/esm/__unstable/ConjureSupport.js.map +1 -1
  133. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
  134. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
  135. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +2 -2
  136. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
  137. package/build/esm/actions/actions.test.js +19 -0
  138. package/build/esm/actions/actions.test.js.map +1 -1
  139. package/build/esm/actions/applyAction.js +1 -1
  140. package/build/esm/actions/applyAction.js.map +1 -1
  141. package/build/esm/createClient.d.ts +1 -1
  142. package/build/esm/createClient.d.ts.map +1 -1
  143. package/build/esm/createClient.js +53 -19
  144. package/build/esm/createClient.js.map +1 -1
  145. package/build/esm/createClient.test.js +24 -0
  146. package/build/esm/createClient.test.js.map +1 -1
  147. package/build/esm/createGeotimeSeriesProperty.d.ts +1 -1
  148. package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -1
  149. package/build/esm/createGeotimeSeriesProperty.js +4 -1
  150. package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
  151. package/build/esm/createMinimalClient.js +9 -4
  152. package/build/esm/createMinimalClient.js.map +1 -1
  153. package/build/esm/createPlatformClient.d.ts +1 -1
  154. package/build/esm/createPlatformClient.d.ts.map +1 -1
  155. package/build/esm/createTimeseriesProperty.d.ts.map +1 -1
  156. package/build/esm/fetchMetadata.test.js +14 -0
  157. package/build/esm/fetchMetadata.test.js.map +1 -1
  158. package/build/esm/index.d.ts +2 -2
  159. package/build/esm/index.d.ts.map +1 -1
  160. package/build/esm/index.js +1 -1
  161. package/build/esm/index.js.map +1 -1
  162. package/build/esm/intellisense.test.js +1 -1
  163. package/build/esm/intellisense.test.js.map +1 -1
  164. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
  165. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
  166. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +11 -3
  167. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  168. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +208 -7
  169. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  170. package/build/esm/object/AttachmentUpload.d.ts.map +1 -1
  171. package/build/esm/object/AttachmentUpload.js +6 -0
  172. package/build/esm/object/AttachmentUpload.js.map +1 -1
  173. package/build/esm/object/aggregate.js +4 -5
  174. package/build/esm/object/aggregate.js.map +1 -1
  175. package/build/esm/object/aggregate.test.js +6 -9
  176. package/build/esm/object/aggregate.test.js.map +1 -1
  177. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
  178. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
  179. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
  180. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  181. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +4 -3
  182. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  183. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +41 -85
  184. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
  185. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js +0 -6
  186. package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
  187. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +57 -86
  188. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  189. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js +2 -2
  190. package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
  191. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js +14 -38
  192. package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
  193. package/build/esm/object/convertWireToOsdkObjects.js +42 -6
  194. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  195. package/build/esm/object/convertWireToOsdkObjects.test.js +177 -45
  196. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  197. package/build/esm/object/fetchPage.d.ts.map +1 -1
  198. package/build/esm/object/fetchPage.js +34 -23
  199. package/build/esm/object/fetchPage.js.map +1 -1
  200. package/build/esm/object/fetchPage.test.js +75 -1
  201. package/build/esm/object/fetchPage.test.js.map +1 -1
  202. package/build/esm/object/object.test.d.ts.map +1 -1
  203. package/build/esm/object/object.test.js +25 -1
  204. package/build/esm/object/object.test.js.map +1 -1
  205. package/build/esm/object/timeseries.test.js +10 -0
  206. package/build/esm/object/timeseries.test.js.map +1 -1
  207. package/build/esm/objectSet/InterfaceObjectSet.test.d.ts +2 -0
  208. package/build/esm/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
  209. package/build/esm/objectSet/InterfaceObjectSet.test.js +61 -0
  210. package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -0
  211. package/build/esm/objectSet/ObjectSet.test.js +149 -48
  212. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  213. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +136 -77
  214. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  215. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +150 -42
  216. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  217. package/build/esm/objectSet/createObjectSet.js +10 -8
  218. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  219. package/build/esm/objectSet/toConjureObjectSet.js +2 -0
  220. package/build/esm/objectSet/toConjureObjectSet.js.map +1 -1
  221. package/build/esm/ontology/makeConjureContext.d.ts +1 -1
  222. package/build/esm/ontology/makeConjureContext.d.ts.map +1 -1
  223. package/build/esm/queries/applyQuery.d.ts.map +1 -1
  224. package/build/esm/queries/applyQuery.js +1 -2
  225. package/build/esm/queries/applyQuery.js.map +1 -1
  226. package/build/esm/queries/queries.test.js +30 -2
  227. package/build/esm/queries/queries.test.js.map +1 -1
  228. package/build/esm/tsserver.js +1 -1
  229. package/build/esm/tsserver.js.map +1 -1
  230. package/build/esm/util/UserAgent.js +1 -1
  231. package/build/esm/util/UserAgent.js.map +1 -1
  232. package/build/esm/util/datetimeConverters.d.ts +22 -0
  233. package/build/esm/util/datetimeConverters.d.ts.map +1 -0
  234. package/build/esm/util/datetimeConverters.js +55 -0
  235. package/build/esm/util/datetimeConverters.js.map +1 -0
  236. package/build/esm/util/datetimeConverters.test.d.ts +2 -0
  237. package/build/esm/util/datetimeConverters.test.d.ts.map +1 -0
  238. package/build/esm/util/datetimeConverters.test.js +75 -0
  239. package/build/esm/util/datetimeConverters.test.js.map +1 -0
  240. package/build/esm/util/objectSetUtils.d.ts +4 -0
  241. package/build/esm/util/objectSetUtils.d.ts.map +1 -0
  242. package/build/esm/util/objectSetUtils.js +25 -0
  243. package/build/esm/util/objectSetUtils.js.map +1 -0
  244. package/build/esm/util/timeseriesUtils.d.ts +1 -1
  245. package/build/esm/util/timeseriesUtils.d.ts.map +1 -1
  246. package/build/esm/util/timeseriesUtils.js +1 -1
  247. package/build/esm/util/timeseriesUtils.js.map +1 -1
  248. package/package.json +24 -20
@@ -1 +1 @@
1
- {"version":3,"file":"actions.test.js","names":["$Actions","$ontologyRid","actionTakesAttachment","createOffice","moveOffice","apiServer","stubData","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","createAttachmentUpload","ActionValidationError","remapActionResponse","client","listen","close","result","applyAction","officeId","address","capacity","$returnEdits","toEqualTypeOf","toMatchInlineSnapshot","undefinedResult","toBeUndefined","batchApplyAction","toBeCallableWith","newAddress","newCapacity","$validateOnly","fail","e","toBeInstanceOf","validation","toMatchTypeOf","attachment","blob","attachmentUploadRequestBody","localAttachment1","filename","actionResponse","edits","type","deletedLinksCount","deletedObjectsCount","addedObjectCount","modifiedObjectsCount","addedLinksCount","batchActionResponse","remappedActionResponse","remappedBatchActionResponse","actions","Object","keys","toStrictEqual"],"sources":["actions.test.js"],"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 */\nimport { $Actions, $ontologyRid, actionTakesAttachment, createOffice, moveOffice, } from \"@osdk/client.test.ontology\";\nimport { apiServer, stubData } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"../createClient.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\nimport { remapActionResponse } from \"./applyAction.js\";\ndescribe(\"actions\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"conditionally returns the edits\", async () => {\n const result = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }, { $returnEdits: true });\n expectTypeOf().toEqualTypeOf();\n expect(result).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [],\n \"type\": \"edits\",\n }\n `);\n const undefinedResult = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n });\n expectTypeOf().toEqualTypeOf();\n expect(undefinedResult).toBeUndefined();\n const clientCreateOffice = client(createOffice).batchApplyAction;\n expectTypeOf().toBeCallableWith([{\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }], { $returnEdits: true });\n });\n it(\"returns validation directly on validateOnly mode\", async () => {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $validateOnly: true,\n });\n expectTypeOf().toEqualTypeOf();\n expect(result).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n }\n `);\n });\n it(\"throws on validation errors\", async () => {\n try {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $returnEdits: true,\n });\n expect.fail(\"Should not reach here\");\n }\n catch (e) {\n expect(e).toBeInstanceOf(ActionValidationError);\n expect(e.validation).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n }\n `);\n }\n });\n it(\"Accepts attachments\", async () => {\n const clientBoundActionTakesAttachment = client(actionTakesAttachment).applyAction;\n expectTypeOf().toMatchTypeOf();\n const clientBoundBatchActionTakesAttachment = client(actionTakesAttachment).batchApplyAction;\n expectTypeOf().toMatchTypeOf();\n const result = await client(actionTakesAttachment).applyAction({\n attachment: \"attachment.rid\",\n });\n expectTypeOf().toEqualTypeOf();\n expect(result).toBeUndefined();\n });\n it(\"Accepts attachment uploads\", async () => {\n const clientBoundActionTakesAttachment = client(actionTakesAttachment).applyAction;\n const clientBoundBatchActionTakesAttachment = client(actionTakesAttachment).batchApplyAction;\n expectTypeOf().toMatchTypeOf();\n expectTypeOf().toMatchTypeOf();\n const blob = stubData.attachmentUploadRequestBody[stubData.localAttachment1.filename];\n const attachment = createAttachmentUpload(blob, \"file1.txt\");\n const result = await client(actionTakesAttachment).applyAction({\n attachment,\n });\n expectTypeOf().toEqualTypeOf();\n expect(result).toBeUndefined();\n });\n it(\"conditionally returns edits in batch mode\", async () => {\n const result = await client(moveOffice).batchApplyAction([\n {\n officeId: \"SEA\",\n newAddress: \"456 Good Place\",\n newCapacity: 40,\n },\n {\n officeId: \"NYC\",\n newAddress: \"123 Main Street\",\n newCapacity: 80,\n },\n ], { $returnEdits: true });\n expect(result).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"SEA\",\n },\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n });\n});\ndescribe(\"ActionResponse remapping\", () => {\n const actionResponse = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 0,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n const batchActionResponse = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 0,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n it(\"Correctly unpacks edits and editedObjectTypes\", () => {\n const remappedActionResponse = remapActionResponse(actionResponse);\n const remappedBatchActionResponse = remapActionResponse(batchActionResponse);\n expect(remappedActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n expect(remappedBatchActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n });\n it(\"actions are enumerable\", async () => {\n const actions = Object.keys($Actions);\n expect(actions).toStrictEqual([\n \"actionTakesAttachment\",\n \"actionTakesObjectSet\",\n \"createOffice\",\n \"createOfficeAndEmployee\",\n \"moveOffice\",\n \"promoteEmployee\",\n \"promoteEmployeeObject\",\n ]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,qBAAqB,EAAEC,YAAY,EAAEC,UAAU,QAAS,4BAA4B;AACrH,SAASC,SAAS,EAAEC,QAAQ,QAAQ,mBAAmB;AACvD,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,mBAAmB,QAAQ,kBAAkB;AACtDP,QAAQ,CAAC,SAAS,EAAE,MAAM;EACtB,IAAIQ,MAAM;EACVT,SAAS,CAAC,YAAY;IAClBH,SAAS,CAACa,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGJ,YAAY,CAAC,4BAA4B,EAAEZ,YAAY,EAAE,YAAY,eAAe,CAAC;EAClG,CAAC,CAAC;EACFM,QAAQ,CAAC,MAAM;IACXF,SAAS,CAACc,KAAK,CAAC,CAAC;EACrB,CAAC,CAAC;EACFP,EAAE,CAAC,iCAAiC,EAAE,YAAY;IAC9C,MAAMQ,MAAM,GAAG,MA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AmB,CAAC6B,cAAc,CAAC;IAClE,MAAMU,2BAA2B,GAAGvC,mBAAmB,CAACqC,mBAAmB,CAAC;IAC5E3C,MAAM,CAAC4C,sBAAsB,CAAC,CAAC3B,qBAAqB,CAAC;AAC7D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;IACEjB,MAAM,CAAC6C,2BAA2B,CAAC,CAAC5B,qBAAqB,CAAC;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFf,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACrC,MAAM4C,OAAO,GAAGC,MAAM,CAACC,IAAI,CAAC1D,QAAQ,CAAC;IACrCU,MAAM,CAAC8C,OAAO,CAAC,CAACG,aAAa,CAAC,CAC1B,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,CAC1B,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"actions.test.js","names":["$Actions","$ontologyRid","actionTakesAttachment","createOffice","moveOffice","apiServer","stubData","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","createAttachmentUpload","ActionValidationError","remapActionResponse","client","customEntryPointClient","listen","close","result","applyAction","officeId","address","capacity","$returnEdits","toEqualTypeOf","toMatchInlineSnapshot","undefinedResult","toBeUndefined","batchApplyAction","toBeCallableWith","newAddress","newCapacity","$validateOnly","fail","e","toBeInstanceOf","validation","toMatchTypeOf","attachment","blob","attachmentUploadRequestBody","localAttachment1","filename","actionResponse","edits","type","deletedLinksCount","deletedObjectsCount","addedObjectCount","modifiedObjectsCount","addedLinksCount","batchActionResponse","remappedActionResponse","remappedBatchActionResponse","actions","Object","keys","toStrictEqual"],"sources":["actions.test.js"],"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 */\nimport { $Actions, $ontologyRid, actionTakesAttachment, createOffice, moveOffice, } from \"@osdk/client.test.ontology\";\nimport { apiServer, stubData } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"../createClient.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\nimport { remapActionResponse } from \"./applyAction.js\";\ndescribe(\"actions\", () => {\n let client;\n let customEntryPointClient;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n customEntryPointClient = createClient(\"https://stack.palantirCustom.com/foo/first/someStuff\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"conditionally returns the edits\", async () => {\n const result = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }, { $returnEdits: true });\n expectTypeOf().toEqualTypeOf();\n expect(result).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [],\n \"type\": \"edits\",\n }\n `);\n const undefinedResult = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n });\n expectTypeOf().toEqualTypeOf();\n expect(undefinedResult).toBeUndefined();\n const clientCreateOffice = client(createOffice).batchApplyAction;\n expectTypeOf().toBeCallableWith([{\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }], { $returnEdits: true });\n });\n it(\"returns validation directly on validateOnly mode\", async () => {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $validateOnly: true,\n });\n expectTypeOf().toEqualTypeOf();\n expect(result).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n }\n `);\n });\n it(\"returns validation directly on validateOnly mode, with custom entry point in URL\", async () => {\n const result = await customEntryPointClient(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $validateOnly: true,\n });\n expectTypeOf().toEqualTypeOf();\n expect(result).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n }\n `);\n });\n it(\"throws on validation errors\", async () => {\n try {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $returnEdits: true,\n });\n expect.fail(\"Should not reach here\");\n }\n catch (e) {\n expect(e).toBeInstanceOf(ActionValidationError);\n expect(e.validation).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n }\n `);\n }\n });\n it(\"Accepts attachments\", async () => {\n const clientBoundActionTakesAttachment = client(actionTakesAttachment).applyAction;\n expectTypeOf().toMatchTypeOf();\n const clientBoundBatchActionTakesAttachment = client(actionTakesAttachment).batchApplyAction;\n expectTypeOf().toMatchTypeOf();\n const result = await client(actionTakesAttachment).applyAction({\n attachment: \"attachment.rid\",\n });\n expectTypeOf().toEqualTypeOf();\n expect(result).toBeUndefined();\n });\n it(\"Accepts attachment uploads\", async () => {\n const clientBoundActionTakesAttachment = client(actionTakesAttachment).applyAction;\n const clientBoundBatchActionTakesAttachment = client(actionTakesAttachment).batchApplyAction;\n expectTypeOf().toMatchTypeOf();\n expectTypeOf().toMatchTypeOf();\n const blob = stubData.attachmentUploadRequestBody[stubData.localAttachment1.filename];\n const attachment = createAttachmentUpload(blob, \"file1.txt\");\n const result = await client(actionTakesAttachment).applyAction({\n attachment,\n });\n expectTypeOf().toEqualTypeOf();\n expect(result).toBeUndefined();\n });\n it(\"conditionally returns edits in batch mode\", async () => {\n const result = await client(moveOffice).batchApplyAction([\n {\n officeId: \"SEA\",\n newAddress: \"456 Good Place\",\n newCapacity: 40,\n },\n {\n officeId: \"NYC\",\n newAddress: \"123 Main Street\",\n newCapacity: 80,\n },\n ], { $returnEdits: true });\n expect(result).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"SEA\",\n },\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n });\n});\ndescribe(\"ActionResponse remapping\", () => {\n const actionResponse = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 0,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n const batchActionResponse = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 0,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n it(\"Correctly unpacks edits and editedObjectTypes\", () => {\n const remappedActionResponse = remapActionResponse(actionResponse);\n const remappedBatchActionResponse = remapActionResponse(batchActionResponse);\n expect(remappedActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n expect(remappedBatchActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n });\n it(\"actions are enumerable\", async () => {\n const actions = Object.keys($Actions);\n expect(actions).toStrictEqual([\n \"actionTakesAttachment\",\n \"actionTakesObjectSet\",\n \"createOffice\",\n \"createOfficeAndEmployee\",\n \"moveOffice\",\n \"promoteEmployee\",\n \"promoteEmployeeObject\",\n ]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,qBAAqB,EAAEC,YAAY,EAAEC,UAAU,QAAS,4BAA4B;AACrH,SAASC,SAAS,EAAEC,QAAQ,QAAQ,mBAAmB;AACvD,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,mBAAmB,QA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ACA;AACA;AACA,KAAK,CAAC;IACElB,MAAM,CAAC8C,2BAA2B,CAAC,CAAC5B,qBAAqB,CAAC;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACF,CAAC,CAAC;EACFhB,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACrC,MAAM6C,OAAO,GAAGC,MAAM,CAACC,IAAI,CAAC3D,QAAQ,CAAC;IACrCU,MAAM,CAAC+C,OAAO,CAAC,CAACG,aAAa,CAAC,CAC1B,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,yBAAyB,EACzB,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,CAC1B,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -104,7 +104,7 @@ export function remapActionResponse(response) {
104
104
  });
105
105
  editedObjectTypesSet.add(edit.objectType);
106
106
  } else {
107
- invariant(false, "Unknown edit type");
107
+ process.env.NODE_ENV !== "production" ? invariant(false, "Unknown edit type") : invariant(false);
108
108
  }
109
109
  }
110
110
  remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];
@@ -1 +1 @@
1
- {"version":3,"file":"applyAction.js","names":["OntologiesV2","invariant","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","returnEdits","$returnEdits","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","addedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","push","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","add","objectType","primaryKey"],"sources":["applyAction.js"],"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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\nexport async function applyAction(client, action, parameters, options = {}) {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })), action);\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(clientWithHeaders, await client.ontologyRid, action.apiName, {\n requests: parameters\n ? await remapBatchActionParams(parameters, client)\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n });\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined);\n }\n else {\n const response = await OntologiesV2.Actions.apply(clientWithHeaders, await client.ontologyRid, action.apiName, {\n parameters: await remapActionParams(parameters, client),\n options: {\n mode: options?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL\"\n : \"NONE\",\n },\n });\n if (options?.$validateOnly) {\n return response.validation;\n }\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined);\n }\n}\nasync function remapActionParams(params, client) {\n if (params == null) {\n return {};\n }\n const parameterMap = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client);\n }\n return parameterMap;\n}\nasync function remapBatchActionParams(params, client) {\n const remappedParams = await Promise.all(params.map(async (param) => {\n return { parameters: await remapActionParams(param, client) };\n }));\n return remappedParams;\n}\nexport function remapActionResponse(response) {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n addedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n const editedObjectTypesSet = new Set();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\") {\n remappedActionResponse.addedLinks.push({\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n });\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n }\n else if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push({\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n });\n editedObjectTypesSet.add(edit.objectType);\n }\n else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push({\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n });\n editedObjectTypesSet.add(edit.objectType);\n }\n else {\n invariant(false, \"Unknown edit type\");\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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GAAG,CAACN,IAAI,CAACO,UAAU,CAAC;MAC7C,CAAC,MACI,IAAIP,IAAI,CAAC9B,IAAI,KAAK,cAAc,EAAE;QACnCqB,sBAAsB,CAACK,eAAe,CAACK,IAAI,CAAC;UACxCM,UAAU,EAAEP,IAAI,CAACO,UAAU;UAC3BC,UAAU,EAAER,IAAI,CAACQ;QACrB,CAAC,CAAC;QACFV,oBAAoB,CAACQ,GAAG,CAACN,IAAI,CAACO,UAAU,CAAC;MAC7C,CAAC,MACI;QACD7D,SAAS,QAAQ,mBAAmB;MACxC;IACJ;IACA6C,sBAAsB,CAACM,iBAAiB,GAAG,CAAC,GAAGC,oBAAoB,CAAC;IACpE,OAAOP,sBAAsB;EACjC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"applyAction.js","names":["OntologiesV2","invariant","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","returnEdits","$returnEdits","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","addedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","push","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","add","objectType","primaryKey","process","env","NODE_ENV"],"sources":["applyAction.js"],"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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\nexport async function applyAction(client, action, parameters, options = {}) {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })), action);\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(clientWithHeaders, await client.ontologyRid, action.apiName, {\n requests: parameters\n ? await remapBatchActionParams(parameters, client)\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n });\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined);\n }\n else {\n const response = await OntologiesV2.Actions.apply(clientWithHeaders, await client.ontologyRid, action.apiName, {\n parameters: await remapActionParams(parameters, client),\n options: {\n mode: options?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL\"\n : \"NONE\",\n },\n });\n if (options?.$validateOnly) {\n return response.validation;\n }\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined);\n }\n}\nasync function remapActionParams(params, client) {\n if (params == null) {\n return {};\n }\n const parameterMap = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client);\n }\n return parameterMap;\n}\nasync function remapBatchActionParams(params, client) {\n const remappedParams = await Promise.all(params.map(async (param) => {\n return { parameters: await remapActionParams(param, client) };\n }));\n return remappedParams;\n}\nexport function remapActionResponse(response) {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n addedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n const editedObjectTypesSet = new Set();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\") {\n remappedActionResponse.addedLinks.push({\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n });\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n }\n else if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push({\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n });\n editedObjectTypesSet.add(edit.objectType);\n }\n else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push({\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n });\n editedObjectTypesSet.add(edit.objectType);\n }\n else {\n invariant(false, \"Unknown edit type\");\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;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,OAAO,eAAeC,WAAWA,CAACC,MAAM,EAAEC,MAAM,EAAEC,UAAU,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAE;EACxE,MAAMC,iBAAiB,G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Q,mBAAmB,IAApCA,SAAS;MACb;IACJ;IACA6C,sBAAsB,CAACM,iBAAiB,GAAG,CAAC,GAAGC,oBAAoB,CAAC;IACpE,OAAOP,sBAAsB;EACjC;AACJ","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { Client } from "./Client.js";
1
+ import { type Client } from "./Client.js";
2
2
  import type { Logger } from "./Logger.js";
3
3
  export declare const createClient: (baseUrl: string, ontologyRid: string | Promise<string>, tokenProvider: () => Promise<string>, options?: {
4
4
  logger?: Logger;
@@ -1 +1 @@
1
- {"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../src/createClient.ts"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAqJ1C,eAAO,MAAM,YAAY,gFAzGF,OAAO,CAAC,MAAM,CAAC;aAChB,MAAM;4DA2G3B,CAAC"}
1
+ {"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../src/createClient.ts"],"names":[],"mappings":"AA6CA,OAAO,EAAqB,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAG7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAoN1C,eAAO,MAAM,YAAY,gFApKF,OAAO,CAAC,MAAM,CAAC;aAChB,MAAM;4DAsK3B,CAAC"}
@@ -13,13 +13,17 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet } from "@osdk/api/unstable";
17
- import { symbolClientContext } from "@osdk/shared.client";
16
+ import { __EXPERIMENTAL__NOT_SUPPORTED_YET__createTemporaryObjectSet, __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe } from "@osdk/api/unstable";
17
+ import { OntologyObjectSets } from "@osdk/internal.foundry.ontologiesv2";
18
+ import { symbolClientContext as oldSymbolClientContext } from "@osdk/shared.client";
19
+ import { symbolClientContext } from "@osdk/shared.client2";
18
20
  import { createBulkLinksAsyncIterFactory } from "./__unstable/createBulkLinksAsyncIterFactory.js";
19
21
  import { applyAction } from "./actions/applyAction.js";
22
+ import { additionalContext } from "./Client.js";
20
23
  import { createMinimalClient } from "./createMinimalClient.js";
21
24
  import { fetchMetadataInternal } from "./fetchMetadata.js";
22
- import { createObjectSet } from "./objectSet/createObjectSet.js";
25
+ import { createObjectSet, getWireObjectSet } from "./objectSet/createObjectSet.js";
26
+ import { ObjectSetListenerWebsocket } from "./objectSet/ObjectSetListenerWebsocket.js";
23
27
  import { applyQuery } from "./queries/applyQuery.js";
24
28
  class ActionInvoker {
25
29
  constructor(clientCtx, actionDef) {
@@ -65,29 +69,59 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
65
69
  return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value
66
70
  } else if (o.type === "query") {
67
71
  return new QueryInvoker(clientCtx, o);
72
+ } else if (o.type === "experiment") {
73
+ switch (o.name) {
74
+ case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:
75
+ return {
76
+ getBulkLinks: createBulkLinksAsyncIterFactory(clientCtx)
77
+ };
78
+ case __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet.name:
79
+ return {
80
+ preexistingObjectSet: (definition, rid) => {
81
+ return createObjectSet(definition, client[additionalContext], {
82
+ type: "intersect",
83
+ objectSets: [{
84
+ type: "base",
85
+ objectType: definition.apiName
86
+ }, {
87
+ type: "reference",
88
+ reference: rid
89
+ }]
90
+ });
91
+ }
92
+ };
93
+ case __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe.name:
94
+ return {
95
+ subscribe: (objectSet, listener, opts) => {
96
+ const pendingSubscribe = ObjectSetListenerWebsocket.getInstance(clientCtx).subscribe(objectSet.$objectSetInternals?.def, getWireObjectSet(objectSet), listener, opts?.properties);
97
+ return {
98
+ unsubscribe: async () => (await pendingSubscribe)()
99
+ };
100
+ }
101
+ };
102
+ case __EXPERIMENTAL__NOT_SUPPORTED_YET__createTemporaryObjectSet.name:
103
+ return {
104
+ createTemporaryObjectSet: async objectSet => {
105
+ const response = await OntologyObjectSets.createTemporary(clientCtx, await clientCtx.ontologyRid, {
106
+ objectSet: getWireObjectSet(objectSet)
107
+ });
108
+ return response.objectSetRid;
109
+ }
110
+ };
111
+ }
112
+ throw new Error("not implemented");
68
113
  } else {
69
114
  throw new Error("not implemented");
70
115
  }
71
116
  }, {
72
- [symbolClientContext]: {
117
+ [oldSymbolClientContext]: {
73
118
  value: clientCtx
74
119
  },
75
- [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: {
76
- get: () => createBulkLinksAsyncIterFactory(clientCtx)
120
+ [symbolClientContext]: {
121
+ value: clientCtx
77
122
  },
78
- [__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: {
79
- get: () => (definition, rid) => {
80
- return createObjectSet(definition, client[symbolClientContext], {
81
- type: "intersect",
82
- objectSets: [{
83
- type: "base",
84
- objectType: definition.apiName
85
- }, {
86
- type: "reference",
87
- reference: rid
88
- }]
89
- });
90
- }
123
+ [additionalContext]: {
124
+ value: clientCtx
91
125
  },
92
126
  fetchMetadata: {
93
127
  value: fetchMetadata
@@ -1 +1 @@
1
- {"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet","symbolClientContext","createBulkLinksAsyncIterFactory","applyAction","createMinimalClient","fetchMetadataInternal","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","value","get","definition","rid","objectSets","objectType","apiName","reference","createClient"],"sources":["createClient.js"],"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 */\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, } from \"@osdk/api/unstable\";\nimport { symbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nclass ActionInvoker {\n constructor(clientCtx, actionDef) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n applyAction;\n batchApplyAction;\n}\nclass QueryInvoker {\n constructor(clientCtx, queryDef) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n executeFunction;\n}\n/** @internal */\nexport function createClientInternal(objectSetFactory, // first so i can bind\nbaseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n }\n else {\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n const clientCtx = createMinimalClient({ ontologyRid }, baseUrl, tokenProvider, options, fetchFn, objectSetFactory);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx);\n }\n else if (o.type === \"action\") {\n return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value\n }\n else if (o.type === \"query\") {\n return new QueryInvoker(clientCtx, o);\n }\n else {\n throw new Error(\"not implemented\");\n }\n }\n const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);\n const client = Object.defineProperties(clientFn, {\n [symbolClientContext]: {\n value: clientCtx,\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: {\n get: () => createBulkLinksAsyncIterFactory(clientCtx),\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: {\n get: () => (definition, rid) => {\n return createObjectSet(definition, client[symbolClientContext], {\n type: \"intersect\",\n objectSets: [\n {\n type: \"base\",\n objectType: definition.apiName,\n },\n {\n type: \"reference\",\n reference: rid,\n },\n ],\n });\n },\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n });\n return client;\n}\nexport const createClient = createClientInternal.bind(undefined, createObjectSet);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,+CAA+C,EAAEC,uDAAuD,QAAS,oBAAoB;AAC9I,SAASC,mBAAmB,QAAQ,qBAAqB;AACzD,SAASC,+BAA+B,QAAQ,iDAAiD;AACjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBA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AAC;EACF,OAAOC,MAAM;AACjB;AACA,OAAO,MAAMa,YAAY,GAAGzB,oBAAoB,CAACN,IAAI,CAACC,SAAS,EAAEP,eAAe,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__createTemporaryObjectSet","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet","__EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe","OntologyObjectSets","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","createObjectSet","getWireObjectSet","ObjectSetListenerWebsocket","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","preexistingObjectSet","definition","rid","objectSets","objectType","apiName","reference","subscribe","objectSet","listener","opts","pendingSubscribe","getInstance","$objectSetInternals","def","properties","unsubscribe","createTemporaryObjectSet","response","createTemporary","objectSetRid","value","createClient"],"sources":["createClient.js"],"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 */\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__createTemporaryObjectSet, __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe, } from \"@osdk/api/unstable\";\nimport { OntologyObjectSets } from \"@osdk/internal.foundry.ontologiesv2\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { symbolClientContext } from \"@osdk/shared.client2\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { createObjectSet, getWireObjectSet, } from \"./objectSet/createObjectSet.js\";\nimport { ObjectSetListenerWebsocket } from \"./objectSet/ObjectSetListenerWebsocket.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nclass ActionInvoker {\n constructor(clientCtx, actionDef) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n applyAction;\n batchApplyAction;\n}\nclass QueryInvoker {\n constructor(clientCtx, queryDef) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n executeFunction;\n}\n/** @internal */\nexport function createClientInternal(objectSetFactory, // first so i can bind\nbaseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n }\n else {\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n const clientCtx = createMinimalClient({ ontologyRid }, baseUrl, tokenProvider, options, fetchFn, objectSetFactory);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx);\n }\n else if (o.type === \"action\") {\n return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value\n }\n else if (o.type === \"query\") {\n return new QueryInvoker(clientCtx, o);\n }\n else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(clientCtx),\n };\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet.name:\n return {\n preexistingObjectSet: (definition, rid) => {\n return createObjectSet(definition, client[additionalContext], {\n type: \"intersect\",\n objectSets: [\n {\n type: \"base\",\n objectType: definition.apiName,\n },\n {\n type: \"reference\",\n reference: rid,\n },\n ],\n });\n },\n };\n case __EXPERIMENTAL__NOT_SUPPORTED_YET_subscribe.name:\n return {\n subscribe: (objectSet, listener, opts) => {\n const pendingSubscribe = ObjectSetListenerWebsocket.getInstance(clientCtx).subscribe(objectSet.$objectSetInternals?.def, getWireObjectSet(objectSet), listener, opts?.properties);\n return { unsubscribe: async () => (await pendingSubscribe)() };\n },\n };\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createTemporaryObjectSet.name:\n return {\n createTemporaryObjectSet: async (objectSet) => {\n const response = await OntologyObjectSets.createTemporary(clientCtx, await clientCtx.ontologyRid, {\n objectSet: getWireObjectSet(objectSet),\n });\n return response.objectSetRid;\n },\n };\n }\n throw new Error(\"not implemented\");\n }\n else {\n throw new Error(\"not implemented\");\n }\n }\n const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);\n const client = Object.defineProperties(clientFn, {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n });\n return client;\n}\nexport const createClient = createClientInternal.bind(undefined, createObjectSet);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AC,EAEgD;IAC7C,CAAC7B,sBAAsB,GAAG;MACtB4D,KAAK,EAAEhD;IACX,CAAC;IACD,CAACb,mBAAmB,GAAG;MACnB6D,KAAK,EAAEhD;IACX,CAAC;IACD,CAACT,iBAAiB,GAAG;MACjByD,KAAK,EAAEhD;IACX,CAAC;IACDmB,aAAa,EAAE;MACX6B,KAAK,EAAE7B;IACX;EACJ,CAAC,CAAC;EACF,OAAOC,MAAM;AACjB;AACA,OAAO,MAAM6B,YAAY,GAAGzC,oBAAoB,CAACN,IAAI,CAACC,SAAS,EAAET,eAAe,CAAC","ignoreList":[]}
@@ -14,9 +14,12 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { Task } from "@osdk/client.test.ontology";
17
+ import * as SharedClientContext from "@osdk/shared.client.impl";
17
18
  import { mockFetchResponse, MockOntology } from "@osdk/shared.test";
18
19
  import { beforeEach, describe, expect, it, vi } from "vitest";
20
+ import { metadataCacheClient } from "./__unstable/ConjureSupport.js";
19
21
  import { createClient } from "./createClient.js";
22
+ import * as MakeConjureContext from "./ontology/makeConjureContext.js";
20
23
  import { USER_AGENT } from "./util/UserAgent.js";
21
24
  describe(createClient, () => {
22
25
  let fetchFunction;
@@ -41,5 +44,26 @@ describe(createClient, () => {
41
44
  expect(parts).toEqual([...Task.osdkMetadata.extraUserAgent.split(" "), USER_AGENT]);
42
45
  });
43
46
  });
47
+ describe("check url formatting", () => {
48
+ it("urls are correctly formatted", async () => {
49
+ const spy = vi.spyOn(SharedClientContext, "createSharedClientContext");
50
+ const client = createClient("https://mock.com", MockOntology.metadata.ontologyRid, async () => "Token", undefined, fetchFunction);
51
+ expect(spy.mock.calls[0][0]).toBe("https://mock.com/");
52
+ createClient("https://mock1.com/", MockOntology.metadata.ontologyRid, async () => "Token", undefined, fetchFunction);
53
+ expect(spy.mock.calls[1][0]).toBe("https://mock1.com/");
54
+ createClient("https://mock2.com/stuff/first/foo", MockOntology.metadata.ontologyRid, async () => "Token", undefined, fetchFunction);
55
+ expect(spy.mock.calls[2][0]).toBe("https://mock2.com/stuff/first/foo/");
56
+ createClient("https://mock3.com/stuff/first/foo/", MockOntology.metadata.ontologyRid, async () => "Token", undefined, fetchFunction);
57
+ expect(spy.mock.calls[3][0]).toBe("https://mock3.com/stuff/first/foo/");
58
+ const conjureContextSpy = vi.spyOn(MakeConjureContext, "makeConjureContext");
59
+ metadataCacheClient({
60
+ baseUrl: "https://mock4.com/",
61
+ ontologyProvider: {
62
+ getObjectDefinition: async () => ({})
63
+ }
64
+ });
65
+ expect(conjureContextSpy.mock.results[0].value["baseUrl"] + conjureContextSpy.mock.results[0].value["servicePath"]).toBe("https://mock4.com/ontology-metadata/api");
66
+ });
67
+ });
44
68
  });
45
69
  //# sourceMappingURL=createClient.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createClient.test.js","names":["Task","mockFetchResponse","MockOntology","beforeEach","describe","expect","it","vi","createClient","USER_AGENT","fetchFunction","client","fn","metadata","ontologyRid","undefined","data","getUserAgentPartsFromMockedFetch","userAgent","mock","calls","headers","get","parts","split","fetchPage","toHaveBeenCalledTimes","toEqual","osdkMetadata","extraUserAgent"],"sources":["createClient.test.js"],"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 */\nimport { Task } from \"@osdk/client.test.ontology\";\nimport { mockFetchResponse, MockOntology } from \"@osdk/shared.test\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { createClient } from \"./createClient.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\ndescribe(createClient, () => {\n const validOlderVersion = \"0.13.0\";\n const validCurrentVersion = \"0.14.0\";\n const invalidFutureVersion = \"100.100.100\";\n let fetchFunction;\n let client;\n beforeEach(() => {\n fetchFunction = vi.fn();\n client = createClient(\"https://mock.com\", MockOntology.metadata.ontologyRid, async () => \"Token\", undefined, fetchFunction);\n mockFetchResponse(fetchFunction, { data: [] });\n });\n describe(\"user agent passing\", () => {\n function getUserAgentPartsFromMockedFetch() {\n const userAgent = (fetchFunction.mock.calls[0][1]?.headers)\n .get(\"Fetch-User-Agent\");\n const parts = userAgent?.split(\" \") ?? [];\n return parts;\n }\n it(\"works for objects\", async () => {\n await client(Task).fetchPage();\n expect(fetchFunction).toHaveBeenCalledTimes(1);\n const parts = getUserAgentPartsFromMockedFetch();\n expect(parts).toEqual([\n ...Task.osdkMetadata\n .extraUserAgent\n .split(\" \"),\n USER_AGENT,\n ]);\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,4BAA4B;AACjD,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,mBAAmB;AACnE,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAC7D,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,UAAU,QAAQ,qBAAqB;AAChDL,QAAQ,CAACI,YAAY,EAAE,MAAM;EAIzB,IAAIE,aAAa;EACjB,IAAIC,MAAM;EACVR,UAAU,CAAC,MAAM;IACbO,aAAa,GAAGH,EAAE,CAACK,EAAE,CAAC,CAAC;IACvBD,MAAM,GAAGH,YAAY,CAAC,kBAAkB,EAAEN,YAAY,CAACW,QAAQ,CAACC,WAAW,EAAE,YAAY,OAAO,EAAEC,SAAS,EAAEL,aAAa,CAAC;IAC3HT,iBAAiB,CAACS,aAAa,EAAE;MAAEM,IAAI,EAAE;IAAG,CAAC,CAAC;EAClD,CAAC,CAAC;EACFZ,QAAQ,CAAC,oBAAoB,EAAE,MAAM;IACjC,SAASa,gCAAgCA,CAAA,EAAG;MACxC,MAAMC,SAAS,GAAG,CAACR,aAAa,CAACS,IAAI,CAACC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAEC,OAAO,EACrDC,GAAG,CAAC,kBAAkB,CAAC;MAC5B,MAAMC,KAAK,GAAGL,SAAS,EAAEM,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;MACzC,OAAOD,KAAK;IAChB;IACAjB,EAAE,CAAC,mBAAmB,EAAE,YAAY;MAChC,MAAMK,MAAM,CAACX,IAAI,CAAC,CAACyB,SAAS,CAAC,CAAC;MAC9BpB,MAAM,CAACK,aAAa,CAAC,CAACgB,qBAAqB,CAAC,CAAC,CAAC;MAC9C,MAAMH,KAAK,GAAGN,gCAAgC,CAAC,CAAC;MAChDZ,MAAM,CAACkB,KAAK,CAAC,CAACI,OAAO,CAAC,CAClB,GAAG3B,IAAI,CAAC4B,YAAY,CACfC,cAAc,CACdL,KAAK,CAAC,GAAG,CAAC,EACff,UAAU,CACb,CAAC;IACN,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"createClient.test.js","names":["Task","SharedClientContext","mockFetchResponse","MockOntology","beforeEach","describe","expect","it","vi","metadataCacheClient","createClient","MakeConjureContext","USER_AGENT","fetchFunction","client","fn","metadata","ontologyRid","undefined","data","getUserAgentPartsFromMockedFetch","userAgent","mock","calls","headers","get","parts","split","fetchPage","toHaveBeenCalledTimes","toEqual","osdkMetadata","extraUserAgent","spy","spyOn","toBe","conjureContextSpy","baseUrl","ontologyProvider","getObjectDefinition","results","value"],"sources":["createClient.test.js"],"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 */\nimport { Task } from \"@osdk/client.test.ontology\";\nimport * as SharedClientContext from \"@osdk/shared.client.impl\";\nimport { mockFetchResponse, MockOntology } from \"@osdk/shared.test\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { metadataCacheClient } from \"./__unstable/ConjureSupport.js\";\nimport { createClient } from \"./createClient.js\";\nimport * as MakeConjureContext from \"./ontology/makeConjureContext.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\ndescribe(createClient, () => {\n const validOlderVersion = \"0.13.0\";\n const validCurrentVersion = \"0.14.0\";\n const invalidFutureVersion = \"100.100.100\";\n let fetchFunction;\n let client;\n beforeEach(() => {\n fetchFunction = vi.fn();\n client = createClient(\"https://mock.com\", MockOntology.metadata.ontologyRid, async () => \"Token\", undefined, fetchFunction);\n mockFetchResponse(fetchFunction, { data: [] });\n });\n describe(\"user agent passing\", () => {\n function getUserAgentPartsFromMockedFetch() {\n const userAgent = (fetchFunction.mock.calls[0][1]?.headers)\n .get(\"Fetch-User-Agent\");\n const parts = userAgent?.split(\" \") ?? [];\n return parts;\n }\n it(\"works for objects\", async () => {\n await client(Task).fetchPage();\n expect(fetchFunction).toHaveBeenCalledTimes(1);\n const parts = getUserAgentPartsFromMockedFetch();\n expect(parts).toEqual([\n ...Task.osdkMetadata\n .extraUserAgent\n .split(\" \"),\n USER_AGENT,\n ]);\n });\n });\n describe(\"check url formatting\", () => {\n it(\"urls are correctly formatted\", async () => {\n const spy = vi.spyOn(SharedClientContext, \"createSharedClientContext\");\n const client = createClient(\"https://mock.com\", MockOntology.metadata.ontologyRid, async () => \"Token\", undefined, fetchFunction);\n expect(spy.mock.calls[0][0]).toBe(\"https://mock.com/\");\n createClient(\"https://mock1.com/\", MockOntology.metadata.ontologyRid, async () => \"Token\", undefined, fetchFunction);\n expect(spy.mock.calls[1][0]).toBe(\"https://mock1.com/\");\n createClient(\"https://mock2.com/stuff/first/foo\", MockOntology.metadata.ontologyRid, async () => \"Token\", undefined, fetchFunction);\n expect(spy.mock.calls[2][0]).toBe(\"https://mock2.com/stuff/first/foo/\");\n createClient(\"https://mock3.com/stuff/first/foo/\", MockOntology.metadata.ontologyRid, async () => \"Token\", undefined, fetchFunction);\n expect(spy.mock.calls[3][0]).toBe(\"https://mock3.com/stuff/first/foo/\");\n const conjureContextSpy = vi.spyOn(MakeConjureContext, \"makeConjureContext\");\n metadataCacheClient({\n baseUrl: \"https://mock4.com/\",\n ontologyProvider: { getObjectDefinition: async () => ({}) },\n });\n expect(conjureContextSpy.mock.results[0].value[\"baseUrl\"]\n + conjureContextSpy.mock.results[0].value[\"servicePath\"]).toBe(\"https://mock4.com/ontology-metadata/api\");\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,4BAA4B;AACjD,OAAO,KAAKC,mBAAmB,MAAM,0BAA0B;AAC/D,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,mBAAmB;AACnE,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAC7D,SAASC,mBAAmB,QAAQ,gCAAgC;AACpE,SAASC,YAAY,QAAQ,mBAAmB;AAChD,OAAO,KAAKC,kBAAkB,MAAM,kCAAkC;AACtE,SAASC,UAAU,QAAQ,qBAAqB;AAChDP,QAAQ,CAACK,YAAY,EAAE,MAAM;EAIzB,IAAIG,aAAa;EACjB,IAAIC,MAAM;EACVV,UAAU,CAAC,MAAM;IACbS,aAAa,GAAGL,EAAE,CAACO,EAAE,CAAC,CAAC;IACvBD,MAAM,GAAGJ,YAAY,CAAC,kBAAkB,EAAEP,YAAY,CAACa,QAAQ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,CAAC,CAAC,CAACN,IAAI,CAAC,yCAAyC,CAAC;IACjH,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -3,7 +3,7 @@ import type { MinimalClient } from "./MinimalClientContext.js";
3
3
  export declare class GeotimeSeriesPropertyImpl<T extends GeoJSON.Point> implements GeotimeSeriesProperty<T> {
4
4
  #private;
5
5
  lastFetchedValue: TimeSeriesPoint<T> | undefined;
6
- constructor(client: MinimalClient, objectApiName: string, primaryKey: any, propertyName: string);
6
+ constructor(client: MinimalClient, objectApiName: string, primaryKey: any, propertyName: string, initialValue?: TimeSeriesPoint<T>);
7
7
  getLatestValue(): Promise<TimeSeriesPoint<T> | undefined>;
8
8
  getAllValues(query?: TimeSeriesQuery): Promise<TimeSeriesPoint<T>[]>;
9
9
  asyncIterValues(query?: TimeSeriesQuery): AsyncGenerator<{
@@ -1 +1 @@
1
- {"version":3,"file":"createGeotimeSeriesProperty.d.ts","sourceRoot":"","sources":["../../src/createGeotimeSeriesProperty.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EAEf,eAAe,EAChB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO/D,qBAAa,yBAAyB,CAAC,CAAC,SAAS,OAAO,CAAC,KAAK,CAC5D,YAAW,qBAAqB,CAAC,CAAC,CAAC;;IAInC,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;gBAG/C,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM;IAMT,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAWzD,YAAY,CAAC,KAAK,CAAC,EAAE,eAAe;IASnC,eAAe,CAC3B,KAAK,CAAC,EAAE,eAAe;;;;CAgB1B"}
1
+ {"version":3,"file":"createGeotimeSeriesProperty.d.ts","sourceRoot":"","sources":["../../src/createGeotimeSeriesProperty.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,qBAAqB,EACrB,eAAe,EACf,eAAe,EAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,qBAAa,yBAAyB,CAAC,CAAC,SAAS,OAAO,CAAC,KAAK,CAC5D,YAAW,qBAAqB,CAAC,CAAC,CAAC;;IAInC,gBAAgB,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;gBAG/C,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM,EACpB,YAAY,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;IAStB,cAAc,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC;IAWzD,YAAY,CAAC,KAAK,CAAC,EAAE,eAAe;IASnC,eAAe,CAC3B,KAAK,CAAC,EAAE,eAAe;;;;CAgB1B"}
@@ -19,9 +19,12 @@ export class GeotimeSeriesPropertyImpl {
19
19
  #triplet;
20
20
  #client;
21
21
  lastFetchedValue;
22
- constructor(client, objectApiName, primaryKey, propertyName) {
22
+ constructor(client, objectApiName, primaryKey, propertyName, initialValue) {
23
23
  this.#client = client;
24
24
  this.#triplet = [objectApiName, primaryKey, propertyName];
25
+ if (initialValue != null) {
26
+ this.lastFetchedValue = initialValue;
27
+ }
25
28
  }
26
29
  async getLatestValue() {
27
30
  const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties.getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);
@@ -1 +1 @@
1
- {"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","lastFetchedValue","constructor","objectApiName","primaryKey","propertyName","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.js"],"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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\nexport class GeotimeSeriesPropertyImpl {\n #triplet;\n #client;\n lastFetchedValue;\n constructor(client, objectApiName, primaryKey, propertyName) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n async getLatestValue() {\n const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties\n .getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint);\n return latestPointPromise;\n }\n async getAllValues(query) {\n const allPoints = [];\n for await (const point of this.asyncIterValues(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n async *asyncIterValues(query) {\n const streamPointsIterator = await OntologiesV2\n .TimeSeriesValueBankProperties.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? { range: getTimeRange(query) } : {});\n for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM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AAMQ,eAAe,IAAIzB,qBAAqB,CAACsB,oBAAoB,CAAC,EAAE;MAC7E,MAAMG,eAAe;IACzB;EACJ;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","lastFetchedValue","constructor","objectApiName","primaryKey","propertyName","initialValue","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.js"],"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 */\nimport * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\nexport class GeotimeSeriesPropertyImpl {\n #triplet;\n #client;\n lastFetchedValue;\n constructor(client, objectApiName, primaryKey, propertyName, initialValue) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n if (initialValue != null) {\n this.lastFetchedValue = initialValue;\n }\n }\n async getLatestValue() {\n const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties\n .getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint);\n return latestPointPromise;\n }\n async getAllValues(query) {\n const allPoints = [];\n for await (const point of this.asyncIterValues(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n async *asyncIterValues(query) {\n const streamPointsIterator = await OntologiesV2\n .TimeSeriesValueBankProperties.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? { range: getTimeRange(query) } : {});\n for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,qBAAqB,EAAEC,YAAY,QAAQ,2BAA2B;AAC/E,OAAO,MAAMC,yBAAyB,CAAC;EACnC,CAACC,OAAO;EACR,CAACC,MAAM;EACPC,gBAAgB;EAChBC,WAAWA,CAACF,MAAM,EAAEG,aAAa,EAAEC,UAAU,EAAEC,YAAY,EAAEC,YAAY,EAAE;IACvE,IAAI,CAAC,CAACN,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACI,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;IACzD,IAAIC,YAAY,IAAI,IAAI,EAAE;MACtB,IAAI,CAACL,gBAAgB,GAAGK,YAAY;IACxC;EACJ;EACA,MAAMC,cAAcA,CAAA,EAAG;IACnB,MAAMC,kBAAkB,GAAGb,YAAY,CAACc,6BAA6B,CAChEF,cAAc,CAAC,IAAI,CAAC,CAACP,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACU,WAAW,EAAE,GAAG,IAAI,CAAC,CAACX,OAAO,CAAC;IACnFS,kBAAkB,CAACG,IAAI,CAACC,WAAW,IAAI,IAAI,CAACX,gBAAgB,GAAGW,WAAW,CAAC;IAC3E,OAAOJ,kBAAkB;EAC7B;EACA,MAAMK,YAAYA,CAACC,KAAK,EAAE;IACtB,MAAMC,SAAS,GAAG,EAAE;IACpB,WAAW,MAAMC,KAAK,IAAI,IAAI,CAACC,eAAe,CAACH,KAAK,CAAC,EAAE;MACnDC,SAAS,CAACG,IAAI,CAACF,KAAK,CAAC;IACzB;IACA,OAAOD,SAAS;EACpB;EACA,OAAOE,eAAeA,CAACH,KAAK,EAAE;IAC1B,MAAMK,oBAAoB,GAAG,MAAMxB,YAAY,CAC1Cc,6BAA6B,CAACW,YAAY,CAAC,IAAI,CAAC,CAACpB,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACU,WAAW,EAAE,GAAG,IAAI,CAAC,CAACX,OAAO,EAAEe,KAAK,GAAG;MAAEO,KAAK,EAAExB,YAAY,CAACiB,KAAK;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5J,WAAW,MAAMQ,eAAe,IAAI1B,qBAAqB,CAACuB,oBAAoB,CAAC,EAAE;MAC7E,MAAMG,eAAe;IACzB;EACJ;AACJ","ignoreList":[]}
@@ -14,12 +14,13 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import { createSharedClientContext } from "@osdk/shared.client.impl";
17
+ import { convertWireToOsdkObjects, convertWireToOsdkObjects2 } from "./object/convertWireToOsdkObjects.js";
17
18
  import { createObjectSet } from "./objectSet/createObjectSet.js";
18
19
  import { createStandardOntologyProviderFactory } from "./ontology/StandardOntologyProvider.js";
19
20
  import { USER_AGENT } from "./util/UserAgent.js";
20
21
  /** @internal */
21
22
  export function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
22
- if (process?.env?.NODE_ENV !== "production") {
23
+ if (process.env.NODE_ENV !== "production") {
23
24
  try {
24
25
  new URL(baseUrl);
25
26
  } catch (e) {
@@ -27,16 +28,20 @@ export function createMinimalClient(metadata, baseUrl, tokenProvider, options =
27
28
  throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);
28
29
  }
29
30
  }
31
+ const processedBaseUrl = new URL(baseUrl);
32
+ processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith("/") ? "" : "/";
30
33
  const minimalClient = {
31
- ...createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn),
34
+ ...createSharedClientContext(processedBaseUrl.toString(), tokenProvider, USER_AGENT, fetchFn),
32
35
  objectSetFactory,
36
+ objectFactory: convertWireToOsdkObjects,
37
+ objectFactory2: convertWireToOsdkObjects2,
33
38
  ontologyRid: metadata.ontologyRid,
34
39
  logger: options.logger,
35
40
  clientCacheKey: {},
36
41
  requestContext: {}
37
42
  };
38
- return Object.assign(minimalClient, {
43
+ return Object.freeze(Object.assign(minimalClient, {
39
44
  ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient)
40
- });
45
+ }));
41
46
  }
42
47
  //# sourceMappingURL=createMinimalClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","minimalClient","ontologyRid","logger","clientCacheKey","requestContext","Object","assign","ontologyProvider"],"sources":["createMinimalClient.js"],"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 */\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createStandardOntologyProviderFactory, } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n/** @internal */\nexport function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {\n if (process?.env?.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n }\n catch (e) {\n const hint = !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const minimalClient = {\n ...createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn),\n objectSetFactory,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {},\n requestContext: {},\n };\n return Object.assign(minimalClient, {\n ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,0BAA0B;AACpE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,qCAAqC,QAAS,wCAAwC;AAC/F,SAASC,UAAU,QAAQ,qBAAqB;AAChD;AACA,OAAO,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,aAAa,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAGC,MAAM,CAACC,KAAK,EAAEC,gBAAgB,GAAGX,eAAe,EAAE;EAC5I,IAAIY,OAAO,EAAEC,GAAG,EAAEC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAI;MACA,IAAIC,GAAG,CAACV,OAAO,CAAC;IACpB,CAAC,CACD,OAAOW,CAAC,EAAE;MACN,MAAMC,IAAI,GAAG,CAACZ,OAAO,CAACa,UAAU,CAAC,SAAS,CAAC,IAAI,CAACb,OAAO,CAACa,UAAU,CAAC,UAAU,CAAC,GACxE,kDAAkD,GAClD,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,sBAAsBd,OAAO,GAAGY,IAAI,EAAE,CAAC;IAC3D;EACJ;EACA,MAAMG,aAAa,GAAG;IAClB,GAAGrB,yBAAyB,CAACM,OAAO,EAAEC,aAAa,EAAEJ,UAAU,EAAEM,OAAO,CAAC;IACzEG,gBAAgB;IAChBU,WAAW,EAAEjB,QAAQ,CAACiB,WAAW;IACjCC,MAAM,EAAEf,OAAO,CAACe,MAAM;IACtBC,cAAc,EAAE,CAAC,CAAC;IAClBC,cAAc,EAAE,CAAC;EACrB,CAAC;EACD,OAAOC,MAAM,CAACC,MAAM,CAACN,aAAa,EAAE;IAChCO,gBAAgB,EAAE1B,qCAAqC,CAACM,OAAO,CAAC,CAACa,aAAa;EAClF,CAAC,CAAC;AACN","ignoreList":[]}
1
+ {"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.js"],"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 */\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { convertWireToOsdkObjects, convertWireToOsdkObjects2, } from \"./object/convertWireToOsdkObjects.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createStandardOntologyProviderFactory, } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n/** @internal */\nexport function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n }\n catch (e) {\n const hint = !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const processedBaseUrl = new URL(baseUrl);\n processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith(\"/\")\n ? \"\"\n : \"/\";\n const minimalClient = {\n ...createSharedClientContext(processedBaseUrl.toString(), tokenProvider, USER_AGENT, fetchFn),\n objectSetFactory,\n objectFactory: convertWireToOsdkObjects,\n objectFactory2: convertWireToOsdkObjects2,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {},\n requestContext: {},\n };\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,0BAA0B;AACpE,SAASC,wBAAwB,EAAEC,yBAAyB,QAAS,sCAAsC;AAC3G,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,qCAAqC,QAAS,wCAAwC;AAC/F,SAASC,UAAU,QAAQ,qBAAqB;AAChD;AACA,OAAO,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,aAAa,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAGC,MAAM,CAACC,KAAK,EAAEC,gBAAgB,GAAGX,eAAe,EAAE;EAC5I,IAAIY,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACvC,IAAI;MACA,IAAIC,GAAG,CAACV,OAAO,CAAC;IACpB,CAAC,CACD,OAAOW,CAAC,EAAE;MACN,MAAMC,IAAI,GAAG,CAACZ,OAAO,CAACa,UAAU,CAAC,SAAS,CAAC,IAAI,CAACb,OAAO,CAACa,UAAU,CAAC,UAAU,CAAC,GACxE,kDAAkD,GAClD,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,sBAAsBd,OAAO,GAAGY,IAAI,EAAE,CAAC;IAC3D;EACJ;EACA,MAAMG,gBAAgB,GAAG,IAAIL,GAAG,CAACV,OAAO,CAAC;EACzCe,gBAAgB,CAACC,QAAQ,IAAID,gBAAgB,CAACC,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC,GAC9D,EAAE,GACF,GAAG;EACT,MAAMC,aAAa,GAAG;IAClB,GAAG1B,yBAAyB,CAACuB,gBAAgB,CAACI,QAAQ,CAAC,CAAC,EAAElB,aAAa,EAAEJ,UAAU,EAAEM,OAAO,CAAC;IAC7FG,gBAAgB;IAChBc,aAAa,EAAE3B,wBAAwB;IACvC4B,cAAc,EAAE3B,yBAAyB;IACzC4B,WAAW,EAAEvB,QAAQ,CAACuB,WAAW;IACjCC,MAAM,EAAErB,OAAO,CAACqB,MAAM;IACtBC,cAAc,EAAE,CAAC,CAAC;IAClBC,cAAc,EAAE,CAAC;EACrB,CAAC;EACD,OAAOC,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAACV,aAAa,EAAE;IAC9CW,gBAAgB,EAAEjC,qCAAqC,CAACM,OAAO,CAAC,CAACgB,aAAa;EAClF,CAAC,CAAC,CAAC;AACP","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { SharedClientContext } from "@osdk/shared.client";
1
+ import type { SharedClientContext } from "@osdk/shared.client2";
2
2
  export interface PlatformClient extends SharedClientContext {
3
3
  }
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"createPlatformClient.d.ts","sourceRoot":"","sources":["../../src/createPlatformClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI/D,MAAM,WAAW,cAAe,SAAQ,mBAAmB;CAAG;AAE9D;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACpC,OAAO,GAAE,SAAqB,EAC9B,OAAO,GAAE,OAAO,UAAU,CAAC,KAAa,GACvC,cAAc,CAOhB"}
1
+ {"version":3,"file":"createPlatformClient.d.ts","sourceRoot":"","sources":["../../src/createPlatformClient.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,MAAM,WAAW,cAAe,SAAQ,mBAAmB;CAAG;AAE9D;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACpC,OAAO,GAAE,SAAqB,EAC9B,OAAO,GAAE,OAAO,UAAU,CAAC,KAAa,GACvC,cAAc,CAOhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"createTimeseriesProperty.d.ts","sourceRoot":"","sources":["../../src/createTimeseriesProperty.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AAInB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAO/D,qBAAa,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAC3D,YAAW,kBAAkB,CAAC,CAAC,CAAC;;gBAM9B,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM;IAMT,aAAa;IAQb,YAAY;IAQZ,YAAY,CAAC,KAAK,CAAC,EAAE,eAAe;IASnC,eAAe,CAC3B,KAAK,CAAC,EAAE,eAAe;;;;CAgB1B"}
1
+ {"version":3,"file":"createTimeseriesProperty.d.ts","sourceRoot":"","sources":["../../src/createTimeseriesProperty.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EAChB,MAAM,WAAW,CAAC;AAEnB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAG/D,qBAAa,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,CAC3D,YAAW,kBAAkB,CAAC,CAAC,CAAC;;gBAM9B,MAAM,EAAE,aAAa,EACrB,aAAa,EAAE,MAAM,EACrB,UAAU,EAAE,GAAG,EACf,YAAY,EAAE,MAAM;IAMT,aAAa;IAQb,YAAY;IAQZ,YAAY,CAAC,KAAK,CAAC,EAAE,eAAe;IASnC,eAAe,CAC3B,KAAK,CAAC,EAAE,eAAe;;;;CAgB1B"}
@@ -72,6 +72,13 @@ describe("FetchMetadata", () => {
72
72
  "primaryKeyApiName": "employeeId",
73
73
  "primaryKeyType": "integer",
74
74
  "properties": {
75
+ "class": {
76
+ "description": "",
77
+ "displayName": undefined,
78
+ "multiplicity": false,
79
+ "nullable": true,
80
+ "type": "string",
81
+ },
75
82
  "employeeId": {
76
83
  "description": undefined,
77
84
  "displayName": undefined,
@@ -86,6 +93,13 @@ describe("FetchMetadata", () => {
86
93
  "nullable": true,
87
94
  "type": "geotimeSeriesReference",
88
95
  },
96
+ "employeeSensor": {
97
+ "description": "TimeSeries sensor of the status of the employee",
98
+ "displayName": undefined,
99
+ "multiplicity": false,
100
+ "nullable": true,
101
+ "type": "sensorTimeseries",
102
+ },
89
103
  "employeeStatus": {
90
104
  "description": "TimeSeries of the status of the employee",
91
105
  "displayName": undefined,