@xyo-network/api 2.74.4 → 2.75.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (616) hide show
  1. package/dist/browser/Api/Api.cjs +188 -0
  2. package/dist/browser/Api/Api.cjs.map +1 -0
  3. package/dist/browser/Api/Api.d.mts.map +1 -0
  4. package/dist/browser/Api/Api.d.ts.map +1 -0
  5. package/dist/browser/Api/Api.js +167 -0
  6. package/dist/browser/Api/Api.js.map +1 -0
  7. package/dist/browser/Api/index.cjs +190 -0
  8. package/dist/browser/Api/index.cjs.map +1 -0
  9. package/dist/browser/Api/index.d.mts.map +1 -0
  10. package/dist/browser/Api/index.d.ts.map +1 -0
  11. package/dist/browser/Api/index.js +167 -0
  12. package/dist/browser/Api/index.js.map +1 -0
  13. package/dist/browser/Base.cjs +123 -0
  14. package/dist/browser/Base.cjs.map +1 -0
  15. package/dist/browser/Base.d.mts.map +1 -0
  16. package/dist/browser/Base.d.ts.map +1 -0
  17. package/dist/browser/Base.js +102 -0
  18. package/dist/browser/Base.js.map +1 -0
  19. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApi.cjs +55 -0
  20. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApi.cjs.map +1 -0
  21. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApi.d.mts.map +1 -0
  22. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApi.d.ts.map +1 -0
  23. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApi.js +34 -0
  24. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApi.js.map +1 -0
  25. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.cjs +34 -0
  26. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.cjs.map +1 -0
  27. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts.map +1 -0
  28. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts.map +1 -0
  29. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.js +13 -0
  30. package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.js.map +1 -0
  31. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.cjs +19 -0
  32. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.cjs.map +1 -0
  33. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.mts.map +1 -0
  34. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts.map +1 -0
  35. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.js +1 -0
  36. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.js.map +1 -0
  37. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.cjs +33 -0
  38. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.cjs.map +1 -0
  39. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.mts.map +1 -0
  40. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts.map +1 -0
  41. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.js +12 -0
  42. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.js.map +1 -0
  43. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.cjs +35 -0
  44. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.cjs.map +1 -0
  45. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.mts.map +1 -0
  46. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts.map +1 -0
  47. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.js +12 -0
  48. package/dist/browser/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.js.map +1 -0
  49. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.cjs +33 -0
  50. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.cjs.map +1 -0
  51. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.mts.map +1 -0
  52. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts.map +1 -0
  53. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.js +12 -0
  54. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.js.map +1 -0
  55. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.cjs +35 -0
  56. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.cjs.map +1 -0
  57. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.mts.map +1 -0
  58. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts.map +1 -0
  59. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.js +12 -0
  60. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.js.map +1 -0
  61. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.cjs +19 -0
  62. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.cjs.map +1 -0
  63. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.mts.map +1 -0
  64. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +1 -0
  65. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.js +1 -0
  66. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.js.map +1 -0
  67. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.cjs +19 -0
  68. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.cjs.map +1 -0
  69. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.mts.map +1 -0
  70. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts.map +1 -0
  71. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.js +1 -0
  72. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.js.map +1 -0
  73. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuerySchema.cjs +34 -0
  74. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuerySchema.cjs.map +1 -0
  75. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.mts.map +1 -0
  76. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts.map +1 -0
  77. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuerySchema.js +13 -0
  78. package/dist/browser/Diviner/LocationDiviner/Queries/LocationQuerySchema.js.map +1 -0
  79. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.cjs +19 -0
  80. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.cjs.map +1 -0
  81. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.mts.map +1 -0
  82. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts.map +1 -0
  83. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.js +1 -0
  84. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.js.map +1 -0
  85. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.cjs +33 -0
  86. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.cjs.map +1 -0
  87. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.mts.map +1 -0
  88. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts.map +1 -0
  89. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.js +12 -0
  90. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.js.map +1 -0
  91. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.cjs +35 -0
  92. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.cjs.map +1 -0
  93. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.mts.map +1 -0
  94. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts.map +1 -0
  95. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.js +12 -0
  96. package/dist/browser/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.js.map +1 -0
  97. package/dist/browser/Diviner/LocationDiviner/Queries/index.cjs +66 -0
  98. package/dist/browser/Diviner/LocationDiviner/Queries/index.cjs.map +1 -0
  99. package/dist/browser/Diviner/LocationDiviner/Queries/index.d.mts.map +1 -0
  100. package/dist/browser/Diviner/LocationDiviner/Queries/index.d.ts.map +1 -0
  101. package/dist/browser/Diviner/LocationDiviner/Queries/index.js +43 -0
  102. package/dist/browser/Diviner/LocationDiviner/Queries/index.js.map +1 -0
  103. package/dist/browser/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.cjs +27 -0
  104. package/dist/browser/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.cjs.map +1 -0
  105. package/dist/browser/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.mts.map +1 -0
  106. package/dist/browser/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts.map +1 -0
  107. package/dist/browser/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.js +6 -0
  108. package/dist/browser/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.js.map +1 -0
  109. package/dist/browser/Diviner/LocationDiviner/Witnesses/LocationWitness.cjs +27 -0
  110. package/dist/browser/Diviner/LocationDiviner/Witnesses/LocationWitness.cjs.map +1 -0
  111. package/dist/browser/Diviner/LocationDiviner/Witnesses/LocationWitness.d.mts.map +1 -0
  112. package/dist/browser/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts.map +1 -0
  113. package/dist/browser/Diviner/LocationDiviner/Witnesses/LocationWitness.js +6 -0
  114. package/dist/browser/Diviner/LocationDiviner/Witnesses/LocationWitness.js.map +1 -0
  115. package/dist/browser/Diviner/LocationDiviner/Witnesses/index.cjs +33 -0
  116. package/dist/browser/Diviner/LocationDiviner/Witnesses/index.cjs.map +1 -0
  117. package/dist/browser/Diviner/LocationDiviner/Witnesses/index.d.mts.map +1 -0
  118. package/dist/browser/Diviner/LocationDiviner/Witnesses/index.d.ts.map +1 -0
  119. package/dist/browser/Diviner/LocationDiviner/Witnesses/index.js +10 -0
  120. package/dist/browser/Diviner/LocationDiviner/Witnesses/index.js.map +1 -0
  121. package/dist/browser/Diviner/LocationDiviner/index.cjs +106 -0
  122. package/dist/browser/Diviner/LocationDiviner/index.cjs.map +1 -0
  123. package/dist/browser/Diviner/LocationDiviner/index.d.mts.map +1 -0
  124. package/dist/browser/Diviner/LocationDiviner/index.d.ts.map +1 -0
  125. package/dist/browser/Diviner/LocationDiviner/index.js +83 -0
  126. package/dist/browser/Diviner/LocationDiviner/index.js.map +1 -0
  127. package/dist/browser/Diviner/LocationDiviner/models.cjs +19 -0
  128. package/dist/browser/Diviner/LocationDiviner/models.cjs.map +1 -0
  129. package/dist/browser/Diviner/LocationDiviner/models.d.mts.map +1 -0
  130. package/dist/browser/Diviner/LocationDiviner/models.d.ts.map +1 -0
  131. package/dist/browser/Diviner/LocationDiviner/models.js +1 -0
  132. package/dist/browser/Diviner/LocationDiviner/models.js.map +1 -0
  133. package/dist/browser/Diviner/RemoteDivinerConfig.cjs +27 -0
  134. package/dist/browser/Diviner/RemoteDivinerConfig.cjs.map +1 -0
  135. package/dist/browser/Diviner/RemoteDivinerConfig.d.mts.map +1 -0
  136. package/dist/browser/Diviner/RemoteDivinerConfig.d.ts.map +1 -0
  137. package/dist/browser/Diviner/RemoteDivinerConfig.js +6 -0
  138. package/dist/browser/Diviner/RemoteDivinerConfig.js.map +1 -0
  139. package/dist/browser/Diviner/RemoteDivinerError.cjs +35 -0
  140. package/dist/browser/Diviner/RemoteDivinerError.cjs.map +1 -0
  141. package/dist/browser/Diviner/RemoteDivinerError.d.mts.map +1 -0
  142. package/dist/browser/Diviner/RemoteDivinerError.d.ts.map +1 -0
  143. package/dist/browser/Diviner/RemoteDivinerError.js +14 -0
  144. package/dist/browser/Diviner/RemoteDivinerError.js.map +1 -0
  145. package/dist/browser/Diviner/index.cjs +110 -0
  146. package/dist/browser/Diviner/index.cjs.map +1 -0
  147. package/dist/browser/Diviner/index.d.mts.map +1 -0
  148. package/dist/browser/Diviner/index.d.ts.map +1 -0
  149. package/dist/browser/Diviner/index.js +87 -0
  150. package/dist/browser/Diviner/index.js.map +1 -0
  151. package/dist/browser/Simple.cjs +176 -0
  152. package/dist/browser/Simple.cjs.map +1 -0
  153. package/dist/browser/Simple.d.mts.map +1 -0
  154. package/dist/browser/Simple.d.ts.map +1 -0
  155. package/dist/browser/Simple.js +153 -0
  156. package/dist/browser/Simple.js.map +1 -0
  157. package/dist/browser/Test/index.cjs +56 -0
  158. package/dist/browser/Test/index.cjs.map +1 -0
  159. package/dist/browser/Test/index.d.mts.map +1 -0
  160. package/dist/browser/Test/index.d.ts.map +1 -0
  161. package/dist/browser/Test/index.js +33 -0
  162. package/dist/browser/Test/index.js.map +1 -0
  163. package/dist/browser/Test/testBoundWitness.cjs +38 -0
  164. package/dist/browser/Test/testBoundWitness.cjs.map +1 -0
  165. package/dist/browser/Test/testBoundWitness.d.mts.map +1 -0
  166. package/dist/browser/Test/testBoundWitness.d.ts.map +1 -0
  167. package/dist/browser/Test/testBoundWitness.js +17 -0
  168. package/dist/browser/Test/testBoundWitness.js.map +1 -0
  169. package/dist/browser/Test/testPayload.cjs +39 -0
  170. package/dist/browser/Test/testPayload.cjs.map +1 -0
  171. package/dist/browser/Test/testPayload.d.mts.map +1 -0
  172. package/dist/browser/Test/testPayload.d.ts.map +1 -0
  173. package/dist/browser/Test/testPayload.js +18 -0
  174. package/dist/browser/Test/testPayload.js.map +1 -0
  175. package/dist/browser/WithArchive.cjs +19 -0
  176. package/dist/browser/WithArchive.cjs.map +1 -0
  177. package/dist/browser/WithArchive.d.mts.map +1 -0
  178. package/dist/browser/WithArchive.d.ts.map +1 -0
  179. package/dist/browser/WithArchive.js +1 -0
  180. package/dist/browser/WithArchive.js.map +1 -0
  181. package/dist/{index.js → browser/index.cjs} +1 -21
  182. package/dist/browser/index.cjs.map +1 -0
  183. package/dist/browser/index.d.mts.map +1 -0
  184. package/dist/browser/index.d.ts.map +1 -0
  185. package/dist/{index.mjs → browser/index.js} +1 -1
  186. package/dist/browser/index.js.map +1 -0
  187. package/dist/browser/models/ArchivePath.cjs +19 -0
  188. package/dist/browser/models/ArchivePath.cjs.map +1 -0
  189. package/dist/browser/models/ArchivePath.d.mts.map +1 -0
  190. package/dist/browser/models/ArchivePath.d.ts.map +1 -0
  191. package/dist/browser/models/ArchivePath.js +1 -0
  192. package/dist/browser/models/ArchivePath.js.map +1 -0
  193. package/dist/browser/models/index.cjs +19 -0
  194. package/dist/browser/models/index.cjs.map +1 -0
  195. package/dist/browser/models/index.d.mts.map +1 -0
  196. package/dist/browser/models/index.d.ts.map +1 -0
  197. package/dist/browser/models/index.js +1 -0
  198. package/dist/browser/models/index.js.map +1 -0
  199. package/dist/browser/objToQuery.cjs +31 -0
  200. package/dist/browser/objToQuery.cjs.map +1 -0
  201. package/dist/browser/objToQuery.d.mts.map +1 -0
  202. package/dist/browser/objToQuery.d.ts.map +1 -0
  203. package/dist/browser/objToQuery.js +10 -0
  204. package/dist/browser/objToQuery.js.map +1 -0
  205. package/dist/node/Api/Api.d.mts +12 -0
  206. package/dist/node/Api/Api.d.mts.map +1 -0
  207. package/dist/node/Api/Api.d.ts +12 -0
  208. package/dist/node/Api/Api.d.ts.map +1 -0
  209. package/dist/node/Api/Api.js +39 -0
  210. package/dist/node/Api/Api.js.map +1 -0
  211. package/dist/node/Api/Api.mjs +15 -0
  212. package/dist/node/Api/Api.mjs.map +1 -0
  213. package/dist/node/Api/index.d.mts +2 -0
  214. package/dist/node/Api/index.d.mts.map +1 -0
  215. package/dist/node/Api/index.d.ts +2 -0
  216. package/dist/node/Api/index.d.ts.map +1 -0
  217. package/dist/node/Api/index.js +23 -0
  218. package/dist/node/Api/index.js.map +1 -0
  219. package/dist/node/Api/index.mjs +2 -0
  220. package/dist/node/Api/index.mjs.map +1 -0
  221. package/dist/node/Base.d.mts +32 -0
  222. package/dist/node/Base.d.mts.map +1 -0
  223. package/dist/node/Base.d.ts +32 -0
  224. package/dist/node/Base.d.ts.map +1 -0
  225. package/dist/node/Base.js +125 -0
  226. package/dist/node/Base.js.map +1 -0
  227. package/dist/node/Base.mjs +101 -0
  228. package/dist/node/Base.mjs.map +1 -0
  229. package/dist/node/Diviner/LocationDiviner/LocationDivinerApi.d.mts +12 -0
  230. package/dist/node/Diviner/LocationDiviner/LocationDivinerApi.d.mts.map +1 -0
  231. package/dist/node/Diviner/LocationDiviner/LocationDivinerApi.d.ts +12 -0
  232. package/dist/node/Diviner/LocationDiviner/LocationDivinerApi.d.ts.map +1 -0
  233. package/dist/node/Diviner/LocationDiviner/LocationDivinerApi.js +47 -0
  234. package/dist/node/Diviner/LocationDiviner/LocationDivinerApi.js.map +1 -0
  235. package/dist/node/Diviner/LocationDiviner/LocationDivinerApi.mjs +23 -0
  236. package/dist/node/Diviner/LocationDiviner/LocationDivinerApi.mjs.map +1 -0
  237. package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts +10 -0
  238. package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts.map +1 -0
  239. package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts +10 -0
  240. package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts.map +1 -0
  241. package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.js +37 -0
  242. package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.js.map +1 -0
  243. package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.mjs +12 -0
  244. package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.mjs.map +1 -0
  245. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.mts +5 -0
  246. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.mts.map +1 -0
  247. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts +5 -0
  248. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts.map +1 -0
  249. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.js +17 -0
  250. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.js.map +1 -0
  251. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.mjs +1 -0
  252. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.mjs.map +1 -0
  253. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.mts +12 -0
  254. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.mts.map +1 -0
  255. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts +12 -0
  256. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts.map +1 -0
  257. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.js +37 -0
  258. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.js.map +1 -0
  259. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.mjs +11 -0
  260. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.mjs.map +1 -0
  261. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.mts +3 -0
  262. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.mts.map +1 -0
  263. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts +3 -0
  264. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts.map +1 -0
  265. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.js +25 -0
  266. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.js.map +1 -0
  267. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.mjs +3 -0
  268. package/dist/node/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.mjs.map +1 -0
  269. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.mts +12 -0
  270. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.mts.map +1 -0
  271. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts +12 -0
  272. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts.map +1 -0
  273. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.js +37 -0
  274. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.js.map +1 -0
  275. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.mjs +11 -0
  276. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.mjs.map +1 -0
  277. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.mts +2 -0
  278. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.mts.map +1 -0
  279. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts +2 -0
  280. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts.map +1 -0
  281. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.js +23 -0
  282. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.js.map +1 -0
  283. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.mjs +2 -0
  284. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.mjs.map +1 -0
  285. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.mts +18 -0
  286. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.mts.map +1 -0
  287. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +18 -0
  288. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +1 -0
  289. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.js +17 -0
  290. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.js.map +1 -0
  291. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.mjs +1 -0
  292. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.mjs.map +1 -0
  293. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.mts +5 -0
  294. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.mts.map +1 -0
  295. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts +5 -0
  296. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts.map +1 -0
  297. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.js +17 -0
  298. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.js.map +1 -0
  299. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.mjs +1 -0
  300. package/dist/node/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.mjs.map +1 -0
  301. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.mts +6 -0
  302. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.mts.map +1 -0
  303. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts +6 -0
  304. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts.map +1 -0
  305. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuerySchema.js +36 -0
  306. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuerySchema.js.map +1 -0
  307. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuerySchema.mjs +12 -0
  308. package/dist/node/Diviner/LocationDiviner/Queries/LocationQuerySchema.mjs.map +1 -0
  309. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.mts +8 -0
  310. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.mts.map +1 -0
  311. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts +8 -0
  312. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts.map +1 -0
  313. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.js +17 -0
  314. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.js.map +1 -0
  315. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.mjs +1 -0
  316. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.mjs.map +1 -0
  317. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.mts +12 -0
  318. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.mts.map +1 -0
  319. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts +12 -0
  320. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts.map +1 -0
  321. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.js +37 -0
  322. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.js.map +1 -0
  323. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.mjs +11 -0
  324. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.mjs.map +1 -0
  325. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.mts +3 -0
  326. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.mts.map +1 -0
  327. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts +3 -0
  328. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts.map +1 -0
  329. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.js +25 -0
  330. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.js.map +1 -0
  331. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.mjs +3 -0
  332. package/dist/node/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.mjs.map +1 -0
  333. package/dist/node/Diviner/LocationDiviner/Queries/index.d.mts +7 -0
  334. package/dist/node/Diviner/LocationDiviner/Queries/index.d.mts.map +1 -0
  335. package/dist/node/Diviner/LocationDiviner/Queries/index.d.ts +7 -0
  336. package/dist/node/Diviner/LocationDiviner/Queries/index.d.ts.map +1 -0
  337. package/dist/node/Diviner/LocationDiviner/Queries/index.js +33 -0
  338. package/dist/node/Diviner/LocationDiviner/Queries/index.js.map +1 -0
  339. package/dist/node/Diviner/LocationDiviner/Queries/index.mjs +7 -0
  340. package/dist/node/Diviner/LocationDiviner/Queries/index.mjs.map +1 -0
  341. package/dist/node/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.mts +13 -0
  342. package/dist/node/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.mts.map +1 -0
  343. package/dist/node/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts +13 -0
  344. package/dist/node/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts.map +1 -0
  345. package/dist/node/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.js +29 -0
  346. package/dist/node/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.js.map +1 -0
  347. package/dist/node/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.mjs +5 -0
  348. package/dist/node/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.mjs.map +1 -0
  349. package/dist/node/Diviner/LocationDiviner/Witnesses/LocationWitness.d.mts +21 -0
  350. package/dist/node/Diviner/LocationDiviner/Witnesses/LocationWitness.d.mts.map +1 -0
  351. package/dist/node/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts +21 -0
  352. package/dist/node/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts.map +1 -0
  353. package/dist/node/Diviner/LocationDiviner/Witnesses/LocationWitness.js +29 -0
  354. package/dist/node/Diviner/LocationDiviner/Witnesses/LocationWitness.js.map +1 -0
  355. package/dist/node/Diviner/LocationDiviner/Witnesses/LocationWitness.mjs +5 -0
  356. package/dist/node/Diviner/LocationDiviner/Witnesses/LocationWitness.mjs.map +1 -0
  357. package/dist/node/Diviner/LocationDiviner/Witnesses/index.d.mts +3 -0
  358. package/dist/node/Diviner/LocationDiviner/Witnesses/index.d.mts.map +1 -0
  359. package/dist/node/Diviner/LocationDiviner/Witnesses/index.d.ts +3 -0
  360. package/dist/node/Diviner/LocationDiviner/Witnesses/index.d.ts.map +1 -0
  361. package/dist/node/Diviner/LocationDiviner/Witnesses/index.js +25 -0
  362. package/dist/node/Diviner/LocationDiviner/Witnesses/index.js.map +1 -0
  363. package/dist/node/Diviner/LocationDiviner/Witnesses/index.mjs +3 -0
  364. package/dist/node/Diviner/LocationDiviner/Witnesses/index.mjs.map +1 -0
  365. package/dist/node/Diviner/LocationDiviner/index.d.mts +5 -0
  366. package/dist/node/Diviner/LocationDiviner/index.d.mts.map +1 -0
  367. package/dist/node/Diviner/LocationDiviner/index.d.ts +5 -0
  368. package/dist/node/Diviner/LocationDiviner/index.d.ts.map +1 -0
  369. package/dist/node/Diviner/LocationDiviner/index.js +29 -0
  370. package/dist/node/Diviner/LocationDiviner/index.js.map +1 -0
  371. package/dist/node/Diviner/LocationDiviner/index.mjs +5 -0
  372. package/dist/node/Diviner/LocationDiviner/index.mjs.map +1 -0
  373. package/dist/node/Diviner/LocationDiviner/models.d.mts +5 -0
  374. package/dist/node/Diviner/LocationDiviner/models.d.mts.map +1 -0
  375. package/dist/node/Diviner/LocationDiviner/models.d.ts +5 -0
  376. package/dist/node/Diviner/LocationDiviner/models.d.ts.map +1 -0
  377. package/dist/node/Diviner/LocationDiviner/models.js +17 -0
  378. package/dist/node/Diviner/LocationDiviner/models.js.map +1 -0
  379. package/dist/node/Diviner/LocationDiviner/models.mjs +1 -0
  380. package/dist/node/Diviner/LocationDiviner/models.mjs.map +1 -0
  381. package/dist/node/Diviner/RemoteDivinerConfig.d.mts +11 -0
  382. package/dist/node/Diviner/RemoteDivinerConfig.d.mts.map +1 -0
  383. package/dist/node/Diviner/RemoteDivinerConfig.d.ts +11 -0
  384. package/dist/node/Diviner/RemoteDivinerConfig.d.ts.map +1 -0
  385. package/dist/node/Diviner/RemoteDivinerConfig.js +29 -0
  386. package/dist/node/Diviner/RemoteDivinerConfig.js.map +1 -0
  387. package/dist/node/Diviner/RemoteDivinerConfig.mjs +5 -0
  388. package/dist/node/Diviner/RemoteDivinerConfig.mjs.map +1 -0
  389. package/dist/node/Diviner/RemoteDivinerError.d.mts +6 -0
  390. package/dist/node/Diviner/RemoteDivinerError.d.mts.map +1 -0
  391. package/dist/node/Diviner/RemoteDivinerError.d.ts +6 -0
  392. package/dist/node/Diviner/RemoteDivinerError.d.ts.map +1 -0
  393. package/dist/node/Diviner/RemoteDivinerError.js +37 -0
  394. package/dist/node/Diviner/RemoteDivinerError.js.map +1 -0
  395. package/dist/node/Diviner/RemoteDivinerError.mjs +13 -0
  396. package/dist/node/Diviner/RemoteDivinerError.mjs.map +1 -0
  397. package/dist/node/Diviner/index.d.mts +3 -0
  398. package/dist/node/Diviner/index.d.mts.map +1 -0
  399. package/dist/node/Diviner/index.d.ts +3 -0
  400. package/dist/node/Diviner/index.d.ts.map +1 -0
  401. package/dist/node/Diviner/index.js +25 -0
  402. package/dist/node/Diviner/index.js.map +1 -0
  403. package/dist/node/Diviner/index.mjs +3 -0
  404. package/dist/node/Diviner/index.mjs.map +1 -0
  405. package/dist/node/Simple.d.mts +22 -0
  406. package/dist/node/Simple.d.mts.map +1 -0
  407. package/dist/node/Simple.d.ts +22 -0
  408. package/dist/node/Simple.d.ts.map +1 -0
  409. package/dist/node/Simple.js +72 -0
  410. package/dist/node/Simple.js.map +1 -0
  411. package/dist/node/Simple.mjs +48 -0
  412. package/dist/node/Simple.mjs.map +1 -0
  413. package/dist/node/Test/index.d.mts +3 -0
  414. package/dist/node/Test/index.d.mts.map +1 -0
  415. package/dist/node/Test/index.d.ts +3 -0
  416. package/dist/node/Test/index.d.ts.map +1 -0
  417. package/dist/node/Test/index.js +25 -0
  418. package/dist/node/Test/index.js.map +1 -0
  419. package/dist/node/Test/index.mjs +3 -0
  420. package/dist/node/Test/index.mjs.map +1 -0
  421. package/dist/node/Test/testBoundWitness.d.mts +4 -0
  422. package/dist/node/Test/testBoundWitness.d.mts.map +1 -0
  423. package/dist/node/Test/testBoundWitness.d.ts +4 -0
  424. package/dist/node/Test/testBoundWitness.d.ts.map +1 -0
  425. package/dist/node/Test/testBoundWitness.js +40 -0
  426. package/dist/node/Test/testBoundWitness.js.map +1 -0
  427. package/dist/node/Test/testBoundWitness.mjs +16 -0
  428. package/dist/node/Test/testBoundWitness.mjs.map +1 -0
  429. package/dist/node/Test/testPayload.d.mts +6 -0
  430. package/dist/node/Test/testPayload.d.mts.map +1 -0
  431. package/dist/node/Test/testPayload.d.ts +6 -0
  432. package/dist/node/Test/testPayload.d.ts.map +1 -0
  433. package/dist/node/Test/testPayload.js +42 -0
  434. package/dist/node/Test/testPayload.js.map +1 -0
  435. package/dist/node/Test/testPayload.mjs +17 -0
  436. package/dist/node/Test/testPayload.mjs.map +1 -0
  437. package/dist/node/WithArchive.d.mts +4 -0
  438. package/dist/node/WithArchive.d.mts.map +1 -0
  439. package/dist/node/WithArchive.d.ts +4 -0
  440. package/dist/node/WithArchive.d.ts.map +1 -0
  441. package/dist/node/WithArchive.js +17 -0
  442. package/dist/node/WithArchive.js.map +1 -0
  443. package/dist/node/WithArchive.mjs +1 -0
  444. package/dist/node/WithArchive.mjs.map +1 -0
  445. package/dist/node/index.d.mts +7 -0
  446. package/dist/node/index.d.mts.map +1 -0
  447. package/dist/node/index.d.ts +7 -0
  448. package/dist/node/index.d.ts.map +1 -0
  449. package/dist/node/index.js +33 -0
  450. package/dist/node/index.js.map +1 -0
  451. package/dist/node/index.mjs +7 -0
  452. package/dist/node/index.mjs.map +1 -0
  453. package/dist/node/models/ArchivePath.d.mts +4 -0
  454. package/dist/node/models/ArchivePath.d.mts.map +1 -0
  455. package/dist/node/models/ArchivePath.d.ts +4 -0
  456. package/dist/node/models/ArchivePath.d.ts.map +1 -0
  457. package/dist/node/models/ArchivePath.js +17 -0
  458. package/dist/node/models/ArchivePath.js.map +1 -0
  459. package/dist/node/models/ArchivePath.mjs +1 -0
  460. package/dist/node/models/ArchivePath.mjs.map +1 -0
  461. package/dist/node/models/index.d.mts +2 -0
  462. package/dist/node/models/index.d.mts.map +1 -0
  463. package/dist/node/models/index.d.ts +2 -0
  464. package/dist/node/models/index.d.ts.map +1 -0
  465. package/dist/node/models/index.js +23 -0
  466. package/dist/node/models/index.js.map +1 -0
  467. package/dist/node/models/index.mjs +2 -0
  468. package/dist/node/models/index.mjs.map +1 -0
  469. package/dist/node/objToQuery.d.mts +2 -0
  470. package/dist/node/objToQuery.d.mts.map +1 -0
  471. package/dist/node/objToQuery.d.ts +2 -0
  472. package/dist/node/objToQuery.d.ts.map +1 -0
  473. package/dist/node/objToQuery.js +33 -0
  474. package/dist/node/objToQuery.js.map +1 -0
  475. package/dist/node/objToQuery.mjs +9 -0
  476. package/dist/node/objToQuery.mjs.map +1 -0
  477. package/package.json +32 -29
  478. package/dist/Api/Api.d.mts.map +0 -1
  479. package/dist/Api/Api.d.ts.map +0 -1
  480. package/dist/Api/index.d.mts.map +0 -1
  481. package/dist/Api/index.d.ts.map +0 -1
  482. package/dist/Base.d.mts.map +0 -1
  483. package/dist/Base.d.ts.map +0 -1
  484. package/dist/Diviner/LocationDiviner/LocationDivinerApi.d.mts.map +0 -1
  485. package/dist/Diviner/LocationDiviner/LocationDivinerApi.d.ts.map +0 -1
  486. package/dist/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts.map +0 -1
  487. package/dist/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts.map +0 -1
  488. package/dist/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.mts.map +0 -1
  489. package/dist/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts.map +0 -1
  490. package/dist/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.mts.map +0 -1
  491. package/dist/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts.map +0 -1
  492. package/dist/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.mts.map +0 -1
  493. package/dist/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts.map +0 -1
  494. package/dist/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.mts.map +0 -1
  495. package/dist/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts.map +0 -1
  496. package/dist/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.mts.map +0 -1
  497. package/dist/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts.map +0 -1
  498. package/dist/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.mts.map +0 -1
  499. package/dist/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +0 -1
  500. package/dist/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.mts.map +0 -1
  501. package/dist/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts.map +0 -1
  502. package/dist/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.mts.map +0 -1
  503. package/dist/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts.map +0 -1
  504. package/dist/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.mts.map +0 -1
  505. package/dist/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts.map +0 -1
  506. package/dist/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.mts.map +0 -1
  507. package/dist/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts.map +0 -1
  508. package/dist/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.mts.map +0 -1
  509. package/dist/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts.map +0 -1
  510. package/dist/Diviner/LocationDiviner/Queries/index.d.mts.map +0 -1
  511. package/dist/Diviner/LocationDiviner/Queries/index.d.ts.map +0 -1
  512. package/dist/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.mts.map +0 -1
  513. package/dist/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts.map +0 -1
  514. package/dist/Diviner/LocationDiviner/Witnesses/LocationWitness.d.mts.map +0 -1
  515. package/dist/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts.map +0 -1
  516. package/dist/Diviner/LocationDiviner/Witnesses/index.d.mts.map +0 -1
  517. package/dist/Diviner/LocationDiviner/Witnesses/index.d.ts.map +0 -1
  518. package/dist/Diviner/LocationDiviner/index.d.mts.map +0 -1
  519. package/dist/Diviner/LocationDiviner/index.d.ts.map +0 -1
  520. package/dist/Diviner/LocationDiviner/models.d.mts.map +0 -1
  521. package/dist/Diviner/LocationDiviner/models.d.ts.map +0 -1
  522. package/dist/Diviner/RemoteDivinerConfig.d.mts.map +0 -1
  523. package/dist/Diviner/RemoteDivinerConfig.d.ts.map +0 -1
  524. package/dist/Diviner/RemoteDivinerError.d.mts.map +0 -1
  525. package/dist/Diviner/RemoteDivinerError.d.ts.map +0 -1
  526. package/dist/Diviner/index.d.mts.map +0 -1
  527. package/dist/Diviner/index.d.ts.map +0 -1
  528. package/dist/Simple.d.mts.map +0 -1
  529. package/dist/Simple.d.ts.map +0 -1
  530. package/dist/Test/index.d.mts.map +0 -1
  531. package/dist/Test/index.d.ts.map +0 -1
  532. package/dist/Test/testBoundWitness.d.mts.map +0 -1
  533. package/dist/Test/testBoundWitness.d.ts.map +0 -1
  534. package/dist/Test/testPayload.d.mts.map +0 -1
  535. package/dist/Test/testPayload.d.ts.map +0 -1
  536. package/dist/WithArchive.d.mts.map +0 -1
  537. package/dist/WithArchive.d.ts.map +0 -1
  538. package/dist/docs.json +0 -16171
  539. package/dist/index.d.mts.map +0 -1
  540. package/dist/index.d.ts.map +0 -1
  541. package/dist/index.js.map +0 -1
  542. package/dist/index.mjs.map +0 -1
  543. package/dist/models/ArchivePath.d.mts.map +0 -1
  544. package/dist/models/ArchivePath.d.ts.map +0 -1
  545. package/dist/models/index.d.mts.map +0 -1
  546. package/dist/models/index.d.ts.map +0 -1
  547. package/dist/objToQuery.d.mts.map +0 -1
  548. package/dist/objToQuery.d.ts.map +0 -1
  549. /package/dist/{Api → browser/Api}/Api.d.mts +0 -0
  550. /package/dist/{Api → browser/Api}/Api.d.ts +0 -0
  551. /package/dist/{Api → browser/Api}/index.d.mts +0 -0
  552. /package/dist/{Api → browser/Api}/index.d.ts +0 -0
  553. /package/dist/{Base.d.mts → browser/Base.d.mts} +0 -0
  554. /package/dist/{Base.d.ts → browser/Base.d.ts} +0 -0
  555. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/LocationDivinerApi.d.mts +0 -0
  556. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/LocationDivinerApi.d.ts +0 -0
  557. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts +0 -0
  558. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts +0 -0
  559. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.mts +0 -0
  560. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts +0 -0
  561. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.mts +0 -0
  562. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts +0 -0
  563. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationHeatmapQuery/index.d.mts +0 -0
  564. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts +0 -0
  565. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.mts +0 -0
  566. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts +0 -0
  567. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.mts +0 -0
  568. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts +0 -0
  569. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQueryCreationRequest.d.mts +0 -0
  570. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +0 -0
  571. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQueryCreationResponse.d.mts +0 -0
  572. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts +0 -0
  573. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQuerySchema.d.mts +0 -0
  574. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationQuerySchema.d.ts +0 -0
  575. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.mts +0 -0
  576. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts +0 -0
  577. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.mts +0 -0
  578. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts +0 -0
  579. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.mts +0 -0
  580. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts +0 -0
  581. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/index.d.mts +0 -0
  582. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Queries/index.d.ts +0 -0
  583. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Witnesses/CurrentLocationWitness.d.mts +0 -0
  584. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts +0 -0
  585. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Witnesses/LocationWitness.d.mts +0 -0
  586. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Witnesses/LocationWitness.d.ts +0 -0
  587. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Witnesses/index.d.mts +0 -0
  588. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/Witnesses/index.d.ts +0 -0
  589. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/index.d.mts +0 -0
  590. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/index.d.ts +0 -0
  591. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/models.d.mts +0 -0
  592. /package/dist/{Diviner → browser/Diviner}/LocationDiviner/models.d.ts +0 -0
  593. /package/dist/{Diviner → browser/Diviner}/RemoteDivinerConfig.d.mts +0 -0
  594. /package/dist/{Diviner → browser/Diviner}/RemoteDivinerConfig.d.ts +0 -0
  595. /package/dist/{Diviner → browser/Diviner}/RemoteDivinerError.d.mts +0 -0
  596. /package/dist/{Diviner → browser/Diviner}/RemoteDivinerError.d.ts +0 -0
  597. /package/dist/{Diviner → browser/Diviner}/index.d.mts +0 -0
  598. /package/dist/{Diviner → browser/Diviner}/index.d.ts +0 -0
  599. /package/dist/{Simple.d.mts → browser/Simple.d.mts} +0 -0
  600. /package/dist/{Simple.d.ts → browser/Simple.d.ts} +0 -0
  601. /package/dist/{Test → browser/Test}/index.d.mts +0 -0
  602. /package/dist/{Test → browser/Test}/index.d.ts +0 -0
  603. /package/dist/{Test → browser/Test}/testBoundWitness.d.mts +0 -0
  604. /package/dist/{Test → browser/Test}/testBoundWitness.d.ts +0 -0
  605. /package/dist/{Test → browser/Test}/testPayload.d.mts +0 -0
  606. /package/dist/{Test → browser/Test}/testPayload.d.ts +0 -0
  607. /package/dist/{WithArchive.d.mts → browser/WithArchive.d.mts} +0 -0
  608. /package/dist/{WithArchive.d.ts → browser/WithArchive.d.ts} +0 -0
  609. /package/dist/{index.d.mts → browser/index.d.mts} +0 -0
  610. /package/dist/{index.d.ts → browser/index.d.ts} +0 -0
  611. /package/dist/{models → browser/models}/ArchivePath.d.mts +0 -0
  612. /package/dist/{models → browser/models}/ArchivePath.d.ts +0 -0
  613. /package/dist/{models → browser/models}/index.d.mts +0 -0
  614. /package/dist/{models → browser/models}/index.d.ts +0 -0
  615. /package/dist/{objToQuery.d.mts → browser/objToQuery.d.mts} +0 -0
  616. /package/dist/{objToQuery.d.ts → browser/objToQuery.d.ts} +0 -0
@@ -0,0 +1,188 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/Api/Api.ts
21
+ var Api_exports = {};
22
+ __export(Api_exports, {
23
+ ArchivistApi: () => ArchivistApi
24
+ });
25
+ module.exports = __toCommonJS(Api_exports);
26
+ var import_huri = require("@xyo-network/huri");
27
+
28
+ // src/Base.ts
29
+ var import_axios = require("@xyo-network/axios");
30
+ var ApiBase = class _ApiBase {
31
+ config;
32
+ axios;
33
+ constructor(config) {
34
+ this.config = config;
35
+ this.axios = new import_axios.AxiosJson({ ...this.config, headers: this.headers });
36
+ }
37
+ get authenticated() {
38
+ return !!this.config.apiKey || !!this.config.jwtToken;
39
+ }
40
+ get headers() {
41
+ const headers = {};
42
+ if (this.config.jwtToken) {
43
+ headers.Authorization = `Bearer ${this.config.jwtToken}`;
44
+ }
45
+ if (this.config.apiKey) {
46
+ headers["x-api-key"] = this.config.apiKey;
47
+ }
48
+ return headers;
49
+ }
50
+ get query() {
51
+ return this.config.query ?? "";
52
+ }
53
+ get root() {
54
+ return this.config.root ?? "/";
55
+ }
56
+ static resolveResponse(result) {
57
+ return [result?.data?.data, result?.data, result];
58
+ }
59
+ static shapeResponse(response, responseType) {
60
+ const resolvedResponse = _ApiBase.resolveResponse(response);
61
+ return responseType === "tuple" ? resolvedResponse : resolvedResponse[0];
62
+ }
63
+ onError(error, depth = 0) {
64
+ this.config.reportableParent?.onError?.(error, depth + 1);
65
+ this.config.onError?.(error, depth);
66
+ }
67
+ onFailure(response, depth = 0) {
68
+ this.config.reportableParent?.onFailure?.(response, depth + 1);
69
+ this.config.onFailure?.(response, depth);
70
+ }
71
+ onSuccess(response, depth = 0) {
72
+ this.config.reportableParent?.onSuccess?.(response, depth + 1);
73
+ this.config.onSuccess?.(response, depth);
74
+ }
75
+ async deleteEndpoint(endPoint = "", responseType) {
76
+ const response = await this.monitorResponse(async () => {
77
+ return await this.axios.delete(`${this.resolveRoot()}${endPoint}${this.query}`);
78
+ });
79
+ return _ApiBase.shapeResponse(response, responseType);
80
+ }
81
+ async getEndpoint(endPoint = "", responseType) {
82
+ const response = await this.monitorResponse(async () => {
83
+ return await this.axios.get(`${this.resolveRoot()}${endPoint}${this.query}`);
84
+ });
85
+ return _ApiBase.shapeResponse(response, responseType);
86
+ }
87
+ handleMonitorResponseError(error, trapAxiosException) {
88
+ if (!error.isError) {
89
+ throw error;
90
+ }
91
+ if (trapAxiosException) {
92
+ error.response ? this.onFailure(error.response) : this.onError(error);
93
+ if (this.config.throwFailure) {
94
+ throw error;
95
+ }
96
+ return error.response;
97
+ }
98
+ }
99
+ async monitorResponse(closure) {
100
+ let trapAxiosException = true;
101
+ try {
102
+ const response = await closure();
103
+ trapAxiosException = false;
104
+ response.status < 300 ? this.onSuccess(response) : this.onFailure(response);
105
+ return response;
106
+ } catch (ex) {
107
+ this.handleMonitorResponseError(ex, trapAxiosException);
108
+ }
109
+ }
110
+ async postEndpoint(endPoint = "", data, responseType) {
111
+ const response = await this.monitorResponse(async () => {
112
+ return await this.axios.post(`${this.resolveRoot()}${endPoint}${this.query}`, data);
113
+ });
114
+ return _ApiBase.shapeResponse(response, responseType);
115
+ }
116
+ async putEndpoint(endPoint = "", data, responseType) {
117
+ const response = await this.monitorResponse(async () => {
118
+ return await this.axios.put(`${this.resolveRoot()}${endPoint}${this.query}`, data);
119
+ });
120
+ return _ApiBase.shapeResponse(response, responseType);
121
+ }
122
+ resolveRoot() {
123
+ return `${this.config.apiDomain}${this.root}`;
124
+ }
125
+ };
126
+
127
+ // src/objToQuery.ts
128
+ var objToQuery = (obj) => {
129
+ return `?${Object.entries(obj).map(([key, value]) => {
130
+ return `${key}=${value}`;
131
+ }).filter((value) => value !== void 0).join("&")}`;
132
+ };
133
+
134
+ // src/Simple.ts
135
+ var ApiSimple = class extends ApiBase {
136
+ async delete(responseType) {
137
+ switch (responseType) {
138
+ case "tuple":
139
+ return await this.deleteEndpoint(void 0, "tuple");
140
+ default:
141
+ return await this.deleteEndpoint(void 0);
142
+ }
143
+ }
144
+ async find(query = {}, responseType) {
145
+ switch (responseType) {
146
+ case "tuple":
147
+ return await this.getEndpoint(objToQuery(query), "tuple");
148
+ default:
149
+ return await this.getEndpoint(objToQuery(query));
150
+ }
151
+ }
152
+ async get(responseType) {
153
+ switch (responseType) {
154
+ case "tuple":
155
+ return await this.getEndpoint(void 0, "tuple");
156
+ default:
157
+ return await this.getEndpoint(void 0);
158
+ }
159
+ }
160
+ async post(data, responseType) {
161
+ switch (responseType) {
162
+ case "tuple":
163
+ return await this.postEndpoint(void 0, data, "tuple");
164
+ default:
165
+ return await this.postEndpoint(void 0, data);
166
+ }
167
+ }
168
+ async put(data, responseType) {
169
+ switch (responseType) {
170
+ case "tuple":
171
+ return await this.putEndpoint(void 0, data, "tuple");
172
+ default:
173
+ return await this.putEndpoint(void 0, data);
174
+ }
175
+ }
176
+ };
177
+
178
+ // src/Api/Api.ts
179
+ var ArchivistApi = class extends ApiSimple {
180
+ huri(huri) {
181
+ const huriObj = typeof huri === "string" ? new import_huri.Huri(huri) : huri;
182
+ return new ApiSimple({
183
+ ...this.config,
184
+ root: `${this.root}${huriObj.href}/`
185
+ });
186
+ }
187
+ };
188
+ //# sourceMappingURL=Api.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/Api/Api.ts","../../../src/Base.ts","../../../src/objToQuery.ts","../../../src/Simple.ts"],"sourcesContent":["import { ApiConfig } from '@xyo-network/api-models'\nimport { Huri } from '@xyo-network/huri'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ApiSimple } from '../Simple'\n\nexport class ArchivistApi<C extends ApiConfig = ApiConfig> extends ApiSimple<Payload[], C> {\n huri(huri: Huri | string) {\n const huriObj = typeof huri === 'string' ? new Huri(huri) : huri\n return new ApiSimple<Payload>({\n ...this.config,\n root: `${this.root}${huriObj.href}/`,\n })\n }\n}\n","import {\n ApiConfig,\n ApiEnvelope,\n ApiError,\n ApiReportable,\n ApiResponse,\n ApiResponseBody,\n ApiResponseTuple,\n ApiResponseTupleOrBody,\n ApiResponseType,\n} from '@xyo-network/api-models'\nimport { AxiosJson } from '@xyo-network/axios'\n\nexport class ApiBase<C extends ApiConfig = ApiConfig> implements ApiReportable {\n readonly config: C\n protected axios: AxiosJson\n\n constructor(config: C) {\n this.config = config\n this.axios = new AxiosJson({ ...this.config, headers: this.headers })\n }\n\n get authenticated() {\n return !!this.config.apiKey || !!this.config.jwtToken\n }\n\n protected get headers(): Record<string, string> {\n const headers: Record<string, string> = {}\n if (this.config.jwtToken) {\n headers.Authorization = `Bearer ${this.config.jwtToken}`\n }\n if (this.config.apiKey) {\n headers['x-api-key'] = this.config.apiKey\n }\n return headers\n }\n\n protected get query() {\n return this.config.query ?? ''\n }\n\n protected get root() {\n return this.config.root ?? '/'\n }\n\n private static resolveResponse<T>(result?: ApiResponse<ApiEnvelope<T>>) {\n return [result?.data?.data, result?.data, result] as ApiResponseTuple<T>\n }\n\n private static shapeResponse<T = unknown>(response: ApiResponse<ApiEnvelope<T>> | undefined, responseType?: ApiResponseType) {\n const resolvedResponse = ApiBase.resolveResponse(response)\n return responseType === 'tuple' ? resolvedResponse : resolvedResponse[0]\n }\n\n onError(error: ApiError, depth = 0) {\n this.config.reportableParent?.onError?.(error, depth + 1)\n this.config.onError?.(error, depth)\n }\n\n onFailure(response: ApiResponse, depth = 0) {\n this.config.reportableParent?.onFailure?.(response, depth + 1)\n this.config.onFailure?.(response, depth)\n }\n\n onSuccess(response: ApiResponse, depth = 0) {\n this.config.reportableParent?.onSuccess?.(response, depth + 1)\n this.config.onSuccess?.(response, depth)\n }\n\n protected async deleteEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>\n protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async deleteEndpoint<T = unknown>(endPoint = '', responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.delete<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected async getEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>\n protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async getEndpoint<T = unknown>(endPoint = '', responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.get<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected handleMonitorResponseError<T>(error: ApiError, trapAxiosException: boolean) {\n if (!error.isError) {\n throw error\n }\n\n if (trapAxiosException) {\n error.response ? this.onFailure(error.response) : this.onError(error)\n if (this.config.throwFailure) {\n throw error\n }\n return error.response as ApiResponse<ApiEnvelope<T>>\n }\n }\n\n protected async monitorResponse<T>(closure: () => Promise<ApiResponse<ApiEnvelope<T>>>) {\n //we use this to prevent accidental catching on exceptions in callbacks\n let trapAxiosException = true\n try {\n const response = await closure()\n trapAxiosException = false\n\n response.status < 300 ? this.onSuccess(response) : this.onFailure(response)\n\n return response\n } catch (ex) {\n this.handleMonitorResponseError(ex as ApiError, trapAxiosException)\n }\n }\n\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async postEndpoint<T = unknown, D = unknown>(\n endPoint = '',\n data?: D,\n responseType?: ApiResponseType,\n ): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.post<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>, D>, D>(`${this.resolveRoot()}${endPoint}${this.query}`, data)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint = '', data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.put<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>, D>, D>(`${this.resolveRoot()}${endPoint}${this.query}`, data)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n private resolveRoot() {\n return `${this.config.apiDomain}${this.root}`\n }\n}\n","export const objToQuery = (obj: Record<string, string | number | undefined>) => {\n return `?${Object.entries(obj)\n .map(([key, value]) => {\n return `${key}=${value}`\n })\n .filter((value) => value !== undefined)\n .join('&')}`\n}\n","import { ApiConfig, ApiResponseBody, ApiResponseTuple, ApiResponseTupleOrBody, ApiResponseType } from '@xyo-network/api-models'\nimport { Payload, PayloadFindFilter } from '@xyo-network/payload-model'\n\nimport { ApiBase } from './Base'\nimport { objToQuery } from './objToQuery'\n\nexport type ApiSimpleQuery = PayloadFindFilter\n\nexport class ApiSimple<T = Payload, D = T, Q extends ApiSimpleQuery = ApiSimpleQuery, C extends ApiConfig = ApiConfig> extends ApiBase<C> {\n async delete(): Promise<ApiResponseBody<T>>\n async delete(responseType?: 'body'): Promise<ApiResponseBody<T>>\n async delete(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async delete(responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.deleteEndpoint(undefined, 'tuple')\n default:\n return await this.deleteEndpoint(undefined)\n }\n }\n\n async find(query?: Q): Promise<ApiResponseBody<T>>\n async find(query?: Q, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async find(query?: Q, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async find(query = {}, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.getEndpoint(objToQuery(query), 'tuple')\n default:\n return await this.getEndpoint(objToQuery(query))\n }\n }\n\n async get(): Promise<ApiResponseBody<T>>\n async get(responseType?: 'body'): Promise<ApiResponseBody<T>>\n async get(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async get(responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.getEndpoint(undefined, 'tuple')\n default:\n return await this.getEndpoint(undefined)\n }\n }\n\n async post(data?: D): Promise<ApiResponseBody<T>>\n async post(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async post(data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async post(data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.postEndpoint(undefined, data, 'tuple')\n default:\n return await this.postEndpoint(undefined, data)\n }\n }\n\n async put(data?: D): Promise<ApiResponseBody<T>>\n async put(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async put(data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async put(data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.putEndpoint(undefined, data, 'tuple')\n default:\n return await this.putEndpoint(undefined, data)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqB;;;ACUrB,mBAA0B;AAEnB,IAAM,UAAN,MAAM,SAAkE;AAAA,EACpE;AAAA,EACC;AAAA,EAEV,YAAY,QAAW;AACrB,SAAK,SAAS;AACd,SAAK,QAAQ,IAAI,uBAAU,EAAE,GAAG,KAAK,QAAQ,SAAS,KAAK,QAAQ,CAAC;AAAA,EACtE;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,CAAC,CAAC,KAAK,OAAO,UAAU,CAAC,CAAC,KAAK,OAAO;AAAA,EAC/C;AAAA,EAEA,IAAc,UAAkC;AAC9C,UAAM,UAAkC,CAAC;AACzC,QAAI,KAAK,OAAO,UAAU;AACxB,cAAQ,gBAAgB,UAAU,KA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IAAI,MAAU,cAAoE;AACtF,YAAQ,cAAc;AAAA,MACpB,KAAK;AACH,eAAO,MAAM,KAAK,YAAY,QAAW,MAAM,OAAO;AAAA,MACxD;AACE,eAAO,MAAM,KAAK,YAAY,QAAW,IAAI;AAAA,IACjD;AAAA,EACF;AACF;;;AH9DO,IAAM,eAAN,cAA4D,UAAwB;AAAA,EACzF,KAAK,MAAqB;AACxB,UAAM,UAAU,OAAO,SAAS,WAAW,IAAI,iBAAK,IAAI,IAAI;AAC5D,WAAO,IAAI,UAAmB;AAAA,MAC5B,GAAG,KAAK;AAAA,MACR,MAAM,GAAG,KAAK,IAAI,GAAG,QAAQ,IAAI;AAAA,IACnC,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../src/Api/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,qBAAa,YAAY,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACxF,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;;;;;CAOzB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Api.d.ts","sourceRoot":"","sources":["../../../src/Api/Api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAErC,qBAAa,YAAY,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,SAAQ,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACxF,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM;;;;;CAOzB"}
@@ -0,0 +1,167 @@
1
+ // src/Api/Api.ts
2
+ import { Huri } from "@xyo-network/huri";
3
+
4
+ // src/Base.ts
5
+ import { AxiosJson } from "@xyo-network/axios";
6
+ var ApiBase = class _ApiBase {
7
+ config;
8
+ axios;
9
+ constructor(config) {
10
+ this.config = config;
11
+ this.axios = new AxiosJson({ ...this.config, headers: this.headers });
12
+ }
13
+ get authenticated() {
14
+ return !!this.config.apiKey || !!this.config.jwtToken;
15
+ }
16
+ get headers() {
17
+ const headers = {};
18
+ if (this.config.jwtToken) {
19
+ headers.Authorization = `Bearer ${this.config.jwtToken}`;
20
+ }
21
+ if (this.config.apiKey) {
22
+ headers["x-api-key"] = this.config.apiKey;
23
+ }
24
+ return headers;
25
+ }
26
+ get query() {
27
+ return this.config.query ?? "";
28
+ }
29
+ get root() {
30
+ return this.config.root ?? "/";
31
+ }
32
+ static resolveResponse(result) {
33
+ return [result?.data?.data, result?.data, result];
34
+ }
35
+ static shapeResponse(response, responseType) {
36
+ const resolvedResponse = _ApiBase.resolveResponse(response);
37
+ return responseType === "tuple" ? resolvedResponse : resolvedResponse[0];
38
+ }
39
+ onError(error, depth = 0) {
40
+ this.config.reportableParent?.onError?.(error, depth + 1);
41
+ this.config.onError?.(error, depth);
42
+ }
43
+ onFailure(response, depth = 0) {
44
+ this.config.reportableParent?.onFailure?.(response, depth + 1);
45
+ this.config.onFailure?.(response, depth);
46
+ }
47
+ onSuccess(response, depth = 0) {
48
+ this.config.reportableParent?.onSuccess?.(response, depth + 1);
49
+ this.config.onSuccess?.(response, depth);
50
+ }
51
+ async deleteEndpoint(endPoint = "", responseType) {
52
+ const response = await this.monitorResponse(async () => {
53
+ return await this.axios.delete(`${this.resolveRoot()}${endPoint}${this.query}`);
54
+ });
55
+ return _ApiBase.shapeResponse(response, responseType);
56
+ }
57
+ async getEndpoint(endPoint = "", responseType) {
58
+ const response = await this.monitorResponse(async () => {
59
+ return await this.axios.get(`${this.resolveRoot()}${endPoint}${this.query}`);
60
+ });
61
+ return _ApiBase.shapeResponse(response, responseType);
62
+ }
63
+ handleMonitorResponseError(error, trapAxiosException) {
64
+ if (!error.isError) {
65
+ throw error;
66
+ }
67
+ if (trapAxiosException) {
68
+ error.response ? this.onFailure(error.response) : this.onError(error);
69
+ if (this.config.throwFailure) {
70
+ throw error;
71
+ }
72
+ return error.response;
73
+ }
74
+ }
75
+ async monitorResponse(closure) {
76
+ let trapAxiosException = true;
77
+ try {
78
+ const response = await closure();
79
+ trapAxiosException = false;
80
+ response.status < 300 ? this.onSuccess(response) : this.onFailure(response);
81
+ return response;
82
+ } catch (ex) {
83
+ this.handleMonitorResponseError(ex, trapAxiosException);
84
+ }
85
+ }
86
+ async postEndpoint(endPoint = "", data, responseType) {
87
+ const response = await this.monitorResponse(async () => {
88
+ return await this.axios.post(`${this.resolveRoot()}${endPoint}${this.query}`, data);
89
+ });
90
+ return _ApiBase.shapeResponse(response, responseType);
91
+ }
92
+ async putEndpoint(endPoint = "", data, responseType) {
93
+ const response = await this.monitorResponse(async () => {
94
+ return await this.axios.put(`${this.resolveRoot()}${endPoint}${this.query}`, data);
95
+ });
96
+ return _ApiBase.shapeResponse(response, responseType);
97
+ }
98
+ resolveRoot() {
99
+ return `${this.config.apiDomain}${this.root}`;
100
+ }
101
+ };
102
+
103
+ // src/objToQuery.ts
104
+ var objToQuery = (obj) => {
105
+ return `?${Object.entries(obj).map(([key, value]) => {
106
+ return `${key}=${value}`;
107
+ }).filter((value) => value !== void 0).join("&")}`;
108
+ };
109
+
110
+ // src/Simple.ts
111
+ var ApiSimple = class extends ApiBase {
112
+ async delete(responseType) {
113
+ switch (responseType) {
114
+ case "tuple":
115
+ return await this.deleteEndpoint(void 0, "tuple");
116
+ default:
117
+ return await this.deleteEndpoint(void 0);
118
+ }
119
+ }
120
+ async find(query = {}, responseType) {
121
+ switch (responseType) {
122
+ case "tuple":
123
+ return await this.getEndpoint(objToQuery(query), "tuple");
124
+ default:
125
+ return await this.getEndpoint(objToQuery(query));
126
+ }
127
+ }
128
+ async get(responseType) {
129
+ switch (responseType) {
130
+ case "tuple":
131
+ return await this.getEndpoint(void 0, "tuple");
132
+ default:
133
+ return await this.getEndpoint(void 0);
134
+ }
135
+ }
136
+ async post(data, responseType) {
137
+ switch (responseType) {
138
+ case "tuple":
139
+ return await this.postEndpoint(void 0, data, "tuple");
140
+ default:
141
+ return await this.postEndpoint(void 0, data);
142
+ }
143
+ }
144
+ async put(data, responseType) {
145
+ switch (responseType) {
146
+ case "tuple":
147
+ return await this.putEndpoint(void 0, data, "tuple");
148
+ default:
149
+ return await this.putEndpoint(void 0, data);
150
+ }
151
+ }
152
+ };
153
+
154
+ // src/Api/Api.ts
155
+ var ArchivistApi = class extends ApiSimple {
156
+ huri(huri) {
157
+ const huriObj = typeof huri === "string" ? new Huri(huri) : huri;
158
+ return new ApiSimple({
159
+ ...this.config,
160
+ root: `${this.root}${huriObj.href}/`
161
+ });
162
+ }
163
+ };
164
+ export {
165
+ ArchivistApi
166
+ };
167
+ //# sourceMappingURL=Api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/Api/Api.ts","../../../src/Base.ts","../../../src/objToQuery.ts","../../../src/Simple.ts"],"sourcesContent":["import { ApiConfig } from '@xyo-network/api-models'\nimport { Huri } from '@xyo-network/huri'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ApiSimple } from '../Simple'\n\nexport class ArchivistApi<C extends ApiConfig = ApiConfig> extends ApiSimple<Payload[], C> {\n huri(huri: Huri | string) {\n const huriObj = typeof huri === 'string' ? new Huri(huri) : huri\n return new ApiSimple<Payload>({\n ...this.config,\n root: `${this.root}${huriObj.href}/`,\n })\n }\n}\n","import {\n ApiConfig,\n ApiEnvelope,\n ApiError,\n ApiReportable,\n ApiResponse,\n ApiResponseBody,\n ApiResponseTuple,\n ApiResponseTupleOrBody,\n ApiResponseType,\n} from '@xyo-network/api-models'\nimport { AxiosJson } from '@xyo-network/axios'\n\nexport class ApiBase<C extends ApiConfig = ApiConfig> implements ApiReportable {\n readonly config: C\n protected axios: AxiosJson\n\n constructor(config: C) {\n this.config = config\n this.axios = new AxiosJson({ ...this.config, headers: this.headers })\n }\n\n get authenticated() {\n return !!this.config.apiKey || !!this.config.jwtToken\n }\n\n protected get headers(): Record<string, string> {\n const headers: Record<string, string> = {}\n if (this.config.jwtToken) {\n headers.Authorization = `Bearer ${this.config.jwtToken}`\n }\n if (this.config.apiKey) {\n headers['x-api-key'] = this.config.apiKey\n }\n return headers\n }\n\n protected get query() {\n return this.config.query ?? ''\n }\n\n protected get root() {\n return this.config.root ?? '/'\n }\n\n private static resolveResponse<T>(result?: ApiResponse<ApiEnvelope<T>>) {\n return [result?.data?.data, result?.data, result] as ApiResponseTuple<T>\n }\n\n private static shapeResponse<T = unknown>(response: ApiResponse<ApiEnvelope<T>> | undefined, responseType?: ApiResponseType) {\n const resolvedResponse = ApiBase.resolveResponse(response)\n return responseType === 'tuple' ? resolvedResponse : resolvedResponse[0]\n }\n\n onError(error: ApiError, depth = 0) {\n this.config.reportableParent?.onError?.(error, depth + 1)\n this.config.onError?.(error, depth)\n }\n\n onFailure(response: ApiResponse, depth = 0) {\n this.config.reportableParent?.onFailure?.(response, depth + 1)\n this.config.onFailure?.(response, depth)\n }\n\n onSuccess(response: ApiResponse, depth = 0) {\n this.config.reportableParent?.onSuccess?.(response, depth + 1)\n this.config.onSuccess?.(response, depth)\n }\n\n protected async deleteEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>\n protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async deleteEndpoint<T = unknown>(endPoint = '', responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.delete<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected async getEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>\n protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async getEndpoint<T = unknown>(endPoint = '', responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.get<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected handleMonitorResponseError<T>(error: ApiError, trapAxiosException: boolean) {\n if (!error.isError) {\n throw error\n }\n\n if (trapAxiosException) {\n error.response ? this.onFailure(error.response) : this.onError(error)\n if (this.config.throwFailure) {\n throw error\n }\n return error.response as ApiResponse<ApiEnvelope<T>>\n }\n }\n\n protected async monitorResponse<T>(closure: () => Promise<ApiResponse<ApiEnvelope<T>>>) {\n //we use this to prevent accidental catching on exceptions in callbacks\n let trapAxiosException = true\n try {\n const response = await closure()\n trapAxiosException = false\n\n response.status < 300 ? this.onSuccess(response) : this.onFailure(response)\n\n return response\n } catch (ex) {\n this.handleMonitorResponseError(ex as ApiError, trapAxiosException)\n }\n }\n\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async postEndpoint<T = unknown, D = unknown>(\n endPoint = '',\n data?: D,\n responseType?: ApiResponseType,\n ): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.post<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>, D>, D>(`${this.resolveRoot()}${endPoint}${this.query}`, data)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint = '', data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.put<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>, D>, D>(`${this.resolveRoot()}${endPoint}${this.query}`, data)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n private resolveRoot() {\n return `${this.config.apiDomain}${this.root}`\n }\n}\n","export const objToQuery = (obj: Record<string, string | number | undefined>) => {\n return `?${Object.entries(obj)\n .map(([key, value]) => {\n return `${key}=${value}`\n })\n .filter((value) => value !== undefined)\n .join('&')}`\n}\n","import { ApiConfig, ApiResponseBody, ApiResponseTuple, ApiResponseTupleOrBody, ApiResponseType } from '@xyo-network/api-models'\nimport { Payload, PayloadFindFilter } from '@xyo-network/payload-model'\n\nimport { ApiBase } from './Base'\nimport { objToQuery } from './objToQuery'\n\nexport type ApiSimpleQuery = PayloadFindFilter\n\nexport class ApiSimple<T = Payload, D = T, Q extends ApiSimpleQuery = ApiSimpleQuery, C extends ApiConfig = ApiConfig> extends ApiBase<C> {\n async delete(): Promise<ApiResponseBody<T>>\n async delete(responseType?: 'body'): Promise<ApiResponseBody<T>>\n async delete(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async delete(responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.deleteEndpoint(undefined, 'tuple')\n default:\n return await this.deleteEndpoint(undefined)\n }\n }\n\n async find(query?: Q): Promise<ApiResponseBody<T>>\n async find(query?: Q, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async find(query?: Q, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async find(query = {}, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.getEndpoint(objToQuery(query), 'tuple')\n default:\n return await this.getEndpoint(objToQuery(query))\n }\n }\n\n async get(): Promise<ApiResponseBody<T>>\n async get(responseType?: 'body'): Promise<ApiResponseBody<T>>\n async get(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async get(responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.getEndpoint(undefined, 'tuple')\n default:\n return await this.getEndpoint(undefined)\n }\n }\n\n async post(data?: D): Promise<ApiResponseBody<T>>\n async post(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async post(data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async post(data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.postEndpoint(undefined, data, 'tuple')\n default:\n return await this.postEndpoint(undefined, data)\n }\n }\n\n async put(data?: D): Promise<ApiResponseBody<T>>\n async put(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async put(data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async put(data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.putEndpoint(undefined, data, 'tuple')\n default:\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,GAAG,OAAO;AAAA,MAC1D;AACE,eAAO,MAAM,KAAK,YAAY,WAAW,KAAK,CAAC;AAAA,IACnD;AAAA,EACF;AAAA,EAKA,MAAM,IAAI,cAAoE;AAC5E,YAAQ,cAAc;AAAA,MACpB,KAAK;AACH,eAAO,MAAM,KAAK,YAAY,QAAW,OAAO;AAAA,MAClD;AACE,eAAO,MAAM,KAAK,YAAY,MAAS;AAAA,IAC3C;AAAA,EACF;AAAA,EAKA,MAAM,KAAK,MAAU,cAAoE;AACvF,YAAQ,cAAc;AAAA,MACpB,KAAK;AACH,eAAO,MAAM,KAAK,aAAa,QAAW,MAAM,OAAO;AAAA,MACzD;AACE,eAAO,MAAM,KAAK,aAAa,QAAW,IAAI;AAAA,IAClD;AAAA,EACF;AAAA,EAKA,MAAM,IAAI,MAAU,cAAoE;AACtF,YAAQ,cAAc;AAAA,MACpB,KAAK;AACH,eAAO,MAAM,KAAK,YAAY,QAAW,MAAM,OAAO;AAAA,MACxD;AACE,eAAO,MAAM,KAAK,YAAY,QAAW,IAAI;AAAA,IACjD;AAAA,EACF;AACF;;;AH9DO,IAAM,eAAN,cAA4D,UAAwB;AAAA,EACzF,KAAK,MAAqB;AACxB,UAAM,UAAU,OAAO,SAAS,WAAW,IAAI,KAAK,IAAI,IAAI;AAC5D,WAAO,IAAI,UAAmB;AAAA,MAC5B,GAAG,KAAK;AAAA,MACR,MAAM,GAAG,KAAK,IAAI,GAAG,QAAQ,IAAI;AAAA,IACnC,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -0,0 +1,190 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/Api/index.ts
21
+ var Api_exports = {};
22
+ __export(Api_exports, {
23
+ ArchivistApi: () => ArchivistApi
24
+ });
25
+ module.exports = __toCommonJS(Api_exports);
26
+
27
+ // src/Api/Api.ts
28
+ var import_huri = require("@xyo-network/huri");
29
+
30
+ // src/Base.ts
31
+ var import_axios = require("@xyo-network/axios");
32
+ var ApiBase = class _ApiBase {
33
+ config;
34
+ axios;
35
+ constructor(config) {
36
+ this.config = config;
37
+ this.axios = new import_axios.AxiosJson({ ...this.config, headers: this.headers });
38
+ }
39
+ get authenticated() {
40
+ return !!this.config.apiKey || !!this.config.jwtToken;
41
+ }
42
+ get headers() {
43
+ const headers = {};
44
+ if (this.config.jwtToken) {
45
+ headers.Authorization = `Bearer ${this.config.jwtToken}`;
46
+ }
47
+ if (this.config.apiKey) {
48
+ headers["x-api-key"] = this.config.apiKey;
49
+ }
50
+ return headers;
51
+ }
52
+ get query() {
53
+ return this.config.query ?? "";
54
+ }
55
+ get root() {
56
+ return this.config.root ?? "/";
57
+ }
58
+ static resolveResponse(result) {
59
+ return [result?.data?.data, result?.data, result];
60
+ }
61
+ static shapeResponse(response, responseType) {
62
+ const resolvedResponse = _ApiBase.resolveResponse(response);
63
+ return responseType === "tuple" ? resolvedResponse : resolvedResponse[0];
64
+ }
65
+ onError(error, depth = 0) {
66
+ this.config.reportableParent?.onError?.(error, depth + 1);
67
+ this.config.onError?.(error, depth);
68
+ }
69
+ onFailure(response, depth = 0) {
70
+ this.config.reportableParent?.onFailure?.(response, depth + 1);
71
+ this.config.onFailure?.(response, depth);
72
+ }
73
+ onSuccess(response, depth = 0) {
74
+ this.config.reportableParent?.onSuccess?.(response, depth + 1);
75
+ this.config.onSuccess?.(response, depth);
76
+ }
77
+ async deleteEndpoint(endPoint = "", responseType) {
78
+ const response = await this.monitorResponse(async () => {
79
+ return await this.axios.delete(`${this.resolveRoot()}${endPoint}${this.query}`);
80
+ });
81
+ return _ApiBase.shapeResponse(response, responseType);
82
+ }
83
+ async getEndpoint(endPoint = "", responseType) {
84
+ const response = await this.monitorResponse(async () => {
85
+ return await this.axios.get(`${this.resolveRoot()}${endPoint}${this.query}`);
86
+ });
87
+ return _ApiBase.shapeResponse(response, responseType);
88
+ }
89
+ handleMonitorResponseError(error, trapAxiosException) {
90
+ if (!error.isError) {
91
+ throw error;
92
+ }
93
+ if (trapAxiosException) {
94
+ error.response ? this.onFailure(error.response) : this.onError(error);
95
+ if (this.config.throwFailure) {
96
+ throw error;
97
+ }
98
+ return error.response;
99
+ }
100
+ }
101
+ async monitorResponse(closure) {
102
+ let trapAxiosException = true;
103
+ try {
104
+ const response = await closure();
105
+ trapAxiosException = false;
106
+ response.status < 300 ? this.onSuccess(response) : this.onFailure(response);
107
+ return response;
108
+ } catch (ex) {
109
+ this.handleMonitorResponseError(ex, trapAxiosException);
110
+ }
111
+ }
112
+ async postEndpoint(endPoint = "", data, responseType) {
113
+ const response = await this.monitorResponse(async () => {
114
+ return await this.axios.post(`${this.resolveRoot()}${endPoint}${this.query}`, data);
115
+ });
116
+ return _ApiBase.shapeResponse(response, responseType);
117
+ }
118
+ async putEndpoint(endPoint = "", data, responseType) {
119
+ const response = await this.monitorResponse(async () => {
120
+ return await this.axios.put(`${this.resolveRoot()}${endPoint}${this.query}`, data);
121
+ });
122
+ return _ApiBase.shapeResponse(response, responseType);
123
+ }
124
+ resolveRoot() {
125
+ return `${this.config.apiDomain}${this.root}`;
126
+ }
127
+ };
128
+
129
+ // src/objToQuery.ts
130
+ var objToQuery = (obj) => {
131
+ return `?${Object.entries(obj).map(([key, value]) => {
132
+ return `${key}=${value}`;
133
+ }).filter((value) => value !== void 0).join("&")}`;
134
+ };
135
+
136
+ // src/Simple.ts
137
+ var ApiSimple = class extends ApiBase {
138
+ async delete(responseType) {
139
+ switch (responseType) {
140
+ case "tuple":
141
+ return await this.deleteEndpoint(void 0, "tuple");
142
+ default:
143
+ return await this.deleteEndpoint(void 0);
144
+ }
145
+ }
146
+ async find(query = {}, responseType) {
147
+ switch (responseType) {
148
+ case "tuple":
149
+ return await this.getEndpoint(objToQuery(query), "tuple");
150
+ default:
151
+ return await this.getEndpoint(objToQuery(query));
152
+ }
153
+ }
154
+ async get(responseType) {
155
+ switch (responseType) {
156
+ case "tuple":
157
+ return await this.getEndpoint(void 0, "tuple");
158
+ default:
159
+ return await this.getEndpoint(void 0);
160
+ }
161
+ }
162
+ async post(data, responseType) {
163
+ switch (responseType) {
164
+ case "tuple":
165
+ return await this.postEndpoint(void 0, data, "tuple");
166
+ default:
167
+ return await this.postEndpoint(void 0, data);
168
+ }
169
+ }
170
+ async put(data, responseType) {
171
+ switch (responseType) {
172
+ case "tuple":
173
+ return await this.putEndpoint(void 0, data, "tuple");
174
+ default:
175
+ return await this.putEndpoint(void 0, data);
176
+ }
177
+ }
178
+ };
179
+
180
+ // src/Api/Api.ts
181
+ var ArchivistApi = class extends ApiSimple {
182
+ huri(huri) {
183
+ const huriObj = typeof huri === "string" ? new import_huri.Huri(huri) : huri;
184
+ return new ApiSimple({
185
+ ...this.config,
186
+ root: `${this.root}${huriObj.href}/`
187
+ });
188
+ }
189
+ };
190
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/Api/index.ts","../../../src/Api/Api.ts","../../../src/Base.ts","../../../src/objToQuery.ts","../../../src/Simple.ts"],"sourcesContent":["export * from './Api'\n","import { ApiConfig } from '@xyo-network/api-models'\nimport { Huri } from '@xyo-network/huri'\nimport { Payload } from '@xyo-network/payload-model'\n\nimport { ApiSimple } from '../Simple'\n\nexport class ArchivistApi<C extends ApiConfig = ApiConfig> extends ApiSimple<Payload[], C> {\n huri(huri: Huri | string) {\n const huriObj = typeof huri === 'string' ? new Huri(huri) : huri\n return new ApiSimple<Payload>({\n ...this.config,\n root: `${this.root}${huriObj.href}/`,\n })\n }\n}\n","import {\n ApiConfig,\n ApiEnvelope,\n ApiError,\n ApiReportable,\n ApiResponse,\n ApiResponseBody,\n ApiResponseTuple,\n ApiResponseTupleOrBody,\n ApiResponseType,\n} from '@xyo-network/api-models'\nimport { AxiosJson } from '@xyo-network/axios'\n\nexport class ApiBase<C extends ApiConfig = ApiConfig> implements ApiReportable {\n readonly config: C\n protected axios: AxiosJson\n\n constructor(config: C) {\n this.config = config\n this.axios = new AxiosJson({ ...this.config, headers: this.headers })\n }\n\n get authenticated() {\n return !!this.config.apiKey || !!this.config.jwtToken\n }\n\n protected get headers(): Record<string, string> {\n const headers: Record<string, string> = {}\n if (this.config.jwtToken) {\n headers.Authorization = `Bearer ${this.config.jwtToken}`\n }\n if (this.config.apiKey) {\n headers['x-api-key'] = this.config.apiKey\n }\n return headers\n }\n\n protected get query() {\n return this.config.query ?? ''\n }\n\n protected get root() {\n return this.config.root ?? '/'\n }\n\n private static resolveResponse<T>(result?: ApiResponse<ApiEnvelope<T>>) {\n return [result?.data?.data, result?.data, result] as ApiResponseTuple<T>\n }\n\n private static shapeResponse<T = unknown>(response: ApiResponse<ApiEnvelope<T>> | undefined, responseType?: ApiResponseType) {\n const resolvedResponse = ApiBase.resolveResponse(response)\n return responseType === 'tuple' ? resolvedResponse : resolvedResponse[0]\n }\n\n onError(error: ApiError, depth = 0) {\n this.config.reportableParent?.onError?.(error, depth + 1)\n this.config.onError?.(error, depth)\n }\n\n onFailure(response: ApiResponse, depth = 0) {\n this.config.reportableParent?.onFailure?.(response, depth + 1)\n this.config.onFailure?.(response, depth)\n }\n\n onSuccess(response: ApiResponse, depth = 0) {\n this.config.reportableParent?.onSuccess?.(response, depth + 1)\n this.config.onSuccess?.(response, depth)\n }\n\n protected async deleteEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>\n protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async deleteEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async deleteEndpoint<T = unknown>(endPoint = '', responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.delete<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected async getEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>\n protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async getEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async getEndpoint<T = unknown>(endPoint = '', responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.get<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>>>(`${this.resolveRoot()}${endPoint}${this.query}`)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected handleMonitorResponseError<T>(error: ApiError, trapAxiosException: boolean) {\n if (!error.isError) {\n throw error\n }\n\n if (trapAxiosException) {\n error.response ? this.onFailure(error.response) : this.onError(error)\n if (this.config.throwFailure) {\n throw error\n }\n return error.response as ApiResponse<ApiEnvelope<T>>\n }\n }\n\n protected async monitorResponse<T>(closure: () => Promise<ApiResponse<ApiEnvelope<T>>>) {\n //we use this to prevent accidental catching on exceptions in callbacks\n let trapAxiosException = true\n try {\n const response = await closure()\n trapAxiosException = false\n\n response.status < 300 ? this.onSuccess(response) : this.onFailure(response)\n\n return response\n } catch (ex) {\n this.handleMonitorResponseError(ex as ApiError, trapAxiosException)\n }\n }\n\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async postEndpoint<T = unknown, D = unknown>(\n endPoint = '',\n data?: D,\n responseType?: ApiResponseType,\n ): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.post<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>, D>, D>(`${this.resolveRoot()}${endPoint}${this.query}`, data)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n protected async putEndpoint<T = unknown, D = unknown>(endPoint = '', data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n const response = await this.monitorResponse<T>(async () => {\n return await this.axios.put<ApiEnvelope<T>, ApiResponse<ApiEnvelope<T>, D>, D>(`${this.resolveRoot()}${endPoint}${this.query}`, data)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n private resolveRoot() {\n return `${this.config.apiDomain}${this.root}`\n }\n}\n","export const objToQuery = (obj: Record<string, string | number | undefined>) => {\n return `?${Object.entries(obj)\n .map(([key, value]) => {\n return `${key}=${value}`\n })\n .filter((value) => value !== undefined)\n .join('&')}`\n}\n","import { ApiConfig, ApiResponseBody, ApiResponseTuple, ApiResponseTupleOrBody, ApiResponseType } from '@xyo-network/api-models'\nimport { Payload, PayloadFindFilter } from '@xyo-network/payload-model'\n\nimport { ApiBase } from './Base'\nimport { objToQuery } from './objToQuery'\n\nexport type ApiSimpleQuery = PayloadFindFilter\n\nexport class ApiSimple<T = Payload, D = T, Q extends ApiSimpleQuery = ApiSimpleQuery, C extends ApiConfig = ApiConfig> extends ApiBase<C> {\n async delete(): Promise<ApiResponseBody<T>>\n async delete(responseType?: 'body'): Promise<ApiResponseBody<T>>\n async delete(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async delete(responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.deleteEndpoint(undefined, 'tuple')\n default:\n return await this.deleteEndpoint(undefined)\n }\n }\n\n async find(query?: Q): Promise<ApiResponseBody<T>>\n async find(query?: Q, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async find(query?: Q, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async find(query = {}, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.getEndpoint(objToQuery(query), 'tuple')\n default:\n return await this.getEndpoint(objToQuery(query))\n }\n }\n\n async get(): Promise<ApiResponseBody<T>>\n async get(responseType?: 'body'): Promise<ApiResponseBody<T>>\n async get(responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async get(responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.getEndpoint(undefined, 'tuple')\n default:\n return await this.getEndpoint(undefined)\n }\n }\n\n async post(data?: D): Promise<ApiResponseBody<T>>\n async post(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async post(data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async post(data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.postEndpoint(undefined, data, 'tuple')\n default:\n return await this.postEndpoint(undefined, data)\n }\n }\n\n async put(data?: D): Promise<ApiResponseBody<T>>\n async put(data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>\n async put(data?: D, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>\n async put(data?: D, responseType?: ApiResponseType): Promise<ApiResponseTupleOrBody<T>> {\n switch (responseType) {\n case 'tuple':\n return await this.putEndpoint(undefined, data, 'tuple')\n default:\n return await this.putEndpoint(undefined, data)\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kBAAqB;;;ACUrB,mBAA0B;AAEnB,IAAM,UAAN,MAAM,SAAkE;AAAA,EACpE;AAAA,EACC;AAAA,EAEV,YAAY,QAAW;AACrB,SAAK,SAAS;AACd,SAAK,QAAQ,IAAI,uBAAU,EAAE,GAAG,KAAK,QAAQ,SAAS,KAAK,QAAQ,CAAC;AAAA,EACtE;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,CAAC,CAAC,KAAK,OAAO,UAAU,CAAC,CAAC,KAAK,OAAO;AAAA,EAC/C;AAAA,EAEA,IAAc,UAAkC;AAC9C,UAAM,UAAkC,CAAC;AACzC,QAAI,KAAK,OAAO,UAAU;AACxB,cAAQ,gBAAgB,UAAU,KAAK,OAAO,QAAQ;AAAA,IACxD;AACA,QAAI,KAAK,OAAO,QAAQ;AACtB,cAAQ,WAAW,IAAI,KAAK,OAAO;AAAA,IACrC;AACA,WAAO;AAAA,EACT;AAAA,EAEA,IAAc,QAAQ;AACpB,WAAO,KAAK,OAAO,SAAS;AAAA,EAC9B;AAAA,EAEA,IAAc,OAAO;AACnB,WAAO,KAAK,OAAO,QAAQ;AAAA,EAC7B;AAAA,EAEA,OAAe,gBAAmB,QAAsC;AACtE,WAAO,CAAC,QAAQ,MAAM,MAAM,QAAQ,MAAM,MAAM;AAAA,EAClD;AAAA,EAEA,OAAe,cAA2B,UAAmD,cAAgC;AAC3H,UAAM,mBAAmB,SAAQ,gBAAgB,QAAQ;AACzD,WAAO,iBAAiB,UAAU,mBAAmB,iBAAiB,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sourceRoot":"","sources":["../../../src/Api/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Api/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA"}