@incomy/platform-sdk 0.0.0-29531a1b
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/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/services/core/core/ApiError.d.ts +10 -0
- package/dist/services/core/core/ApiError.js +11 -0
- package/dist/services/core/core/ApiRequestOptions.d.ts +13 -0
- package/dist/services/core/core/ApiRequestOptions.js +1 -0
- package/dist/services/core/core/ApiResult.d.ts +7 -0
- package/dist/services/core/core/ApiResult.js +1 -0
- package/dist/services/core/core/CancelablePromise.d.ts +20 -0
- package/dist/services/core/core/CancelablePromise.js +111 -0
- package/dist/services/core/core/OpenAPI.d.ts +16 -0
- package/dist/services/core/core/OpenAPI.js +11 -0
- package/dist/services/core/core/request.d.ts +30 -0
- package/dist/services/core/core/request.js +275 -0
- package/dist/services/core/index.d.ts +52 -0
- package/dist/services/core/index.js +12 -0
- package/dist/services/core/models/ActualBalance.d.ts +8 -0
- package/dist/services/core/models/ActualBalance.js +1 -0
- package/dist/services/core/models/Balance.d.ts +6 -0
- package/dist/services/core/models/Balance.js +1 -0
- package/dist/services/core/models/BalanceReport.d.ts +6 -0
- package/dist/services/core/models/BalanceReport.js +1 -0
- package/dist/services/core/models/Bucket.d.ts +4 -0
- package/dist/services/core/models/Bucket.js +1 -0
- package/dist/services/core/models/BucketBalance.d.ts +5 -0
- package/dist/services/core/models/BucketBalance.js +1 -0
- package/dist/services/core/models/BucketBreakdown.d.ts +5 -0
- package/dist/services/core/models/BucketBreakdown.js +1 -0
- package/dist/services/core/models/BucketEdit.d.ts +3 -0
- package/dist/services/core/models/BucketEdit.js +1 -0
- package/dist/services/core/models/BucketInsert.d.ts +3 -0
- package/dist/services/core/models/BucketInsert.js +1 -0
- package/dist/services/core/models/Entry.d.ts +13 -0
- package/dist/services/core/models/Entry.js +1 -0
- package/dist/services/core/models/EntryEdit.d.ts +10 -0
- package/dist/services/core/models/EntryEdit.js +1 -0
- package/dist/services/core/models/EntryInsert.d.ts +13 -0
- package/dist/services/core/models/EntryInsert.js +1 -0
- package/dist/services/core/models/Group.d.ts +4 -0
- package/dist/services/core/models/Group.js +1 -0
- package/dist/services/core/models/GroupEdit.d.ts +3 -0
- package/dist/services/core/models/GroupEdit.js +1 -0
- package/dist/services/core/models/GroupInsert.d.ts +3 -0
- package/dist/services/core/models/GroupInsert.js +1 -0
- package/dist/services/core/models/GroupWallet.d.ts +5 -0
- package/dist/services/core/models/GroupWallet.js +1 -0
- package/dist/services/core/models/GroupWalletEdit.d.ts +7 -0
- package/dist/services/core/models/GroupWalletEdit.js +1 -0
- package/dist/services/core/models/GroupWalletInsert.d.ts +4 -0
- package/dist/services/core/models/GroupWalletInsert.js +1 -0
- package/dist/services/core/models/InputFieldDefinition.d.ts +6 -0
- package/dist/services/core/models/InputFieldDefinition.js +1 -0
- package/dist/services/core/models/Member.d.ts +4 -0
- package/dist/services/core/models/Member.js +1 -0
- package/dist/services/core/models/MemberBalanceReport.d.ts +5 -0
- package/dist/services/core/models/MemberBalanceReport.js +1 -0
- package/dist/services/core/models/MemberEdit.d.ts +3 -0
- package/dist/services/core/models/MemberEdit.js +1 -0
- package/dist/services/core/models/MemberInsert.d.ts +3 -0
- package/dist/services/core/models/MemberInsert.js +1 -0
- package/dist/services/core/models/Money.d.ts +4 -0
- package/dist/services/core/models/Money.js +1 -0
- package/dist/services/core/models/MoneyExpression.d.ts +4 -0
- package/dist/services/core/models/MoneyExpression.js +1 -0
- package/dist/services/core/models/Operation.d.ts +12 -0
- package/dist/services/core/models/Operation.js +1 -0
- package/dist/services/core/models/OperationEdit.d.ts +14 -0
- package/dist/services/core/models/OperationEdit.js +1 -0
- package/dist/services/core/models/OperationInsert.d.ts +14 -0
- package/dist/services/core/models/OperationInsert.js +1 -0
- package/dist/services/core/models/Settlement.d.ts +11 -0
- package/dist/services/core/models/Settlement.js +1 -0
- package/dist/services/core/models/SettlementEdit.d.ts +10 -0
- package/dist/services/core/models/SettlementEdit.js +1 -0
- package/dist/services/core/models/SettlementInsert.d.ts +10 -0
- package/dist/services/core/models/SettlementInsert.js +1 -0
- package/dist/services/core/models/Template.d.ts +7 -0
- package/dist/services/core/models/Template.js +1 -0
- package/dist/services/core/models/TemplateBucketBreakdownDefinition.d.ts +5 -0
- package/dist/services/core/models/TemplateBucketBreakdownDefinition.js +1 -0
- package/dist/services/core/models/TemplateData.d.ts +4 -0
- package/dist/services/core/models/TemplateData.js +1 -0
- package/dist/services/core/models/TemplateDefinition.d.ts +10 -0
- package/dist/services/core/models/TemplateDefinition.js +1 -0
- package/dist/services/core/models/TemplateEdit.d.ts +6 -0
- package/dist/services/core/models/TemplateEdit.js +1 -0
- package/dist/services/core/models/TemplateEntryDefinition.d.ts +4 -0
- package/dist/services/core/models/TemplateEntryDefinition.js +1 -0
- package/dist/services/core/models/TemplateInfo.d.ts +5 -0
- package/dist/services/core/models/TemplateInfo.js +1 -0
- package/dist/services/core/models/TemplateInput.d.ts +3 -0
- package/dist/services/core/models/TemplateInput.js +1 -0
- package/dist/services/core/models/TemplateInputDefinition.d.ts +4 -0
- package/dist/services/core/models/TemplateInputDefinition.js +1 -0
- package/dist/services/core/models/TemplateInsert.d.ts +6 -0
- package/dist/services/core/models/TemplateInsert.js +1 -0
- package/dist/services/core/models/TemplateOperationDefinition.d.ts +11 -0
- package/dist/services/core/models/TemplateOperationDefinition.js +1 -0
- package/dist/services/core/models/TemplateSettlementDefinition.d.ts +9 -0
- package/dist/services/core/models/TemplateSettlementDefinition.js +1 -0
- package/dist/services/core/models/WalletBalance.d.ts +7 -0
- package/dist/services/core/models/WalletBalance.js +1 -0
- package/dist/services/core/services/BucketsService.d.ts +41 -0
- package/dist/services/core/services/BucketsService.js +86 -0
- package/dist/services/core/services/EntriesService.d.ts +44 -0
- package/dist/services/core/services/EntriesService.js +96 -0
- package/dist/services/core/services/GroupWalletsService.d.ts +49 -0
- package/dist/services/core/services/GroupWalletsService.js +102 -0
- package/dist/services/core/services/GroupsService.d.ts +89 -0
- package/dist/services/core/services/GroupsService.js +184 -0
- package/dist/services/core/services/TemplatesService.d.ts +41 -0
- package/dist/services/core/services/TemplatesService.js +86 -0
- package/package.json +11 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as core from "./services/core";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as core from "./services/core";
|
|
@@ -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,11 @@
|
|
|
1
|
+
export class ApiError extends Error {
|
|
2
|
+
constructor(request, response, message) {
|
|
3
|
+
super(message);
|
|
4
|
+
this.name = 'ApiError';
|
|
5
|
+
this.url = response.url;
|
|
6
|
+
this.status = response.status;
|
|
7
|
+
this.statusText = response.statusText;
|
|
8
|
+
this.body = response.body;
|
|
9
|
+
this.request = request;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
@@ -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 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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,111 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
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");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
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");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _CancelablePromise_isResolved, _CancelablePromise_isRejected, _CancelablePromise_isCancelled, _CancelablePromise_cancelHandlers, _CancelablePromise_promise, _CancelablePromise_resolve, _CancelablePromise_reject;
|
|
13
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
14
|
+
/* istanbul ignore file */
|
|
15
|
+
/* tslint:disable */
|
|
16
|
+
/* eslint-disable */
|
|
17
|
+
export class CancelError extends Error {
|
|
18
|
+
constructor(message) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'CancelError';
|
|
21
|
+
}
|
|
22
|
+
get isCancelled() {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export class CancelablePromise {
|
|
27
|
+
constructor(executor) {
|
|
28
|
+
_CancelablePromise_isResolved.set(this, void 0);
|
|
29
|
+
_CancelablePromise_isRejected.set(this, void 0);
|
|
30
|
+
_CancelablePromise_isCancelled.set(this, void 0);
|
|
31
|
+
_CancelablePromise_cancelHandlers.set(this, void 0);
|
|
32
|
+
_CancelablePromise_promise.set(this, void 0);
|
|
33
|
+
_CancelablePromise_resolve.set(this, void 0);
|
|
34
|
+
_CancelablePromise_reject.set(this, void 0);
|
|
35
|
+
__classPrivateFieldSet(this, _CancelablePromise_isResolved, false, "f");
|
|
36
|
+
__classPrivateFieldSet(this, _CancelablePromise_isRejected, false, "f");
|
|
37
|
+
__classPrivateFieldSet(this, _CancelablePromise_isCancelled, false, "f");
|
|
38
|
+
__classPrivateFieldSet(this, _CancelablePromise_cancelHandlers, [], "f");
|
|
39
|
+
__classPrivateFieldSet(this, _CancelablePromise_promise, new Promise((resolve, reject) => {
|
|
40
|
+
__classPrivateFieldSet(this, _CancelablePromise_resolve, resolve, "f");
|
|
41
|
+
__classPrivateFieldSet(this, _CancelablePromise_reject, reject, "f");
|
|
42
|
+
const onResolve = (value) => {
|
|
43
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
__classPrivateFieldSet(this, _CancelablePromise_isResolved, true, "f");
|
|
47
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_resolve, "f"))
|
|
48
|
+
__classPrivateFieldGet(this, _CancelablePromise_resolve, "f").call(this, value);
|
|
49
|
+
};
|
|
50
|
+
const onReject = (reason) => {
|
|
51
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
__classPrivateFieldSet(this, _CancelablePromise_isRejected, true, "f");
|
|
55
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_reject, "f"))
|
|
56
|
+
__classPrivateFieldGet(this, _CancelablePromise_reject, "f").call(this, reason);
|
|
57
|
+
};
|
|
58
|
+
const onCancel = (cancelHandler) => {
|
|
59
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").push(cancelHandler);
|
|
63
|
+
};
|
|
64
|
+
Object.defineProperty(onCancel, 'isResolved', {
|
|
65
|
+
get: () => __classPrivateFieldGet(this, _CancelablePromise_isResolved, "f"),
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(onCancel, 'isRejected', {
|
|
68
|
+
get: () => __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f"),
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(onCancel, 'isCancelled', {
|
|
71
|
+
get: () => __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f"),
|
|
72
|
+
});
|
|
73
|
+
return executor(onResolve, onReject, onCancel);
|
|
74
|
+
}), "f");
|
|
75
|
+
}
|
|
76
|
+
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)]() {
|
|
77
|
+
return "Cancellable Promise";
|
|
78
|
+
}
|
|
79
|
+
then(onFulfilled, onRejected) {
|
|
80
|
+
return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").then(onFulfilled, onRejected);
|
|
81
|
+
}
|
|
82
|
+
catch(onRejected) {
|
|
83
|
+
return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").catch(onRejected);
|
|
84
|
+
}
|
|
85
|
+
finally(onFinally) {
|
|
86
|
+
return __classPrivateFieldGet(this, _CancelablePromise_promise, "f").finally(onFinally);
|
|
87
|
+
}
|
|
88
|
+
cancel() {
|
|
89
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_isResolved, "f") || __classPrivateFieldGet(this, _CancelablePromise_isRejected, "f") || __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f")) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
__classPrivateFieldSet(this, _CancelablePromise_isCancelled, true, "f");
|
|
93
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").length) {
|
|
94
|
+
try {
|
|
95
|
+
for (const cancelHandler of __classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f")) {
|
|
96
|
+
cancelHandler();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
console.warn('Cancellation threw an error', error);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
__classPrivateFieldGet(this, _CancelablePromise_cancelHandlers, "f").length = 0;
|
|
105
|
+
if (__classPrivateFieldGet(this, _CancelablePromise_reject, "f"))
|
|
106
|
+
__classPrivateFieldGet(this, _CancelablePromise_reject, "f").call(this, new CancelError('Request aborted'));
|
|
107
|
+
}
|
|
108
|
+
get isCancelled() {
|
|
109
|
+
return __classPrivateFieldGet(this, _CancelablePromise_isCancelled, "f");
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -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,30 @@
|
|
|
1
|
+
import type { ApiRequestOptions } from './ApiRequestOptions';
|
|
2
|
+
import type { ApiResult } from './ApiResult';
|
|
3
|
+
import { CancelablePromise } from './CancelablePromise';
|
|
4
|
+
import type { OnCancel } from './CancelablePromise';
|
|
5
|
+
import type { OpenAPIConfig } from './OpenAPI';
|
|
6
|
+
export declare const isDefined: <T>(value: T | null | undefined) => value is Exclude<T, null | undefined>;
|
|
7
|
+
export declare const isString: (value: any) => value is string;
|
|
8
|
+
export declare const isStringWithValue: (value: any) => value is string;
|
|
9
|
+
export declare const isBlob: (value: any) => value is Blob;
|
|
10
|
+
export declare const isFormData: (value: any) => value is FormData;
|
|
11
|
+
export declare const base64: (str: string) => string;
|
|
12
|
+
export declare const getQueryString: (params: Record<string, any>) => string;
|
|
13
|
+
export declare const getFormData: (options: ApiRequestOptions) => FormData | undefined;
|
|
14
|
+
type Resolver<T> = (options: ApiRequestOptions) => Promise<T>;
|
|
15
|
+
export declare const resolve: <T>(options: ApiRequestOptions, resolver?: T | Resolver<T>) => Promise<T | undefined>;
|
|
16
|
+
export declare const getHeaders: (config: OpenAPIConfig, options: ApiRequestOptions) => Promise<Headers>;
|
|
17
|
+
export declare const getRequestBody: (options: ApiRequestOptions) => any;
|
|
18
|
+
export declare const sendRequest: (config: OpenAPIConfig, options: ApiRequestOptions, url: string, body: any, formData: FormData | undefined, headers: Headers, onCancel: OnCancel) => Promise<Response>;
|
|
19
|
+
export declare const getResponseHeader: (response: Response, responseHeader?: string) => string | undefined;
|
|
20
|
+
export declare const getResponseBody: (response: Response) => Promise<any>;
|
|
21
|
+
export declare const catchErrorCodes: (options: ApiRequestOptions, result: ApiResult) => void;
|
|
22
|
+
/**
|
|
23
|
+
* Request method
|
|
24
|
+
* @param config The OpenAPI configuration object
|
|
25
|
+
* @param options The request options from the service
|
|
26
|
+
* @returns CancelablePromise<T>
|
|
27
|
+
* @throws ApiError
|
|
28
|
+
*/
|
|
29
|
+
export declare const request: <T>(config: OpenAPIConfig, options: ApiRequestOptions) => CancelablePromise<T>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
import { ApiError } from './ApiError';
|
|
6
|
+
import { CancelablePromise } from './CancelablePromise';
|
|
7
|
+
export const isDefined = (value) => {
|
|
8
|
+
return value !== undefined && value !== null;
|
|
9
|
+
};
|
|
10
|
+
export const isString = (value) => {
|
|
11
|
+
return typeof value === 'string';
|
|
12
|
+
};
|
|
13
|
+
export const isStringWithValue = (value) => {
|
|
14
|
+
return isString(value) && value !== '';
|
|
15
|
+
};
|
|
16
|
+
export const isBlob = (value) => {
|
|
17
|
+
return (typeof value === 'object' &&
|
|
18
|
+
typeof value.type === 'string' &&
|
|
19
|
+
typeof value.stream === 'function' &&
|
|
20
|
+
typeof value.arrayBuffer === 'function' &&
|
|
21
|
+
typeof value.constructor === 'function' &&
|
|
22
|
+
typeof value.constructor.name === 'string' &&
|
|
23
|
+
/^(Blob|File)$/.test(value.constructor.name) &&
|
|
24
|
+
/^(Blob|File)$/.test(value[Symbol.toStringTag]));
|
|
25
|
+
};
|
|
26
|
+
export const isFormData = (value) => {
|
|
27
|
+
return value instanceof FormData;
|
|
28
|
+
};
|
|
29
|
+
export const base64 = (str) => {
|
|
30
|
+
try {
|
|
31
|
+
return btoa(str);
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
return Buffer.from(str).toString('base64');
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
export const getQueryString = (params) => {
|
|
39
|
+
const qs = [];
|
|
40
|
+
const append = (key, value) => {
|
|
41
|
+
qs.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
|
|
42
|
+
};
|
|
43
|
+
const process = (key, value) => {
|
|
44
|
+
if (isDefined(value)) {
|
|
45
|
+
if (Array.isArray(value)) {
|
|
46
|
+
value.forEach(v => {
|
|
47
|
+
process(key, v);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
else if (typeof value === 'object') {
|
|
51
|
+
Object.entries(value).forEach(([k, v]) => {
|
|
52
|
+
process(`${key}[${k}]`, v);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
append(key, value);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
61
|
+
process(key, value);
|
|
62
|
+
});
|
|
63
|
+
if (qs.length > 0) {
|
|
64
|
+
return `?${qs.join('&')}`;
|
|
65
|
+
}
|
|
66
|
+
return '';
|
|
67
|
+
};
|
|
68
|
+
const getUrl = (config, options) => {
|
|
69
|
+
const encoder = config.ENCODE_PATH || encodeURI;
|
|
70
|
+
const path = options.url
|
|
71
|
+
.replace('{api-version}', config.VERSION)
|
|
72
|
+
.replace(/{(.*?)}/g, (substring, group) => {
|
|
73
|
+
if (options.path?.hasOwnProperty(group)) {
|
|
74
|
+
return encoder(String(options.path[group]));
|
|
75
|
+
}
|
|
76
|
+
return substring;
|
|
77
|
+
});
|
|
78
|
+
const url = `${config.BASE}${path}`;
|
|
79
|
+
if (options.query) {
|
|
80
|
+
return `${url}${getQueryString(options.query)}`;
|
|
81
|
+
}
|
|
82
|
+
return url;
|
|
83
|
+
};
|
|
84
|
+
export const getFormData = (options) => {
|
|
85
|
+
if (options.formData) {
|
|
86
|
+
const formData = new FormData();
|
|
87
|
+
const process = (key, value) => {
|
|
88
|
+
if (isString(value) || isBlob(value)) {
|
|
89
|
+
formData.append(key, value);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
formData.append(key, JSON.stringify(value));
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
Object.entries(options.formData)
|
|
96
|
+
.filter(([_, value]) => isDefined(value))
|
|
97
|
+
.forEach(([key, value]) => {
|
|
98
|
+
if (Array.isArray(value)) {
|
|
99
|
+
value.forEach(v => process(key, v));
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
process(key, value);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return formData;
|
|
106
|
+
}
|
|
107
|
+
return undefined;
|
|
108
|
+
};
|
|
109
|
+
export const resolve = async (options, resolver) => {
|
|
110
|
+
if (typeof resolver === 'function') {
|
|
111
|
+
return resolver(options);
|
|
112
|
+
}
|
|
113
|
+
return resolver;
|
|
114
|
+
};
|
|
115
|
+
export const getHeaders = async (config, options) => {
|
|
116
|
+
const [token, username, password, additionalHeaders] = await Promise.all([
|
|
117
|
+
resolve(options, config.TOKEN),
|
|
118
|
+
resolve(options, config.USERNAME),
|
|
119
|
+
resolve(options, config.PASSWORD),
|
|
120
|
+
resolve(options, config.HEADERS),
|
|
121
|
+
]);
|
|
122
|
+
const headers = Object.entries({
|
|
123
|
+
Accept: 'application/json',
|
|
124
|
+
...additionalHeaders,
|
|
125
|
+
...options.headers,
|
|
126
|
+
})
|
|
127
|
+
.filter(([_, value]) => isDefined(value))
|
|
128
|
+
.reduce((headers, [key, value]) => ({
|
|
129
|
+
...headers,
|
|
130
|
+
[key]: String(value),
|
|
131
|
+
}), {});
|
|
132
|
+
if (isStringWithValue(token)) {
|
|
133
|
+
headers['Authorization'] = `Bearer ${token}`;
|
|
134
|
+
}
|
|
135
|
+
if (isStringWithValue(username) && isStringWithValue(password)) {
|
|
136
|
+
const credentials = base64(`${username}:${password}`);
|
|
137
|
+
headers['Authorization'] = `Basic ${credentials}`;
|
|
138
|
+
}
|
|
139
|
+
if (options.body !== undefined) {
|
|
140
|
+
if (options.mediaType) {
|
|
141
|
+
headers['Content-Type'] = options.mediaType;
|
|
142
|
+
}
|
|
143
|
+
else if (isBlob(options.body)) {
|
|
144
|
+
headers['Content-Type'] = options.body.type || 'application/octet-stream';
|
|
145
|
+
}
|
|
146
|
+
else if (isString(options.body)) {
|
|
147
|
+
headers['Content-Type'] = 'text/plain';
|
|
148
|
+
}
|
|
149
|
+
else if (!isFormData(options.body)) {
|
|
150
|
+
headers['Content-Type'] = 'application/json';
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return new Headers(headers);
|
|
154
|
+
};
|
|
155
|
+
export const getRequestBody = (options) => {
|
|
156
|
+
if (options.body !== undefined) {
|
|
157
|
+
if (options.mediaType?.includes('/json')) {
|
|
158
|
+
return JSON.stringify(options.body);
|
|
159
|
+
}
|
|
160
|
+
else if (isString(options.body) || isBlob(options.body) || isFormData(options.body)) {
|
|
161
|
+
return options.body;
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
return JSON.stringify(options.body);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return undefined;
|
|
168
|
+
};
|
|
169
|
+
export const sendRequest = async (config, options, url, body, formData, headers, onCancel) => {
|
|
170
|
+
const controller = new AbortController();
|
|
171
|
+
const request = {
|
|
172
|
+
headers,
|
|
173
|
+
body: body ?? formData,
|
|
174
|
+
method: options.method,
|
|
175
|
+
signal: controller.signal,
|
|
176
|
+
};
|
|
177
|
+
if (config.WITH_CREDENTIALS) {
|
|
178
|
+
request.credentials = config.CREDENTIALS;
|
|
179
|
+
}
|
|
180
|
+
onCancel(() => controller.abort());
|
|
181
|
+
return await fetch(url, request);
|
|
182
|
+
};
|
|
183
|
+
export const getResponseHeader = (response, responseHeader) => {
|
|
184
|
+
if (responseHeader) {
|
|
185
|
+
const content = response.headers.get(responseHeader);
|
|
186
|
+
if (isString(content)) {
|
|
187
|
+
return content;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return undefined;
|
|
191
|
+
};
|
|
192
|
+
export const getResponseBody = async (response) => {
|
|
193
|
+
if (response.status !== 204) {
|
|
194
|
+
try {
|
|
195
|
+
const contentType = response.headers.get('Content-Type');
|
|
196
|
+
if (contentType) {
|
|
197
|
+
const jsonTypes = ['application/json', 'application/problem+json'];
|
|
198
|
+
const isJSON = jsonTypes.some(type => contentType.toLowerCase().startsWith(type));
|
|
199
|
+
if (isJSON) {
|
|
200
|
+
return await response.json();
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
return await response.text();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
catch (error) {
|
|
208
|
+
console.error(error);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
return undefined;
|
|
212
|
+
};
|
|
213
|
+
export const catchErrorCodes = (options, result) => {
|
|
214
|
+
const errors = {
|
|
215
|
+
400: 'Bad Request',
|
|
216
|
+
401: 'Unauthorized',
|
|
217
|
+
403: 'Forbidden',
|
|
218
|
+
404: 'Not Found',
|
|
219
|
+
500: 'Internal Server Error',
|
|
220
|
+
502: 'Bad Gateway',
|
|
221
|
+
503: 'Service Unavailable',
|
|
222
|
+
...options.errors,
|
|
223
|
+
};
|
|
224
|
+
const error = errors[result.status];
|
|
225
|
+
if (error) {
|
|
226
|
+
throw new ApiError(options, result, error);
|
|
227
|
+
}
|
|
228
|
+
if (!result.ok) {
|
|
229
|
+
const errorStatus = result.status ?? 'unknown';
|
|
230
|
+
const errorStatusText = result.statusText ?? 'unknown';
|
|
231
|
+
const errorBody = (() => {
|
|
232
|
+
try {
|
|
233
|
+
return JSON.stringify(result.body, null, 2);
|
|
234
|
+
}
|
|
235
|
+
catch (e) {
|
|
236
|
+
return undefined;
|
|
237
|
+
}
|
|
238
|
+
})();
|
|
239
|
+
throw new ApiError(options, result, `Generic Error: status: ${errorStatus}; status text: ${errorStatusText}; body: ${errorBody}`);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
/**
|
|
243
|
+
* Request method
|
|
244
|
+
* @param config The OpenAPI configuration object
|
|
245
|
+
* @param options The request options from the service
|
|
246
|
+
* @returns CancelablePromise<T>
|
|
247
|
+
* @throws ApiError
|
|
248
|
+
*/
|
|
249
|
+
export const request = (config, options) => {
|
|
250
|
+
return new CancelablePromise(async (resolve, reject, onCancel) => {
|
|
251
|
+
try {
|
|
252
|
+
const url = getUrl(config, options);
|
|
253
|
+
const formData = getFormData(options);
|
|
254
|
+
const body = getRequestBody(options);
|
|
255
|
+
const headers = await getHeaders(config, options);
|
|
256
|
+
if (!onCancel.isCancelled) {
|
|
257
|
+
const response = await sendRequest(config, options, url, body, formData, headers, onCancel);
|
|
258
|
+
const responseBody = await getResponseBody(response);
|
|
259
|
+
const responseHeader = getResponseHeader(response, options.responseHeader);
|
|
260
|
+
const result = {
|
|
261
|
+
url,
|
|
262
|
+
ok: response.ok,
|
|
263
|
+
status: response.status,
|
|
264
|
+
statusText: response.statusText,
|
|
265
|
+
body: responseHeader ?? responseBody,
|
|
266
|
+
};
|
|
267
|
+
catchErrorCodes(options, result);
|
|
268
|
+
resolve(result.body);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
catch (error) {
|
|
272
|
+
reject(error);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
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 { ActualBalance } from './models/ActualBalance';
|
|
6
|
+
export type { Balance } from './models/Balance';
|
|
7
|
+
export type { BalanceReport } from './models/BalanceReport';
|
|
8
|
+
export type { Bucket } from './models/Bucket';
|
|
9
|
+
export type { BucketBalance } from './models/BucketBalance';
|
|
10
|
+
export type { BucketBreakdown } from './models/BucketBreakdown';
|
|
11
|
+
export type { BucketEdit } from './models/BucketEdit';
|
|
12
|
+
export type { BucketInsert } from './models/BucketInsert';
|
|
13
|
+
export type { Entry } from './models/Entry';
|
|
14
|
+
export type { EntryEdit } from './models/EntryEdit';
|
|
15
|
+
export type { EntryInsert } from './models/EntryInsert';
|
|
16
|
+
export type { Group } from './models/Group';
|
|
17
|
+
export type { GroupEdit } from './models/GroupEdit';
|
|
18
|
+
export type { GroupInsert } from './models/GroupInsert';
|
|
19
|
+
export type { GroupWallet } from './models/GroupWallet';
|
|
20
|
+
export type { GroupWalletEdit } from './models/GroupWalletEdit';
|
|
21
|
+
export type { GroupWalletInsert } from './models/GroupWalletInsert';
|
|
22
|
+
export type { InputFieldDefinition } from './models/InputFieldDefinition';
|
|
23
|
+
export type { Member } from './models/Member';
|
|
24
|
+
export type { MemberBalanceReport } from './models/MemberBalanceReport';
|
|
25
|
+
export type { MemberEdit } from './models/MemberEdit';
|
|
26
|
+
export type { MemberInsert } from './models/MemberInsert';
|
|
27
|
+
export type { Money } from './models/Money';
|
|
28
|
+
export type { MoneyExpression } from './models/MoneyExpression';
|
|
29
|
+
export type { Operation } from './models/Operation';
|
|
30
|
+
export type { OperationEdit } from './models/OperationEdit';
|
|
31
|
+
export type { OperationInsert } from './models/OperationInsert';
|
|
32
|
+
export type { Settlement } from './models/Settlement';
|
|
33
|
+
export type { SettlementEdit } from './models/SettlementEdit';
|
|
34
|
+
export type { SettlementInsert } from './models/SettlementInsert';
|
|
35
|
+
export type { Template } from './models/Template';
|
|
36
|
+
export type { TemplateBucketBreakdownDefinition } from './models/TemplateBucketBreakdownDefinition';
|
|
37
|
+
export type { TemplateData } from './models/TemplateData';
|
|
38
|
+
export type { TemplateDefinition } from './models/TemplateDefinition';
|
|
39
|
+
export type { TemplateEdit } from './models/TemplateEdit';
|
|
40
|
+
export type { TemplateEntryDefinition } from './models/TemplateEntryDefinition';
|
|
41
|
+
export type { TemplateInfo } from './models/TemplateInfo';
|
|
42
|
+
export type { TemplateInput } from './models/TemplateInput';
|
|
43
|
+
export type { TemplateInputDefinition } from './models/TemplateInputDefinition';
|
|
44
|
+
export type { TemplateInsert } from './models/TemplateInsert';
|
|
45
|
+
export type { TemplateOperationDefinition } from './models/TemplateOperationDefinition';
|
|
46
|
+
export type { TemplateSettlementDefinition } from './models/TemplateSettlementDefinition';
|
|
47
|
+
export type { WalletBalance } from './models/WalletBalance';
|
|
48
|
+
export { BucketsService } from './services/BucketsService';
|
|
49
|
+
export { EntriesService } from './services/EntriesService';
|
|
50
|
+
export { GroupsService } from './services/GroupsService';
|
|
51
|
+
export { GroupWalletsService } from './services/GroupWalletsService';
|
|
52
|
+
export { TemplatesService } from './services/TemplatesService';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/* generated using openapi-typescript-codegen -- do not edit */
|
|
2
|
+
/* istanbul ignore file */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export { ApiError } from './core/ApiError';
|
|
6
|
+
export { CancelablePromise, CancelError } from './core/CancelablePromise';
|
|
7
|
+
export { OpenAPI } from './core/OpenAPI';
|
|
8
|
+
export { BucketsService } from './services/BucketsService';
|
|
9
|
+
export { EntriesService } from './services/EntriesService';
|
|
10
|
+
export { GroupsService } from './services/GroupsService';
|
|
11
|
+
export { GroupWalletsService } from './services/GroupWalletsService';
|
|
12
|
+
export { TemplatesService } from './services/TemplatesService';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BucketBalance } from './BucketBalance';
|
|
2
|
+
import type { Money } from './Money';
|
|
3
|
+
import type { WalletBalance } from './WalletBalance';
|
|
4
|
+
export type ActualBalance = {
|
|
5
|
+
total: Array<Money>;
|
|
6
|
+
perBucketBreakdown: Array<BucketBalance>;
|
|
7
|
+
perWalletBreakdown: Array<WalletBalance>;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|