@xyo-network/api 2.110.10 → 2.110.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.cts +1 -1
- package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.cts.map +1 -1
- package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts +1 -1
- package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts.map +1 -1
- package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts +1 -1
- package/dist/browser/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts.map +1 -1
- package/dist/browser/Diviner/RemoteDivinerError.d.cts.map +1 -1
- package/dist/browser/Diviner/RemoteDivinerError.d.mts.map +1 -1
- package/dist/browser/Diviner/RemoteDivinerError.d.ts.map +1 -1
- package/dist/browser/index.cjs +20 -46
- package/dist/browser/index.cjs.map +1 -1
- package/dist/browser/index.js +20 -48
- package/dist/browser/index.js.map +1 -1
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.cts +1 -1
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.cts.map +1 -1
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts +1 -1
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts.map +1 -1
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts +1 -1
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts.map +1 -1
- package/dist/neutral/Diviner/RemoteDivinerError.d.cts.map +1 -1
- package/dist/neutral/Diviner/RemoteDivinerError.d.mts.map +1 -1
- package/dist/neutral/Diviner/RemoteDivinerError.d.ts.map +1 -1
- package/dist/neutral/index.cjs +20 -46
- package/dist/neutral/index.cjs.map +1 -1
- package/dist/neutral/index.js +20 -48
- package/dist/neutral/index.js.map +1 -1
- package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.cts +1 -1
- package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.cts.map +1 -1
- package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts +1 -1
- package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.mts.map +1 -1
- package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts +1 -1
- package/dist/node/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts.map +1 -1
- package/dist/node/Diviner/RemoteDivinerError.d.cts.map +1 -1
- package/dist/node/Diviner/RemoteDivinerError.d.mts.map +1 -1
- package/dist/node/Diviner/RemoteDivinerError.d.ts.map +1 -1
- package/dist/node/index.cjs +31 -52
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.js +31 -54
- package/dist/node/index.js.map +1 -1
- package/package.json +15 -13
- package/src/Diviner/RemoteDivinerError.ts +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AxiosResponseTransformer } from '@xylabs/axios';
|
|
2
2
|
export declare const locationDivinerApiResponseTransformer: AxiosResponseTransformer;
|
|
3
|
-
export declare const getLocationDivinerApiResponseTransformer: (axiosInstance?: import("axios").AxiosStatic) => AxiosResponseTransformer[];
|
|
3
|
+
export declare const getLocationDivinerApiResponseTransformer: (axiosInstance?: import("@xylabs/axios").AxiosStatic) => AxiosResponseTransformer[];
|
|
4
4
|
//# sourceMappingURL=LocationDivinerApiResponseTransformer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationDivinerApiResponseTransformer.d.ts","sourceRoot":"","sources":["../../../../src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,wBAAwB,EAAE,MAAM,eAAe,CAAA;AAE/D,eAAO,MAAM,qCAAqC,EAAE,wBAEnD,CAAA;AAQD,eAAO,MAAM,wCAAwC,
|
|
1
|
+
{"version":3,"file":"LocationDivinerApiResponseTransformer.d.ts","sourceRoot":"","sources":["../../../../src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,wBAAwB,EAAE,MAAM,eAAe,CAAA;AAE/D,eAAO,MAAM,qCAAqC,EAAE,wBAEnD,CAAA;AAQD,eAAO,MAAM,wCAAwC,2DAA4B,wBAAwB,EAWxG,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AxiosResponseTransformer } from '@xylabs/axios';
|
|
2
2
|
export declare const locationDivinerApiResponseTransformer: AxiosResponseTransformer;
|
|
3
|
-
export declare const getLocationDivinerApiResponseTransformer: (axiosInstance?: import("axios").AxiosStatic) => AxiosResponseTransformer[];
|
|
3
|
+
export declare const getLocationDivinerApiResponseTransformer: (axiosInstance?: import("@xylabs/axios").AxiosStatic) => AxiosResponseTransformer[];
|
|
4
4
|
//# sourceMappingURL=LocationDivinerApiResponseTransformer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocationDivinerApiResponseTransformer.d.ts","sourceRoot":"","sources":["../../../../src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,wBAAwB,EAAE,MAAM,eAAe,CAAA;AAE/D,eAAO,MAAM,qCAAqC,EAAE,wBAEnD,CAAA;AAQD,eAAO,MAAM,wCAAwC,
|
|
1
|
+
{"version":3,"file":"LocationDivinerApiResponseTransformer.d.ts","sourceRoot":"","sources":["../../../../src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,wBAAwB,EAAE,MAAM,eAAe,CAAA;AAE/D,eAAO,MAAM,qCAAqC,EAAE,wBAEnD,CAAA;AAQD,eAAO,MAAM,wCAAwC,2DAA4B,wBAAwB,EAWxG,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteDivinerError.d.ts","sourceRoot":"","sources":["../../../src/Diviner/RemoteDivinerError.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,oBAAoB,UAAO;gBACf,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"RemoteDivinerError.d.ts","sourceRoot":"","sources":["../../../src/Diviner/RemoteDivinerError.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,oBAAoB,UAAO;gBACf,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;IAInE,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS;CAG5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteDivinerError.d.ts","sourceRoot":"","sources":["../../../src/Diviner/RemoteDivinerError.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,oBAAoB,UAAO;gBACf,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"RemoteDivinerError.d.ts","sourceRoot":"","sources":["../../../src/Diviner/RemoteDivinerError.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,oBAAoB,UAAO;gBACf,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;IAInE,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS;CAG5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemoteDivinerError.d.ts","sourceRoot":"","sources":["../../../src/Diviner/RemoteDivinerError.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,oBAAoB,UAAO;gBACf,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;
|
|
1
|
+
{"version":3,"file":"RemoteDivinerError.d.ts","sourceRoot":"","sources":["../../../src/Diviner/RemoteDivinerError.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,oBAAoB,UAAO;gBACf,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,MAAM;IAInE,MAAM,CAAC,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS;CAG5E"}
|
package/dist/node/index.cjs
CHANGED
|
@@ -3,7 +3,6 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
6
|
var __export = (target, all) => {
|
|
8
7
|
for (var name in all)
|
|
9
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -46,15 +45,12 @@ var import_huri = require("@xyo-network/huri");
|
|
|
46
45
|
|
|
47
46
|
// src/Base.ts
|
|
48
47
|
var import_axios = require("@xylabs/axios");
|
|
49
|
-
var
|
|
48
|
+
var ApiBase = class _ApiBase {
|
|
50
49
|
config;
|
|
51
50
|
axios;
|
|
52
51
|
constructor(config) {
|
|
53
52
|
this.config = config;
|
|
54
|
-
this.axios = new import_axios.AxiosJson({
|
|
55
|
-
...this.config,
|
|
56
|
-
headers: this.headers
|
|
57
|
-
});
|
|
53
|
+
this.axios = new import_axios.AxiosJson({ ...this.config, headers: this.headers });
|
|
58
54
|
}
|
|
59
55
|
get authenticated() {
|
|
60
56
|
return !!this.config.apiKey || !!this.config.jwtToken;
|
|
@@ -76,30 +72,26 @@ var _ApiBase = class _ApiBase {
|
|
|
76
72
|
return this.config.root ?? "/";
|
|
77
73
|
}
|
|
78
74
|
static resolveResponse(result) {
|
|
79
|
-
var
|
|
80
|
-
return [
|
|
81
|
-
(_a2 = result == null ? void 0 : result.data) == null ? void 0 : _a2.data,
|
|
82
|
-
result == null ? void 0 : result.data,
|
|
83
|
-
result
|
|
84
|
-
];
|
|
75
|
+
var _a;
|
|
76
|
+
return [(_a = result == null ? void 0 : result.data) == null ? void 0 : _a.data, result == null ? void 0 : result.data, result];
|
|
85
77
|
}
|
|
86
78
|
static shapeResponse(response, responseType) {
|
|
87
79
|
const resolvedResponse = _ApiBase.resolveResponse(response);
|
|
88
80
|
return responseType === "tuple" ? resolvedResponse : resolvedResponse[0];
|
|
89
81
|
}
|
|
90
82
|
onError(error, depth = 0) {
|
|
91
|
-
var
|
|
92
|
-
(_b = (
|
|
83
|
+
var _a, _b, _c, _d;
|
|
84
|
+
(_b = (_a = this.config.reportableParent) == null ? void 0 : _a.onError) == null ? void 0 : _b.call(_a, error, depth + 1);
|
|
93
85
|
(_d = (_c = this.config).onError) == null ? void 0 : _d.call(_c, error, depth);
|
|
94
86
|
}
|
|
95
87
|
onFailure(response, depth = 0) {
|
|
96
|
-
var
|
|
97
|
-
(_b = (
|
|
88
|
+
var _a, _b, _c, _d;
|
|
89
|
+
(_b = (_a = this.config.reportableParent) == null ? void 0 : _a.onFailure) == null ? void 0 : _b.call(_a, response, depth + 1);
|
|
98
90
|
(_d = (_c = this.config).onFailure) == null ? void 0 : _d.call(_c, response, depth);
|
|
99
91
|
}
|
|
100
92
|
onSuccess(response, depth = 0) {
|
|
101
|
-
var
|
|
102
|
-
(_b = (
|
|
93
|
+
var _a, _b, _c, _d;
|
|
94
|
+
(_b = (_a = this.config.reportableParent) == null ? void 0 : _a.onSuccess) == null ? void 0 : _b.call(_a, response, depth + 1);
|
|
103
95
|
(_d = (_c = this.config).onSuccess) == null ? void 0 : _d.call(_c, response, depth);
|
|
104
96
|
}
|
|
105
97
|
async deleteEndpoint(endPoint = "", responseType) {
|
|
@@ -153,18 +145,16 @@ var _ApiBase = class _ApiBase {
|
|
|
153
145
|
return `${this.config.apiDomain}${this.root}`;
|
|
154
146
|
}
|
|
155
147
|
};
|
|
156
|
-
__name(_ApiBase, "ApiBase");
|
|
157
|
-
var ApiBase = _ApiBase;
|
|
158
148
|
|
|
159
149
|
// src/objToQuery.ts
|
|
160
|
-
var objToQuery =
|
|
150
|
+
var objToQuery = (obj) => {
|
|
161
151
|
return `?${Object.entries(obj).map(([key, value]) => {
|
|
162
152
|
return `${key}=${value}`;
|
|
163
153
|
}).filter((value) => value !== void 0).join("&")}`;
|
|
164
|
-
}
|
|
154
|
+
};
|
|
165
155
|
|
|
166
156
|
// src/Simple.ts
|
|
167
|
-
var
|
|
157
|
+
var ApiSimple = class extends ApiBase {
|
|
168
158
|
async delete(responseType) {
|
|
169
159
|
switch (responseType) {
|
|
170
160
|
case "tuple": {
|
|
@@ -216,11 +206,9 @@ var _ApiSimple = class _ApiSimple extends ApiBase {
|
|
|
216
206
|
}
|
|
217
207
|
}
|
|
218
208
|
};
|
|
219
|
-
__name(_ApiSimple, "ApiSimple");
|
|
220
|
-
var ApiSimple = _ApiSimple;
|
|
221
209
|
|
|
222
210
|
// src/Api/Api.ts
|
|
223
|
-
var
|
|
211
|
+
var ArchivistApi = class extends ApiSimple {
|
|
224
212
|
huri(huri) {
|
|
225
213
|
const huriObj = typeof huri === "string" ? new import_huri.Huri(huri) : huri;
|
|
226
214
|
return new ApiSimple({
|
|
@@ -229,31 +217,24 @@ var _ArchivistApi = class _ArchivistApi extends ApiSimple {
|
|
|
229
217
|
});
|
|
230
218
|
}
|
|
231
219
|
};
|
|
232
|
-
__name(_ArchivistApi, "ArchivistApi");
|
|
233
|
-
var ArchivistApi = _ArchivistApi;
|
|
234
220
|
|
|
235
221
|
// src/Diviner/LocationDiviner/LocationDivinerApi.ts
|
|
236
222
|
var import_axios3 = require("@xylabs/axios");
|
|
237
223
|
|
|
238
224
|
// src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts
|
|
239
225
|
var import_axios2 = require("@xylabs/axios");
|
|
240
|
-
var locationDivinerApiResponseTransformer =
|
|
226
|
+
var locationDivinerApiResponseTransformer = (data, _headers) => {
|
|
241
227
|
return data.data;
|
|
242
|
-
}
|
|
243
|
-
var getLocationDivinerApiResponseTransformer =
|
|
228
|
+
};
|
|
229
|
+
var getLocationDivinerApiResponseTransformer = (axiosInstance = import_axios2.axios) => {
|
|
244
230
|
return axiosInstance.defaults.transformResponse ? [
|
|
245
|
-
...Array.isArray(axiosInstance.defaults.transformResponse) ? axiosInstance.defaults.transformResponse : [
|
|
246
|
-
axiosInstance.defaults.transformResponse
|
|
247
|
-
],
|
|
248
|
-
locationDivinerApiResponseTransformer
|
|
249
|
-
] : [
|
|
231
|
+
...Array.isArray(axiosInstance.defaults.transformResponse) ? axiosInstance.defaults.transformResponse : [axiosInstance.defaults.transformResponse],
|
|
250
232
|
locationDivinerApiResponseTransformer
|
|
251
|
-
];
|
|
252
|
-
}
|
|
233
|
+
] : [locationDivinerApiResponseTransformer];
|
|
234
|
+
};
|
|
253
235
|
|
|
254
236
|
// src/Diviner/LocationDiviner/LocationDivinerApi.ts
|
|
255
|
-
var
|
|
256
|
-
var LocationDivinerApi = (_a = class {
|
|
237
|
+
var LocationDivinerApi = class {
|
|
257
238
|
config;
|
|
258
239
|
constructor(config) {
|
|
259
240
|
this.config = config;
|
|
@@ -267,25 +248,23 @@ var LocationDivinerApi = (_a = class {
|
|
|
267
248
|
return (await import_axios3.axios.get(`${this.config.apiDomain}/location/query/${hash}`, this.axiosRequestConfig)).data;
|
|
268
249
|
}
|
|
269
250
|
async postLocationQuery(request) {
|
|
270
|
-
return (await import_axios3.axios.post(`${this.config.apiDomain}/location/query`, {
|
|
271
|
-
...request
|
|
272
|
-
}, this.axiosRequestConfig)).data;
|
|
251
|
+
return (await import_axios3.axios.post(`${this.config.apiDomain}/location/query`, { ...request }, this.axiosRequestConfig)).data;
|
|
273
252
|
}
|
|
274
|
-
}
|
|
253
|
+
};
|
|
275
254
|
|
|
276
255
|
// src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.ts
|
|
277
256
|
var locationHeatmapQuerySchema = "network.xyo.location.heatmap.query";
|
|
278
257
|
var locationHeatmapAnswerSchema = "network.xyo.location.heatmap.answer";
|
|
279
|
-
var isLocationHeatmapQuery =
|
|
258
|
+
var isLocationHeatmapQuery = (query) => {
|
|
280
259
|
return query && (query == null ? void 0 : query.schema) === locationHeatmapQuerySchema;
|
|
281
|
-
}
|
|
260
|
+
};
|
|
282
261
|
|
|
283
262
|
// src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.ts
|
|
284
263
|
var locationQuadkeyHeatmapQuerySchema = "network.xyo.location.heatmap.quadkey.query";
|
|
285
264
|
var locationQuadkeyHeatmapAnswerSchema = "network.xyo.location.heatmap.quadkey.answer";
|
|
286
|
-
var isLocationQuadkeyHeatmapQuery =
|
|
265
|
+
var isLocationQuadkeyHeatmapQuery = (query) => {
|
|
287
266
|
return query && (query == null ? void 0 : query.schema) === locationQuadkeyHeatmapQuerySchema;
|
|
288
|
-
}
|
|
267
|
+
};
|
|
289
268
|
|
|
290
269
|
// src/Diviner/LocationDiviner/Queries/LocationQuerySchema.ts
|
|
291
270
|
var locationQuerySchemas = {
|
|
@@ -293,16 +272,16 @@ var locationQuerySchemas = {
|
|
|
293
272
|
"network.xyo.location.heatmap.query": true,
|
|
294
273
|
"network.xyo.location.range.query": true
|
|
295
274
|
};
|
|
296
|
-
var isSupportedLocationQuerySchema =
|
|
275
|
+
var isSupportedLocationQuerySchema = (schema) => {
|
|
297
276
|
return locationQuerySchemas[schema] || false;
|
|
298
|
-
}
|
|
277
|
+
};
|
|
299
278
|
|
|
300
279
|
// src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.ts
|
|
301
280
|
var LocationTimeRangeQuerySchema = "network.xyo.location.range.query";
|
|
302
281
|
var LocationTimeRangeAnswerSchema = "network.xyo.location.range.answer";
|
|
303
|
-
var isLocationTimeRangeQuery =
|
|
282
|
+
var isLocationTimeRangeQuery = (query) => {
|
|
304
283
|
return query && (query == null ? void 0 : query.schema) === LocationTimeRangeAnswerSchema;
|
|
305
|
-
}
|
|
284
|
+
};
|
|
306
285
|
|
|
307
286
|
// src/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.ts
|
|
308
287
|
var CurrentLocationWitnessSchema = "co.coinapp.currentlocationwitness";
|
package/dist/node/index.cjs.map
CHANGED
|
@@ -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/index.js'\nexport * from './Base.js'\nexport * from './Diviner/index.js'\nexport * from './models/index.js'\nexport * from './Simple.js'\nexport * from './WithArchive.js'\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.js'\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.js'\nimport { objToQuery } from './objToQuery.js'\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.js'\nimport { GetLocationQueryResponse } from './models.js'\nimport { LocationQueryCreationResponse, SupportedLocationQueryCreationRequest } from './Queries/index.js'\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/index.js'\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/index.js'\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/index.js'\nimport { LocationQuadkeyHeatmapQuerySchema } from './LocationQuadkeyHeatmapQuery/index.js'\nimport { LocationTimeRangeQuerySchema } from './LocationTimeRangeQuery/index.js'\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/index.js'\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/index.js'\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,WAAN,MAAMA,SAAAA;EACFC;EACCC;EAEVC,YAAYF,QAAW;AACrB,SAAKA,SAASA;AACd,SAAKC,QAAQ,IAAIE,uBAAU;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,K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AAGQ;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,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":["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","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"]}
|
|
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/index.js'\nexport * from './Base.js'\nexport * from './Diviner/index.js'\nexport * from './models/index.js'\nexport * from './Simple.js'\nexport * from './WithArchive.js'\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.js'\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.js'\nimport { objToQuery } from './objToQuery.js'\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.js'\nimport { GetLocationQueryResponse } from './models.js'\nimport { LocationQueryCreationResponse, SupportedLocationQueryCreationRequest } from './Queries/index.js'\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/index.js'\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/index.js'\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/index.js'\nimport { LocationQuadkeyHeatmapQuerySchema } from './LocationQuadkeyHeatmapQuery/index.js'\nimport { LocationTimeRangeQuerySchema } from './LocationTimeRangeQuery/index.js'\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/index.js'\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/index.js'\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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kBAAqB;;;ACDrB,mBAA0B;AAanB,IAAM,UAAN,MAAM,SAAkE;AAAA,EACpE;AAAA,EACC;AAAA,EAEV,YAAY,QAAW;AACrB,SAAK,SAAS;AACd,SAAK,QAAQ,IAAI,uBAAU,EAAE,GAAG,KAAK,QAAQ,SAAS,KAAK,QAAQ,CAAC;AAAA,EACtE;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,CAAC,CAAC,KAAK,OAAO,UAAU,CAAC,CAAC,KAAK,OAAO;AAAA,EAC/C;AAAA,EAEA,IAAc,UAAkC;AAC9C,UAAM,UAAkC,CAAC;AACzC,QAAI,KAAK,OAAO,UAAU;AACxB,cAAQ,gBAAgB,UAAU,KAAK,OAAO,QAAQ;AAAA,IACxD;AACA,QAAI,KAAK,OAAO,QAAQ;AACtB,cAAQ,WAAW,IAAI,KAAK,OAAO;AAAA,IACrC;AACA,WAAO;AAAA,EACT;AAAA,EAEA,IAAc,QAAQ;AACpB,WAAO,KAAK,OAAO,SAAS;AAAA,EAC9B;AAAA,EAEA,IAAc,OAAO;AACnB,WAAO,KAAK,OAAO,QAAQ;AAAA,EAC7B;AAAA,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,KAAK,kBAAkB,GAAG;AAAA,EAC/I;AACF;;;AEvBO,IAAM,6BAAyD;AAG/D,IAAM,8BAA2D;AAQjE,IAAM,yBAAyB,CAAC,UAAkE;AACvG,SAAO,UAAS,+BAAO,YAAW;AACpC;;;ACbO,IAAM,oCAAuE;AAE7E,IAAM,qCAAyE;AAO/E,IAAM,gCAAgC,CAAC,UAAyE;AACrH,SAAO,UAAS,+BAAO,YAAW;AACpC;;;ACRA,IAAM,uBAA0D;AAAA,EAC9D,8CAA8C;AAAA,EAC9C,sCAAsC;AAAA,EACtC,oCAAoC;AACtC;AAEO,IAAM,iCAAiC,CAAC,WAAkD;AAC/F,SAAO,qBAAqB,MAA6B,KAAK;AAChE;;;ACXO,IAAM,+BAA6D;AAGnE,IAAM,gCAA+D;AAUrE,IAAM,2BAA2B,CAAC,UAAoE;AAC3G,SAAO,UAAS,+BAAO,YAAW;AACpC;;;ACfO,IAAM,+BAA6D;;;ACAnE,IAAM,wBAA+C;;;ACErD,IAAM,4BAAuD;","names":["import_axios","import_axios"]}
|
package/dist/node/index.js
CHANGED
|
@@ -1,20 +1,14 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// src/Api/Api.ts
|
|
5
2
|
import { Huri } from "@xyo-network/huri";
|
|
6
3
|
|
|
7
4
|
// src/Base.ts
|
|
8
5
|
import { AxiosJson } from "@xylabs/axios";
|
|
9
|
-
var
|
|
6
|
+
var ApiBase = class _ApiBase {
|
|
10
7
|
config;
|
|
11
8
|
axios;
|
|
12
9
|
constructor(config) {
|
|
13
10
|
this.config = config;
|
|
14
|
-
this.axios = new AxiosJson({
|
|
15
|
-
...this.config,
|
|
16
|
-
headers: this.headers
|
|
17
|
-
});
|
|
11
|
+
this.axios = new AxiosJson({ ...this.config, headers: this.headers });
|
|
18
12
|
}
|
|
19
13
|
get authenticated() {
|
|
20
14
|
return !!this.config.apiKey || !!this.config.jwtToken;
|
|
@@ -36,30 +30,26 @@ var _ApiBase = class _ApiBase {
|
|
|
36
30
|
return this.config.root ?? "/";
|
|
37
31
|
}
|
|
38
32
|
static resolveResponse(result) {
|
|
39
|
-
var
|
|
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
|
-
];
|
|
33
|
+
var _a;
|
|
34
|
+
return [(_a = result == null ? void 0 : result.data) == null ? void 0 : _a.data, result == null ? void 0 : result.data, result];
|
|
45
35
|
}
|
|
46
36
|
static shapeResponse(response, responseType) {
|
|
47
37
|
const resolvedResponse = _ApiBase.resolveResponse(response);
|
|
48
38
|
return responseType === "tuple" ? resolvedResponse : resolvedResponse[0];
|
|
49
39
|
}
|
|
50
40
|
onError(error, depth = 0) {
|
|
51
|
-
var
|
|
52
|
-
(_b = (
|
|
41
|
+
var _a, _b, _c, _d;
|
|
42
|
+
(_b = (_a = this.config.reportableParent) == null ? void 0 : _a.onError) == null ? void 0 : _b.call(_a, error, depth + 1);
|
|
53
43
|
(_d = (_c = this.config).onError) == null ? void 0 : _d.call(_c, error, depth);
|
|
54
44
|
}
|
|
55
45
|
onFailure(response, depth = 0) {
|
|
56
|
-
var
|
|
57
|
-
(_b = (
|
|
46
|
+
var _a, _b, _c, _d;
|
|
47
|
+
(_b = (_a = this.config.reportableParent) == null ? void 0 : _a.onFailure) == null ? void 0 : _b.call(_a, response, depth + 1);
|
|
58
48
|
(_d = (_c = this.config).onFailure) == null ? void 0 : _d.call(_c, response, depth);
|
|
59
49
|
}
|
|
60
50
|
onSuccess(response, depth = 0) {
|
|
61
|
-
var
|
|
62
|
-
(_b = (
|
|
51
|
+
var _a, _b, _c, _d;
|
|
52
|
+
(_b = (_a = this.config.reportableParent) == null ? void 0 : _a.onSuccess) == null ? void 0 : _b.call(_a, response, depth + 1);
|
|
63
53
|
(_d = (_c = this.config).onSuccess) == null ? void 0 : _d.call(_c, response, depth);
|
|
64
54
|
}
|
|
65
55
|
async deleteEndpoint(endPoint = "", responseType) {
|
|
@@ -113,18 +103,16 @@ var _ApiBase = class _ApiBase {
|
|
|
113
103
|
return `${this.config.apiDomain}${this.root}`;
|
|
114
104
|
}
|
|
115
105
|
};
|
|
116
|
-
__name(_ApiBase, "ApiBase");
|
|
117
|
-
var ApiBase = _ApiBase;
|
|
118
106
|
|
|
119
107
|
// src/objToQuery.ts
|
|
120
|
-
var objToQuery =
|
|
108
|
+
var objToQuery = (obj) => {
|
|
121
109
|
return `?${Object.entries(obj).map(([key, value]) => {
|
|
122
110
|
return `${key}=${value}`;
|
|
123
111
|
}).filter((value) => value !== void 0).join("&")}`;
|
|
124
|
-
}
|
|
112
|
+
};
|
|
125
113
|
|
|
126
114
|
// src/Simple.ts
|
|
127
|
-
var
|
|
115
|
+
var ApiSimple = class extends ApiBase {
|
|
128
116
|
async delete(responseType) {
|
|
129
117
|
switch (responseType) {
|
|
130
118
|
case "tuple": {
|
|
@@ -176,11 +164,9 @@ var _ApiSimple = class _ApiSimple extends ApiBase {
|
|
|
176
164
|
}
|
|
177
165
|
}
|
|
178
166
|
};
|
|
179
|
-
__name(_ApiSimple, "ApiSimple");
|
|
180
|
-
var ApiSimple = _ApiSimple;
|
|
181
167
|
|
|
182
168
|
// src/Api/Api.ts
|
|
183
|
-
var
|
|
169
|
+
var ArchivistApi = class extends ApiSimple {
|
|
184
170
|
huri(huri) {
|
|
185
171
|
const huriObj = typeof huri === "string" ? new Huri(huri) : huri;
|
|
186
172
|
return new ApiSimple({
|
|
@@ -189,31 +175,24 @@ var _ArchivistApi = class _ArchivistApi extends ApiSimple {
|
|
|
189
175
|
});
|
|
190
176
|
}
|
|
191
177
|
};
|
|
192
|
-
__name(_ArchivistApi, "ArchivistApi");
|
|
193
|
-
var ArchivistApi = _ArchivistApi;
|
|
194
178
|
|
|
195
179
|
// src/Diviner/LocationDiviner/LocationDivinerApi.ts
|
|
196
180
|
import { axios as axios2 } from "@xylabs/axios";
|
|
197
181
|
|
|
198
182
|
// src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts
|
|
199
183
|
import { axios } from "@xylabs/axios";
|
|
200
|
-
var locationDivinerApiResponseTransformer =
|
|
184
|
+
var locationDivinerApiResponseTransformer = (data, _headers) => {
|
|
201
185
|
return data.data;
|
|
202
|
-
}
|
|
203
|
-
var getLocationDivinerApiResponseTransformer =
|
|
186
|
+
};
|
|
187
|
+
var getLocationDivinerApiResponseTransformer = (axiosInstance = axios) => {
|
|
204
188
|
return axiosInstance.defaults.transformResponse ? [
|
|
205
|
-
...Array.isArray(axiosInstance.defaults.transformResponse) ? axiosInstance.defaults.transformResponse : [
|
|
206
|
-
axiosInstance.defaults.transformResponse
|
|
207
|
-
],
|
|
208
|
-
locationDivinerApiResponseTransformer
|
|
209
|
-
] : [
|
|
189
|
+
...Array.isArray(axiosInstance.defaults.transformResponse) ? axiosInstance.defaults.transformResponse : [axiosInstance.defaults.transformResponse],
|
|
210
190
|
locationDivinerApiResponseTransformer
|
|
211
|
-
];
|
|
212
|
-
}
|
|
191
|
+
] : [locationDivinerApiResponseTransformer];
|
|
192
|
+
};
|
|
213
193
|
|
|
214
194
|
// src/Diviner/LocationDiviner/LocationDivinerApi.ts
|
|
215
|
-
var
|
|
216
|
-
var LocationDivinerApi = (_a = class {
|
|
195
|
+
var LocationDivinerApi = class {
|
|
217
196
|
config;
|
|
218
197
|
constructor(config) {
|
|
219
198
|
this.config = config;
|
|
@@ -227,25 +206,23 @@ var LocationDivinerApi = (_a = class {
|
|
|
227
206
|
return (await axios2.get(`${this.config.apiDomain}/location/query/${hash}`, this.axiosRequestConfig)).data;
|
|
228
207
|
}
|
|
229
208
|
async postLocationQuery(request) {
|
|
230
|
-
return (await axios2.post(`${this.config.apiDomain}/location/query`, {
|
|
231
|
-
...request
|
|
232
|
-
}, this.axiosRequestConfig)).data;
|
|
209
|
+
return (await axios2.post(`${this.config.apiDomain}/location/query`, { ...request }, this.axiosRequestConfig)).data;
|
|
233
210
|
}
|
|
234
|
-
}
|
|
211
|
+
};
|
|
235
212
|
|
|
236
213
|
// src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.ts
|
|
237
214
|
var locationHeatmapQuerySchema = "network.xyo.location.heatmap.query";
|
|
238
215
|
var locationHeatmapAnswerSchema = "network.xyo.location.heatmap.answer";
|
|
239
|
-
var isLocationHeatmapQuery =
|
|
216
|
+
var isLocationHeatmapQuery = (query) => {
|
|
240
217
|
return query && (query == null ? void 0 : query.schema) === locationHeatmapQuerySchema;
|
|
241
|
-
}
|
|
218
|
+
};
|
|
242
219
|
|
|
243
220
|
// src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.ts
|
|
244
221
|
var locationQuadkeyHeatmapQuerySchema = "network.xyo.location.heatmap.quadkey.query";
|
|
245
222
|
var locationQuadkeyHeatmapAnswerSchema = "network.xyo.location.heatmap.quadkey.answer";
|
|
246
|
-
var isLocationQuadkeyHeatmapQuery =
|
|
223
|
+
var isLocationQuadkeyHeatmapQuery = (query) => {
|
|
247
224
|
return query && (query == null ? void 0 : query.schema) === locationQuadkeyHeatmapQuerySchema;
|
|
248
|
-
}
|
|
225
|
+
};
|
|
249
226
|
|
|
250
227
|
// src/Diviner/LocationDiviner/Queries/LocationQuerySchema.ts
|
|
251
228
|
var locationQuerySchemas = {
|
|
@@ -253,16 +230,16 @@ var locationQuerySchemas = {
|
|
|
253
230
|
"network.xyo.location.heatmap.query": true,
|
|
254
231
|
"network.xyo.location.range.query": true
|
|
255
232
|
};
|
|
256
|
-
var isSupportedLocationQuerySchema =
|
|
233
|
+
var isSupportedLocationQuerySchema = (schema) => {
|
|
257
234
|
return locationQuerySchemas[schema] || false;
|
|
258
|
-
}
|
|
235
|
+
};
|
|
259
236
|
|
|
260
237
|
// src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.ts
|
|
261
238
|
var LocationTimeRangeQuerySchema = "network.xyo.location.range.query";
|
|
262
239
|
var LocationTimeRangeAnswerSchema = "network.xyo.location.range.answer";
|
|
263
|
-
var isLocationTimeRangeQuery =
|
|
240
|
+
var isLocationTimeRangeQuery = (query) => {
|
|
264
241
|
return query && (query == null ? void 0 : query.schema) === LocationTimeRangeAnswerSchema;
|
|
265
|
-
}
|
|
242
|
+
};
|
|
266
243
|
|
|
267
244
|
// src/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.ts
|
|
268
245
|
var CurrentLocationWitnessSchema = "co.coinapp.currentlocationwitness";
|