@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,60 @@
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 { OpenApiCallError } from "../handlers/util/handleOpenApiCall.js";
18
+ export class FauxAttachmentStore {
19
+ #attachments = new Map();
20
+ registerAttachment(attachment) {
21
+ this.#attachments.set(attachment.rid, attachment);
22
+ return this.getAttachmentMetadataByRid(attachment.rid);
23
+ }
24
+ getAttachmentMetadataByRid(attachmentRid) {
25
+ const attachment = this.#attachments.get(attachmentRid);
26
+ if (!attachment) {
27
+ throw new OpenApiCallError(404, {
28
+ errorCode: "NOT_FOUND",
29
+ errorName: "AttachmentNotFound",
30
+ errorInstanceId: "internal",
31
+ parameters: {
32
+ attachmentRid
33
+ }
34
+ });
35
+ }
36
+ const {
37
+ buffer,
38
+ ...metadata
39
+ } = attachment;
40
+ return {
41
+ ...metadata,
42
+ sizeBytes: String(buffer.byteLength)
43
+ };
44
+ }
45
+ getAttachmentBuffer(attachmentRid) {
46
+ const attachment = this.#attachments.get(attachmentRid);
47
+ if (!attachment) {
48
+ throw new OpenApiCallError(404, {
49
+ errorCode: "NOT_FOUND",
50
+ errorName: "AttachmentNotFound",
51
+ errorInstanceId: "internal",
52
+ parameters: {
53
+ attachmentRid
54
+ }
55
+ });
56
+ }
57
+ return attachment.buffer;
58
+ }
59
+ }
60
+ //# sourceMappingURL=FauxAttachmentStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FauxAttachmentStore.js","names":["OpenApiCallError","FauxAttachmentStore","attachments","Map","registerAttachment","attachment","set","rid","getAttachmentMetadataByRid","attachmentRid","get","errorCode","errorName","errorInstanceId","parameters","buffer","metadata","sizeBytes","String","byteLength","getAttachmentBuffer"],"sources":["FauxAttachmentStore.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 * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { OpenApiCallError } from \"../handlers/util/handleOpenApiCall.js\";\n\nexport interface FauxAttachmentInfo\n extends Omit<OntologiesV2.AttachmentV2, \"sizeBytes\">\n{\n buffer: ArrayBuffer;\n}\n\nexport class FauxAttachmentStore {\n #attachments = new Map<string, FauxAttachmentInfo>();\n\n registerAttachment(\n attachment: FauxAttachmentInfo,\n ): OntologiesV2.AttachmentV2 {\n this.#attachments.set(attachment.rid, attachment);\n return this.getAttachmentMetadataByRid(attachment.rid);\n }\n\n getAttachmentMetadataByRid(attachmentRid: string): OntologiesV2.AttachmentV2 {\n const attachment = this.#attachments.get(attachmentRid);\n if (!attachment) {\n throw new OpenApiCallError(\n 404,\n {\n errorCode: \"NOT_FOUND\",\n errorName: \"AttachmentNotFound\",\n errorInstanceId: \"internal\",\n parameters: { attachmentRid },\n } satisfies OntologiesV2.AttachmentNotFound,\n );\n }\n\n const { buffer, ...metadata } = attachment;\n\n return {\n ...metadata,\n sizeBytes: String(buffer.byteLength),\n };\n }\n\n getAttachmentBuffer(attachmentRid: string): ArrayBuffer {\n const attachment = this.#attachments.get(attachmentRid);\n if (!attachment) {\n throw new OpenApiCallError(\n 404,\n {\n errorCode: \"NOT_FOUND\",\n errorName: \"AttachmentNotFound\",\n errorInstanceId: \"internal\",\n parameters: { attachmentRid },\n } satisfies OntologiesV2.AttachmentNotFound,\n );\n }\n return attachment.buffer;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,uCAAuC;AAQxE,OAAO,MAAMC,mBAAmB,CAAC;EAC/B,CAACC,WAAW,GAAG,IAAIC,GAAG,CAA6B,CAAC;EAEpDC,kBAAkBA,CAChBC,UAA8B,EACH;IAC3B,IAAI,CAAC,CAACH,WAAW,CAACI,GAAG,CAACD,UAAU,CAACE,GAAG,EAAEF,UAAU,CAAC;IACjD,OAAO,IAAI,CAACG,0BAA0B,CAACH,UAAU,CAACE,GAAG,CAAC;EACxD;EAEAC,0BAA0BA,CAACC,aAAqB,EAA6B;IAC3E,MAAMJ,UAAU,GAAG,IAAI,CAAC,CAACH,WAAW,CAACQ,GAAG,CAACD,aAAa,CAAC;IACvD,IAAI,CAACJ,UAAU,EAAE;MACf,MAAM,IAAIL,gBAAgB,CACxB,GAAG,EACH;QACEW,SAAS,EAAE,WAAW;QACtBC,SAAS,EAAE,oBAAoB;QAC/BC,eAAe,EAAE,UAAU;QAC3BC,UAAU,EAAE;UAAEL;QAAc;MAC9B,CACF,CAAC;IACH;IAEA,MAAM;MAAEM,MAAM;MAAE,GAAGC;IAAS,CAAC,GAAGX,UAAU;IAE1C,OAAO;MACL,GAAGW,QAAQ;MACXC,SAAS,EAAEC,MAAM,CAACH,MAAM,CAACI,UAAU;IACrC,CAAC;EACH;EAEAC,mBAAmBA,CAACX,aAAqB,EAAe;IACtD,MAAMJ,UAAU,GAAG,IAAI,CAAC,CAACH,WAAW,CAACQ,GAAG,CAACD,aAAa,CAAC;IACvD,IAAI,CAACJ,UAAU,EAAE;MACf,MAAM,IAAIL,gBAAgB,CACxB,GAAG,EACH;QACEW,SAAS,EAAE,WAAW;QACtBC,SAAS,EAAE,oBAAoB;QAC/BC,eAAe,EAAE,UAAU;QAC3BC,UAAU,EAAE;UAAEL;QAAc;MAC9B,CACF,CAAC;IACH;IACA,OAAOJ,UAAU,CAACU,MAAM;EAC1B;AACF","ignoreList":[]}
@@ -0,0 +1,470 @@
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 { DefaultMap, MultiMap } from "mnemonist";
18
+ import { randomUUID } from "node:crypto";
19
+ import * as crypto from "node:crypto";
20
+ import invariant from "tiny-invariant";
21
+ import { InvalidRequest, ObjectNotFoundError } from "../errors.js";
22
+ import { subSelectProperties } from "../filterObjects.js";
23
+ import { getPaginationParamsFromRequest } from "../handlers/util/getPaginationParams.js";
24
+ import { OpenApiCallError } from "../handlers/util/handleOpenApiCall.js";
25
+ import { pageThroughResponseSearchParams } from "../handlers/util/pageThroughResponseSearchParams.js";
26
+ import { isBaseServerObject } from "./BaseServerObject.js";
27
+ import { FauxDataStoreBatch } from "./FauxDataStoreBatch.js";
28
+ import { filterTimeSeriesData } from "./filterTimeSeriesData.js";
29
+ import { createOrderBySortFn, getObjectsFromSet } from "./getObjectsFromSet.js";
30
+ import { objectLocator, parseLocator } from "./ObjectLocator.js";
31
+ import { validateAction } from "./validateAction.js";
32
+
33
+ /**
34
+ * Represents the properties needed to create an object, specifically,
35
+ * the properties of the object and the $apiName
36
+ */
37
+
38
+ /**
39
+ * Helper type for converting `foo: string | undefined` into `foo?: string`
40
+ */
41
+
42
+ /**
43
+ * Type safe object for representing "client" side objects.
44
+ */
45
+
46
+ export class FauxDataStore {
47
+ #objects = new DefaultMap(() => new Map());
48
+ #singleLinks = new DefaultMap(() => new Map());
49
+ #manyLinks = new DefaultMap(() => new MultiMap(Set));
50
+ #fauxOntology;
51
+ #attachments;
52
+ #timeSeriesData = new DefaultMap(() => new DefaultMap(() => new DefaultMap(() => [])));
53
+ #media = new DefaultMap(() => new DefaultMap(() => {
54
+ return new Map();
55
+ }));
56
+ constructor(fauxOntology, attachments) {
57
+ this.#fauxOntology = fauxOntology;
58
+ this.#attachments = attachments;
59
+ }
60
+
61
+ /**
62
+ * Removes all data that is associated with a namespace/ontology.
63
+ *
64
+ * Note: does not clear `attachments` nor does it clear the ontology itself.
65
+ */
66
+ clear() {
67
+ this.#media.clear();
68
+ this.#timeSeriesData.clear();
69
+ this.#manyLinks.clear();
70
+ this.#singleLinks.clear();
71
+ this.#objects.clear();
72
+ }
73
+ get ontology() {
74
+ return this.#fauxOntology;
75
+ }
76
+ #assertObjectExists(objectType, primaryKey) {
77
+ if (!this.getObject(objectType, primaryKey)) {
78
+ throw new OpenApiCallError(404, ObjectNotFoundError(objectType, String(primaryKey)));
79
+ }
80
+ }
81
+ #assertObjectDoesNotExist(objectType, primaryKey) {
82
+ if (this.getObject(objectType, primaryKey)) {
83
+ throw new OpenApiCallError(500, {
84
+ errorCode: "CONFLICT",
85
+ errorName: "ObjectAlreadyExists",
86
+ errorInstanceId: "faux-foundry",
87
+ parameters: {
88
+ objectType,
89
+ primaryKey: String(primaryKey)
90
+ }
91
+ });
92
+ }
93
+ }
94
+
95
+ /**
96
+ * Version for use in places like @osdk/client.
97
+ *
98
+ * @param obj An `Osdk.Instance` like object for the ObjectType in the generics
99
+ */
100
+
101
+ /**
102
+ * Version of register object generally used in shared.test
103
+ * @param obj A raw server side representation of an object
104
+ *
105
+ * Don't use, its too easy to end up with an any.
106
+ */
107
+
108
+ registerObject(objectType, anyObj) {
109
+ let bso;
110
+ // obj = { ...obj }; // make a copy so we can mutate it
111
+
112
+ if (isBaseServerObject(objectType)) {
113
+ !(anyObj == null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Internal overload should only pass one argument") : invariant(false) : void 0;
114
+ !!Object.keys(objectType).some(s => s.startsWith("$")) ? process.env.NODE_ENV !== "production" ? invariant(false, "Object should not have any keys starting with $ if it has __apiName") : invariant(false) : void 0;
115
+ bso = objectType;
116
+ } else if (anyObj == null) {
117
+ process.env.NODE_ENV !== "production" ? invariant(false, "should not be possible due to overloads") : invariant(false);
118
+ } else if (isBaseServerObject(anyObj)) {
119
+ !!Object.keys(anyObj).some(s => s.startsWith("$")) ? process.env.NODE_ENV !== "production" ? invariant(false, "Object should not have any keys starting with $ if it has __apiName") : invariant(false) : void 0;
120
+ bso = anyObj;
121
+ } else {
122
+ bso = this.#osdkCreatableToBso(objectType, anyObj);
123
+ }
124
+ const apiName = bso.__apiName || bso.$apiName;
125
+ !apiName ? process.env.NODE_ENV !== "production" ? invariant(false, "Object should have an __apiName or $apiName") : invariant(false) : void 0;
126
+ this.#assertObjectDoesNotExist(apiName, bso.__primaryKey);
127
+ if (!("__apiName" in bso && "__primaryKey" in bso)) {
128
+ !("$apiName" in bso && "$primaryKey" in bso) ? process.env.NODE_ENV !== "production" ? invariant(false, "Object should have (__apiName and __primaryKey) or ($apiName and $primaryKey)") : invariant(false) : void 0;
129
+ const {
130
+ $apiName,
131
+ $primaryKey,
132
+ ...others
133
+ } = bso;
134
+ bso = {
135
+ __apiName: $apiName,
136
+ __primaryKey: $primaryKey,
137
+ ...others
138
+ };
139
+ }
140
+ this.#assertObjectDoesNotExist(bso.__apiName, bso.__primaryKey);
141
+ this.#objects.get(bso.__apiName).set(String(bso.__primaryKey), Object.freeze({
142
+ ...bso
143
+ }));
144
+ }
145
+ #osdkCreatableToBso(objectType, anyObj) {
146
+ objectType = typeof objectType === "string" ? objectType : objectType.apiName;
147
+ if ("$apiName" in anyObj) {
148
+ !(anyObj.$apiName === objectType) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
149
+ }
150
+ const {
151
+ $apiName,
152
+ $primaryKey,
153
+ ...others
154
+ } = anyObj;
155
+ const meta = this.ontology.getObjectTypeFullMetadataOrThrow(objectType);
156
+ const realPrimaryKey = anyObj[meta.objectType.primaryKey];
157
+ const maybeTitle = anyObj[meta.objectType.titleProperty];
158
+ const rid = anyObj.$rid ?? `ri.phonograph2-objects.main.object.${crypto.randomUUID()}`;
159
+ !(realPrimaryKey != null) ? process.env.NODE_ENV !== "production" ? invariant(false, `Object should have a primary key. ${JSON.stringify(anyObj)}`) : invariant(false) : void 0;
160
+ !($primaryKey == null || $primaryKey === realPrimaryKey) ? process.env.NODE_ENV !== "production" ? invariant(false, "Primary key mismatch") : invariant(false) : void 0;
161
+ return {
162
+ __apiName: objectType,
163
+ __primaryKey: realPrimaryKey,
164
+ __title: maybeTitle ? String(maybeTitle) : undefined,
165
+ __rid: rid,
166
+ ...others
167
+ };
168
+ }
169
+ replaceObjectOrThrow(x) {
170
+ this.#assertObjectExists(x.__apiName, x.__primaryKey);
171
+ this.#objects.get(x.__apiName).set(String(x.__primaryKey), x);
172
+ }
173
+
174
+ /** Throws if the object does not already exist */
175
+ unregisterObjectOrThrow(objectType, primaryKey) {
176
+ this.#assertObjectExists(objectType, primaryKey);
177
+ this.#objects.get(objectType).delete(String(primaryKey));
178
+ }
179
+ registerLink(src, srcLinkName, dst, destLinkName) {
180
+ const srcLocator = objectLocator(src);
181
+ const dstLocator = objectLocator(dst);
182
+ const [srcSide, dstSide] = this.#fauxOntology.getBothLinkTypeSides(src.__apiName, srcLinkName, dst.__apiName);
183
+ !(srcSide.linkTypeRid === dstSide.linkTypeRid) ? process.env.NODE_ENV !== "production" ? invariant(false, `Expected both sides of the link to have the same rid, but got ${srcSide.linkTypeRid} and ${dstSide.linkTypeRid}`) : invariant(false) : void 0;
184
+ !(dstSide.apiName === destLinkName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Link name mismatch on dst side. Expected ${destLinkName} but found ${dstSide.apiName}`) : invariant(false) : void 0;
185
+ this.#updateSingleLinkSide(srcSide, srcLocator, dstSide, dstLocator);
186
+ this.#updateSingleLinkSide(dstSide, dstLocator, srcSide, srcLocator);
187
+ }
188
+ unregisterLink(src, srcLinkName, dst, dstLinkName) {
189
+ const srcLocator = objectLocator(src);
190
+ const dstLocator = objectLocator(dst);
191
+ const [srcSide, dstSide] = this.#fauxOntology.getBothLinkTypeSides(src.__apiName, srcLinkName, dst.__apiName);
192
+ !(dstSide.apiName === dstLinkName) ? process.env.NODE_ENV !== "production" ? invariant(false, `Link name mismatch on dst side. Expected ${dstLinkName} but found ${dstSide.apiName}`) : invariant(false) : void 0;
193
+ this.#removeSingleSideOfLink(srcLocator, srcSide, dstLocator);
194
+ this.#removeSingleSideOfLink(dstLocator, dstSide, srcLocator);
195
+ }
196
+ registerTimeSeriesData(objectType, primaryKey, property, data) {
197
+ this.getObjectOrThrow(objectType, primaryKey);
198
+ const def = this.ontology.getObjectTypeFullMetadataOrThrow(objectType);
199
+ !(def.objectType.properties[property].dataType.type === "timeseries" || def.objectType.properties[property].dataType.type === "geotimeSeriesReference") ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
200
+ this.#timeSeriesData.get(objectType).get(String(primaryKey)).set(property, data);
201
+ }
202
+ getTimeSeriesData(objectType, primaryKey, property, filter) {
203
+ this.getObjectOrThrow(objectType, primaryKey);
204
+ const allData = this.#timeSeriesData.get(objectType).get(String(primaryKey)).get(property);
205
+ if (!filter) return allData;
206
+ return filterTimeSeriesData(allData, filter);
207
+ }
208
+ #updateSingleLinkSide(srcSide, srcLocator, dstSide, dstLocator) {
209
+ const srcLinkName = srcSide.apiName;
210
+ if (srcSide.cardinality === "ONE") {
211
+ const linkNameToObj = this.#singleLinks.get(srcLocator);
212
+ const oldLocator = linkNameToObj.get(srcLinkName);
213
+ if (oldLocator && oldLocator !== dstLocator) {
214
+ // we need to remove the other side's old value
215
+ this.#removeSingleSideOfLink(oldLocator, dstSide, srcLocator);
216
+ }
217
+ linkNameToObj.set(srcLinkName, dstLocator);
218
+ } else if (srcSide.cardinality === "MANY") {
219
+ const linkNameToObj = this.#manyLinks.get(srcLocator);
220
+ linkNameToObj.set(srcLinkName, dstLocator);
221
+ } else {
222
+ // "never" case
223
+ throw new Error("unexpected cardinality: " + srcSide.cardinality);
224
+ }
225
+ }
226
+ registerMedia(objectType, property, content, mediaType, path,
227
+ // This should be the correct prefix, per
228
+ // https://github.com/palantir/osdk-ts/pull/1303#discussion_r2001989395
229
+ mediaItemRid = `ri.mio.main.media-item.${randomUUID()}`) {
230
+ const mediaRef = Object.freeze({
231
+ mimeType: mediaType,
232
+ reference: Object.freeze({
233
+ type: "mediaSetViewItem",
234
+ mediaSetViewItem: Object.freeze({
235
+ mediaItemRid,
236
+ mediaSetRid: "ri.unimplemented.in.shared.test",
237
+ mediaSetViewRid: "ri.unimplemented.in.shared.test"
238
+ })
239
+ })
240
+ });
241
+ this.#media.get(objectType).get(property).set(mediaItemRid, Object.freeze({
242
+ content,
243
+ mediaRef,
244
+ metaData: Object.freeze({
245
+ mediaType,
246
+ path,
247
+ sizeBytes: String(content.byteLength)
248
+ })
249
+ }));
250
+ return mediaRef;
251
+ }
252
+ getMediaOrThrow(objectType, primaryKey, property) {
253
+ const obj = this.getObjectOrThrow(objectType, primaryKey);
254
+ const propertyDef = this.ontology.getObjectTypeFullMetadataOrThrow(objectType).objectType.properties[property];
255
+ if (!propertyDef) {
256
+ // This should be the correct error, per
257
+ // https://github.com/palantir/osdk-ts/pull/1303#discussion_r2001968959
258
+ throw new OpenApiCallError(400, {
259
+ errorCode: "NOT_FOUND",
260
+ errorName: "PropertiesNotFound",
261
+ errorInstanceId: "faux-foundry",
262
+ parameters: {
263
+ objectType,
264
+ properties: [property]
265
+ }
266
+ });
267
+ }
268
+ if (propertyDef.dataType.type !== "mediaReference") {
269
+ // FIXME: what would the backend do here?
270
+ throw new OpenApiCallError(400, {
271
+ errorCode: "INVALID_ARGUMENT",
272
+ errorName: "InvalidPropertyType",
273
+ errorInstanceId: "faux-foundry",
274
+ parameters: {
275
+ property,
276
+ propertyBaseType: propertyDef.dataType.type
277
+ }
278
+ });
279
+ }
280
+ const rid = obj[property].reference.mediaSetViewItem.mediaItemRid;
281
+ if (!rid || !rid.startsWith("ri.")) {
282
+ throw new OpenApiCallError(400, {
283
+ errorCode: "INVALID_ARGUMENT",
284
+ errorName: "InvalidPropertyValue",
285
+ errorInstanceId: "faux-foundry",
286
+ parameters: {
287
+ property,
288
+ propertyBaseType: propertyDef.dataType.type,
289
+ propertyValue: rid
290
+ }
291
+ });
292
+ }
293
+ const ret = this.#media.get(objectType).get(property).get(rid);
294
+ if (!ret) {
295
+ throw new OpenApiCallError(400, InvalidRequest("Invalid parameters"));
296
+ }
297
+ return ret;
298
+ }
299
+ #removeSingleSideOfLink(locator, linkSide, expectedPriorValue) {
300
+ const destLinkName = linkSide.apiName;
301
+ if (linkSide.cardinality === "ONE") {
302
+ const links = this.#singleLinks.get(locator);
303
+ !(links.get(destLinkName) === expectedPriorValue) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
304
+ links.delete(destLinkName);
305
+ } else {
306
+ const links = this.#manyLinks.get(locator);
307
+ !links.get(destLinkName)?.has(expectedPriorValue) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
308
+ links.remove(destLinkName, expectedPriorValue);
309
+ }
310
+ }
311
+ getObject(apiName, primaryKey) {
312
+ return this.#objects.get(apiName).get(String(primaryKey));
313
+ }
314
+ getObjectOrThrow(apiName, primaryKey) {
315
+ const object = this.getObject(apiName, primaryKey);
316
+ if (!object) {
317
+ throw new OpenApiCallError(404, ObjectNotFoundError(apiName, String(primaryKey)));
318
+ }
319
+ return object;
320
+ }
321
+ getObjectByRid(rid) {
322
+ for (const [, pkToObjects] of this.#objects) {
323
+ for (const [, obj] of pkToObjects) {
324
+ if (obj.__rid === rid) {
325
+ return obj;
326
+ }
327
+ }
328
+ }
329
+ }
330
+ getLinksOrThrow(apiName, primaryKey, linkApiName) {
331
+ const object = this.getObjectOrThrow(apiName, primaryKey);
332
+ const linkTypeSide = this.#fauxOntology.getLinkTypeSideV2(apiName, linkApiName);
333
+ if (linkTypeSide.cardinality === "ONE") {
334
+ const locator = this.#singleLinks.get(objectLocator(object)).get(linkApiName);
335
+ if (locator === undefined) {
336
+ return [];
337
+ }
338
+ const {
339
+ objectType,
340
+ primaryKey
341
+ } = parseLocator(locator);
342
+ return [this.getObjectOrThrow(objectType, primaryKey)]; // will throw if not found
343
+ } else {
344
+ const locators = this.#manyLinks.get(objectLocator(object)).get(linkApiName);
345
+ return Array.from(locators ?? []).map(a => {
346
+ const [objectType, primaryKey] = a.split(":") ?? [];
347
+ !(objectType && primaryKey) ? process.env.NODE_ENV !== "production" ? invariant(false, "Invalid locator format") : invariant(false) : void 0;
348
+ return this.getObjectOrThrow(objectType, primaryKey);
349
+ });
350
+ }
351
+ }
352
+ getLinkOrThrow(objectType, primaryKey, linkType, targetPrimaryKey) {
353
+ const allLinks = this.getLinksOrThrow(objectType, primaryKey, linkType);
354
+ const object = allLinks.filter(l => String(l.__primaryKey) === targetPrimaryKey)[0];
355
+ if (!object) {
356
+ throw new OpenApiCallError(404, ObjectNotFoundError(`${objectType} -> ${linkType}`, String(targetPrimaryKey)));
357
+ }
358
+ return object;
359
+ }
360
+ getObjectsOfType(apiName) {
361
+ return this.#objects.get(apiName).values();
362
+ }
363
+ getObjectsFromObjectSet(parsedBody) {
364
+ const selected = parsedBody.select;
365
+ // when we have interfaces in here, we have a little trick for
366
+ // caching off the important properties
367
+ let objects = getObjectsFromSet(this, parsedBody.objectSet, undefined);
368
+ if (!objects) {
369
+ return {
370
+ data: [],
371
+ totalCount: "0",
372
+ nextPageToken: undefined
373
+ };
374
+ }
375
+ if (parsedBody.orderBy) {
376
+ objects = objects.sort(createOrderBySortFn(parsedBody.orderBy));
377
+ }
378
+
379
+ // finally, if we got interfaces, the objects have names like the interface and we need
380
+ // to return them like the object.
381
+
382
+ const page = pageThroughResponseSearchParams(objects, getPaginationParamsFromRequest(parsedBody), false);
383
+ if (!page) {
384
+ throw new OpenApiCallError(404, InvalidRequest(`No objects found for ${JSON.stringify(parsedBody)}`));
385
+ }
386
+ const ret = subSelectProperties(page, [...selected], true, parsedBody.excludeRid);
387
+ return ret;
388
+ }
389
+ getAttachmentMetadata(objectType, primaryKey, propertyName) {
390
+ const rid = this.getObjectOrThrow(objectType, primaryKey)[propertyName];
391
+ return this.#attachments.getAttachmentMetadataByRid(rid);
392
+ }
393
+ getAttachmentBuffer(objectType, primaryKey, propertyName) {
394
+ const rid = this.getObjectOrThrow(objectType, primaryKey)[propertyName];
395
+ return this.#attachments.getAttachmentBuffer(rid);
396
+ }
397
+ applyAction(actionTypeApiName, req) {
398
+ const actionDef = this.#fauxOntology.getActionDef(actionTypeApiName);
399
+ const actionImpl = this.#fauxOntology.getActionImpl(actionTypeApiName);
400
+ const validation = validateAction(req, actionDef, this);
401
+ if (validation.result === "INVALID") {
402
+ return {
403
+ validation
404
+ };
405
+ }
406
+ const batch = new FauxDataStoreBatch(this);
407
+ const r = actionImpl(batch, req, {
408
+ def: actionDef,
409
+ attachments: this.#attachments
410
+ });
411
+
412
+ // The legacy actions return the full payload
413
+ // they want to return, so we need to do that
414
+ // but the future is for the actionImpl's to
415
+ // return void and to do validation details here
416
+ if (r) return r;
417
+ return {
418
+ validation: {
419
+ parameters: {},
420
+ result: "VALID",
421
+ submissionCriteria: []
422
+ },
423
+ edits: req.options?.mode === "VALIDATE_AND_EXECUTE" && (req.options.returnEdits === "ALL" || req.options.returnEdits === "ALL_V2_WITH_DELETIONS") ? {
424
+ type: "edits",
425
+ ...batch.objectEdits
426
+ } : undefined
427
+ };
428
+ }
429
+ batchApplyAction(actionTypeApiName, batchReq) {
430
+ const actionDef = this.#fauxOntology.getActionDef(actionTypeApiName);
431
+ const actionImpl = this.#fauxOntology.getActionImpl(actionTypeApiName);
432
+ for (const req of batchReq.requests) {
433
+ const result = validateAction(req, actionDef, this);
434
+ if (result.result === "INVALID") {
435
+ throw new OpenApiCallError(500, {
436
+ errorCode: "INVALID_ARGUMENT",
437
+ errorName: "ActionValidationFailed",
438
+ errorInstanceId: "faux-foundry",
439
+ parameters: {
440
+ actionType: actionTypeApiName
441
+ }
442
+ });
443
+ }
444
+ }
445
+ const batch = new FauxDataStoreBatch(this);
446
+ for (const item of batchReq.requests) {
447
+ actionImpl(batch, {
448
+ ...item,
449
+ options: {
450
+ mode: "VALIDATE_AND_EXECUTE",
451
+ returnEdits: batchReq.options?.returnEdits
452
+ }
453
+ }, {
454
+ def: actionDef,
455
+ attachments: this.#attachments
456
+ });
457
+ }
458
+ if (batchReq.options?.returnEdits === "NONE") {
459
+ return {};
460
+ }
461
+ return {
462
+ edits: {
463
+ type: "edits",
464
+ ...batch.objectEdits,
465
+ edits: batch.objectEdits.edits.filter(x => x.type !== "deleteObject" && x.type !== "deleteLink")
466
+ }
467
+ };
468
+ }
469
+ }
470
+ //# sourceMappingURL=FauxDataStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FauxDataStore.js","names":["DefaultMap","MultiMap","randomUUID","crypto","invariant","InvalidRequest","ObjectNotFoundError","subSelectProperties","getPaginationParamsFromRequest","OpenApiCallError","pageThroughResponseSearchParams","isBaseServerObject","FauxDataStoreBatch","filterTimeSeriesData","createOrderBySortFn","getObjectsFromSet","objectLocator","parseLocator","validateAction","FauxDataStore","objects","Map","singleLinks","manyLinks","Set","fauxOntology","attachments","timeSeriesData","media","constructor","clear","ontology","assertObjectExists","#assertObjectExists","objectType","primaryKey","getObject","String","assertObjectDoesNotExist","#assertObjectDoesNotExist","errorCode","errorName","errorInstanceId","parameters","registerObject","anyObj","bso","process","env","NODE_ENV","Object","keys","some","s","startsWith","osdkCreatableToBso","apiName","__apiName","$apiName","__primaryKey","$primaryKey","others","get","set","freeze","#osdkCreatableToBso","meta","getObjectTypeFullMetadataOrThrow","realPrimaryKey","maybeTitle","titleProperty","rid","$rid","JSON","stringify","__title","undefined","__rid","replaceObjectOrThrow","x","unregisterObjectOrThrow","delete","registerLink","src","srcLinkName","dst","destLinkName","srcLocator","dstLocator","srcSide","dstSide","getBothLinkTypeSides","linkTypeRid","updateSingleLinkSide","unregisterLink","dstLinkName","removeSingleSideOfLink","registerTimeSeriesData","property","data","getObjectOrThrow","def","properties","dataType","type","getTimeSeriesData","filter","allData","#updateSingleLinkSide","cardinality","linkNameToObj","oldLocator","Error","registerMedia","content","mediaType","path","mediaItemRid","mediaRef","mimeType","reference","mediaSetViewItem","mediaSetRid","mediaSetViewRid","metaData","sizeBytes","byteLength","getMediaOrThrow","obj","propertyDef","propertyBaseType","propertyValue","ret","#removeSingleSideOfLink","locator","linkSide","expectedPriorValue","links","has","remove","object","getObjectByRid","pkToObjects","getLinksOrThrow","linkApiName","linkTypeSide","getLinkTypeSideV2","locators","Array","from","map","a","split","getLinkOrThrow","linkType","targetPrimaryKey","allLinks","l","getObjectsOfType","values","getObjectsFromObjectSet","parsedBody","selected","select","objectSet","totalCount","nextPageToken","orderBy","sort","page","excludeRid","getAttachmentMetadata","propertyName","getAttachmentMetadataByRid","getAttachmentBuffer","applyAction","actionTypeApiName","req","actionDef","getActionDef","actionImpl","getActionImpl","validation","result","batch","r","submissionCriteria","edits","options","mode","returnEdits","objectEdits","batchApplyAction","batchReq","requests","actionType","item"],"sources":["FauxDataStore.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 { CompileTimeMetadata, ObjectTypeDefinition } from \"@osdk/api\";\nimport type {\n MediaItemRid,\n MediaReference,\n MediaType,\n} from \"@osdk/foundry.core\";\nimport type * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { DefaultMap, MultiMap } from \"mnemonist\";\nimport { randomUUID } from \"node:crypto\";\nimport * as crypto from \"node:crypto\";\nimport invariant from \"tiny-invariant\";\nimport type { ReadonlyDeep } from \"type-fest\";\nimport { InvalidRequest, ObjectNotFoundError } from \"../errors.js\";\nimport { subSelectProperties } from \"../filterObjects.js\";\nimport { getPaginationParamsFromRequest } from \"../handlers/util/getPaginationParams.js\";\nimport { OpenApiCallError } from \"../handlers/util/handleOpenApiCall.js\";\nimport type { PagedBodyResponseWithTotal } from \"../handlers/util/pageThroughResponseSearchParams.js\";\nimport { pageThroughResponseSearchParams } from \"../handlers/util/pageThroughResponseSearchParams.js\";\nimport {\n type BaseServerObject,\n isBaseServerObject,\n} from \"./BaseServerObject.js\";\nimport type { FauxAttachmentStore } from \"./FauxAttachmentStore.js\";\nimport { FauxDataStoreBatch } from \"./FauxDataStoreBatch.js\";\nimport type { FauxOntology } from \"./FauxOntology.js\";\nimport { filterTimeSeriesData } from \"./filterTimeSeriesData.js\";\nimport { createOrderBySortFn, getObjectsFromSet } from \"./getObjectsFromSet.js\";\nimport type { ObjectLocator } from \"./ObjectLocator.js\";\nimport { objectLocator, parseLocator } from \"./ObjectLocator.js\";\nimport type { JustProps } from \"./typeHelpers/JustProps.js\";\nimport { validateAction } from \"./validateAction.js\";\n\nexport interface MediaMetadataAndContent {\n content: ArrayBuffer;\n mediaRef: MediaReference;\n metaData: OntologiesV2.MediaMetadata;\n}\n\ntype ObjectTypeCreatableWithoutApiName<T extends ObjectTypeDefinition> =\n OrUndefinedToOptional<JustProps<T>>;\n\n/**\n * Represents the properties needed to create an object, specifically,\n * the properties of the object and the $apiName\n */\ntype ObjectTypeCreatable<T extends ObjectTypeDefinition> =\n & ObjectTypeCreatableWithoutApiName<T>\n & { $apiName: CompileTimeMetadata<T>[\"apiName\"] };\n\n/**\n * Helper type for converting `foo: string | undefined` into `foo?: string`\n */\ntype OrUndefinedToOptional<T extends object> =\n & {\n [K in keyof T as T[K] extends undefined ? K : never]?: T[K];\n }\n & {\n [K in keyof T as T[K] extends undefined ? never : K]?: T[K];\n };\n\n/**\n * Type safe object for representing \"client\" side objects.\n */\ninterface BaseObjectTypeCreatable {\n $apiName?: OntologiesV2.ObjectTypeApiName;\n\n /** if present it must match the correct value */\n $primaryKey?: string | number | boolean;\n\n /** If set, will use the as the $rid for the object, otherwise one is created for you */\n $rid?: string;\n\n /**\n * All the properties.\n *\n * FUTURE: This only handles the primitive types right now. If we want to be able to create\n * objects with some helpers for other types, this will need to be updated.\n */\n [key: string]: string | number | boolean | undefined;\n}\n\nexport class FauxDataStore {\n #objects = new DefaultMap<\n OntologiesV2.ObjectTypeApiName,\n Map<string, BaseServerObject>\n >(\n (key) => new Map(),\n );\n\n #singleLinks = new DefaultMap(\n (_objectLocator: ObjectLocator) =>\n new Map<OntologiesV2.LinkTypeApiName, ObjectLocator>(),\n );\n\n #manyLinks = new DefaultMap(\n (_objectLocator: ObjectLocator) => new MultiMap<string, ObjectLocator>(Set),\n );\n\n #fauxOntology: FauxOntology;\n\n #attachments: FauxAttachmentStore;\n\n #timeSeriesData = new DefaultMap(\n (_objectType: OntologiesV2.ObjectTypeApiName) =>\n new DefaultMap((_pk: string) =>\n new DefaultMap((_property: OntologiesV2.PropertyApiName) =>\n [] as Array<OntologiesV2.TimeSeriesPoint>\n )\n ),\n );\n\n #media = new DefaultMap(\n (_objectType: OntologiesV2.ObjectTypeApiName) =>\n new DefaultMap((_propName: OntologiesV2.PropertyApiName) => {\n return new Map<MediaItemRid, MediaMetadataAndContent>();\n }),\n );\n\n constructor(fauxOntology: FauxOntology, attachments: FauxAttachmentStore) {\n this.#fauxOntology = fauxOntology;\n this.#attachments = attachments;\n }\n\n /**\n * Removes all data that is associated with a namespace/ontology.\n *\n * Note: does not clear `attachments` nor does it clear the ontology itself.\n */\n public clear(): void {\n this.#media.clear();\n this.#timeSeriesData.clear();\n this.#manyLinks.clear();\n this.#singleLinks.clear();\n this.#objects.clear();\n }\n\n get ontology(): FauxOntology {\n return this.#fauxOntology;\n }\n\n #assertObjectExists(\n objectType: string,\n primaryKey: string | number | boolean,\n ) {\n if (!this.getObject(objectType, primaryKey)) {\n throw new OpenApiCallError(\n 404,\n ObjectNotFoundError(objectType, String(primaryKey)),\n );\n }\n }\n\n #assertObjectDoesNotExist(\n objectType: string,\n primaryKey: string | number | boolean,\n ): void {\n if (this.getObject(objectType, primaryKey)) {\n throw new OpenApiCallError(\n 500,\n {\n errorCode: \"CONFLICT\",\n errorName: \"ObjectAlreadyExists\",\n errorInstanceId: \"faux-foundry\",\n parameters: {\n objectType,\n primaryKey: String(primaryKey),\n },\n } satisfies OntologiesV2.ObjectAlreadyExists,\n );\n }\n }\n\n /**\n * Version for use in places like @osdk/client.\n *\n * @param obj An `Osdk.Instance` like object for the ObjectType in the generics\n */\n registerObject<T extends ObjectTypeDefinition>(\n objectType: T,\n obj: ObjectTypeCreatable<T> | ObjectTypeCreatableWithoutApiName<T>,\n ): void;\n /**\n * Version of register object generally used in shared.test\n * @param obj A raw server side representation of an object\n *\n * Don't use, its too easy to end up with an any.\n */\n registerObject(obj: BaseServerObject): void;\n registerObject(\n objectType: string | ObjectTypeDefinition | BaseServerObject,\n anyObj?: BaseServerObject | BaseObjectTypeCreatable,\n ): void {\n let bso: BaseServerObject;\n // obj = { ...obj }; // make a copy so we can mutate it\n\n if (isBaseServerObject(objectType)) {\n invariant(\n anyObj == null,\n \"Internal overload should only pass one argument\",\n );\n invariant(\n !Object.keys(objectType).some(s => s.startsWith(\"$\")),\n \"Object should not have any keys starting with $ if it has __apiName\",\n );\n bso = objectType;\n } else if (anyObj == null) {\n invariant(false, \"should not be possible due to overloads\");\n } else if (isBaseServerObject(anyObj)) {\n invariant(\n !Object.keys(anyObj).some(s => s.startsWith(\"$\")),\n \"Object should not have any keys starting with $ if it has __apiName\",\n );\n bso = anyObj;\n } else {\n bso = this.#osdkCreatableToBso(objectType, anyObj);\n }\n\n const apiName = bso.__apiName || bso.$apiName;\n invariant(apiName, \"Object should have an __apiName or $apiName\");\n\n this.#assertObjectDoesNotExist(apiName, bso.__primaryKey);\n\n if (!(\"__apiName\" in bso && \"__primaryKey\" in bso)) {\n invariant(\n \"$apiName\" in bso && \"$primaryKey\" in bso,\n \"Object should have (__apiName and __primaryKey) or ($apiName and $primaryKey)\",\n );\n const { $apiName, $primaryKey, ...others } = bso as\n & {\n $apiName: OntologiesV2.ObjectTypeApiName;\n $primaryKey: string | number | boolean;\n }\n & Record<\n string,\n unknown\n >;\n bso = {\n __apiName: $apiName,\n __primaryKey: $primaryKey,\n ...others,\n };\n }\n this.#assertObjectDoesNotExist(bso.__apiName, bso.__primaryKey);\n this.#objects.get(bso.__apiName).set(\n String(bso.__primaryKey),\n Object.freeze({ ...bso }),\n );\n }\n\n #osdkCreatableToBso(\n objectType: string | ObjectTypeDefinition,\n anyObj: BaseObjectTypeCreatable,\n ) {\n objectType = typeof objectType === \"string\"\n ? objectType\n : objectType.apiName;\n\n if (\"$apiName\" in anyObj) {\n invariant(anyObj.$apiName === objectType);\n }\n const { $apiName, $primaryKey, ...others } = anyObj;\n\n const meta = this.ontology.getObjectTypeFullMetadataOrThrow(\n objectType,\n );\n const realPrimaryKey = anyObj[meta.objectType.primaryKey] as\n | string\n | number\n | boolean;\n\n const maybeTitle = anyObj[meta.objectType.titleProperty];\n const rid = anyObj.$rid\n ?? `ri.phonograph2-objects.main.object.${crypto.randomUUID()}`;\n\n invariant(\n realPrimaryKey != null,\n `Object should have a primary key. ${JSON.stringify(anyObj)}`,\n );\n\n invariant(\n $primaryKey == null || $primaryKey === realPrimaryKey,\n \"Primary key mismatch\",\n );\n\n return {\n __apiName: objectType,\n __primaryKey: realPrimaryKey,\n __title: maybeTitle ? String(maybeTitle) : undefined,\n __rid: rid,\n ...others,\n };\n }\n\n replaceObjectOrThrow(x: BaseServerObject): void {\n this.#assertObjectExists(x.__apiName, x.__primaryKey);\n this.#objects.get(x.__apiName).set(String(x.__primaryKey), x);\n }\n\n /** Throws if the object does not already exist */\n unregisterObjectOrThrow(\n objectType: string,\n primaryKey: string | number | boolean,\n ): void {\n this.#assertObjectExists(objectType, primaryKey);\n this.#objects.get(objectType).delete(String(primaryKey));\n }\n\n registerLink(\n src: BaseServerObject,\n srcLinkName: string,\n dst: BaseServerObject,\n destLinkName: string,\n ): void {\n const srcLocator = objectLocator(src);\n const dstLocator = objectLocator(dst);\n const [srcSide, dstSide] = this.#fauxOntology.getBothLinkTypeSides(\n src.__apiName,\n srcLinkName,\n dst.__apiName,\n );\n\n invariant(\n srcSide.linkTypeRid === dstSide.linkTypeRid,\n `Expected both sides of the link to have the same rid, but got ${srcSide.linkTypeRid} and ${dstSide.linkTypeRid}`,\n );\n invariant(\n dstSide.apiName === destLinkName,\n `Link name mismatch on dst side. Expected ${destLinkName} but found ${dstSide.apiName}`,\n );\n\n this.#updateSingleLinkSide(\n srcSide,\n srcLocator,\n dstSide,\n dstLocator,\n );\n this.#updateSingleLinkSide(\n dstSide,\n dstLocator,\n srcSide,\n srcLocator,\n );\n }\n\n unregisterLink(\n src: BaseServerObject,\n srcLinkName: string,\n dst: BaseServerObject,\n dstLinkName: string,\n ): void {\n const srcLocator = objectLocator(src);\n const dstLocator = objectLocator(dst);\n const [srcSide, dstSide] = this.#fauxOntology.getBothLinkTypeSides(\n src.__apiName,\n srcLinkName,\n dst.__apiName,\n );\n\n invariant(\n dstSide.apiName === dstLinkName,\n `Link name mismatch on dst side. Expected ${dstLinkName} but found ${dstSide.apiName}`,\n );\n\n this.#removeSingleSideOfLink(srcLocator, srcSide, dstLocator);\n this.#removeSingleSideOfLink(dstLocator, dstSide, srcLocator);\n }\n\n registerTimeSeriesData(\n objectType: OntologiesV2.ObjectTypeApiName,\n primaryKey: string,\n property: OntologiesV2.PropertyApiName,\n data: OntologiesV2.TimeSeriesPoint[],\n ): void {\n this.getObjectOrThrow(objectType, primaryKey);\n const def = this.ontology.getObjectTypeFullMetadataOrThrow(objectType);\n invariant(\n def.objectType.properties[property].dataType.type === \"timeseries\"\n || def.objectType.properties[property].dataType.type\n === \"geotimeSeriesReference\",\n );\n this.#timeSeriesData.get(objectType).get(String(primaryKey)).set(\n property,\n data,\n );\n }\n\n getTimeSeriesData(\n objectType: OntologiesV2.ObjectTypeApiName,\n primaryKey: string,\n property: OntologiesV2.PropertyApiName,\n filter?: OntologiesV2.StreamTimeSeriesPointsRequest,\n ): OntologiesV2.TimeSeriesPoint[] {\n this.getObjectOrThrow(objectType, primaryKey);\n const allData = this.#timeSeriesData.get(objectType).get(String(primaryKey))\n .get(\n property,\n );\n if (!filter) return allData;\n return filterTimeSeriesData(allData, filter);\n }\n\n #updateSingleLinkSide(\n srcSide: OntologiesV2.LinkTypeSideV2,\n srcLocator: ObjectLocator,\n dstSide: OntologiesV2.LinkTypeSideV2,\n dstLocator: ObjectLocator,\n ) {\n const srcLinkName = srcSide.apiName;\n if (srcSide.cardinality === \"ONE\") {\n const linkNameToObj = this.#singleLinks.get(srcLocator);\n const oldLocator = linkNameToObj.get(srcLinkName);\n\n if (oldLocator && oldLocator !== dstLocator) {\n // we need to remove the other side's old value\n this.#removeSingleSideOfLink(\n oldLocator,\n dstSide,\n srcLocator,\n );\n }\n linkNameToObj.set(srcLinkName, dstLocator);\n } else if (srcSide.cardinality === \"MANY\") {\n const linkNameToObj = this.#manyLinks.get(srcLocator);\n linkNameToObj.set(srcLinkName, dstLocator);\n } else {\n // \"never\" case\n throw new Error(\"unexpected cardinality: \" + srcSide.cardinality);\n }\n }\n\n registerMedia(\n objectType: OntologiesV2.ObjectTypeApiName,\n property: OntologiesV2.PropertyApiName,\n content: ArrayBuffer,\n mediaType: MediaType,\n path: string | undefined,\n // This should be the correct prefix, per\n // https://github.com/palantir/osdk-ts/pull/1303#discussion_r2001989395\n mediaItemRid: MediaItemRid = `ri.mio.main.media-item.${randomUUID()}`,\n ): MediaReference {\n const mediaRef: ReadonlyDeep<MediaReference> = Object.freeze({\n mimeType: mediaType,\n reference: Object.freeze({\n type: \"mediaSetViewItem\",\n mediaSetViewItem: Object.freeze({\n mediaItemRid,\n mediaSetRid: \"ri.unimplemented.in.shared.test\",\n mediaSetViewRid: \"ri.unimplemented.in.shared.test\",\n }),\n }),\n });\n\n this.#media.get(objectType).get(property).set(\n mediaItemRid,\n Object.freeze({\n content,\n mediaRef,\n metaData: Object.freeze({\n mediaType,\n path,\n sizeBytes: String(content.byteLength),\n }),\n }),\n );\n\n return mediaRef;\n }\n\n getMediaOrThrow(\n objectType: OntologiesV2.ObjectTypeApiName,\n primaryKey: string,\n property: OntologiesV2.PropertyApiName,\n ): MediaMetadataAndContent {\n const obj = this.getObjectOrThrow(objectType, primaryKey);\n const propertyDef =\n this.ontology.getObjectTypeFullMetadataOrThrow(objectType)\n .objectType.properties[property];\n\n if (!propertyDef) {\n // This should be the correct error, per\n // https://github.com/palantir/osdk-ts/pull/1303#discussion_r2001968959\n throw new OpenApiCallError(\n 400,\n {\n errorCode: \"NOT_FOUND\",\n errorName: \"PropertiesNotFound\",\n errorInstanceId: \"faux-foundry\",\n parameters: {\n objectType,\n properties: [property],\n },\n } satisfies OntologiesV2.PropertiesNotFound,\n );\n }\n\n if (propertyDef.dataType.type !== \"mediaReference\") {\n // FIXME: what would the backend do here?\n throw new OpenApiCallError(\n 400,\n {\n errorCode: \"INVALID_ARGUMENT\",\n errorName: \"InvalidPropertyType\",\n errorInstanceId: \"faux-foundry\",\n parameters: {\n property,\n propertyBaseType: propertyDef.dataType.type,\n },\n } satisfies OntologiesV2.InvalidPropertyType,\n );\n }\n\n const rid = obj[property].reference.mediaSetViewItem.mediaItemRid;\n\n if (!rid || !rid.startsWith(\"ri.\")) {\n throw new OpenApiCallError(\n 400,\n {\n errorCode: \"INVALID_ARGUMENT\",\n errorName: \"InvalidPropertyValue\",\n errorInstanceId: \"faux-foundry\",\n parameters: {\n property,\n propertyBaseType: propertyDef.dataType.type,\n propertyValue: rid,\n },\n } satisfies OntologiesV2.InvalidPropertyValue,\n );\n }\n\n const ret = this.#media.get(objectType).get(property).get(rid);\n\n if (!ret) {\n throw new OpenApiCallError(400, InvalidRequest(\"Invalid parameters\"));\n }\n return ret;\n }\n\n #removeSingleSideOfLink(\n locator: ObjectLocator,\n linkSide: OntologiesV2.LinkTypeSideV2,\n expectedPriorValue: ObjectLocator,\n ) {\n const destLinkName = linkSide.apiName;\n if (linkSide.cardinality === \"ONE\") {\n const links = this.#singleLinks.get(locator);\n invariant(links.get(destLinkName) === expectedPriorValue);\n links.delete(destLinkName);\n } else {\n const links = this.#manyLinks.get(locator);\n invariant(links.get(destLinkName)?.has(expectedPriorValue));\n links.remove(destLinkName, expectedPriorValue);\n }\n }\n\n getObject(\n apiName: string,\n primaryKey: string | number | boolean,\n ): BaseServerObject | undefined {\n return this.#objects\n .get(apiName)\n .get(String(primaryKey));\n }\n\n getObjectOrThrow(\n apiName: string,\n primaryKey: string | number | boolean,\n ): BaseServerObject {\n const object = this.getObject(apiName, primaryKey);\n\n if (!object) {\n throw new OpenApiCallError(\n 404,\n ObjectNotFoundError(apiName, String(primaryKey)),\n );\n }\n return object;\n }\n\n getObjectByRid(rid: string): BaseServerObject | undefined {\n for (const [, pkToObjects] of this.#objects) {\n for (const [, obj] of pkToObjects) {\n if (obj.__rid === rid) {\n return obj;\n }\n }\n }\n }\n\n getLinksOrThrow(\n apiName: string,\n primaryKey: string | number | boolean,\n linkApiName: string,\n ): BaseServerObject[] {\n const object = this.getObjectOrThrow(apiName, primaryKey);\n\n const linkTypeSide = this.#fauxOntology.getLinkTypeSideV2(\n apiName,\n linkApiName,\n );\n\n if (linkTypeSide.cardinality === \"ONE\") {\n const locator = this.#singleLinks\n .get(objectLocator(object))\n .get(linkApiName);\n if (locator === undefined) {\n return [];\n }\n const { objectType, primaryKey } = parseLocator(locator);\n\n return [this.getObjectOrThrow(objectType, primaryKey)]; // will throw if not found\n } else {\n const locators = this.#manyLinks\n .get(objectLocator(object))\n .get(linkApiName);\n\n return Array.from(locators ?? [])\n .map((a) => {\n const [objectType, primaryKey] = a.split(\":\") ?? [];\n invariant(objectType && primaryKey, \"Invalid locator format\");\n return this.getObjectOrThrow(objectType, primaryKey);\n });\n }\n }\n\n getLinkOrThrow(\n objectType: string,\n primaryKey: string | number | boolean,\n linkType: string,\n targetPrimaryKey: string | number | boolean,\n ): BaseServerObject {\n const allLinks = this.getLinksOrThrow(objectType, primaryKey, linkType);\n const object =\n allLinks.filter(l => String(l.__primaryKey) === targetPrimaryKey)[0];\n\n if (!object) {\n throw new OpenApiCallError(\n 404,\n ObjectNotFoundError(\n `${objectType} -> ${linkType}`,\n String(targetPrimaryKey),\n ),\n );\n }\n return object;\n }\n\n getObjectsOfType(apiName: string): Iterable<BaseServerObject> {\n return this.#objects\n .get(apiName)\n .values();\n }\n\n getObjectsFromObjectSet(\n parsedBody:\n | OntologiesV2.LoadObjectSetV2MultipleObjectTypesRequest\n | OntologiesV2.LoadObjectSetRequestV2,\n ): PagedBodyResponseWithTotal<BaseServerObject> {\n const selected = parsedBody.select;\n // when we have interfaces in here, we have a little trick for\n // caching off the important properties\n let objects = getObjectsFromSet(this, parsedBody.objectSet, undefined);\n\n if (!objects) {\n return {\n data: [],\n totalCount: \"0\",\n nextPageToken: undefined,\n };\n }\n\n if (parsedBody.orderBy) {\n objects = objects.sort(createOrderBySortFn(parsedBody.orderBy));\n }\n\n // finally, if we got interfaces, the objects have names like the interface and we need\n // to return them like the object.\n\n const page = pageThroughResponseSearchParams(\n objects,\n getPaginationParamsFromRequest(parsedBody),\n false,\n );\n\n if (!page) {\n throw new OpenApiCallError(\n 404,\n InvalidRequest(\n `No objects found for ${JSON.stringify(parsedBody)}`,\n ),\n );\n }\n const ret = subSelectProperties(\n page,\n [...selected],\n true,\n parsedBody.excludeRid,\n );\n\n return ret;\n }\n\n getAttachmentMetadata(\n objectType: string,\n primaryKey: string | number | boolean,\n propertyName: string,\n ): OntologiesV2.AttachmentV2 {\n const rid = this.getObjectOrThrow(objectType, primaryKey)[propertyName];\n return this.#attachments.getAttachmentMetadataByRid(rid);\n }\n\n getAttachmentBuffer(\n objectType: string,\n primaryKey: string | number | boolean,\n propertyName: string,\n ): ArrayBuffer {\n const rid = this.getObjectOrThrow(objectType, primaryKey)[propertyName];\n return this.#attachments.getAttachmentBuffer(rid);\n }\n\n applyAction(\n actionTypeApiName: string,\n req: OntologiesV2.ApplyActionRequestV2,\n ): OntologiesV2.SyncApplyActionResponseV2 {\n const actionDef = this.#fauxOntology.getActionDef(actionTypeApiName);\n const actionImpl = this.#fauxOntology.getActionImpl(actionTypeApiName);\n\n const validation = validateAction(req, actionDef, this);\n if (validation.result === \"INVALID\") {\n return { validation };\n }\n\n const batch = new FauxDataStoreBatch(this);\n const r = actionImpl(batch, req, {\n def: actionDef,\n attachments: this.#attachments,\n });\n\n // The legacy actions return the full payload\n // they want to return, so we need to do that\n // but the future is for the actionImpl's to\n // return void and to do validation details here\n if (r) return r;\n\n return {\n validation: {\n parameters: {},\n result: \"VALID\",\n submissionCriteria: [],\n },\n edits: req.options?.mode === \"VALIDATE_AND_EXECUTE\"\n && (\n req.options.returnEdits === \"ALL\"\n || req.options.returnEdits === \"ALL_V2_WITH_DELETIONS\"\n )\n ? {\n type: \"edits\",\n ...batch.objectEdits,\n }\n : undefined,\n };\n }\n\n batchApplyAction(\n actionTypeApiName: string,\n batchReq: OntologiesV2.BatchApplyActionRequestV2,\n ): OntologiesV2.BatchApplyActionResponseV2 {\n const actionDef = this.#fauxOntology.getActionDef(actionTypeApiName);\n const actionImpl = this.#fauxOntology.getActionImpl(actionTypeApiName);\n\n for (const req of batchReq.requests) {\n const result = validateAction(req, actionDef, this);\n if (result.result === \"INVALID\") {\n throw new OpenApiCallError(\n 500,\n {\n errorCode: \"INVALID_ARGUMENT\",\n errorName: \"ActionValidationFailed\",\n errorInstanceId: \"faux-foundry\",\n parameters: {\n actionType: actionTypeApiName,\n },\n } as OntologiesV2.ActionValidationFailed,\n );\n }\n }\n\n const batch = new FauxDataStoreBatch(this);\n\n const returnLargeScaleEdits = false;\n for (const item of batchReq.requests) {\n actionImpl(\n batch,\n {\n ...item,\n options: {\n mode: \"VALIDATE_AND_EXECUTE\",\n returnEdits: batchReq.options?.returnEdits,\n },\n },\n { def: actionDef, attachments: this.#attachments },\n );\n }\n if (batchReq.options?.returnEdits === \"NONE\") {\n return {};\n }\n\n if (returnLargeScaleEdits) {\n const editedObjectTypes = new Set<OntologiesV2.ObjectTypeApiName>();\n for (const edit of batch.objectEdits.edits) {\n if (\n edit.type === \"modifyObject\" || edit.type === \"addObject\"\n || edit.type === \"deleteObject\"\n ) {\n editedObjectTypes.add(edit.objectType);\n }\n }\n\n return {\n edits: {\n type: \"largeScaleEdits\",\n editedObjectTypes: Array.from(editedObjectTypes),\n },\n };\n }\n\n return {\n edits: {\n type: \"edits\",\n ...batch.objectEdits,\n edits: batch.objectEdits.edits.filter(x =>\n x.type !== \"deleteObject\" && x.type !== \"deleteLink\"\n ),\n },\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,WAAW;AAChD,SAASC,UAAU,QAAQ,aAAa;AACxC,OAAO,KAAKC,MAAM,MAAM,aAAa;AACrC,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,SAASC,cAAc,EAAEC,mBAAmB,QAAQ,cAAc;AAClE,SAASC,mBAAmB,QAAQ,qBAAqB;AACzD,SAASC,8BAA8B,QAAQ,yCAAyC;AACxF,SAASC,gBAAgB,QAAQ,uCAAuC;A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