@mbanq/core-sdk-js 1.0.0-alpha.5 → 1.0.0-alpha.6
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/README.md +434 -179
- package/dist/chunk-5PEETHWV.mjs +1 -0
- package/dist/chunk-BDI3SHA2.js +1 -0
- package/dist/chunk-LXODYKLU.mjs +1 -0
- package/dist/chunk-NVFP3TSF.js +1 -0
- package/dist/chunk-OGW7GTJP.js +1 -0
- package/dist/chunk-RX3BFHHX.mjs +1 -0
- package/dist/client/index.d.mts +3 -10
- package/dist/client/index.d.ts +3 -10
- package/dist/client/index.js +1 -1
- package/dist/client/index.mjs +1 -1
- package/dist/commands/index.d.mts +66 -4
- package/dist/commands/index.d.ts +66 -4
- package/dist/commands/index.js +1 -1
- package/dist/commands/index.mjs +1 -1
- package/dist/{config.d-NcOIimSJ.d.mts → config.d-CyK6ZM6s.d.mts} +2 -1
- package/dist/{config.d-NcOIimSJ.d.ts → config.d-CyK6ZM6s.d.ts} +2 -1
- package/dist/{index-B5WvpVzR.d.ts → index-5Sj83ZJ4.d.mts} +2 -64
- package/dist/index-BlNgOA4v.d.ts +387 -0
- package/dist/index-BwrcqeVR.d.mts +387 -0
- package/dist/{index-CR5y5AHj.d.mts → index-DXK5OdKW.d.ts} +2 -64
- package/dist/index.d.mts +43 -5
- package/dist/index.d.ts +43 -5
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +3 -2
- package/dist/chunk-4TZWTPAO.mjs +0 -1
- package/dist/chunk-E4GWSVC5.js +0 -1
- package/dist/chunk-XGUW3EAC.js +0 -1
- package/dist/chunk-XOV45AFR.js +0 -1
- package/dist/chunk-YPDJGVWM.mjs +0 -1
- package/dist/chunk-ZC5XVPET.mjs +0 -1
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { a as Config, C as Command } from './config.d-CyK6ZM6s.mjs';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
declare const PaymentStatusSchema: z.ZodEnum<{
|
|
5
|
+
DRAFT: "DRAFT";
|
|
6
|
+
AML_SCREENING: "AML_SCREENING";
|
|
7
|
+
AML_REJECTED: "AML_REJECTED";
|
|
8
|
+
EXECUTION_SCHEDULED: "EXECUTION_SCHEDULED";
|
|
9
|
+
EXECUTION_PROCESSING: "EXECUTION_PROCESSING";
|
|
10
|
+
EXECUTION_SUCCESS: "EXECUTION_SUCCESS";
|
|
11
|
+
EXECUTION_FAILURE: "EXECUTION_FAILURE";
|
|
12
|
+
RETURNED: "RETURNED";
|
|
13
|
+
CANCELLED: "CANCELLED";
|
|
14
|
+
COMPLIANCE_FAILURE: "COMPLIANCE_FAILURE";
|
|
15
|
+
DELETED: "DELETED";
|
|
16
|
+
UNKNOWN: "UNKNOWN";
|
|
17
|
+
}>;
|
|
18
|
+
declare const PaymentRailSchema: z.ZodEnum<{
|
|
19
|
+
ACH: "ACH";
|
|
20
|
+
SAMEDAYACH: "SAMEDAYACH";
|
|
21
|
+
WIRE: "WIRE";
|
|
22
|
+
SWIFT: "SWIFT";
|
|
23
|
+
INTERNAL: "INTERNAL";
|
|
24
|
+
FXPAY: "FXPAY";
|
|
25
|
+
CARD: "CARD";
|
|
26
|
+
}>;
|
|
27
|
+
declare const PaymentTypeSchema: z.ZodEnum<{
|
|
28
|
+
CREDIT: "CREDIT";
|
|
29
|
+
DEBIT: "DEBIT";
|
|
30
|
+
}>;
|
|
31
|
+
type PaymentStatus = z.infer<typeof PaymentStatusSchema>;
|
|
32
|
+
type PaymentRailType = z.infer<typeof PaymentRailSchema>;
|
|
33
|
+
type PaymentType = z.infer<typeof PaymentTypeSchema>;
|
|
34
|
+
declare const PaymentSchema: z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
amount: z.ZodNumber;
|
|
37
|
+
clientId: z.ZodString;
|
|
38
|
+
currency: z.ZodString;
|
|
39
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
40
|
+
DRAFT: "DRAFT";
|
|
41
|
+
AML_SCREENING: "AML_SCREENING";
|
|
42
|
+
AML_REJECTED: "AML_REJECTED";
|
|
43
|
+
EXECUTION_SCHEDULED: "EXECUTION_SCHEDULED";
|
|
44
|
+
EXECUTION_PROCESSING: "EXECUTION_PROCESSING";
|
|
45
|
+
EXECUTION_SUCCESS: "EXECUTION_SUCCESS";
|
|
46
|
+
EXECUTION_FAILURE: "EXECUTION_FAILURE";
|
|
47
|
+
RETURNED: "RETURNED";
|
|
48
|
+
CANCELLED: "CANCELLED";
|
|
49
|
+
COMPLIANCE_FAILURE: "COMPLIANCE_FAILURE";
|
|
50
|
+
DELETED: "DELETED";
|
|
51
|
+
UNKNOWN: "UNKNOWN";
|
|
52
|
+
}>>;
|
|
53
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
54
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
55
|
+
}, z.core.$catchall<z.ZodAny>>;
|
|
56
|
+
declare const CreatePaymentInputSchema: z.ZodObject<{
|
|
57
|
+
amount: z.ZodNumber;
|
|
58
|
+
currency: z.ZodString;
|
|
59
|
+
paymentRail: z.ZodEnum<{
|
|
60
|
+
ACH: "ACH";
|
|
61
|
+
SAMEDAYACH: "SAMEDAYACH";
|
|
62
|
+
WIRE: "WIRE";
|
|
63
|
+
SWIFT: "SWIFT";
|
|
64
|
+
INTERNAL: "INTERNAL";
|
|
65
|
+
FXPAY: "FXPAY";
|
|
66
|
+
CARD: "CARD";
|
|
67
|
+
}>;
|
|
68
|
+
paymentType: z.ZodEnum<{
|
|
69
|
+
CREDIT: "CREDIT";
|
|
70
|
+
DEBIT: "DEBIT";
|
|
71
|
+
}>;
|
|
72
|
+
debtor: z.ZodObject<{
|
|
73
|
+
name: z.ZodString;
|
|
74
|
+
identifier: z.ZodString;
|
|
75
|
+
accountType: z.ZodOptional<z.ZodEnum<{
|
|
76
|
+
CHECKING: "CHECKING";
|
|
77
|
+
SAVINGS: "SAVINGS";
|
|
78
|
+
}>>;
|
|
79
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
streetAddress: z.ZodOptional<z.ZodString>;
|
|
81
|
+
city: z.ZodOptional<z.ZodString>;
|
|
82
|
+
state: z.ZodOptional<z.ZodString>;
|
|
83
|
+
country: z.ZodOptional<z.ZodString>;
|
|
84
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
87
|
+
name: z.ZodOptional<z.ZodString>;
|
|
88
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
89
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
90
|
+
streetAddress: z.ZodOptional<z.ZodString>;
|
|
91
|
+
city: z.ZodOptional<z.ZodString>;
|
|
92
|
+
state: z.ZodOptional<z.ZodString>;
|
|
93
|
+
country: z.ZodOptional<z.ZodString>;
|
|
94
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
95
|
+
}, z.core.$strip>>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
creditor: z.ZodObject<{
|
|
99
|
+
name: z.ZodString;
|
|
100
|
+
identifier: z.ZodString;
|
|
101
|
+
accountType: z.ZodOptional<z.ZodEnum<{
|
|
102
|
+
CHECKING: "CHECKING";
|
|
103
|
+
SAVINGS: "SAVINGS";
|
|
104
|
+
}>>;
|
|
105
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
106
|
+
streetAddress: z.ZodOptional<z.ZodString>;
|
|
107
|
+
city: z.ZodOptional<z.ZodString>;
|
|
108
|
+
state: z.ZodOptional<z.ZodString>;
|
|
109
|
+
country: z.ZodOptional<z.ZodString>;
|
|
110
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
111
|
+
}, z.core.$strip>>;
|
|
112
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
113
|
+
name: z.ZodOptional<z.ZodString>;
|
|
114
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
115
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
116
|
+
streetAddress: z.ZodOptional<z.ZodString>;
|
|
117
|
+
city: z.ZodOptional<z.ZodString>;
|
|
118
|
+
state: z.ZodOptional<z.ZodString>;
|
|
119
|
+
country: z.ZodOptional<z.ZodString>;
|
|
120
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
121
|
+
}, z.core.$strip>>;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
125
|
+
correspondent: z.ZodOptional<z.ZodObject<{
|
|
126
|
+
name: z.ZodString;
|
|
127
|
+
identifier: z.ZodString;
|
|
128
|
+
accountType: z.ZodOptional<z.ZodEnum<{
|
|
129
|
+
CHECKING: "CHECKING";
|
|
130
|
+
SAVINGS: "SAVINGS";
|
|
131
|
+
}>>;
|
|
132
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
133
|
+
streetAddress: z.ZodOptional<z.ZodString>;
|
|
134
|
+
city: z.ZodOptional<z.ZodString>;
|
|
135
|
+
state: z.ZodOptional<z.ZodString>;
|
|
136
|
+
country: z.ZodOptional<z.ZodString>;
|
|
137
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
138
|
+
}, z.core.$strip>>;
|
|
139
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
140
|
+
name: z.ZodOptional<z.ZodString>;
|
|
141
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
142
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
143
|
+
streetAddress: z.ZodOptional<z.ZodString>;
|
|
144
|
+
city: z.ZodOptional<z.ZodString>;
|
|
145
|
+
state: z.ZodOptional<z.ZodString>;
|
|
146
|
+
country: z.ZodOptional<z.ZodString>;
|
|
147
|
+
postalCode: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.core.$strip>>;
|
|
149
|
+
}, z.core.$strip>>;
|
|
150
|
+
}, z.core.$strip>>;
|
|
151
|
+
exchangeRate: z.ZodOptional<z.ZodNumber>;
|
|
152
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
153
|
+
reference: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
154
|
+
paymentRailMetaData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
155
|
+
chargeBearer: z.ZodOptional<z.ZodEnum<{
|
|
156
|
+
OUR: "OUR";
|
|
157
|
+
BEN: "BEN";
|
|
158
|
+
SHA: "SHA";
|
|
159
|
+
}>>;
|
|
160
|
+
purposeCode: z.ZodOptional<z.ZodString>;
|
|
161
|
+
valueDate: z.ZodOptional<z.ZodString>;
|
|
162
|
+
executionDate: z.ZodOptional<z.ZodString>;
|
|
163
|
+
}, z.core.$catchall<z.ZodAny>>;
|
|
164
|
+
declare const UpdatePaymentInputSchema: z.ZodObject<{
|
|
165
|
+
amount: z.ZodOptional<z.ZodNumber>;
|
|
166
|
+
correspondent: z.ZodOptional<z.ZodObject<{
|
|
167
|
+
name: z.ZodOptional<z.ZodString>;
|
|
168
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
169
|
+
accountType: z.ZodOptional<z.ZodString>;
|
|
170
|
+
}, z.core.$strip>>;
|
|
171
|
+
creditor: z.ZodOptional<z.ZodObject<{
|
|
172
|
+
name: z.ZodOptional<z.ZodString>;
|
|
173
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
174
|
+
accountType: z.ZodOptional<z.ZodString>;
|
|
175
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
176
|
+
name: z.ZodOptional<z.ZodString>;
|
|
177
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
178
|
+
}, z.core.$strip>>;
|
|
179
|
+
}, z.core.$strip>>;
|
|
180
|
+
debtor: z.ZodOptional<z.ZodObject<{
|
|
181
|
+
name: z.ZodOptional<z.ZodString>;
|
|
182
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
183
|
+
accountType: z.ZodOptional<z.ZodString>;
|
|
184
|
+
agent: z.ZodOptional<z.ZodObject<{
|
|
185
|
+
name: z.ZodOptional<z.ZodString>;
|
|
186
|
+
identifier: z.ZodOptional<z.ZodString>;
|
|
187
|
+
}, z.core.$strip>>;
|
|
188
|
+
}, z.core.$strip>>;
|
|
189
|
+
exchangeRate: z.ZodOptional<z.ZodNumber>;
|
|
190
|
+
externalId: z.ZodOptional<z.ZodString>;
|
|
191
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
192
|
+
errorMessage: z.ZodOptional<z.ZodString>;
|
|
193
|
+
reference: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
194
|
+
paymentRailMetaData: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
195
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
196
|
+
DRAFT: "DRAFT";
|
|
197
|
+
AML_SCREENING: "AML_SCREENING";
|
|
198
|
+
AML_REJECTED: "AML_REJECTED";
|
|
199
|
+
EXECUTION_SCHEDULED: "EXECUTION_SCHEDULED";
|
|
200
|
+
EXECUTION_PROCESSING: "EXECUTION_PROCESSING";
|
|
201
|
+
EXECUTION_SUCCESS: "EXECUTION_SUCCESS";
|
|
202
|
+
EXECUTION_FAILURE: "EXECUTION_FAILURE";
|
|
203
|
+
RETURNED: "RETURNED";
|
|
204
|
+
CANCELLED: "CANCELLED";
|
|
205
|
+
COMPLIANCE_FAILURE: "COMPLIANCE_FAILURE";
|
|
206
|
+
DELETED: "DELETED";
|
|
207
|
+
UNKNOWN: "UNKNOWN";
|
|
208
|
+
}>>;
|
|
209
|
+
}, z.core.$catchall<z.ZodAny>>;
|
|
210
|
+
declare const PaymentResponseSchema: z.ZodObject<{
|
|
211
|
+
totalFilteredRecords: z.ZodNumber;
|
|
212
|
+
pageItems: z.ZodArray<z.ZodObject<{
|
|
213
|
+
id: z.ZodString;
|
|
214
|
+
amount: z.ZodNumber;
|
|
215
|
+
clientId: z.ZodString;
|
|
216
|
+
currency: z.ZodString;
|
|
217
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
218
|
+
DRAFT: "DRAFT";
|
|
219
|
+
AML_SCREENING: "AML_SCREENING";
|
|
220
|
+
AML_REJECTED: "AML_REJECTED";
|
|
221
|
+
EXECUTION_SCHEDULED: "EXECUTION_SCHEDULED";
|
|
222
|
+
EXECUTION_PROCESSING: "EXECUTION_PROCESSING";
|
|
223
|
+
EXECUTION_SUCCESS: "EXECUTION_SUCCESS";
|
|
224
|
+
EXECUTION_FAILURE: "EXECUTION_FAILURE";
|
|
225
|
+
RETURNED: "RETURNED";
|
|
226
|
+
CANCELLED: "CANCELLED";
|
|
227
|
+
COMPLIANCE_FAILURE: "COMPLIANCE_FAILURE";
|
|
228
|
+
DELETED: "DELETED";
|
|
229
|
+
UNKNOWN: "UNKNOWN";
|
|
230
|
+
}>>;
|
|
231
|
+
createdAt: z.ZodOptional<z.ZodString>;
|
|
232
|
+
updatedAt: z.ZodOptional<z.ZodString>;
|
|
233
|
+
}, z.core.$catchall<z.ZodAny>>>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
|
+
type Payment = z.infer<typeof PaymentSchema>;
|
|
236
|
+
type CreatePaymentInput = z.infer<typeof CreatePaymentInputSchema>;
|
|
237
|
+
type UpdatePaymentInput = z.infer<typeof UpdatePaymentInputSchema>;
|
|
238
|
+
type PaymentResponse = z.infer<typeof PaymentResponseSchema>;
|
|
239
|
+
|
|
240
|
+
declare const createClient: (initialConfig: Config) => {
|
|
241
|
+
payment: {
|
|
242
|
+
create: (data: CreatePaymentInput) => Promise<{
|
|
243
|
+
[x: string]: any;
|
|
244
|
+
id: string;
|
|
245
|
+
amount: number;
|
|
246
|
+
clientId: string;
|
|
247
|
+
currency: string;
|
|
248
|
+
status?: "DRAFT" | "AML_SCREENING" | "AML_REJECTED" | "EXECUTION_SCHEDULED" | "EXECUTION_PROCESSING" | "EXECUTION_SUCCESS" | "EXECUTION_FAILURE" | "RETURNED" | "CANCELLED" | "COMPLIANCE_FAILURE" | "DELETED" | "UNKNOWN" | undefined;
|
|
249
|
+
createdAt?: string | undefined;
|
|
250
|
+
updatedAt?: string | undefined;
|
|
251
|
+
} | undefined>;
|
|
252
|
+
get: (id: string) => Promise<{
|
|
253
|
+
[x: string]: any;
|
|
254
|
+
id: string;
|
|
255
|
+
amount: number;
|
|
256
|
+
clientId: string;
|
|
257
|
+
currency: string;
|
|
258
|
+
status?: "DRAFT" | "AML_SCREENING" | "AML_REJECTED" | "EXECUTION_SCHEDULED" | "EXECUTION_PROCESSING" | "EXECUTION_SUCCESS" | "EXECUTION_FAILURE" | "RETURNED" | "CANCELLED" | "COMPLIANCE_FAILURE" | "DELETED" | "UNKNOWN" | undefined;
|
|
259
|
+
createdAt?: string | undefined;
|
|
260
|
+
updatedAt?: string | undefined;
|
|
261
|
+
} | undefined>;
|
|
262
|
+
update: (id: string, data: UpdatePaymentInput) => Promise<{
|
|
263
|
+
[x: string]: any;
|
|
264
|
+
id: string;
|
|
265
|
+
amount: number;
|
|
266
|
+
clientId: string;
|
|
267
|
+
currency: string;
|
|
268
|
+
status?: "DRAFT" | "AML_SCREENING" | "AML_REJECTED" | "EXECUTION_SCHEDULED" | "EXECUTION_PROCESSING" | "EXECUTION_SUCCESS" | "EXECUTION_FAILURE" | "RETURNED" | "CANCELLED" | "COMPLIANCE_FAILURE" | "DELETED" | "UNKNOWN" | undefined;
|
|
269
|
+
createdAt?: string | undefined;
|
|
270
|
+
updatedAt?: string | undefined;
|
|
271
|
+
} | undefined>;
|
|
272
|
+
delete: (id: string) => Promise<void | undefined>;
|
|
273
|
+
list: () => {
|
|
274
|
+
where: (field: string) => {
|
|
275
|
+
eq: (value: any) => {
|
|
276
|
+
where: /*elided*/ any;
|
|
277
|
+
limit: (value: number) => /*elided*/ any;
|
|
278
|
+
offset: (value: number) => /*elided*/ any;
|
|
279
|
+
execute: () => Command<any, Array<Payment>>;
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
limit: (value: number) => {
|
|
283
|
+
where: (field: string) => {
|
|
284
|
+
eq: (value: any) => /*elided*/ any;
|
|
285
|
+
};
|
|
286
|
+
limit: /*elided*/ any;
|
|
287
|
+
offset: (value: number) => /*elided*/ any;
|
|
288
|
+
execute: () => Command<any, Array<Payment>>;
|
|
289
|
+
};
|
|
290
|
+
offset: (value: number) => {
|
|
291
|
+
where: (field: string) => {
|
|
292
|
+
eq: (value: any) => /*elided*/ any;
|
|
293
|
+
};
|
|
294
|
+
limit: (value: number) => /*elided*/ any;
|
|
295
|
+
offset: /*elided*/ any;
|
|
296
|
+
execute: () => Command<any, Array<Payment>>;
|
|
297
|
+
};
|
|
298
|
+
execute: () => Promise<{
|
|
299
|
+
[x: string]: any;
|
|
300
|
+
id: string;
|
|
301
|
+
amount: number;
|
|
302
|
+
clientId: string;
|
|
303
|
+
currency: string;
|
|
304
|
+
status?: "DRAFT" | "AML_SCREENING" | "AML_REJECTED" | "EXECUTION_SCHEDULED" | "EXECUTION_PROCESSING" | "EXECUTION_SUCCESS" | "EXECUTION_FAILURE" | "RETURNED" | "CANCELLED" | "COMPLIANCE_FAILURE" | "DELETED" | "UNKNOWN" | undefined;
|
|
305
|
+
createdAt?: string | undefined;
|
|
306
|
+
updatedAt?: string | undefined;
|
|
307
|
+
}[] | undefined>;
|
|
308
|
+
};
|
|
309
|
+
};
|
|
310
|
+
setConfig: (config: Config) => void;
|
|
311
|
+
updateConfig: (config: Partial<Config>) => void;
|
|
312
|
+
resetConfig: () => void;
|
|
313
|
+
request: <TOutput>(command: Command<any, TOutput>) => Promise<TOutput | undefined>;
|
|
314
|
+
tenant: (tenantId: string) => {
|
|
315
|
+
payment: {
|
|
316
|
+
create: (data: CreatePaymentInput) => Promise<{
|
|
317
|
+
[x: string]: any;
|
|
318
|
+
id: string;
|
|
319
|
+
amount: number;
|
|
320
|
+
clientId: string;
|
|
321
|
+
currency: string;
|
|
322
|
+
status?: "DRAFT" | "AML_SCREENING" | "AML_REJECTED" | "EXECUTION_SCHEDULED" | "EXECUTION_PROCESSING" | "EXECUTION_SUCCESS" | "EXECUTION_FAILURE" | "RETURNED" | "CANCELLED" | "COMPLIANCE_FAILURE" | "DELETED" | "UNKNOWN" | undefined;
|
|
323
|
+
createdAt?: string | undefined;
|
|
324
|
+
updatedAt?: string | undefined;
|
|
325
|
+
} | undefined>;
|
|
326
|
+
get: (id: string) => Promise<{
|
|
327
|
+
[x: string]: any;
|
|
328
|
+
id: string;
|
|
329
|
+
amount: number;
|
|
330
|
+
clientId: string;
|
|
331
|
+
currency: string;
|
|
332
|
+
status?: "DRAFT" | "AML_SCREENING" | "AML_REJECTED" | "EXECUTION_SCHEDULED" | "EXECUTION_PROCESSING" | "EXECUTION_SUCCESS" | "EXECUTION_FAILURE" | "RETURNED" | "CANCELLED" | "COMPLIANCE_FAILURE" | "DELETED" | "UNKNOWN" | undefined;
|
|
333
|
+
createdAt?: string | undefined;
|
|
334
|
+
updatedAt?: string | undefined;
|
|
335
|
+
} | undefined>;
|
|
336
|
+
update: (id: string, data: UpdatePaymentInput) => Promise<{
|
|
337
|
+
[x: string]: any;
|
|
338
|
+
id: string;
|
|
339
|
+
amount: number;
|
|
340
|
+
clientId: string;
|
|
341
|
+
currency: string;
|
|
342
|
+
status?: "DRAFT" | "AML_SCREENING" | "AML_REJECTED" | "EXECUTION_SCHEDULED" | "EXECUTION_PROCESSING" | "EXECUTION_SUCCESS" | "EXECUTION_FAILURE" | "RETURNED" | "CANCELLED" | "COMPLIANCE_FAILURE" | "DELETED" | "UNKNOWN" | undefined;
|
|
343
|
+
createdAt?: string | undefined;
|
|
344
|
+
updatedAt?: string | undefined;
|
|
345
|
+
} | undefined>;
|
|
346
|
+
delete: (id: string) => Promise<void | undefined>;
|
|
347
|
+
list: () => {
|
|
348
|
+
where: (field: string) => {
|
|
349
|
+
eq: (value: any) => {
|
|
350
|
+
where: /*elided*/ any;
|
|
351
|
+
limit: (value: number) => /*elided*/ any;
|
|
352
|
+
offset: (value: number) => /*elided*/ any;
|
|
353
|
+
execute: () => Command<any, Array<Payment>>;
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
limit: (value: number) => {
|
|
357
|
+
where: (field: string) => {
|
|
358
|
+
eq: (value: any) => /*elided*/ any;
|
|
359
|
+
};
|
|
360
|
+
limit: /*elided*/ any;
|
|
361
|
+
offset: (value: number) => /*elided*/ any;
|
|
362
|
+
execute: () => Command<any, Array<Payment>>;
|
|
363
|
+
};
|
|
364
|
+
offset: (value: number) => {
|
|
365
|
+
where: (field: string) => {
|
|
366
|
+
eq: (value: any) => /*elided*/ any;
|
|
367
|
+
};
|
|
368
|
+
limit: (value: number) => /*elided*/ any;
|
|
369
|
+
offset: /*elided*/ any;
|
|
370
|
+
execute: () => Command<any, Array<Payment>>;
|
|
371
|
+
};
|
|
372
|
+
execute: () => Promise<{
|
|
373
|
+
[x: string]: any;
|
|
374
|
+
id: string;
|
|
375
|
+
amount: number;
|
|
376
|
+
clientId: string;
|
|
377
|
+
currency: string;
|
|
378
|
+
status?: "DRAFT" | "AML_SCREENING" | "AML_REJECTED" | "EXECUTION_SCHEDULED" | "EXECUTION_PROCESSING" | "EXECUTION_SUCCESS" | "EXECUTION_FAILURE" | "RETURNED" | "CANCELLED" | "COMPLIANCE_FAILURE" | "DELETED" | "UNKNOWN" | undefined;
|
|
379
|
+
createdAt?: string | undefined;
|
|
380
|
+
updatedAt?: string | undefined;
|
|
381
|
+
}[] | undefined>;
|
|
382
|
+
};
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
export { type CreatePaymentInput as C, type Payment as P, type UpdatePaymentInput as U, type PaymentResponse as a, type PaymentStatus as b, createClient as c, type PaymentRailType as d, type PaymentType as e };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as Command, G as GraphQLRequest } from './config.d-CyK6ZM6s.js';
|
|
2
2
|
|
|
3
3
|
type PaymentRail = 'ACH' | 'SAMEDAYACH';
|
|
4
4
|
type PaymentType = 'CREDIT' | 'DEBIT';
|
|
@@ -112,68 +112,6 @@ interface CreateTransferOutput extends ProcessOutput {
|
|
|
112
112
|
data: { amount: number }
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
declare const CreateTransfer: (params: {
|
|
116
|
-
transfer: CreateTransferInput;
|
|
117
|
-
tenantId: string;
|
|
118
|
-
}) => Command<{
|
|
119
|
-
transfer: CreateTransferInput;
|
|
120
|
-
tenantId: string;
|
|
121
|
-
}, CreateTransferOutput>;
|
|
122
|
-
declare const GetTransfer: (params: {
|
|
123
|
-
id: number;
|
|
124
|
-
tenantId: string;
|
|
125
|
-
}) => Command<{
|
|
126
|
-
id: number;
|
|
127
|
-
tenantId: string;
|
|
128
|
-
}, any>;
|
|
129
|
-
declare const GetTransfers: (params: GetTransferInput) => Command<GetTransferInput, Array<Transfer>>;
|
|
130
|
-
declare const MarkAsSuccess: (params: {
|
|
131
|
-
externalId: string;
|
|
132
|
-
paymentType?: PaymentRail;
|
|
133
|
-
tenantId?: string;
|
|
134
|
-
}) => Command<{
|
|
135
|
-
externalId: string;
|
|
136
|
-
paymentType?: PaymentRail;
|
|
137
|
-
tenantId?: string;
|
|
138
|
-
}, ProcessOutput>;
|
|
139
|
-
declare const MarkAsProcessing: (params: {
|
|
140
|
-
externalId: string;
|
|
141
|
-
fileUrl: string;
|
|
142
|
-
paymentType: PaymentRail;
|
|
143
|
-
traceNumbers: {
|
|
144
|
-
outgoingTransfer: string;
|
|
145
|
-
};
|
|
146
|
-
tenantId?: string;
|
|
147
|
-
}) => Command<{
|
|
148
|
-
externalId: string;
|
|
149
|
-
fileUrl: string;
|
|
150
|
-
paymentType: PaymentRail;
|
|
151
|
-
traceNumbers: {
|
|
152
|
-
outgoingTransfer: string;
|
|
153
|
-
};
|
|
154
|
-
tenantId?: string;
|
|
155
|
-
}, ProcessOutput>;
|
|
156
|
-
declare const MarkAsReturned: (params: MarkAsReturnInput) => Command<MarkAsReturnInput, ProcessOutput>;
|
|
157
|
-
declare const LogFailTransfer: (params: {
|
|
158
|
-
payload: Transfer;
|
|
159
|
-
tenantId?: string;
|
|
160
|
-
}) => Command<{
|
|
161
|
-
payload: Transfer;
|
|
162
|
-
tenantId?: string;
|
|
163
|
-
}, ProcessOutput>;
|
|
164
|
-
declare const MarkAsFail: (params: {
|
|
165
|
-
externalId: string;
|
|
166
|
-
errorMessage: string;
|
|
167
|
-
paymentType: PaymentRail;
|
|
168
|
-
tenantId?: string;
|
|
169
|
-
}) => Command<{
|
|
170
|
-
externalId: string;
|
|
171
|
-
errorMessage: string;
|
|
172
|
-
paymentType: PaymentRail;
|
|
173
|
-
tenantId?: string;
|
|
174
|
-
}, ProcessOutput>;
|
|
175
|
-
declare const UpdateTraceNumber: (params: UpdateTraceNumbersInput) => Command<UpdateTraceNumbersInput, ProcessOutput>;
|
|
176
|
-
|
|
177
115
|
interface SimpleCard {
|
|
178
116
|
internalCardId: string,
|
|
179
117
|
cardType?: string,
|
|
@@ -268,4 +206,4 @@ declare const UpdateClientIdentifier: (params: {
|
|
|
268
206
|
|
|
269
207
|
declare const GraphQL: (request: GraphQLRequest) => Command<GraphQLRequest, any>;
|
|
270
208
|
|
|
271
|
-
export {
|
|
209
|
+
export { type CreateTransferInput as C, GetClientData as G, type MarkAsReturnInput as M, type PaymentRail as P, SendAuthorizationToCore as S, type Transfer as T, UpdateCardID as U, UpdateClient as a, UpdateClientIdentifier as b, GraphQL as c, type ProcessOutput as d, type GetTransferInput as e, type UpdateTraceNumbersInput as f, type CreateTransferOutput as g };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import { M as Middleware } from './config.d-
|
|
4
|
-
export { a as
|
|
1
|
+
import { C as CreatePaymentInput, P as Payment, U as UpdatePaymentInput } from './index-BwrcqeVR.mjs';
|
|
2
|
+
export { d as PaymentRailType, a as PaymentResponse, b as PaymentStatus, e as PaymentType, c as createClient } from './index-BwrcqeVR.mjs';
|
|
3
|
+
import { M as Middleware, C as Command } from './config.d-CyK6ZM6s.mjs';
|
|
4
|
+
export { a as Config } from './config.d-CyK6ZM6s.mjs';
|
|
5
|
+
export { G as GetClientData, c as GraphQL, S as SendAuthorizationToCore, U as UpdateCardID, a as UpdateClient, b as UpdateClientIdentifier } from './index-5Sj83ZJ4.mjs';
|
|
6
|
+
import 'zod';
|
|
5
7
|
import 'graphql';
|
|
6
8
|
import 'axios';
|
|
7
9
|
|
|
@@ -19,6 +21,42 @@ interface Logger {
|
|
|
19
21
|
}
|
|
20
22
|
declare const createLoggingMiddleware: (logger?: Logger) => Middleware;
|
|
21
23
|
|
|
24
|
+
declare const CreatePayment: (params: {
|
|
25
|
+
payment: CreatePaymentInput;
|
|
26
|
+
tenantId?: string;
|
|
27
|
+
}) => Command<{
|
|
28
|
+
payment: CreatePaymentInput;
|
|
29
|
+
tenantId?: string;
|
|
30
|
+
}, Payment>;
|
|
31
|
+
declare const GetPayment: (params: {
|
|
32
|
+
id: string;
|
|
33
|
+
tenantId?: string;
|
|
34
|
+
}) => Command<{
|
|
35
|
+
id: string;
|
|
36
|
+
tenantId?: string;
|
|
37
|
+
}, Payment>;
|
|
38
|
+
declare const UpdatePayment: (params: {
|
|
39
|
+
id: string;
|
|
40
|
+
payment: UpdatePaymentInput;
|
|
41
|
+
tenantId?: string;
|
|
42
|
+
}) => Command<{
|
|
43
|
+
id: string;
|
|
44
|
+
payment: UpdatePaymentInput;
|
|
45
|
+
tenantId?: string;
|
|
46
|
+
}, Payment>;
|
|
47
|
+
declare const GetPayments: (params?: {
|
|
48
|
+
tenantId?: string;
|
|
49
|
+
}) => {
|
|
50
|
+
list: () => {
|
|
51
|
+
where: (field: string) => {
|
|
52
|
+
eq: (value: any) => /*elided*/ any;
|
|
53
|
+
};
|
|
54
|
+
limit: (value: number) => /*elided*/ any;
|
|
55
|
+
offset: (value: number) => /*elided*/ any;
|
|
56
|
+
execute: () => Command<any, Array<Payment>>;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
22
60
|
interface ApiError {
|
|
23
61
|
name: string;
|
|
24
62
|
message: string;
|
|
@@ -30,4 +68,4 @@ interface ApiError {
|
|
|
30
68
|
|
|
31
69
|
declare const isCommandError: (error: unknown) => error is ApiError;
|
|
32
70
|
|
|
33
|
-
export { type Logger, type MetricsClient, Middleware, createLoggingMiddleware, createMetricsMiddleware, isCommandError };
|
|
71
|
+
export { Command, CreatePayment, CreatePaymentInput, GetPayment, GetPayments, type Logger, type MetricsClient, Middleware, Payment, UpdatePayment, UpdatePaymentInput, createLoggingMiddleware, createMetricsMiddleware, isCommandError };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
import { M as Middleware } from './config.d-
|
|
4
|
-
export { a as
|
|
1
|
+
import { C as CreatePaymentInput, P as Payment, U as UpdatePaymentInput } from './index-BlNgOA4v.js';
|
|
2
|
+
export { d as PaymentRailType, a as PaymentResponse, b as PaymentStatus, e as PaymentType, c as createClient } from './index-BlNgOA4v.js';
|
|
3
|
+
import { M as Middleware, C as Command } from './config.d-CyK6ZM6s.js';
|
|
4
|
+
export { a as Config } from './config.d-CyK6ZM6s.js';
|
|
5
|
+
export { G as GetClientData, c as GraphQL, S as SendAuthorizationToCore, U as UpdateCardID, a as UpdateClient, b as UpdateClientIdentifier } from './index-DXK5OdKW.js';
|
|
6
|
+
import 'zod';
|
|
5
7
|
import 'graphql';
|
|
6
8
|
import 'axios';
|
|
7
9
|
|
|
@@ -19,6 +21,42 @@ interface Logger {
|
|
|
19
21
|
}
|
|
20
22
|
declare const createLoggingMiddleware: (logger?: Logger) => Middleware;
|
|
21
23
|
|
|
24
|
+
declare const CreatePayment: (params: {
|
|
25
|
+
payment: CreatePaymentInput;
|
|
26
|
+
tenantId?: string;
|
|
27
|
+
}) => Command<{
|
|
28
|
+
payment: CreatePaymentInput;
|
|
29
|
+
tenantId?: string;
|
|
30
|
+
}, Payment>;
|
|
31
|
+
declare const GetPayment: (params: {
|
|
32
|
+
id: string;
|
|
33
|
+
tenantId?: string;
|
|
34
|
+
}) => Command<{
|
|
35
|
+
id: string;
|
|
36
|
+
tenantId?: string;
|
|
37
|
+
}, Payment>;
|
|
38
|
+
declare const UpdatePayment: (params: {
|
|
39
|
+
id: string;
|
|
40
|
+
payment: UpdatePaymentInput;
|
|
41
|
+
tenantId?: string;
|
|
42
|
+
}) => Command<{
|
|
43
|
+
id: string;
|
|
44
|
+
payment: UpdatePaymentInput;
|
|
45
|
+
tenantId?: string;
|
|
46
|
+
}, Payment>;
|
|
47
|
+
declare const GetPayments: (params?: {
|
|
48
|
+
tenantId?: string;
|
|
49
|
+
}) => {
|
|
50
|
+
list: () => {
|
|
51
|
+
where: (field: string) => {
|
|
52
|
+
eq: (value: any) => /*elided*/ any;
|
|
53
|
+
};
|
|
54
|
+
limit: (value: number) => /*elided*/ any;
|
|
55
|
+
offset: (value: number) => /*elided*/ any;
|
|
56
|
+
execute: () => Command<any, Array<Payment>>;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
22
60
|
interface ApiError {
|
|
23
61
|
name: string;
|
|
24
62
|
message: string;
|
|
@@ -30,4 +68,4 @@ interface ApiError {
|
|
|
30
68
|
|
|
31
69
|
declare const isCommandError: (error: unknown) => error is ApiError;
|
|
32
70
|
|
|
33
|
-
export { type Logger, type MetricsClient, Middleware, createLoggingMiddleware, createMetricsMiddleware, isCommandError };
|
|
71
|
+
export { Command, CreatePayment, CreatePaymentInput, GetPayment, GetPayments, type Logger, type MetricsClient, Middleware, Payment, UpdatePayment, UpdatePaymentInput, createLoggingMiddleware, createMetricsMiddleware, isCommandError };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkNVFP3TSFjs = require('./chunk-NVFP3TSF.js');var _chunkBDI3SHA2js = require('./chunk-BDI3SHA2.js');var _chunkOGW7GTJPjs = require('./chunk-OGW7GTJP.js');var u=(r=console)=>({before:async e=>{r.info(`Executing ${e.metadata.commandName}`,{input:e.input,metadata:e.metadata})},after:async(e,t)=>{r.info(`Completed ${e.metadata.commandName}`,{response:t,metadata:e.metadata})},onError:async(e,t)=>{r.error(`Error in ${e.metadata.commandName}`,{error:t,input:e.input,metadata:e.metadata})}});var x=r=>({before:async e=>{r.incrementCounter(`${e.metadata.commandName}_started`)},after:async e=>{r.incrementCounter(`${e.metadata.commandName}_completed`)},onError:async(e,t)=>{r.incrementCounter(`${e.metadata.commandName}_error`),r.recordError&&typeof r.recordError=="function"&&r.recordError(t)}});exports.CreatePayment = _chunkNVFP3TSFjs.a; exports.GetClientData = _chunkBDI3SHA2js.c; exports.GetPayment = _chunkNVFP3TSFjs.b; exports.GetPayments = _chunkNVFP3TSFjs.d; exports.GraphQL = _chunkBDI3SHA2js.f; exports.SendAuthorizationToCore = _chunkBDI3SHA2js.a; exports.UpdateCardID = _chunkBDI3SHA2js.b; exports.UpdateClient = _chunkBDI3SHA2js.d; exports.UpdateClientIdentifier = _chunkBDI3SHA2js.e; exports.UpdatePayment = _chunkNVFP3TSFjs.c; exports.createClient = _chunkNVFP3TSFjs.e; exports.createLoggingMiddleware = u; exports.createMetricsMiddleware = x; exports.isCommandError = _chunkOGW7GTJPjs.b;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o
|
|
1
|
+
import{a as o,b as n,c as m,d,e as i}from"./chunk-LXODYKLU.mjs";import{a as p,b as s,c,d as y,e as f,f as g}from"./chunk-5PEETHWV.mjs";import{b as a}from"./chunk-RX3BFHHX.mjs";var u=(r=console)=>({before:async e=>{r.info(`Executing ${e.metadata.commandName}`,{input:e.input,metadata:e.metadata})},after:async(e,t)=>{r.info(`Completed ${e.metadata.commandName}`,{response:t,metadata:e.metadata})},onError:async(e,t)=>{r.error(`Error in ${e.metadata.commandName}`,{error:t,input:e.input,metadata:e.metadata})}});var x=r=>({before:async e=>{r.incrementCounter(`${e.metadata.commandName}_started`)},after:async e=>{r.incrementCounter(`${e.metadata.commandName}_completed`)},onError:async(e,t)=>{r.incrementCounter(`${e.metadata.commandName}_error`),r.recordError&&typeof r.recordError=="function"&&r.recordError(t)}});export{o as CreatePayment,c as GetClientData,n as GetPayment,d as GetPayments,g as GraphQL,p as SendAuthorizationToCore,s as UpdateCardID,y as UpdateClient,f as UpdateClientIdentifier,m as UpdatePayment,i as createClient,u as createLoggingMiddleware,x as createMetricsMiddleware,a as isCommandError};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbanq/core-sdk-js",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.6",
|
|
4
4
|
"description": "A comprehensive JavaScript SDK for interacting with the Mbanq payment API. Features type-safe payment operations, multi-tenant support, and Zod validation.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -87,6 +87,7 @@
|
|
|
87
87
|
"graphql": "^16.11.0",
|
|
88
88
|
"jsonwebtoken": "^9.0.2",
|
|
89
89
|
"moment-timezone": "^0.6.0",
|
|
90
|
-
"uuid": "^11.1.0"
|
|
90
|
+
"uuid": "^11.1.0",
|
|
91
|
+
"zod": "^4.0.17"
|
|
91
92
|
}
|
|
92
93
|
}
|
package/dist/chunk-4TZWTPAO.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as f}from"./chunk-YPDJGVWM.mjs";var u=r=>{let t=[];if(!r.baseUrl)t.push("baseUrl is required");else if(typeof r.baseUrl!="string")t.push("baseUrl must be a string");else try{new URL(r.baseUrl)}catch{t.push("baseUrl must be a valid URL")}return r.axiosConfig?.timeout!==void 0&&(typeof r.axiosConfig.timeout!="number"||r.axiosConfig.timeout<0)&&t.push("timeout must be a positive number"),t};var C=r=>{let t=u(r);if(t.length>0)throw f({message:`Invalid configuration: ${t.join(", ")}`,code:"invalid_config"});let n=async(e,o,s)=>{if(r.middlewares)for(let a of r.middlewares)e==="before"&&a.before?await a.before(o):e==="after"&&a.after?await a.after(o,s):e==="onError"&&a.onError&&await a.onError(o,s)},i={...r};return{setConfig:e=>{i=e},updateConfig:e=>{let o={...i,...e,axiosConfig:{...i.axiosConfig,...e.axiosConfig,headers:{...i.axiosConfig?.headers,...e.axiosConfig?.headers}}},s=u(o);if(s.length>0)throw f({message:`Invalid configuration: ${s.join(", ")}`,code:"invalid_config"});i=o},resetConfig:()=>{i=r},request:async e=>{try{await n("before",e);let o=await e.execute(i);return await n("after",e,o),o}catch(o){throw await n("onError",e,o),o}}}};export{C as a};
|
package/dist/chunk-E4GWSVC5.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);var a=({message:s,statusCode:e,code:t,requestId:o,originalError:n})=>({name:"CommandError",message:s,statusCode:e,code:t,requestId:o,originalError:n}),d= exports.b =s=>typeof s=="object"&&s!==null&&"name"in s&&s.name==="CommandError",i=s=>{if(!s||typeof s!="object")return s;let e={...s};if(e.config&&typeof e.config=="object"){let t=e.config;if(t.httpsAgent&&typeof t.httpsAgent=="object"){let o=t.httpsAgent;delete o.sockets,delete o.freeSockets,delete o._sessionCache}}return e},m= exports.c =s=>{if(_axios2.default.isAxiosError(s)){let e=_optionalChain([s, 'access', _ => _.response, 'optionalAccess', _2 => _2.data, 'optionalAccess', _3 => _3.message]),t=_optionalChain([s, 'access', _4 => _4.response, 'optionalAccess', _5 => _5.status])?`Request failed with status code ${s.response.status}`:s.message||"Request failed";throw a({message:e||t,statusCode:_optionalChain([s, 'access', _6 => _6.response, 'optionalAccess', _7 => _7.status]),code:s.code,requestId:_optionalChain([s, 'access', _8 => _8.response, 'optionalAccess', _9 => _9.headers, 'optionalAccess', _10 => _10["x-request-id"]]),originalError:i(s)})}throw s};exports.a = a; exports.b = d; exports.c = m;
|
package/dist/chunk-XGUW3EAC.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkE4GWSVC5js = require('./chunk-E4GWSVC5.js');var u=r=>{let t=[];if(!r.baseUrl)t.push("baseUrl is required");else if(typeof r.baseUrl!="string")t.push("baseUrl must be a string");else try{new URL(r.baseUrl)}catch (e2){t.push("baseUrl must be a valid URL")}return _optionalChain([r, 'access', _ => _.axiosConfig, 'optionalAccess', _2 => _2.timeout])!==void 0&&(typeof r.axiosConfig.timeout!="number"||r.axiosConfig.timeout<0)&&t.push("timeout must be a positive number"),t};var C=r=>{let t=u(r);if(t.length>0)throw _chunkE4GWSVC5js.a.call(void 0, {message:`Invalid configuration: ${t.join(", ")}`,code:"invalid_config"});let n=async(e,o,s)=>{if(r.middlewares)for(let a of r.middlewares)e==="before"&&a.before?await a.before(o):e==="after"&&a.after?await a.after(o,s):e==="onError"&&a.onError&&await a.onError(o,s)},i={...r};return{setConfig:e=>{i=e},updateConfig:e=>{let o={...i,...e,axiosConfig:{...i.axiosConfig,...e.axiosConfig,headers:{..._optionalChain([i, 'access', _3 => _3.axiosConfig, 'optionalAccess', _4 => _4.headers]),..._optionalChain([e, 'access', _5 => _5.axiosConfig, 'optionalAccess', _6 => _6.headers])}}},s=u(o);if(s.length>0)throw _chunkE4GWSVC5js.a.call(void 0, {message:`Invalid configuration: ${s.join(", ")}`,code:"invalid_config"});i=o},resetConfig:()=>{i=r},request:async e=>{try{await n("before",e);let o=await e.execute(i);return await n("after",e,o),o}catch(o){throw await n("onError",e,o),o}}}};exports.a = C;
|