@financeable/aggregation 0.2.1 → 0.3.1
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/FUNCTIONS.md +9 -121
- package/README.md +74 -483
- package/docs/sdks/applications/README.md +20 -12
- package/docs/sdks/financeable/README.md +84 -0
- package/funcs/applicationsCreate.d.ts +2 -1
- package/funcs/applicationsCreate.d.ts.map +1 -1
- package/funcs/applicationsCreate.js +19 -8
- package/funcs/applicationsCreate.js.map +1 -1
- package/funcs/applicationsGet.d.ts +2 -1
- package/funcs/applicationsGet.d.ts.map +1 -1
- package/funcs/applicationsGet.js +19 -8
- package/funcs/applicationsGet.js.map +1 -1
- package/funcs/applicationsList.d.ts +2 -1
- package/funcs/applicationsList.d.ts.map +1 -1
- package/funcs/applicationsList.js +19 -8
- package/funcs/applicationsList.js.map +1 -1
- package/funcs/getToken.d.ts +13 -0
- package/funcs/getToken.d.ts.map +1 -0
- package/funcs/getToken.js +111 -0
- package/funcs/getToken.js.map +1 -0
- package/jsr.json +1 -1
- package/lib/config.d.ts +5 -4
- package/lib/config.d.ts.map +1 -1
- package/lib/config.js +7 -4
- package/lib/config.js.map +1 -1
- package/lib/env.d.ts +1 -0
- package/lib/env.d.ts.map +1 -1
- package/lib/env.js +1 -0
- package/lib/env.js.map +1 -1
- package/lib/security.d.ts +3 -0
- package/lib/security.d.ts.map +1 -1
- package/lib/security.js +19 -0
- package/lib/security.js.map +1 -1
- package/models/components/customerattributes.d.ts +5 -36
- package/models/components/customerattributes.d.ts.map +1 -1
- package/models/components/customerattributes.js +6 -41
- package/models/components/customerattributes.js.map +1 -1
- package/models/components/customeridtype.d.ts +28 -0
- package/models/components/customeridtype.d.ts.map +1 -0
- package/models/components/customeridtype.js +60 -0
- package/models/components/customeridtype.js.map +1 -0
- package/models/components/index.d.ts +4 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +4 -0
- package/models/components/index.js.map +1 -1
- package/models/components/security.d.ts +29 -0
- package/models/components/security.d.ts.map +1 -0
- package/models/components/security.js +69 -0
- package/models/components/security.js.map +1 -0
- package/models/components/tokenrequest.d.ts +79 -0
- package/models/components/tokenrequest.d.ts.map +1 -0
- package/models/components/tokenrequest.js +110 -0
- package/models/components/tokenrequest.js.map +1 -0
- package/models/components/tokenresponse.d.ts +50 -0
- package/models/components/tokenresponse.d.ts.map +1 -0
- package/models/components/tokenresponse.js +88 -0
- package/models/components/tokenresponse.js.map +1 -0
- package/package.json +1 -1
- package/sdk/sdk.d.ts +6 -1
- package/sdk/sdk.d.ts.map +1 -1
- package/sdk/sdk.js +8 -0
- package/sdk/sdk.js.map +1 -1
- package/src/funcs/applicationsCreate.ts +45 -9
- package/src/funcs/applicationsGet.ts +45 -9
- package/src/funcs/applicationsList.ts +45 -9
- package/src/funcs/getToken.ts +153 -0
- package/src/lib/config.ts +9 -4
- package/src/lib/env.ts +4 -0
- package/src/lib/security.ts +27 -0
- package/src/models/components/customerattributes.ts +13 -53
- package/src/models/components/customeridtype.ts +33 -0
- package/src/models/components/index.ts +4 -0
- package/src/models/components/security.ts +62 -0
- package/src/models/components/tokenrequest.ts +133 -0
- package/src/models/components/tokenresponse.ts +102 -0
- package/src/sdk/sdk.ts +18 -1
- package/src/types/async.ts +68 -0
- package/types/async.d.ts +23 -0
- package/types/async.d.ts.map +1 -0
- package/types/async.js +44 -0
- package/types/async.js.map +1 -0
|
@@ -8,6 +8,7 @@ import * as M from "../lib/matchers.js";
|
|
|
8
8
|
import { compactMap } from "../lib/primitives.js";
|
|
9
9
|
import { safeParse } from "../lib/schemas.js";
|
|
10
10
|
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
12
|
import { pathToFunc } from "../lib/url.js";
|
|
12
13
|
import { APIError } from "../models/errors/apierror.js";
|
|
13
14
|
import {
|
|
@@ -20,16 +21,17 @@ import {
|
|
|
20
21
|
import * as errors from "../models/errors/index.js";
|
|
21
22
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
22
23
|
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
23
25
|
import { Result } from "../types/fp.js";
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* Retrieve an application by its ID
|
|
27
29
|
*/
|
|
28
|
-
export
|
|
30
|
+
export function applicationsGet(
|
|
29
31
|
client: FinanceableCore,
|
|
30
32
|
request: operations.GetApplicationRequest,
|
|
31
33
|
options?: RequestOptions,
|
|
32
|
-
):
|
|
34
|
+
): APIPromise<
|
|
33
35
|
Result<
|
|
34
36
|
operations.GetApplicationResponseBody,
|
|
35
37
|
| errors.GetApplicationResponseBody
|
|
@@ -41,6 +43,33 @@ export async function applicationsGet(
|
|
|
41
43
|
| RequestTimeoutError
|
|
42
44
|
| ConnectionError
|
|
43
45
|
>
|
|
46
|
+
> {
|
|
47
|
+
return new APIPromise($do(
|
|
48
|
+
client,
|
|
49
|
+
request,
|
|
50
|
+
options,
|
|
51
|
+
));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function $do(
|
|
55
|
+
client: FinanceableCore,
|
|
56
|
+
request: operations.GetApplicationRequest,
|
|
57
|
+
options?: RequestOptions,
|
|
58
|
+
): Promise<
|
|
59
|
+
[
|
|
60
|
+
Result<
|
|
61
|
+
operations.GetApplicationResponseBody,
|
|
62
|
+
| errors.GetApplicationResponseBody
|
|
63
|
+
| APIError
|
|
64
|
+
| SDKValidationError
|
|
65
|
+
| UnexpectedClientError
|
|
66
|
+
| InvalidRequestError
|
|
67
|
+
| RequestAbortedError
|
|
68
|
+
| RequestTimeoutError
|
|
69
|
+
| ConnectionError
|
|
70
|
+
>,
|
|
71
|
+
APICall,
|
|
72
|
+
]
|
|
44
73
|
> {
|
|
45
74
|
const parsed = safeParse(
|
|
46
75
|
request,
|
|
@@ -48,7 +77,7 @@ export async function applicationsGet(
|
|
|
48
77
|
"Input validation failed",
|
|
49
78
|
);
|
|
50
79
|
if (!parsed.ok) {
|
|
51
|
-
return parsed;
|
|
80
|
+
return [parsed, { status: "invalid" }];
|
|
52
81
|
}
|
|
53
82
|
const payload = parsed.value;
|
|
54
83
|
const body = null;
|
|
@@ -66,14 +95,20 @@ export async function applicationsGet(
|
|
|
66
95
|
Accept: "application/json",
|
|
67
96
|
}));
|
|
68
97
|
|
|
98
|
+
const secConfig = await extractSecurity(client._options.clientCredentials);
|
|
99
|
+
const securityInput = secConfig == null
|
|
100
|
+
? {}
|
|
101
|
+
: { clientCredentials: secConfig };
|
|
102
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
103
|
+
|
|
69
104
|
const context = {
|
|
70
105
|
baseURL: options?.serverURL ?? "",
|
|
71
106
|
operationID: "getApplication",
|
|
72
107
|
oAuth2Scopes: [],
|
|
73
108
|
|
|
74
|
-
resolvedSecurity:
|
|
109
|
+
resolvedSecurity: requestSecurity,
|
|
75
110
|
|
|
76
|
-
securitySource:
|
|
111
|
+
securitySource: client._options.clientCredentials,
|
|
77
112
|
retryConfig: options?.retries
|
|
78
113
|
|| client._options.retryConfig
|
|
79
114
|
|| { strategy: "none" },
|
|
@@ -81,6 +116,7 @@ export async function applicationsGet(
|
|
|
81
116
|
};
|
|
82
117
|
|
|
83
118
|
const requestRes = client._createRequest(context, {
|
|
119
|
+
security: requestSecurity,
|
|
84
120
|
method: "GET",
|
|
85
121
|
baseURL: options?.serverURL,
|
|
86
122
|
path: path,
|
|
@@ -89,7 +125,7 @@ export async function applicationsGet(
|
|
|
89
125
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
90
126
|
}, options);
|
|
91
127
|
if (!requestRes.ok) {
|
|
92
|
-
return requestRes;
|
|
128
|
+
return [requestRes, { status: "invalid" }];
|
|
93
129
|
}
|
|
94
130
|
const req = requestRes.value;
|
|
95
131
|
|
|
@@ -100,7 +136,7 @@ export async function applicationsGet(
|
|
|
100
136
|
retryCodes: context.retryCodes,
|
|
101
137
|
});
|
|
102
138
|
if (!doResult.ok) {
|
|
103
|
-
return doResult;
|
|
139
|
+
return [doResult, { status: "request-error", request: req }];
|
|
104
140
|
}
|
|
105
141
|
const response = doResult.value;
|
|
106
142
|
|
|
@@ -125,8 +161,8 @@ export async function applicationsGet(
|
|
|
125
161
|
M.fail("5XX"),
|
|
126
162
|
)(response, { extraFields: responseFields });
|
|
127
163
|
if (!result.ok) {
|
|
128
|
-
return result;
|
|
164
|
+
return [result, { status: "complete", request: req, response }];
|
|
129
165
|
}
|
|
130
166
|
|
|
131
|
-
return result;
|
|
167
|
+
return [result, { status: "complete", request: req, response }];
|
|
132
168
|
}
|
|
@@ -8,6 +8,7 @@ import * as M from "../lib/matchers.js";
|
|
|
8
8
|
import { compactMap } from "../lib/primitives.js";
|
|
9
9
|
import { safeParse } from "../lib/schemas.js";
|
|
10
10
|
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
11
12
|
import { pathToFunc } from "../lib/url.js";
|
|
12
13
|
import { APIError } from "../models/errors/apierror.js";
|
|
13
14
|
import {
|
|
@@ -20,16 +21,17 @@ import {
|
|
|
20
21
|
import * as errors from "../models/errors/index.js";
|
|
21
22
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
22
23
|
import * as operations from "../models/operations/index.js";
|
|
24
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
23
25
|
import { Result } from "../types/fp.js";
|
|
24
26
|
|
|
25
27
|
/**
|
|
26
28
|
* Retrieve a list of applications
|
|
27
29
|
*/
|
|
28
|
-
export
|
|
30
|
+
export function applicationsList(
|
|
29
31
|
client: FinanceableCore,
|
|
30
32
|
request: operations.GetApplicationsRequest,
|
|
31
33
|
options?: RequestOptions,
|
|
32
|
-
):
|
|
34
|
+
): APIPromise<
|
|
33
35
|
Result<
|
|
34
36
|
operations.GetApplicationsResponseBody,
|
|
35
37
|
| errors.GetApplicationsResponseBody
|
|
@@ -41,6 +43,33 @@ export async function applicationsList(
|
|
|
41
43
|
| RequestTimeoutError
|
|
42
44
|
| ConnectionError
|
|
43
45
|
>
|
|
46
|
+
> {
|
|
47
|
+
return new APIPromise($do(
|
|
48
|
+
client,
|
|
49
|
+
request,
|
|
50
|
+
options,
|
|
51
|
+
));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function $do(
|
|
55
|
+
client: FinanceableCore,
|
|
56
|
+
request: operations.GetApplicationsRequest,
|
|
57
|
+
options?: RequestOptions,
|
|
58
|
+
): Promise<
|
|
59
|
+
[
|
|
60
|
+
Result<
|
|
61
|
+
operations.GetApplicationsResponseBody,
|
|
62
|
+
| errors.GetApplicationsResponseBody
|
|
63
|
+
| APIError
|
|
64
|
+
| SDKValidationError
|
|
65
|
+
| UnexpectedClientError
|
|
66
|
+
| InvalidRequestError
|
|
67
|
+
| RequestAbortedError
|
|
68
|
+
| RequestTimeoutError
|
|
69
|
+
| ConnectionError
|
|
70
|
+
>,
|
|
71
|
+
APICall,
|
|
72
|
+
]
|
|
44
73
|
> {
|
|
45
74
|
const parsed = safeParse(
|
|
46
75
|
request,
|
|
@@ -48,7 +77,7 @@ export async function applicationsList(
|
|
|
48
77
|
"Input validation failed",
|
|
49
78
|
);
|
|
50
79
|
if (!parsed.ok) {
|
|
51
|
-
return parsed;
|
|
80
|
+
return [parsed, { status: "invalid" }];
|
|
52
81
|
}
|
|
53
82
|
const payload = parsed.value;
|
|
54
83
|
const body = null;
|
|
@@ -63,14 +92,20 @@ export async function applicationsList(
|
|
|
63
92
|
Accept: "application/json",
|
|
64
93
|
}));
|
|
65
94
|
|
|
95
|
+
const secConfig = await extractSecurity(client._options.clientCredentials);
|
|
96
|
+
const securityInput = secConfig == null
|
|
97
|
+
? {}
|
|
98
|
+
: { clientCredentials: secConfig };
|
|
99
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
100
|
+
|
|
66
101
|
const context = {
|
|
67
102
|
baseURL: options?.serverURL ?? "",
|
|
68
103
|
operationID: "getApplications",
|
|
69
104
|
oAuth2Scopes: [],
|
|
70
105
|
|
|
71
|
-
resolvedSecurity:
|
|
106
|
+
resolvedSecurity: requestSecurity,
|
|
72
107
|
|
|
73
|
-
securitySource:
|
|
108
|
+
securitySource: client._options.clientCredentials,
|
|
74
109
|
retryConfig: options?.retries
|
|
75
110
|
|| client._options.retryConfig
|
|
76
111
|
|| { strategy: "none" },
|
|
@@ -78,6 +113,7 @@ export async function applicationsList(
|
|
|
78
113
|
};
|
|
79
114
|
|
|
80
115
|
const requestRes = client._createRequest(context, {
|
|
116
|
+
security: requestSecurity,
|
|
81
117
|
method: "GET",
|
|
82
118
|
baseURL: options?.serverURL,
|
|
83
119
|
path: path,
|
|
@@ -87,7 +123,7 @@ export async function applicationsList(
|
|
|
87
123
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
88
124
|
}, options);
|
|
89
125
|
if (!requestRes.ok) {
|
|
90
|
-
return requestRes;
|
|
126
|
+
return [requestRes, { status: "invalid" }];
|
|
91
127
|
}
|
|
92
128
|
const req = requestRes.value;
|
|
93
129
|
|
|
@@ -98,7 +134,7 @@ export async function applicationsList(
|
|
|
98
134
|
retryCodes: context.retryCodes,
|
|
99
135
|
});
|
|
100
136
|
if (!doResult.ok) {
|
|
101
|
-
return doResult;
|
|
137
|
+
return [doResult, { status: "request-error", request: req }];
|
|
102
138
|
}
|
|
103
139
|
const response = doResult.value;
|
|
104
140
|
|
|
@@ -123,8 +159,8 @@ export async function applicationsList(
|
|
|
123
159
|
M.fail("5XX"),
|
|
124
160
|
)(response, { extraFields: responseFields });
|
|
125
161
|
if (!result.ok) {
|
|
126
|
-
return result;
|
|
162
|
+
return [result, { status: "complete", request: req, response }];
|
|
127
163
|
}
|
|
128
164
|
|
|
129
|
-
return result;
|
|
165
|
+
return [result, { status: "complete", request: req, response }];
|
|
130
166
|
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { FinanceableCore } from "../core.js";
|
|
6
|
+
import { encodeJSON } from "../lib/encodings.js";
|
|
7
|
+
import * as M from "../lib/matchers.js";
|
|
8
|
+
import { compactMap } from "../lib/primitives.js";
|
|
9
|
+
import { safeParse } from "../lib/schemas.js";
|
|
10
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
11
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
12
|
+
import { pathToFunc } from "../lib/url.js";
|
|
13
|
+
import * as components from "../models/components/index.js";
|
|
14
|
+
import { APIError } from "../models/errors/apierror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
|
+
import { Result } from "../types/fp.js";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Obtain an OAuth client_credentials token
|
|
28
|
+
*/
|
|
29
|
+
export function getToken(
|
|
30
|
+
client: FinanceableCore,
|
|
31
|
+
request: components.TokenRequest,
|
|
32
|
+
options?: RequestOptions,
|
|
33
|
+
): APIPromise<
|
|
34
|
+
Result<
|
|
35
|
+
components.TokenResponse,
|
|
36
|
+
| APIError
|
|
37
|
+
| SDKValidationError
|
|
38
|
+
| UnexpectedClientError
|
|
39
|
+
| InvalidRequestError
|
|
40
|
+
| RequestAbortedError
|
|
41
|
+
| RequestTimeoutError
|
|
42
|
+
| ConnectionError
|
|
43
|
+
>
|
|
44
|
+
> {
|
|
45
|
+
return new APIPromise($do(
|
|
46
|
+
client,
|
|
47
|
+
request,
|
|
48
|
+
options,
|
|
49
|
+
));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async function $do(
|
|
53
|
+
client: FinanceableCore,
|
|
54
|
+
request: components.TokenRequest,
|
|
55
|
+
options?: RequestOptions,
|
|
56
|
+
): Promise<
|
|
57
|
+
[
|
|
58
|
+
Result<
|
|
59
|
+
components.TokenResponse,
|
|
60
|
+
| APIError
|
|
61
|
+
| SDKValidationError
|
|
62
|
+
| UnexpectedClientError
|
|
63
|
+
| InvalidRequestError
|
|
64
|
+
| RequestAbortedError
|
|
65
|
+
| RequestTimeoutError
|
|
66
|
+
| ConnectionError
|
|
67
|
+
>,
|
|
68
|
+
APICall,
|
|
69
|
+
]
|
|
70
|
+
> {
|
|
71
|
+
const parsed = safeParse(
|
|
72
|
+
request,
|
|
73
|
+
(value) => components.TokenRequest$outboundSchema.parse(value),
|
|
74
|
+
"Input validation failed",
|
|
75
|
+
);
|
|
76
|
+
if (!parsed.ok) {
|
|
77
|
+
return [parsed, { status: "invalid" }];
|
|
78
|
+
}
|
|
79
|
+
const payload = parsed.value;
|
|
80
|
+
const body = encodeJSON("body", payload, { explode: true });
|
|
81
|
+
|
|
82
|
+
const path = pathToFunc("/oauth/token")();
|
|
83
|
+
|
|
84
|
+
const headers = new Headers(compactMap({
|
|
85
|
+
"Content-Type": "application/json",
|
|
86
|
+
Accept: "application/json",
|
|
87
|
+
}));
|
|
88
|
+
|
|
89
|
+
const secConfig = await extractSecurity(client._options.clientCredentials);
|
|
90
|
+
const securityInput = secConfig == null
|
|
91
|
+
? {}
|
|
92
|
+
: { clientCredentials: secConfig };
|
|
93
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
94
|
+
|
|
95
|
+
const context = {
|
|
96
|
+
baseURL: options?.serverURL ?? "",
|
|
97
|
+
operationID: "getToken",
|
|
98
|
+
oAuth2Scopes: [],
|
|
99
|
+
|
|
100
|
+
resolvedSecurity: requestSecurity,
|
|
101
|
+
|
|
102
|
+
securitySource: client._options.clientCredentials,
|
|
103
|
+
retryConfig: options?.retries
|
|
104
|
+
|| client._options.retryConfig
|
|
105
|
+
|| { strategy: "none" },
|
|
106
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const requestRes = client._createRequest(context, {
|
|
110
|
+
security: requestSecurity,
|
|
111
|
+
method: "POST",
|
|
112
|
+
baseURL: options?.serverURL,
|
|
113
|
+
path: path,
|
|
114
|
+
headers: headers,
|
|
115
|
+
body: body,
|
|
116
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
117
|
+
}, options);
|
|
118
|
+
if (!requestRes.ok) {
|
|
119
|
+
return [requestRes, { status: "invalid" }];
|
|
120
|
+
}
|
|
121
|
+
const req = requestRes.value;
|
|
122
|
+
|
|
123
|
+
const doResult = await client._do(req, {
|
|
124
|
+
context,
|
|
125
|
+
errorCodes: ["4XX", "5XX"],
|
|
126
|
+
retryConfig: context.retryConfig,
|
|
127
|
+
retryCodes: context.retryCodes,
|
|
128
|
+
});
|
|
129
|
+
if (!doResult.ok) {
|
|
130
|
+
return [doResult, { status: "request-error", request: req }];
|
|
131
|
+
}
|
|
132
|
+
const response = doResult.value;
|
|
133
|
+
|
|
134
|
+
const [result] = await M.match<
|
|
135
|
+
components.TokenResponse,
|
|
136
|
+
| APIError
|
|
137
|
+
| SDKValidationError
|
|
138
|
+
| UnexpectedClientError
|
|
139
|
+
| InvalidRequestError
|
|
140
|
+
| RequestAbortedError
|
|
141
|
+
| RequestTimeoutError
|
|
142
|
+
| ConnectionError
|
|
143
|
+
>(
|
|
144
|
+
M.json(201, components.TokenResponse$inboundSchema),
|
|
145
|
+
M.fail("4XX"),
|
|
146
|
+
M.fail("5XX"),
|
|
147
|
+
)(response);
|
|
148
|
+
if (!result.ok) {
|
|
149
|
+
return [result, { status: "complete", request: req, response }];
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return [result, { status: "complete", request: req, response }];
|
|
153
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -11,10 +11,15 @@ import { Params, pathToFunc } from "./url.js";
|
|
|
11
11
|
* Contains the list of servers available to the SDK
|
|
12
12
|
*/
|
|
13
13
|
export const ServerList = [
|
|
14
|
+
/**
|
|
15
|
+
* Production Server
|
|
16
|
+
*/
|
|
14
17
|
"https://api.financeable.com.au",
|
|
15
18
|
] as const;
|
|
16
19
|
|
|
17
20
|
export type SDKOptions = {
|
|
21
|
+
clientCredentials?: string | (() => Promise<string>);
|
|
22
|
+
|
|
18
23
|
httpClient?: HTTPClient;
|
|
19
24
|
/**
|
|
20
25
|
* Allows overriding the default server used by the SDK
|
|
@@ -51,9 +56,9 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
51
56
|
|
|
52
57
|
export const SDK_METADATA = {
|
|
53
58
|
language: "typescript",
|
|
54
|
-
openapiDocVersion: "0.
|
|
55
|
-
sdkVersion: "0.
|
|
56
|
-
genVersion: "2.
|
|
59
|
+
openapiDocVersion: "0.3.0",
|
|
60
|
+
sdkVersion: "0.3.1",
|
|
61
|
+
genVersion: "2.515.0",
|
|
57
62
|
userAgent:
|
|
58
|
-
"speakeasy-sdk/typescript 0.
|
|
63
|
+
"speakeasy-sdk/typescript 0.3.1 2.515.0 0.3.0 @financeable/aggregation",
|
|
59
64
|
} as const;
|
package/src/lib/env.ts
CHANGED
|
@@ -7,10 +7,14 @@ import { dlv } from "./dlv.js";
|
|
|
7
7
|
import * as z from "zod";
|
|
8
8
|
|
|
9
9
|
export interface Env {
|
|
10
|
+
FINANCEABLE_CLIENT_CREDENTIALS?: string | undefined;
|
|
11
|
+
|
|
10
12
|
FINANCEABLE_DEBUG?: boolean | undefined;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export const envSchema: z.ZodType<Env, z.ZodTypeDef, unknown> = z.object({
|
|
16
|
+
FINANCEABLE_CLIENT_CREDENTIALS: z.string().optional(),
|
|
17
|
+
|
|
14
18
|
FINANCEABLE_DEBUG: z.coerce.boolean().optional(),
|
|
15
19
|
});
|
|
16
20
|
|
package/src/lib/security.ts
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import * as components from "../models/components/index.js";
|
|
6
|
+
import { env } from "./env.js";
|
|
5
7
|
type OAuth2PasswordFlow = {
|
|
6
8
|
username: string;
|
|
7
9
|
password?: string | undefined;
|
|
@@ -225,3 +227,28 @@ function applyBearer(
|
|
|
225
227
|
|
|
226
228
|
state.headers[spec.fieldName] = value;
|
|
227
229
|
}
|
|
230
|
+
|
|
231
|
+
export function resolveGlobalSecurity(
|
|
232
|
+
security: Partial<components.Security> | null | undefined,
|
|
233
|
+
): SecurityState | null {
|
|
234
|
+
return resolveSecurity(
|
|
235
|
+
[
|
|
236
|
+
{
|
|
237
|
+
fieldName: "Authorization",
|
|
238
|
+
type: "oauth2",
|
|
239
|
+
value: security?.clientCredentials
|
|
240
|
+
?? env().FINANCEABLE_CLIENT_CREDENTIALS,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export async function extractSecurity<
|
|
247
|
+
T extends string | Record<string, unknown>,
|
|
248
|
+
>(sec: T | (() => Promise<T>) | undefined): Promise<T | undefined> {
|
|
249
|
+
if (sec == null) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return typeof sec === "function" ? sec() : sec;
|
|
254
|
+
}
|
|
@@ -3,29 +3,20 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import * as z from "zod";
|
|
6
|
-
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
6
|
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
-
import { ClosedEnum } from "../../types/enums.js";
|
|
9
7
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
8
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
import {
|
|
10
|
+
CustomerIDType,
|
|
11
|
+
CustomerIDType$inboundSchema,
|
|
12
|
+
CustomerIDType$outboundSchema,
|
|
13
|
+
} from "./customeridtype.js";
|
|
11
14
|
import {
|
|
12
15
|
CustomerTitle,
|
|
13
16
|
CustomerTitle$inboundSchema,
|
|
14
17
|
CustomerTitle$outboundSchema,
|
|
15
18
|
} from "./customertitle.js";
|
|
16
19
|
|
|
17
|
-
/**
|
|
18
|
-
* Type of ID, either drivers' license or passport
|
|
19
|
-
*/
|
|
20
|
-
export const IDType = {
|
|
21
|
-
Licence: "licence",
|
|
22
|
-
Passport: "passport",
|
|
23
|
-
} as const;
|
|
24
|
-
/**
|
|
25
|
-
* Type of ID, either drivers' license or passport
|
|
26
|
-
*/
|
|
27
|
-
export type IDType = ClosedEnum<typeof IDType>;
|
|
28
|
-
|
|
29
20
|
/**
|
|
30
21
|
* A customer of the proposed financing
|
|
31
22
|
*/
|
|
@@ -57,32 +48,13 @@ export type CustomerAttributes = {
|
|
|
57
48
|
/**
|
|
58
49
|
* Type of ID, either drivers' license or passport
|
|
59
50
|
*/
|
|
60
|
-
idType?:
|
|
51
|
+
idType?: CustomerIDType | undefined;
|
|
61
52
|
/**
|
|
62
53
|
* Number of the ID
|
|
63
54
|
*/
|
|
64
55
|
idNumber?: string | undefined;
|
|
65
56
|
};
|
|
66
57
|
|
|
67
|
-
/** @internal */
|
|
68
|
-
export const IDType$inboundSchema: z.ZodNativeEnum<typeof IDType> = z
|
|
69
|
-
.nativeEnum(IDType);
|
|
70
|
-
|
|
71
|
-
/** @internal */
|
|
72
|
-
export const IDType$outboundSchema: z.ZodNativeEnum<typeof IDType> =
|
|
73
|
-
IDType$inboundSchema;
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* @internal
|
|
77
|
-
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
78
|
-
*/
|
|
79
|
-
export namespace IDType$ {
|
|
80
|
-
/** @deprecated use `IDType$inboundSchema` instead. */
|
|
81
|
-
export const inboundSchema = IDType$inboundSchema;
|
|
82
|
-
/** @deprecated use `IDType$outboundSchema` instead. */
|
|
83
|
-
export const outboundSchema = IDType$outboundSchema;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
58
|
/** @internal */
|
|
87
59
|
export const CustomerAttributes$inboundSchema: z.ZodType<
|
|
88
60
|
CustomerAttributes,
|
|
@@ -94,15 +66,9 @@ export const CustomerAttributes$inboundSchema: z.ZodType<
|
|
|
94
66
|
middleNames: z.string().optional(),
|
|
95
67
|
lastName: z.string(),
|
|
96
68
|
dateOfBirth: z.string(),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}).transform((v) => {
|
|
101
|
-
return remap$(v, {
|
|
102
|
-
"IDExpiryDate": "idExpiryDate",
|
|
103
|
-
"IDType": "idType",
|
|
104
|
-
"IDNumber": "idNumber",
|
|
105
|
-
});
|
|
69
|
+
idExpiryDate: z.string(),
|
|
70
|
+
idType: CustomerIDType$inboundSchema.optional(),
|
|
71
|
+
idNumber: z.string().optional(),
|
|
106
72
|
});
|
|
107
73
|
|
|
108
74
|
/** @internal */
|
|
@@ -112,9 +78,9 @@ export type CustomerAttributes$Outbound = {
|
|
|
112
78
|
middleNames?: string | undefined;
|
|
113
79
|
lastName: string;
|
|
114
80
|
dateOfBirth: string;
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
81
|
+
idExpiryDate: string;
|
|
82
|
+
idType?: string | undefined;
|
|
83
|
+
idNumber?: string | undefined;
|
|
118
84
|
};
|
|
119
85
|
|
|
120
86
|
/** @internal */
|
|
@@ -129,14 +95,8 @@ export const CustomerAttributes$outboundSchema: z.ZodType<
|
|
|
129
95
|
lastName: z.string(),
|
|
130
96
|
dateOfBirth: z.string(),
|
|
131
97
|
idExpiryDate: z.string(),
|
|
132
|
-
idType:
|
|
98
|
+
idType: CustomerIDType$outboundSchema.optional(),
|
|
133
99
|
idNumber: z.string().optional(),
|
|
134
|
-
}).transform((v) => {
|
|
135
|
-
return remap$(v, {
|
|
136
|
-
idExpiryDate: "IDExpiryDate",
|
|
137
|
-
idType: "IDType",
|
|
138
|
-
idNumber: "IDNumber",
|
|
139
|
-
});
|
|
140
100
|
});
|
|
141
101
|
|
|
142
102
|
/**
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
export const CustomerIDType = {
|
|
9
|
+
Passport: "passport",
|
|
10
|
+
Licence: "licence",
|
|
11
|
+
} as const;
|
|
12
|
+
export type CustomerIDType = ClosedEnum<typeof CustomerIDType>;
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export const CustomerIDType$inboundSchema: z.ZodNativeEnum<
|
|
16
|
+
typeof CustomerIDType
|
|
17
|
+
> = z.nativeEnum(CustomerIDType);
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const CustomerIDType$outboundSchema: z.ZodNativeEnum<
|
|
21
|
+
typeof CustomerIDType
|
|
22
|
+
> = CustomerIDType$inboundSchema;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
27
|
+
*/
|
|
28
|
+
export namespace CustomerIDType$ {
|
|
29
|
+
/** @deprecated use `CustomerIDType$inboundSchema` instead. */
|
|
30
|
+
export const inboundSchema = CustomerIDType$inboundSchema;
|
|
31
|
+
/** @deprecated use `CustomerIDType$outboundSchema` instead. */
|
|
32
|
+
export const outboundSchema = CustomerIDType$outboundSchema;
|
|
33
|
+
}
|
|
@@ -11,6 +11,7 @@ export * from "./applicationstatus.js";
|
|
|
11
11
|
export * from "./applicationtype.js";
|
|
12
12
|
export * from "./assetattributes.js";
|
|
13
13
|
export * from "./customerattributes.js";
|
|
14
|
+
export * from "./customeridtype.js";
|
|
14
15
|
export * from "./customertitle.js";
|
|
15
16
|
export * from "./errorsource.js";
|
|
16
17
|
export * from "./forbiddenerror.js";
|
|
@@ -18,3 +19,6 @@ export * from "./frequencytype.js";
|
|
|
18
19
|
export * from "./links.js";
|
|
19
20
|
export * from "./loandetailsattributes.js";
|
|
20
21
|
export * from "./repaymentstructure.js";
|
|
22
|
+
export * from "./security.js";
|
|
23
|
+
export * from "./tokenrequest.js";
|
|
24
|
+
export * from "./tokenresponse.js";
|