@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,294 @@
1
- var y=Object.defineProperty;var s=(n,t)=>y(n,"name",{value:t,configurable:!0});import{Huri as $}from"@xyo-network/huri";import{AxiosJson as R}from"@xylabs/axios";var c=class c{config;axios;constructor(t){this.config=t,this.axios=new R({...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){var e;return[(e=t==null?void 0:t.data)==null?void 0:e.data,t==null?void 0:t.data,t]}static shapeResponse(t,e){let o=c.resolveResponse(t);return e==="tuple"?o:o[0]}onError(t,e=0){var o,r,i,a;(r=(o=this.config.reportableParent)==null?void 0:o.onError)==null||r.call(o,t,e+1),(a=(i=this.config).onError)==null||a.call(i,t,e)}onFailure(t,e=0){var o,r,i,a;(r=(o=this.config.reportableParent)==null?void 0:o.onFailure)==null||r.call(o,t,e+1),(a=(i=this.config).onFailure)==null||a.call(i,t,e)}onSuccess(t,e=0){var o,r,i,a;(r=(o=this.config.reportableParent)==null?void 0:o.onSuccess)==null||r.call(o,t,e+1),(a=(i=this.config).onSuccess)==null||a.call(i,t,e)}async deleteEndpoint(t="",e){let o=await this.monitorResponse(async()=>await this.axios.delete(`${this.resolveRoot()}${t}${this.query}`));return c.shapeResponse(o,e)}async getEndpoint(t="",e){let o=await this.monitorResponse(async()=>await this.axios.get(`${this.resolveRoot()}${t}${this.query}`));return c.shapeResponse(o,e)}handleMonitorResponseError(t,e){if(!t.isError)throw t;if(e){if(t.response?this.onFailure(t.response):this.onError(t),this.config.throwFailure)throw t;return t.response}}async monitorResponse(t){let e=!0;try{let o=await t();return e=!1,o.status<300?this.onSuccess(o):this.onFailure(o),o}catch(o){this.handleMonitorResponseError(o,e)}}async postEndpoint(t="",e,o){let r=await this.monitorResponse(async()=>await this.axios.post(`${this.resolveRoot()}${t}${this.query}`,e));return c.shapeResponse(r,o)}async putEndpoint(t="",e,o){let r=await this.monitorResponse(async()=>await this.axios.put(`${this.resolveRoot()}${t}${this.query}`,e));return c.shapeResponse(r,o)}resolveRoot(){return`${this.config.apiDomain}${this.root}`}};s(c,"ApiBase");var h=c;var f=s(n=>`?${Object.entries(n).map(([t,e])=>`${t}=${e}`).filter(t=>t!==void 0).join("&")}`,"objToQuery");var m=class m extends h{async delete(t){switch(t){case"tuple":return await this.deleteEndpoint(void 0,"tuple");default:return await this.deleteEndpoint()}}async find(t={},e){switch(e){case"tuple":return await this.getEndpoint(f(t),"tuple");default:return await this.getEndpoint(f(t))}}async get(t){switch(t){case"tuple":return await this.getEndpoint(void 0,"tuple");default:return await this.getEndpoint()}}async post(t,e){switch(e){case"tuple":return await this.postEndpoint(void 0,t,"tuple");default:return await this.postEndpoint(void 0,t)}}async put(t,e){switch(e){case"tuple":return await this.putEndpoint(void 0,t,"tuple");default:return await this.putEndpoint(void 0,t)}}};s(m,"ApiSimple");var u=m;var d=class d extends u{huri(t){let e=typeof t=="string"?new $(t):t;return new u({...this.config,root:`${this.root}${e.href}/`})}};s(d,"ArchivistApi");var l=d;import{axios as x}from"@xylabs/axios";import{axios as E}from"@xylabs/axios";var w=s((n,t)=>n.data,"locationDivinerApiResponseTransformer"),g=s((n=E)=>n.defaults.transformResponse?[...Array.isArray(n.defaults.transformResponse)?n.defaults.transformResponse:[n.defaults.transformResponse],w]:[w],"getLocationDivinerApiResponseTransformer");var p,N=(p=class{config;constructor(t){this.config=t}get axiosRequestConfig(){return{transformResponse:g()}}async getLocationQuery(t){return(await x.get(`${this.config.apiDomain}/location/query/${t}`,this.axiosRequestConfig)).data}async postLocationQuery(t){return(await x.post(`${this.config.apiDomain}/location/query`,{...t},this.axiosRequestConfig)).data}},s(p,"LocationDivinerApi"),p);var k="network.xyo.location.heatmap.query",X="network.xyo.location.heatmap.answer",Y=s(n=>n&&(n==null?void 0:n.schema)===k,"isLocationHeatmapQuery");var Q="network.xyo.location.heatmap.quadkey.query",_="network.xyo.location.heatmap.quadkey.answer",tt=s(n=>n&&(n==null?void 0:n.schema)===Q,"isLocationQuadkeyHeatmapQuery");var S={"network.xyo.location.heatmap.quadkey.query":!0,"network.xyo.location.heatmap.query":!0,"network.xyo.location.range.query":!0},nt=s(n=>S[n]||!1,"isSupportedLocationQuerySchema");var it="network.xyo.location.range.query",L="network.xyo.location.range.answer",at=s(n=>n&&(n==null?void 0:n.schema)===L,"isLocationTimeRangeQuery");var ut="co.coinapp.currentlocationwitness";var ft="network.xyo.location";var dt="network.xyo.diviner.remote.config";export{h as ApiBase,u as ApiSimple,l as ArchivistApi,ut as CurrentLocationWitnessSchema,N as LocationDivinerApi,L as LocationTimeRangeAnswerSchema,it as LocationTimeRangeQuerySchema,ft as LocationWitnessSchema,dt as RemoteDivinerConfigSchema,Y as isLocationHeatmapQuery,tt as isLocationQuadkeyHeatmapQuery,at as isLocationTimeRangeQuery,nt as isSupportedLocationQuerySchema,X as locationHeatmapAnswerSchema,k as locationHeatmapQuerySchema,_ as locationQuadkeyHeatmapAnswerSchema,Q as locationQuadkeyHeatmapQuerySchema};
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
+ config;
11
+ axios;
12
+ constructor(config) {
13
+ this.config = config;
14
+ this.axios = new AxiosJson({
15
+ ...this.config,
16
+ headers: this.headers
17
+ });
18
+ }
19
+ get authenticated() {
20
+ return !!this.config.apiKey || !!this.config.jwtToken;
21
+ }
22
+ get headers() {
23
+ const headers = {};
24
+ if (this.config.jwtToken) {
25
+ headers.Authorization = `Bearer ${this.config.jwtToken}`;
26
+ }
27
+ if (this.config.apiKey) {
28
+ headers["x-api-key"] = this.config.apiKey;
29
+ }
30
+ return headers;
31
+ }
32
+ get query() {
33
+ return this.config.query ?? "";
34
+ }
35
+ get root() {
36
+ return this.config.root ?? "/";
37
+ }
38
+ static resolveResponse(result) {
39
+ var _a2;
40
+ return [
41
+ (_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.data,
42
+ result == null ? void 0 : result.data,
43
+ result
44
+ ];
45
+ }
46
+ static shapeResponse(response, responseType) {
47
+ const resolvedResponse = _ApiBase.resolveResponse(response);
48
+ return responseType === "tuple" ? resolvedResponse : resolvedResponse[0];
49
+ }
50
+ onError(error, depth = 0) {
51
+ var _a2, _b, _c, _d;
52
+ (_b = (_a2 = this.config.reportableParent) == null ? void 0 : _a2.onError) == null ? void 0 : _b.call(_a2, error, depth + 1);
53
+ (_d = (_c = this.config).onError) == null ? void 0 : _d.call(_c, error, depth);
54
+ }
55
+ onFailure(response, depth = 0) {
56
+ var _a2, _b, _c, _d;
57
+ (_b = (_a2 = this.config.reportableParent) == null ? void 0 : _a2.onFailure) == null ? void 0 : _b.call(_a2, response, depth + 1);
58
+ (_d = (_c = this.config).onFailure) == null ? void 0 : _d.call(_c, response, depth);
59
+ }
60
+ onSuccess(response, depth = 0) {
61
+ var _a2, _b, _c, _d;
62
+ (_b = (_a2 = this.config.reportableParent) == null ? void 0 : _a2.onSuccess) == null ? void 0 : _b.call(_a2, response, depth + 1);
63
+ (_d = (_c = this.config).onSuccess) == null ? void 0 : _d.call(_c, response, depth);
64
+ }
65
+ async deleteEndpoint(endPoint = "", responseType) {
66
+ const response = await this.monitorResponse(async () => {
67
+ return await this.axios.delete(`${this.resolveRoot()}${endPoint}${this.query}`);
68
+ });
69
+ return _ApiBase.shapeResponse(response, responseType);
70
+ }
71
+ async getEndpoint(endPoint = "", responseType) {
72
+ const response = await this.monitorResponse(async () => {
73
+ return await this.axios.get(`${this.resolveRoot()}${endPoint}${this.query}`);
74
+ });
75
+ return _ApiBase.shapeResponse(response, responseType);
76
+ }
77
+ handleMonitorResponseError(error, trapAxiosException) {
78
+ if (!error.isError) {
79
+ throw error;
80
+ }
81
+ if (trapAxiosException) {
82
+ error.response ? this.onFailure(error.response) : this.onError(error);
83
+ if (this.config.throwFailure) {
84
+ throw error;
85
+ }
86
+ return error.response;
87
+ }
88
+ }
89
+ async monitorResponse(closure) {
90
+ let trapAxiosException = true;
91
+ try {
92
+ const response = await closure();
93
+ trapAxiosException = false;
94
+ response.status < 300 ? this.onSuccess(response) : this.onFailure(response);
95
+ return response;
96
+ } catch (error) {
97
+ this.handleMonitorResponseError(error, trapAxiosException);
98
+ }
99
+ }
100
+ async postEndpoint(endPoint = "", data, responseType) {
101
+ const response = await this.monitorResponse(async () => {
102
+ return await this.axios.post(`${this.resolveRoot()}${endPoint}${this.query}`, data);
103
+ });
104
+ return _ApiBase.shapeResponse(response, responseType);
105
+ }
106
+ async putEndpoint(endPoint = "", data, responseType) {
107
+ const response = await this.monitorResponse(async () => {
108
+ return await this.axios.put(`${this.resolveRoot()}${endPoint}${this.query}`, data);
109
+ });
110
+ return _ApiBase.shapeResponse(response, responseType);
111
+ }
112
+ resolveRoot() {
113
+ return `${this.config.apiDomain}${this.root}`;
114
+ }
115
+ };
116
+ __name(_ApiBase, "ApiBase");
117
+ var ApiBase = _ApiBase;
118
+
119
+ // src/objToQuery.ts
120
+ var objToQuery = /* @__PURE__ */ __name((obj) => {
121
+ return `?${Object.entries(obj).map(([key, value]) => {
122
+ return `${key}=${value}`;
123
+ }).filter((value) => value !== void 0).join("&")}`;
124
+ }, "objToQuery");
125
+
126
+ // src/Simple.ts
127
+ var _ApiSimple = class _ApiSimple extends ApiBase {
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
+ __name(_ApiSimple, "ApiSimple");
180
+ var ApiSimple = _ApiSimple;
181
+
182
+ // src/Api/Api.ts
183
+ var _ArchivistApi = class _ArchivistApi extends ApiSimple {
184
+ huri(huri) {
185
+ const huriObj = typeof huri === "string" ? new Huri(huri) : huri;
186
+ return new ApiSimple({
187
+ ...this.config,
188
+ root: `${this.root}${huriObj.href}/`
189
+ });
190
+ }
191
+ };
192
+ __name(_ArchivistApi, "ArchivistApi");
193
+ var ArchivistApi = _ArchivistApi;
194
+
195
+ // src/Diviner/LocationDiviner/LocationDivinerApi.ts
196
+ import { axios as axios2 } from "@xylabs/axios";
197
+
198
+ // src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts
199
+ import { axios } from "@xylabs/axios";
200
+ var locationDivinerApiResponseTransformer = /* @__PURE__ */ __name((data, _headers) => {
201
+ return data.data;
202
+ }, "locationDivinerApiResponseTransformer");
203
+ var getLocationDivinerApiResponseTransformer = /* @__PURE__ */ __name((axiosInstance = axios) => {
204
+ return axiosInstance.defaults.transformResponse ? [
205
+ ...Array.isArray(axiosInstance.defaults.transformResponse) ? axiosInstance.defaults.transformResponse : [
206
+ axiosInstance.defaults.transformResponse
207
+ ],
208
+ locationDivinerApiResponseTransformer
209
+ ] : [
210
+ locationDivinerApiResponseTransformer
211
+ ];
212
+ }, "getLocationDivinerApiResponseTransformer");
213
+
214
+ // src/Diviner/LocationDiviner/LocationDivinerApi.ts
215
+ var _a;
216
+ var LocationDivinerApi = (_a = class {
217
+ config;
218
+ constructor(config) {
219
+ this.config = config;
220
+ }
221
+ get axiosRequestConfig() {
222
+ return {
223
+ transformResponse: getLocationDivinerApiResponseTransformer()
224
+ };
225
+ }
226
+ async getLocationQuery(hash) {
227
+ return (await axios2.get(`${this.config.apiDomain}/location/query/${hash}`, this.axiosRequestConfig)).data;
228
+ }
229
+ async postLocationQuery(request) {
230
+ return (await axios2.post(`${this.config.apiDomain}/location/query`, {
231
+ ...request
232
+ }, this.axiosRequestConfig)).data;
233
+ }
234
+ }, __name(_a, "LocationDivinerApi"), _a);
235
+
236
+ // src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.ts
237
+ var locationHeatmapQuerySchema = "network.xyo.location.heatmap.query";
238
+ var locationHeatmapAnswerSchema = "network.xyo.location.heatmap.answer";
239
+ var isLocationHeatmapQuery = /* @__PURE__ */ __name((query) => {
240
+ return query && (query == null ? void 0 : query.schema) === locationHeatmapQuerySchema;
241
+ }, "isLocationHeatmapQuery");
242
+
243
+ // src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.ts
244
+ var locationQuadkeyHeatmapQuerySchema = "network.xyo.location.heatmap.quadkey.query";
245
+ var locationQuadkeyHeatmapAnswerSchema = "network.xyo.location.heatmap.quadkey.answer";
246
+ var isLocationQuadkeyHeatmapQuery = /* @__PURE__ */ __name((query) => {
247
+ return query && (query == null ? void 0 : query.schema) === locationQuadkeyHeatmapQuerySchema;
248
+ }, "isLocationQuadkeyHeatmapQuery");
249
+
250
+ // src/Diviner/LocationDiviner/Queries/LocationQuerySchema.ts
251
+ var locationQuerySchemas = {
252
+ "network.xyo.location.heatmap.quadkey.query": true,
253
+ "network.xyo.location.heatmap.query": true,
254
+ "network.xyo.location.range.query": true
255
+ };
256
+ var isSupportedLocationQuerySchema = /* @__PURE__ */ __name((schema) => {
257
+ return locationQuerySchemas[schema] || false;
258
+ }, "isSupportedLocationQuerySchema");
259
+
260
+ // src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.ts
261
+ var LocationTimeRangeQuerySchema = "network.xyo.location.range.query";
262
+ var LocationTimeRangeAnswerSchema = "network.xyo.location.range.answer";
263
+ var isLocationTimeRangeQuery = /* @__PURE__ */ __name((query) => {
264
+ return query && (query == null ? void 0 : query.schema) === LocationTimeRangeAnswerSchema;
265
+ }, "isLocationTimeRangeQuery");
266
+
267
+ // src/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.ts
268
+ var CurrentLocationWitnessSchema = "co.coinapp.currentlocationwitness";
269
+
270
+ // src/Diviner/LocationDiviner/Witnesses/LocationWitness.ts
271
+ var LocationWitnessSchema = "network.xyo.location";
272
+
273
+ // src/Diviner/RemoteDivinerConfig.ts
274
+ var RemoteDivinerConfigSchema = "network.xyo.diviner.remote.config";
275
+ export {
276
+ ApiBase,
277
+ ApiSimple,
278
+ ArchivistApi,
279
+ CurrentLocationWitnessSchema,
280
+ LocationDivinerApi,
281
+ LocationTimeRangeAnswerSchema,
282
+ LocationTimeRangeQuerySchema,
283
+ LocationWitnessSchema,
284
+ RemoteDivinerConfigSchema,
285
+ isLocationHeatmapQuery,
286
+ isLocationQuadkeyHeatmapQuery,
287
+ isLocationTimeRangeQuery,
288
+ isSupportedLocationQuerySchema,
289
+ locationHeatmapAnswerSchema,
290
+ locationHeatmapQuerySchema,
291
+ locationQuadkeyHeatmapAnswerSchema,
292
+ locationQuadkeyHeatmapQuerySchema
293
+ };
2
294
  //# sourceMappingURL=index.js.map
@@ -1 +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":"+EACA,OAASA,QAAAA,MAAY,oBCDrB,OAASC,aAAAA,MAAiB,gBAanB,IAAMC,EAAN,MAAMA,CAAAA,CACFC,OACCC,MAEVC,YAAYF,EAAW,CACrB,KAAKA,OAASA,EACd,KAAKC,MAAQ,IAAIE,EAAU,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,IA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ACJC,OACAC,YAAYD,EAAmB,CAC7B,KAAKA,OAASA,CAChB,CAEA,IAAYE,oBAA4C,CACtD,MAAO,CACLC,kBAAmBC,EAAAA,CACrB,CACF,CAEA,MAAMC,iBAAiBC,EAAc,CACnC,OAAQ,MAAMC,EAAMC,IAA8B,GAAG,KAAKR,OAAOS,SAAS,mBAAmBH,CAAAA,GAAQ,KAAKJ,kBAAkB,GAAGQ,IACjI,CAEA,MAAMC,kBAAkBC,EAAgD,CACtE,OAAQ,MAAML,EAAMM,KAAoC,GAAG,KAAKb,OAAOS,SAAS,kBAAmB,CAAE,GAAGG,CAAQ,EAAG,KAAKV,kBAAkB,GAAGQ,IAC/I,CACF,EAnBMX,EAAAA,EAAAA,sBAAND,GEJO,IAAMgB,EAAyD,qCAGzDC,EAA2D,sCAQ3DC,EAAyBC,EAACC,GAC9BA,IAASA,GAAAA,YAAAA,EAAOC,UAAWL,EADE,0BCX/B,IAAMM,EAAuE,6CAEvEC,EAAyE,8CAOzEC,GAAgCC,EAACC,GACrCA,IAASA,GAAAA,YAAAA,EAAOC,UAAWL,EADS,iCCN7C,IAAMM,EAA0D,CAC9D,6CAA8C,GAC9C,qCAAsC,GACtC,mCAAoC,EACtC,EAEaC,GAAiCC,EAACC,GACtCH,EAAqBG,CAAAA,GAAkC,GADlB,kCCTvC,IAAMC,GAA6D,mCAG7DC,EAA+D,oCAU/DC,GAA2BC,EAACC,GAChCA,IAASA,GAAAA,YAAAA,EAAOC,UAAWJ,EADI,4BCbjC,IAAMK,GAA6D,oCCAnE,IAAMC,GAA+C,uBCErD,IAAMC,GAAuD","names":["Huri","AxiosJson","ApiBase","config","axios","constructor","AxiosJson","headers","authenticated","apiKey","jwtToken","Authorization","query","root","resolveResponse","result","_a","data","shapeResponse","response","responseType","resolvedResponse","onError","error","depth","_b","_c","_d","reportableParent","onFailure","onSuccess","deleteEndpoint","endPoint","monitorResponse","delete","resolveRoot","getEndpoint","get","handleMonitorResponseError","trapAxiosException","isError","throwFailure","closure","status","postEndpoint","post","putEndpoint","put","apiDomain","_ApiBase","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","_ApiSimple","ArchivistApi","ApiSimple","huri","huriObj","Huri","config","root","href","_ArchivistApi","axios","axios","locationDivinerApiResponseTransformer","__name","data","_headers","getLocationDivinerApiResponseTransformer","axiosInstance","axios","defaults","transformResponse","Array","isArray","_a","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/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,WAAN,MAAMA,SAAAA;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;AACtBF,cAAQ,WAAA,IAAe,KAAKJ,OAAOM;IACrC;AACA,WAAOF;EACT;EAEA,IAAcK,QAAQ;AACpB,WAAO,KAAKT,OAAOS,SAAS;EAC9B;EAEA,IAAcC,OAAO;AACnB,WAAO,KAAKV,OAAOU,QAAQ;EAC7B;EAEA,OAAeC,gBAAmBC,QAAsC;AA7C1E,QAAAC;AA8CI,WAAO;OAACD,MAAAA,iCAAQE,SAARF,gBAAAA,IAAcE;MAAMF,iCAAQE;MAAMF;;E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AGQ;EAC/I;AACF,GAnBMX,kCAAN;;;AEJO,IAAMe,6BAAyD;AAG/D,IAAMC,8BAA2D;AAQjE,IAAMC,yBAAyB,wBAACC,UAAAA;AACrC,SAAOA,UAASA,+BAAOC,YAAWJ;AACpC,GAFsC;;;ACX/B,IAAMK,oCAAuE;AAE7E,IAAMC,qCAAyE;AAO/E,IAAMC,gCAAgC,wBAACC,UAAAA;AAC5C,SAAOA,UAASA,+BAAOC,YAAWJ;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,UAASA,+BAAOC,YAAWH;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","_a","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"]}
package/package.json CHANGED
@@ -11,19 +11,19 @@
11
11
  "dependencies": {
12
12
  "@xylabs/axios": "^3.5.1",
13
13
  "@xylabs/object": "^3.5.1",
14
- "@xyo-network/api-models": "~2.107.3",
15
- "@xyo-network/boundwitness-model": "~2.107.3",
16
- "@xyo-network/diviner-model": "~2.107.3",
17
- "@xyo-network/huri": "~2.107.3",
18
- "@xyo-network/payload-model": "~2.107.3"
14
+ "@xyo-network/api-models": "~2.107.5",
15
+ "@xyo-network/boundwitness-model": "~2.107.5",
16
+ "@xyo-network/diviner-model": "~2.107.5",
17
+ "@xyo-network/huri": "~2.107.5",
18
+ "@xyo-network/payload-model": "~2.107.5"
19
19
  },
20
20
  "description": "Primary SDK for using XYO Protocol 2.0",
21
21
  "devDependencies": {
22
22
  "@xylabs/jest-helpers": "^3.5.1",
23
- "@xylabs/ts-scripts-yarn3": "^3.11.9",
24
- "@xylabs/tsconfig": "^3.11.9",
25
- "@xyo-network/module-model": "~2.107.3",
26
- "@xyo-network/query-payload-plugin": "~2.107.3",
23
+ "@xylabs/ts-scripts-yarn3": "^3.11.10",
24
+ "@xylabs/tsconfig": "^3.11.10",
25
+ "@xyo-network/module-model": "~2.107.5",
26
+ "@xyo-network/query-payload-plugin": "~2.107.5",
27
27
  "jest": "^29.7.0",
28
28
  "typescript": "^5.5.2",
29
29
  "uuid": "^10.0.0"
@@ -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.107.3",
70
+ "version": "2.107.5",
71
71
  "type": "module"
72
72
  }