@xyo-network/api 2.107.3 → 2.107.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,2 +1,316 @@
1
- "use strict";var c=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var n=(e,t)=>c(e,"name",{value:t,configurable:!0});var k=(e,t)=>{for(var o in t)c(e,o,{get:t[o],enumerable:!0})},q=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $(t))!E.call(e,s)&&s!==o&&c(e,s,{get:()=>t[s],enumerable:!(r=R(t,s))||r.enumerable});return e};var S=e=>q(c({},"__esModule",{value:!0}),e);var P={};k(P,{ApiBase:()=>a,ApiSimple:()=>i,ArchivistApi:()=>u,CurrentLocationWitnessSchema:()=>F,LocationDivinerApi:()=>Q,LocationTimeRangeAnswerSchema:()=>x,LocationTimeRangeQuerySchema:()=>b,LocationWitnessSchema:()=>C,RemoteDivinerConfigSchema:()=>K,isLocationHeatmapQuery:()=>L,isLocationQuadkeyHeatmapQuery:()=>T,isLocationTimeRangeQuery:()=>H,isSupportedLocationQuerySchema:()=>j,locationHeatmapAnswerSchema:()=>v,locationHeatmapQuerySchema:()=>w,locationQuadkeyHeatmapAnswerSchema:()=>A,locationQuadkeyHeatmapQuerySchema:()=>g});module.exports=S(P);var l=require("@xyo-network/huri");var f=require("@xylabs/axios");var a=class e{static{n(this,"ApiBase")}config;axios;constructor(t){this.config=t,this.axios=new f.AxiosJson({...this.config,headers:this.headers})}get authenticated(){return!!this.config.apiKey||!!this.config.jwtToken}get headers(){let t={};return this.config.jwtToken&&(t.Authorization=`Bearer ${this.config.jwtToken}`),this.config.apiKey&&(t["x-api-key"]=this.config.apiKey),t}get query(){return this.config.query??""}get root(){return this.config.root??"/"}static resolveResponse(t){return[t?.data?.data,t?.data,t]}static shapeResponse(t,o){let r=e.resolveResponse(t);return o==="tuple"?r:r[0]}onError(t,o=0){this.config.reportableParent?.onError?.(t,o+1),this.config.onError?.(t,o)}onFailure(t,o=0){this.config.reportableParent?.onFailure?.(t,o+1),this.config.onFailure?.(t,o)}onSuccess(t,o=0){this.config.reportableParent?.onSuccess?.(t,o+1),this.config.onSuccess?.(t,o)}async deleteEndpoint(t="",o){let r=await this.monitorResponse(async()=>await this.axios.delete(`${this.resolveRoot()}${t}${this.query}`));return e.shapeResponse(r,o)}async getEndpoint(t="",o){let r=await this.monitorResponse(async()=>await this.axios.get(`${this.resolveRoot()}${t}${this.query}`));return e.shapeResponse(r,o)}handleMonitorResponseError(t,o){if(!t.isError)throw t;if(o){if(t.response?this.onFailure(t.response):this.onError(t),this.config.throwFailure)throw t;return t.response}}async monitorResponse(t){let o=!0;try{let r=await t();return o=!1,r.status<300?this.onSuccess(r):this.onFailure(r),r}catch(r){this.handleMonitorResponseError(r,o)}}async postEndpoint(t="",o,r){let s=await this.monitorResponse(async()=>await this.axios.post(`${this.resolveRoot()}${t}${this.query}`,o));return e.shapeResponse(s,r)}async putEndpoint(t="",o,r){let s=await this.monitorResponse(async()=>await this.axios.put(`${this.resolveRoot()}${t}${this.query}`,o));return e.shapeResponse(s,r)}resolveRoot(){return`${this.config.apiDomain}${this.root}`}};var p=n(e=>`?${Object.entries(e).map(([t,o])=>`${t}=${o}`).filter(t=>t!==void 0).join("&")}`,"objToQuery");var i=class extends a{static{n(this,"ApiSimple")}async delete(t){switch(t){case"tuple":return await this.deleteEndpoint(void 0,"tuple");default:return await this.deleteEndpoint()}}async find(t={},o){switch(o){case"tuple":return await this.getEndpoint(p(t),"tuple");default:return await this.getEndpoint(p(t))}}async get(t){switch(t){case"tuple":return await this.getEndpoint(void 0,"tuple");default:return await this.getEndpoint()}}async post(t,o){switch(o){case"tuple":return await this.postEndpoint(void 0,t,"tuple");default:return await this.postEndpoint(void 0,t)}}async put(t,o){switch(o){case"tuple":return await this.putEndpoint(void 0,t,"tuple");default:return await this.putEndpoint(void 0,t)}}};var u=class extends i{static{n(this,"ArchivistApi")}huri(t){let o=typeof t=="string"?new l.Huri(t):t;return new i({...this.config,root:`${this.root}${o.href}/`})}};var h=require("@xylabs/axios");var d=require("@xylabs/axios");var m=n((e,t)=>e.data,"locationDivinerApiResponseTransformer"),y=n((e=d.axios)=>e.defaults.transformResponse?[...Array.isArray(e.defaults.transformResponse)?e.defaults.transformResponse:[e.defaults.transformResponse],m]:[m],"getLocationDivinerApiResponseTransformer");var Q=class{static{n(this,"LocationDivinerApi")}config;constructor(t){this.config=t}get axiosRequestConfig(){return{transformResponse:y()}}async getLocationQuery(t){return(await h.axios.get(`${this.config.apiDomain}/location/query/${t}`,this.axiosRequestConfig)).data}async postLocationQuery(t){return(await h.axios.post(`${this.config.apiDomain}/location/query`,{...t},this.axiosRequestConfig)).data}};var w="network.xyo.location.heatmap.query",v="network.xyo.location.heatmap.answer",L=n(e=>e&&e?.schema===w,"isLocationHeatmapQuery");var g="network.xyo.location.heatmap.quadkey.query",A="network.xyo.location.heatmap.quadkey.answer",T=n(e=>e&&e?.schema===g,"isLocationQuadkeyHeatmapQuery");var D={"network.xyo.location.heatmap.quadkey.query":!0,"network.xyo.location.heatmap.query":!0,"network.xyo.location.range.query":!0},j=n(e=>D[e]||!1,"isSupportedLocationQuerySchema");var b="network.xyo.location.range.query",x="network.xyo.location.range.answer",H=n(e=>e&&e?.schema===x,"isLocationTimeRangeQuery");var F="co.coinapp.currentlocationwitness";var C="network.xyo.location";var K="network.xyo.diviner.remote.config";
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ ApiBase: () => ApiBase,
25
+ ApiSimple: () => ApiSimple,
26
+ ArchivistApi: () => ArchivistApi,
27
+ CurrentLocationWitnessSchema: () => CurrentLocationWitnessSchema,
28
+ LocationDivinerApi: () => LocationDivinerApi,
29
+ LocationTimeRangeAnswerSchema: () => LocationTimeRangeAnswerSchema,
30
+ LocationTimeRangeQuerySchema: () => LocationTimeRangeQuerySchema,
31
+ LocationWitnessSchema: () => LocationWitnessSchema,
32
+ RemoteDivinerConfigSchema: () => RemoteDivinerConfigSchema,
33
+ isLocationHeatmapQuery: () => isLocationHeatmapQuery,
34
+ isLocationQuadkeyHeatmapQuery: () => isLocationQuadkeyHeatmapQuery,
35
+ isLocationTimeRangeQuery: () => isLocationTimeRangeQuery,
36
+ isSupportedLocationQuerySchema: () => isSupportedLocationQuerySchema,
37
+ locationHeatmapAnswerSchema: () => locationHeatmapAnswerSchema,
38
+ locationHeatmapQuerySchema: () => locationHeatmapQuerySchema,
39
+ locationQuadkeyHeatmapAnswerSchema: () => locationQuadkeyHeatmapAnswerSchema,
40
+ locationQuadkeyHeatmapQuerySchema: () => locationQuadkeyHeatmapQuerySchema
41
+ });
42
+ module.exports = __toCommonJS(src_exports);
43
+
44
+ // src/Api/Api.ts
45
+ var import_huri = require("@xyo-network/huri");
46
+
47
+ // src/Base.ts
48
+ var import_axios = require("@xylabs/axios");
49
+ var ApiBase = class _ApiBase {
50
+ static {
51
+ __name(this, "ApiBase");
52
+ }
53
+ config;
54
+ axios;
55
+ constructor(config) {
56
+ this.config = config;
57
+ this.axios = new import_axios.AxiosJson({
58
+ ...this.config,
59
+ headers: this.headers
60
+ });
61
+ }
62
+ get authenticated() {
63
+ return !!this.config.apiKey || !!this.config.jwtToken;
64
+ }
65
+ get headers() {
66
+ const headers = {};
67
+ if (this.config.jwtToken) {
68
+ headers.Authorization = `Bearer ${this.config.jwtToken}`;
69
+ }
70
+ if (this.config.apiKey) {
71
+ headers["x-api-key"] = this.config.apiKey;
72
+ }
73
+ return headers;
74
+ }
75
+ get query() {
76
+ return this.config.query ?? "";
77
+ }
78
+ get root() {
79
+ return this.config.root ?? "/";
80
+ }
81
+ static resolveResponse(result) {
82
+ return [
83
+ result?.data?.data,
84
+ result?.data,
85
+ result
86
+ ];
87
+ }
88
+ static shapeResponse(response, responseType) {
89
+ const resolvedResponse = _ApiBase.resolveResponse(response);
90
+ return responseType === "tuple" ? resolvedResponse : resolvedResponse[0];
91
+ }
92
+ onError(error, depth = 0) {
93
+ this.config.reportableParent?.onError?.(error, depth + 1);
94
+ this.config.onError?.(error, depth);
95
+ }
96
+ onFailure(response, depth = 0) {
97
+ this.config.reportableParent?.onFailure?.(response, depth + 1);
98
+ this.config.onFailure?.(response, depth);
99
+ }
100
+ onSuccess(response, depth = 0) {
101
+ this.config.reportableParent?.onSuccess?.(response, depth + 1);
102
+ this.config.onSuccess?.(response, depth);
103
+ }
104
+ async deleteEndpoint(endPoint = "", responseType) {
105
+ const response = await this.monitorResponse(async () => {
106
+ return await this.axios.delete(`${this.resolveRoot()}${endPoint}${this.query}`);
107
+ });
108
+ return _ApiBase.shapeResponse(response, responseType);
109
+ }
110
+ async getEndpoint(endPoint = "", responseType) {
111
+ const response = await this.monitorResponse(async () => {
112
+ return await this.axios.get(`${this.resolveRoot()}${endPoint}${this.query}`);
113
+ });
114
+ return _ApiBase.shapeResponse(response, responseType);
115
+ }
116
+ handleMonitorResponseError(error, trapAxiosException) {
117
+ if (!error.isError) {
118
+ throw error;
119
+ }
120
+ if (trapAxiosException) {
121
+ error.response ? this.onFailure(error.response) : this.onError(error);
122
+ if (this.config.throwFailure) {
123
+ throw error;
124
+ }
125
+ return error.response;
126
+ }
127
+ }
128
+ async monitorResponse(closure) {
129
+ let trapAxiosException = true;
130
+ try {
131
+ const response = await closure();
132
+ trapAxiosException = false;
133
+ response.status < 300 ? this.onSuccess(response) : this.onFailure(response);
134
+ return response;
135
+ } catch (error) {
136
+ this.handleMonitorResponseError(error, trapAxiosException);
137
+ }
138
+ }
139
+ async postEndpoint(endPoint = "", data, responseType) {
140
+ const response = await this.monitorResponse(async () => {
141
+ return await this.axios.post(`${this.resolveRoot()}${endPoint}${this.query}`, data);
142
+ });
143
+ return _ApiBase.shapeResponse(response, responseType);
144
+ }
145
+ async putEndpoint(endPoint = "", data, responseType) {
146
+ const response = await this.monitorResponse(async () => {
147
+ return await this.axios.put(`${this.resolveRoot()}${endPoint}${this.query}`, data);
148
+ });
149
+ return _ApiBase.shapeResponse(response, responseType);
150
+ }
151
+ resolveRoot() {
152
+ return `${this.config.apiDomain}${this.root}`;
153
+ }
154
+ };
155
+
156
+ // src/objToQuery.ts
157
+ var objToQuery = /* @__PURE__ */ __name((obj) => {
158
+ return `?${Object.entries(obj).map(([key, value]) => {
159
+ return `${key}=${value}`;
160
+ }).filter((value) => value !== void 0).join("&")}`;
161
+ }, "objToQuery");
162
+
163
+ // src/Simple.ts
164
+ var ApiSimple = class extends ApiBase {
165
+ static {
166
+ __name(this, "ApiSimple");
167
+ }
168
+ async delete(responseType) {
169
+ switch (responseType) {
170
+ case "tuple": {
171
+ return await this.deleteEndpoint(void 0, "tuple");
172
+ }
173
+ default: {
174
+ return await this.deleteEndpoint();
175
+ }
176
+ }
177
+ }
178
+ async find(query = {}, responseType) {
179
+ switch (responseType) {
180
+ case "tuple": {
181
+ return await this.getEndpoint(objToQuery(query), "tuple");
182
+ }
183
+ default: {
184
+ return await this.getEndpoint(objToQuery(query));
185
+ }
186
+ }
187
+ }
188
+ async get(responseType) {
189
+ switch (responseType) {
190
+ case "tuple": {
191
+ return await this.getEndpoint(void 0, "tuple");
192
+ }
193
+ default: {
194
+ return await this.getEndpoint();
195
+ }
196
+ }
197
+ }
198
+ async post(data, responseType) {
199
+ switch (responseType) {
200
+ case "tuple": {
201
+ return await this.postEndpoint(void 0, data, "tuple");
202
+ }
203
+ default: {
204
+ return await this.postEndpoint(void 0, data);
205
+ }
206
+ }
207
+ }
208
+ async put(data, responseType) {
209
+ switch (responseType) {
210
+ case "tuple": {
211
+ return await this.putEndpoint(void 0, data, "tuple");
212
+ }
213
+ default: {
214
+ return await this.putEndpoint(void 0, data);
215
+ }
216
+ }
217
+ }
218
+ };
219
+
220
+ // src/Api/Api.ts
221
+ var ArchivistApi = class extends ApiSimple {
222
+ static {
223
+ __name(this, "ArchivistApi");
224
+ }
225
+ huri(huri) {
226
+ const huriObj = typeof huri === "string" ? new import_huri.Huri(huri) : huri;
227
+ return new ApiSimple({
228
+ ...this.config,
229
+ root: `${this.root}${huriObj.href}/`
230
+ });
231
+ }
232
+ };
233
+
234
+ // src/Diviner/LocationDiviner/LocationDivinerApi.ts
235
+ var import_axios3 = require("@xylabs/axios");
236
+
237
+ // src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts
238
+ var import_axios2 = require("@xylabs/axios");
239
+ var locationDivinerApiResponseTransformer = /* @__PURE__ */ __name((data, _headers) => {
240
+ return data.data;
241
+ }, "locationDivinerApiResponseTransformer");
242
+ var getLocationDivinerApiResponseTransformer = /* @__PURE__ */ __name((axiosInstance = import_axios2.axios) => {
243
+ return axiosInstance.defaults.transformResponse ? [
244
+ ...Array.isArray(axiosInstance.defaults.transformResponse) ? axiosInstance.defaults.transformResponse : [
245
+ axiosInstance.defaults.transformResponse
246
+ ],
247
+ locationDivinerApiResponseTransformer
248
+ ] : [
249
+ locationDivinerApiResponseTransformer
250
+ ];
251
+ }, "getLocationDivinerApiResponseTransformer");
252
+
253
+ // src/Diviner/LocationDiviner/LocationDivinerApi.ts
254
+ var LocationDivinerApi = class LocationDivinerApi2 {
255
+ static {
256
+ __name(this, "LocationDivinerApi");
257
+ }
258
+ config;
259
+ constructor(config) {
260
+ this.config = config;
261
+ }
262
+ get axiosRequestConfig() {
263
+ return {
264
+ transformResponse: getLocationDivinerApiResponseTransformer()
265
+ };
266
+ }
267
+ async getLocationQuery(hash) {
268
+ return (await import_axios3.axios.get(`${this.config.apiDomain}/location/query/${hash}`, this.axiosRequestConfig)).data;
269
+ }
270
+ async postLocationQuery(request) {
271
+ return (await import_axios3.axios.post(`${this.config.apiDomain}/location/query`, {
272
+ ...request
273
+ }, this.axiosRequestConfig)).data;
274
+ }
275
+ };
276
+
277
+ // src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.ts
278
+ var locationHeatmapQuerySchema = "network.xyo.location.heatmap.query";
279
+ var locationHeatmapAnswerSchema = "network.xyo.location.heatmap.answer";
280
+ var isLocationHeatmapQuery = /* @__PURE__ */ __name((query) => {
281
+ return query && query?.schema === locationHeatmapQuerySchema;
282
+ }, "isLocationHeatmapQuery");
283
+
284
+ // src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.ts
285
+ var locationQuadkeyHeatmapQuerySchema = "network.xyo.location.heatmap.quadkey.query";
286
+ var locationQuadkeyHeatmapAnswerSchema = "network.xyo.location.heatmap.quadkey.answer";
287
+ var isLocationQuadkeyHeatmapQuery = /* @__PURE__ */ __name((query) => {
288
+ return query && query?.schema === locationQuadkeyHeatmapQuerySchema;
289
+ }, "isLocationQuadkeyHeatmapQuery");
290
+
291
+ // src/Diviner/LocationDiviner/Queries/LocationQuerySchema.ts
292
+ var locationQuerySchemas = {
293
+ "network.xyo.location.heatmap.quadkey.query": true,
294
+ "network.xyo.location.heatmap.query": true,
295
+ "network.xyo.location.range.query": true
296
+ };
297
+ var isSupportedLocationQuerySchema = /* @__PURE__ */ __name((schema) => {
298
+ return locationQuerySchemas[schema] || false;
299
+ }, "isSupportedLocationQuerySchema");
300
+
301
+ // src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.ts
302
+ var LocationTimeRangeQuerySchema = "network.xyo.location.range.query";
303
+ var LocationTimeRangeAnswerSchema = "network.xyo.location.range.answer";
304
+ var isLocationTimeRangeQuery = /* @__PURE__ */ __name((query) => {
305
+ return query && query?.schema === LocationTimeRangeAnswerSchema;
306
+ }, "isLocationTimeRangeQuery");
307
+
308
+ // src/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.ts
309
+ var CurrentLocationWitnessSchema = "co.coinapp.currentlocationwitness";
310
+
311
+ // src/Diviner/LocationDiviner/Witnesses/LocationWitness.ts
312
+ var LocationWitnessSchema = "network.xyo.location";
313
+
314
+ // src/Diviner/RemoteDivinerConfig.ts
315
+ var RemoteDivinerConfigSchema = "network.xyo.diviner.remote.config";
2
316
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/index.ts","../../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":["export * from './Api'\nexport * from './Base'\nexport * from './Diviner'\nexport * from './models'\nexport * from './Simple'\nexport * from './WithArchive'\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 { 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":"4dAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,cAAAC,EAAA,iBAAAC,EAAA,iCAAAC,EAAA,uBAAAC,EAAA,kCAAAC,EAAA,iCAAAC,EAAA,0BAAAC,EAAA,8BAAAC,EAAA,2BAAAC,EAAA,kCAAAC,EAAA,6BAAAC,EAAA,mCAAAC,EAAA,gCAAAC,EAAA,+BAAAC,EAAA,uCAAAC,EAAA,sCAAAC,IAAA,eAAAC,EAAAnB,GCCA,IAAAoB,EAAqB,6BCDrB,IAAAC,EAA0B,yBAanB,IAAMC,EAAN,MAAMA,CAAAA,CAbb,MAaaA,CAAAA,EAAAA,gBACFC,OACCC,MAEVC,YAAYF,EAAW,CACrB,KAAKA,OAASA,EACd,KAAKC,MAAQ,IAAIE,YAAU,CAAE,GAAG,KAAKH,OAAQI,QAAS,KAAKA,OAAQ,CAAA,CACrE,CAEA,IAAIC,eAAgB,CAClB,MAAO,CAAC,CAAC,KAAKL,OAAOM,QAAU,CAAC,CAAC,KAAKN,OAAOO,QAC/C,CAEA,IAAcH,SAAkC,CAC9C,IAAMA,EAAkC,CAAC,EACzC,OAAI,KAAKJ,OAAOO,WACdH,EAAQI,cAAgB,UAAU,KAAKR,OAAOO,QAAQ,IAEpD,KAAKP,OAAOM,SACdF,EAAQ,WAAA,EAAe,KAAKJ,OAAOM,QAE9BF,CACT,CAEA,IAAcK,OAAQ,CACpB,OAAO,KAAKT,OAAOS,OAAS,EAC9B,CAEA,IAAcC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C,EAACC,GAChCA,GAASA,GAAOC,SAAWJ,EADI,4BCbjC,IAAMK,EAA6D,oCCAnE,IAAMC,EAA+C,uBCErD,IAAMC,EAAuD","names":["src_exports","__export","ApiBase","ApiSimple","ArchivistApi","CurrentLocationWitnessSchema","LocationDivinerApi","LocationTimeRangeAnswerSchema","LocationTimeRangeQuerySchema","LocationWitnessSchema","RemoteDivinerConfigSchema","isLocationHeatmapQuery","isLocationQuadkeyHeatmapQuery","isLocationTimeRangeQuery","isSupportedLocationQuerySchema","locationHeatmapAnswerSchema","locationHeatmapQuerySchema","locationQuadkeyHeatmapAnswerSchema","locationQuadkeyHeatmapQuerySchema","__toCommonJS","import_huri","import_axios","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","__name","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","import_axios","import_axios","locationDivinerApiResponseTransformer","__name","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","__name","query","schema","locationQuadkeyHeatmapQuerySchema","locationQuadkeyHeatmapAnswerSchema","isLocationQuadkeyHeatmapQuery","__name","query","schema","locationQuerySchemas","isSupportedLocationQuerySchema","__name","schema","LocationTimeRangeQuerySchema","LocationTimeRangeAnswerSchema","isLocationTimeRangeQuery","__name","query","schema","CurrentLocationWitnessSchema","LocationWitnessSchema","RemoteDivinerConfigSchema"]}
1
+ {"version":3,"sources":["../../src/index.ts","../../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":["export * from './Api'\nexport * from './Base'\nexport * from './Diviner'\nexport * from './models'\nexport * from './Simple'\nexport * from './WithArchive'\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 { 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":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;;;;;;ACCA,kBAAqB;;;ACDrB,mBAA0B;AAanB,IAAMA,UA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GAXwD;;;ADLxD,IAAMU,qBAAN,MAAMA,oBAAAA;EAPN,OAOMA;;;EACJC;EACAC,YAAYD,QAAmB;AAC7B,SAAKA,SAASA;EAChB;EAEA,IAAYE,qBAA4C;AACtD,WAAO;MACLC,mBAAmBC,yCAAAA;IACrB;EACF;EAEA,MAAMC,iBAAiBC,MAAc;AACnC,YAAQ,MAAMC,oBAAMC,IAA8B,GAAG,KAAKR,OAAOS,SAAS,mBAAmBH,IAAAA,IAAQ,KAAKJ,kBAAkB,GAAGQ;EACjI;EAEA,MAAMC,kBAAkBC,SAAgD;AACtE,YAAQ,MAAML,oBAAMM,KAAoC,GAAG,KAAKb,OAAOS,SAAS,mBAAmB;MAAE,GAAGG;IAAQ,GAAG,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":["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","import_axios","import_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"]}