@xyo-network/api 5.3.30 → 5.4.0
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/README.md +0 -3725
- package/dist/neutral/Base.d.ts +3 -3
- package/dist/neutral/Base.d.ts.map +1 -1
- package/dist/neutral/index.d.ts +0 -1
- package/dist/neutral/index.d.ts.map +1 -1
- package/dist/neutral/index.mjs +18 -121
- package/dist/neutral/index.mjs.map +1 -1
- package/package.json +27 -35
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApi.d.ts +0 -12
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApi.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts +0 -10
- package/dist/neutral/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts +0 -5
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts +0 -16
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts +0 -3
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts +0 -16
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts +0 -2
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts +0 -18
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts +0 -5
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts +0 -7
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuerySchema.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts +0 -8
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts +0 -16
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts +0 -3
- package/dist/neutral/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/index.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Queries/index.d.ts +0 -7
- package/dist/neutral/Diviner/LocationDiviner/Queries/index.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts +0 -15
- package/dist/neutral/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts +0 -23
- package/dist/neutral/Diviner/LocationDiviner/Witnesses/LocationWitness.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/Witnesses/index.d.ts +0 -3
- package/dist/neutral/Diviner/LocationDiviner/Witnesses/index.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/index.d.ts +0 -5
- package/dist/neutral/Diviner/LocationDiviner/index.d.ts.map +0 -1
- package/dist/neutral/Diviner/LocationDiviner/models.d.ts +0 -5
- package/dist/neutral/Diviner/LocationDiviner/models.d.ts.map +0 -1
- package/dist/neutral/Diviner/RemoteDivinerConfig.d.ts +0 -13
- package/dist/neutral/Diviner/RemoteDivinerConfig.d.ts.map +0 -1
- package/dist/neutral/Diviner/RemoteDivinerError.d.ts +0 -6
- package/dist/neutral/Diviner/RemoteDivinerError.d.ts.map +0 -1
- package/dist/neutral/Diviner/index.d.ts +0 -4
- package/dist/neutral/Diviner/index.d.ts.map +0 -1
package/dist/neutral/Base.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { FetchJsonClient } from '@xylabs/sdk-js';
|
|
1
2
|
import type { ApiConfig, ApiEnvelope, ApiError, ApiReportable, ApiResponse, ApiResponseBody, ApiResponseTuple } from '@xyo-network/api-models';
|
|
2
|
-
import { Axios } from 'axios';
|
|
3
3
|
export declare class ApiBase<C extends ApiConfig = ApiConfig> implements ApiReportable {
|
|
4
4
|
readonly config: C;
|
|
5
|
-
protected
|
|
5
|
+
protected fetchClient: FetchJsonClient;
|
|
6
6
|
constructor(config: C);
|
|
7
7
|
get authenticated(): boolean;
|
|
8
8
|
protected get headers(): Record<string, string>;
|
|
@@ -19,7 +19,7 @@ export declare class ApiBase<C extends ApiConfig = ApiConfig> implements ApiRepo
|
|
|
19
19
|
protected getEndpoint<T = unknown>(endPoint?: string): Promise<ApiResponseBody<T>>;
|
|
20
20
|
protected getEndpoint<T = unknown>(endPoint?: string, responseType?: 'body'): Promise<ApiResponseBody<T>>;
|
|
21
21
|
protected getEndpoint<T = unknown>(endPoint?: string, responseType?: 'tuple'): Promise<ApiResponseTuple<T>>;
|
|
22
|
-
protected handleMonitorResponseError<T>(error:
|
|
22
|
+
protected handleMonitorResponseError<T>(error: unknown, trapFetchException: boolean): ApiResponse<ApiEnvelope<T>> | undefined;
|
|
23
23
|
protected monitorResponse<T>(closure: () => Promise<ApiResponse<ApiEnvelope<T>>>): Promise<ApiResponse<ApiEnvelope<T>> | undefined>;
|
|
24
24
|
protected postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D): Promise<ApiResponseBody<T>>;
|
|
25
25
|
protected postEndpoint<T = unknown, D = unknown>(endPoint?: string, data?: D, responseType?: 'body'): Promise<ApiResponseBody<T>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../src/Base.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Base.d.ts","sourceRoot":"","sources":["../../src/Base.ts"],"names":[],"mappings":"AAAA,OAAO,EACa,eAAe,EAClC,MAAM,gBAAgB,CAAA;AACvB,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,QAAQ,EACR,aAAa,EACb,WAAW,EACX,eAAe,EACf,gBAAgB,EAGjB,MAAM,yBAAyB,CAAA;AAEhC,qBAAa,OAAO,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,CAAE,YAAW,aAAa;IAC5E,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAA;IAClB,SAAS,CAAC,WAAW,EAAE,eAAe,CAAA;gBAE1B,MAAM,EAAE,CAAC;IAKrB,IAAI,aAAa,YAEhB;IAED,SAAS,KAAK,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAS9C;IAED,SAAS,KAAK,KAAK,WAElB;IAED,SAAS,KAAK,IAAI,WAEjB;IAED,OAAO,CAAC,MAAM,CAAC,eAAe;IAI9B,OAAO,CAAC,MAAM,CAAC,aAAa;IAK5B,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,SAAI;IAKlC,SAAS,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,SAAI;IAK1C,SAAS,CAAC,QAAQ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"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA;AAC9B,cAAc,WAAW,CAAA;AACzB,cAAc,mBAAmB,CAAA;AACjC,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
import { Huri } from "@xyo-network/huri";
|
|
3
3
|
|
|
4
4
|
// src/Base.ts
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import {
|
|
6
|
+
FetchClientError,
|
|
7
|
+
FetchJsonClient,
|
|
8
|
+
isString
|
|
9
|
+
} from "@xylabs/sdk-js";
|
|
7
10
|
var ApiBase = class _ApiBase {
|
|
8
11
|
config;
|
|
9
|
-
|
|
12
|
+
fetchClient;
|
|
10
13
|
constructor(config) {
|
|
11
14
|
this.config = config;
|
|
12
|
-
this.
|
|
15
|
+
this.fetchClient = new FetchJsonClient({ ...this.config, headers: this.headers });
|
|
13
16
|
}
|
|
14
17
|
get authenticated() {
|
|
15
18
|
return isString(this.config.apiKey) || isString(this.config.jwtToken);
|
|
@@ -51,21 +54,21 @@ var ApiBase = class _ApiBase {
|
|
|
51
54
|
}
|
|
52
55
|
async deleteEndpoint(endPoint = "", responseType) {
|
|
53
56
|
const response = await this.monitorResponse(async () => {
|
|
54
|
-
return await this.
|
|
57
|
+
return await this.fetchClient.delete(`${this.resolveRoot()}${endPoint}${this.query}`);
|
|
55
58
|
});
|
|
56
59
|
return _ApiBase.shapeResponse(response, responseType);
|
|
57
60
|
}
|
|
58
61
|
async getEndpoint(endPoint = "", responseType) {
|
|
59
62
|
const response = await this.monitorResponse(async () => {
|
|
60
|
-
return await this.
|
|
63
|
+
return await this.fetchClient.get(`${this.resolveRoot()}${endPoint}${this.query}`);
|
|
61
64
|
});
|
|
62
65
|
return _ApiBase.shapeResponse(response, responseType);
|
|
63
66
|
}
|
|
64
|
-
handleMonitorResponseError(error,
|
|
65
|
-
if (!error
|
|
67
|
+
handleMonitorResponseError(error, trapFetchException) {
|
|
68
|
+
if (!(error instanceof FetchClientError)) {
|
|
66
69
|
throw error;
|
|
67
70
|
}
|
|
68
|
-
if (
|
|
71
|
+
if (trapFetchException) {
|
|
69
72
|
error.response ? this.onFailure(error.response) : this.onError(error);
|
|
70
73
|
if (this.config.throwFailure) {
|
|
71
74
|
throw error;
|
|
@@ -74,25 +77,25 @@ var ApiBase = class _ApiBase {
|
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
async monitorResponse(closure) {
|
|
77
|
-
let
|
|
80
|
+
let trapFetchException = true;
|
|
78
81
|
try {
|
|
79
82
|
const response = await closure();
|
|
80
|
-
|
|
83
|
+
trapFetchException = false;
|
|
81
84
|
response.status < 300 ? this.onSuccess(response) : this.onFailure(response);
|
|
82
85
|
return response;
|
|
83
86
|
} catch (error) {
|
|
84
|
-
this.handleMonitorResponseError(error,
|
|
87
|
+
this.handleMonitorResponseError(error, trapFetchException);
|
|
85
88
|
}
|
|
86
89
|
}
|
|
87
90
|
async postEndpoint(endPoint = "", data, responseType) {
|
|
88
91
|
const response = await this.monitorResponse(async () => {
|
|
89
|
-
return await this.
|
|
92
|
+
return await this.fetchClient.post(`${this.resolveRoot()}${endPoint}${this.query}`, data);
|
|
90
93
|
});
|
|
91
94
|
return _ApiBase.shapeResponse(response, responseType);
|
|
92
95
|
}
|
|
93
96
|
async putEndpoint(endPoint = "", data, responseType) {
|
|
94
97
|
const response = await this.monitorResponse(async () => {
|
|
95
|
-
return await this.
|
|
98
|
+
return await this.fetchClient.put(`${this.resolveRoot()}${endPoint}${this.query}`, data);
|
|
96
99
|
});
|
|
97
100
|
return _ApiBase.shapeResponse(response, responseType);
|
|
98
101
|
}
|
|
@@ -172,115 +175,9 @@ var ArchivistApi = class extends ApiSimple {
|
|
|
172
175
|
});
|
|
173
176
|
}
|
|
174
177
|
};
|
|
175
|
-
|
|
176
|
-
// src/Diviner/LocationDiviner/LocationDivinerApi.ts
|
|
177
|
-
import { axiosJson } from "@xylabs/sdk-js";
|
|
178
|
-
|
|
179
|
-
// src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts
|
|
180
|
-
import axios from "axios";
|
|
181
|
-
var locationDivinerApiResponseTransformer = (data, _headers) => {
|
|
182
|
-
return data.data;
|
|
183
|
-
};
|
|
184
|
-
var getLocationDivinerApiResponseTransformer = (axiosInstance = axios) => {
|
|
185
|
-
return axiosInstance.defaults.transformResponse ? [
|
|
186
|
-
...Array.isArray(axiosInstance.defaults.transformResponse) ? axiosInstance.defaults.transformResponse : [axiosInstance.defaults.transformResponse],
|
|
187
|
-
locationDivinerApiResponseTransformer
|
|
188
|
-
] : [locationDivinerApiResponseTransformer];
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
// src/Diviner/LocationDiviner/LocationDivinerApi.ts
|
|
192
|
-
var LocationDivinerApi = class {
|
|
193
|
-
config;
|
|
194
|
-
constructor(config) {
|
|
195
|
-
this.config = config;
|
|
196
|
-
}
|
|
197
|
-
get axiosRequestConfig() {
|
|
198
|
-
return { transformResponse: getLocationDivinerApiResponseTransformer() };
|
|
199
|
-
}
|
|
200
|
-
async getLocationQuery(hash) {
|
|
201
|
-
return (await axiosJson.get(`${this.config.apiDomain}/location/query/${hash}`, this.axiosRequestConfig)).data;
|
|
202
|
-
}
|
|
203
|
-
async postLocationQuery(request) {
|
|
204
|
-
return (await axiosJson.post(`${this.config.apiDomain}/location/query`, { ...request }, this.axiosRequestConfig)).data;
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
// src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.ts
|
|
209
|
-
import { asSchema } from "@xyo-network/payload-model";
|
|
210
|
-
var LocationHeatmapQuerySchema = asSchema("network.xyo.location.heatmap.query", true);
|
|
211
|
-
var LocationHeatmapAnswerSchema = asSchema("network.xyo.location.heatmap.answer", true);
|
|
212
|
-
var isLocationHeatmapQuery = (query) => {
|
|
213
|
-
return query && query?.schema === LocationHeatmapQuerySchema;
|
|
214
|
-
};
|
|
215
|
-
|
|
216
|
-
// src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.ts
|
|
217
|
-
import { asSchema as asSchema2 } from "@xyo-network/payload-model";
|
|
218
|
-
var LocationQuadkeyHeatmapQuerySchema = asSchema2("network.xyo.location.heatmap.quadkey.query", true);
|
|
219
|
-
var LocationQuadkeyHeatmapAnswerSchema = asSchema2("network.xyo.location.heatmap.quadkey.answer", true);
|
|
220
|
-
var isLocationQuadkeyHeatmapQuery = (query) => {
|
|
221
|
-
return query && query?.schema === LocationQuadkeyHeatmapQuerySchema;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
// src/Diviner/LocationDiviner/Queries/LocationQuerySchema.ts
|
|
225
|
-
var locationQuerySchemas = {
|
|
226
|
-
"network.xyo.location.heatmap.quadkey.query": true,
|
|
227
|
-
"network.xyo.location.heatmap.query": true,
|
|
228
|
-
"network.xyo.location.range.query": true
|
|
229
|
-
};
|
|
230
|
-
var isSupportedLocationQuerySchema = (schema) => {
|
|
231
|
-
return locationQuerySchemas[schema] || false;
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
// src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.ts
|
|
235
|
-
import { asSchema as asSchema5, isPayload } from "@xyo-network/payload-model";
|
|
236
|
-
|
|
237
|
-
// src/Diviner/LocationDiviner/Witnesses/CurrentLocationWitness.ts
|
|
238
|
-
import { asSchema as asSchema3 } from "@xyo-network/payload-model";
|
|
239
|
-
var CurrentLocationWitnessSchema = asSchema3("co.coinapp.currentlocationwitness", true);
|
|
240
|
-
|
|
241
|
-
// src/Diviner/LocationDiviner/Witnesses/LocationWitness.ts
|
|
242
|
-
import { asSchema as asSchema4 } from "@xyo-network/payload-model";
|
|
243
|
-
var LocationWitnessSchema = asSchema4("network.xyo.location", true);
|
|
244
|
-
|
|
245
|
-
// src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangeQuery.ts
|
|
246
|
-
var LocationTimeRangeQuerySchema = asSchema5("network.xyo.location.range.query", true);
|
|
247
|
-
var LocationTimeRangeAnswerSchema = asSchema5("network.xyo.location.range.answer", true);
|
|
248
|
-
var isLocationTimeRangeQuery = isPayload([LocationWitnessSchema]);
|
|
249
|
-
|
|
250
|
-
// src/Diviner/RemoteDivinerConfig.ts
|
|
251
|
-
import { asSchema as asSchema6 } from "@xyo-network/payload-model";
|
|
252
|
-
var RemoteDivinerConfigSchema = asSchema6("network.xyo.diviner.remote.config", true);
|
|
253
|
-
|
|
254
|
-
// src/Diviner/RemoteDivinerError.ts
|
|
255
|
-
import { isString as isString2 } from "@xylabs/sdk-js";
|
|
256
|
-
var RemoteDivinerError = class extends Error {
|
|
257
|
-
isRemoteDivinerError = true;
|
|
258
|
-
constructor(action, error, message) {
|
|
259
|
-
const messageString = isString2(message) ? ` (${message})` : "";
|
|
260
|
-
super(`Remote Diviner [${action}] failed${messageString}`, { cause: error });
|
|
261
|
-
}
|
|
262
|
-
static isRemoteDivinerError(error) {
|
|
263
|
-
return error.isRemoteDivinerError ? error : void 0;
|
|
264
|
-
}
|
|
265
|
-
};
|
|
266
178
|
export {
|
|
267
179
|
ApiBase,
|
|
268
180
|
ApiSimple,
|
|
269
|
-
ArchivistApi
|
|
270
|
-
CurrentLocationWitnessSchema,
|
|
271
|
-
LocationDivinerApi,
|
|
272
|
-
LocationHeatmapAnswerSchema,
|
|
273
|
-
LocationHeatmapQuerySchema,
|
|
274
|
-
LocationQuadkeyHeatmapAnswerSchema,
|
|
275
|
-
LocationQuadkeyHeatmapQuerySchema,
|
|
276
|
-
LocationTimeRangeAnswerSchema,
|
|
277
|
-
LocationTimeRangeQuerySchema,
|
|
278
|
-
LocationWitnessSchema,
|
|
279
|
-
RemoteDivinerConfigSchema,
|
|
280
|
-
RemoteDivinerError,
|
|
281
|
-
isLocationHeatmapQuery,
|
|
282
|
-
isLocationQuadkeyHeatmapQuery,
|
|
283
|
-
isLocationTimeRangeQuery,
|
|
284
|
-
isSupportedLocationQuerySchema
|
|
181
|
+
ArchivistApi
|
|
285
182
|
};
|
|
286
183
|
//# sourceMappingURL=index.mjs.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","../../src/Diviner/RemoteDivinerError.ts"],"sourcesContent":["import type { ApiConfig } from '@xyo-network/api-models'\nimport { Huri } from '@xyo-network/huri'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport { ApiSimple } from '../Simple.ts'\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 { axiosJsonConfig, isString } from '@xylabs/sdk-js'\nimport type {\n ApiConfig,\n ApiEnvelope,\n ApiError,\n ApiReportable,\n ApiResponse,\n ApiResponseBody,\n ApiResponseTuple,\n ApiResponseTupleOrBody,\n ApiResponseType,\n} from '@xyo-network/api-models'\nimport { Axios } from 'axios'\n\nexport class ApiBase<C extends ApiConfig = ApiConfig> implements ApiReportable {\n readonly config: C\n protected axios: Axios\n\n constructor(config: C) {\n this.config = config\n this.axios = new Axios(axiosJsonConfig({ ...this.config, headers: this.headers }))\n }\n\n get authenticated() {\n return isString(this.config.apiKey) || isString(this.config.jwtToken)\n }\n\n protected get headers(): Record<string, string> {\n const headers: Record<string, string> = {}\n if (isString(this.config.jwtToken)) {\n headers.Authorization = `Bearer ${this.config.jwtToken}`\n }\n if (isString(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 // eslint-disable-next-line @typescript-eslint/no-unused-expressions\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\n trapAxiosException = false\n\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\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 type {\n ApiConfig, ApiResponseBody, ApiResponseTuple, ApiResponseTupleOrBody, ApiResponseType,\n} from '@xyo-network/api-models'\nimport type { Payload, PayloadFindFilter } from '@xyo-network/payload-model'\n\nimport { ApiBase } from './Base.ts'\nimport { objToQuery } from './objToQuery.ts'\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 { axiosJson } from '@xylabs/sdk-js'\nimport type { ApiConfig } from '@xyo-network/api-models'\nimport type { RawAxiosRequestConfig } from 'axios'\n\nimport { getLocationDivinerApiResponseTransformer } from './LocationDivinerApiResponseTransformer.ts'\nimport type { GetLocationQueryResponse } from './models.ts'\nimport type { LocationQueryCreationResponse, SupportedLocationQueryCreationRequest } from './Queries/index.ts'\n\nclass LocationDivinerApi {\n config: ApiConfig\n constructor(config: ApiConfig) {\n this.config = config\n }\n\n private get axiosRequestConfig(): RawAxiosRequestConfig {\n return { transformResponse: getLocationDivinerApiResponseTransformer() }\n }\n\n async getLocationQuery(hash: string) {\n return (await axiosJson.get<GetLocationQueryResponse>(`${this.config.apiDomain}/location/query/${hash}`, this.axiosRequestConfig)).data\n }\n\n async postLocationQuery(request: SupportedLocationQueryCreationRequest) {\n return (await axiosJson.post<LocationQueryCreationResponse>(`${this.config.apiDomain}/location/query`, { ...request }, this.axiosRequestConfig)).data\n }\n}\n\nexport { LocationDivinerApi }\n","import type { AxiosResponseTransformer } from 'axios'\nimport axios from '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 { asSchema } from '@xyo-network/payload-model'\n\nimport type { LocationWitnessSchema } from '../../Witnesses/index.ts'\n\nexport const LocationHeatmapQuerySchema = asSchema('network.xyo.location.heatmap.query', true)\nexport type LocationHeatmapQuerySchema = typeof LocationHeatmapQuerySchema\n\nexport const LocationHeatmapAnswerSchema = asSchema('network.xyo.location.heatmap.answer', true)\nexport type LocationHeatmapAnswerSchema = typeof LocationHeatmapAnswerSchema\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 { asSchema } from '@xyo-network/payload-model'\n\nimport type { LocationWitnessSchema } from '../../Witnesses/index.ts'\n\nexport const LocationQuadkeyHeatmapQuerySchema = asSchema('network.xyo.location.heatmap.quadkey.query', true)\nexport type LocationQuadkeyHeatmapQuerySchema = typeof LocationQuadkeyHeatmapQuerySchema\n\nexport const LocationQuadkeyHeatmapAnswerSchema = asSchema('network.xyo.location.heatmap.quadkey.answer', true)\nexport type LocationQuadkeyHeatmapAnswerSchema = typeof LocationQuadkeyHeatmapAnswerSchema\n\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 type { Schema } from '@xyo-network/payload-model'\n\nimport type { LocationHeatmapQuerySchema } from './LocationHeatmapQuery/index.ts'\nimport type { LocationQuadkeyHeatmapQuerySchema } from './LocationQuadkeyHeatmapQuery/index.ts'\nimport type { LocationTimeRangeQuerySchema } from './LocationTimeRangeQuery/index.ts'\n\nexport type LocationQuerySchema = LocationQuadkeyHeatmapQuerySchema | LocationHeatmapQuerySchema | LocationTimeRangeQuerySchema\n\nconst locationQuerySchemas: Record<string, 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: Schema): schema is LocationQuerySchema => {\n return locationQuerySchemas[schema as LocationQuerySchema] || false\n}\n","import { asSchema, isPayload } from '@xyo-network/payload-model'\n\nimport { LocationWitnessSchema } from '../../Witnesses/index.ts'\n\nexport const LocationTimeRangeQuerySchema = asSchema('network.xyo.location.range.query', true)\nexport type LocationTimeRangeQuerySchema = typeof LocationTimeRangeQuerySchema\n\nexport const LocationTimeRangeAnswerSchema = asSchema('network.xyo.location.range.answer', true)\nexport type LocationTimeRangeAnswerSchema = typeof LocationTimeRangeAnswerSchema\n\nexport type LocationTimeRangeQuery = {\n schema: LocationWitnessSchema\n startTime?: string\n stopTime?: string\n\n // TODO: Bounding rectangle, etc.\n}\n\nexport const isLocationTimeRangeQuery = isPayload([LocationWitnessSchema])\n","import { asSchema, type Payload } from '@xyo-network/payload-model'\n\nexport const CurrentLocationWitnessSchema = asSchema('co.coinapp.currentlocationwitness', true)\nexport type CurrentLocationWitnessSchema = typeof CurrentLocationWitnessSchema\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 { asSchema, type Payload } from '@xyo-network/payload-model'\n\nexport const LocationWitnessSchema = asSchema('network.xyo.location', true)\nexport type LocationWitnessSchema = typeof LocationWitnessSchema\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 type { DivinerConfig } from '@xyo-network/diviner-model'\nimport { asSchema } from '@xyo-network/payload-model'\n\nimport type { ArchivistApi } from '../Api/index.ts'\n\nexport const RemoteDivinerConfigSchema = asSchema('network.xyo.diviner.remote.config', true)\nexport type RemoteDivinerConfigSchema = typeof RemoteDivinerConfigSchema\n\nexport type RemoteDivinerConfig = DivinerConfig & {\n /** @deprecated use in params instead */\n api?: ArchivistApi\n archive?: string\n schema: RemoteDivinerConfigSchema\n}\n","import { isString } from '@xylabs/sdk-js'\n\nexport class RemoteDivinerError extends Error {\n isRemoteDivinerError = true\n constructor(action: string, error: Error['cause'], message?: string) {\n const messageString = isString(message) ? ` (${message})` : ''\n super(`Remote Diviner [${action}] failed${messageString}`, { cause: error })\n }\n\n static isRemoteDivinerError(error: unknown): RemoteDivinerError | undefined {\n return (error as RemoteDivinerError).isRemoteDivinerError ? (error as RemoteDivinerError) : undefined\n }\n}\n"],"mappings":";AACA,SAAS,YAAY;;;ACDrB,SAAS,iBAAiB,gBAAgB;AAY1C,SAAS,aAAa;AAEf,IAAM,UAAN,MAAM,SAAkE;AAAA,EACpE;AAAA,EACC;AAAA,EAEV,YAAY,QAAW;AACrB,SAAK,SAAS;AACd,SAAK,QAAQ,IAAI,MAAM,gBAAgB,EAAE,GAAG,KAAK,QAAQ,SAAS,KAAK,QAAQ,CAAC,CAAC;AAAA,EACnF;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,SAAS,KAAK,OAAO,MAAM,KAAK,SAAS,KAAK,OAAO,QAAQ;AAAA,EACtE;AAAA,EAEA,IAAc,UAAkC;AAC9C,UAAM,UAAkC,CAAC;AACzC,QAAI,SAAS,KAAK,OAAO,QAAQ,GAAG;AAClC,cAAQ,gBAAgB,UAAU,KAAK,OAAO,QAAQ;AAAA,IACxD;AACA,QAAI,SAAS,KAAK,OAAO,MAAM,GAAG;AAChC,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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ema","asSchema","asSchema","asSchema","asSchema","isString"]}
|
|
1
|
+
{"version":3,"sources":["../../src/Api/Api.ts","../../src/Base.ts","../../src/objToQuery.ts","../../src/Simple.ts"],"sourcesContent":["import type { ApiConfig } from '@xyo-network/api-models'\nimport { Huri } from '@xyo-network/huri'\nimport type { Payload } from '@xyo-network/payload-model'\n\nimport { ApiSimple } from '../Simple.ts'\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 {\n FetchClientError, FetchJsonClient, isString,\n} from '@xylabs/sdk-js'\nimport type {\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 fetchClient: FetchJsonClient\n\n constructor(config: C) {\n this.config = config\n this.fetchClient = new FetchJsonClient({ ...this.config, headers: this.headers })\n }\n\n get authenticated() {\n return isString(this.config.apiKey) || isString(this.config.jwtToken)\n }\n\n protected get headers(): Record<string, string> {\n const headers: Record<string, string> = {}\n if (isString(this.config.jwtToken)) {\n headers.Authorization = `Bearer ${this.config.jwtToken}`\n }\n if (isString(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.fetchClient.delete<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.fetchClient.get<ApiEnvelope<T>>(`${this.resolveRoot()}${endPoint}${this.query}`)\n })\n return ApiBase.shapeResponse<T>(response, responseType)\n }\n\n protected handleMonitorResponseError<T>(error: unknown, trapFetchException: boolean) {\n if (!(error instanceof FetchClientError)) {\n throw error\n }\n\n if (trapFetchException) {\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n error.response ? this.onFailure(error.response) : this.onError(error as ApiError)\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 trapFetchException = true\n try {\n const response = await closure()\n\n trapFetchException = false\n\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n response.status < 300 ? this.onSuccess(response) : this.onFailure(response)\n\n return response\n } catch (error) {\n this.handleMonitorResponseError(error, trapFetchException)\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.fetchClient.post<ApiEnvelope<T>>(`${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.fetchClient.put<ApiEnvelope<T>>(`${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 type {\n ApiConfig, ApiResponseBody, ApiResponseTuple, ApiResponseTupleOrBody, ApiResponseType,\n} from '@xyo-network/api-models'\nimport type { Payload, PayloadFindFilter } from '@xyo-network/payload-model'\n\nimport { ApiBase } from './Base.ts'\nimport { objToQuery } from './objToQuery.ts'\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"],"mappings":";AACA,SAAS,YAAY;;;ACDrB;AAAA,EACE;AAAA,EAAkB;AAAA,EAAiB;AAAA,OAC9B;AAaA,IAAM,UAAN,MAAM,SAAkE;AAAA,EACpE;AAAA,EACC;AAAA,EAEV,YAAY,QAAW;AACrB,SAAK,SAAS;AACd,SAAK,cAAc,IAAI,gBAAgB,EAAE,GAAG,KAAK,QAAQ,SAAS,KAAK,QAAQ,CAAC;AAAA,EAClF;AAAA,EAEA,IAAI,gBAAgB;AAClB,WAAO,SAAS,KAAK,OAAO,MAAM,KAAK,SAAS,KAAK,OAAO,QAAQ;AAAA,EACtE;AAAA,EAEA,IAAc,UAAkC;AAC9C,UAAM,UAAkC,CAAC;AACzC,QAAI,SAAS,KAAK,OAAO,QAAQ,GAAG;AAClC,cAAQ,gBAAgB,UAAU,KAAK,OAAO,QAAQ;AAAA,IACxD;AACA,QAAI,SAAS,KAAK,OAAO,MAAM,GAAG;AAChC,cAAQ,WAAW,IAAI,KAAK,OAAO;AAAA,IACrC;AACA,WAAO;AAAA,EACT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AI,MAAU,cAAoE;AACtF,YAAQ,cAAc;AAAA,MACpB,KAAK,SAAS;AACZ,eAAO,MAAM,KAAK,YAAY,QAAW,MAAM,OAAO;AAAA,MACxD;AAAA,MACA,SAAS;AACP,eAAO,MAAM,KAAK,YAAY,QAAW,IAAI;AAAA,MAC/C;AAAA,IACF;AAAA,EACF;AACF;;;AH1EO,IAAM,eAAN,cAA4D,UAAwB;AAAA,EACzF,KAAK,MAAqB;AACxB,UAAM,UAAU,OAAO,SAAS,WAAW,IAAI,KAAK,IAAI,IAAI;AAC5D,WAAO,IAAI,UAAmB;AAAA,MAC5B,GAAG,KAAK;AAAA,MACR,MAAM,GAAG,KAAK,IAAI,GAAG,QAAQ,IAAI;AAAA,IACnC,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/api",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Primary SDK for using XYO Protocol 2.0",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -22,12 +22,10 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/neutral/index.d.ts",
|
|
25
|
-
"import": "./dist/neutral/index.mjs",
|
|
26
25
|
"default": "./dist/neutral/index.mjs"
|
|
27
26
|
},
|
|
28
27
|
"./package.json": "./package.json"
|
|
29
28
|
},
|
|
30
|
-
"types": "dist/neutral/index.d.ts",
|
|
31
29
|
"files": [
|
|
32
30
|
"dist",
|
|
33
31
|
"!**/*.bench.*",
|
|
@@ -36,49 +34,43 @@
|
|
|
36
34
|
"README.md"
|
|
37
35
|
],
|
|
38
36
|
"dependencies": {
|
|
39
|
-
"@xyo-network/payload-model": "~5.
|
|
37
|
+
"@xyo-network/payload-model": "~5.4.0"
|
|
40
38
|
},
|
|
41
39
|
"devDependencies": {
|
|
42
40
|
"@opentelemetry/api": "^1.9.1",
|
|
43
|
-
"@types/node": "^25.
|
|
44
|
-
"@
|
|
45
|
-
"@xylabs/
|
|
46
|
-
"@xylabs/
|
|
47
|
-
"@xylabs/
|
|
48
|
-
"@xylabs/
|
|
49
|
-
"@xylabs/vitest-extended": "~5.0.95",
|
|
50
|
-
"@xylabs/vitest-matchers": "~5.0.95",
|
|
51
|
-
"axios": "^1.14.0",
|
|
41
|
+
"@types/node": "^25.6.0",
|
|
42
|
+
"@xylabs/sdk-js": "^5.0.97",
|
|
43
|
+
"@xylabs/toolchain": "~7.10.8",
|
|
44
|
+
"@xylabs/tsconfig": "~7.10.8",
|
|
45
|
+
"@xylabs/vitest-extended": "~5.0.97",
|
|
46
|
+
"@xylabs/vitest-matchers": "~5.0.97",
|
|
52
47
|
"esbuild": "^0.28.0",
|
|
53
48
|
"ethers": "^6.16.0",
|
|
54
49
|
"pako": "~2.1.0",
|
|
55
50
|
"typescript": "~5.9.3",
|
|
56
51
|
"uuid": "~13.0.0",
|
|
57
|
-
"vite": "^8.0.
|
|
58
|
-
"vitest": "~4.1.
|
|
52
|
+
"vite": "^8.0.8",
|
|
53
|
+
"vitest": "~4.1.4",
|
|
59
54
|
"zod": "^4.3.6",
|
|
60
|
-
"@xyo-network/
|
|
61
|
-
"@xyo-network/
|
|
62
|
-
"@xyo-network/
|
|
63
|
-
"@xyo-network/
|
|
64
|
-
"@xyo-network/
|
|
65
|
-
"@xyo-network/
|
|
66
|
-
"@xyo-network/
|
|
67
|
-
"@xyo-network/
|
|
68
|
-
"@xyo-network/
|
|
69
|
-
"@xyo-network/
|
|
70
|
-
"@xyo-network/
|
|
71
|
-
"@xyo-network/
|
|
72
|
-
"@xyo-network/
|
|
73
|
-
"@xyo-network/
|
|
74
|
-
"@xyo-network/wasm": "~5.3.30"
|
|
55
|
+
"@xyo-network/account-model": "~5.4.0",
|
|
56
|
+
"@xyo-network/api-models": "~5.4.0",
|
|
57
|
+
"@xyo-network/data": "~5.4.0",
|
|
58
|
+
"@xyo-network/boundwitness-model": "~5.4.0",
|
|
59
|
+
"@xyo-network/elliptic": "~5.4.0",
|
|
60
|
+
"@xyo-network/hash": "~5.4.0",
|
|
61
|
+
"@xyo-network/huri": "~5.4.0",
|
|
62
|
+
"@xyo-network/module-model": "~5.4.0",
|
|
63
|
+
"@xyo-network/manifest-model": "~5.4.0",
|
|
64
|
+
"@xyo-network/payload-builder": "~5.4.0",
|
|
65
|
+
"@xyo-network/payload-validator": "~5.4.0",
|
|
66
|
+
"@xyo-network/previous-hash-store-model": "~5.4.0",
|
|
67
|
+
"@xyo-network/query-payload-plugin": "~5.4.0",
|
|
68
|
+
"@xyo-network/wasm": "~5.4.0"
|
|
75
69
|
},
|
|
76
70
|
"peerDependencies": {
|
|
77
|
-
"@xylabs/sdk-js": "^5",
|
|
78
|
-
"
|
|
79
|
-
"@xyo-network/
|
|
80
|
-
"@xyo-network/diviner-model": "~5.3.30",
|
|
81
|
-
"@xyo-network/huri": "~5.3.30"
|
|
71
|
+
"@xylabs/sdk-js": "^5.0.97",
|
|
72
|
+
"@xyo-network/api-models": "~5.4",
|
|
73
|
+
"@xyo-network/huri": "~5.4"
|
|
82
74
|
},
|
|
83
75
|
"publishConfig": {
|
|
84
76
|
"access": "public"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ApiConfig } from '@xyo-network/api-models';
|
|
2
|
-
import type { GetLocationQueryResponse } from './models.ts';
|
|
3
|
-
import type { LocationQueryCreationResponse, SupportedLocationQueryCreationRequest } from './Queries/index.ts';
|
|
4
|
-
declare class LocationDivinerApi {
|
|
5
|
-
config: ApiConfig;
|
|
6
|
-
constructor(config: ApiConfig);
|
|
7
|
-
private get axiosRequestConfig();
|
|
8
|
-
getLocationQuery(hash: string): Promise<GetLocationQueryResponse>;
|
|
9
|
-
postLocationQuery(request: SupportedLocationQueryCreationRequest): Promise<LocationQueryCreationResponse>;
|
|
10
|
-
}
|
|
11
|
-
export { LocationDivinerApi };
|
|
12
|
-
//# sourceMappingURL=LocationDivinerApi.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocationDivinerApi.d.ts","sourceRoot":"","sources":["../../../../src/Diviner/LocationDiviner/LocationDivinerApi.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAIxD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAA;AAC3D,OAAO,KAAK,EAAE,6BAA6B,EAAE,qCAAqC,EAAE,MAAM,oBAAoB,CAAA;AAE9G,cAAM,kBAAkB;IACtB,MAAM,EAAE,SAAS,CAAA;gBACL,MAAM,EAAE,SAAS;IAI7B,OAAO,KAAK,kBAAkB,GAE7B;IAEK,gBAAgB,CAAC,IAAI,EAAE,MAAM;IAI7B,iBAAiB,CAAC,OAAO,EAAE,qCAAqC;CAGvE;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAA"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { AxiosResponseTransformer } from 'axios';
|
|
2
|
-
export declare const locationDivinerApiResponseTransformer: AxiosResponseTransformer;
|
|
3
|
-
/**
|
|
4
|
-
* Gets the response transformers for the LocationDiviner API. Done as a method instead of a property
|
|
5
|
-
* to allow detection of dynamically added response transformers.
|
|
6
|
-
* @param axiosInstance The axios instance (defaults to the global instance if none provided)
|
|
7
|
-
* @returns the response transformers for the LocationDiviner API
|
|
8
|
-
*/
|
|
9
|
-
export declare const getLocationDivinerApiResponseTransformer: (axiosInstance?: import("axios").AxiosStatic) => AxiosResponseTransformer[];
|
|
10
|
-
//# sourceMappingURL=LocationDivinerApiResponseTransformer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocationDivinerApiResponseTransformer.d.ts","sourceRoot":"","sources":["../../../../src/Diviner/LocationDiviner/LocationDivinerApiResponseTransformer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,OAAO,CAAA;AAGrD,eAAO,MAAM,qCAAqC,EAAE,wBAEnD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,wCAAwC,GAAI,2CAAqB,KAAG,wBAAwB,EAWxG,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocationHeatmapPointProperties.d.ts","sourceRoot":"","sources":["../../../../../../src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapPointProperties.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd"}
|
package/dist/neutral/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.d.ts
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { LocationWitnessSchema } from '../../Witnesses/index.ts';
|
|
2
|
-
export declare const LocationHeatmapQuerySchema: "network.xyo.location.heatmap.query" & {
|
|
3
|
-
readonly __schema: true;
|
|
4
|
-
};
|
|
5
|
-
export type LocationHeatmapQuerySchema = typeof LocationHeatmapQuerySchema;
|
|
6
|
-
export declare const LocationHeatmapAnswerSchema: "network.xyo.location.heatmap.answer" & {
|
|
7
|
-
readonly __schema: true;
|
|
8
|
-
};
|
|
9
|
-
export type LocationHeatmapAnswerSchema = typeof LocationHeatmapAnswerSchema;
|
|
10
|
-
export type LocationHeatmapQuery = {
|
|
11
|
-
schema: LocationWitnessSchema;
|
|
12
|
-
startTime?: string;
|
|
13
|
-
stopTime?: string;
|
|
14
|
-
};
|
|
15
|
-
export declare const isLocationHeatmapQuery: (query: Record<string, unknown>) => query is LocationHeatmapQuery;
|
|
16
|
-
//# sourceMappingURL=LocationHeatmapQuery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocationHeatmapQuery.d.ts","sourceRoot":"","sources":["../../../../../../src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/LocationHeatmapQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAErE,eAAO,MAAM,0BAA0B;;CAAuD,CAAA;AAC9F,MAAM,MAAM,0BAA0B,GAAG,OAAO,0BAA0B,CAAA;AAE1E,eAAO,MAAM,2BAA2B;;CAAwD,CAAA;AAChG,MAAM,MAAM,2BAA2B,GAAG,OAAO,2BAA2B,CAAA;AAE5E,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,qBAAqB,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,KAAK,IAAI,oBAEhF,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Diviner/LocationDiviner/Queries/LocationHeatmapQuery/index.ts"],"names":[],"mappings":"AAAA,cAAc,qCAAqC,CAAA;AACnD,cAAc,2BAA2B,CAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { LocationWitnessSchema } from '../../Witnesses/index.ts';
|
|
2
|
-
export declare const LocationQuadkeyHeatmapQuerySchema: "network.xyo.location.heatmap.quadkey.query" & {
|
|
3
|
-
readonly __schema: true;
|
|
4
|
-
};
|
|
5
|
-
export type LocationQuadkeyHeatmapQuerySchema = typeof LocationQuadkeyHeatmapQuerySchema;
|
|
6
|
-
export declare const LocationQuadkeyHeatmapAnswerSchema: "network.xyo.location.heatmap.quadkey.answer" & {
|
|
7
|
-
readonly __schema: true;
|
|
8
|
-
};
|
|
9
|
-
export type LocationQuadkeyHeatmapAnswerSchema = typeof LocationQuadkeyHeatmapAnswerSchema;
|
|
10
|
-
export type LocationQuadkeyHeatmapQuery = {
|
|
11
|
-
schema: LocationWitnessSchema;
|
|
12
|
-
startTime?: string;
|
|
13
|
-
stopTime?: string;
|
|
14
|
-
};
|
|
15
|
-
export declare const isLocationQuadkeyHeatmapQuery: (query: Record<string, unknown>) => query is LocationQuadkeyHeatmapQuery;
|
|
16
|
-
//# sourceMappingURL=LocationQuadkeyHeatmapQuery.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocationQuadkeyHeatmapQuery.d.ts","sourceRoot":"","sources":["../../../../../../src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/LocationQuadkeyHeatmapQuery.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAErE,eAAO,MAAM,iCAAiC;;CAA+D,CAAA;AAC7G,MAAM,MAAM,iCAAiC,GAAG,OAAO,iCAAiC,CAAA;AAExF,eAAO,MAAM,kCAAkC;;CAAgE,CAAA;AAC/G,MAAM,MAAM,kCAAkC,GAAG,OAAO,kCAAkC,CAAA;AAE1F,MAAM,MAAM,2BAA2B,GAAG;IACxC,MAAM,EAAE,qBAAqB,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,eAAO,MAAM,6BAA6B,GAAI,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAG,KAAK,IAAI,2BAEvF,CAAA"}
|
package/dist/neutral/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/Diviner/LocationDiviner/Queries/LocationQuadkeyHeatmapQuery/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAA"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ApiConfig } from '@xyo-network/api-models';
|
|
2
|
-
import type { LocationHeatmapQuery, LocationHeatmapQuerySchema } from './LocationHeatmapQuery/index.ts';
|
|
3
|
-
import type { LocationQuadkeyHeatmapQuery, LocationQuadkeyHeatmapQuerySchema } from './LocationQuadkeyHeatmapQuery/index.ts';
|
|
4
|
-
import type { LocationQuerySchema } from './LocationQuerySchema.ts';
|
|
5
|
-
import type { LocationTimeRangeQuery, LocationTimeRangeQuerySchema } from './LocationTimeRangeQuery/index.ts';
|
|
6
|
-
export interface LocationQueryCreationRequest<TSchema extends LocationQuerySchema = LocationQuerySchema, TQuery extends Record<string, unknown> = Record<string, unknown>> {
|
|
7
|
-
query: TQuery;
|
|
8
|
-
resultArchive: string;
|
|
9
|
-
resultArchivist: ApiConfig;
|
|
10
|
-
schema: TSchema;
|
|
11
|
-
sourceArchive: string;
|
|
12
|
-
sourceArchivist: ApiConfig;
|
|
13
|
-
}
|
|
14
|
-
export type LocationTimeRangeQueryCreationRequest = LocationQueryCreationRequest<LocationTimeRangeQuerySchema, LocationTimeRangeQuery>;
|
|
15
|
-
export type LocationHeatmapQueryCreationRequest = LocationQueryCreationRequest<LocationHeatmapQuerySchema, LocationHeatmapQuery>;
|
|
16
|
-
export type LocationQuadkeyHeatmapQueryCreationRequest = LocationQueryCreationRequest<LocationQuadkeyHeatmapQuerySchema, LocationQuadkeyHeatmapQuery>;
|
|
17
|
-
export type SupportedLocationQueryCreationRequest = LocationTimeRangeQueryCreationRequest | LocationHeatmapQueryCreationRequest | LocationQuadkeyHeatmapQueryCreationRequest;
|
|
18
|
-
//# sourceMappingURL=LocationQueryCreationRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocationQueryCreationRequest.d.ts","sourceRoot":"","sources":["../../../../../src/Diviner/LocationDiviner/Queries/LocationQueryCreationRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AACvG,OAAO,KAAK,EAAE,2BAA2B,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAA;AAC5H,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAA;AAE7G,MAAM,WAAW,4BAA4B,CAC3C,OAAO,SAAS,mBAAmB,GAAG,mBAAmB,EACzD,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAEhE,KAAK,EAAE,MAAM,CAAA;IACb,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,SAAS,CAAA;IAC1B,MAAM,EAAE,OAAO,CAAA;IACf,aAAa,EAAE,MAAM,CAAA;IACrB,eAAe,EAAE,SAAS,CAAA;CAC3B;AAED,MAAM,MAAM,qCAAqC,GAAG,4BAA4B,CAAC,4BAA4B,EAAE,sBAAsB,CAAC,CAAA;AACtI,MAAM,MAAM,mCAAmC,GAAG,4BAA4B,CAAC,0BAA0B,EAAE,oBAAoB,CAAC,CAAA;AAEhI,MAAM,MAAM,0CAA0C,GAAG,4BAA4B,CAAC,iCAAiC,EAAE,2BAA2B,CAAC,CAAA;AAErJ,MAAM,MAAM,qCAAqC,GAC3C,qCAAqC,GACrC,mCAAmC,GACnC,0CAA0C,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocationQueryCreationResponse.d.ts","sourceRoot":"","sources":["../../../../../src/Diviner/LocationDiviner/Queries/LocationQueryCreationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAA;AAErF,MAAM,WAAW,6BAA8B,SAAQ,4BAA4B;IACjF,IAAI,EAAE,MAAM,CAAA;CACb"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Schema } from '@xyo-network/payload-model';
|
|
2
|
-
import type { LocationHeatmapQuerySchema } from './LocationHeatmapQuery/index.ts';
|
|
3
|
-
import type { LocationQuadkeyHeatmapQuerySchema } from './LocationQuadkeyHeatmapQuery/index.ts';
|
|
4
|
-
import type { LocationTimeRangeQuerySchema } from './LocationTimeRangeQuery/index.ts';
|
|
5
|
-
export type LocationQuerySchema = LocationQuadkeyHeatmapQuerySchema | LocationHeatmapQuerySchema | LocationTimeRangeQuerySchema;
|
|
6
|
-
export declare const isSupportedLocationQuerySchema: (schema: Schema) => schema is LocationQuerySchema;
|
|
7
|
-
//# sourceMappingURL=LocationQuerySchema.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocationQuerySchema.d.ts","sourceRoot":"","sources":["../../../../../src/Diviner/LocationDiviner/Queries/LocationQuerySchema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAExD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAA;AACjF,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAA;AAC/F,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAA;AAErF,MAAM,MAAM,mBAAmB,GAAG,iCAAiC,GAAG,0BAA0B,GAAG,4BAA4B,CAAA;AAQ/H,eAAO,MAAM,8BAA8B,GAAI,QAAQ,MAAM,KAAG,MAAM,IAAI,mBAEzE,CAAA"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { LocationWitnessSchema } from '../../Witnesses/index.ts';
|
|
2
|
-
export interface LocationTimeRangePointProperties {
|
|
3
|
-
_archive: string;
|
|
4
|
-
_client: string;
|
|
5
|
-
_timestamp: number;
|
|
6
|
-
schema: LocationWitnessSchema;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=LocationTimeRangePointProperties.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocationTimeRangePointProperties.d.ts","sourceRoot":"","sources":["../../../../../../src/Diviner/LocationDiviner/Queries/LocationTimeRangeQuery/LocationTimeRangePointProperties.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAA;AAErE,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,qBAAqB,CAAA;CAC9B"}
|