@financeable/aggregation 0.2.5 → 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 -119
- package/README.md +73 -472
- package/docs/sdks/applications/README.md +18 -6
- 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/index.d.ts +3 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +3 -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/index.ts +3 -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
package/sdk/sdk.d.ts
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
-
import { ClientSDK } from "../lib/sdks.js";
|
|
1
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
2
|
+
import * as components from "../models/components/index.js";
|
|
2
3
|
import { Applications } from "./applications.js";
|
|
3
4
|
export declare class Financeable extends ClientSDK {
|
|
4
5
|
private _applications?;
|
|
5
6
|
get applications(): Applications;
|
|
7
|
+
/**
|
|
8
|
+
* Obtain an OAuth client_credentials token
|
|
9
|
+
*/
|
|
10
|
+
getToken(request: components.TokenRequest, options?: RequestOptions): Promise<components.TokenResponse>;
|
|
6
11
|
}
|
|
7
12
|
//# sourceMappingURL=sdk.d.ts.map
|
package/sdk/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk/sdk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../src/sdk/sdk.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,qBAAa,WAAY,SAAQ,SAAS;IACxC,OAAO,CAAC,aAAa,CAAC,CAAe;IACrC,IAAI,YAAY,IAAI,YAAY,CAE/B;IAED;;OAEG;IACG,QAAQ,CACZ,OAAO,EAAE,UAAU,CAAC,YAAY,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,UAAU,CAAC,aAAa,CAAC;CAOrC"}
|
package/sdk/sdk.js
CHANGED
|
@@ -4,12 +4,20 @@
|
|
|
4
4
|
*/
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Financeable = void 0;
|
|
7
|
+
const getToken_js_1 = require("../funcs/getToken.js");
|
|
7
8
|
const sdks_js_1 = require("../lib/sdks.js");
|
|
9
|
+
const fp_js_1 = require("../types/fp.js");
|
|
8
10
|
const applications_js_1 = require("./applications.js");
|
|
9
11
|
class Financeable extends sdks_js_1.ClientSDK {
|
|
10
12
|
get applications() {
|
|
11
13
|
return (this._applications ?? (this._applications = new applications_js_1.Applications(this._options)));
|
|
12
14
|
}
|
|
15
|
+
/**
|
|
16
|
+
* Obtain an OAuth client_credentials token
|
|
17
|
+
*/
|
|
18
|
+
async getToken(request, options) {
|
|
19
|
+
return (0, fp_js_1.unwrapAsync)((0, getToken_js_1.getToken)(this, request, options));
|
|
20
|
+
}
|
|
13
21
|
}
|
|
14
22
|
exports.Financeable = Financeable;
|
|
15
23
|
//# sourceMappingURL=sdk.js.map
|
package/sdk/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk/sdk.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../src/sdk/sdk.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,sDAAgD;AAChD,4CAA2D;AAE3D,0CAA6C;AAC7C,uDAAiD;AAEjD,MAAa,WAAY,SAAQ,mBAAS;IAExC,IAAI,YAAY;QACd,OAAO,CAAC,IAAI,CAAC,aAAa,KAAlB,IAAI,CAAC,aAAa,GAAK,IAAI,8BAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAC,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CACZ,OAAgC,EAChC,OAAwB;QAExB,OAAO,IAAA,mBAAW,EAAC,IAAA,sBAAQ,EACzB,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF;AAnBD,kCAmBC"}
|
|
@@ -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 * as components from "../models/components/index.js";
|
|
13
14
|
import { APIError } from "../models/errors/apierror.js";
|
|
@@ -21,16 +22,17 @@ import {
|
|
|
21
22
|
import * as errors from "../models/errors/index.js";
|
|
22
23
|
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
23
24
|
import * as operations from "../models/operations/index.js";
|
|
25
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
24
26
|
import { Result } from "../types/fp.js";
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Create an application in the Financeable platform.
|
|
28
30
|
*/
|
|
29
|
-
export
|
|
31
|
+
export function applicationsCreate(
|
|
30
32
|
client: FinanceableCore,
|
|
31
33
|
request: components.ApplicationResourceBulkSubmission,
|
|
32
34
|
options?: RequestOptions,
|
|
33
|
-
):
|
|
35
|
+
): APIPromise<
|
|
34
36
|
Result<
|
|
35
37
|
operations.CreateApplicationResponseBody,
|
|
36
38
|
| errors.CreateApplicationResponseBody
|
|
@@ -42,6 +44,33 @@ export async function applicationsCreate(
|
|
|
42
44
|
| RequestTimeoutError
|
|
43
45
|
| ConnectionError
|
|
44
46
|
>
|
|
47
|
+
> {
|
|
48
|
+
return new APIPromise($do(
|
|
49
|
+
client,
|
|
50
|
+
request,
|
|
51
|
+
options,
|
|
52
|
+
));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function $do(
|
|
56
|
+
client: FinanceableCore,
|
|
57
|
+
request: components.ApplicationResourceBulkSubmission,
|
|
58
|
+
options?: RequestOptions,
|
|
59
|
+
): Promise<
|
|
60
|
+
[
|
|
61
|
+
Result<
|
|
62
|
+
operations.CreateApplicationResponseBody,
|
|
63
|
+
| errors.CreateApplicationResponseBody
|
|
64
|
+
| APIError
|
|
65
|
+
| SDKValidationError
|
|
66
|
+
| UnexpectedClientError
|
|
67
|
+
| InvalidRequestError
|
|
68
|
+
| RequestAbortedError
|
|
69
|
+
| RequestTimeoutError
|
|
70
|
+
| ConnectionError
|
|
71
|
+
>,
|
|
72
|
+
APICall,
|
|
73
|
+
]
|
|
45
74
|
> {
|
|
46
75
|
const parsed = safeParse(
|
|
47
76
|
request,
|
|
@@ -50,7 +79,7 @@ export async function applicationsCreate(
|
|
|
50
79
|
"Input validation failed",
|
|
51
80
|
);
|
|
52
81
|
if (!parsed.ok) {
|
|
53
|
-
return parsed;
|
|
82
|
+
return [parsed, { status: "invalid" }];
|
|
54
83
|
}
|
|
55
84
|
const payload = parsed.value;
|
|
56
85
|
const body = encodeJSON("body", payload, { explode: true });
|
|
@@ -62,14 +91,20 @@ export async function applicationsCreate(
|
|
|
62
91
|
Accept: "application/json",
|
|
63
92
|
}));
|
|
64
93
|
|
|
94
|
+
const secConfig = await extractSecurity(client._options.clientCredentials);
|
|
95
|
+
const securityInput = secConfig == null
|
|
96
|
+
? {}
|
|
97
|
+
: { clientCredentials: secConfig };
|
|
98
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
99
|
+
|
|
65
100
|
const context = {
|
|
66
101
|
baseURL: options?.serverURL ?? "",
|
|
67
102
|
operationID: "createApplication",
|
|
68
103
|
oAuth2Scopes: [],
|
|
69
104
|
|
|
70
|
-
resolvedSecurity:
|
|
105
|
+
resolvedSecurity: requestSecurity,
|
|
71
106
|
|
|
72
|
-
securitySource:
|
|
107
|
+
securitySource: client._options.clientCredentials,
|
|
73
108
|
retryConfig: options?.retries
|
|
74
109
|
|| client._options.retryConfig
|
|
75
110
|
|| { strategy: "none" },
|
|
@@ -77,6 +112,7 @@ export async function applicationsCreate(
|
|
|
77
112
|
};
|
|
78
113
|
|
|
79
114
|
const requestRes = client._createRequest(context, {
|
|
115
|
+
security: requestSecurity,
|
|
80
116
|
method: "POST",
|
|
81
117
|
baseURL: options?.serverURL,
|
|
82
118
|
path: path,
|
|
@@ -85,7 +121,7 @@ export async function applicationsCreate(
|
|
|
85
121
|
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
86
122
|
}, options);
|
|
87
123
|
if (!requestRes.ok) {
|
|
88
|
-
return requestRes;
|
|
124
|
+
return [requestRes, { status: "invalid" }];
|
|
89
125
|
}
|
|
90
126
|
const req = requestRes.value;
|
|
91
127
|
|
|
@@ -96,7 +132,7 @@ export async function applicationsCreate(
|
|
|
96
132
|
retryCodes: context.retryCodes,
|
|
97
133
|
});
|
|
98
134
|
if (!doResult.ok) {
|
|
99
|
-
return doResult;
|
|
135
|
+
return [doResult, { status: "request-error", request: req }];
|
|
100
136
|
}
|
|
101
137
|
const response = doResult.value;
|
|
102
138
|
|
|
@@ -121,8 +157,8 @@ export async function applicationsCreate(
|
|
|
121
157
|
M.fail("5XX"),
|
|
122
158
|
)(response, { extraFields: responseFields });
|
|
123
159
|
if (!result.ok) {
|
|
124
|
-
return result;
|
|
160
|
+
return [result, { status: "complete", request: req, response }];
|
|
125
161
|
}
|
|
126
162
|
|
|
127
|
-
return result;
|
|
163
|
+
return [result, { status: "complete", request: req, response }];
|
|
128
164
|
}
|
|
@@ -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: "
|
|
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
|
+
}
|
|
@@ -19,3 +19,6 @@ export * from "./frequencytype.js";
|
|
|
19
19
|
export * from "./links.js";
|
|
20
20
|
export * from "./loandetailsattributes.js";
|
|
21
21
|
export * from "./repaymentstructure.js";
|
|
22
|
+
export * from "./security.js";
|
|
23
|
+
export * from "./tokenrequest.js";
|
|
24
|
+
export * from "./tokenresponse.js";
|