@mbanq/core-sdk-js 1.0.0-alpha.5

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Mbanq Cloud Devs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,405 @@
1
+ # Core SDK JS
2
+ ## Table of Contents
3
+
4
+ - ### Introduction
5
+ - ### Installation
6
+ - ### Authentication
7
+ - ### Setup
8
+ - #### Axios Instance Logger
9
+ - ### Middleware
10
+ - #### Logging Middleware
11
+ - #### Metrics Middleware
12
+ - #### Custom Middleware
13
+ - ### API Reference
14
+ - #### Transfer Operations
15
+ - #### GetTransfers
16
+ - #### LogFail Transfer
17
+ - #### MarkAsFail
18
+ - #### MarkAsProcessing
19
+ - #### MarkAsReturned
20
+ - ### Custom API
21
+ - #### Custom Get
22
+ - #### Custom Create
23
+ - #### Custom Update
24
+ - ### Error Handling
25
+ - ### Examples
26
+
27
+ ## Introduction
28
+ This library provides a set of JavaScript functions for interacting with our transfer management API. It simplifies the process of handling transfers and managing their statuses throughout their lifecycle.
29
+ ## Installation
30
+
31
+ ```bash
32
+ npm install @mbanq/core-sdk-js
33
+ ```
34
+ ## Setup
35
+ Before using any of the library functions, you need to initialize the client with your API credentials:
36
+ ```javascript
37
+ const coreSDK = createClient({
38
+ secret: 'testing123',
39
+ signee: 'TESTING',
40
+ baseUrl: 'https://example.com',
41
+ tenantId: 'testing'
42
+ });
43
+ ```
44
+
45
+ ### Axios Instance Logger
46
+ You can also configure an Axios instance logger to set up interceptors or other axios-specific configurations:
47
+
48
+ ```javascript
49
+ const axiosLogger = (axiosInstance) => {
50
+ // Add request interceptor
51
+ axiosInstance.interceptors.request.use(
52
+ (config) => {
53
+ console.log('Request:', config.method?.toUpperCase(), config.url);
54
+ return config;
55
+ }
56
+ );
57
+
58
+ // Add response interceptor
59
+ axiosInstance.interceptors.response.use(
60
+ (response) => {
61
+ console.log('Response:', response.status, response.config.url);
62
+ return response;
63
+ }
64
+ );
65
+ };
66
+
67
+ const coreSDK = createClient({
68
+ secret: 'testing123',
69
+ signee: 'TESTING',
70
+ baseUrl: 'https://example.com',
71
+ tenantId: 'testing',
72
+ logger: axiosLogger // Configure Axios instance
73
+ });
74
+ ```
75
+
76
+ ## Middleware
77
+ The SDK supports middleware for cross-cutting concerns like logging and metrics. Middleware functions are executed automatically around command execution.
78
+
79
+ **Note**: This is different from the Axios instance logger above. Middleware loggers handle command-level logging, while the Axios logger handles HTTP request/response logging.
80
+
81
+ ### Available Middleware
82
+
83
+ #### Logging Middleware
84
+ Logs command execution details including inputs, outputs, and errors.
85
+
86
+ ```javascript
87
+ import { createClient, createLoggingMiddleware } from '@mbanq/core-sdk-js';
88
+
89
+ const loggingMiddleware = createLoggingMiddleware(console); // or custom logger
90
+
91
+ const client = createClient({
92
+ secret: 'testing123',
93
+ signee: 'TESTING',
94
+ baseUrl: 'https://example.com',
95
+ tenantId: 'testing',
96
+ middlewares: [loggingMiddleware]
97
+ });
98
+ ```
99
+
100
+ #### Logger Interface
101
+ For custom loggers, implement the Logger interface:
102
+
103
+ ```typescript
104
+ interface Logger {
105
+ info: (message: string, ...args: unknown[]) => void;
106
+ error: (message: string, ...args: unknown[]) => void;
107
+ warn?: (message: string, ...args: unknown[]) => void; // Optional
108
+ log?: (message: string, ...args: unknown[]) => void; // Optional
109
+ }
110
+
111
+ // Example with a custom logger
112
+ const customLogger = {
113
+ info: (message, ...args) => myLoggingService.info(message, args),
114
+ error: (message, ...args) => myLoggingService.error(message, args),
115
+ warn: (message, ...args) => myLoggingService.warn(message, args)
116
+ };
117
+
118
+ const middleware = createLoggingMiddleware(customLogger);
119
+ ```
120
+
121
+ #### Metrics Middleware
122
+ Tracks command execution metrics including counters for started, completed, and error events.
123
+
124
+ ```javascript
125
+ import { createClient, createMetricsMiddleware } from '@mbanq/core-sdk-js';
126
+
127
+ // Your metrics client must implement the MetricsClient interface
128
+ const metricsClient = {
129
+ incrementCounter: (counterName) => {
130
+ // Increment your counter (e.g., Prometheus, StatsD, etc.)
131
+ console.log(`Counter: ${counterName}`);
132
+ },
133
+ recordError: (error) => {
134
+ // Optional: Record error details
135
+ console.error('Command error:', error);
136
+ }
137
+ };
138
+
139
+ const metricsMiddleware = createMetricsMiddleware(metricsClient);
140
+
141
+ const client = createClient({
142
+ secret: 'testing123',
143
+ signee: 'TESTING',
144
+ baseUrl: 'https://example.com',
145
+ tenantId: 'testing',
146
+ middlewares: [metricsMiddleware]
147
+ });
148
+ ```
149
+
150
+ #### MetricsClient Interface
151
+ ```typescript
152
+ interface MetricsClient {
153
+ incrementCounter: (counterName: string) => void;
154
+ recordError?: (error: Error) => void; // Optional
155
+ }
156
+ ```
157
+
158
+ #### Using Multiple Middleware
159
+ ```javascript
160
+ const client = createClient({
161
+ // ... other config
162
+ middlewares: [
163
+ createLoggingMiddleware(console),
164
+ createMetricsMiddleware(metricsClient)
165
+ ]
166
+ });
167
+ ```
168
+
169
+ #### Custom Middleware
170
+ You can create custom middleware by implementing the Middleware interface:
171
+
172
+ ```javascript
173
+ const customMiddleware = {
174
+ before: async (command) => {
175
+ // Called before command execution
176
+ console.log(`Starting ${command.metadata.commandName}`);
177
+ },
178
+ after: async (command, response) => {
179
+ // Called after successful execution
180
+ console.log(`Completed ${command.metadata.commandName}`, response);
181
+ },
182
+ onError: async (command, error) => {
183
+ // Called when command fails
184
+ console.error(`Error in ${command.metadata.commandName}`, error);
185
+ }
186
+ };
187
+
188
+ const client = createClient({
189
+ // ... other config
190
+ middlewares: [customMiddleware]
191
+ });
192
+ ```
193
+
194
+ ## API Reference
195
+ ### Transfer Operations
196
+ ### `GetTransfers(options)`
197
+
198
+ Retrieves a list of transfers based on the provided options.
199
+ #### Parameters:
200
+
201
+ - `options (Object)`
202
+ - `transferStatus` (String, optional): Filter by transfer status
203
+ - `executedAt` (Date): Filter executed transfers from this date
204
+ - `queryLimit` (Date, optional): Number of results per page
205
+ - `paymentType` (String): Filter by paymentType
206
+ - `tenantId` (String, optional): Set tenant ID
207
+
208
+ #### Returns:
209
+
210
+ - Promise`<Array>` of transfer objects
211
+
212
+ #### Example:
213
+ ```javascript
214
+ const command = GetTransfers({
215
+ transferStatus: 'EXECUTION_SCHEDULED',
216
+ executedAt: '2025-01-22',
217
+ paymentType: 'ACH',
218
+ queryLimit: 200,
219
+ tenantId: 'default'
220
+ });
221
+ await coreSDK.request(command);
222
+ ```
223
+ ### `LogFailTransfer(params)`
224
+
225
+ Logs a failed transfer with the specified reason.
226
+ #### Parameters:
227
+ - `params (Object)`
228
+ - `payload` (Transfer): The payload of transfer
229
+ - `tanantId` (String): tenant ID
230
+
231
+ #### Returns:
232
+
233
+ - Promise`<Object>`
234
+
235
+ ### `MarkAsFail(options)`
236
+
237
+ Marks a transfer as failed.
238
+ #### Parameters:
239
+
240
+ - `options`
241
+ - `externalId`: (String)
242
+ - `paymentType`: (String, optional)
243
+ - `tenantId`: (String, optional)
244
+
245
+ #### Returns:
246
+
247
+ - Promise`<Object>`
248
+ - `id`: (string)
249
+ - `clientId`: (number)
250
+ - `resourceId`: (number)
251
+ - `resourceIdentifier`: (string)
252
+
253
+ ### `MarkAsProcessing(options)`
254
+
255
+ Marks a transfer as currently processing.
256
+ #### Parameters:
257
+
258
+ - `options`
259
+ - `externalId`: (string)
260
+ - `fileUrl`: (string)
261
+ - `paymentType`: (string)
262
+ - `traceNumbers`: (Object)
263
+ - `outgoingTransfer`: (string)
264
+ - `tenantId`: (string, optional)
265
+
266
+ #### Returns:
267
+
268
+ - Promise`<Object>`
269
+ - `id`: (string)
270
+ - `clientId`: (number)
271
+ - `resourceId`: (number)
272
+ - `resourceIdentifier`: (string)
273
+
274
+ ### `MarkAsReturned(transferId)`
275
+
276
+ Marks a transfer as returned.
277
+ #### Parameters:
278
+
279
+ - `options`
280
+ - `paymentType`: (string)
281
+ - `externalId`: (string)
282
+ - `returnFileUrl`: (string)
283
+ - `errorCode`: (string)
284
+ - `errorMessage`: (string)
285
+ - `returnDate`: (Date, optional)
286
+ - `traceNumbers`: (Object)
287
+ - `incomingReturnFile`?: (string, optional)
288
+ - `outgoingReturnFile`: (string, optional)
289
+ - `rawReturnDetails`: (any, optional)
290
+ - `tenantId`: (string, optional)
291
+
292
+ #### Returns:
293
+
294
+ - Promise`<Object>`
295
+ - `id`: (string)
296
+ - `clientId`: (number)
297
+ - `resourceId`: (number)
298
+ - `resourceIdentifier`: (string)
299
+
300
+ ### Custom API
301
+ ### `Custom Get`
302
+
303
+ Retrieves any records based on the provided options.
304
+
305
+ #### Parameters:
306
+
307
+ - `options (Object)`
308
+ - `commandName` (String, optional): Set command name base on you want beside name CustomGet
309
+ - `url` (String): The url that use to request to get something but not include baseURL
310
+ - `tenantId` (String, optional): Set tenant ID
311
+
312
+ #### Returns:
313
+
314
+ - Promise`<any>`
315
+
316
+ ### `Custom Create`
317
+
318
+ Create any record or something based on the provided options.
319
+
320
+ #### Parameters:
321
+
322
+ - `options (Object)`
323
+ - `data` (Object): any values that use to create somthing
324
+ - `commandName` (String, optional): Set command name base on you want beside name CustomGet
325
+ - `url` (String): The url that use to request to get something but not include baseURL
326
+ - `tenantId` (String, optional): Set tenant ID
327
+
328
+ #### Returns:
329
+
330
+ - Promise`<any>`
331
+
332
+ ### `Custom Update`
333
+
334
+ Update any record or something based on the provided options.
335
+
336
+ #### Parameters:
337
+
338
+ - `options (Object)`
339
+ - `update` (Object): any values that use to update somthing
340
+ - `commandName` (String, optional): Set command name base on you want beside name CustomGet
341
+ - `url` (String): The url that use to request to get something but not include baseURL
342
+ - `tenantId` (String, optional): Set tenant ID
343
+
344
+ #### Returns:
345
+
346
+ - Promise`<any>`
347
+
348
+ ## Error Handling
349
+ The library uses a consistent error handling pattern. All API calls may throw the following errors:
350
+
351
+ - `AuthenticationError`: Invalid or missing API credentials
352
+ - `ValidationError`: Invalid parameters provided
353
+ - `ApiError`: General API error with specific error code and message
354
+ - `NetworkError`: Network-related issues
355
+
356
+ ## Examples
357
+ ### Complete Transfer Flow Example
358
+ ```javascript
359
+ // Initialize the client
360
+ const coreSDK = createClient({ secret: 'testing123', signee: 'TESTING', baseUrl: 'https://example.com', tenantId: 'testing' });
361
+
362
+ // Get schedule transfers
363
+ const command = GetTransfers({
364
+ transferStatus: 'EXECUTION_SCHEDULED',
365
+ executedAt: '2025-01-22',
366
+ paymentType: 'ACH',
367
+ queryLimit: 200,
368
+ tenantId: 'default'
369
+ });
370
+ const scheduleTransfers = await coreSDK.request(command);
371
+
372
+ // Process each transfer
373
+ for (const transfer of scheduleTransfers) {
374
+ try {
375
+ // Mark as processing
376
+ const markProcessing = MarkAsProcessing({
377
+ externalId: transfer.externalId,
378
+ fileUrl: transfer.fileUrl,
379
+ paymentType: 'ACH',
380
+ traceNumbers: {
381
+ outgoingTransfer: '123456'
382
+ },
383
+ tenantId: 'default'
384
+ })
385
+ await coreSDK.request(markProcessing);
386
+
387
+ // Your processing logic here
388
+
389
+ // If processing fails
390
+ if (/* some condition */) {
391
+ const markFail = MarkAsFail({
392
+ externalId: transfer.externalId,
393
+ errorMessage: 'error testing',
394
+ paymentType: 'ACH',
395
+ tenantId: 'default'
396
+ })
397
+ await coreSDK.request(markFail);
398
+ }
399
+ } catch (error) {
400
+ console.error(`Error processing transfer ${transfer.id}:`, error);
401
+ }
402
+ }
403
+ ```
404
+
405
+ For more detailed information or support, please contact our support team or visit our developer portal.
@@ -0,0 +1 @@
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};
@@ -0,0 +1 @@
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;
@@ -0,0 +1 @@
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;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } 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 _chunkE4GWSVC5js = require('./chunk-E4GWSVC5.js');var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);var _uuid = require('uuid');var _https = require('https'); var f = _interopRequireWildcard(_https);var _jsonwebtoken = require('jsonwebtoken'); var _jsonwebtoken2 = _interopRequireDefault(_jsonwebtoken);var p=(t,e)=>{if(!t)throw new Error("Missing JWT secret");return _jsonwebtoken2.default.sign({signee:e},t,{algorithm:"HS512",expiresIn:"1d"})||""},l=async(t,e,n,r)=>{let a={method:"POST",url:`${e}/oauth/token`,headers:{"Content-Type":"application/x-www-form-urlencoded",tenantId:n},data:r},{data:{access_token:i}}=await _axios2.default.request(a);return t=i,t};var I={token:""},s= exports.a =async t=>{let n=_axios2.default.create({timeout:_optionalChain([t, 'access', _2 => _2.axiosConfig, 'optionalAccess', _3 => _3.timeout])||29e3,baseURL:t.baseUrl,headers:{"Content-Type":"application/json; charset=utf-8","JWT-Token":_optionalChain([t, 'optionalAccess', _4 => _4.secret])?`${p(_optionalChain([t, 'optionalAccess', _5 => _5.secret]),_optionalChain([t, 'optionalAccess', _6 => _6.signee])||"")}`:void 0,Authorization:t.credential?`Bearer ${I.token||await l(I.token,t.baseUrl,t.tenantId,t.credential)}`:void 0,"trace-id":t.traceId||`RequestUUID=${_uuid.v4.call(void 0, )}`,tenantId:t.tenantId},httpsAgent:new f.Agent({rejectUnauthorized:!0,keepAlive:_optionalChain([t, 'access', _7 => _7.axiosConfig, 'optionalAccess', _8 => _8.keepAlive])})});return t.logger&&t.logger(n),n};var _=t=>({input:t,metadata:{commandName:"CreateTransfer",path:"/v1/transfers",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.post("/v1/transfers",t.transfer)).data}catch(r){_chunkE4GWSVC5js.c.call(void 0, r)}}}),G= exports.c =t=>({input:t,metadata:{commandName:"GetTransfer",path:`/v1/transfers/${t.id}`,method:"GET"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.get(`/v1/transfers/${t.id}`)).data}catch(r){_chunkE4GWSVC5js.c.call(void 0, r)}}}),M= exports.d =t=>{let e={paymentType:t.paymentType,status:t.transferStatus||"EXECUTION_SCHEDULED",toExecuteDate:t.executedAt,locale:"en",dateFormat:"yyyy-MM-dd",associateClientData:!0,originatedBy:"us",accountType:t.accountType};return{input:t,metadata:{commandName:"GetTransfers",path:"/v1/transfers",method:"GET"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let r=await s(n),a=[],i=t.queryLimit||200,d=0,m=0,g={...e,limit:i,offset:d};try{do{let u=await r.get("/v1/transfers",{params:g}),{totalFilteredRecords:C,pageItems:h}=u.data;a.push(...h),m=C,d+=i}while(d<m);return a}catch(u){_chunkE4GWSVC5js.c.call(void 0, u)}}}},L= exports.e =t=>{let e={...t,paymentType:t.paymentType||"ACH"};return{input:t,metadata:{commandName:"MarkAsSuccess",path:"/v1/external-transfers?command=MARK_AS_SUCCESS",method:"POST"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let r=await s(n);try{return(await r.post("/v1/external-transfers?command=MARK_AS_SUCCESS",e)).data}catch(a){_chunkE4GWSVC5js.c.call(void 0, a)}}}},q= exports.f =t=>({input:t,metadata:{commandName:"MarkAsProcessing",path:"/v1/external-transfers?command=MARK_AS_PROCESSING",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.post("/v1/external-transfers?command=MARK_AS_PROCESSING",t)).data}catch(r){_chunkE4GWSVC5js.c.call(void 0, r)}}}),F= exports.g =t=>({input:t,metadata:{commandName:"MarkAsReturned",path:"/v1/external-transfers?command=MARK_AS_RETURN",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.post("/v1/external-transfers?command=MARK_AS_RETURN",{...t})).data}catch(r){_chunkE4GWSVC5js.c.call(void 0, r)}}}),z= exports.h =t=>{let e={...t.payload};return{input:t,metadata:{commandName:"LogFailTransfer",path:"/v1/external-transfers?command=LOG_FAILURE",method:"POST"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let r=await s(n);try{return(await r.post("/v1/external-transfers?command=LOG_FAILURE",e)).data}catch(a){throw _axios2.default.isAxiosError(a)?_chunkE4GWSVC5js.a.call(void 0, {message:"LogFailTransfer command failed",statusCode:_optionalChain([a, 'access', _9 => _9.response, 'optionalAccess', _10 => _10.status]),code:a.code,requestId:_optionalChain([a, 'access', _11 => _11.response, 'optionalAccess', _12 => _12.headers, 'optionalAccess', _13 => _13["x-request-id"]]),originalError:a}):a}}}},Q= exports.i =t=>({input:t,metadata:{commandName:"MarkAsFail",path:"/v1/external-transfers?command=MARK_AS_FAIL",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.post("/v1/external-transfers?command=MARK_AS_FAIL",t)).data}catch(r){_chunkE4GWSVC5js.c.call(void 0, r)}}}),j= exports.j =t=>{let e={traceNumbers:t.traceNumbers};return{input:t,metadata:{commandName:"UpdateTraceNumber",path:`/v1/external-transfers/${t.externalId}`,method:"PUT"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let r=await s(n);try{return(await r.put(`/v1/external-transfers/${t.externalId}`,e)).data}catch(a){_chunkE4GWSVC5js.c.call(void 0, a)}}}};var H=t=>{let e=t.skipNotification&&"?skipNotification=true"||"",n=t.card.cardType==="CREDIT"?"creditcards":"cards",r={...t.payload,query:e,flag:t.flag};return{input:t,metadata:{commandName:"SendAuthorizationToCore",path:`/${n}/${t.card.internalCardId}/authorization${e}`,method:"POST"},execute:async a=>{t.tenantId&&(a.tenantId=t.tenantId);let i=await s(a);try{return await i.post(`/${n}/${t.card.internalCardId}/authorization${e}`,r)}catch(d){_chunkE4GWSVC5js.c.call(void 0, d)}}}},B= exports.l =t=>({input:t,metadata:{commandName:"UpdateCardID",path:`/clients/${t.clientId}`,method:"PUT"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{await n.put(`/clients/${t.clientId}`,{businessCardIDURL:t.businessCardIDURL,businessCardIDQRCode:t.businessCardIDQRCode})}catch(r){_chunkE4GWSVC5js.c.call(void 0, r)}}});var Z=t=>({input:t,metadata:{commandName:"GetClientData",path:`/v1/clients/${t.clientId}`,method:"GET"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e),r={clientData:void 0,riskRatingData:void 0,clientAddressData:void 0,clientIdentifierData:void 0};try{return r.clientData=await n.get(`/v1/clients/${t.clientId}`),t.riskRating&&(r.riskRatingData=await n.get(`/v1/clients/${t.clientId}/riskrating`)),t.clientAddress&&(r.clientAddressData=await n.get(`/v1/client/${t.clientId}/addresses`)),t.clientIdentifier&&(r.clientIdentifierData=await n.get(`/v1/clients/${t.clientId}/identifiers?unmaskValue=true`)),r}catch(a){_chunkE4GWSVC5js.c.call(void 0, a)}}}),tt= exports.n =t=>({input:t,metadata:{commandName:"UpdateClient",path:`/v1/clients/${t.clientId}`,method:"PUT"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.put(`/v1/clients/${t.clientId}`,{...t.updates})).data}catch(r){_chunkE4GWSVC5js.c.call(void 0, r)}}}),et= exports.o =t=>({input:t,metadata:{commandName:"UpdateClientIdentifier",path:`/v1/clients/${t.clientId}/identifiers/${t.identifierId}`,method:"PUT"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.put(`/v1/clients/${t.clientId}/identifiers/${t.identifierId}`,{...t.updates})).data}catch(r){_chunkE4GWSVC5js.c.call(void 0, r)}}});var _graphql = require('graphql');var ot=t=>({input:t,metadata:{commandName:t.operationName||"GraphQL",path:"/graphql",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e),r=e.graphqlPath||"/graphql";try{let a=typeof t.command=="string"?t.command:_graphql.print.call(void 0, t.command),{data:i}=await n.post(r,{query:a,variables:t.variables,operationName:t.operationName});if(_optionalChain([i, 'access', _14 => _14.errors, 'optionalAccess', _15 => _15.length]))throw _chunkE4GWSVC5js.a.call(void 0, {message:i.errors[0].message,code:"graphql_error",originalError:i.errors[0]});if(!i.data)throw _chunkE4GWSVC5js.a.call(void 0, {message:"No data returned from GraphQL query",code:"graphql_no_data"});return i.data}catch(a){throw a.name==="CommandError"?a:_chunkE4GWSVC5js.a.call(void 0, {message:a.message,code:"graphql_request_failed",originalError:a})}}});exports.a = s; exports.b = _; exports.c = G; exports.d = M; exports.e = L; exports.f = q; exports.g = F; exports.h = z; exports.i = Q; exports.j = j; exports.k = H; exports.l = B; exports.m = Z; exports.n = tt; exports.o = et; exports.p = ot;
@@ -0,0 +1 @@
1
+ import r from"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=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=s=>{if(r.isAxiosError(s)){let e=s.response?.data?.message,t=s.response?.status?`Request failed with status code ${s.response.status}`:s.message||"Request failed";throw a({message:e||t,statusCode:s.response?.status,code:s.code,requestId:s.response?.headers?.["x-request-id"],originalError:i(s)})}throw s};export{a,d as b,m as c};
@@ -0,0 +1 @@
1
+ import{a as c,c as o}from"./chunk-YPDJGVWM.mjs";import T from"axios";import{v4 as R}from"uuid";import*as f from"https";import y from"axios";import x from"jsonwebtoken";var p=(t,e)=>{if(!t)throw new Error("Missing JWT secret");return x.sign({signee:e},t,{algorithm:"HS512",expiresIn:"1d"})||""},l=async(t,e,n,r)=>{let a={method:"POST",url:`${e}/oauth/token`,headers:{"Content-Type":"application/x-www-form-urlencoded",tenantId:n},data:r},{data:{access_token:i}}=await y.request(a);return t=i,t};var I={token:""},s=async t=>{let n=T.create({timeout:t.axiosConfig?.timeout||29e3,baseURL:t.baseUrl,headers:{"Content-Type":"application/json; charset=utf-8","JWT-Token":t?.secret?`${p(t?.secret,t?.signee||"")}`:void 0,Authorization:t.credential?`Bearer ${I.token||await l(I.token,t.baseUrl,t.tenantId,t.credential)}`:void 0,"trace-id":t.traceId||`RequestUUID=${R()}`,tenantId:t.tenantId},httpsAgent:new f.Agent({rejectUnauthorized:!0,keepAlive:t.axiosConfig?.keepAlive})});return t.logger&&t.logger(n),n};import A from"axios";var _=t=>({input:t,metadata:{commandName:"CreateTransfer",path:"/v1/transfers",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.post("/v1/transfers",t.transfer)).data}catch(r){o(r)}}}),G=t=>({input:t,metadata:{commandName:"GetTransfer",path:`/v1/transfers/${t.id}`,method:"GET"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.get(`/v1/transfers/${t.id}`)).data}catch(r){o(r)}}}),M=t=>{let e={paymentType:t.paymentType,status:t.transferStatus||"EXECUTION_SCHEDULED",toExecuteDate:t.executedAt,locale:"en",dateFormat:"yyyy-MM-dd",associateClientData:!0,originatedBy:"us",accountType:t.accountType};return{input:t,metadata:{commandName:"GetTransfers",path:"/v1/transfers",method:"GET"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let r=await s(n),a=[],i=t.queryLimit||200,d=0,m=0,g={...e,limit:i,offset:d};try{do{let u=await r.get("/v1/transfers",{params:g}),{totalFilteredRecords:C,pageItems:h}=u.data;a.push(...h),m=C,d+=i}while(d<m);return a}catch(u){o(u)}}}},L=t=>{let e={...t,paymentType:t.paymentType||"ACH"};return{input:t,metadata:{commandName:"MarkAsSuccess",path:"/v1/external-transfers?command=MARK_AS_SUCCESS",method:"POST"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let r=await s(n);try{return(await r.post("/v1/external-transfers?command=MARK_AS_SUCCESS",e)).data}catch(a){o(a)}}}},q=t=>({input:t,metadata:{commandName:"MarkAsProcessing",path:"/v1/external-transfers?command=MARK_AS_PROCESSING",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.post("/v1/external-transfers?command=MARK_AS_PROCESSING",t)).data}catch(r){o(r)}}}),F=t=>({input:t,metadata:{commandName:"MarkAsReturned",path:"/v1/external-transfers?command=MARK_AS_RETURN",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.post("/v1/external-transfers?command=MARK_AS_RETURN",{...t})).data}catch(r){o(r)}}}),z=t=>{let e={...t.payload};return{input:t,metadata:{commandName:"LogFailTransfer",path:"/v1/external-transfers?command=LOG_FAILURE",method:"POST"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let r=await s(n);try{return(await r.post("/v1/external-transfers?command=LOG_FAILURE",e)).data}catch(a){throw A.isAxiosError(a)?c({message:"LogFailTransfer command failed",statusCode:a.response?.status,code:a.code,requestId:a.response?.headers?.["x-request-id"],originalError:a}):a}}}},Q=t=>({input:t,metadata:{commandName:"MarkAsFail",path:"/v1/external-transfers?command=MARK_AS_FAIL",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.post("/v1/external-transfers?command=MARK_AS_FAIL",t)).data}catch(r){o(r)}}}),j=t=>{let e={traceNumbers:t.traceNumbers};return{input:t,metadata:{commandName:"UpdateTraceNumber",path:`/v1/external-transfers/${t.externalId}`,method:"PUT"},execute:async n=>{t.tenantId&&(n.tenantId=t.tenantId);let r=await s(n);try{return(await r.put(`/v1/external-transfers/${t.externalId}`,e)).data}catch(a){o(a)}}}};var H=t=>{let e=t.skipNotification&&"?skipNotification=true"||"",n=t.card.cardType==="CREDIT"?"creditcards":"cards",r={...t.payload,query:e,flag:t.flag};return{input:t,metadata:{commandName:"SendAuthorizationToCore",path:`/${n}/${t.card.internalCardId}/authorization${e}`,method:"POST"},execute:async a=>{t.tenantId&&(a.tenantId=t.tenantId);let i=await s(a);try{return await i.post(`/${n}/${t.card.internalCardId}/authorization${e}`,r)}catch(d){o(d)}}}},B=t=>({input:t,metadata:{commandName:"UpdateCardID",path:`/clients/${t.clientId}`,method:"PUT"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{await n.put(`/clients/${t.clientId}`,{businessCardIDURL:t.businessCardIDURL,businessCardIDQRCode:t.businessCardIDQRCode})}catch(r){o(r)}}});var Z=t=>({input:t,metadata:{commandName:"GetClientData",path:`/v1/clients/${t.clientId}`,method:"GET"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e),r={clientData:void 0,riskRatingData:void 0,clientAddressData:void 0,clientIdentifierData:void 0};try{return r.clientData=await n.get(`/v1/clients/${t.clientId}`),t.riskRating&&(r.riskRatingData=await n.get(`/v1/clients/${t.clientId}/riskrating`)),t.clientAddress&&(r.clientAddressData=await n.get(`/v1/client/${t.clientId}/addresses`)),t.clientIdentifier&&(r.clientIdentifierData=await n.get(`/v1/clients/${t.clientId}/identifiers?unmaskValue=true`)),r}catch(a){o(a)}}}),tt=t=>({input:t,metadata:{commandName:"UpdateClient",path:`/v1/clients/${t.clientId}`,method:"PUT"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.put(`/v1/clients/${t.clientId}`,{...t.updates})).data}catch(r){o(r)}}}),et=t=>({input:t,metadata:{commandName:"UpdateClientIdentifier",path:`/v1/clients/${t.clientId}/identifiers/${t.identifierId}`,method:"PUT"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e);try{return(await n.put(`/v1/clients/${t.clientId}/identifiers/${t.identifierId}`,{...t.updates})).data}catch(r){o(r)}}});import{print as P}from"graphql";var ot=t=>({input:t,metadata:{commandName:t.operationName||"GraphQL",path:"/graphql",method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await s(e),r=e.graphqlPath||"/graphql";try{let a=typeof t.command=="string"?t.command:P(t.command),{data:i}=await n.post(r,{query:a,variables:t.variables,operationName:t.operationName});if(i.errors?.length)throw c({message:i.errors[0].message,code:"graphql_error",originalError:i.errors[0]});if(!i.data)throw c({message:"No data returned from GraphQL query",code:"graphql_no_data"});return i.data}catch(a){throw a.name==="CommandError"?a:c({message:a.message,code:"graphql_request_failed",originalError:a})}}});export{s as a,_ as b,G as c,M as d,L as e,q as f,F as g,z as h,Q as i,j,H as k,B as l,Z as m,tt as n,et as o,ot as p};
@@ -0,0 +1,12 @@
1
+ import { C as Config, a as Command } from '../config.d-NcOIimSJ.mjs';
2
+ import 'graphql';
3
+ import 'axios';
4
+
5
+ declare const createClient: (initialConfig: Config) => {
6
+ setConfig: (config: Config) => void;
7
+ updateConfig: (config: Partial<Config>) => void;
8
+ resetConfig: () => void;
9
+ request: <TOutput>(command: Command<any, TOutput>) => Promise<TOutput | undefined>;
10
+ };
11
+
12
+ export { createClient };
@@ -0,0 +1,12 @@
1
+ import { C as Config, a as Command } from '../config.d-NcOIimSJ.js';
2
+ import 'graphql';
3
+ import 'axios';
4
+
5
+ declare const createClient: (initialConfig: Config) => {
6
+ setConfig: (config: Config) => void;
7
+ updateConfig: (config: Partial<Config>) => void;
8
+ resetConfig: () => void;
9
+ request: <TOutput>(command: Command<any, TOutput>) => Promise<TOutput | undefined>;
10
+ };
11
+
12
+ export { createClient };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXGUW3EACjs = require('../chunk-XGUW3EAC.js');require('../chunk-E4GWSVC5.js');exports.createClient = _chunkXGUW3EACjs.a;
@@ -0,0 +1 @@
1
+ import{a}from"../chunk-4TZWTPAO.mjs";import"../chunk-YPDJGVWM.mjs";export{a as createClient};
@@ -0,0 +1,34 @@
1
+ import { P as ProcessOutput } from '../index-CR5y5AHj.mjs';
2
+ export { C as CreateTransfer, f as GetClientData, d as GetTransfer, G as GetTransfers, i as GraphQL, L as LogFailTransfer, M as MarkAsFail, a as MarkAsProcessing, b as MarkAsReturned, c as MarkAsSuccess, S as SendAuthorizationToCore, e as UpdateCardID, g as UpdateClient, h as UpdateClientIdentifier, U as UpdateTraceNumber } from '../index-CR5y5AHj.mjs';
3
+ import { a as Command } from '../config.d-NcOIimSJ.mjs';
4
+ import 'graphql';
5
+ import 'axios';
6
+
7
+ interface CustomUpdateInput {
8
+ commandName?: string;
9
+ url: string;
10
+ tenantId?: string;
11
+ updates: object;
12
+ params?: Record<string, any>;
13
+ }
14
+
15
+ interface CustomCreateInput {
16
+ commandName?: string;
17
+ url: string;
18
+ tenantId?: string;
19
+ data: object;
20
+ params?: Record<string, any>;
21
+ }
22
+
23
+ interface CustomGetInput {
24
+ commandName?: string;
25
+ url: string;
26
+ tenantId?: string;
27
+ params?: Record<string, any>;
28
+ }
29
+
30
+ declare const CustomUpdate: (params: CustomUpdateInput) => Command<CustomUpdateInput, ProcessOutput>;
31
+ declare const CustomCreate: (params: CustomCreateInput) => Command<CustomCreateInput, ProcessOutput>;
32
+ declare const CustomGet: (params: CustomGetInput) => Command<CustomGetInput, any>;
33
+
34
+ export { CustomCreate, CustomGet, CustomUpdate };
@@ -0,0 +1,34 @@
1
+ import { P as ProcessOutput } from '../index-B5WvpVzR.js';
2
+ export { C as CreateTransfer, f as GetClientData, d as GetTransfer, G as GetTransfers, i as GraphQL, L as LogFailTransfer, M as MarkAsFail, a as MarkAsProcessing, b as MarkAsReturned, c as MarkAsSuccess, S as SendAuthorizationToCore, e as UpdateCardID, g as UpdateClient, h as UpdateClientIdentifier, U as UpdateTraceNumber } from '../index-B5WvpVzR.js';
3
+ import { a as Command } from '../config.d-NcOIimSJ.js';
4
+ import 'graphql';
5
+ import 'axios';
6
+
7
+ interface CustomUpdateInput {
8
+ commandName?: string;
9
+ url: string;
10
+ tenantId?: string;
11
+ updates: object;
12
+ params?: Record<string, any>;
13
+ }
14
+
15
+ interface CustomCreateInput {
16
+ commandName?: string;
17
+ url: string;
18
+ tenantId?: string;
19
+ data: object;
20
+ params?: Record<string, any>;
21
+ }
22
+
23
+ interface CustomGetInput {
24
+ commandName?: string;
25
+ url: string;
26
+ tenantId?: string;
27
+ params?: Record<string, any>;
28
+ }
29
+
30
+ declare const CustomUpdate: (params: CustomUpdateInput) => Command<CustomUpdateInput, ProcessOutput>;
31
+ declare const CustomCreate: (params: CustomCreateInput) => Command<CustomCreateInput, ProcessOutput>;
32
+ declare const CustomGet: (params: CustomGetInput) => Command<CustomGetInput, any>;
33
+
34
+ export { CustomCreate, CustomGet, CustomUpdate };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkXOV45AFRjs = require('../chunk-XOV45AFR.js');var _chunkE4GWSVC5js = require('../chunk-E4GWSVC5.js');var T=t=>({input:t,metadata:{commandName:t.commandName||"CustomUpdate",path:t.url,method:"PUT"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await _chunkXOV45AFRjs.a.call(void 0, e);try{return(await n.put(t.url,{...t.updates},{params:t.params})).data}catch(o){_chunkE4GWSVC5js.c.call(void 0, o)}}}),y= exports.CustomCreate =t=>({input:t,metadata:{commandName:t.commandName||"CustomCreate",path:t.url,method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await _chunkXOV45AFRjs.a.call(void 0, e);try{return(await n.post(t.url,t.data,{params:t.params})).data}catch(o){_chunkE4GWSVC5js.c.call(void 0, o)}}}),P= exports.CustomGet =t=>({input:t,metadata:{commandName:t.commandName||"CustomGet",path:t.url,method:"GET"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await _chunkXOV45AFRjs.a.call(void 0, e);try{return(await n.get(t.url,{params:t.params})).data}catch(o){_chunkE4GWSVC5js.c.call(void 0, o)}}});exports.CreateTransfer = _chunkXOV45AFRjs.b; exports.CustomCreate = y; exports.CustomGet = P; exports.CustomUpdate = T; exports.GetClientData = _chunkXOV45AFRjs.m; exports.GetTransfer = _chunkXOV45AFRjs.c; exports.GetTransfers = _chunkXOV45AFRjs.d; exports.GraphQL = _chunkXOV45AFRjs.p; exports.LogFailTransfer = _chunkXOV45AFRjs.h; exports.MarkAsFail = _chunkXOV45AFRjs.i; exports.MarkAsProcessing = _chunkXOV45AFRjs.f; exports.MarkAsReturned = _chunkXOV45AFRjs.g; exports.MarkAsSuccess = _chunkXOV45AFRjs.e; exports.SendAuthorizationToCore = _chunkXOV45AFRjs.k; exports.UpdateCardID = _chunkXOV45AFRjs.l; exports.UpdateClient = _chunkXOV45AFRjs.n; exports.UpdateClientIdentifier = _chunkXOV45AFRjs.o; exports.UpdateTraceNumber = _chunkXOV45AFRjs.j;
@@ -0,0 +1 @@
1
+ import{a as r,b as s,c as u,d as m,e as d,f as p,g as C,h as c,i,j as I,k as f,l as x,m as h,n as l,o as G,p as U}from"../chunk-ZC5XVPET.mjs";import{c as a}from"../chunk-YPDJGVWM.mjs";var T=t=>({input:t,metadata:{commandName:t.commandName||"CustomUpdate",path:t.url,method:"PUT"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await r(e);try{return(await n.put(t.url,{...t.updates},{params:t.params})).data}catch(o){a(o)}}}),y=t=>({input:t,metadata:{commandName:t.commandName||"CustomCreate",path:t.url,method:"POST"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await r(e);try{return(await n.post(t.url,t.data,{params:t.params})).data}catch(o){a(o)}}}),P=t=>({input:t,metadata:{commandName:t.commandName||"CustomGet",path:t.url,method:"GET"},execute:async e=>{t.tenantId&&(e.tenantId=t.tenantId);let n=await r(e);try{return(await n.get(t.url,{params:t.params})).data}catch(o){a(o)}}});export{s as CreateTransfer,y as CustomCreate,P as CustomGet,T as CustomUpdate,h as GetClientData,u as GetTransfer,m as GetTransfers,U as GraphQL,c as LogFailTransfer,i as MarkAsFail,p as MarkAsProcessing,C as MarkAsReturned,d as MarkAsSuccess,f as SendAuthorizationToCore,x as UpdateCardID,l as UpdateClient,G as UpdateClientIdentifier,I as UpdateTraceNumber};
@@ -0,0 +1,52 @@
1
+ import { DocumentNode } from 'graphql';
2
+ import { AxiosInstance } from 'axios';
3
+
4
+ interface Config {
5
+ credential?: Credential;
6
+ secret?: string;
7
+ baseUrl: string;
8
+ tenantId: string;
9
+ signee?: string;
10
+ graphqlPath?: string;
11
+ middlewares?: Middleware[];
12
+ logger?: (instance: AxiosInstance) => void;
13
+ traceId?: string;
14
+ axiosConfig?: {
15
+ timeout?: number;
16
+ headers?: Record<string, string>;
17
+ keepAlive?: boolean;
18
+ };
19
+ }
20
+
21
+ interface Credential {
22
+ client_secret: string,
23
+ grant_type: string,
24
+ client_id: string,
25
+ username: string,
26
+ password: string
27
+ }
28
+
29
+ interface Middleware {
30
+ before?: (command: Command<any, any>) => Promise<void>;
31
+ after?: (command: Command<any, any>, response: any) => Promise<void>;
32
+ onError?: (command: Command<any, any>, error: Error) => Promise<void>;
33
+ }
34
+
35
+ interface Command<TInput, TOutput> {
36
+ input: TInput;
37
+ metadata: {
38
+ commandName: string;
39
+ path: string;
40
+ method: 'GET' | 'POST' | 'PUT' | 'DELETE';
41
+ };
42
+ execute: (config: Config) => Promise<TOutput | undefined>;
43
+ }
44
+
45
+ interface GraphQLRequest {
46
+ command: string | DocumentNode;
47
+ tenantId?: string;
48
+ variables?: any;
49
+ operationName?: string;
50
+ }
51
+
52
+ export type { Config as C, GraphQLRequest as G, Middleware as M, Command as a };