@osdk/faux 0.1.0-beta.1

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 (401) hide show
  1. package/CHANGELOG.md +1047 -0
  2. package/build/browser/BaseError.js +21 -0
  3. package/build/browser/BaseError.js.map +1 -0
  4. package/build/browser/FauxFoundry/BaseOsdkObjectType.js +2 -0
  5. package/build/browser/FauxFoundry/BaseOsdkObjectType.js.map +1 -0
  6. package/build/browser/FauxFoundry/BaseServerObject.js +30 -0
  7. package/build/browser/FauxFoundry/BaseServerObject.js.map +1 -0
  8. package/build/browser/FauxFoundry/FauxActionImpl.js +2 -0
  9. package/build/browser/FauxFoundry/FauxActionImpl.js.map +1 -0
  10. package/build/browser/FauxFoundry/FauxAttachmentStore.js +60 -0
  11. package/build/browser/FauxFoundry/FauxAttachmentStore.js.map +1 -0
  12. package/build/browser/FauxFoundry/FauxDataStore.js +470 -0
  13. package/build/browser/FauxFoundry/FauxDataStore.js.map +1 -0
  14. package/build/browser/FauxFoundry/FauxDataStore.test.js +190 -0
  15. package/build/browser/FauxFoundry/FauxDataStore.test.js.map +1 -0
  16. package/build/browser/FauxFoundry/FauxDataStoreBatch.js +125 -0
  17. package/build/browser/FauxFoundry/FauxDataStoreBatch.js.map +1 -0
  18. package/build/browser/FauxFoundry/FauxFoundry.js +87 -0
  19. package/build/browser/FauxFoundry/FauxFoundry.js.map +1 -0
  20. package/build/browser/FauxFoundry/FauxOntology.js +228 -0
  21. package/build/browser/FauxFoundry/FauxOntology.js.map +1 -0
  22. package/build/browser/FauxFoundry/FauxQueryImpl.js +2 -0
  23. package/build/browser/FauxFoundry/FauxQueryImpl.js.map +1 -0
  24. package/build/browser/FauxFoundry/ObjectLocator.js +29 -0
  25. package/build/browser/FauxFoundry/ObjectLocator.js.map +1 -0
  26. package/build/browser/FauxFoundry/filterObjects.js +122 -0
  27. package/build/browser/FauxFoundry/filterObjects.js.map +1 -0
  28. package/build/browser/FauxFoundry/filterTimeSeriesData.js +70 -0
  29. package/build/browser/FauxFoundry/filterTimeSeriesData.js.map +1 -0
  30. package/build/browser/FauxFoundry/filterTimeSeriesData.test.js +116 -0
  31. package/build/browser/FauxFoundry/filterTimeSeriesData.test.js.map +1 -0
  32. package/build/browser/FauxFoundry/getObjectsFromSet.js +217 -0
  33. package/build/browser/FauxFoundry/getObjectsFromSet.js.map +1 -0
  34. package/build/browser/FauxFoundry/typeHelpers/ActionTypeBuilder.js +64 -0
  35. package/build/browser/FauxFoundry/typeHelpers/ActionTypeBuilder.js.map +1 -0
  36. package/build/browser/FauxFoundry/typeHelpers/JustProps.js +2 -0
  37. package/build/browser/FauxFoundry/typeHelpers/JustProps.js.map +1 -0
  38. package/build/browser/FauxFoundry/typeHelpers/TH_ActionDefinition.js +2 -0
  39. package/build/browser/FauxFoundry/typeHelpers/TH_ActionDefinition.js.map +1 -0
  40. package/build/browser/FauxFoundry/typeHelpers/TH_ActionParameterV2.js +25 -0
  41. package/build/browser/FauxFoundry/typeHelpers/TH_ActionParameterV2.js.map +1 -0
  42. package/build/browser/FauxFoundry/typeHelpers/TH_ActionTypeV2.js +35 -0
  43. package/build/browser/FauxFoundry/typeHelpers/TH_ActionTypeV2.js.map +1 -0
  44. package/build/browser/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.js +2 -0
  45. package/build/browser/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.js.map +1 -0
  46. package/build/browser/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.js +2 -0
  47. package/build/browser/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.js.map +1 -0
  48. package/build/browser/FauxFoundry/typeHelpers/ToObjectTypeDefinition.js +2 -0
  49. package/build/browser/FauxFoundry/typeHelpers/ToObjectTypeDefinition.js.map +1 -0
  50. package/build/browser/FauxFoundry/typeHelpers/index.js +20 -0
  51. package/build/browser/FauxFoundry/typeHelpers/index.js.map +1 -0
  52. package/build/browser/FauxFoundry/validateAction.js +245 -0
  53. package/build/browser/FauxFoundry/validateAction.js.map +1 -0
  54. package/build/browser/defaultOntologyForConjure.js +25 -0
  55. package/build/browser/defaultOntologyForConjure.js.map +1 -0
  56. package/build/browser/defaultOntologyMetadata.js +23 -0
  57. package/build/browser/defaultOntologyMetadata.js.map +1 -0
  58. package/build/browser/errors.js +134 -0
  59. package/build/browser/errors.js.map +1 -0
  60. package/build/browser/filterObjects.js +86 -0
  61. package/build/browser/filterObjects.js.map +1 -0
  62. package/build/browser/handlers/authHandlerMiddleware.js +41 -0
  63. package/build/browser/handlers/authHandlerMiddleware.js.map +1 -0
  64. package/build/browser/handlers/createActionHandlers.js +49 -0
  65. package/build/browser/handlers/createActionHandlers.js.map +1 -0
  66. package/build/browser/handlers/createAttachmentHandlers.js +88 -0
  67. package/build/browser/handlers/createAttachmentHandlers.js.map +1 -0
  68. package/build/browser/handlers/createFauxFoundryHandlers.js +29 -0
  69. package/build/browser/handlers/createFauxFoundryHandlers.js.map +1 -0
  70. package/build/browser/handlers/createLoadObjectsHandlers.js +91 -0
  71. package/build/browser/handlers/createLoadObjectsHandlers.js.map +1 -0
  72. package/build/browser/handlers/createMediaRefHandlers.js +70 -0
  73. package/build/browser/handlers/createMediaRefHandlers.js.map +1 -0
  74. package/build/browser/handlers/createMultipassServerHandlers.js +67 -0
  75. package/build/browser/handlers/createMultipassServerHandlers.js.map +1 -0
  76. package/build/browser/handlers/createObjectSetHandlers.js +50 -0
  77. package/build/browser/handlers/createObjectSetHandlers.js.map +1 -0
  78. package/build/browser/handlers/createOntologyHandlers.js +122 -0
  79. package/build/browser/handlers/createOntologyHandlers.js.map +1 -0
  80. package/build/browser/handlers/createQueryHandlers.js +38 -0
  81. package/build/browser/handlers/createQueryHandlers.js.map +1 -0
  82. package/build/browser/handlers/createTimeseriesAndGeotimeHandlers.js +95 -0
  83. package/build/browser/handlers/createTimeseriesAndGeotimeHandlers.js.map +1 -0
  84. package/build/browser/handlers/util/getPaginationParams.js +33 -0
  85. package/build/browser/handlers/util/getPaginationParams.js.map +1 -0
  86. package/build/browser/handlers/util/handleOpenApiCall.js +85 -0
  87. package/build/browser/handlers/util/handleOpenApiCall.js.map +1 -0
  88. package/build/browser/handlers/util/loadAll.js +24 -0
  89. package/build/browser/handlers/util/loadAll.js.map +1 -0
  90. package/build/browser/handlers/util/pageThroughResponseSearchParams.js +39 -0
  91. package/build/browser/handlers/util/pageThroughResponseSearchParams.js.map +1 -0
  92. package/build/browser/handlers/util/requireParam.js +29 -0
  93. package/build/browser/handlers/util/requireParam.js.map +1 -0
  94. package/build/browser/handlers/util/requireSearchParams.js +29 -0
  95. package/build/browser/handlers/util/requireSearchParams.js.map +1 -0
  96. package/build/browser/index.js +29 -0
  97. package/build/browser/index.js.map +1 -0
  98. package/build/browser/mock/OntologiesV2/ActionTypesV2.js +21 -0
  99. package/build/browser/mock/OntologiesV2/ActionTypesV2.js.map +1 -0
  100. package/build/browser/mock/OntologiesV2/Actions.js +21 -0
  101. package/build/browser/mock/OntologiesV2/Actions.js.map +1 -0
  102. package/build/browser/mock/OntologiesV2/AttachmentPropertiesV2.js +21 -0
  103. package/build/browser/mock/OntologiesV2/AttachmentPropertiesV2.js.map +1 -0
  104. package/build/browser/mock/OntologiesV2/Attachments.js +22 -0
  105. package/build/browser/mock/OntologiesV2/Attachments.js.map +1 -0
  106. package/build/browser/mock/OntologiesV2/LinkedObjectsV2.js +21 -0
  107. package/build/browser/mock/OntologiesV2/LinkedObjectsV2.js.map +1 -0
  108. package/build/browser/mock/OntologiesV2/MediaReferenceProperties.js +22 -0
  109. package/build/browser/mock/OntologiesV2/MediaReferenceProperties.js.map +1 -0
  110. package/build/browser/mock/OntologiesV2/ObjectTypesV2.js +24 -0
  111. package/build/browser/mock/OntologiesV2/ObjectTypesV2.js.map +1 -0
  112. package/build/browser/mock/OntologiesV2/OntologiesV2.js +27 -0
  113. package/build/browser/mock/OntologiesV2/OntologiesV2.js.map +1 -0
  114. package/build/browser/mock/OntologiesV2/OntologyInterfaces.js +21 -0
  115. package/build/browser/mock/OntologiesV2/OntologyInterfaces.js.map +1 -0
  116. package/build/browser/mock/OntologiesV2/OntologyObjectSets.js +22 -0
  117. package/build/browser/mock/OntologiesV2/OntologyObjectSets.js.map +1 -0
  118. package/build/browser/mock/OntologiesV2/OntologyObjectsV2.js +21 -0
  119. package/build/browser/mock/OntologiesV2/OntologyObjectsV2.js.map +1 -0
  120. package/build/browser/mock/OntologiesV2/Queries.js +20 -0
  121. package/build/browser/mock/OntologiesV2/Queries.js.map +1 -0
  122. package/build/browser/mock/OntologiesV2/QueryTypes.js +21 -0
  123. package/build/browser/mock/OntologiesV2/QueryTypes.js.map +1 -0
  124. package/build/browser/mock/OntologiesV2/TimeSeriesPropertiesV2.js +22 -0
  125. package/build/browser/mock/OntologiesV2/TimeSeriesPropertiesV2.js.map +1 -0
  126. package/build/browser/mock/OntologiesV2/TimeSeriesValueBankProperties.js +21 -0
  127. package/build/browser/mock/OntologiesV2/TimeSeriesValueBankProperties.js.map +1 -0
  128. package/build/browser/mock/OntologiesV2/index.js +32 -0
  129. package/build/browser/mock/OntologiesV2/index.js.map +1 -0
  130. package/build/browser/mock/index.js +18 -0
  131. package/build/browser/mock/index.js.map +1 -0
  132. package/build/browser/withoutRid.js +24 -0
  133. package/build/browser/withoutRid.js.map +1 -0
  134. package/build/cjs/index.cjs +2983 -0
  135. package/build/cjs/index.cjs.map +1 -0
  136. package/build/cjs/index.d.cts +562 -0
  137. package/build/esm/BaseError.js +21 -0
  138. package/build/esm/BaseError.js.map +1 -0
  139. package/build/esm/FauxFoundry/BaseOsdkObjectType.js +2 -0
  140. package/build/esm/FauxFoundry/BaseOsdkObjectType.js.map +1 -0
  141. package/build/esm/FauxFoundry/BaseServerObject.js +30 -0
  142. package/build/esm/FauxFoundry/BaseServerObject.js.map +1 -0
  143. package/build/esm/FauxFoundry/FauxActionImpl.js +2 -0
  144. package/build/esm/FauxFoundry/FauxActionImpl.js.map +1 -0
  145. package/build/esm/FauxFoundry/FauxAttachmentStore.js +60 -0
  146. package/build/esm/FauxFoundry/FauxAttachmentStore.js.map +1 -0
  147. package/build/esm/FauxFoundry/FauxDataStore.js +470 -0
  148. package/build/esm/FauxFoundry/FauxDataStore.js.map +1 -0
  149. package/build/esm/FauxFoundry/FauxDataStore.test.js +190 -0
  150. package/build/esm/FauxFoundry/FauxDataStore.test.js.map +1 -0
  151. package/build/esm/FauxFoundry/FauxDataStoreBatch.js +125 -0
  152. package/build/esm/FauxFoundry/FauxDataStoreBatch.js.map +1 -0
  153. package/build/esm/FauxFoundry/FauxFoundry.js +87 -0
  154. package/build/esm/FauxFoundry/FauxFoundry.js.map +1 -0
  155. package/build/esm/FauxFoundry/FauxOntology.js +228 -0
  156. package/build/esm/FauxFoundry/FauxOntology.js.map +1 -0
  157. package/build/esm/FauxFoundry/FauxQueryImpl.js +2 -0
  158. package/build/esm/FauxFoundry/FauxQueryImpl.js.map +1 -0
  159. package/build/esm/FauxFoundry/ObjectLocator.js +29 -0
  160. package/build/esm/FauxFoundry/ObjectLocator.js.map +1 -0
  161. package/build/esm/FauxFoundry/filterObjects.js +122 -0
  162. package/build/esm/FauxFoundry/filterObjects.js.map +1 -0
  163. package/build/esm/FauxFoundry/filterTimeSeriesData.js +70 -0
  164. package/build/esm/FauxFoundry/filterTimeSeriesData.js.map +1 -0
  165. package/build/esm/FauxFoundry/filterTimeSeriesData.test.js +116 -0
  166. package/build/esm/FauxFoundry/filterTimeSeriesData.test.js.map +1 -0
  167. package/build/esm/FauxFoundry/getObjectsFromSet.js +217 -0
  168. package/build/esm/FauxFoundry/getObjectsFromSet.js.map +1 -0
  169. package/build/esm/FauxFoundry/typeHelpers/ActionTypeBuilder.js +64 -0
  170. package/build/esm/FauxFoundry/typeHelpers/ActionTypeBuilder.js.map +1 -0
  171. package/build/esm/FauxFoundry/typeHelpers/JustProps.js +2 -0
  172. package/build/esm/FauxFoundry/typeHelpers/JustProps.js.map +1 -0
  173. package/build/esm/FauxFoundry/typeHelpers/TH_ActionDefinition.js +2 -0
  174. package/build/esm/FauxFoundry/typeHelpers/TH_ActionDefinition.js.map +1 -0
  175. package/build/esm/FauxFoundry/typeHelpers/TH_ActionParameterV2.js +25 -0
  176. package/build/esm/FauxFoundry/typeHelpers/TH_ActionParameterV2.js.map +1 -0
  177. package/build/esm/FauxFoundry/typeHelpers/TH_ActionTypeV2.js +35 -0
  178. package/build/esm/FauxFoundry/typeHelpers/TH_ActionTypeV2.js.map +1 -0
  179. package/build/esm/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.js +2 -0
  180. package/build/esm/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.js.map +1 -0
  181. package/build/esm/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.js +2 -0
  182. package/build/esm/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.js.map +1 -0
  183. package/build/esm/FauxFoundry/typeHelpers/ToObjectTypeDefinition.js +2 -0
  184. package/build/esm/FauxFoundry/typeHelpers/ToObjectTypeDefinition.js.map +1 -0
  185. package/build/esm/FauxFoundry/typeHelpers/index.js +20 -0
  186. package/build/esm/FauxFoundry/typeHelpers/index.js.map +1 -0
  187. package/build/esm/FauxFoundry/validateAction.js +245 -0
  188. package/build/esm/FauxFoundry/validateAction.js.map +1 -0
  189. package/build/esm/defaultOntologyForConjure.js +25 -0
  190. package/build/esm/defaultOntologyForConjure.js.map +1 -0
  191. package/build/esm/defaultOntologyMetadata.js +23 -0
  192. package/build/esm/defaultOntologyMetadata.js.map +1 -0
  193. package/build/esm/errors.js +134 -0
  194. package/build/esm/errors.js.map +1 -0
  195. package/build/esm/filterObjects.js +86 -0
  196. package/build/esm/filterObjects.js.map +1 -0
  197. package/build/esm/handlers/authHandlerMiddleware.js +41 -0
  198. package/build/esm/handlers/authHandlerMiddleware.js.map +1 -0
  199. package/build/esm/handlers/createActionHandlers.js +49 -0
  200. package/build/esm/handlers/createActionHandlers.js.map +1 -0
  201. package/build/esm/handlers/createAttachmentHandlers.js +88 -0
  202. package/build/esm/handlers/createAttachmentHandlers.js.map +1 -0
  203. package/build/esm/handlers/createFauxFoundryHandlers.js +29 -0
  204. package/build/esm/handlers/createFauxFoundryHandlers.js.map +1 -0
  205. package/build/esm/handlers/createLoadObjectsHandlers.js +91 -0
  206. package/build/esm/handlers/createLoadObjectsHandlers.js.map +1 -0
  207. package/build/esm/handlers/createMediaRefHandlers.js +70 -0
  208. package/build/esm/handlers/createMediaRefHandlers.js.map +1 -0
  209. package/build/esm/handlers/createMultipassServerHandlers.js +67 -0
  210. package/build/esm/handlers/createMultipassServerHandlers.js.map +1 -0
  211. package/build/esm/handlers/createObjectSetHandlers.js +50 -0
  212. package/build/esm/handlers/createObjectSetHandlers.js.map +1 -0
  213. package/build/esm/handlers/createOntologyHandlers.js +122 -0
  214. package/build/esm/handlers/createOntologyHandlers.js.map +1 -0
  215. package/build/esm/handlers/createQueryHandlers.js +38 -0
  216. package/build/esm/handlers/createQueryHandlers.js.map +1 -0
  217. package/build/esm/handlers/createTimeseriesAndGeotimeHandlers.js +95 -0
  218. package/build/esm/handlers/createTimeseriesAndGeotimeHandlers.js.map +1 -0
  219. package/build/esm/handlers/util/getPaginationParams.js +33 -0
  220. package/build/esm/handlers/util/getPaginationParams.js.map +1 -0
  221. package/build/esm/handlers/util/handleOpenApiCall.js +85 -0
  222. package/build/esm/handlers/util/handleOpenApiCall.js.map +1 -0
  223. package/build/esm/handlers/util/loadAll.js +24 -0
  224. package/build/esm/handlers/util/loadAll.js.map +1 -0
  225. package/build/esm/handlers/util/pageThroughResponseSearchParams.js +39 -0
  226. package/build/esm/handlers/util/pageThroughResponseSearchParams.js.map +1 -0
  227. package/build/esm/handlers/util/requireParam.js +29 -0
  228. package/build/esm/handlers/util/requireParam.js.map +1 -0
  229. package/build/esm/handlers/util/requireSearchParams.js +29 -0
  230. package/build/esm/handlers/util/requireSearchParams.js.map +1 -0
  231. package/build/esm/index.js +29 -0
  232. package/build/esm/index.js.map +1 -0
  233. package/build/esm/mock/OntologiesV2/ActionTypesV2.js +21 -0
  234. package/build/esm/mock/OntologiesV2/ActionTypesV2.js.map +1 -0
  235. package/build/esm/mock/OntologiesV2/Actions.js +21 -0
  236. package/build/esm/mock/OntologiesV2/Actions.js.map +1 -0
  237. package/build/esm/mock/OntologiesV2/AttachmentPropertiesV2.js +21 -0
  238. package/build/esm/mock/OntologiesV2/AttachmentPropertiesV2.js.map +1 -0
  239. package/build/esm/mock/OntologiesV2/Attachments.js +22 -0
  240. package/build/esm/mock/OntologiesV2/Attachments.js.map +1 -0
  241. package/build/esm/mock/OntologiesV2/LinkedObjectsV2.js +21 -0
  242. package/build/esm/mock/OntologiesV2/LinkedObjectsV2.js.map +1 -0
  243. package/build/esm/mock/OntologiesV2/MediaReferenceProperties.js +22 -0
  244. package/build/esm/mock/OntologiesV2/MediaReferenceProperties.js.map +1 -0
  245. package/build/esm/mock/OntologiesV2/ObjectTypesV2.js +24 -0
  246. package/build/esm/mock/OntologiesV2/ObjectTypesV2.js.map +1 -0
  247. package/build/esm/mock/OntologiesV2/OntologiesV2.js +27 -0
  248. package/build/esm/mock/OntologiesV2/OntologiesV2.js.map +1 -0
  249. package/build/esm/mock/OntologiesV2/OntologyInterfaces.js +21 -0
  250. package/build/esm/mock/OntologiesV2/OntologyInterfaces.js.map +1 -0
  251. package/build/esm/mock/OntologiesV2/OntologyObjectSets.js +22 -0
  252. package/build/esm/mock/OntologiesV2/OntologyObjectSets.js.map +1 -0
  253. package/build/esm/mock/OntologiesV2/OntologyObjectsV2.js +21 -0
  254. package/build/esm/mock/OntologiesV2/OntologyObjectsV2.js.map +1 -0
  255. package/build/esm/mock/OntologiesV2/Queries.js +20 -0
  256. package/build/esm/mock/OntologiesV2/Queries.js.map +1 -0
  257. package/build/esm/mock/OntologiesV2/QueryTypes.js +21 -0
  258. package/build/esm/mock/OntologiesV2/QueryTypes.js.map +1 -0
  259. package/build/esm/mock/OntologiesV2/TimeSeriesPropertiesV2.js +22 -0
  260. package/build/esm/mock/OntologiesV2/TimeSeriesPropertiesV2.js.map +1 -0
  261. package/build/esm/mock/OntologiesV2/TimeSeriesValueBankProperties.js +21 -0
  262. package/build/esm/mock/OntologiesV2/TimeSeriesValueBankProperties.js.map +1 -0
  263. package/build/esm/mock/OntologiesV2/index.js +32 -0
  264. package/build/esm/mock/OntologiesV2/index.js.map +1 -0
  265. package/build/esm/mock/index.js +18 -0
  266. package/build/esm/mock/index.js.map +1 -0
  267. package/build/esm/withoutRid.js +24 -0
  268. package/build/esm/withoutRid.js.map +1 -0
  269. package/build/types/BaseError.d.ts +7 -0
  270. package/build/types/BaseError.d.ts.map +1 -0
  271. package/build/types/FauxFoundry/BaseOsdkObjectType.d.ts +5 -0
  272. package/build/types/FauxFoundry/BaseOsdkObjectType.d.ts.map +1 -0
  273. package/build/types/FauxFoundry/BaseServerObject.d.ts +18 -0
  274. package/build/types/FauxFoundry/BaseServerObject.d.ts.map +1 -0
  275. package/build/types/FauxFoundry/FauxActionImpl.d.ts +8 -0
  276. package/build/types/FauxFoundry/FauxActionImpl.d.ts.map +1 -0
  277. package/build/types/FauxFoundry/FauxAttachmentStore.d.ts +10 -0
  278. package/build/types/FauxFoundry/FauxAttachmentStore.d.ts.map +1 -0
  279. package/build/types/FauxFoundry/FauxDataStore.d.ts +70 -0
  280. package/build/types/FauxFoundry/FauxDataStore.d.ts.map +1 -0
  281. package/build/types/FauxFoundry/FauxDataStore.test.d.ts +1 -0
  282. package/build/types/FauxFoundry/FauxDataStore.test.d.ts.map +1 -0
  283. package/build/types/FauxFoundry/FauxDataStoreBatch.d.ts +22 -0
  284. package/build/types/FauxFoundry/FauxDataStoreBatch.d.ts.map +1 -0
  285. package/build/types/FauxFoundry/FauxFoundry.d.ts +25 -0
  286. package/build/types/FauxFoundry/FauxFoundry.d.ts.map +1 -0
  287. package/build/types/FauxFoundry/FauxOntology.d.ts +39 -0
  288. package/build/types/FauxFoundry/FauxOntology.d.ts.map +1 -0
  289. package/build/types/FauxFoundry/FauxQueryImpl.d.ts +5 -0
  290. package/build/types/FauxFoundry/FauxQueryImpl.d.ts.map +1 -0
  291. package/build/types/FauxFoundry/ObjectLocator.d.ts +11 -0
  292. package/build/types/FauxFoundry/ObjectLocator.d.ts.map +1 -0
  293. package/build/types/FauxFoundry/filterObjects.d.ts +3 -0
  294. package/build/types/FauxFoundry/filterObjects.d.ts.map +1 -0
  295. package/build/types/FauxFoundry/filterTimeSeriesData.d.ts +2 -0
  296. package/build/types/FauxFoundry/filterTimeSeriesData.d.ts.map +1 -0
  297. package/build/types/FauxFoundry/filterTimeSeriesData.test.d.ts +1 -0
  298. package/build/types/FauxFoundry/filterTimeSeriesData.test.d.ts.map +1 -0
  299. package/build/types/FauxFoundry/getObjectsFromSet.d.ts +6 -0
  300. package/build/types/FauxFoundry/getObjectsFromSet.d.ts.map +1 -0
  301. package/build/types/FauxFoundry/typeHelpers/ActionTypeBuilder.d.ts +27 -0
  302. package/build/types/FauxFoundry/typeHelpers/ActionTypeBuilder.d.ts.map +1 -0
  303. package/build/types/FauxFoundry/typeHelpers/JustProps.d.ts +4 -0
  304. package/build/types/FauxFoundry/typeHelpers/JustProps.d.ts.map +1 -0
  305. package/build/types/FauxFoundry/typeHelpers/TH_ActionDefinition.d.ts +43 -0
  306. package/build/types/FauxFoundry/typeHelpers/TH_ActionDefinition.d.ts.map +1 -0
  307. package/build/types/FauxFoundry/typeHelpers/TH_ActionParameterV2.d.ts +15 -0
  308. package/build/types/FauxFoundry/typeHelpers/TH_ActionParameterV2.d.ts.map +1 -0
  309. package/build/types/FauxFoundry/typeHelpers/TH_ActionTypeV2.d.ts +8 -0
  310. package/build/types/FauxFoundry/typeHelpers/TH_ActionTypeV2.d.ts.map +1 -0
  311. package/build/types/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.d.ts +24 -0
  312. package/build/types/FauxFoundry/typeHelpers/TH_ApplyActionRequestV2.d.ts.map +1 -0
  313. package/build/types/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.d.ts +18 -0
  314. package/build/types/FauxFoundry/typeHelpers/TH_ObjectTypeFullMetadata.d.ts.map +1 -0
  315. package/build/types/FauxFoundry/typeHelpers/ToObjectTypeDefinition.d.ts +12 -0
  316. package/build/types/FauxFoundry/typeHelpers/ToObjectTypeDefinition.d.ts.map +1 -0
  317. package/build/types/FauxFoundry/typeHelpers/index.d.ts +10 -0
  318. package/build/types/FauxFoundry/typeHelpers/index.d.ts.map +1 -0
  319. package/build/types/FauxFoundry/validateAction.d.ts +9 -0
  320. package/build/types/FauxFoundry/validateAction.d.ts.map +1 -0
  321. package/build/types/defaultOntologyForConjure.d.ts +7 -0
  322. package/build/types/defaultOntologyForConjure.d.ts.map +1 -0
  323. package/build/types/defaultOntologyMetadata.d.ts +2 -0
  324. package/build/types/defaultOntologyMetadata.d.ts.map +1 -0
  325. package/build/types/errors.d.ts +14 -0
  326. package/build/types/errors.d.ts.map +1 -0
  327. package/build/types/filterObjects.d.ts +8 -0
  328. package/build/types/filterObjects.d.ts.map +1 -0
  329. package/build/types/handlers/authHandlerMiddleware.d.ts +5 -0
  330. package/build/types/handlers/authHandlerMiddleware.d.ts.map +1 -0
  331. package/build/types/handlers/createActionHandlers.d.ts +3 -0
  332. package/build/types/handlers/createActionHandlers.d.ts.map +1 -0
  333. package/build/types/handlers/createAttachmentHandlers.d.ts +2 -0
  334. package/build/types/handlers/createAttachmentHandlers.d.ts.map +1 -0
  335. package/build/types/handlers/createFauxFoundryHandlers.d.ts +4 -0
  336. package/build/types/handlers/createFauxFoundryHandlers.d.ts.map +1 -0
  337. package/build/types/handlers/createLoadObjectsHandlers.d.ts +2 -0
  338. package/build/types/handlers/createLoadObjectsHandlers.d.ts.map +1 -0
  339. package/build/types/handlers/createMediaRefHandlers.d.ts +2 -0
  340. package/build/types/handlers/createMediaRefHandlers.d.ts.map +1 -0
  341. package/build/types/handlers/createMultipassServerHandlers.d.ts +2 -0
  342. package/build/types/handlers/createMultipassServerHandlers.d.ts.map +1 -0
  343. package/build/types/handlers/createObjectSetHandlers.d.ts +3 -0
  344. package/build/types/handlers/createObjectSetHandlers.d.ts.map +1 -0
  345. package/build/types/handlers/createOntologyHandlers.d.ts +4 -0
  346. package/build/types/handlers/createOntologyHandlers.d.ts.map +1 -0
  347. package/build/types/handlers/createQueryHandlers.d.ts +2 -0
  348. package/build/types/handlers/createQueryHandlers.d.ts.map +1 -0
  349. package/build/types/handlers/createTimeseriesAndGeotimeHandlers.d.ts +2 -0
  350. package/build/types/handlers/createTimeseriesAndGeotimeHandlers.d.ts.map +1 -0
  351. package/build/types/handlers/util/getPaginationParams.d.ts +11 -0
  352. package/build/types/handlers/util/getPaginationParams.d.ts.map +1 -0
  353. package/build/types/handlers/util/handleOpenApiCall.d.ts +49 -0
  354. package/build/types/handlers/util/handleOpenApiCall.d.ts.map +1 -0
  355. package/build/types/handlers/util/loadAll.d.ts +1 -0
  356. package/build/types/handlers/util/loadAll.d.ts.map +1 -0
  357. package/build/types/handlers/util/pageThroughResponseSearchParams.d.ts +20 -0
  358. package/build/types/handlers/util/pageThroughResponseSearchParams.d.ts.map +1 -0
  359. package/build/types/handlers/util/requireParam.d.ts +8 -0
  360. package/build/types/handlers/util/requireParam.d.ts.map +1 -0
  361. package/build/types/handlers/util/requireSearchParams.d.ts +2 -0
  362. package/build/types/handlers/util/requireSearchParams.d.ts.map +1 -0
  363. package/build/types/index.d.ts +14 -0
  364. package/build/types/index.d.ts.map +1 -0
  365. package/build/types/mock/OntologiesV2/ActionTypesV2.d.ts +4 -0
  366. package/build/types/mock/OntologiesV2/ActionTypesV2.d.ts.map +1 -0
  367. package/build/types/mock/OntologiesV2/Actions.d.ts +4 -0
  368. package/build/types/mock/OntologiesV2/Actions.d.ts.map +1 -0
  369. package/build/types/mock/OntologiesV2/AttachmentPropertiesV2.d.ts +4 -0
  370. package/build/types/mock/OntologiesV2/AttachmentPropertiesV2.d.ts.map +1 -0
  371. package/build/types/mock/OntologiesV2/Attachments.d.ts +5 -0
  372. package/build/types/mock/OntologiesV2/Attachments.d.ts.map +1 -0
  373. package/build/types/mock/OntologiesV2/LinkedObjectsV2.d.ts +4 -0
  374. package/build/types/mock/OntologiesV2/LinkedObjectsV2.d.ts.map +1 -0
  375. package/build/types/mock/OntologiesV2/MediaReferenceProperties.d.ts +5 -0
  376. package/build/types/mock/OntologiesV2/MediaReferenceProperties.d.ts.map +1 -0
  377. package/build/types/mock/OntologiesV2/ObjectTypesV2.d.ts +7 -0
  378. package/build/types/mock/OntologiesV2/ObjectTypesV2.d.ts.map +1 -0
  379. package/build/types/mock/OntologiesV2/OntologiesV2.d.ts +9 -0
  380. package/build/types/mock/OntologiesV2/OntologiesV2.d.ts.map +1 -0
  381. package/build/types/mock/OntologiesV2/OntologyInterfaces.d.ts +4 -0
  382. package/build/types/mock/OntologiesV2/OntologyInterfaces.d.ts.map +1 -0
  383. package/build/types/mock/OntologiesV2/OntologyObjectSets.d.ts +5 -0
  384. package/build/types/mock/OntologiesV2/OntologyObjectSets.d.ts.map +1 -0
  385. package/build/types/mock/OntologiesV2/OntologyObjectsV2.d.ts +4 -0
  386. package/build/types/mock/OntologiesV2/OntologyObjectsV2.d.ts.map +1 -0
  387. package/build/types/mock/OntologiesV2/Queries.d.ts +3 -0
  388. package/build/types/mock/OntologiesV2/Queries.d.ts.map +1 -0
  389. package/build/types/mock/OntologiesV2/QueryTypes.d.ts +4 -0
  390. package/build/types/mock/OntologiesV2/QueryTypes.d.ts.map +1 -0
  391. package/build/types/mock/OntologiesV2/TimeSeriesPropertiesV2.d.ts +5 -0
  392. package/build/types/mock/OntologiesV2/TimeSeriesPropertiesV2.d.ts.map +1 -0
  393. package/build/types/mock/OntologiesV2/TimeSeriesValueBankProperties.d.ts +4 -0
  394. package/build/types/mock/OntologiesV2/TimeSeriesValueBankProperties.d.ts.map +1 -0
  395. package/build/types/mock/OntologiesV2/index.d.ts +15 -0
  396. package/build/types/mock/OntologiesV2/index.d.ts.map +1 -0
  397. package/build/types/mock/index.d.ts +1 -0
  398. package/build/types/mock/index.d.ts.map +1 -0
  399. package/build/types/withoutRid.d.ts +3 -0
  400. package/build/types/withoutRid.d.ts.map +1 -0
  401. package/package.json +88 -0
@@ -0,0 +1,122 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /* eslint-disable @typescript-eslint/require-await */
18
+
19
+ import { http as rest, HttpResponse } from "msw";
20
+ import { defaultOntologyForConjure } from "../defaultOntologyForConjure.js";
21
+ import { defaultOntologyMetadata } from "../defaultOntologyMetadata.js";
22
+ import { OntologiesV2 } from "../mock/index.js";
23
+ import { authHandlerMiddleware } from "./authHandlerMiddleware.js";
24
+ export const createOntologyHandlers = (baseUrl, fauxFoundry) => [
25
+ /**
26
+ * Load full Ontology metadata
27
+ */
28
+ OntologiesV2.OntologiesV2.getFullMetadata(baseUrl, async req => {
29
+ return fauxFoundry.getOntology(req.params.ontologyApiName).getOntologyFullMetadata();
30
+ }),
31
+ /**
32
+ * Load ontology metadata for the requested object, link, action, query, and interface types.
33
+ */
34
+ OntologiesV2.OntologiesV2.loadMetadata(baseUrl, async ({
35
+ params,
36
+ request
37
+ }) => {
38
+ return fauxFoundry.getOntology(params.ontologyApiName).getFilteredOntologyMetadata(await request.json());
39
+ }), OntologiesV2.ObjectTypesV2.get(baseUrl, async req => {
40
+ return fauxFoundry.getOntology(req.params.ontologyApiName).getObjectTypeFullMetadataOrThrow(req.params.objectTypeApiName).objectType;
41
+ }), OntologiesV2.ObjectTypesV2.getFullMetadata(baseUrl, async req => {
42
+ return fauxFoundry.getOntology(req.params.ontologyApiName).getObjectTypeFullMetadataOrThrow(req.params.objectTypeApiName);
43
+ }),
44
+ /**
45
+ * List ActionTypes
46
+ */
47
+ OntologiesV2.ActionTypesV2.list(baseUrl, async ({
48
+ params
49
+ }) => {
50
+ return {
51
+ data: fauxFoundry.getOntology(params.ontologyApiName).getAllActionTypes()
52
+ };
53
+ }), OntologiesV2.ActionTypesV2.get(baseUrl, async req => {
54
+ return fauxFoundry.getOntology(req.params.ontologyApiName).getActionDef(req.params.actionTypeApiName);
55
+ }), OntologiesV2.QueryTypes.get(baseUrl, async req => {
56
+ const queryParams = Object.fromEntries(new URL(req.request.url).searchParams.entries());
57
+ const version = queryParams["version"];
58
+ return fauxFoundry.getOntology(req.params.ontologyApiName).getQueryDef(version ? `${req.params.queryTypeApiName}:${version}` : req.params.queryTypeApiName);
59
+ }), OntologiesV2.ObjectTypesV2.getOutgoingLinkType(baseUrl, async ({
60
+ params
61
+ }) => {
62
+ return fauxFoundry.getOntology(params.ontology).getLinkTypeSideV2(params.objectType, params.linkType);
63
+ }), OntologiesV2.ObjectTypesV2.listOutgoingLinkTypes(baseUrl, async ({
64
+ params
65
+ }) => {
66
+ return {
67
+ data: fauxFoundry.getOntology(params.ontology).getObjectTypeFullMetadataOrThrow(params.objectType).linkTypes
68
+ };
69
+ }), OntologiesV2.OntologyInterfaces.list(baseUrl, async req => {
70
+ return {
71
+ data: fauxFoundry.getOntology(req.params.ontologyApiName).getAllInterfaceTypes()
72
+ };
73
+ }), OntologiesV2.OntologyInterfaces.get(baseUrl, ({
74
+ params
75
+ }) => {
76
+ return fauxFoundry.getOntology(params.ontologyApiName).getInterfaceType(params.interfaceType);
77
+ }),
78
+ /**
79
+ * List ontologies
80
+ */
81
+ OntologiesV2.OntologiesV2.list(baseUrl, async () => {
82
+ return {
83
+ data: fauxFoundry.getEveryOntology().map(x => x.getOntologyFullMetadata().ontology)
84
+ };
85
+ }),
86
+ /**
87
+ * Get specified Ontology
88
+ */
89
+ OntologiesV2.OntologiesV2.get(baseUrl, async req => {
90
+ return fauxFoundry.getOntology(req.params.ontologyRid).getOntologyFullMetadata().ontology;
91
+ }),
92
+ /**
93
+ * List objectTypes V2
94
+ */
95
+ OntologiesV2.ObjectTypesV2.list(baseUrl, async req => {
96
+ return {
97
+ data: fauxFoundry.getOntology(req.params.ontologyApiName).getAllObjectTypes().map(x => x.objectType)
98
+ };
99
+ }),
100
+ /**
101
+ * List Queries
102
+ */
103
+ OntologiesV2.QueryTypes.list(baseUrl, async req => {
104
+ return {
105
+ data: fauxFoundry.getOntology(req.params.ontologyApiName).getAllQueryTypes()
106
+ };
107
+ })];
108
+ export const conjureEndpoint = [rest.post(`https://stack.palantir.com/ontology-metadata/api/ontology/ontology/ontologies/load/all`, authHandlerMiddleware(async () => {
109
+ return HttpResponse.json({
110
+ ontologies: {
111
+ "ri.ontology.main.ontology.f34bca54-eb0f-41ad-84f0-d562d9f2763a": {
112
+ apiName: "ontology-migration-source",
113
+ displayName: "Ontology Migration Test Source",
114
+ description: "",
115
+ currentOntologyVersion: "0000000c-040d-f49d-b7e8-79fa53caacf5",
116
+ defaultBranchRid: "ri.ontology.main.branch.122438ac-a6b7-46e9-825f-6c911ffff857"
117
+ },
118
+ [defaultOntologyMetadata.rid]: defaultOntologyForConjure
119
+ }
120
+ });
121
+ }))];
122
+ //# sourceMappingURL=createOntologyHandlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createOntologyHandlers.js","names":["http","rest","HttpResponse","defaultOntologyForConjure","defaultOntologyMetadata","OntologiesV2","authHandlerMiddleware","createOntologyHandlers","baseUrl","fauxFoundry","getFullMetadata","req","getOntology","params","ontologyApiName","getOntologyFullMetadata","loadMetadata","request","getFilteredOntologyMetadata","json","ObjectTypesV2","get","getObjectTypeFullMetadataOrThrow","objectTypeApiName","objectType","ActionTypesV2","list","data","getAllActionTypes","getActionDef","actionTypeApiName","QueryTypes","queryParams","Object","fromEntries","URL","url","searchParams","entries","version","getQueryDef","queryTypeApiName","getOutgoingLinkType","ontology","getLinkTypeSideV2","linkType","listOutgoingLinkTypes","linkTypes","OntologyInterfaces","getAllInterfaceTypes","getInterfaceType","interfaceType","getEveryOntology","map","x","ontologyRid","getAllObjectTypes","getAllQueryTypes","conjureEndpoint","post","ontologies","apiName","displayName","description","currentOntologyVersion","defaultBranchRid","rid"],"sources":["createOntologyHandlers.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable @typescript-eslint/require-await */\n\nimport type { RequestHandler } from \"msw\";\nimport { http as rest, HttpResponse } from \"msw\";\nimport { defaultOntologyForConjure } from \"../defaultOntologyForConjure.js\";\nimport { defaultOntologyMetadata } from \"../defaultOntologyMetadata.js\";\nimport { OntologiesV2 } from \"../mock/index.js\";\nimport { authHandlerMiddleware } from \"./authHandlerMiddleware.js\";\nimport type { FauxFoundryHandlersFactory } from \"./createFauxFoundryHandlers.js\";\n\nexport const createOntologyHandlers: FauxFoundryHandlersFactory = (\n baseUrl,\n fauxFoundry,\n) => [\n /**\n * Load full Ontology metadata\n */\n OntologiesV2.OntologiesV2.getFullMetadata(\n baseUrl,\n async (req) => {\n return fauxFoundry\n .getOntology(req.params.ontologyApiName)\n .getOntologyFullMetadata();\n },\n ),\n\n /**\n * Load ontology metadata for the requested object, link, action, query, and interface types.\n */\n OntologiesV2.OntologiesV2.loadMetadata(\n baseUrl,\n async ({ params, request }) => {\n return fauxFoundry\n .getOntology(params.ontologyApiName)\n .getFilteredOntologyMetadata(await request.json());\n },\n ),\n\n OntologiesV2.ObjectTypesV2.get(\n baseUrl,\n async (req) => {\n return fauxFoundry\n .getOntology(req.params.ontologyApiName)\n .getObjectTypeFullMetadataOrThrow(req.params.objectTypeApiName)\n .objectType;\n },\n ),\n\n OntologiesV2.ObjectTypesV2.getFullMetadata(\n baseUrl,\n async (req) => {\n return fauxFoundry\n .getOntology(req.params.ontologyApiName)\n .getObjectTypeFullMetadataOrThrow(req.params.objectTypeApiName);\n },\n ),\n\n /**\n * List ActionTypes\n */\n OntologiesV2.ActionTypesV2.list(\n baseUrl,\n async ({ params }) => {\n return {\n data: fauxFoundry\n .getOntology(params.ontologyApiName)\n .getAllActionTypes(),\n };\n },\n ),\n\n OntologiesV2.ActionTypesV2.get(\n baseUrl,\n async (req) => {\n return fauxFoundry\n .getOntology(req.params.ontologyApiName)\n .getActionDef(req.params.actionTypeApiName);\n },\n ),\n\n OntologiesV2.QueryTypes.get(\n baseUrl,\n async (req) => {\n const queryParams = Object.fromEntries(\n new URL(req.request.url).searchParams.entries(),\n );\n\n const version = queryParams[\"version\"];\n return fauxFoundry\n .getOntology(req.params.ontologyApiName)\n .getQueryDef(\n version\n ? `${req.params.queryTypeApiName}:${version}`\n : req.params.queryTypeApiName,\n );\n },\n ),\n\n OntologiesV2.ObjectTypesV2.getOutgoingLinkType(\n baseUrl,\n async ({ params }) => {\n return fauxFoundry\n .getOntology(params.ontology)\n .getLinkTypeSideV2(params.objectType, params.linkType);\n },\n ),\n\n OntologiesV2.ObjectTypesV2.listOutgoingLinkTypes(\n baseUrl,\n async ({ params }) => {\n return {\n data: fauxFoundry\n .getOntology(params.ontology)\n .getObjectTypeFullMetadataOrThrow(params.objectType).linkTypes,\n };\n },\n ),\n\n OntologiesV2.OntologyInterfaces.list(\n baseUrl,\n async (req) => {\n return {\n data: fauxFoundry\n .getOntology(req.params.ontologyApiName)\n .getAllInterfaceTypes(),\n };\n },\n ),\n\n OntologiesV2.OntologyInterfaces.get(\n baseUrl,\n ({ params }) => {\n return fauxFoundry\n .getOntology(params.ontologyApiName)\n .getInterfaceType(params.interfaceType);\n },\n ),\n\n /**\n * List ontologies\n */\n OntologiesV2.OntologiesV2.list(\n baseUrl,\n async () => {\n return {\n data: fauxFoundry\n .getEveryOntology()\n .map(x => x.getOntologyFullMetadata().ontology),\n };\n },\n ),\n\n /**\n * Get specified Ontology\n */\n OntologiesV2.OntologiesV2.get(\n baseUrl,\n async req => {\n return fauxFoundry\n .getOntology(req.params.ontologyRid)\n .getOntologyFullMetadata()\n .ontology;\n },\n ),\n\n /**\n * List objectTypes V2\n */\n OntologiesV2.ObjectTypesV2.list(\n baseUrl,\n async req => {\n return {\n data: fauxFoundry\n .getOntology(req.params.ontologyApiName)\n .getAllObjectTypes()\n .map(x => x.objectType),\n };\n },\n ),\n\n /**\n * List Queries\n */\n OntologiesV2.QueryTypes.list(\n baseUrl,\n async (req) => {\n return {\n data: fauxFoundry.getOntology(req.params.ontologyApiName)\n .getAllQueryTypes(),\n };\n },\n ),\n];\n\nexport const conjureEndpoint: Array<RequestHandler> = [\n rest.post(\n `https://stack.palantir.com/ontology-metadata/api/ontology/ontology/ontologies/load/all`,\n authHandlerMiddleware(\n async () => {\n return HttpResponse.json(\n {\n ontologies: {\n \"ri.ontology.main.ontology.f34bca54-eb0f-41ad-84f0-d562d9f2763a\":\n {\n apiName: \"ontology-migration-source\",\n displayName: \"Ontology Migration Test Source\",\n description: \"\",\n currentOntologyVersion:\n \"0000000c-040d-f49d-b7e8-79fa53caacf5\",\n defaultBranchRid:\n \"ri.ontology.main.branch.122438ac-a6b7-46e9-825f-6c911ffff857\",\n },\n [defaultOntologyMetadata.rid]: defaultOntologyForConjure,\n },\n },\n );\n },\n ),\n ),\n];\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAGA,SAASA,IAAI,IAAIC,IAAI,EAAEC,YAAY,QAAQ,KAAK;AACh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W,CAACD,GAAG,CAACE,MAAM,CAACC,eAAe,CAAC,CACvC0C,iBAAiB,CAAC,CAAC,CACnBH,GAAG,CAACC,CAAC,IAAIA,CAAC,CAAC9B,UAAU;EAC1B,CAAC;AACH,CACF,CAAC;AAED;AACF;AACA;AACEnB,YAAY,CAAC0B,UAAU,CAACL,IAAI,CAC1BlB,OAAO,EACP,MAAOG,GAAG,IAAK;EACb,OAAO;IACLgB,IAAI,EAAElB,WAAW,CAACG,WAAW,CAACD,GAAG,CAACE,MAAM,CAACC,eAAe,CAAC,CACtD2C,gBAAgB,CAAC;EACtB,CAAC;AACH,CACF,CAAC,CACF;AAED,OAAO,MAAMC,eAAsC,GAAG,CACpDzD,IAAI,CAAC0D,IAAI,CACP,wFAAwF,EACxFrD,qBAAqB,CACnB,YAAY;EACV,OAAOJ,YAAY,CAACiB,IAAI,CACtB;IACEyC,UAAU,EAAE;MACV,gEAAgE,EAC9D;QACEC,OAAO,EAAE,2BAA2B;QACpCC,WAAW,EAAE,gCAAgC;QAC7CC,WAAW,EAAE,EAAE;QACfC,sBAAsB,EACpB,sCAAsC;QACxCC,gBAAgB,EACd;MACJ,CAAC;MACH,CAAC7D,uBAAuB,CAAC8D,GAAG,GAAG/D;IACjC;EACF,CACF,CAAC;AACH,CACF,CACF,CAAC,CACF","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { valid } from "semver";
18
+ import { OntologiesV2 } from "../mock/index.js";
19
+ export const createQueryHandlers = (baseUrl, fauxFoundry) => [
20
+ /**
21
+ * Execute Queries
22
+ */
23
+ OntologiesV2.Queries.execute(baseUrl, async ({
24
+ request,
25
+ params: {
26
+ ontologyApiName,
27
+ queryApiName
28
+ }
29
+ }) => {
30
+ const queryParams = Object.fromEntries(new URL(request.url).searchParams.entries());
31
+ const version = queryParams["version"];
32
+ if (!valid(version)) {
33
+ throw new Error(`Invalid version "${version}" for query "${queryApiName}" in ontology "${ontologyApiName}: not semver compatible".`);
34
+ }
35
+ const queryImpl = fauxFoundry.getOntology(ontologyApiName).getQueryImpl(queryApiName, version);
36
+ return queryImpl(await request.json(), fauxFoundry.getDataStore(ontologyApiName));
37
+ })];
38
+ //# sourceMappingURL=createQueryHandlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQueryHandlers.js","names":["valid","OntologiesV2","createQueryHandlers","baseUrl","fauxFoundry","Queries","execute","request","params","ontologyApiName","queryApiName","queryParams","Object","fromEntries","URL","url","searchParams","entries","version","Error","queryImpl","getOntology","getQueryImpl","json","getDataStore"],"sources":["createQueryHandlers.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { valid } from \"semver\";\nimport { OntologiesV2 } from \"../mock/index.js\";\nimport type { FauxFoundryHandlersFactory } from \"./createFauxFoundryHandlers.js\";\n\nexport const createQueryHandlers: FauxFoundryHandlersFactory = (\n baseUrl,\n fauxFoundry,\n) => [\n /**\n * Execute Queries\n */\n OntologiesV2.Queries.execute(\n baseUrl,\n async ({ request, params: { ontologyApiName, queryApiName } }) => {\n const queryParams = Object.fromEntries(\n new URL(request.url).searchParams.entries(),\n );\n\n const version = queryParams[\"version\"];\n if (!valid(version)) {\n throw new Error(\n `Invalid version \"${version}\" for query \"${queryApiName}\" in ontology \"${ontologyApiName}: not semver compatible\".`,\n );\n }\n\n const queryImpl = fauxFoundry\n .getOntology(ontologyApiName)\n .getQueryImpl(queryApiName, version);\n\n return queryImpl(\n await request.json(),\n fauxFoundry.getDataStore(ontologyApiName),\n );\n },\n ),\n];\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,KAAK,QAAQ,QAAQ;AAC9B,SAASC,YAAY,QAAQ,kBAAkB;AAG/C,OAAO,MAAMC,mBAA+C,GAAGA,CAC7DC,OAAO,EACPC,WAAW,KACR;AACH;AACF;AACA;AACEH,YAAY,CAACI,OAAO,CAACC,OAAO,CAC1BH,OAAO,EACP,OAAO;EAAEI,OAAO;EAAEC,MAAM,EAAE;IAAEC,eAAe;IAAEC;EAAa;AAAE,CAAC,KAAK;EAChE,MAAMC,WAAW,GAAGC,MAAM,CAACC,WAAW,CACpC,IAAIC,GAAG,CAACP,OAAO,CAACQ,GAAG,CAAC,CAACC,YAAY,CAACC,OAAO,CAAC,CAC5C,CAAC;EAED,MAAMC,OAAO,GAAGP,WAAW,CAAC,SAAS,CAAC;EACtC,IAAI,CAACX,KAAK,CAACkB,OAAO,CAAC,EAAE;IACnB,MAAM,IAAIC,KAAK,CACb,oBAAoBD,OAAO,gBAAgBR,YAAY,kBAAkBD,eAAe,2BAC1F,CAAC;EACH;EAEA,MAAMW,SAAS,GAAGhB,WAAW,CAC1BiB,WAAW,CAACZ,eAAe,CAAC,CAC5Ba,YAAY,CAACZ,YAAY,EAAEQ,OAAO,CAAC;EAEtC,OAAOE,SAAS,CACd,MAAMb,OAAO,CAACgB,IAAI,CAAC,CAAC,EACpBnB,WAAW,CAACoB,YAAY,CAACf,eAAe,CAC1C,CAAC;AACH,CACF,CAAC,CACF","ignoreList":[]}
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ /* eslint-disable @typescript-eslint/require-await */
18
+
19
+ import { InvalidRequest } from "../errors.js";
20
+ import { OntologiesV2 } from "../mock/index.js";
21
+ import { OpenApiCallError } from "./util/handleOpenApiCall.js";
22
+ export const createTimeseriesAndGeotimeHandlers = (baseUrl, fauxFoundry) => [
23
+ /**
24
+ * Load firstPoint
25
+ */
26
+
27
+ OntologiesV2.TimeSeriesPropertiesV2.getFirstPoint(baseUrl, async ({
28
+ params: {
29
+ objectType,
30
+ ontologyApiName,
31
+ primaryKey,
32
+ propertyName
33
+ }
34
+ }) => {
35
+ return fauxFoundry.getDataStore(ontologyApiName).getTimeSeriesData(objectType, primaryKey, propertyName).at(0);
36
+ }),
37
+ /**
38
+ * Load lastPoint
39
+ */
40
+ OntologiesV2.TimeSeriesPropertiesV2.getLastPoint(baseUrl, async ({
41
+ params: {
42
+ objectType,
43
+ ontologyApiName,
44
+ primaryKey,
45
+ propertyName
46
+ }
47
+ }) => {
48
+ return fauxFoundry.getDataStore(ontologyApiName).getTimeSeriesData(objectType, primaryKey, propertyName).at(-1);
49
+ }),
50
+ /**
51
+ * stream points
52
+ */
53
+ OntologiesV2.TimeSeriesPropertiesV2.streamPoints(baseUrl, async ({
54
+ request,
55
+ params: {
56
+ objectType,
57
+ ontologyApiName,
58
+ primaryKey,
59
+ propertyName
60
+ }
61
+ }) => {
62
+ return Response.json(fauxFoundry.getDataStore(ontologyApiName).getTimeSeriesData(objectType, primaryKey, propertyName, await request.json()));
63
+ }),
64
+ /**
65
+ * Load latestValue
66
+ */
67
+ OntologiesV2.TimeSeriesValueBankProperties.getLatestValue(baseUrl, async ({
68
+ params: {
69
+ objectType,
70
+ ontologyApiName,
71
+ primaryKey,
72
+ propertyName
73
+ }
74
+ }) => {
75
+ const ret = fauxFoundry.getDataStore(ontologyApiName).getTimeSeriesData(objectType, primaryKey, propertyName).at(-1);
76
+ if (!ret) {
77
+ throw new OpenApiCallError(400, InvalidRequest("Invalid request"));
78
+ }
79
+ return ret;
80
+ }),
81
+ /**
82
+ * stream values
83
+ */
84
+ OntologiesV2.TimeSeriesValueBankProperties.streamValues(baseUrl, async ({
85
+ request,
86
+ params: {
87
+ objectType,
88
+ ontologyApiName,
89
+ primaryKey,
90
+ propertyName
91
+ }
92
+ }) => {
93
+ return Response.json(fauxFoundry.getDataStore(ontologyApiName).getTimeSeriesData(objectType, primaryKey, propertyName, await request.json()));
94
+ })];
95
+ //# sourceMappingURL=createTimeseriesAndGeotimeHandlers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTimeseriesAndGeotimeHandlers.js","names":["InvalidRequest","OntologiesV2","OpenApiCallError","createTimeseriesAndGeotimeHandlers","baseUrl","fauxFoundry","TimeSeriesPropertiesV2","getFirstPoint","params","objectType","ontologyApiName","primaryKey","propertyName","getDataStore","getTimeSeriesData","at","getLastPoint","streamPoints","request","Response","json","TimeSeriesValueBankProperties","getLatestValue","ret","streamValues"],"sources":["createTimeseriesAndGeotimeHandlers.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable @typescript-eslint/require-await */\n\nimport { InvalidRequest } from \"../errors.js\";\nimport { OntologiesV2 } from \"../mock/index.js\";\nimport type { FauxFoundryHandlersFactory } from \"./createFauxFoundryHandlers.js\";\nimport { OpenApiCallError } from \"./util/handleOpenApiCall.js\";\n\nexport const createTimeseriesAndGeotimeHandlers: FauxFoundryHandlersFactory = (\n baseUrl,\n fauxFoundry,\n) => [\n /**\n * Load firstPoint\n */\n\n OntologiesV2.TimeSeriesPropertiesV2.getFirstPoint(\n baseUrl,\n async (\n { params: { objectType, ontologyApiName, primaryKey, propertyName } },\n ) => {\n return fauxFoundry.getDataStore(ontologyApiName)\n .getTimeSeriesData(\n objectType,\n primaryKey,\n propertyName,\n ).at(0);\n },\n ),\n\n /**\n * Load lastPoint\n */\n OntologiesV2.TimeSeriesPropertiesV2.getLastPoint(\n baseUrl,\n async (\n { params: { objectType, ontologyApiName, primaryKey, propertyName } },\n ) => {\n return fauxFoundry.getDataStore(ontologyApiName)\n .getTimeSeriesData(\n objectType,\n primaryKey,\n propertyName,\n ).at(-1);\n },\n ),\n\n /**\n * stream points\n */\n OntologiesV2.TimeSeriesPropertiesV2.streamPoints(\n baseUrl,\n async (\n {\n request,\n params: { objectType, ontologyApiName, primaryKey, propertyName },\n },\n ) => {\n return Response.json(\n fauxFoundry.getDataStore(ontologyApiName)\n .getTimeSeriesData(\n objectType,\n primaryKey,\n propertyName,\n await request.json(),\n ),\n );\n },\n ),\n\n /**\n * Load latestValue\n */\n OntologiesV2.TimeSeriesValueBankProperties.getLatestValue(\n baseUrl,\n async (\n { params: { objectType, ontologyApiName, primaryKey, propertyName } },\n ) => {\n const ret = fauxFoundry.getDataStore(ontologyApiName)\n .getTimeSeriesData(\n objectType,\n primaryKey,\n propertyName,\n ).at(-1);\n\n if (!ret) {\n throw new OpenApiCallError(400, InvalidRequest(\"Invalid request\"));\n }\n\n return ret;\n },\n ),\n\n /**\n * stream values\n */\n OntologiesV2.TimeSeriesValueBankProperties.streamValues(\n baseUrl,\n async (\n {\n request,\n params: { objectType, ontologyApiName, primaryKey, propertyName },\n },\n ) => {\n return Response.json(\n fauxFoundry.getDataStore(ontologyApiName)\n .getTimeSeriesData(\n objectType,\n primaryKey,\n propertyName,\n await request.json(),\n ),\n );\n },\n ),\n];\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA,SAASA,cAAc,QAAQ,cAAc;AAC7C,SAASC,YAAY,QAAQ,kBAAkB;AAE/C,SAASC,gBAAgB,QAAQ,6BAA6B;AAE9D,OAAO,MAAMC,kCAA8D,GAAGA,CAC5EC,OAAO,EACPC,WAAW,KACR;AACH;AACF;AACA;;AAEEJ,YAAY,CAACK,sBAAsB,CAACC,aAAa,CAC/CH,OAAO,EACP,OACE;EAAEI,MAAM,EAAE;IAAEC,UAAU;IAAEC,eAAe;IAAEC,UAAU;IAAEC;EAAa;AAAE,CAAC,KAClE;EACH,OAAOP,WAAW,CAACQ,YAAY,CAACH,eAAe,CAAC,CAC7CI,iBAAiB,CAChBL,UAAU,EACVE,UAAU,EACVC,YACF,CAAC,CAACG,EAAE,CAAC,CAAC,CAAC;AACX,CACF,CAAC;AAED;AACF;AACA;AACEd,YAAY,CAACK,sBAAsB,CAACU,YAAY,CAC9CZ,OAAO,EACP,OACE;EAAEI,MAAM,EAAE;IAAEC,UAAU;IAAEC,eAAe;IAAEC,UAAU;IAAEC;EAAa;AAAE,CAAC,KAClE;EACH,OAAOP,WAAW,CAACQ,YAAY,CAACH,eAAe,CAAC,CAC7CI,iBAAiB,CAChBL,UAAU,EACVE,UAAU,EACVC,YACF,CAAC,CAACG,EAAE,CAAC,CAAC,CAAC,CAAC;AACZ,CACF,CAAC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,CAAC,CACF","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export function getPaginationParamsFromUrl(request) {
18
+ const url = new URL(request.url);
19
+ return {
20
+ pageSize: url.searchParams.get("pageSize") == null ? undefined : Number(url.searchParams.get("pageSize")),
21
+ pageToken: url.searchParams.get("pageToken") == null ? undefined : url.searchParams.get("pageToken")
22
+ };
23
+ }
24
+ export function getPaginationParamsFromRequest({
25
+ pageSize,
26
+ pageToken
27
+ }) {
28
+ return {
29
+ pageSize,
30
+ pageToken
31
+ };
32
+ }
33
+ //# sourceMappingURL=getPaginationParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getPaginationParams.js","names":["getPaginationParamsFromUrl","request","url","URL","pageSize","searchParams","get","undefined","Number","pageToken","getPaginationParamsFromRequest"],"sources":["getPaginationParams.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PageToken } from \"@osdk/foundry.core\";\nimport type { LoadObjectSetRequestV2 } from \"@osdk/internal.foundry.ontologies\";\nimport type { StrictRequest } from \"msw\";\n\nexport function getPaginationParamsFromUrl(\n request: StrictRequest<any>,\n): { pageSize: number | undefined; pageToken: PageToken | undefined } {\n const url = new URL(request.url);\n return {\n pageSize: url.searchParams.get(\"pageSize\") == null\n ? undefined\n : Number(url.searchParams.get(\"pageSize\")),\n pageToken: url.searchParams.get(\"pageToken\") == null\n ? undefined\n : (url.searchParams.get(\"pageToken\") as string),\n };\n}\n\nexport function getPaginationParamsFromRequest(\n { pageSize, pageToken }: Pick<\n LoadObjectSetRequestV2,\n \"pageToken\" | \"pageSize\"\n >,\n): { pageSize: number | undefined; pageToken: PageToken | undefined } {\n return {\n pageSize,\n pageToken,\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAO,SAASA,0BAA0BA,CACxCC,OAA2B,EACyC;EACpE,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAACF,OAAO,CAACC,GAAG,CAAC;EAChC,OAAO;IACLE,QAAQ,EAAEF,GAAG,CAACG,YAAY,CAACC,GAAG,CAAC,UAAU,CAAC,IAAI,IAAI,GAC9CC,SAAS,GACTC,MAAM,CAACN,GAAG,CAACG,YAAY,CAACC,GAAG,CAAC,UAAU,CAAC,CAAC;IAC5CG,SAAS,EAAEP,GAAG,CAACG,YAAY,CAACC,GAAG,CAAC,WAAW,CAAC,IAAI,IAAI,GAChDC,SAAS,GACRL,GAAG,CAACG,YAAY,CAACC,GAAG,CAAC,WAAW;EACvC,CAAC;AACH;AAEA,OAAO,SAASI,8BAA8BA,CAC5C;EAAEN,QAAQ;EAAEK;AAGZ,CAAC,EACmE;EACpE,OAAO;IACLL,QAAQ;IACRK;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,85 @@
1
+ /*
2
+ * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { http, HttpResponse } from "msw";
18
+ import { authHandlerMiddleware } from "../authHandlerMiddleware.js";
19
+ export class OpenApiCallError extends Error {
20
+ constructor(status, json) {
21
+ super(`${json.errorCode} ${json.errorName ?? "Unknown error"} ${JSON.stringify(json.parameters)}`);
22
+ this.status = status;
23
+ this.json = json;
24
+ }
25
+ }
26
+
27
+ /**
28
+ * This relies on a trick that generally our query params and header params are optional therefore
29
+ * the body can generally be assumed to be the first payload following the strings which are path
30
+ * params.
31
+ *
32
+ * This will also fail if your body is defined as a string as that will get interpreted as a path param.
33
+ * If this happens, you cannot use the helper. Sorry
34
+ */
35
+
36
+ export function handleOpenApiCall(openApiCall, names) {
37
+ return (baseUrl, restImpl, options) => {
38
+ let captured = {};
39
+ // we don't care about the promise here, we are just building the url
40
+ void openApiCall({
41
+ fetch: (url, req) => {
42
+ const u = new URL(url);
43
+ u.search = ""; // msw doesn't want the search string
44
+ captured = {
45
+ method: req.method,
46
+ endPoint: u.toString().replace(/%3A/g, ":")
47
+ };
48
+
49
+ // fake a response object so the call doesn't fail
50
+ return {
51
+ ok: true,
52
+ json: () => Promise.resolve({}),
53
+ blob: () => new Blob()
54
+ };
55
+ },
56
+ baseUrl
57
+ }, ...names.map(n => `:${n}`),
58
+ // add a simulated blob in here in case of an upload
59
+ {
60
+ type: "",
61
+ size: 5
62
+ });
63
+ return http[captured.method.toLowerCase()](captured.endPoint, authHandlerMiddleware(async info => {
64
+ try {
65
+ const result = await restImpl(info);
66
+ if (result instanceof Response) {
67
+ return new HttpResponse(result.body);
68
+ }
69
+ return HttpResponse.json(result);
70
+ } catch (e) {
71
+ if (e instanceof OpenApiCallError) {
72
+ return HttpResponse.json({
73
+ ...e.json,
74
+ stack: e.stack
75
+ }, {
76
+ status: e.status,
77
+ statusText: e.message
78
+ });
79
+ }
80
+ throw e;
81
+ }
82
+ }), options);
83
+ };
84
+ }
85
+ //# sourceMappingURL=handleOpenApiCall.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleOpenApiCall.js","names":["http","HttpResponse","authHandlerMiddleware","OpenApiCallError","Error","constructor","status","json","errorCode","errorName","JSON","stringify","parameters","handleOpenApiCall","openApiCall","names","baseUrl","restImpl","options","captured","fetch","url","req","u","URL","search","method","endPoint","toString","replace","ok","Promise","resolve","blob","Blob","map","n","type","size","toLowerCase","info","result","Response","body","e","stack","statusText","message"],"sources":["handleOpenApiCall.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n DefaultBodyType,\n HttpHandler,\n HttpResponseResolver,\n RequestHandlerOptions,\n StrictResponse,\n} from \"msw\";\nimport { http as http, HttpResponse } from \"msw\";\nimport type { BaseAPIError } from \"../../BaseError.js\";\nimport { authHandlerMiddleware } from \"../authHandlerMiddleware.js\";\n\nexport class OpenApiCallError extends Error {\n constructor(\n public status: number,\n public json: {\n errorCode: string;\n errorName: string;\n errorInstanceId: string;\n parameters: Record<string, unknown>;\n },\n ) {\n super(\n `${json.errorCode} ${json.errorName ?? \"Unknown error\"} ${\n JSON.stringify(json.parameters)\n }`,\n );\n }\n}\n\ntype ExtractStringParams<T extends any[]> = T extends [infer A, ...infer B]\n ? A extends string ? [A, ...ExtractStringParams<B>] : []\n : [];\n\nexport type SkipStringParams<T extends any[]> = T extends [infer A, ...infer B]\n ? A extends string ? SkipStringParams<B> : T\n : T;\n\n/**\n * This relies on a trick that generally our query params and header params are optional therefore\n * the body can generally be assumed to be the first payload following the strings which are path\n * params.\n *\n * This will also fail if your body is defined as a string as that will get interpreted as a path param.\n * If this happens, you cannot use the helper. Sorry\n */\nexport type ExtractBody<\n X extends ((reqCall: any, ...args: any[]) => Promise<any>),\n> = undefined extends SkipStringParams<ParamsAfterReqCall<X>>[0] ? never\n : SkipStringParams<ParamsAfterReqCall<X>>[0];\n\nexport type ExtractResponse<\n X extends ((...args: any[]) => Promise<any>),\n> = Awaited<ReturnType<X>>;\n\nexport type ParamsAfterReqCall<\n T extends (reqCall: any, ...args: any[]) => Promise<any>,\n> = T extends (reqCall: any, ...args: infer Z) => Promise<any> ? Z : never;\n\nexport type RestImpl<\n URL_PARAMS extends string,\n REQ_BODY extends DefaultBodyType,\n RESP_BODY extends DefaultBodyType,\n> = (\n info: Parameters<\n HttpResponseResolver<\n Record<URL_PARAMS, string>,\n REQ_BODY,\n RESP_BODY | BaseAPIError\n >\n >[0],\n) => RESP_BODY | Promise<RESP_BODY>;\n\nexport type OpenApiCallFactory<\n URL_PARAMS extends string,\n REQ_BODY extends DefaultBodyType,\n RESP_BODY extends DefaultBodyType,\n> = (\n baseUrl: string,\n restImpl: RestImpl<URL_PARAMS, REQ_BODY, RESP_BODY>,\n options?: RequestHandlerOptions,\n) => HttpHandler;\n\nexport type CallFactory<\n URL_PARAMS extends string,\n X extends ((...args: any[]) => Promise<any>),\n> = (\n baseUrl: string,\n restImpl: RestImpl<URL_PARAMS, ExtractBody<X>, ExtractResponse<X>>,\n options?: RequestHandlerOptions,\n) => HttpHandler;\n\nexport function handleOpenApiCall<\n const N extends ExtractStringParams<ParamsAfterReqCall<X>>,\n const X extends ((...args: any[]) => Promise<any>),\n>(\n openApiCall: X,\n names: N,\n): CallFactory<N[number], X> {\n return (\n baseUrl: string,\n restImpl: RestImpl<N[number], ExtractBody<X>, ExtractResponse<X>>,\n options?: RequestHandlerOptions,\n ): HttpHandler => {\n let captured: {\n method: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\";\n endPoint: string;\n data?: any;\n queryArguments?: Record<string, any>;\n headers?: Record<string, any>;\n requestMediaType?: string;\n responseMediaType?: string;\n } = {} as any;\n\n const capture = {\n fetch: (url: string, req: Request) => {\n const u = new URL(url);\n u.search = \"\"; // msw doesn't want the search string\n captured = {\n method: req.method as any,\n endPoint: u.toString().replace(/%3A/g, \":\"),\n };\n\n // fake a response object so the call doesn't fail\n return {\n ok: true,\n json: () => Promise.resolve({}),\n blob: () => new Blob(),\n };\n },\n baseUrl,\n };\n\n // we don't care about the promise here, we are just building the url\n void openApiCall(\n capture as any,\n ...(names.map(n => `:${n}`) as any),\n // add a simulated blob in here in case of an upload\n { type: \"\", size: 5 },\n );\n\n return http\n [captured.method.toLowerCase() as Lowercase<typeof captured.method>](\n captured.endPoint,\n authHandlerMiddleware(async (info) => {\n try {\n const result: any = await restImpl(\n info as any,\n );\n\n if (result instanceof Response) {\n return new HttpResponse(result.body) as StrictResponse<\n DefaultBodyType\n >;\n }\n return HttpResponse.json(\n result,\n );\n } catch (e) {\n if (e instanceof OpenApiCallError) {\n return HttpResponse.json({ ...e.json, stack: e.stack }, {\n status: e.status,\n statusText: e.message,\n });\n }\n throw e;\n }\n }),\n options,\n );\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,IAAY,EAAEC,YAAY,QAAQ,KAAK;AAEhD,SAASC,qBAAqB,QAAQ,6BAA6B;AAEnE,OAAO,MAAMC,gBAAgB,SAASC,KAAK,CAAC;EAC1CC,WAAWA,CACFC,MAAc,EACdC,IAKN,EACD;IACA,KAAK,CACH,GAAGA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CAAC,MAAOsC,IAAI,IAAK;MACpC,IAAI;QACF,MAAMC,MAAW,GAAG,MAAMxB,QAAQ,CAChCuB,IACF,CAAC;QAED,IAAIC,MAAM,YAAYC,QAAQ,EAAE;UAC9B,OAAO,IAAIzC,YAAY,CAACwC,MAAM,CAACE,IAAI,CAAC;QAGtC;QACA,OAAO1C,YAAY,CAACM,IAAI,CACtBkC,MACF,CAAC;MACH,CAAC,CAAC,OAAOG,CAAC,EAAE;QACV,IAAIA,CAAC,YAAYzC,gBAAgB,EAAE;UACjC,OAAOF,YAAY,CAACM,IAAI,CAAC;YAAE,GAAGqC,CAAC,CAACrC,IAAI;YAAEsC,KAAK,EAAED,CAAC,CAACC;UAAM,CAAC,EAAE;YACtDvC,MAAM,EAAEsC,CAAC,CAACtC,MAAM;YAChBwC,UAAU,EAAEF,CAAC,CAACG;UAChB,CAAC,CAAC;QACJ;QACA,MAAMH,CAAC;MACT;IACF,CAAC,CAAC,EACF1B,OACF,CAAC;EACL,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ /*
2
+ * Copyright 2024 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export async function loadAll(iterator) {
18
+ const arr = [];
19
+ for await (const i of iterator) {
20
+ arr.push(i);
21
+ }
22
+ return arr;
23
+ }
24
+ //# sourceMappingURL=loadAll.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadAll.js","names":["loadAll","iterator","arr","i","push"],"sources":["loadAll.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport async function loadAll<T>(\n iterator: AsyncIterableIterator<T>,\n): Promise<T[]> {\n const arr: T[] = [];\n for await (const i of iterator) {\n arr.push(i);\n }\n return arr;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,eAAeA,OAAOA,CAC3BC,QAAkC,EACpB;EACd,MAAMC,GAAQ,GAAG,EAAE;EACnB,WAAW,MAAMC,CAAC,IAAIF,QAAQ,EAAE;IAC9BC,GAAG,CAACE,IAAI,CAACD,CAAC,CAAC;EACb;EACA,OAAOD,GAAG;AACZ","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export function pageThroughResponseSearchParams(iter, {
18
+ pageSize = 1000,
19
+ pageToken
20
+ }, includeCount) {
21
+ const data = Array.from(iter);
22
+ const pageCount = Math.ceil(data.length / pageSize);
23
+ const currentPage = pageToken ? Number(pageToken) : 0;
24
+ if (currentPage < 0 || currentPage >= pageCount) {
25
+ return undefined;
26
+ }
27
+ const startIndex = currentPage * pageSize;
28
+ const endIndex = Math.min(startIndex + pageSize, data.length);
29
+ const nextPageToken = currentPage + 1 < pageCount ? (currentPage + 1).toString() : undefined;
30
+ const ret = {
31
+ nextPageToken,
32
+ data: data.slice(startIndex, endIndex),
33
+ ...(includeCount ? {
34
+ totalCount: String(data.length)
35
+ } : {})
36
+ };
37
+ return ret;
38
+ }
39
+ //# sourceMappingURL=pageThroughResponseSearchParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pageThroughResponseSearchParams.js","names":["pageThroughResponseSearchParams","iter","pageSize","pageToken","includeCount","data","Array","from","pageCount","Math","ceil","length","currentPage","Number","undefined","startIndex","endIndex","min","nextPageToken","toString","ret","slice","totalCount","String"],"sources":["pageThroughResponseSearchParams.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PageToken } from \"@osdk/foundry.core\";\n\nexport interface PagedBodyResponse<T> {\n nextPageToken?: string;\n data: T[];\n}\n\nexport interface PagedBodyResponseWithTotal<T> extends PagedBodyResponse<T> {\n totalCount: string;\n}\n\nexport type PagedRequest = {\n excludeRid?: boolean;\n pageSize?: number;\n pageToken?: string;\n};\n\nexport function pageThroughResponseSearchParams<\n TData,\n TIncludeCount extends boolean,\n>(\n iter: Iterable<TData>,\n { pageSize = 1000, pageToken }: {\n pageSize: number | undefined;\n pageToken: PageToken | undefined;\n },\n includeCount?: TIncludeCount,\n):\n | (TIncludeCount extends true ? PagedBodyResponseWithTotal<TData>\n : PagedBodyResponse<TData>)\n | undefined\n{\n const data = Array.from(iter);\n const pageCount = Math.ceil(data.length / pageSize);\n const currentPage = pageToken ? Number(pageToken) : 0;\n\n if (currentPage < 0 || currentPage >= pageCount) {\n return undefined;\n }\n\n const startIndex = currentPage * pageSize;\n const endIndex = Math.min(startIndex + pageSize, data.length);\n const nextPageToken = currentPage + 1 < pageCount\n ? (currentPage + 1).toString()\n : undefined;\n\n const ret: PagedBodyResponse<TData> | PagedBodyResponseWithTotal<TData> = {\n nextPageToken,\n data: data.slice(startIndex, endIndex),\n ...(includeCount\n ? { totalCount: String(data.length) }\n : {}),\n };\n\n return ret as\n | (TIncludeCount extends true ? PagedBodyResponseWithTotal<TData>\n : PagedBodyResponse<TData>)\n | undefined;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA,OAAO,SAASA,+BAA+BA,CAI7CC,IAAqB,EACrB;EAAEC,QAAQ,GAAG,IAAI;EAAEC;AAGnB,CAAC,EACDC,YAA4B,EAK9B;EACE,MAAMC,IAAI,GAAGC,KAAK,CAACC,IAAI,CAACN,IAAI,CAAC;EAC7B,MAAMO,SAAS,GAAGC,IAAI,CAACC,IAAI,CAACL,IAAI,CAACM,MAAM,GAAGT,QAAQ,CAAC;EACnD,MAAMU,WAAW,GAAGT,SAAS,GAAGU,MAAM,CAACV,SAAS,CAAC,GAAG,CAAC;EAErD,IAAIS,WAAW,GAAG,CAAC,IAAIA,WAAW,IAAIJ,SAAS,EAAE;IAC/C,OAAOM,SAAS;EAClB;EAEA,MAAMC,UAAU,GAAGH,WAAW,GAAGV,QAAQ;EACzC,MAAMc,QAAQ,GAAGP,IAAI,CAACQ,GAAG,CAACF,UAAU,GAAGb,QAAQ,EAAEG,IAAI,CAACM,MAAM,CAAC;EAC7D,MAAMO,aAAa,GAAGN,WAAW,GAAG,CAAC,GAAGJ,SAAS,GAC7C,CAACI,WAAW,GAAG,CAAC,EAAEO,QAAQ,CAAC,CAAC,GAC5BL,SAAS;EAEb,MAAMM,GAAiE,GAAG;IACxEF,aAAa;IACbb,IAAI,EAAEA,IAAI,CAACgB,KAAK,CAACN,UAAU,EAAEC,QAAQ,CAAC;IACtC,IAAIZ,YAAY,GACZ;MAAEkB,UAAU,EAAEC,MAAM,CAAClB,IAAI,CAACM,MAAM;IAAE,CAAC,GACnC,CAAC,CAAC;EACR,CAAC;EAED,OAAOS,GAAG;AAIZ","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { InvalidRequest } from "../../errors.js";
18
+ import { OpenApiCallError } from "./handleOpenApiCall.js";
19
+ export function requireParam(params, name) {
20
+ if (typeof params[name] !== "string") {
21
+ throw new OpenApiCallError(400, InvalidRequest(`Invalid parameter: ${name} must be a string`));
22
+ }
23
+ }
24
+ export function requireParams(params, names) {
25
+ for (const name of names) {
26
+ requireParam(params, name);
27
+ }
28
+ }
29
+ //# sourceMappingURL=requireParam.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requireParam.js","names":["InvalidRequest","OpenApiCallError","requireParam","params","name","requireParams","names"],"sources":["requireParam.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { InvalidRequest } from \"../../errors.js\";\nimport { OpenApiCallError } from \"./handleOpenApiCall.js\";\n\nexport function requireParam<P, K extends string>(\n params: P,\n name: K & keyof P,\n): asserts params is\n & P\n & {\n [KK in K]: string;\n }\n{\n if (typeof params[name] !== \"string\") {\n throw new OpenApiCallError(\n 400,\n InvalidRequest(`Invalid parameter: ${name} must be a string`),\n );\n }\n}\n\nexport function requireParams<P, K extends string>(\n params: P,\n names: Array<K & keyof P>,\n): asserts params is\n & P\n & {\n [KK in K]: string;\n }\n{\n for (const name of names) {\n requireParam(params, name);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,cAAc,QAAQ,iBAAiB;AAChD,SAASC,gBAAgB,QAAQ,wBAAwB;AAEzD,OAAO,SAASC,YAAYA,CAC1BC,MAAS,EACTC,IAAiB,EAMnB;EACE,IAAI,OAAOD,MAAM,CAACC,IAAI,CAAC,KAAK,QAAQ,EAAE;IACpC,MAAM,IAAIH,gBAAgB,CACxB,GAAG,EACHD,cAAc,CAAC,sBAAsBI,IAAI,mBAAmB,CAC9D,CAAC;EACH;AACF;AAEA,OAAO,SAASC,aAAaA,CAC3BF,MAAS,EACTG,KAAyB,EAM3B;EACE,KAAK,MAAMF,IAAI,IAAIE,KAAK,EAAE;IACxBJ,YAAY,CAACC,MAAM,EAAEC,IAAI,CAAC;EAC5B;AACF","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright 2025 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ import { InvalidRequest } from "../../errors.js";
18
+ import { OpenApiCallError } from "./handleOpenApiCall.js";
19
+ export function requireSearchParams(names, req) {
20
+ const url = new URL(req.url);
21
+ return Object.fromEntries(names.map(name => {
22
+ const value = url.searchParams.get(name);
23
+ if (value == null) {
24
+ throw new OpenApiCallError(400, InvalidRequest("Invalid parameters"));
25
+ }
26
+ return [name, value];
27
+ }));
28
+ }
29
+ //# sourceMappingURL=requireSearchParams.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requireSearchParams.js","names":["InvalidRequest","OpenApiCallError","requireSearchParams","names","req","url","URL","Object","fromEntries","map","name","value","searchParams","get"],"sources":["requireSearchParams.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { StrictRequest } from \"msw\";\nimport { InvalidRequest } from \"../../errors.js\";\nimport { OpenApiCallError } from \"./handleOpenApiCall.js\";\n\nexport function requireSearchParams<T extends string>(\n names: T[],\n req: StrictRequest<any>,\n): Record<T, string> {\n const url = new URL(req.url);\n return Object.fromEntries(names.map(name => {\n const value = url.searchParams.get(name);\n if (value == null) {\n throw new OpenApiCallError(400, InvalidRequest(\"Invalid parameters\"));\n }\n return [name, value];\n })) as Record<T, string>;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,cAAc,QAAQ,iBAAiB;AAChD,SAASC,gBAAgB,QAAQ,wBAAwB;AAEzD,OAAO,SAASC,mBAAmBA,CACjCC,KAAU,EACVC,GAAuB,EACJ;EACnB,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAACF,GAAG,CAACC,GAAG,CAAC;EAC5B,OAAOE,MAAM,CAACC,WAAW,CAACL,KAAK,CAACM,GAAG,CAACC,IAAI,IAAI;IAC1C,MAAMC,KAAK,GAAGN,GAAG,CAACO,YAAY,CAACC,GAAG,CAACH,IAAI,CAAC;IACxC,IAAIC,KAAK,IAAI,IAAI,EAAE;MACjB,MAAM,IAAIV,gBAAgB,CAAC,GAAG,EAAED,cAAc,CAAC,oBAAoB,CAAC,CAAC;IACvE;IACA,OAAO,CAACU,IAAI,EAAEC,KAAK,CAAC;EACtB,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1,29 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+
17
+ export * as TypeHelpers from "./FauxFoundry/typeHelpers/index.js";
18
+ export { isBaseApiError } from "./BaseError.js";
19
+ export * as Errors from "./errors.js";
20
+ export { FauxDataStore } from "./FauxFoundry/FauxDataStore.js";
21
+ export { FauxDataStoreBatch } from "./FauxFoundry/FauxDataStoreBatch.js";
22
+ export { FauxFoundry } from "./FauxFoundry/FauxFoundry.js";
23
+ export { FauxOntology } from "./FauxFoundry/FauxOntology.js";
24
+ export { authHandlerMiddleware } from "./handlers/authHandlerMiddleware.js";
25
+ export { OpenApiCallError } from "./handlers/util/handleOpenApiCall.js";
26
+ export { OntologiesV2 as MockOntologiesV2 } from "./mock/index.js";
27
+ export { withoutRid } from "./withoutRid.js";
28
+ export * as msw from "msw";
29
+ //# sourceMappingURL=index.js.map