@xyo-network/api 2.99.2 → 2.99.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. package/dist/neutral/Api/Api.d.cts +12 -0
  2. package/dist/neutral/Api/Api.d.cts.map +1 -0
  3. package/dist/neutral/Api/Api.d.mts +12 -0
  4. package/dist/neutral/Api/Api.d.mts.map +1 -0
  5. package/dist/neutral/Api/Api.d.ts +12 -0
  6. package/dist/neutral/Api/Api.d.ts.map +1 -0
  7. package/dist/neutral/Api/index.d.cts +2 -0
  8. package/dist/neutral/Api/index.d.cts.map +1 -0
  9. package/dist/neutral/Api/index.d.mts +2 -0
  10. package/dist/neutral/Api/index.d.mts.map +1 -0
  11. package/dist/neutral/Api/index.d.ts +2 -0
  12. package/dist/neutral/Api/index.d.ts.map +1 -0
  13. package/dist/neutral/Base.d.cts +32 -0
  14. package/dist/neutral/Base.d.cts.map +1 -0
  15. package/dist/neutral/Base.d.mts +32 -0
  16. package/dist/neutral/Base.d.mts.map +1 -0
  17. package/dist/neutral/Base.d.ts +32 -0
  18. package/dist/neutral/Base.d.ts.map +1 -0
  19. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApi.d.cts +12 -0
  20. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApi.d.cts.map +1 -0
  21. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApi.d.mts +12 -0
  22. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApi.d.mts.map +1 -0
  23. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApi.d.ts +12 -0
  24. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApi.d.ts.map +1 -0
  25. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.cts +10 -0
  26. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.cts.map +1 -0
  27. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts +10 -0
  28. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts.map +1 -0
  29. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts +10 -0
  30. package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts.map +1 -0
  31. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.cts +5 -0
  32. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.cts.map +1 -0
  33. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.mts +5 -0
  34. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.mts.map +1 -0
  35. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts +5 -0
  36. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts.map +1 -0
  37. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.cts +12 -0
  38. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.cts.map +1 -0
  39. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.mts +12 -0
  40. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.mts.map +1 -0
  41. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts +12 -0
  42. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts.map +1 -0
  43. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.cts +3 -0
  44. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.cts.map +1 -0
  45. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.mts +3 -0
  46. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.mts.map +1 -0
  47. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts +3 -0
  48. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts.map +1 -0
  49. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.cts +12 -0
  50. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.cts.map +1 -0
  51. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.mts +12 -0
  52. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.mts.map +1 -0
  53. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts +12 -0
  54. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts.map +1 -0
  55. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.cts +2 -0
  56. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.cts.map +1 -0
  57. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.mts +2 -0
  58. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.mts.map +1 -0
  59. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts +2 -0
  60. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts.map +1 -0
  61. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.cts +18 -0
  62. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.cts.map +1 -0
  63. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.mts +18 -0
  64. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.mts.map +1 -0
  65. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +18 -0
  66. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +1 -0
  67. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.cts +5 -0
  68. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.cts.map +1 -0
  69. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.mts +5 -0
  70. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.mts.map +1 -0
  71. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts +5 -0
  72. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts.map +1 -0
  73. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.cts +6 -0
  74. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.cts.map +1 -0
  75. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.mts +6 -0
  76. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.mts.map +1 -0
  77. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts +6 -0
  78. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts.map +1 -0
  79. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.cts +8 -0
  80. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.cts.map +1 -0
  81. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.mts +8 -0
  82. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.mts.map +1 -0
  83. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts +8 -0
  84. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts.map +1 -0
  85. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.cts +12 -0
  86. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.cts.map +1 -0
  87. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.mts +12 -0
  88. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.mts.map +1 -0
  89. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts +12 -0
  90. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts.map +1 -0
  91. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.cts +3 -0
  92. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.cts.map +1 -0
  93. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.mts +3 -0
  94. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.mts.map +1 -0
  95. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts +3 -0
  96. package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts.map +1 -0
  97. package/dist/neutral/Diviner/LocationDiviner/Queries/index.d.cts +7 -0
  98. package/dist/neutral/Diviner/LocationDiviner/Queries/index.d.cts.map +1 -0
  99. package/dist/neutral/Diviner/LocationDiviner/Queries/index.d.mts +7 -0
  100. package/dist/neutral/Diviner/LocationDiviner/Queries/index.d.mts.map +1 -0
  101. package/dist/neutral/Diviner/LocationDiviner/Queries/index.d.ts +7 -0
  102. package/dist/neutral/Diviner/LocationDiviner/Queries/index.d.ts.map +1 -0
  103. package/dist/neutral/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.cts +13 -0
  104. package/dist/neutral/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.cts.map +1 -0
  105. package/dist/neutral/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.mts +13 -0
  106. package/dist/neutral/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.mts.map +1 -0
  107. package/dist/neutral/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts +13 -0
  108. package/dist/neutral/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts.map +1 -0
  109. package/dist/neutral/Diviner/LocationDiviner/Witnesses/LocationWitness.d.cts +21 -0
  110. package/dist/neutral/Diviner/LocationDiviner/Witnesses/LocationWitness.d.cts.map +1 -0
  111. package/dist/neutral/Diviner/LocationDiviner/Witnesses/LocationWitness.d.mts +21 -0
  112. package/dist/neutral/Diviner/LocationDiviner/Witnesses/LocationWitness.d.mts.map +1 -0
  113. package/dist/neutral/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts +21 -0
  114. package/dist/neutral/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts.map +1 -0
  115. package/dist/neutral/Diviner/LocationDiviner/Witnesses/index.d.cts +3 -0
  116. package/dist/neutral/Diviner/LocationDiviner/Witnesses/index.d.cts.map +1 -0
  117. package/dist/neutral/Diviner/LocationDiviner/Witnesses/index.d.mts +3 -0
  118. package/dist/neutral/Diviner/LocationDiviner/Witnesses/index.d.mts.map +1 -0
  119. package/dist/neutral/Diviner/LocationDiviner/Witnesses/index.d.ts +3 -0
  120. package/dist/neutral/Diviner/LocationDiviner/Witnesses/index.d.ts.map +1 -0
  121. package/dist/neutral/Diviner/LocationDiviner/index.d.cts +5 -0
  122. package/dist/neutral/Diviner/LocationDiviner/index.d.cts.map +1 -0
  123. package/dist/neutral/Diviner/LocationDiviner/index.d.mts +5 -0
  124. package/dist/neutral/Diviner/LocationDiviner/index.d.mts.map +1 -0
  125. package/dist/neutral/Diviner/LocationDiviner/index.d.ts +5 -0
  126. package/dist/neutral/Diviner/LocationDiviner/index.d.ts.map +1 -0
  127. package/dist/neutral/Diviner/LocationDiviner/models.d.cts +5 -0
  128. package/dist/neutral/Diviner/LocationDiviner/models.d.cts.map +1 -0
  129. package/dist/neutral/Diviner/LocationDiviner/models.d.mts +5 -0
  130. package/dist/neutral/Diviner/LocationDiviner/models.d.mts.map +1 -0
  131. package/dist/neutral/Diviner/LocationDiviner/models.d.ts +5 -0
  132. package/dist/neutral/Diviner/LocationDiviner/models.d.ts.map +1 -0
  133. package/dist/neutral/Diviner/RemoteDivinerConfig.d.cts +11 -0
  134. package/dist/neutral/Diviner/RemoteDivinerConfig.d.cts.map +1 -0
  135. package/dist/neutral/Diviner/RemoteDivinerConfig.d.mts +11 -0
  136. package/dist/neutral/Diviner/RemoteDivinerConfig.d.mts.map +1 -0
  137. package/dist/neutral/Diviner/RemoteDivinerConfig.d.ts +11 -0
  138. package/dist/neutral/Diviner/RemoteDivinerConfig.d.ts.map +1 -0
  139. package/dist/neutral/Diviner/RemoteDivinerError.d.cts +6 -0
  140. package/dist/neutral/Diviner/RemoteDivinerError.d.cts.map +1 -0
  141. package/dist/neutral/Diviner/RemoteDivinerError.d.mts +6 -0
  142. package/dist/neutral/Diviner/RemoteDivinerError.d.mts.map +1 -0
  143. package/dist/neutral/Diviner/RemoteDivinerError.d.ts +6 -0
  144. package/dist/neutral/Diviner/RemoteDivinerError.d.ts.map +1 -0
  145. package/dist/neutral/Diviner/index.d.cts +3 -0
  146. package/dist/neutral/Diviner/index.d.cts.map +1 -0
  147. package/dist/neutral/Diviner/index.d.mts +3 -0
  148. package/dist/neutral/Diviner/index.d.mts.map +1 -0
  149. package/dist/neutral/Diviner/index.d.ts +3 -0
  150. package/dist/neutral/Diviner/index.d.ts.map +1 -0
  151. package/dist/neutral/Simple.d.cts +22 -0
  152. package/dist/neutral/Simple.d.cts.map +1 -0
  153. package/dist/neutral/Simple.d.mts +22 -0
  154. package/dist/neutral/Simple.d.mts.map +1 -0
  155. package/dist/neutral/Simple.d.ts +22 -0
  156. package/dist/neutral/Simple.d.ts.map +1 -0
  157. package/dist/neutral/Test/index.d.cts +3 -0
  158. package/dist/neutral/Test/index.d.cts.map +1 -0
  159. package/dist/neutral/Test/index.d.mts +3 -0
  160. package/dist/neutral/Test/index.d.mts.map +1 -0
  161. package/dist/neutral/Test/index.d.ts +3 -0
  162. package/dist/neutral/Test/index.d.ts.map +1 -0
  163. package/dist/neutral/Test/testBoundWitness.d.cts +4 -0
  164. package/dist/neutral/Test/testBoundWitness.d.cts.map +1 -0
  165. package/dist/neutral/Test/testBoundWitness.d.mts +4 -0
  166. package/dist/neutral/Test/testBoundWitness.d.mts.map +1 -0
  167. package/dist/neutral/Test/testBoundWitness.d.ts +4 -0
  168. package/dist/neutral/Test/testBoundWitness.d.ts.map +1 -0
  169. package/dist/neutral/Test/testPayload.d.cts +6 -0
  170. package/dist/neutral/Test/testPayload.d.cts.map +1 -0
  171. package/dist/neutral/Test/testPayload.d.mts +6 -0
  172. package/dist/neutral/Test/testPayload.d.mts.map +1 -0
  173. package/dist/neutral/Test/testPayload.d.ts +6 -0
  174. package/dist/neutral/Test/testPayload.d.ts.map +1 -0
  175. package/dist/neutral/WithArchive.d.cts +4 -0
  176. package/dist/neutral/WithArchive.d.cts.map +1 -0
  177. package/dist/neutral/WithArchive.d.mts +4 -0
  178. package/dist/neutral/WithArchive.d.mts.map +1 -0
  179. package/dist/neutral/WithArchive.d.ts +4 -0
  180. package/dist/neutral/WithArchive.d.ts.map +1 -0
  181. package/dist/neutral/index.cjs +316 -0
  182. package/dist/neutral/index.cjs.map +1 -0
  183. package/dist/neutral/index.d.cts +7 -0
  184. package/dist/neutral/index.d.cts.map +1 -0
  185. package/dist/neutral/index.d.mts +7 -0
  186. package/dist/neutral/index.d.mts.map +1 -0
  187. package/dist/neutral/index.d.ts +7 -0
  188. package/dist/neutral/index.d.ts.map +1 -0
  189. package/dist/neutral/index.js +295 -0
  190. package/dist/neutral/index.js.map +1 -0
  191. package/dist/neutral/models/ArchivePath.d.cts +4 -0
  192. package/dist/neutral/models/ArchivePath.d.cts.map +1 -0
  193. package/dist/neutral/models/ArchivePath.d.mts +4 -0
  194. package/dist/neutral/models/ArchivePath.d.mts.map +1 -0
  195. package/dist/neutral/models/ArchivePath.d.ts +4 -0
  196. package/dist/neutral/models/ArchivePath.d.ts.map +1 -0
  197. package/dist/neutral/models/index.d.cts +2 -0
  198. package/dist/neutral/models/index.d.cts.map +1 -0
  199. package/dist/neutral/models/index.d.mts +2 -0
  200. package/dist/neutral/models/index.d.mts.map +1 -0
  201. package/dist/neutral/models/index.d.ts +2 -0
  202. package/dist/neutral/models/index.d.ts.map +1 -0
  203. package/dist/neutral/objToQuery.d.cts +2 -0
  204. package/dist/neutral/objToQuery.d.cts.map +1 -0
  205. package/dist/neutral/objToQuery.d.mts +2 -0
  206. package/dist/neutral/objToQuery.d.mts.map +1 -0
  207. package/dist/neutral/objToQuery.d.ts +2 -0
  208. package/dist/neutral/objToQuery.d.ts.map +1 -0
  209. package/package.json +13 -13
@@ -0,0 +1,295 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
+
4
+ // src/Api/Api.ts
5
+ import { Huri } from "@xyo-network/huri";
6
+
7
+ // src/Base.ts
8
+ import { AxiosJson } from "@xylabs/axios";
9
+ var ApiBase = class _ApiBase {
10
+ static {
11
+ __name(this, "ApiBase");
12
+ }
13
+ config;
14
+ axios;
15
+ constructor(config) {
16
+ this.config = config;
17
+ this.axios = new AxiosJson({
18
+ ...this.config,
19
+ headers: this.headers
20
+ });
21
+ }
22
+ get authenticated() {
23
+ return !!this.config.apiKey || !!this.config.jwtToken;
24
+ }
25
+ get headers() {
26
+ const headers = {};
27
+ if (this.config.jwtToken) {
28
+ headers.Authorization = `Bearer ${this.config.jwtToken}`;
29
+ }
30
+ if (this.config.apiKey) {
31
+ headers["x-api-key"] = this.config.apiKey;
32
+ }
33
+ return headers;
34
+ }
35
+ get query() {
36
+ return this.config.query ?? "";
37
+ }
38
+ get root() {
39
+ return this.config.root ?? "/";
40
+ }
41
+ static resolveResponse(result) {
42
+ return [
43
+ result?.data?.data,
44
+ result?.data,
45
+ result
46
+ ];
47
+ }
48
+ static shapeResponse(response, responseType) {
49
+ const resolvedResponse = _ApiBase.resolveResponse(response);
50
+ return responseType === "tuple" ? resolvedResponse : resolvedResponse[0];
51
+ }
52
+ onError(error, depth = 0) {
53
+ this.config.reportableParent?.onError?.(error, depth + 1);
54
+ this.config.onError?.(error, depth);
55
+ }
56
+ onFailure(response, depth = 0) {
57
+ this.config.reportableParent?.onFailure?.(response, depth + 1);
58
+ this.config.onFailure?.(response, depth);
59
+ }
60
+ onSuccess(response, depth = 0) {
61
+ this.config.reportableParent?.onSuccess?.(response, depth + 1);
62
+ this.config.onSuccess?.(response, depth);
63
+ }
64
+ async deleteEndpoint(endPoint = "", responseType) {
65
+ const response = await this.monitorResponse(async () => {
66
+ return await this.axios.delete(`${this.resolveRoot()}${endPoint}${this.query}`);
67
+ });
68
+ return _ApiBase.shapeResponse(response, responseType);
69
+ }
70
+ async getEndpoint(endPoint = "", responseType) {
71
+ const response = await this.monitorResponse(async () => {
72
+ return await this.axios.get(`${this.resolveRoot()}${endPoint}${this.query}`);
73
+ });
74
+ return _ApiBase.shapeResponse(response, responseType);
75
+ }
76
+ handleMonitorResponseError(error, trapAxiosException) {
77
+ if (!error.isError) {
78
+ throw error;
79
+ }
80
+ if (trapAxiosException) {
81
+ error.response ? this.onFailure(error.response) : this.onError(error);
82
+ if (this.config.throwFailure) {
83
+ throw error;
84
+ }
85
+ return error.response;
86
+ }
87
+ }
88
+ async monitorResponse(closure) {
89
+ let trapAxiosException = true;
90
+ try {
91
+ const response = await closure();
92
+ trapAxiosException = false;
93
+ response.status < 300 ? this.onSuccess(response) : this.onFailure(response);
94
+ return response;
95
+ } catch (error) {
96
+ this.handleMonitorResponseError(error, trapAxiosException);
97
+ }
98
+ }
99
+ async postEndpoint(endPoint = "", data, responseType) {
100
+ const response = await this.monitorResponse(async () => {
101
+ return await this.axios.post(`${this.resolveRoot()}${endPoint}${this.query}`, data);
102
+ });
103
+ return _ApiBase.shapeResponse(response, responseType);
104
+ }
105
+ async putEndpoint(endPoint = "", data, responseType) {
106
+ const response = await this.monitorResponse(async () => {
107
+ return await this.axios.put(`${this.resolveRoot()}${endPoint}${this.query}`, data);
108
+ });
109
+ return _ApiBase.shapeResponse(response, responseType);
110
+ }
111
+ resolveRoot() {
112
+ return `${this.config.apiDomain}${this.root}`;
113
+ }
114
+ };
115
+
116
+ // src/objToQuery.ts
117
+ var objToQuery = /* @__PURE__ */ __name((obj) => {
118
+ return `?${Object.entries(obj).map(([key, value]) => {
119
+ return `${key}=${value}`;
120
+ }).filter((value) => value !== void 0).join("&")}`;
121
+ }, "objToQuery");
122
+
123
+ // src/Simple.ts
124
+ var ApiSimple = class extends ApiBase {
125
+ static {
126
+ __name(this, "ApiSimple");
127
+ }
128
+ async delete(responseType) {
129
+ switch (responseType) {
130
+ case "tuple": {
131
+ return await this.deleteEndpoint(void 0, "tuple");
132
+ }
133
+ default: {
134
+ return await this.deleteEndpoint();
135
+ }
136
+ }
137
+ }
138
+ async find(query = {}, responseType) {
139
+ switch (responseType) {
140
+ case "tuple": {
141
+ return await this.getEndpoint(objToQuery(query), "tuple");
142
+ }
143
+ default: {
144
+ return await this.getEndpoint(objToQuery(query));
145
+ }
146
+ }
147
+ }
148
+ async get(responseType) {
149
+ switch (responseType) {
150
+ case "tuple": {
151
+ return await this.getEndpoint(void 0, "tuple");
152
+ }
153
+ default: {
154
+ return await this.getEndpoint();
155
+ }
156
+ }
157
+ }
158
+ async post(data, responseType) {
159
+ switch (responseType) {
160
+ case "tuple": {
161
+ return await this.postEndpoint(void 0, data, "tuple");
162
+ }
163
+ default: {
164
+ return await this.postEndpoint(void 0, data);
165
+ }
166
+ }
167
+ }
168
+ async put(data, responseType) {
169
+ switch (responseType) {
170
+ case "tuple": {
171
+ return await this.putEndpoint(void 0, data, "tuple");
172
+ }
173
+ default: {
174
+ return await this.putEndpoint(void 0, data);
175
+ }
176
+ }
177
+ }
178
+ };
179
+
180
+ // src/Api/Api.ts
181
+ var ArchivistApi = class extends ApiSimple {
182
+ static {
183
+ __name(this, "ArchivistApi");
184
+ }
185
+ huri(huri) {
186
+ const huriObj = typeof huri === "string" ? new Huri(huri) : huri;
187
+ return new ApiSimple({
188
+ ...this.config,
189
+ root: `${this.root}${huriObj.href}/`
190
+ });
191
+ }
192
+ };
193
+
194
+ // src/Diviner/LocationDiviner/LocationDivinerApi.ts
195
+ import { axios as axios2 } from "@xylabs/axios";
196
+
197
+ // src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts
198
+ import { axios } from "@xylabs/axios";
199
+ var locationDivinerApiResponseTransformer = /* @__PURE__ */ __name((data, _headers) => {
200
+ return data.data;
201
+ }, "locationDivinerApiResponseTransformer");
202
+ var getLocationDivinerApiResponseTransformer = /* @__PURE__ */ __name((axiosInstance = axios) => {
203
+ return axiosInstance.defaults.transformResponse ? [
204
+ ...Array.isArray(axiosInstance.defaults.transformResponse) ? axiosInstance.defaults.transformResponse : [
205
+ axiosInstance.defaults.transformResponse
206
+ ],
207
+ locationDivinerApiResponseTransformer
208
+ ] : [
209
+ locationDivinerApiResponseTransformer
210
+ ];
211
+ }, "getLocationDivinerApiResponseTransformer");
212
+
213
+ // src/Diviner/LocationDiviner/LocationDivinerApi.ts
214
+ var LocationDivinerApi = class LocationDivinerApi2 {
215
+ static {
216
+ __name(this, "LocationDivinerApi");
217
+ }
218
+ config;
219
+ constructor(config) {
220
+ this.config = config;
221
+ }
222
+ get axiosRequestConfig() {
223
+ return {
224
+ transformResponse: getLocationDivinerApiResponseTransformer()
225
+ };
226
+ }
227
+ async getLocationQuery(hash) {
228
+ return (await axios2.get(`${this.config.apiDomain}/location/query/${hash}`, this.axiosRequestConfig)).data;
229
+ }
230
+ async postLocationQuery(request) {
231
+ return (await axios2.post(`${this.config.apiDomain}/location/query`, {
232
+ ...request
233
+ }, this.axiosRequestConfig)).data;
234
+ }
235
+ };
236
+
237
+ // src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.ts
238
+ var locationHeatmapQuerySchema = "network.xyo.location.heatmap.query";
239
+ var locationHeatmapAnswerSchema = "network.xyo.location.heatmap.answer";
240
+ var isLocationHeatmapQuery = /* @__PURE__ */ __name((query) => {
241
+ return query && query?.schema === locationHeatmapQuerySchema;
242
+ }, "isLocationHeatmapQuery");
243
+
244
+ // src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.ts
245
+ var locationQuadkeyHeatmapQuerySchema = "network.xyo.location.heatmap.quadkey.query";
246
+ var locationQuadkeyHeatmapAnswerSchema = "network.xyo.location.heatmap.quadkey.answer";
247
+ var isLocationQuadkeyHeatmapQuery = /* @__PURE__ */ __name((query) => {
248
+ return query && query?.schema === locationQuadkeyHeatmapQuerySchema;
249
+ }, "isLocationQuadkeyHeatmapQuery");
250
+
251
+ // src/Diviner/LocationDiviner/Queries/LocationQuerySchema.ts
252
+ var locationQuerySchemas = {
253
+ "network.xyo.location.heatmap.quadkey.query": true,
254
+ "network.xyo.location.heatmap.query": true,
255
+ "network.xyo.location.range.query": true
256
+ };
257
+ var isSupportedLocationQuerySchema = /* @__PURE__ */ __name((schema) => {
258
+ return locationQuerySchemas[schema] || false;
259
+ }, "isSupportedLocationQuerySchema");
260
+
261
+ // src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.ts
262
+ var LocationTimeRangeQuerySchema = "network.xyo.location.range.query";
263
+ var LocationTimeRangeAnswerSchema = "network.xyo.location.range.answer";
264
+ var isLocationTimeRangeQuery = /* @__PURE__ */ __name((query) => {
265
+ return query && query?.schema === LocationTimeRangeAnswerSchema;
266
+ }, "isLocationTimeRangeQuery");
267
+
268
+ // src/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.ts
269
+ var CurrentLocationWitnessSchema = "co.coinapp.currentlocationwitness";
270
+
271
+ // src/Diviner/LocationDiviner/Witnesses/LocationWitness.ts
272
+ var LocationWitnessSchema = "network.xyo.location";
273
+
274
+ // src/Diviner/RemoteDivinerConfig.ts
275
+ var RemoteDivinerConfigSchema = "network.xyo.diviner.remote.config";
276
+ export {
277
+ ApiBase,
278
+ ApiSimple,
279
+ ArchivistApi,
280
+ CurrentLocationWitnessSchema,
281
+ LocationDivinerApi,
282
+ LocationTimeRangeAnswerSchema,
283
+ LocationTimeRangeQuerySchema,
284
+ LocationWitnessSchema,
285
+ RemoteDivinerConfigSchema,
286
+ isLocationHeatmapQuery,
287
+ isLocationQuadkeyHeatmapQuery,
288
+ isLocationTimeRangeQuery,
289
+ isSupportedLocationQuerySchema,
290
+ locationHeatmapAnswerSchema,
291
+ locationHeatmapQuerySchema,
292
+ locationQuadkeyHeatmapAnswerSchema,
293
+ locationQuadkeyHeatmapQuerySchema
294
+ };
295
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Api/Api.ts","../../src/Base.ts","../../src/objToQuery.ts","../../src/Simple.ts","../../src/Diviner/LocationDiviner/LocationDivinerApi.ts","../../src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts","../../src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.ts","../../src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.ts","../../src/Diviner/LocationDiviner/Queries/LocationQuerySchema.ts","../../src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.ts","../../src/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.ts","../../src/Diviner/LocationDiviner/Witnesses/LocationWitness.ts","../../src/Diviner/RemoteDivinerConfig.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 { AxiosJson } from '@xylabs/axios'\nimport {\n ApiConfig,\n ApiEnvelope,\n ApiError,\n ApiReportable,\n ApiResponse,\n ApiResponseBody,\n ApiResponseTuple,\n ApiResponseTupleOrBody,\n ApiResponseType,\n} from '@xyo-network/api-models'\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 (error) {\n this.handleMonitorResponseError(error 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 }\n default: {\n return await this.deleteEndpoint()\n }\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 }\n default: {\n return await this.getEndpoint(objToQuery(query))\n }\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 }\n default: {\n return await this.getEndpoint()\n }\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 }\n default: {\n return await this.postEndpoint(undefined, data)\n }\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 }\n default: {\n return await this.putEndpoint(undefined, data)\n }\n }\n }\n}\n","import { axios, RawAxiosRequestConfig } from '@xylabs/axios'\nimport { ApiConfig } from '@xyo-network/api-models'\n\nimport { getLocationDivinerApiResponseTransformer } from './LocationDivinerApiResponseTransformer'\nimport { GetLocationQueryResponse } from './models'\nimport { LocationQueryCreationResponse, SupportedLocationQueryCreationRequest } from './Queries'\n\nclass LocationDivinerApi {\n config: ApiConfig\n constructor(config: ApiConfig) {\n this.config = config\n }\n\n private get axiosRequestConfig(): RawAxiosRequestConfig {\n return {\n transformResponse: getLocationDivinerApiResponseTransformer(),\n }\n }\n\n async getLocationQuery(hash: string) {\n return (await axios.get<GetLocationQueryResponse>(`${this.config.apiDomain}/location/query/${hash}`, this.axiosRequestConfig)).data\n }\n\n async postLocationQuery(request: SupportedLocationQueryCreationRequest) {\n return (await axios.post<LocationQueryCreationResponse>(`${this.config.apiDomain}/location/query`, { ...request }, this.axiosRequestConfig)).data\n }\n}\n\nexport { LocationDivinerApi }\n","import { axios, AxiosResponseTransformer } from '@xylabs/axios'\n\nexport const locationDivinerApiResponseTransformer: AxiosResponseTransformer = (data, _headers) => {\n return data.data\n}\n\n/**\n * Gets the response transformers for the LocationDiviner API. Done as a method instead of a property\n * to allow detection of dynamically added response transformers.\n * @param axiosInstance The axios instance (defaults to the global instance if none provided)\n * @returns the response transformers for the LocationDiviner API\n */\nexport const getLocationDivinerApiResponseTransformer = (axiosInstance = axios): AxiosResponseTransformer[] => {\n // If there's any existing response transforms preserve them and\n // append our response transform, otherwise just return ours\n return axiosInstance.defaults.transformResponse ?\n [\n ...(Array.isArray(axiosInstance.defaults.transformResponse) ?\n axiosInstance.defaults.transformResponse\n : [axiosInstance.defaults.transformResponse]),\n locationDivinerApiResponseTransformer,\n ]\n : [locationDivinerApiResponseTransformer]\n}\n","import { LocationWitnessSchema } from '../../Witnesses'\n\nexport type LocationHeatmapQuerySchema = 'network.xyo.location.heatmap.query'\nexport const locationHeatmapQuerySchema: LocationHeatmapQuerySchema = 'network.xyo.location.heatmap.query'\n\nexport type LocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\nexport const locationHeatmapAnswerSchema: LocationHeatmapAnswerSchema = 'network.xyo.location.heatmap.answer'\n\nexport type LocationHeatmapQuery = {\n schema: LocationWitnessSchema\n startTime?: string\n stopTime?: string\n}\n\nexport const isLocationHeatmapQuery = (query: Record<string, unknown>): query is LocationHeatmapQuery => {\n return query && query?.schema === locationHeatmapQuerySchema\n}\n","import { LocationWitnessSchema } from '../../Witnesses'\n\nexport type LocationQuadkeyHeatmapQuerySchema = 'network.xyo.location.heatmap.quadkey.query'\nexport const locationQuadkeyHeatmapQuerySchema: LocationQuadkeyHeatmapQuerySchema = 'network.xyo.location.heatmap.quadkey.query'\nexport type LocationQuadkeyHeatmapAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport const locationQuadkeyHeatmapAnswerSchema: LocationQuadkeyHeatmapAnswerSchema = 'network.xyo.location.heatmap.quadkey.answer'\nexport type LocationQuadkeyHeatmapQuery = {\n schema: LocationWitnessSchema\n startTime?: string\n stopTime?: string\n}\n\nexport const isLocationQuadkeyHeatmapQuery = (query: Record<string, unknown>): query is LocationQuadkeyHeatmapQuery => {\n return query && query?.schema === locationQuadkeyHeatmapQuerySchema\n}\n","import { LocationHeatmapQuerySchema } from './LocationHeatmapQuery'\nimport { LocationQuadkeyHeatmapQuerySchema } from './LocationQuadkeyHeatmapQuery'\nimport { LocationTimeRangeQuerySchema } from './LocationTimeRangeQuery'\n\nexport type LocationQuerySchema = LocationQuadkeyHeatmapQuerySchema | LocationHeatmapQuerySchema | LocationTimeRangeQuerySchema\n\nconst locationQuerySchemas: Record<LocationQuerySchema, true> = {\n 'network.xyo.location.heatmap.quadkey.query': true,\n 'network.xyo.location.heatmap.query': true,\n 'network.xyo.location.range.query': true,\n}\n\nexport const isSupportedLocationQuerySchema = (schema: string): schema is LocationQuerySchema => {\n return locationQuerySchemas[schema as LocationQuerySchema] || false\n}\n","import { LocationWitnessSchema } from '../../Witnesses'\n\nexport type LocationTimeRangeQuerySchema = 'network.xyo.location.range.query'\nexport const LocationTimeRangeQuerySchema: LocationTimeRangeQuerySchema = 'network.xyo.location.range.query'\n\nexport type LocationTimeRangeAnswerSchema = 'network.xyo.location.range.answer'\nexport const LocationTimeRangeAnswerSchema: LocationTimeRangeAnswerSchema = 'network.xyo.location.range.answer'\n\nexport type LocationTimeRangeQuery = {\n schema: LocationWitnessSchema\n startTime?: string\n stopTime?: string\n\n // TODO: Bounding rectangle, etc.\n}\n\nexport const isLocationTimeRangeQuery = (query: Record<string, unknown>): query is LocationTimeRangeQuery => {\n return query && query?.schema === LocationTimeRangeAnswerSchema\n}\n","import { Payload } from '@xyo-network/payload-model'\n\nexport type CurrentLocationWitnessSchema = 'co.coinapp.currentlocationwitness'\nexport const CurrentLocationWitnessSchema: CurrentLocationWitnessSchema = 'co.coinapp.currentlocationwitness'\n\nexport type CurrentLocationWitnessPayload = Payload<{\n altitudeMeters: number\n directionDegrees: number\n latitude: number\n longitude: number\n quadkey: string\n schema: CurrentLocationWitnessSchema\n speedKph: number\n}>\n","import { Payload } from '@xyo-network/payload-model'\n\nexport type LocationWitnessSchema = 'network.xyo.location'\nexport const LocationWitnessSchema: LocationWitnessSchema = 'network.xyo.location'\n\nexport interface Coordinates {\n accuracy: number | null\n altitude: number | null\n altitudeAccuracy: number | null\n heading: number | null\n latitude: number\n longitude: number\n speed: number | null\n}\nexport interface CurrentLocation {\n coords: Coordinates\n timestamp: number\n}\n\nexport type LocationWitnessPayload = Payload<{\n currentLocation: CurrentLocation\n schema: LocationWitnessSchema\n}>\n","import { DivinerConfig } from '@xyo-network/diviner-model'\n\nimport { ArchivistApi } from '../Api'\n\nexport type RemoteDivinerConfigSchema = 'network.xyo.diviner.remote.config'\nexport const RemoteDivinerConfigSchema: RemoteDivinerConfigSchema = 'network.xyo.diviner.remote.config'\n\nexport type RemoteDivinerConfig = DivinerConfig & {\n /** @deprecated use in params instead */\n api?: ArchivistApi\n archive?: string\n schema: RemoteDivinerConfigSchema\n}\n"],"mappings":";;;;AACA,SAASA,YAAY;;;ACDrB,SAASC,iBAAiB;AAanB,IAAMC,UAAN,MAAMA,SAAAA;EAbb,OAaaA;;;EACFC;EACCC;EAEVC,YAAYF,QAAW;AACrB,SAAKA,SAASA;AACd,SAAKC,QAAQ,IAAIE,UAAU;MAAE,GAAG,KAAKH;MAAQI,SAAS,KAAKA;IAAQ,CAAA;EACrE;EAEA,IAAIC,gBAAgB;AAClB,WAAO,CAAC,CAAC,KAAKL,OAAOM,UAAU,CAAC,CAAC,KAAKN,OAAOO;EAC/C;EAEA,IAAcH,UAAkC;AAC9C,UAAMA,UAAkC,CAAC;AACzC,QAAI,KAAKJ,OAAOO,UAAU;AACxBH,cAAQI,gBAAgB,UAAU,KAAKR,OAAOO,QAAQ;IACxD;AACA,QAAI,KAAKP,OAAOM,QAAQ;AAC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AG,KAAKV,kBAAkB,GAAGQ;EAC/I;AACF;;;AEvBO,IAAMI,6BAAyD;AAG/D,IAAMC,8BAA2D;AAQjE,IAAMC,yBAAyB,wBAACC,UAAAA;AACrC,SAAOA,SAASA,OAAOC,WAAWJ;AACpC,GAFsC;;;ACX/B,IAAMK,oCAAuE;AAE7E,IAAMC,qCAAyE;AAO/E,IAAMC,gCAAgC,wBAACC,UAAAA;AAC5C,SAAOA,SAASA,OAAOC,WAAWJ;AACpC,GAF6C;;;ACN7C,IAAMK,uBAA0D;EAC9D,8CAA8C;EAC9C,sCAAsC;EACtC,oCAAoC;AACtC;AAEO,IAAMC,iCAAiC,wBAACC,WAAAA;AAC7C,SAAOF,qBAAqBE,MAAAA,KAAkC;AAChE,GAF8C;;;ACTvC,IAAMC,+BAA6D;AAGnE,IAAMC,gCAA+D;AAUrE,IAAMC,2BAA2B,wBAACC,UAAAA;AACvC,SAAOA,SAASA,OAAOC,WAAWH;AACpC,GAFwC;;;ACbjC,IAAMI,+BAA6D;;;ACAnE,IAAMC,wBAA+C;;;ACErD,IAAMC,4BAAuD;","names":["Huri","AxiosJson","ApiBase","config","axios","constructor","AxiosJson","headers","authenticated","apiKey","jwtToken","Authorization","query","root","resolveResponse","result","data","shapeResponse","response","responseType","resolvedResponse","onError","error","depth","reportableParent","onFailure","onSuccess","deleteEndpoint","endPoint","monitorResponse","delete","resolveRoot","getEndpoint","get","handleMonitorResponseError","trapAxiosException","isError","throwFailure","closure","status","postEndpoint","post","putEndpoint","put","apiDomain","objToQuery","obj","Object","entries","map","key","value","filter","undefined","join","ApiSimple","ApiBase","delete","responseType","deleteEndpoint","undefined","find","query","getEndpoint","objToQuery","get","post","data","postEndpoint","put","putEndpoint","ArchivistApi","ApiSimple","huri","huriObj","Huri","config","root","href","axios","axios","locationDivinerApiResponseTransformer","data","_headers","getLocationDivinerApiResponseTransformer","axiosInstance","axios","defaults","transformResponse","Array","isArray","LocationDivinerApi","config","constructor","axiosRequestConfig","transformResponse","getLocationDivinerApiResponseTransformer","getLocationQuery","hash","axios","get","apiDomain","data","postLocationQuery","request","post","locationHeatmapQuerySchema","locationHeatmapAnswerSchema","isLocationHeatmapQuery","query","schema","locationQuadkeyHeatmapQuerySchema","locationQuadkeyHeatmapAnswerSchema","isLocationQuadkeyHeatmapQuery","query","schema","locationQuerySchemas","isSupportedLocationQuerySchema","schema","LocationTimeRangeQuerySchema","LocationTimeRangeAnswerSchema","isLocationTimeRangeQuery","query","schema","CurrentLocationWitnessSchema","LocationWitnessSchema","RemoteDivinerConfigSchema"]}
@@ -0,0 +1,4 @@
1
+ export interface ArchivePath {
2
+ archive: string;
3
+ }
4
+ //# sourceMappingURL=ArchivePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArchivePath.d.ts","sourceRoot":"","sources":["../../../src/models/ArchivePath.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,4 @@
1
+ export interface ArchivePath {
2
+ archive: string;
3
+ }
4
+ //# sourceMappingURL=ArchivePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArchivePath.d.ts","sourceRoot":"","sources":["../../../src/models/ArchivePath.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,4 @@
1
+ export interface ArchivePath {
2
+ archive: string;
3
+ }
4
+ //# sourceMappingURL=ArchivePath.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ArchivePath.d.ts","sourceRoot":"","sources":["../../../src/models/ArchivePath.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAA;CAChB"}
@@ -0,0 +1,2 @@
1
+ export * from './ArchivePath';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './ArchivePath';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from './ArchivePath';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const objToQuery: (obj: Record<string, string | number | undefined>) => string;
2
+ //# sourceMappingURL=objToQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objToQuery.d.ts","sourceRoot":"","sources":["../../src/objToQuery.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,QAAS,OAAO,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,WAO1E,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const objToQuery: (obj: Record<string, string | number | undefined>) => string;
2
+ //# sourceMappingURL=objToQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objToQuery.d.ts","sourceRoot":"","sources":["../../src/objToQuery.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,QAAS,OAAO,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,WAO1E,CAAA"}
@@ -0,0 +1,2 @@
1
+ export declare const objToQuery: (obj: Record<string, string | number | undefined>) => string;
2
+ //# sourceMappingURL=objToQuery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objToQuery.d.ts","sourceRoot":"","sources":["../../src/objToQuery.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,QAAS,OAAO,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,WAO1E,CAAA"}
package/package.json CHANGED
@@ -9,21 +9,21 @@
9
9
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
10
10
  },
11
11
  "dependencies": {
12
- "@xylabs/axios": "^3.1.11",
13
- "@xylabs/object": "^3.1.11",
14
- "@xyo-network/api-models": "~2.99.2",
15
- "@xyo-network/boundwitness-model": "~2.99.2",
16
- "@xyo-network/diviner-model": "~2.99.2",
17
- "@xyo-network/huri": "~2.99.2",
18
- "@xyo-network/payload-model": "~2.99.2"
12
+ "@xylabs/axios": "^3.3.2",
13
+ "@xylabs/object": "^3.3.2",
14
+ "@xyo-network/api-models": "~2.99.3",
15
+ "@xyo-network/boundwitness-model": "~2.99.3",
16
+ "@xyo-network/diviner-model": "~2.99.3",
17
+ "@xyo-network/huri": "~2.99.3",
18
+ "@xyo-network/payload-model": "~2.99.3"
19
19
  },
20
20
  "description": "Primary SDK for using XYO Protocol 2.0",
21
21
  "devDependencies": {
22
- "@xylabs/jest-helpers": "^3.1.11",
23
- "@xylabs/ts-scripts-yarn3": "^3.9.1",
24
- "@xylabs/tsconfig": "^3.9.1",
25
- "@xyo-network/address-payload-plugin": "~2.99.2",
26
- "@xyo-network/query-payload-plugin": "~2.99.2",
22
+ "@xylabs/jest-helpers": "^3.3.2",
23
+ "@xylabs/ts-scripts-yarn3": "^3.10.0",
24
+ "@xylabs/tsconfig": "^3.10.0",
25
+ "@xyo-network/address-payload-plugin": "~2.99.3",
26
+ "@xyo-network/query-payload-plugin": "~2.99.3",
27
27
  "jest": "^29.7.0",
28
28
  "typescript": "^5.4.5",
29
29
  "uuid": "^9.0.1"
@@ -67,6 +67,6 @@
67
67
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
68
68
  },
69
69
  "sideEffects": false,
70
- "version": "2.99.2",
70
+ "version": "2.99.3",
71
71
  "type": "module"
72
72
  }