@temboplus/afloat 0.1.13 → 0.1.30
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/esm/src/features/auth/access/contract.d.ts +14 -0
- package/esm/src/features/auth/access/contract.d.ts.map +1 -0
- package/esm/src/features/auth/access/contract.js +14 -0
- package/esm/src/features/auth/contract.d.ts +20 -20
- package/esm/src/features/auth/contract.js +2 -2
- package/esm/src/features/auth/identity/contract.d.ts +0 -7
- package/esm/src/features/auth/identity/contract.d.ts.map +1 -1
- package/esm/src/features/auth/identity/contract.js +0 -1
- package/esm/src/features/auth/identity/repository.d.ts +2 -2
- package/esm/src/features/auth/identity/repository.d.ts.map +1 -1
- package/esm/src/features/auth/identity/repository.js +5 -5
- package/esm/src/features/auth/manager.js +1 -1
- package/esm/src/features/auth/profile/contract.d.ts +17 -25
- package/esm/src/features/auth/profile/contract.d.ts.map +1 -1
- package/esm/src/features/auth/profile/contract.js +2 -4
- package/esm/src/features/auth/repository.d.ts +0 -1
- package/esm/src/features/auth/repository.d.ts.map +1 -1
- package/esm/src/features/auth/repository.js +3 -11
- package/esm/src/features/auth/storage/server_token_handler.d.ts +7 -6
- package/esm/src/features/auth/storage/server_token_handler.d.ts.map +1 -1
- package/esm/src/features/auth/storage/server_token_handler.js +73 -26
- package/esm/src/features/contact/contract.d.ts +10 -10
- package/esm/src/features/payout/contract.d.ts +12 -12
- package/esm/src/features/wallet/repository.d.ts +1 -28
- package/esm/src/features/wallet/repository.d.ts.map +1 -1
- package/esm/src/features/wallet/repository.js +0 -51
- package/esm/src/models/contact/derivatives/contact.js +2 -2
- package/esm/src/models/contact/derivatives/contact_info.d.ts +8 -8
- package/esm/src/models/contact/derivatives/contact_info.d.ts.map +1 -1
- package/esm/src/models/contact/derivatives/contact_info.js +12 -12
- package/esm/src/models/payout/channel.d.ts +4 -4
- package/esm/src/models/payout/channel.d.ts.map +1 -1
- package/esm/src/models/payout/channel.js +2 -2
- package/esm/src/models/payout/derivatives/payout.d.ts.map +1 -1
- package/esm/src/models/payout/derivatives/payout.js +2 -2
- package/esm/src/models/user/profile.d.ts +135 -12
- package/esm/src/models/user/profile.d.ts.map +1 -1
- package/esm/src/models/user/profile.js +318 -12
- package/esm/src/models/user/user.d.ts +14 -17
- package/esm/src/models/user/user.d.ts.map +1 -1
- package/esm/src/models/user/user.js +109 -26
- package/esm/src/models/wallet/index.d.ts +0 -1
- package/esm/src/models/wallet/index.d.ts.map +1 -1
- package/esm/src/models/wallet/index.js +0 -1
- package/esm/src/shared/token_required_repository.d.ts +78 -0
- package/esm/src/shared/token_required_repository.d.ts.map +1 -0
- package/esm/src/shared/token_required_repository.js +128 -0
- package/package.json +7 -7
- package/script/src/features/auth/access/contract.d.ts +14 -0
- package/script/src/features/auth/access/contract.d.ts.map +1 -0
- package/script/src/features/auth/access/contract.js +17 -0
- package/script/src/features/auth/contract.d.ts +20 -20
- package/script/src/features/auth/contract.js +1 -1
- package/script/src/features/auth/identity/contract.d.ts +0 -7
- package/script/src/features/auth/identity/contract.d.ts.map +1 -1
- package/script/src/features/auth/identity/contract.js +0 -1
- package/script/src/features/auth/identity/repository.d.ts +2 -2
- package/script/src/features/auth/identity/repository.d.ts.map +1 -1
- package/script/src/features/auth/identity/repository.js +5 -5
- package/script/src/features/auth/manager.js +1 -1
- package/script/src/features/auth/profile/contract.d.ts +17 -25
- package/script/src/features/auth/profile/contract.d.ts.map +1 -1
- package/script/src/features/auth/profile/contract.js +1 -3
- package/script/src/features/auth/repository.d.ts +0 -1
- package/script/src/features/auth/repository.d.ts.map +1 -1
- package/script/src/features/auth/repository.js +3 -11
- package/script/src/features/auth/storage/server_token_handler.d.ts +7 -6
- package/script/src/features/auth/storage/server_token_handler.d.ts.map +1 -1
- package/script/src/features/auth/storage/server_token_handler.js +72 -25
- package/script/src/features/contact/contract.d.ts +10 -10
- package/script/src/features/payout/contract.d.ts +12 -12
- package/script/src/features/wallet/repository.d.ts +1 -28
- package/script/src/features/wallet/repository.d.ts.map +1 -1
- package/script/src/features/wallet/repository.js +0 -51
- package/script/src/models/contact/derivatives/contact.js +1 -1
- package/script/src/models/contact/derivatives/contact_info.d.ts +8 -8
- package/script/src/models/contact/derivatives/contact_info.d.ts.map +1 -1
- package/script/src/models/contact/derivatives/contact_info.js +11 -11
- package/script/src/models/payout/channel.d.ts +4 -4
- package/script/src/models/payout/channel.d.ts.map +1 -1
- package/script/src/models/payout/channel.js +2 -2
- package/script/src/models/payout/derivatives/payout.d.ts.map +1 -1
- package/script/src/models/payout/derivatives/payout.js +1 -1
- package/script/src/models/user/profile.d.ts +135 -12
- package/script/src/models/user/profile.d.ts.map +1 -1
- package/script/src/models/user/profile.js +320 -13
- package/script/src/models/user/user.d.ts +14 -17
- package/script/src/models/user/user.d.ts.map +1 -1
- package/script/src/models/user/user.js +109 -26
- package/script/src/models/wallet/index.d.ts +0 -1
- package/script/src/models/wallet/index.d.ts.map +1 -1
- package/script/src/models/wallet/index.js +0 -1
- package/script/src/shared/token_required_repository.d.ts +78 -0
- package/script/src/shared/token_required_repository.d.ts.map +1 -0
- package/script/src/shared/token_required_repository.js +132 -0
- package/esm/src/features/auth/profile/repository.d.ts +0 -11
- package/esm/src/features/auth/profile/repository.d.ts.map +0 -1
- package/esm/src/features/auth/profile/repository.js +0 -21
- package/esm/src/features/files-gen/contract.d.ts +0 -67
- package/esm/src/features/files-gen/contract.d.ts.map +0 -1
- package/esm/src/features/files-gen/contract.js +0 -40
- package/esm/src/features/files-gen/repository.d.ts +0 -50
- package/esm/src/features/files-gen/repository.d.ts.map +0 -1
- package/esm/src/features/files-gen/repository.js +0 -56
- package/esm/src/models/wallet/statement.d.ts +0 -27
- package/esm/src/models/wallet/statement.d.ts.map +0 -1
- package/esm/src/models/wallet/statement.js +0 -13
- package/script/src/features/auth/profile/repository.d.ts +0 -11
- package/script/src/features/auth/profile/repository.d.ts.map +0 -1
- package/script/src/features/auth/profile/repository.js +0 -25
- package/script/src/features/files-gen/contract.d.ts +0 -67
- package/script/src/features/files-gen/contract.d.ts.map +0 -1
- package/script/src/features/files-gen/contract.js +0 -43
- package/script/src/features/files-gen/repository.d.ts +0 -50
- package/script/src/features/files-gen/repository.d.ts.map +0 -1
- package/script/src/features/files-gen/repository.js +0 -60
- package/script/src/models/wallet/statement.d.ts +0 -27
- package/script/src/models/wallet/statement.d.ts.map +0 -1
- package/script/src/models/wallet/statement.js +0 -16
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.User = void 0;
|
|
4
|
+
// deno-lint-ignore-file no-explicit-any
|
|
4
5
|
const permission_js_1 = require("../permission.js");
|
|
6
|
+
const profile_js_1 = require("./profile.js");
|
|
5
7
|
/**
|
|
6
|
-
* Represents a user in Afloat
|
|
8
|
+
* Represents a user in Afloat.
|
|
7
9
|
*
|
|
8
10
|
* This class centralizes user-related logic, simplifying interaction
|
|
9
11
|
* with user-related data and ensuring consistent permission checks across the application.
|
|
@@ -12,7 +14,7 @@ class User {
|
|
|
12
14
|
/**
|
|
13
15
|
* Creates a new instance of the `User` class.
|
|
14
16
|
*
|
|
15
|
-
* @param userData - An object
|
|
17
|
+
* @param userData - An object containing the user's profile, token,
|
|
16
18
|
* permissions (access list), and the `resetPassword` flag.
|
|
17
19
|
*/
|
|
18
20
|
constructor(data) {
|
|
@@ -75,12 +77,12 @@ class User {
|
|
|
75
77
|
writable: true,
|
|
76
78
|
value: void 0
|
|
77
79
|
});
|
|
78
|
-
const { profile, token, access, resetPassword } = data;
|
|
80
|
+
const { profile, token, access, resetPassword, name, identity } = data;
|
|
79
81
|
this.profile = profile;
|
|
80
82
|
this.token = token;
|
|
81
83
|
this.resetPassword = resetPassword;
|
|
82
|
-
this.name =
|
|
83
|
-
this.identity =
|
|
84
|
+
this.name = name;
|
|
85
|
+
this.identity = identity;
|
|
84
86
|
// Initialize the permissions map
|
|
85
87
|
this.permissionsMap = {};
|
|
86
88
|
for (const permission of Object.values(permission_js_1.Permissions)) {
|
|
@@ -89,6 +91,9 @@ class User {
|
|
|
89
91
|
this.permissionsMap[perm] = access.includes(perm);
|
|
90
92
|
});
|
|
91
93
|
}
|
|
94
|
+
else {
|
|
95
|
+
this.permissionsMap[permission] = access.includes(permission);
|
|
96
|
+
}
|
|
92
97
|
}
|
|
93
98
|
}
|
|
94
99
|
/**
|
|
@@ -104,14 +109,14 @@ class User {
|
|
|
104
109
|
* Serializes the `User` instance to a JSON string.
|
|
105
110
|
*
|
|
106
111
|
* @returns A JSON string representation of the `User` instance, including:
|
|
107
|
-
* - `profile`: The user's profile information.
|
|
112
|
+
* - `profile`: The user's profile information. (Requires profile.toJSON() method)
|
|
108
113
|
* - `token`: The user's authentication token.
|
|
109
114
|
* - `resetPassword`: Indicates whether the user must reset their password.
|
|
110
115
|
* - `permissions`: An array of permission keys the user has.
|
|
111
116
|
*/
|
|
112
117
|
toJSON() {
|
|
113
118
|
return JSON.stringify({
|
|
114
|
-
profile: this.profile,
|
|
119
|
+
profile: this.profile.toObject(),
|
|
115
120
|
token: this.token,
|
|
116
121
|
resetPassword: this.resetPassword,
|
|
117
122
|
name: this.name,
|
|
@@ -123,29 +128,107 @@ class User {
|
|
|
123
128
|
* Creates a new `User` instance from a JSON string.
|
|
124
129
|
*
|
|
125
130
|
* @param jsonString - A JSON string containing user data.
|
|
126
|
-
* @returns A `User` instance reconstructed from the JSON data.
|
|
127
|
-
* @throws Will throw an error if the JSON data is invalid or incomplete.
|
|
131
|
+
* @returns A `User` instance reconstructed from the JSON data, or undefined if jsonString is invalid.
|
|
128
132
|
*/
|
|
129
133
|
static fromJSON(jsonString) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
134
|
+
try {
|
|
135
|
+
return User.from(JSON.parse(jsonString));
|
|
136
|
+
}
|
|
137
|
+
catch (e) {
|
|
138
|
+
console.error("Invalid JSON string:", e);
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Creates a new `User` instance from a data object, JSON string, or object with a Profile instance/object.
|
|
144
|
+
*
|
|
145
|
+
* @param data - The data object, JSON string, or object with Profile instance/object containing user information.
|
|
146
|
+
* @returns A `User` instance, or undefined if data is invalid.
|
|
147
|
+
*/
|
|
148
|
+
static from(data) {
|
|
149
|
+
let parsedData;
|
|
150
|
+
// Parse JSON string if needed
|
|
151
|
+
if (typeof data === "string") {
|
|
152
|
+
try {
|
|
153
|
+
parsedData = JSON.parse(data);
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
console.error("Invalid JSON string:", error);
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
parsedData = data;
|
|
162
|
+
}
|
|
163
|
+
if (!parsedData) {
|
|
164
|
+
console.error("Data is null or undefined.");
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
// Handle different profile formats
|
|
168
|
+
let profile;
|
|
169
|
+
let rawProfile = parsedData.profile;
|
|
170
|
+
// Handle stringified profile (the case in the provided sample)
|
|
171
|
+
if (typeof rawProfile === "string") {
|
|
172
|
+
try {
|
|
173
|
+
// Attempt to parse the stringified profile
|
|
174
|
+
rawProfile = JSON.parse(rawProfile);
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
console.error("Failed to parse profile JSON string:", error);
|
|
178
|
+
return undefined;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
// Create Profile instance based on what we received
|
|
182
|
+
if (profile_js_1.Profile.is(rawProfile)) {
|
|
183
|
+
// Already a Profile instance
|
|
184
|
+
profile = rawProfile;
|
|
185
|
+
}
|
|
186
|
+
else if (typeof rawProfile === "object" && rawProfile !== null) {
|
|
187
|
+
// Convert object to Profile instance
|
|
188
|
+
profile = profile_js_1.Profile.from(rawProfile);
|
|
189
|
+
if (!profile) {
|
|
190
|
+
console.error("Failed to create Profile from data:", rawProfile);
|
|
191
|
+
return undefined;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
else if (typeof rawProfile === "string") {
|
|
195
|
+
profile = profile_js_1.Profile.fromJSON(rawProfile);
|
|
196
|
+
if (!profile) {
|
|
197
|
+
console.error("Failed to create Profile from JSON data:", rawProfile);
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
console.error("Invalid profile format:", typeof rawProfile);
|
|
203
|
+
return undefined;
|
|
204
|
+
}
|
|
205
|
+
// Validate other required fields
|
|
206
|
+
if (!parsedData.token || typeof parsedData.token !== "string" ||
|
|
207
|
+
!parsedData.name || typeof parsedData.name !== "string" ||
|
|
208
|
+
!parsedData.identity || typeof parsedData.identity !== "string" ||
|
|
209
|
+
!Array.isArray(parsedData.permissions) &&
|
|
210
|
+
!Array.isArray(parsedData.access) ||
|
|
211
|
+
typeof parsedData.resetPassword !== "boolean") {
|
|
212
|
+
console.error("Missing or invalid required User fields:", {
|
|
213
|
+
token: typeof parsedData.token,
|
|
214
|
+
name: typeof parsedData.name,
|
|
215
|
+
identity: typeof parsedData.identity,
|
|
216
|
+
permissions: Array.isArray(parsedData.permissions),
|
|
217
|
+
access: Array.isArray(parsedData.access),
|
|
218
|
+
resetPassword: typeof parsedData.resetPassword,
|
|
219
|
+
});
|
|
220
|
+
return undefined;
|
|
138
221
|
}
|
|
139
|
-
//
|
|
222
|
+
// Support both 'permissions' and 'access' field names
|
|
223
|
+
const access = parsedData.access || parsedData.permissions;
|
|
224
|
+
// Create and return the User instance
|
|
140
225
|
const args = {
|
|
141
|
-
profile:
|
|
142
|
-
token:
|
|
143
|
-
access:
|
|
144
|
-
resetPassword:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
identity: data.identity,
|
|
148
|
-
},
|
|
226
|
+
profile: profile,
|
|
227
|
+
token: parsedData.token,
|
|
228
|
+
access: access,
|
|
229
|
+
resetPassword: parsedData.resetPassword,
|
|
230
|
+
name: parsedData.name,
|
|
231
|
+
identity: parsedData.identity,
|
|
149
232
|
};
|
|
150
233
|
return new User(args);
|
|
151
234
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/models/wallet/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC"}
|
|
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./guards.js"), exports);
|
|
18
18
|
__exportStar(require("./schemas.js"), exports);
|
|
19
|
-
__exportStar(require("./statement.js"), exports);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { type AppRouter } from "@ts-rest/core";
|
|
2
|
+
import type { InitClientArgs } from "@ts-rest/core";
|
|
3
|
+
/**
|
|
4
|
+
* TokenRequiredRepository
|
|
5
|
+
*
|
|
6
|
+
* A generic base class to build repositories for interacting with the API,
|
|
7
|
+
* without any dependency on AfloatAuth. Instead, it requires token to be
|
|
8
|
+
* explicitly provided when initializing the repository.
|
|
9
|
+
*
|
|
10
|
+
* @template TContract - The API contract extending `AppRouter` from `@ts-rest/core`.
|
|
11
|
+
*/
|
|
12
|
+
export declare class TokenRequiredRepository<TContract extends AppRouter> {
|
|
13
|
+
/**
|
|
14
|
+
* A "ts-rest" contract
|
|
15
|
+
*
|
|
16
|
+
* @protected
|
|
17
|
+
*/
|
|
18
|
+
protected contract: TContract;
|
|
19
|
+
/**
|
|
20
|
+
* An API endpoint
|
|
21
|
+
*
|
|
22
|
+
* @protected
|
|
23
|
+
*/
|
|
24
|
+
protected endpoint: string;
|
|
25
|
+
/**
|
|
26
|
+
* An API Root URL
|
|
27
|
+
*
|
|
28
|
+
* @protected
|
|
29
|
+
*/
|
|
30
|
+
protected root: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Authentication token
|
|
33
|
+
*
|
|
34
|
+
* @protected
|
|
35
|
+
*/
|
|
36
|
+
protected token: string;
|
|
37
|
+
/**
|
|
38
|
+
* Constructs a new instance of `TokenRequiredRepository`.
|
|
39
|
+
*
|
|
40
|
+
* @param endpoint - API endpoint
|
|
41
|
+
* @param contract - The "ts-rest" contract
|
|
42
|
+
* @param token - Authentication token (required)
|
|
43
|
+
* @param root - Optional API root URL
|
|
44
|
+
*/
|
|
45
|
+
constructor(endpoint: string, contract: TContract, token: string, root?: string);
|
|
46
|
+
/**
|
|
47
|
+
* Gets the initialized client for making API requests.
|
|
48
|
+
* Uses the provided authentication token.
|
|
49
|
+
*/
|
|
50
|
+
get client(): { [TKey in keyof TContract]: TContract[TKey] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey], InitClientArgs>> : TContract[TKey] extends AppRouter ? TContract[TKey] extends infer T extends AppRouter ? { [TKey_1 in keyof T]: TContract[TKey][TKey_1] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1], InitClientArgs>> : TContract[TKey][TKey_1] extends AppRouter ? TContract[TKey][TKey_1] extends infer T_1 extends AppRouter ? { [TKey_2 in keyof T_1]: TContract[TKey][TKey_1][TKey_2] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2] extends AppRouter ? TContract[TKey][TKey_1][TKey_2] extends infer T_2 extends AppRouter ? { [TKey_3 in keyof T_2]: TContract[TKey][TKey_1][TKey_2][TKey_3] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3] extends infer T_3 extends AppRouter ? { [TKey_4 in keyof T_3]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4] extends infer T_4 extends AppRouter ? { [TKey_5 in keyof T_4]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5] extends infer T_5 extends AppRouter ? { [TKey_6 in keyof T_5]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6] extends infer T_6 extends AppRouter ? { [TKey_7 in keyof T_6]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7] extends infer T_7 extends AppRouter ? { [TKey_8 in keyof T_7]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8] extends infer T_8 extends AppRouter ? { [TKey_9 in keyof T_8]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends AppRouter ? TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9] extends infer T_9 extends AppRouter ? { [TKey_10 in keyof T_9]: TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10] extends import("@ts-rest/core").AppRoute ? import("@ts-rest/core").AppRouteFunction<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10], InitClientArgs, import("@ts-rest/core").PartialClientInferRequest<TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10], InitClientArgs>> : TContract[TKey][TKey_1][TKey_2][TKey_3][TKey_4][TKey_5][TKey_6][TKey_7][TKey_8][TKey_9][TKey_10] extends AppRouter ? any : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; } : never : never; };
|
|
51
|
+
/**
|
|
52
|
+
* Updates the token used by this repository
|
|
53
|
+
*
|
|
54
|
+
* @param token - New authentication token
|
|
55
|
+
*/
|
|
56
|
+
setToken(token: string): void;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the current token
|
|
59
|
+
*
|
|
60
|
+
* @returns The current authentication token
|
|
61
|
+
*/
|
|
62
|
+
getToken(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Handles the API response by checking the HTTP status code and returning the response body
|
|
65
|
+
* for successful requests or throwing an `APIError` for errors.
|
|
66
|
+
*
|
|
67
|
+
* @template T - The expected type of the successful response body.
|
|
68
|
+
* @param result - The API response object containing the status code and response body.
|
|
69
|
+
* @param successStatusCode - The expected HTTP status code indicating success (e.g., 200, 201).
|
|
70
|
+
* @returns The response body typed as `T` if the status code matches the success criteria.
|
|
71
|
+
* @throws `APIError` - If the status code indicates a failure.
|
|
72
|
+
*/
|
|
73
|
+
handleResponse<T>(result: {
|
|
74
|
+
status: number;
|
|
75
|
+
body: unknown;
|
|
76
|
+
}, successStatusCode: number): T;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=token_required_repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token_required_repository.d.ts","sourceRoot":"","sources":["../../../src/src/shared/token_required_repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAc,MAAM,eAAe,CAAC;AAG3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAGpD;;;;;;;;GAQG;AACH,qBAAa,uBAAuB,CAAC,SAAS,SAAS,SAAS;IAC9D;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC;IAE9B;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC;;;;OAIG;IACH,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;gBAED,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,SAAS,EACnB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE,MAAM;IAQf;;;OAGG;IACH,IAAI,MAAM,k0LAcT;IAED;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAI7B;;;;OAIG;IACH,QAAQ,IAAI,MAAM;IAIlB;;;;;;;;;OASG;IACH,cAAc,CAAC,CAAC,EACd,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,EACzC,iBAAiB,EAAE,MAAM,GACxB,CAAC;CAgBL"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TokenRequiredRepository = void 0;
|
|
4
|
+
const core_1 = require("@ts-rest/core");
|
|
5
|
+
const api_error_js_1 = require("../errors/api_error.js");
|
|
6
|
+
const uuid_1 = require("uuid");
|
|
7
|
+
/**
|
|
8
|
+
* TokenRequiredRepository
|
|
9
|
+
*
|
|
10
|
+
* A generic base class to build repositories for interacting with the API,
|
|
11
|
+
* without any dependency on AfloatAuth. Instead, it requires token to be
|
|
12
|
+
* explicitly provided when initializing the repository.
|
|
13
|
+
*
|
|
14
|
+
* @template TContract - The API contract extending `AppRouter` from `@ts-rest/core`.
|
|
15
|
+
*/
|
|
16
|
+
class TokenRequiredRepository {
|
|
17
|
+
/**
|
|
18
|
+
* Constructs a new instance of `TokenRequiredRepository`.
|
|
19
|
+
*
|
|
20
|
+
* @param endpoint - API endpoint
|
|
21
|
+
* @param contract - The "ts-rest" contract
|
|
22
|
+
* @param token - Authentication token (required)
|
|
23
|
+
* @param root - Optional API root URL
|
|
24
|
+
*/
|
|
25
|
+
constructor(endpoint, contract, token, root) {
|
|
26
|
+
/**
|
|
27
|
+
* A "ts-rest" contract
|
|
28
|
+
*
|
|
29
|
+
* @protected
|
|
30
|
+
*/
|
|
31
|
+
Object.defineProperty(this, "contract", {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
value: void 0
|
|
36
|
+
});
|
|
37
|
+
/**
|
|
38
|
+
* An API endpoint
|
|
39
|
+
*
|
|
40
|
+
* @protected
|
|
41
|
+
*/
|
|
42
|
+
Object.defineProperty(this, "endpoint", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
configurable: true,
|
|
45
|
+
writable: true,
|
|
46
|
+
value: void 0
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* An API Root URL
|
|
50
|
+
*
|
|
51
|
+
* @protected
|
|
52
|
+
*/
|
|
53
|
+
Object.defineProperty(this, "root", {
|
|
54
|
+
enumerable: true,
|
|
55
|
+
configurable: true,
|
|
56
|
+
writable: true,
|
|
57
|
+
value: void 0
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Authentication token
|
|
61
|
+
*
|
|
62
|
+
* @protected
|
|
63
|
+
*/
|
|
64
|
+
Object.defineProperty(this, "token", {
|
|
65
|
+
enumerable: true,
|
|
66
|
+
configurable: true,
|
|
67
|
+
writable: true,
|
|
68
|
+
value: void 0
|
|
69
|
+
});
|
|
70
|
+
this.contract = contract;
|
|
71
|
+
this.endpoint = endpoint;
|
|
72
|
+
this.token = token;
|
|
73
|
+
this.root = root;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Gets the initialized client for making API requests.
|
|
77
|
+
* Uses the provided authentication token.
|
|
78
|
+
*/
|
|
79
|
+
get client() {
|
|
80
|
+
const baseUrl = this.root
|
|
81
|
+
? `${this.root}/${this.endpoint}`
|
|
82
|
+
: `https://api.afloat.money/v1/${this.endpoint}`;
|
|
83
|
+
const args = {
|
|
84
|
+
baseUrl,
|
|
85
|
+
baseHeaders: {
|
|
86
|
+
"token": this.token,
|
|
87
|
+
"x-request-id": (0, uuid_1.v4)(),
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
return (0, core_1.initClient)(this.contract, args);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Updates the token used by this repository
|
|
94
|
+
*
|
|
95
|
+
* @param token - New authentication token
|
|
96
|
+
*/
|
|
97
|
+
setToken(token) {
|
|
98
|
+
this.token = token;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Gets the current token
|
|
102
|
+
*
|
|
103
|
+
* @returns The current authentication token
|
|
104
|
+
*/
|
|
105
|
+
getToken() {
|
|
106
|
+
return this.token;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Handles the API response by checking the HTTP status code and returning the response body
|
|
110
|
+
* for successful requests or throwing an `APIError` for errors.
|
|
111
|
+
*
|
|
112
|
+
* @template T - The expected type of the successful response body.
|
|
113
|
+
* @param result - The API response object containing the status code and response body.
|
|
114
|
+
* @param successStatusCode - The expected HTTP status code indicating success (e.g., 200, 201).
|
|
115
|
+
* @returns The response body typed as `T` if the status code matches the success criteria.
|
|
116
|
+
* @throws `APIError` - If the status code indicates a failure.
|
|
117
|
+
*/
|
|
118
|
+
handleResponse(result, successStatusCode) {
|
|
119
|
+
if (successStatusCode === result.status) {
|
|
120
|
+
return result.body;
|
|
121
|
+
}
|
|
122
|
+
if (result.status === 400) {
|
|
123
|
+
throw new api_error_js_1.APIError(result.body);
|
|
124
|
+
}
|
|
125
|
+
throw new api_error_js_1.APIError({
|
|
126
|
+
message: "We encountered an error trying to process your request. Please try again later",
|
|
127
|
+
statusCode: 520,
|
|
128
|
+
error: "UNKNOWN ERROR",
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.TokenRequiredRepository = TokenRequiredRepository;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Profile } from "../../../models/index.js";
|
|
2
|
-
import { BaseRepository } from "../../../shared/base_repository.js";
|
|
3
|
-
import { profileContract } from "./contract.js";
|
|
4
|
-
export declare class ProfileRepository extends BaseRepository<typeof profileContract> {
|
|
5
|
-
/**
|
|
6
|
-
* Initializes an instance of ProfileRepository.
|
|
7
|
-
*/
|
|
8
|
-
constructor();
|
|
9
|
-
getCurrentProfile(token: string): Promise<Profile>;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../../src/src/features/auth/profile/repository.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD,qBAAa,iBAAkB,SAAQ,cAAc,CAAC,OAAO,eAAe,CAAC;IAC3E;;OAEG;;IAKG,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAUzD"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { BaseRepository } from "../../../shared/base_repository.js";
|
|
2
|
-
import { APIError } from "../../../errors/api_error.js";
|
|
3
|
-
import { profileContract } from "./contract.js";
|
|
4
|
-
export class ProfileRepository extends BaseRepository {
|
|
5
|
-
/**
|
|
6
|
-
* Initializes an instance of ProfileRepository.
|
|
7
|
-
*/
|
|
8
|
-
constructor() {
|
|
9
|
-
super("profile", profileContract);
|
|
10
|
-
}
|
|
11
|
-
async getCurrentProfile(token) {
|
|
12
|
-
const headers = { token };
|
|
13
|
-
const result = await this.client.getCurrentProfile({ headers });
|
|
14
|
-
if (result.status === 200)
|
|
15
|
-
return result.body;
|
|
16
|
-
throw new APIError({
|
|
17
|
-
message: "An error occurred while trying to get the current profile",
|
|
18
|
-
statusCode: 502,
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { STATEMENT_OUTPUT_TYPE } from "../../models/wallet/index.js";
|
|
3
|
-
export declare const contract: {
|
|
4
|
-
genStatementPDF: {
|
|
5
|
-
method: "POST";
|
|
6
|
-
body: z.ZodObject<{
|
|
7
|
-
end_date: z.ZodDate;
|
|
8
|
-
start_date: z.ZodDate;
|
|
9
|
-
account_no: z.ZodOptional<z.ZodString>;
|
|
10
|
-
return_file_type: z.ZodEnum<[STATEMENT_OUTPUT_TYPE.EXCEL, STATEMENT_OUTPUT_TYPE.PDF]>;
|
|
11
|
-
}, "strip", z.ZodTypeAny, {
|
|
12
|
-
end_date: Date;
|
|
13
|
-
start_date: Date;
|
|
14
|
-
return_file_type: STATEMENT_OUTPUT_TYPE;
|
|
15
|
-
account_no?: string | undefined;
|
|
16
|
-
}, {
|
|
17
|
-
end_date: Date;
|
|
18
|
-
start_date: Date;
|
|
19
|
-
return_file_type: STATEMENT_OUTPUT_TYPE;
|
|
20
|
-
account_no?: string | undefined;
|
|
21
|
-
}>;
|
|
22
|
-
path: "/statement";
|
|
23
|
-
responses: {
|
|
24
|
-
201: z.ZodObject<{
|
|
25
|
-
file: z.ZodString;
|
|
26
|
-
file_extension: z.ZodString;
|
|
27
|
-
mime_type: z.ZodString;
|
|
28
|
-
}, "strip", z.ZodTypeAny, {
|
|
29
|
-
file: string;
|
|
30
|
-
file_extension: string;
|
|
31
|
-
mime_type: string;
|
|
32
|
-
}, {
|
|
33
|
-
file: string;
|
|
34
|
-
file_extension: string;
|
|
35
|
-
mime_type: string;
|
|
36
|
-
}>;
|
|
37
|
-
202: z.ZodObject<{
|
|
38
|
-
message: z.ZodString;
|
|
39
|
-
}, "strip", z.ZodTypeAny, {
|
|
40
|
-
message: string;
|
|
41
|
-
}, {
|
|
42
|
-
message: string;
|
|
43
|
-
}>;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
genAccountDetailsPDF: {
|
|
47
|
-
method: "POST";
|
|
48
|
-
body: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
49
|
-
path: "/account_details";
|
|
50
|
-
responses: {
|
|
51
|
-
201: z.ZodObject<{
|
|
52
|
-
file: z.ZodString;
|
|
53
|
-
file_extension: z.ZodString;
|
|
54
|
-
mime_type: z.ZodString;
|
|
55
|
-
}, "strip", z.ZodTypeAny, {
|
|
56
|
-
file: string;
|
|
57
|
-
file_extension: string;
|
|
58
|
-
mime_type: string;
|
|
59
|
-
}, {
|
|
60
|
-
file: string;
|
|
61
|
-
file_extension: string;
|
|
62
|
-
mime_type: string;
|
|
63
|
-
}>;
|
|
64
|
-
};
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=contract.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/src/features/files-gen/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAErE,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoCnB,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import { initContract } from "@ts-rest/core";
|
|
3
|
-
import { STATEMENT_OUTPUT_TYPE } from "../../models/wallet/index.js";
|
|
4
|
-
export const contract = initContract().router({
|
|
5
|
-
genStatementPDF: {
|
|
6
|
-
method: "POST",
|
|
7
|
-
path: "/statement",
|
|
8
|
-
body: z.object({
|
|
9
|
-
end_date: z.date(),
|
|
10
|
-
start_date: z.date(),
|
|
11
|
-
account_no: z.string().optional(),
|
|
12
|
-
return_file_type: z.enum([
|
|
13
|
-
STATEMENT_OUTPUT_TYPE.EXCEL,
|
|
14
|
-
STATEMENT_OUTPUT_TYPE.PDF,
|
|
15
|
-
]),
|
|
16
|
-
}),
|
|
17
|
-
responses: {
|
|
18
|
-
201: z.object({
|
|
19
|
-
file: z.string(),
|
|
20
|
-
file_extension: z.string(),
|
|
21
|
-
mime_type: z.string(),
|
|
22
|
-
}),
|
|
23
|
-
202: z.object({
|
|
24
|
-
message: z.string(),
|
|
25
|
-
}),
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
genAccountDetailsPDF: {
|
|
29
|
-
method: "POST",
|
|
30
|
-
path: "/account_details",
|
|
31
|
-
body: z.object({}),
|
|
32
|
-
responses: {
|
|
33
|
-
201: z.object({
|
|
34
|
-
file: z.string(),
|
|
35
|
-
file_extension: z.string(),
|
|
36
|
-
mime_type: z.string(),
|
|
37
|
-
}),
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { contract } from "./contract.js";
|
|
2
|
-
import { BaseRepository } from "../../shared/index.js";
|
|
3
|
-
import type { ClientInferRequest, ClientInferResponseBody } from "@ts-rest/core";
|
|
4
|
-
import type { StatementFile } from "../../models/wallet/index.js";
|
|
5
|
-
import type { AfloatAuth } from "../auth/index.js";
|
|
6
|
-
/**
|
|
7
|
-
* Type definition for statement generation input parameters.
|
|
8
|
-
* Inferred from the contract's genStatementPDF endpoint request body.
|
|
9
|
-
* @typedef {ClientInferRequest<typeof contract.genStatementPDF>["body"]} GenStatementInput
|
|
10
|
-
*/
|
|
11
|
-
type GenStatementInput = ClientInferRequest<typeof contract.genStatementPDF>["body"];
|
|
12
|
-
/**
|
|
13
|
-
* Type definition for account details response.
|
|
14
|
-
* Inferred from the contract's genAccountDetailsPDF endpoint response body.
|
|
15
|
-
* @typedef {ClientInferResponseBody<typeof contract.genAccountDetailsPDF>} GenAccountDetailsResponse
|
|
16
|
-
*/
|
|
17
|
-
type GenAccountDetailsResponse = ClientInferResponseBody<typeof contract.genAccountDetailsPDF>;
|
|
18
|
-
/**
|
|
19
|
-
* Repository class for managing file generation operations including
|
|
20
|
-
* statement PDFs and account details documents.
|
|
21
|
-
* @extends {BaseRepository<typeof contract>}
|
|
22
|
-
*/
|
|
23
|
-
export declare class AfloatFilesRepo extends BaseRepository<typeof contract> {
|
|
24
|
-
/**
|
|
25
|
-
* Creates an instance of AfloatFilesRepo initialized with the files generation contract.
|
|
26
|
-
* Configures the repository with the PDF maker service endpoint.
|
|
27
|
-
*/
|
|
28
|
-
constructor(props?: {
|
|
29
|
-
auth?: AfloatAuth;
|
|
30
|
-
});
|
|
31
|
-
/**
|
|
32
|
-
* Generates and downloads a statement PDF based on the provided parameters.
|
|
33
|
-
* @param {GenStatementInput} body - The statement generation parameters
|
|
34
|
-
* @param {Date} body.start_date - Start date for the statement period
|
|
35
|
-
* @param {Date} body.end_date - End date for the statement period
|
|
36
|
-
* @param {string} body.return_file_type - Desired file format for the statement
|
|
37
|
-
* @param {string} [body.account_no] - Optional account number to generate statement for
|
|
38
|
-
* @throws {APIError} If the statement generation operation fails
|
|
39
|
-
* @returns {Promise<StatementFile>} The generated statement file
|
|
40
|
-
*/
|
|
41
|
-
downloadStatement(body: GenStatementInput): Promise<StatementFile>;
|
|
42
|
-
/**
|
|
43
|
-
* Generates a PDF containing detailed account information.
|
|
44
|
-
* @throws {APIError} If the PDF generation operation fails
|
|
45
|
-
* @returns {Promise<GenAccountDetailsResponse>} The generated account details PDF
|
|
46
|
-
*/
|
|
47
|
-
genAccountDetailsPDF(): Promise<GenAccountDetailsResponse>;
|
|
48
|
-
}
|
|
49
|
-
export {};
|
|
50
|
-
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../../../src/src/features/files-gen/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,KAAK,EACV,kBAAkB,EAClB,uBAAuB,EACxB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;GAIG;AACH,KAAK,iBAAiB,GAAG,kBAAkB,CACzC,OAAO,QAAQ,CAAC,eAAe,CAChC,CAAC,MAAM,CAAC,CAAC;AAEV;;;;GAIG;AACH,KAAK,yBAAyB,GAAG,uBAAuB,CACtD,OAAO,QAAQ,CAAC,oBAAoB,CACrC,CAAC;AAEF;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,cAAc,CAAC,OAAO,QAAQ,CAAC;IAClE;;;OAGG;gBACS,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,UAAU,CAAA;KAAE;IAQzC;;;;;;;;;OASG;IACG,iBAAiB,CACrB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,aAAa,CAAC;IAiBzB;;;;OAIG;IACG,oBAAoB,IAAI,OAAO,CAAC,yBAAyB,CAAC;CAWjE"}
|