omni-osint-query-client 1.0.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/dist/client/core/ApiError.d.ts +10 -0
- package/dist/client/core/ApiError.js +15 -0
- package/dist/client/core/ApiRequestOptions.d.ts +13 -0
- package/dist/client/core/ApiRequestOptions.js +2 -0
- package/dist/client/core/ApiResult.d.ts +7 -0
- package/dist/client/core/ApiResult.js +2 -0
- package/dist/client/core/CancelablePromise.d.ts +20 -0
- package/dist/client/core/CancelablePromise.js +116 -0
- package/dist/client/core/OpenAPI.d.ts +16 -0
- package/dist/client/core/OpenAPI.js +14 -0
- package/dist/client/core/request.d.ts +34 -0
- package/dist/client/core/request.js +283 -0
- package/dist/client/index.d.ts +20 -0
- package/dist/client/index.js +18 -0
- package/dist/client/models/Event.d.ts +62 -0
- package/dist/client/models/Event.js +6 -0
- package/dist/client/models/HTTPValidationError.d.ts +4 -0
- package/dist/client/models/HTTPValidationError.js +6 -0
- package/dist/client/models/HealthCheck.d.ts +3 -0
- package/dist/client/models/HealthCheck.js +6 -0
- package/dist/client/models/LocationData.d.ts +41 -0
- package/dist/client/models/LocationData.js +6 -0
- package/dist/client/models/NeighborsRequest.d.ts +3 -0
- package/dist/client/models/NeighborsRequest.js +6 -0
- package/dist/client/models/NeighborsResponse.d.ts +14 -0
- package/dist/client/models/NeighborsResponse.js +6 -0
- package/dist/client/models/Organization.d.ts +57 -0
- package/dist/client/models/Organization.js +6 -0
- package/dist/client/models/Person.d.ts +61 -0
- package/dist/client/models/Person.js +6 -0
- package/dist/client/models/QueryRequest.d.ts +6 -0
- package/dist/client/models/QueryRequest.js +6 -0
- package/dist/client/models/QueryResponse.d.ts +6 -0
- package/dist/client/models/QueryResponse.js +6 -0
- package/dist/client/models/Relation.d.ts +61 -0
- package/dist/client/models/Relation.js +6 -0
- package/dist/client/models/Source.d.ts +69 -0
- package/dist/client/models/Source.js +6 -0
- package/dist/client/models/ValidationError.d.ts +7 -0
- package/dist/client/models/ValidationError.js +6 -0
- package/dist/client/models/Website.d.ts +61 -0
- package/dist/client/models/Website.js +6 -0
- package/dist/client/services/HealthService.d.ts +10 -0
- package/dist/client/services/HealthService.js +19 -0
- package/dist/client/services/QueryService.d.ts +23 -0
- package/dist/client/services/QueryService.js +50 -0
- package/dist/core/ApiError.d.ts +10 -0
- package/dist/core/ApiError.js +15 -0
- package/dist/core/ApiRequestOptions.d.ts +13 -0
- package/dist/core/ApiRequestOptions.js +2 -0
- package/dist/core/ApiResult.d.ts +7 -0
- package/dist/core/ApiResult.js +2 -0
- package/dist/core/CancelablePromise.d.ts +20 -0
- package/dist/core/CancelablePromise.js +116 -0
- package/dist/core/OpenAPI.d.ts +16 -0
- package/dist/core/OpenAPI.js +14 -0
- package/dist/core/request.d.ts +34 -0
- package/dist/core/request.js +286 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +18 -0
- package/dist/models/Event.d.ts +62 -0
- package/dist/models/Event.js +2 -0
- package/dist/models/HTTPValidationError.d.ts +4 -0
- package/dist/models/HTTPValidationError.js +2 -0
- package/dist/models/HealthCheck.d.ts +3 -0
- package/dist/models/HealthCheck.js +2 -0
- package/dist/models/LocationData.d.ts +41 -0
- package/dist/models/LocationData.js +2 -0
- package/dist/models/NeighborsRequest.d.ts +3 -0
- package/dist/models/NeighborsRequest.js +2 -0
- package/dist/models/NeighborsResponse.d.ts +14 -0
- package/dist/models/NeighborsResponse.js +2 -0
- package/dist/models/Organization.d.ts +57 -0
- package/dist/models/Organization.js +2 -0
- package/dist/models/Person.d.ts +61 -0
- package/dist/models/Person.js +2 -0
- package/dist/models/QueryRequest.d.ts +6 -0
- package/dist/models/QueryRequest.js +2 -0
- package/dist/models/QueryResponse.d.ts +6 -0
- package/dist/models/QueryResponse.js +2 -0
- package/dist/models/Relation.d.ts +61 -0
- package/dist/models/Relation.js +2 -0
- package/dist/models/Source.d.ts +69 -0
- package/dist/models/Source.js +2 -0
- package/dist/models/ValidationError.d.ts +7 -0
- package/dist/models/ValidationError.js +2 -0
- package/dist/models/Website.d.ts +61 -0
- package/dist/models/Website.js +2 -0
- package/dist/services/HealthService.d.ts +10 -0
- package/dist/services/HealthService.js +19 -0
- package/dist/services/QueryService.d.ts +23 -0
- package/dist/services/QueryService.js +50 -0
- package/package.json +31 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { ApiResult } from './ApiResult';
|
|
3
|
+
export declare class ApiError extends Error {
|
|
4
|
+
readonly url: string;
|
|
5
|
+
readonly status: number;
|
|
6
|
+
readonly statusText: string;
|
|
7
|
+
readonly body: any;
|
|
8
|
+
readonly request: ApiRequestOptions;
|
|
9
|
+
constructor(request: ApiRequestOptions, response: ApiResult, message: string);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
class ApiError extends Error {
|
|
5
|
+
constructor(request, response, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'ApiError';
|
|
8
|
+
this.url = response.url;
|
|
9
|
+
this.status = response.status;
|
|
10
|
+
this.statusText = response.statusText;
|
|
11
|
+
this.body = response.body;
|
|
12
|
+
this.request = request;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.ApiError = ApiError;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export type ApiRequestOptions = {
|
|
2
|
+
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly path?: Record<string, any>;
|
|
5
|
+
readonly cookies?: Record<string, any>;
|
|
6
|
+
readonly headers?: Record<string, any>;
|
|
7
|
+
readonly query?: Record<string, any>;
|
|
8
|
+
readonly formData?: Record<string, any>;
|
|
9
|
+
readonly body?: any;
|
|
10
|
+
readonly mediaType?: string;
|
|
11
|
+
readonly responseHeader?: string;
|
|
12
|
+
readonly errors?: Record<number, string>;
|
|
13
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export declare class CancelError extends Error {
|
|
2
|
+
constructor(message: string);
|
|
3
|
+
get isCancelled(): boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface OnCancel {
|
|
6
|
+
readonly isResolved: boolean;
|
|
7
|
+
readonly isRejected: boolean;
|
|
8
|
+
readonly isCancelled: boolean;
|
|
9
|
+
(cancelHandler: () => void): void;
|
|
10
|
+
}
|
|
11
|
+
export declare class CancelablePromise<T> implements Promise<T> {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(executor: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void, onCancel: OnCancel) => void);
|
|
14
|
+
get [Symbol.toStringTag](): string;
|
|
15
|
+
then<TResult1 = T, TResult2 = never>(onFulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null, onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
|
|
16
|
+
catch<TResult = never>(onRejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
|
|
17
|
+
finally(onFinally?: (() => void) | null): Promise<T>;
|
|
18
|
+
cancel(): void;
|
|
19
|
+
get isCancelled(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _CancelablePromise_isResolved, _CancelablePromise_isRejected, _CancelablePromise_isCancelled, _CancelablePromise_cancelHandlers, _CancelablePromise_promise, _CancelablePromise_resolve, _CancelablePromise_reject;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.CancelablePromise = exports.CancelError = void 0;
|
|
16
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
17
|
+
/* istanbul ignore file */
|
|
18
|
+
/* tslint:disable */
|
|
19
|
+
/* eslint-disable */
|
|
20
|
+
class CancelError extends Error {
|
|
21
|
+
constructor(message) {
|
|
22
|
+
super(message);
|
|
23
|
+
this.name = 'CancelError';
|
|
24
|
+
}
|
|
25
|
+
get isCancelled() {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.CancelError = CancelError;
|
|
30
|
+
class CancelablePromise {
|
|
31
|
+
constructor(executor) {
|
|
32
|
+
_CancelablePromise_isResolved.set(this, void 0);
|
|
33
|
+
_CancelablePromise_isRejected.set(this, void 0);
|
|
34
|
+
_CancelablePromise_isCancelled.set(this, void 0);
|
|
35
|
+
_CancelablePromise_cancelHandlers.set(this, void 0);
|
|
36
|
+
_CancelablePromise_promise.set(this, void 0);
|
|
37
|
+
_CancelablePromise_resolve.set(this, void 0);
|
|
38
|
+
_CancelablePromise_reject.set(this, void 0);
|
|
39
|
+
__classPrivateFieldSet(this, _CancelablePromise_isResolved, false, "f");
|
|
40
|
+
__classPrivateFieldSet(this, _CancelablePromise_isRejected, false, "f");
|
|
41
|
+
__classPrivateFieldSet(this, _CancelablePromise_isCancelled, false, "f");
|
|
42
|
+
__classPrivateFieldSet(this, _CancelablePromise_cancelHandlers, [], "f");
|
|
43
|
+
__classPrivateFieldSet(this, _CancelablePromise_promise, new Promise((resolve, reject) => {
|
|
44
|
+
__classPrivateFieldSet(this, _CancelablePromise_resolve, resolve, "f");
|
|
45
|
+
__classPrivateFieldSet(this, _CancelablePromise_reject, reject, "f");
|
|
46
|
+
const onResolve = (value) => {
|
|
47
|
+
var _a;
|
|
48
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
__classPrivateFieldSet(this, _CancelablePromise_isResolved, true, "f");
|
|
52
|
+
(_a = __classPrivateFieldGet(this, _CancelablePromise_resolve, "f")) === null || _a === void 0 ? void 0 : _a.call(this, value);
|
|
53
|
+
};
|
|
54
|
+
const onReject = (reason) => {
|
|
55
|
+
var _a;
|
|
56
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
__classPrivateFieldSet(this, _CancelablePromise_isRejected, true, "f");
|
|
60
|
+
(_a = __classPrivateFieldGet(this, _CancelablePromise_reject, "f")) === null || _a === void 0 ? void 0 : _a.call(this, reason);
|
|
61
|
+
};
|
|
62
|
+
const onCancel = (cancelHandler) => {
|
|
63
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").push(cancelHandler);
|
|
67
|
+
};
|
|
68
|
+
Object.defineProperty(onCancel, 'isResolved', {
|
|
69
|
+
get: () => __classPrivateFieldGet(this, _CancelablePromise_isResolved, "f"),
|
|
70
|
+
});
|
|
71
|
+
Object.defineProperty(onCancel, 'isRejected', {
|
|
72
|
+
get: () => __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f"),
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(onCancel, 'isCancelled', {
|
|
75
|
+
get: () => __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f"),
|
|
76
|
+
});
|
|
77
|
+
return executor(onResolve, onReject, onCancel);
|
|
78
|
+
}), "f");
|
|
79
|
+
}
|
|
80
|
+
get [(_CancelablePromise_isResolved = new WeakMap(), _CancelablePromise_isRejected = new WeakMap(), _CancelablePromise_isCancelled = new WeakMap(), _CancelablePromise_cancelHandlers = new WeakMap(), _CancelablePromise_promise = new WeakMap(), _CancelablePromise_resolve = new WeakMap(), _CancelablePromise_reject = new WeakMap(), Symbol.toStringTag)]() {
|
|
81
|
+
return "Cancellable Promise";
|
|
82
|
+
}
|
|
83
|
+
then(onFulfilled, onRejected) {
|
|
84
|
+
return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").then(onFulfilled, onRejected);
|
|
85
|
+
}
|
|
86
|
+
catch(onRejected) {
|
|
87
|
+
return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").catch(onRejected);
|
|
88
|
+
}
|
|
89
|
+
finally(onFinally) {
|
|
90
|
+
return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").finally(onFinally);
|
|
91
|
+
}
|
|
92
|
+
cancel() {
|
|
93
|
+
var _a;
|
|
94
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
__classPrivateFieldSet(this, _CancelablePromise_isCancelled, true, "f");
|
|
98
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").length) {
|
|
99
|
+
try {
|
|
100
|
+
for (const cancelHandler of __classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f")) {
|
|
101
|
+
cancelHandler();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
console.warn('Cancellation threw an error', error);
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").length = 0;
|
|
110
|
+
(_a = __classPrivateFieldGet(this, _CancelablePromise_reject, "f")) === null || _a === void 0 ? void 0 : _a.call(this, new CancelError('Request aborted'));
|
|
111
|
+
}
|
|
112
|
+
get isCancelled() {
|
|
113
|
+
return __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f");
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.CancelablePromise = CancelablePromise;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
3
|
+
type Headers = Record<string, string>;
|
|
4
|
+
export type OpenAPIConfig = {
|
|
5
|
+
BASE: string;
|
|
6
|
+
VERSION: string;
|
|
7
|
+
WITH_CREDENTIALS: boolean;
|
|
8
|
+
CREDENTIALS: 'include' | 'omit' | 'same-origin';
|
|
9
|
+
TOKEN?: string | Resolver<string> | undefined;
|
|
10
|
+
USERNAME?: string | Resolver<string> | undefined;
|
|
11
|
+
PASSWORD?: string | Resolver<string> | undefined;
|
|
12
|
+
HEADERS?: Headers | Resolver<Headers> | undefined;
|
|
13
|
+
ENCODE_PATH?: ((path: string) => string) | undefined;
|
|
14
|
+
};
|
|
15
|
+
export declare const OpenAPI: OpenAPIConfig;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenAPI = void 0;
|
|
4
|
+
exports.OpenAPI = {
|
|
5
|
+
BASE: '',
|
|
6
|
+
VERSION: '0.1.0',
|
|
7
|
+
WITH_CREDENTIALS: false,
|
|
8
|
+
CREDENTIALS: 'include',
|
|
9
|
+
TOKEN: undefined,
|
|
10
|
+
USERNAME: undefined,
|
|
11
|
+
PASSWORD: undefined,
|
|
12
|
+
HEADERS: undefined,
|
|
13
|
+
ENCODE_PATH: undefined,
|
|
14
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { AxiosResponse, AxiosInstance } from 'axios';
|
|
2
|
+
import FormData from 'form-data';
|
|
3
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
4
|
+
import type { ApiResult } from './ApiResult';
|
|
5
|
+
import { CancelablePromise } from './CancelablePromise';
|
|
6
|
+
import type { OnCancel } from './CancelablePromise';
|
|
7
|
+
import type { OpenAPIConfig } from './OpenAPI';
|
|
8
|
+
export declare const isDefined: <T>(value: T | null | undefined) => value is Exclude<T, null | undefined>;
|
|
9
|
+
export declare const isString: (value: any) => value is string;
|
|
10
|
+
export declare const isStringWithValue: (value: any) => value is string;
|
|
11
|
+
export declare const isBlob: (value: any) => value is Blob;
|
|
12
|
+
export declare const isFormData: (value: any) => value is FormData;
|
|
13
|
+
export declare const isSuccess: (status: number) => boolean;
|
|
14
|
+
export declare const base64: (str: string) => string;
|
|
15
|
+
export declare const getQueryString: (params: Record<string, any>) => string;
|
|
16
|
+
export declare const getFormData: (options: ApiRequestOptions) => FormData | undefined;
|
|
17
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
18
|
+
export declare const resolve: <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>) => Promise<T | undefined>;
|
|
19
|
+
export declare const getHeaders: (config: OpenAPIConfig, options: ApiRequestOptions, formData?: FormData) => Promise<Record<string, string>>;
|
|
20
|
+
export declare const getRequestBody: (options: ApiRequestOptions) => any;
|
|
21
|
+
export declare const sendRequest: <T>(config: OpenAPIConfig, options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Record<string, string>, onCancel: OnCancel, axiosClient: AxiosInstance) => Promise<AxiosResponse<T>>;
|
|
22
|
+
export declare const getResponseHeader: (response: AxiosResponse<any>, responseHeader?: string) => string | undefined;
|
|
23
|
+
export declare const getResponseBody: (response: AxiosResponse<any>) => any;
|
|
24
|
+
export declare const catchErrorCodes: (options: ApiRequestOptions, result: ApiResult) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Request method
|
|
27
|
+
* @param config The OpenAPI configuration object
|
|
28
|
+
* @param options The request options from the service
|
|
29
|
+
* @param axiosClient The axios client instance to use
|
|
30
|
+
* @returns CancelablePromise<T>
|
|
31
|
+
* @throws ApiError
|
|
32
|
+
*/
|
|
33
|
+
export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions, axiosClient?: AxiosInstance) => CancelablePromise<T>;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.request = exports.catchErrorCodes = exports.getResponseBody = exports.getResponseHeader = exports.sendRequest = exports.getRequestBody = exports.getHeaders = exports.resolve = exports.getFormData = exports.getQueryString = exports.base64 = exports.isSuccess = exports.isFormData = exports.isBlob = exports.isStringWithValue = exports.isString = exports.isDefined = void 0;
|
|
16
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
17
|
+
/* istanbul ignore file */
|
|
18
|
+
/* tslint:disable */
|
|
19
|
+
/* eslint-disable */
|
|
20
|
+
const axios_1 = __importDefault(require("axios"));
|
|
21
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
22
|
+
const ApiError_1 = require("./ApiError");
|
|
23
|
+
const CancelablePromise_1 = require("./CancelablePromise");
|
|
24
|
+
const isDefined = (value) => {
|
|
25
|
+
return value !== undefined && value !== null;
|
|
26
|
+
};
|
|
27
|
+
exports.isDefined = isDefined;
|
|
28
|
+
const isString = (value) => {
|
|
29
|
+
return typeof value === 'string';
|
|
30
|
+
};
|
|
31
|
+
exports.isString = isString;
|
|
32
|
+
const isStringWithValue = (value) => {
|
|
33
|
+
return (0, exports.isString)(value) && value !== '';
|
|
34
|
+
};
|
|
35
|
+
exports.isStringWithValue = isStringWithValue;
|
|
36
|
+
const isBlob = (value) => {
|
|
37
|
+
return (typeof value === 'object' &&
|
|
38
|
+
typeof value.type === 'string' &&
|
|
39
|
+
typeof value.stream === 'function' &&
|
|
40
|
+
typeof value.arrayBuffer === 'function' &&
|
|
41
|
+
typeof value.constructor === 'function' &&
|
|
42
|
+
typeof value.constructor.name === 'string' &&
|
|
43
|
+
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
44
|
+
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
45
|
+
};
|
|
46
|
+
exports.isBlob = isBlob;
|
|
47
|
+
const isFormData = (value) => {
|
|
48
|
+
return value instanceof form_data_1.default;
|
|
49
|
+
};
|
|
50
|
+
exports.isFormData = isFormData;
|
|
51
|
+
const isSuccess = (status) => {
|
|
52
|
+
return status >= 200 && status < 300;
|
|
53
|
+
};
|
|
54
|
+
exports.isSuccess = isSuccess;
|
|
55
|
+
const base64 = (str) => {
|
|
56
|
+
try {
|
|
57
|
+
return btoa(str);
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
return Buffer.from(str).toString('base64');
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
exports.base64 = base64;
|
|
65
|
+
const getQueryString = (params) => {
|
|
66
|
+
const qs = [];
|
|
67
|
+
const append = (key, value) => {
|
|
68
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
69
|
+
};
|
|
70
|
+
const process = (key, value) => {
|
|
71
|
+
if ((0, exports.isDefined)(value)) {
|
|
72
|
+
if (Array.isArray(value)) {
|
|
73
|
+
value.forEach(v => {
|
|
74
|
+
process(key, v);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else if (typeof value === 'object') {
|
|
78
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
79
|
+
process(`${key}[${k}]`, v);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
append(key, value);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
88
|
+
process(key, value);
|
|
89
|
+
});
|
|
90
|
+
if (qs.length > 0) {
|
|
91
|
+
return `?${qs.join('&')}`;
|
|
92
|
+
}
|
|
93
|
+
return '';
|
|
94
|
+
};
|
|
95
|
+
exports.getQueryString = getQueryString;
|
|
96
|
+
const getUrl = (config, options) => {
|
|
97
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
98
|
+
const path = options.url
|
|
99
|
+
.replace('{api-version}', config.VERSION)
|
|
100
|
+
.replace(/{(.*?)}/g, (substring, group) => {
|
|
101
|
+
var _a;
|
|
102
|
+
if ((_a = options.path) === null || _a === void 0 ? void 0 : _a.hasOwnProperty(group)) {
|
|
103
|
+
return encoder(String(options.path[group]));
|
|
104
|
+
}
|
|
105
|
+
return substring;
|
|
106
|
+
});
|
|
107
|
+
const url = `${config.BASE}${path}`;
|
|
108
|
+
if (options.query) {
|
|
109
|
+
return `${url}${(0, exports.getQueryString)(options.query)}`;
|
|
110
|
+
}
|
|
111
|
+
return url;
|
|
112
|
+
};
|
|
113
|
+
const getFormData = (options) => {
|
|
114
|
+
if (options.formData) {
|
|
115
|
+
const formData = new form_data_1.default();
|
|
116
|
+
const process = (key, value) => {
|
|
117
|
+
if ((0, exports.isString)(value) || (0, exports.isBlob)(value)) {
|
|
118
|
+
formData.append(key, value);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
formData.append(key, JSON.stringify(value));
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
Object.entries(options.formData)
|
|
125
|
+
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
126
|
+
.forEach(([key, value]) => {
|
|
127
|
+
if (Array.isArray(value)) {
|
|
128
|
+
value.forEach(v => process(key, v));
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
process(key, value);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return formData;
|
|
135
|
+
}
|
|
136
|
+
return undefined;
|
|
137
|
+
};
|
|
138
|
+
exports.getFormData = getFormData;
|
|
139
|
+
const resolve = (options, resolver) => __awaiter(void 0, void 0, void 0, function* () {
|
|
140
|
+
if (typeof resolver === 'function') {
|
|
141
|
+
return resolver(options);
|
|
142
|
+
}
|
|
143
|
+
return resolver;
|
|
144
|
+
});
|
|
145
|
+
exports.resolve = resolve;
|
|
146
|
+
const getHeaders = (config, options, formData) => __awaiter(void 0, void 0, void 0, function* () {
|
|
147
|
+
const token = yield (0, exports.resolve)(options, config.TOKEN);
|
|
148
|
+
const username = yield (0, exports.resolve)(options, config.USERNAME);
|
|
149
|
+
const password = yield (0, exports.resolve)(options, config.PASSWORD);
|
|
150
|
+
const additionalHeaders = yield (0, exports.resolve)(options, config.HEADERS);
|
|
151
|
+
const formHeaders = typeof (formData === null || formData === void 0 ? void 0 : formData.getHeaders) === 'function' && (formData === null || formData === void 0 ? void 0 : formData.getHeaders()) || {};
|
|
152
|
+
const headers = Object.entries(Object.assign(Object.assign(Object.assign({ Accept: 'application/json' }, additionalHeaders), options.headers), formHeaders))
|
|
153
|
+
.filter(([_, value]) => (0, exports.isDefined)(value))
|
|
154
|
+
.reduce((headers, [key, value]) => (Object.assign(Object.assign({}, headers), { [key]: String(value) })), {});
|
|
155
|
+
if ((0, exports.isStringWithValue)(token)) {
|
|
156
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
157
|
+
}
|
|
158
|
+
if ((0, exports.isStringWithValue)(username) && (0, exports.isStringWithValue)(password)) {
|
|
159
|
+
const credentials = (0, exports.base64)(`${username}:${password}`);
|
|
160
|
+
headers['Authorization'] = `Basic ${credentials}`;
|
|
161
|
+
}
|
|
162
|
+
if (options.body) {
|
|
163
|
+
if (options.mediaType) {
|
|
164
|
+
headers['Content-Type'] = options.mediaType;
|
|
165
|
+
}
|
|
166
|
+
else if ((0, exports.isBlob)(options.body)) {
|
|
167
|
+
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
168
|
+
}
|
|
169
|
+
else if ((0, exports.isString)(options.body)) {
|
|
170
|
+
headers['Content-Type'] = 'text/plain';
|
|
171
|
+
}
|
|
172
|
+
else if (!(0, exports.isFormData)(options.body)) {
|
|
173
|
+
headers['Content-Type'] = 'application/json';
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
return headers;
|
|
177
|
+
});
|
|
178
|
+
exports.getHeaders = getHeaders;
|
|
179
|
+
const getRequestBody = (options) => {
|
|
180
|
+
if (options.body) {
|
|
181
|
+
return options.body;
|
|
182
|
+
}
|
|
183
|
+
return undefined;
|
|
184
|
+
};
|
|
185
|
+
exports.getRequestBody = getRequestBody;
|
|
186
|
+
const sendRequest = (config, options, url, body, formData, headers, onCancel, axiosClient) => __awaiter(void 0, void 0, void 0, function* () {
|
|
187
|
+
const source = axios_1.default.CancelToken.source();
|
|
188
|
+
const requestConfig = {
|
|
189
|
+
url,
|
|
190
|
+
headers,
|
|
191
|
+
data: body !== null && body !== void 0 ? body : formData,
|
|
192
|
+
method: options.method,
|
|
193
|
+
withCredentials: config.WITH_CREDENTIALS,
|
|
194
|
+
cancelToken: source.token,
|
|
195
|
+
};
|
|
196
|
+
onCancel(() => source.cancel('The user aborted a request.'));
|
|
197
|
+
try {
|
|
198
|
+
return yield axiosClient.request(requestConfig);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
const axiosError = error;
|
|
202
|
+
if (axiosError.response) {
|
|
203
|
+
return axiosError.response;
|
|
204
|
+
}
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
exports.sendRequest = sendRequest;
|
|
209
|
+
const getResponseHeader = (response, responseHeader) => {
|
|
210
|
+
if (responseHeader) {
|
|
211
|
+
const content = response.headers[responseHeader];
|
|
212
|
+
if ((0, exports.isString)(content)) {
|
|
213
|
+
return content;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return undefined;
|
|
217
|
+
};
|
|
218
|
+
exports.getResponseHeader = getResponseHeader;
|
|
219
|
+
const getResponseBody = (response) => {
|
|
220
|
+
if (response.status !== 204) {
|
|
221
|
+
return response.data;
|
|
222
|
+
}
|
|
223
|
+
return undefined;
|
|
224
|
+
};
|
|
225
|
+
exports.getResponseBody = getResponseBody;
|
|
226
|
+
const catchErrorCodes = (options, result) => {
|
|
227
|
+
var _a, _b;
|
|
228
|
+
const errors = Object.assign({ 400: 'Bad Request', 401: 'Unauthorized', 403: 'Forbidden', 404: 'Not Found', 500: 'Internal Server Error', 502: 'Bad Gateway', 503: 'Service Unavailable' }, options.errors);
|
|
229
|
+
const error = errors[result.status];
|
|
230
|
+
if (error) {
|
|
231
|
+
throw new ApiError_1.ApiError(options, result, error);
|
|
232
|
+
}
|
|
233
|
+
if (!result.ok) {
|
|
234
|
+
const errorStatus = (_a = result.status) !== null && _a !== void 0 ? _a : 'unknown';
|
|
235
|
+
const errorStatusText = (_b = result.statusText) !== null && _b !== void 0 ? _b : 'unknown';
|
|
236
|
+
const errorBody = (() => {
|
|
237
|
+
try {
|
|
238
|
+
return JSON.stringify(result.body, null, 2);
|
|
239
|
+
}
|
|
240
|
+
catch (e) {
|
|
241
|
+
return undefined;
|
|
242
|
+
}
|
|
243
|
+
})();
|
|
244
|
+
throw new ApiError_1.ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
exports.catchErrorCodes = catchErrorCodes;
|
|
248
|
+
/**
|
|
249
|
+
* Request method
|
|
250
|
+
* @param config The OpenAPI configuration object
|
|
251
|
+
* @param options The request options from the service
|
|
252
|
+
* @param axiosClient The axios client instance to use
|
|
253
|
+
* @returns CancelablePromise<T>
|
|
254
|
+
* @throws ApiError
|
|
255
|
+
*/
|
|
256
|
+
const request = (config, options, axiosClient = axios_1.default) => {
|
|
257
|
+
return new CancelablePromise_1.CancelablePromise((resolve, reject, onCancel) => __awaiter(void 0, void 0, void 0, function* () {
|
|
258
|
+
try {
|
|
259
|
+
const url = getUrl(config, options);
|
|
260
|
+
const formData = (0, exports.getFormData)(options);
|
|
261
|
+
const body = (0, exports.getRequestBody)(options);
|
|
262
|
+
const headers = yield (0, exports.getHeaders)(config, options, formData);
|
|
263
|
+
if (!onCancel.isCancelled) {
|
|
264
|
+
const response = yield (0, exports.sendRequest)(config, options, url, body, formData, headers, onCancel, axiosClient);
|
|
265
|
+
const responseBody = (0, exports.getResponseBody)(response);
|
|
266
|
+
const responseHeader = (0, exports.getResponseHeader)(response, options.responseHeader);
|
|
267
|
+
const result = {
|
|
268
|
+
url,
|
|
269
|
+
ok: (0, exports.isSuccess)(response.status),
|
|
270
|
+
status: response.status,
|
|
271
|
+
statusText: response.statusText,
|
|
272
|
+
body: responseHeader !== null && responseHeader !== void 0 ? responseHeader : responseBody,
|
|
273
|
+
};
|
|
274
|
+
(0, exports.catchErrorCodes)(options, result);
|
|
275
|
+
resolve(result.body);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
catch (error) {
|
|
279
|
+
reject(error);
|
|
280
|
+
}
|
|
281
|
+
}));
|
|
282
|
+
};
|
|
283
|
+
exports.request = request;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { ApiError } from './core/ApiError';
|
|
2
|
+
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
3
|
+
export { OpenAPI } from './core/OpenAPI';
|
|
4
|
+
export type { OpenAPIConfig } from './core/OpenAPI';
|
|
5
|
+
export type { Event } from './models/Event';
|
|
6
|
+
export type { HealthCheck } from './models/HealthCheck';
|
|
7
|
+
export type { HTTPValidationError } from './models/HTTPValidationError';
|
|
8
|
+
export type { LocationData } from './models/LocationData';
|
|
9
|
+
export type { NeighborsRequest } from './models/NeighborsRequest';
|
|
10
|
+
export type { NeighborsResponse } from './models/NeighborsResponse';
|
|
11
|
+
export type { Organization } from './models/Organization';
|
|
12
|
+
export type { Person } from './models/Person';
|
|
13
|
+
export type { QueryRequest } from './models/QueryRequest';
|
|
14
|
+
export type { QueryResponse } from './models/QueryResponse';
|
|
15
|
+
export type { Relation } from './models/Relation';
|
|
16
|
+
export type { Source } from './models/Source';
|
|
17
|
+
export type { ValidationError } from './models/ValidationError';
|
|
18
|
+
export type { Website } from './models/Website';
|
|
19
|
+
export { HealthService } from './services/HealthService';
|
|
20
|
+
export { QueryService } from './services/QueryService';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryService = exports.HealthService = exports.OpenAPI = exports.CancelError = exports.CancelablePromise = exports.ApiError = void 0;
|
|
4
|
+
/* generated using openapi-typescript-codegen -- do no edit */
|
|
5
|
+
/* istanbul ignore file */
|
|
6
|
+
/* tslint:disable */
|
|
7
|
+
/* eslint-disable */
|
|
8
|
+
var ApiError_1 = require("./core/ApiError");
|
|
9
|
+
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return ApiError_1.ApiError; } });
|
|
10
|
+
var CancelablePromise_1 = require("./core/CancelablePromise");
|
|
11
|
+
Object.defineProperty(exports, "CancelablePromise", { enumerable: true, get: function () { return CancelablePromise_1.CancelablePromise; } });
|
|
12
|
+
Object.defineProperty(exports, "CancelError", { enumerable: true, get: function () { return CancelablePromise_1.CancelError; } });
|
|
13
|
+
var OpenAPI_1 = require("./core/OpenAPI");
|
|
14
|
+
Object.defineProperty(exports, "OpenAPI", { enumerable: true, get: function () { return OpenAPI_1.OpenAPI; } });
|
|
15
|
+
var HealthService_1 = require("./services/HealthService");
|
|
16
|
+
Object.defineProperty(exports, "HealthService", { enumerable: true, get: function () { return HealthService_1.HealthService; } });
|
|
17
|
+
var QueryService_1 = require("./services/QueryService");
|
|
18
|
+
Object.defineProperty(exports, "QueryService", { enumerable: true, get: function () { return QueryService_1.QueryService; } });
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { LocationData } from './LocationData';
|
|
2
|
+
/**
|
|
3
|
+
* Represents an event.
|
|
4
|
+
*/
|
|
5
|
+
export type Event = {
|
|
6
|
+
/**
|
|
7
|
+
* Type of event
|
|
8
|
+
*/
|
|
9
|
+
type?: (string | null);
|
|
10
|
+
/**
|
|
11
|
+
* Location of the event
|
|
12
|
+
*/
|
|
13
|
+
location?: (LocationData | null);
|
|
14
|
+
/**
|
|
15
|
+
* Title of the event. Keep it short and clear.
|
|
16
|
+
*/
|
|
17
|
+
title?: (string | null);
|
|
18
|
+
/**
|
|
19
|
+
* Brief description of the event. Keep it short and clear.
|
|
20
|
+
*/
|
|
21
|
+
description?: (string | null);
|
|
22
|
+
/**
|
|
23
|
+
* Timestamp when the event happened
|
|
24
|
+
*/
|
|
25
|
+
happened_at?: (number | null);
|
|
26
|
+
/**
|
|
27
|
+
* Update timestamp
|
|
28
|
+
*/
|
|
29
|
+
updated_at?: (number | null);
|
|
30
|
+
/**
|
|
31
|
+
* Tags
|
|
32
|
+
*/
|
|
33
|
+
tags?: (Array<string> | null);
|
|
34
|
+
/**
|
|
35
|
+
* Additional attributes
|
|
36
|
+
*/
|
|
37
|
+
attributes?: (Record<string, any> | null);
|
|
38
|
+
/**
|
|
39
|
+
* Owner of the document
|
|
40
|
+
*/
|
|
41
|
+
owner?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Users/Roles with read access
|
|
44
|
+
*/
|
|
45
|
+
read?: Array<string>;
|
|
46
|
+
/**
|
|
47
|
+
* Users/Roles with write access
|
|
48
|
+
*/
|
|
49
|
+
write?: Array<string>;
|
|
50
|
+
/**
|
|
51
|
+
* ArangoDB document ID
|
|
52
|
+
*/
|
|
53
|
+
_id?: (string | null);
|
|
54
|
+
/**
|
|
55
|
+
* ArangoDB document key
|
|
56
|
+
*/
|
|
57
|
+
_key?: (string | null);
|
|
58
|
+
/**
|
|
59
|
+
* ArangoDB document revision
|
|
60
|
+
*/
|
|
61
|
+
_rev?: (string | null);
|
|
62
|
+
};
|