@xyo-network/api 2.20.41 → 2.20.44

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 (272) hide show
  1. package/dist/cjs/Archivist/Account/Api.d.ts +18 -18
  2. package/dist/cjs/Archivist/Account/Api.js +14 -14
  3. package/dist/cjs/Archivist/Account/index.d.ts +1 -1
  4. package/dist/cjs/Archivist/Account/index.js +4 -4
  5. package/dist/cjs/Archivist/Api.d.ts +34 -27
  6. package/dist/cjs/Archivist/Api.js +68 -59
  7. package/dist/cjs/Archivist/Api.js.map +1 -1
  8. package/dist/cjs/Archivist/Archive/Api.d.ts +18 -18
  9. package/dist/cjs/Archivist/Archive/Api.js +39 -39
  10. package/dist/cjs/Archivist/Archive/Schema/Api.d.ts +7 -7
  11. package/dist/cjs/Archivist/Archive/Schema/Api.js +14 -14
  12. package/dist/cjs/Archivist/Archive/Schema/index.d.ts +1 -1
  13. package/dist/cjs/Archivist/Archive/Schema/index.js +4 -4
  14. package/dist/cjs/Archivist/Archive/Schemas/Api.d.ts +6 -6
  15. package/dist/cjs/Archivist/Archive/Schemas/Api.js +13 -13
  16. package/dist/cjs/Archivist/Archive/Schemas/index.d.ts +1 -1
  17. package/dist/cjs/Archivist/Archive/Schemas/index.js +4 -4
  18. package/dist/cjs/Archivist/Archive/Settings/Api.d.ts +6 -6
  19. package/dist/cjs/Archivist/Archive/Settings/Api.js +14 -14
  20. package/dist/cjs/Archivist/Archive/Settings/Key/Api.d.ts +5 -5
  21. package/dist/cjs/Archivist/Archive/Settings/Key/Api.js +10 -10
  22. package/dist/cjs/Archivist/Archive/Settings/Key/index.d.ts +1 -1
  23. package/dist/cjs/Archivist/Archive/Settings/Key/index.js +4 -4
  24. package/dist/cjs/Archivist/Archive/Settings/index.d.ts +2 -2
  25. package/dist/cjs/Archivist/Archive/Settings/index.js +5 -5
  26. package/dist/cjs/Archivist/Archive/index.d.ts +4 -4
  27. package/dist/cjs/Archivist/Archive/index.js +7 -7
  28. package/dist/cjs/Archivist/Archives/Api.d.ts +8 -8
  29. package/dist/cjs/Archivist/Archives/Api.js +15 -15
  30. package/dist/cjs/Archivist/Archives/index.d.ts +1 -1
  31. package/dist/cjs/Archivist/Archives/index.js +4 -4
  32. package/dist/cjs/Archivist/Block/Api.d.ts +8 -8
  33. package/dist/cjs/Archivist/Block/Api.js +11 -11
  34. package/dist/cjs/Archivist/Block/index.d.ts +1 -1
  35. package/dist/cjs/Archivist/Block/index.js +4 -4
  36. package/dist/cjs/Archivist/Node/Api.d.ts +20 -0
  37. package/dist/cjs/Archivist/Node/Api.js +57 -0
  38. package/dist/cjs/Archivist/Node/Api.js.map +1 -0
  39. package/dist/cjs/Archivist/Node/index.d.ts +1 -0
  40. package/dist/cjs/Archivist/Node/index.js +5 -0
  41. package/dist/cjs/Archivist/Node/index.js.map +1 -0
  42. package/dist/cjs/Archivist/Payload/Api.d.ts +40 -40
  43. package/dist/cjs/Archivist/Payload/Api.js +83 -83
  44. package/dist/cjs/Archivist/Payload/Schema/Api.d.ts +8 -8
  45. package/dist/cjs/Archivist/Payload/Schema/Api.js +13 -13
  46. package/dist/cjs/Archivist/Payload/Schema/index.d.ts +1 -1
  47. package/dist/cjs/Archivist/Payload/Schema/index.js +4 -4
  48. package/dist/cjs/Archivist/Payload/index.d.ts +2 -2
  49. package/dist/cjs/Archivist/Payload/index.js +5 -5
  50. package/dist/cjs/Archivist/index.d.ts +6 -6
  51. package/dist/cjs/Archivist/index.js +9 -9
  52. package/dist/cjs/Base.d.ts +33 -33
  53. package/dist/cjs/Base.js +146 -146
  54. package/dist/cjs/Diviner/LocationDiviner/LocationDivinerApi.d.ts +11 -11
  55. package/dist/cjs/Diviner/LocationDiviner/LocationDivinerApi.js +27 -27
  56. package/dist/cjs/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts +9 -9
  57. package/dist/cjs/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.js +23 -23
  58. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts +4 -4
  59. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.js +2 -2
  60. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts +11 -11
  61. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.js +9 -9
  62. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts +2 -2
  63. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.js +5 -5
  64. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts +11 -11
  65. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.js +9 -9
  66. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts +1 -1
  67. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.js +4 -4
  68. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +17 -17
  69. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.js +2 -2
  70. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts +4 -4
  71. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.js +2 -2
  72. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts +5 -5
  73. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationQuerySchema.js +12 -12
  74. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts +7 -7
  75. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.js +2 -2
  76. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts +11 -11
  77. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.js +9 -9
  78. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts +2 -2
  79. package/dist/cjs/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.js +5 -5
  80. package/dist/cjs/Diviner/LocationDiviner/Queries/index.d.ts +6 -6
  81. package/dist/cjs/Diviner/LocationDiviner/Queries/index.js +9 -9
  82. package/dist/cjs/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts +13 -13
  83. package/dist/cjs/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.js +4 -4
  84. package/dist/cjs/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts +21 -21
  85. package/dist/cjs/Diviner/LocationDiviner/Witnesses/LocationWitness.js +4 -4
  86. package/dist/cjs/Diviner/LocationDiviner/Witnesses/index.d.ts +2 -2
  87. package/dist/cjs/Diviner/LocationDiviner/Witnesses/index.js +5 -5
  88. package/dist/cjs/Diviner/LocationDiviner/index.d.ts +4 -4
  89. package/dist/cjs/Diviner/LocationDiviner/index.js +7 -7
  90. package/dist/cjs/Diviner/LocationDiviner/models.d.ts +4 -4
  91. package/dist/cjs/Diviner/LocationDiviner/models.js +2 -2
  92. package/dist/cjs/Diviner/index.d.ts +1 -1
  93. package/dist/cjs/Diviner/index.js +4 -4
  94. package/dist/cjs/Simple.d.ts +21 -21
  95. package/dist/cjs/Simple.js +59 -59
  96. package/dist/cjs/Test/index.d.ts +2 -2
  97. package/dist/cjs/Test/index.js +5 -5
  98. package/dist/cjs/Test/testBoundWitness.d.ts +3 -3
  99. package/dist/cjs/Test/testBoundWitness.js +16 -16
  100. package/dist/cjs/Test/testPayload.d.ts +4 -4
  101. package/dist/cjs/Test/testPayload.js +18 -18
  102. package/dist/cjs/User/Api.d.ts +31 -31
  103. package/dist/cjs/User/Api.js +24 -24
  104. package/dist/cjs/User/index.d.ts +1 -1
  105. package/dist/cjs/User/index.js +4 -4
  106. package/dist/cjs/WithArchive.d.ts +3 -3
  107. package/dist/cjs/WithArchive.js +2 -2
  108. package/dist/cjs/index.d.ts +7 -7
  109. package/dist/cjs/index.js +10 -10
  110. package/dist/cjs/models/Api/Config.d.ts +24 -24
  111. package/dist/cjs/models/Api/Config.js +2 -2
  112. package/dist/cjs/models/Api/Envelope.d.ts +14 -14
  113. package/dist/cjs/models/Api/Envelope.js +2 -2
  114. package/dist/cjs/models/Api/Error.d.ts +4 -4
  115. package/dist/cjs/models/Api/Error.js +2 -2
  116. package/dist/cjs/models/Api/Reportable.d.ts +7 -7
  117. package/dist/cjs/models/Api/Reportable.js +2 -2
  118. package/dist/cjs/models/Api/Response.d.ts +7 -7
  119. package/dist/cjs/models/Api/Response.js +2 -2
  120. package/dist/cjs/models/Api/Warning.d.ts +1 -1
  121. package/dist/cjs/models/Api/Warning.js +2 -2
  122. package/dist/cjs/models/Api/index.d.ts +6 -6
  123. package/dist/cjs/models/Api/index.js +9 -9
  124. package/dist/cjs/models/Archive.d.ts +24 -24
  125. package/dist/cjs/models/Archive.js +2 -2
  126. package/dist/cjs/models/ArchiveKey.d.ts +5 -5
  127. package/dist/cjs/models/ArchiveKey.js +2 -2
  128. package/dist/cjs/models/ArchivePath.d.ts +3 -3
  129. package/dist/cjs/models/ArchivePath.js +2 -2
  130. package/dist/cjs/models/index.d.ts +4 -4
  131. package/dist/cjs/models/index.js +7 -7
  132. package/dist/cjs/objToQuery.d.ts +1 -1
  133. package/dist/cjs/objToQuery.js +12 -12
  134. package/dist/docs.json +4183 -4072
  135. package/dist/esm/Archivist/Account/Api.d.ts +18 -18
  136. package/dist/esm/Archivist/Account/Api.js +16 -16
  137. package/dist/esm/Archivist/Account/index.d.ts +1 -1
  138. package/dist/esm/Archivist/Account/index.js +1 -1
  139. package/dist/esm/Archivist/Api.d.ts +34 -27
  140. package/dist/esm/Archivist/Api.js +82 -70
  141. package/dist/esm/Archivist/Api.js.map +1 -1
  142. package/dist/esm/Archivist/Archive/Api.d.ts +18 -18
  143. package/dist/esm/Archivist/Archive/Api.js +50 -50
  144. package/dist/esm/Archivist/Archive/Schema/Api.d.ts +7 -7
  145. package/dist/esm/Archivist/Archive/Schema/Api.js +13 -13
  146. package/dist/esm/Archivist/Archive/Schema/index.d.ts +1 -1
  147. package/dist/esm/Archivist/Archive/Schema/index.js +1 -1
  148. package/dist/esm/Archivist/Archive/Schemas/Api.d.ts +6 -6
  149. package/dist/esm/Archivist/Archive/Schemas/Api.js +12 -12
  150. package/dist/esm/Archivist/Archive/Schemas/index.d.ts +1 -1
  151. package/dist/esm/Archivist/Archive/Schemas/index.js +1 -1
  152. package/dist/esm/Archivist/Archive/Settings/Api.d.ts +6 -6
  153. package/dist/esm/Archivist/Archive/Settings/Api.js +13 -13
  154. package/dist/esm/Archivist/Archive/Settings/Key/Api.d.ts +5 -5
  155. package/dist/esm/Archivist/Archive/Settings/Key/Api.js +9 -9
  156. package/dist/esm/Archivist/Archive/Settings/Key/index.d.ts +1 -1
  157. package/dist/esm/Archivist/Archive/Settings/Key/index.js +1 -1
  158. package/dist/esm/Archivist/Archive/Settings/index.d.ts +2 -2
  159. package/dist/esm/Archivist/Archive/Settings/index.js +2 -2
  160. package/dist/esm/Archivist/Archive/index.d.ts +4 -4
  161. package/dist/esm/Archivist/Archive/index.js +4 -4
  162. package/dist/esm/Archivist/Archives/Api.d.ts +8 -8
  163. package/dist/esm/Archivist/Archives/Api.js +14 -14
  164. package/dist/esm/Archivist/Archives/index.d.ts +1 -1
  165. package/dist/esm/Archivist/Archives/index.js +1 -1
  166. package/dist/esm/Archivist/Block/Api.d.ts +8 -8
  167. package/dist/esm/Archivist/Block/Api.js +10 -10
  168. package/dist/esm/Archivist/Block/index.d.ts +1 -1
  169. package/dist/esm/Archivist/Block/index.js +1 -1
  170. package/dist/esm/Archivist/Node/Api.d.ts +20 -0
  171. package/dist/esm/Archivist/Node/Api.js +53 -0
  172. package/dist/esm/Archivist/Node/Api.js.map +1 -0
  173. package/dist/esm/Archivist/Node/index.d.ts +1 -0
  174. package/dist/esm/Archivist/Node/index.js +2 -0
  175. package/dist/esm/Archivist/Node/index.js.map +1 -0
  176. package/dist/esm/Archivist/Payload/Api.d.ts +40 -40
  177. package/dist/esm/Archivist/Payload/Api.js +67 -67
  178. package/dist/esm/Archivist/Payload/Schema/Api.d.ts +8 -8
  179. package/dist/esm/Archivist/Payload/Schema/Api.js +12 -12
  180. package/dist/esm/Archivist/Payload/Schema/index.d.ts +1 -1
  181. package/dist/esm/Archivist/Payload/Schema/index.js +1 -1
  182. package/dist/esm/Archivist/Payload/index.d.ts +2 -2
  183. package/dist/esm/Archivist/Payload/index.js +2 -2
  184. package/dist/esm/Archivist/index.d.ts +6 -6
  185. package/dist/esm/Archivist/index.js +6 -6
  186. package/dist/esm/Base.d.ts +33 -33
  187. package/dist/esm/Base.js +128 -128
  188. package/dist/esm/Diviner/LocationDiviner/LocationDivinerApi.d.ts +11 -11
  189. package/dist/esm/Diviner/LocationDiviner/LocationDivinerApi.js +19 -19
  190. package/dist/esm/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts +9 -9
  191. package/dist/esm/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.js +17 -17
  192. package/dist/esm/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts +4 -4
  193. package/dist/esm/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.js +1 -1
  194. package/dist/esm/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts +11 -11
  195. package/dist/esm/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.js +5 -5
  196. package/dist/esm/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts +2 -2
  197. package/dist/esm/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.js +2 -2
  198. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts +11 -11
  199. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.js +5 -5
  200. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts +1 -1
  201. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.js +1 -1
  202. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +17 -17
  203. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.js +1 -1
  204. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts +4 -4
  205. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.js +1 -1
  206. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts +5 -5
  207. package/dist/esm/Diviner/LocationDiviner/Queries/LocationQuerySchema.js +8 -8
  208. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts +7 -7
  209. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.js +1 -1
  210. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts +11 -11
  211. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.js +5 -5
  212. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts +2 -2
  213. package/dist/esm/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.js +2 -2
  214. package/dist/esm/Diviner/LocationDiviner/Queries/index.d.ts +6 -6
  215. package/dist/esm/Diviner/LocationDiviner/Queries/index.js +6 -6
  216. package/dist/esm/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts +13 -13
  217. package/dist/esm/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.js +1 -1
  218. package/dist/esm/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts +21 -21
  219. package/dist/esm/Diviner/LocationDiviner/Witnesses/LocationWitness.js +1 -1
  220. package/dist/esm/Diviner/LocationDiviner/Witnesses/index.d.ts +2 -2
  221. package/dist/esm/Diviner/LocationDiviner/Witnesses/index.js +2 -2
  222. package/dist/esm/Diviner/LocationDiviner/index.d.ts +4 -4
  223. package/dist/esm/Diviner/LocationDiviner/index.js +4 -4
  224. package/dist/esm/Diviner/LocationDiviner/models.d.ts +4 -4
  225. package/dist/esm/Diviner/LocationDiviner/models.js +1 -1
  226. package/dist/esm/Diviner/index.d.ts +1 -1
  227. package/dist/esm/Diviner/index.js +1 -1
  228. package/dist/esm/Simple.d.ts +21 -21
  229. package/dist/esm/Simple.js +44 -44
  230. package/dist/esm/Test/index.d.ts +2 -2
  231. package/dist/esm/Test/index.js +2 -2
  232. package/dist/esm/Test/testBoundWitness.d.ts +3 -3
  233. package/dist/esm/Test/testBoundWitness.js +13 -13
  234. package/dist/esm/Test/testPayload.d.ts +4 -4
  235. package/dist/esm/Test/testPayload.js +14 -14
  236. package/dist/esm/User/Api.d.ts +31 -31
  237. package/dist/esm/User/Api.js +26 -26
  238. package/dist/esm/User/index.d.ts +1 -1
  239. package/dist/esm/User/index.js +1 -1
  240. package/dist/esm/WithArchive.d.ts +3 -3
  241. package/dist/esm/WithArchive.js +1 -1
  242. package/dist/esm/index.d.ts +7 -7
  243. package/dist/esm/index.js +7 -7
  244. package/dist/esm/models/Api/Config.d.ts +24 -24
  245. package/dist/esm/models/Api/Config.js +1 -1
  246. package/dist/esm/models/Api/Envelope.d.ts +14 -14
  247. package/dist/esm/models/Api/Envelope.js +1 -1
  248. package/dist/esm/models/Api/Error.d.ts +4 -4
  249. package/dist/esm/models/Api/Error.js +1 -1
  250. package/dist/esm/models/Api/Reportable.d.ts +7 -7
  251. package/dist/esm/models/Api/Reportable.js +1 -1
  252. package/dist/esm/models/Api/Response.d.ts +7 -7
  253. package/dist/esm/models/Api/Response.js +1 -1
  254. package/dist/esm/models/Api/Warning.d.ts +1 -1
  255. package/dist/esm/models/Api/Warning.js +1 -1
  256. package/dist/esm/models/Api/index.d.ts +6 -6
  257. package/dist/esm/models/Api/index.js +6 -6
  258. package/dist/esm/models/Archive.d.ts +24 -24
  259. package/dist/esm/models/Archive.js +1 -1
  260. package/dist/esm/models/ArchiveKey.d.ts +5 -5
  261. package/dist/esm/models/ArchiveKey.js +1 -1
  262. package/dist/esm/models/ArchivePath.d.ts +3 -3
  263. package/dist/esm/models/ArchivePath.js +1 -1
  264. package/dist/esm/models/index.d.ts +4 -4
  265. package/dist/esm/models/index.js +4 -4
  266. package/dist/esm/objToQuery.d.ts +1 -1
  267. package/dist/esm/objToQuery.js +8 -8
  268. package/package.json +3 -3
  269. package/src/Archivist/Api.ts +14 -1
  270. package/src/Archivist/Node/Api.spec.ts +133 -0
  271. package/src/Archivist/Node/Api.ts +61 -0
  272. package/src/Archivist/Node/index.ts +1 -0
@@ -1,24 +1,24 @@
1
- import { XyoApiReportable } from './Reportable';
2
- interface XyoApiConfig extends XyoApiReportable {
3
- /** @description The domain where the api is located */
4
- apiDomain: string;
5
- /** @deprecated use the jwtToken instead*/
6
- userid?: string;
7
- /** @description The jwtToken of the currently logged in user */
8
- jwtToken?: string;
9
- /** @description The apiKey used for authentication */
10
- apiKey?: string;
11
- /** @description The location in the API tree where this API object is mounted */
12
- root?: string;
13
- /** @description The query string, if any, that is added to the end of every request */
14
- query?: string;
15
- /** @description Threshold for Content-Size to cause automatic gzip of request body [default = 1024] */
16
- compressionThreshold?: number;
17
- /** @description Throw on failures */
18
- throwFailure?: boolean;
19
- /** @description Throw on error */
20
- throwError?: boolean;
21
- /** @description Parent that should also report events from this api */
22
- reportableParent?: XyoApiReportable;
23
- }
24
- export type { XyoApiConfig };
1
+ import { XyoApiReportable } from './Reportable';
2
+ interface XyoApiConfig extends XyoApiReportable {
3
+ /** @description The domain where the api is located */
4
+ apiDomain: string;
5
+ /** @deprecated use the jwtToken instead*/
6
+ userid?: string;
7
+ /** @description The jwtToken of the currently logged in user */
8
+ jwtToken?: string;
9
+ /** @description The apiKey used for authentication */
10
+ apiKey?: string;
11
+ /** @description The location in the API tree where this API object is mounted */
12
+ root?: string;
13
+ /** @description The query string, if any, that is added to the end of every request */
14
+ query?: string;
15
+ /** @description Threshold for Content-Size to cause automatic gzip of request body [default = 1024] */
16
+ compressionThreshold?: number;
17
+ /** @description Throw on failures */
18
+ throwFailure?: boolean;
19
+ /** @description Throw on error */
20
+ throwError?: boolean;
21
+ /** @description Parent that should also report events from this api */
22
+ reportableParent?: XyoApiReportable;
23
+ }
24
+ export type { XyoApiConfig };
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=Config.js.map
@@ -1,14 +1,14 @@
1
- import { XyoApiError } from './Error';
2
- import { XyoApiWarning } from './Warning';
3
- export interface XyoApiEnvelopeBase {
4
- warning?: XyoApiWarning[];
5
- }
6
- export interface XyoApiEnvelopeSuccess<T> extends XyoApiEnvelopeBase {
7
- data: T;
8
- error: never;
9
- }
10
- export interface XyoApiEnvelopeError extends XyoApiEnvelopeBase {
11
- data: never;
12
- error: XyoApiError[];
13
- }
14
- export declare type XyoApiEnvelope<T> = XyoApiEnvelopeSuccess<T> | XyoApiEnvelopeError;
1
+ import { XyoApiError } from './Error';
2
+ import { XyoApiWarning } from './Warning';
3
+ export interface XyoApiEnvelopeBase {
4
+ warning?: XyoApiWarning[];
5
+ }
6
+ export interface XyoApiEnvelopeSuccess<T> extends XyoApiEnvelopeBase {
7
+ data: T;
8
+ error: never;
9
+ }
10
+ export interface XyoApiEnvelopeError extends XyoApiEnvelopeBase {
11
+ data: never;
12
+ error: XyoApiError[];
13
+ }
14
+ export declare type XyoApiEnvelope<T> = XyoApiEnvelopeSuccess<T> | XyoApiEnvelopeError;
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=Envelope.js.map
@@ -1,4 +1,4 @@
1
- import { AxiosError } from 'axios';
2
- export interface XyoApiError<T = any, D = any> extends AxiosError<T, D> {
3
- isXyoError: true;
4
- }
1
+ import { AxiosError } from 'axios';
2
+ export interface XyoApiError<T = any, D = any> extends AxiosError<T, D> {
3
+ isXyoError: true;
4
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=Error.js.map
@@ -1,7 +1,7 @@
1
- import { XyoApiError } from './Error';
2
- import { XyoApiResponse } from './Response';
3
- export interface XyoApiReportable {
4
- onError?: (error: XyoApiError, depth: number) => void;
5
- onFailure?: (response: XyoApiResponse, depth: number) => void;
6
- onSuccess?: (response: XyoApiResponse, depth: number) => void;
7
- }
1
+ import { XyoApiError } from './Error';
2
+ import { XyoApiResponse } from './Response';
3
+ export interface XyoApiReportable {
4
+ onError?: (error: XyoApiError, depth: number) => void;
5
+ onFailure?: (response: XyoApiResponse, depth: number) => void;
6
+ onSuccess?: (response: XyoApiResponse, depth: number) => void;
7
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=Reportable.js.map
@@ -1,7 +1,7 @@
1
- import { AxiosResponse } from 'axios';
2
- import { XyoApiEnvelope } from './Envelope';
3
- export declare type XyoApiResponse<T = unknown, D = unknown> = AxiosResponse<T, D>;
4
- export declare type XyoApiResponseBody<T> = T | undefined;
5
- export declare type XyoApiResponseTuple<T> = [T | undefined, XyoApiEnvelope<T | undefined>, XyoApiResponse<XyoApiEnvelope<T | undefined>>];
6
- export declare type XyoApiResponseTupleOrBody<T> = XyoApiResponseTuple<T> | XyoApiResponseBody<T>;
7
- export declare type XyoApiResponseType = 'body' | 'tuple';
1
+ import { AxiosResponse } from 'axios';
2
+ import { XyoApiEnvelope } from './Envelope';
3
+ export declare type XyoApiResponse<T = unknown, D = unknown> = AxiosResponse<T, D>;
4
+ export declare type XyoApiResponseBody<T> = T | undefined;
5
+ export declare type XyoApiResponseTuple<T> = [T | undefined, XyoApiEnvelope<T | undefined>, XyoApiResponse<XyoApiEnvelope<T | undefined>>];
6
+ export declare type XyoApiResponseTupleOrBody<T> = XyoApiResponseTuple<T> | XyoApiResponseBody<T>;
7
+ export declare type XyoApiResponseType = 'body' | 'tuple';
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=Response.js.map
@@ -1 +1 @@
1
- export declare type XyoApiWarning = Error;
1
+ export declare type XyoApiWarning = Error;
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=Warning.js.map
@@ -1,6 +1,6 @@
1
- export * from './Config';
2
- export * from './Envelope';
3
- export * from './Error';
4
- export * from './Reportable';
5
- export * from './Response';
6
- export * from './Warning';
1
+ export * from './Config';
2
+ export * from './Envelope';
3
+ export * from './Error';
4
+ export * from './Reportable';
5
+ export * from './Response';
6
+ export * from './Warning';
@@ -1,7 +1,7 @@
1
- export * from './Config';
2
- export * from './Envelope';
3
- export * from './Error';
4
- export * from './Reportable';
5
- export * from './Response';
6
- export * from './Warning';
1
+ export * from './Config';
2
+ export * from './Envelope';
3
+ export * from './Error';
4
+ export * from './Reportable';
5
+ export * from './Response';
6
+ export * from './Warning';
7
7
  //# sourceMappingURL=index.js.map
@@ -1,24 +1,24 @@
1
- import { XyoArchivePath } from './ArchivePath';
2
- export declare type AccessLevel = 'public' | 'private' | 'none';
3
- export declare type AccessType = 'read' | 'remove' | 'create' | 'list';
4
- export declare type ExpirationWindow = 'create' | 'read';
5
- export interface XyoAccessControl {
6
- access?: Record<AccessType, AccessLevel>;
7
- expiration?: {
8
- window?: ExpirationWindow;
9
- delay?: number;
10
- };
11
- }
12
- export interface XyoAccessControls {
13
- /**
14
- * Set access controls on a per schema basis.
15
- * '*' can be used as a wildcard
16
- * Access control is set from a generic to specific direction if
17
- * multiple wildcard versions apply to a schema
18
- */
19
- schema?: Record<string, XyoAccessControl>;
20
- }
21
- export interface XyoArchive extends XyoArchivePath {
22
- user?: string;
23
- accessControl?: XyoAccessControl | boolean;
24
- }
1
+ import { XyoArchivePath } from './ArchivePath';
2
+ export declare type AccessLevel = 'public' | 'private' | 'none';
3
+ export declare type AccessType = 'read' | 'remove' | 'create' | 'list';
4
+ export declare type ExpirationWindow = 'create' | 'read';
5
+ export interface XyoAccessControl {
6
+ access?: Record<AccessType, AccessLevel>;
7
+ expiration?: {
8
+ window?: ExpirationWindow;
9
+ delay?: number;
10
+ };
11
+ }
12
+ export interface XyoAccessControls {
13
+ /**
14
+ * Set access controls on a per schema basis.
15
+ * '*' can be used as a wildcard
16
+ * Access control is set from a generic to specific direction if
17
+ * multiple wildcard versions apply to a schema
18
+ */
19
+ schema?: Record<string, XyoAccessControl>;
20
+ }
21
+ export interface XyoArchive extends XyoArchivePath {
22
+ user?: string;
23
+ accessControl?: XyoAccessControl | boolean;
24
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=Archive.js.map
@@ -1,5 +1,5 @@
1
- export interface XyoArchiveKey {
2
- archive: string;
3
- created?: number;
4
- key: string;
5
- }
1
+ export interface XyoArchiveKey {
2
+ archive: string;
3
+ created?: number;
4
+ key: string;
5
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=ArchiveKey.js.map
@@ -1,3 +1,3 @@
1
- export interface XyoArchivePath {
2
- archive: string;
3
- }
1
+ export interface XyoArchivePath {
2
+ archive: string;
3
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=ArchivePath.js.map
@@ -1,4 +1,4 @@
1
- export * from './Api';
2
- export * from './Archive';
3
- export * from './ArchiveKey';
4
- export * from './ArchivePath';
1
+ export * from './Api';
2
+ export * from './Archive';
3
+ export * from './ArchiveKey';
4
+ export * from './ArchivePath';
@@ -1,5 +1,5 @@
1
- export * from './Api';
2
- export * from './Archive';
3
- export * from './ArchiveKey';
4
- export * from './ArchivePath';
1
+ export * from './Api';
2
+ export * from './Archive';
3
+ export * from './ArchiveKey';
4
+ export * from './ArchivePath';
5
5
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- export declare const objToQuery: (obj: Record<string, string | number | undefined>) => string;
1
+ export declare const objToQuery: (obj: Record<string, string | number | undefined>) => string;
@@ -1,9 +1,9 @@
1
- export const objToQuery = (obj) => {
2
- return `?${Object.entries(obj)
3
- .map(([key, value]) => {
4
- return `${key}=${value}`;
5
- })
6
- .filter((value) => value !== undefined)
7
- .join('&')}`;
8
- };
1
+ export const objToQuery = (obj) => {
2
+ return `?${Object.entries(obj)
3
+ .map(([key, value]) => {
4
+ return `${key}=${value}`;
5
+ })
6
+ .filter((value) => value !== undefined)
7
+ .join('&')}`;
8
+ };
9
9
  //# sourceMappingURL=objToQuery.js.map
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@xylabs/sdk-js": "^2.5.7",
13
- "@xyo-network/core": "^2.20.41",
13
+ "@xyo-network/core": "^2.20.44",
14
14
  "axios": "^0.27.2",
15
15
  "pako": "^2.0.4",
16
16
  "uuid": "^8.3.2"
@@ -28,7 +28,7 @@
28
28
  "ethers": "^5.6.8",
29
29
  "license-checker": "^25.0.1",
30
30
  "tslib": "^2.4.0",
31
- "typescript": "^4.7.2"
31
+ "typescript": "^4.7.3"
32
32
  },
33
33
  "browser": "dist/esm/index.js",
34
34
  "docs": "dist/docs.json",
@@ -67,6 +67,6 @@
67
67
  },
68
68
  "sideEffects": true,
69
69
  "types": "dist/esm/index.d.ts",
70
- "version": "2.20.41",
70
+ "version": "2.20.44",
71
71
  "packageManager": "yarn@3.1.1"
72
72
  }
@@ -1,4 +1,4 @@
1
- import { Huri, XyoAddressValue, XyoDataLike, XyoPayload } from '@xyo-network/core'
1
+ import { Huri, XyoAddressValue, XyoBoundWitness, XyoDataLike, XyoPayload } from '@xyo-network/core'
2
2
 
3
3
  import { XyoApiBase } from '../Base'
4
4
  import { XyoApiResponseBody, XyoApiResponseTuple, XyoApiResponseTupleOrBody, XyoApiResponseType } from '../models'
@@ -7,6 +7,7 @@ import { XyoUserApi } from '../User'
7
7
  import { XyoAccountApi } from './Account'
8
8
  import { XyoArchivistArchiveApi } from './Archive'
9
9
  import { XyoArchivistArchivesApi } from './Archives'
10
+ import { XyoArchivistNodeApi } from './Node'
10
11
 
11
12
  export class XyoArchivistApi extends XyoApiBase {
12
13
  private _archives?: XyoArchivistArchivesApi
@@ -70,6 +71,18 @@ export class XyoArchivistApi extends XyoApiBase {
70
71
  })
71
72
  }
72
73
 
74
+ /**
75
+ * Issues commands/queries as XyoBoundWitness wrapped XyoPayloads against a Node in the network
76
+ * @param archive Optional, the archive to issue the requests against
77
+ * @returns Confirmation for the request, as a BoundWitness, from the network Node
78
+ */
79
+ public node<TData extends XyoBoundWitness | XyoBoundWitness[] = XyoBoundWitness | XyoBoundWitness[]>(archive = 'temp') {
80
+ return new XyoArchivistNodeApi<TData>({
81
+ ...this.config,
82
+ root: `${this.root}${archive}/`,
83
+ })
84
+ }
85
+
73
86
  /** @deprecated use huri(huri) instead */
74
87
  public async get(huri: Huri | string): Promise<XyoApiResponseBody<XyoPayload>>
75
88
  /** @deprecated use huri(huri) instead */
@@ -0,0 +1,133 @@
1
+ import { assertEx, delay } from '@xylabs/sdk-js'
2
+ import { XyoBoundWitness, XyoBoundWitnessBuilder, XyoPayload, XyoPayloadBuilder } from '@xyo-network/core'
3
+ import { v4 } from 'uuid'
4
+
5
+ import { XyoApiConfig, XyoApiEnvelope } from '../../models'
6
+ import { XyoArchivistApi } from '../Api'
7
+
8
+ const config: XyoApiConfig = {
9
+ apiDomain: process.env.API_DOMAIN || 'http://localhost:8080',
10
+ }
11
+
12
+ const schema = 'network.xyo.debug'
13
+
14
+ const getQuery = (count = 1): XyoBoundWitness => {
15
+ const payloads = [] as XyoPayload[]
16
+ for (let i = 0; i < count; i++) {
17
+ payloads.push(new XyoPayloadBuilder({ schema }).fields({ nonce: v4() }).build())
18
+ }
19
+ return new XyoBoundWitnessBuilder({ inlinePayloads: true }).payloads(payloads).build()
20
+ }
21
+
22
+ const issueQuery = async (query: XyoBoundWitness = getQuery()): Promise<string> => {
23
+ const api = new XyoArchivistApi(config)
24
+ const response = await api.node('temp').post(query)
25
+ const id = response?.[0]?.[0]
26
+ expect(id).toBeDefined()
27
+ return assertEx(id)
28
+ }
29
+
30
+ const validateAllResponseSchemas = (response: XyoApiEnvelope<XyoPayload | undefined>[][]): boolean => {
31
+ return response
32
+ .flatMap((r) => r)
33
+ .map((r) => (r as unknown as XyoPayload)?.schema)
34
+ .every((s) => s === schema)
35
+ }
36
+
37
+ describe('XyoArchivistNodeApi', () => {
38
+ describe('node', () => {
39
+ describe('without archive supplied', () => {
40
+ it('calculates the correct path', () => {
41
+ const api = new XyoArchivistApi(config)
42
+ const path = api.node().config.root
43
+ expect(path).toBe('/temp/')
44
+ })
45
+ })
46
+ describe('with archive supplied', () => {
47
+ const archive = 'foo'
48
+ it('calculates the correct path', () => {
49
+ const api = new XyoArchivistApi(config)
50
+ const path = api.node(archive).config.root
51
+ expect(path).toBe(`/${archive}/`)
52
+ })
53
+ })
54
+ })
55
+ describe('queryResult', () => {
56
+ let id = '123456789'
57
+ describe('with valid query id', () => {
58
+ beforeEach(async () => {
59
+ id = await issueQuery()
60
+ })
61
+ it('returns the query result', async () => {
62
+ const api = new XyoArchivistApi(config)
63
+ await delay(1000)
64
+ const [_, payload, response] = await api.node().result(id).get('tuple')
65
+ expect(_).toBeUndefined()
66
+ expect(payload).toBeDefined()
67
+ expect((payload as unknown as XyoPayload).schema).toBe(schema)
68
+ expect(response.status).toBe(200)
69
+ })
70
+ })
71
+ describe('without archive supplied', () => {
72
+ it('calculates the correct path', () => {
73
+ const api = new XyoArchivistApi(config)
74
+ const path = api.node().result(id).config.root
75
+ expect(path).toBe(`/query/${id}/`)
76
+ })
77
+ })
78
+ describe('with archive supplied', () => {
79
+ const archive = 'foo'
80
+ it('calculates the correct path', () => {
81
+ const api = new XyoArchivistApi(config)
82
+ const path = api.node(archive).result(id).config.root
83
+ expect(path).toBe(`/query/${id}/`)
84
+ })
85
+ })
86
+ })
87
+ describe('perform', () => {
88
+ describe('with a single BoundWitness', () => {
89
+ describe('with a single Payload', () => {
90
+ it('issues the query and returns the result', async () => {
91
+ const api = new XyoArchivistApi(config)
92
+ const query = [getQuery()]
93
+ const response = await api.node().perform(query)
94
+ expect(response).toBeDefined()
95
+ expect(Array.isArray(response)).toBeTruthy()
96
+ expect(validateAllResponseSchemas(response)).toBeTruthy()
97
+ })
98
+ })
99
+ describe('with a multiple Payloads', () => {
100
+ it('issues the query and returns the result', async () => {
101
+ const api = new XyoArchivistApi(config)
102
+ const query = [getQuery(2)]
103
+ const response = await api.node().perform(query)
104
+ expect(response).toBeDefined()
105
+ expect(Array.isArray(response)).toBeTruthy()
106
+ expect(validateAllResponseSchemas(response)).toBeTruthy()
107
+ })
108
+ })
109
+ })
110
+ describe('with a multiple BoundWitnesses', () => {
111
+ describe('with a single Payload', () => {
112
+ it('issues the query and returns the result', async () => {
113
+ const api = new XyoArchivistApi(config)
114
+ const query = [getQuery(), getQuery()]
115
+ const response = await api.node().perform(query)
116
+ expect(response).toBeDefined()
117
+ expect(Array.isArray(response)).toBeTruthy()
118
+ expect(validateAllResponseSchemas(response)).toBeTruthy()
119
+ })
120
+ })
121
+ describe('with a multiple Payloads', () => {
122
+ it('issues the query and returns the result', async () => {
123
+ const api = new XyoArchivistApi(config)
124
+ const query = [getQuery(2), getQuery(2)]
125
+ const response = await api.node().perform(query)
126
+ expect(response).toBeDefined()
127
+ expect(Array.isArray(response)).toBeTruthy()
128
+ expect(validateAllResponseSchemas(response)).toBeTruthy()
129
+ })
130
+ })
131
+ })
132
+ })
133
+ })
@@ -0,0 +1,61 @@
1
+ import { assertEx, delay } from '@xylabs/sdk-js'
2
+ import { XyoBoundWitness, XyoPayload } from '@xyo-network/core'
3
+
4
+ import { XyoApiConfig, XyoApiResponseTuple } from '../../models'
5
+ import { XyoApiSimple, XyoApiSimpleQuery } from '../../Simple'
6
+ import { WithArchive } from '../../WithArchive'
7
+
8
+ const getRequestStatuses = (results: XyoApiResponseTuple<XyoPayload>[][]): number[] => {
9
+ return results.flatMap((r) => r).map((r) => r?.[2]?.status)
10
+ }
11
+
12
+ const allRequestsSucceeded = (results: XyoApiResponseTuple<XyoPayload>[][]): boolean => {
13
+ return getRequestStatuses(results).every((status) => status === 200)
14
+ }
15
+
16
+ const anyRequestsFailed = (results: XyoApiResponseTuple<XyoPayload>[][]): boolean => {
17
+ return getRequestStatuses(results).every((status) => status > 399)
18
+ }
19
+
20
+ export class XyoArchivistNodeApi<
21
+ D extends XyoBoundWitness | XyoBoundWitness[] = XyoBoundWitness | XyoBoundWitness[],
22
+ C extends WithArchive<XyoApiConfig> = WithArchive<XyoApiConfig>
23
+ > extends XyoApiSimple<string[][], D, XyoApiSimpleQuery, C> {
24
+ /**
25
+ * Get the result of a previously issued query (if available)
26
+ * @param queryId Query ID from a previously issued query
27
+ * @returns The result of the query (if available)
28
+ */
29
+ public result<T extends XyoPayload = XyoPayload>(queryId: string): XyoApiSimple<XyoPayload> {
30
+ return new XyoApiSimple<T>({
31
+ ...this.config,
32
+ root: `/query/${queryId}/`,
33
+ })
34
+ }
35
+
36
+ /**
37
+ * Issue the supplied queries and wait (non-blocking) for the results
38
+ * @param data The queries to issue
39
+ * @param timeout
40
+ * @param retryInterval
41
+ * @returns The results for the issued queries
42
+ */
43
+ public async perform(data: D, timeout = 5000, retryInterval = 100) {
44
+ assertEx(timeout > 0, 'timeout must be positive')
45
+ assertEx(retryInterval > 0, 'retryInterval must be positive')
46
+ assertEx(timeout > retryInterval, 'timeout must be greater than retryInterval')
47
+ const ids = await this.post(data)
48
+ if (!ids?.length) return []
49
+ const loops = Math.floor(timeout / retryInterval)
50
+ let results = [] as XyoApiResponseTuple<XyoPayload>[][]
51
+ for (let i = 0; i < loops; i++) {
52
+ await delay(retryInterval)
53
+ results = await Promise.all(ids?.map(async (bw) => await Promise.all(bw.map((p) => this.result(p).get('tuple')))))
54
+ if (allRequestsSucceeded(results)) break
55
+ // TODO: More nuanced error handling of partial success/failure
56
+ if (anyRequestsFailed(results)) throw new Error('Request Error')
57
+ }
58
+ // Unpack results
59
+ return results.map((b) => b.map((p) => p[1]))
60
+ }
61
+ }
@@ -0,0 +1 @@
1
+ export * from './Api'