@mbanq/core-sdk-js 0.50.0 → 0.51.0

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.
Files changed (44) hide show
  1. package/README.md +266 -132
  2. package/dist/chunk-BE75VRZI.mjs +1 -0
  3. package/dist/chunk-DOGGMS3S.js +15 -0
  4. package/dist/chunk-ENQXP5AA.js +1 -0
  5. package/dist/chunk-F2NHOGB6.js +1 -0
  6. package/dist/chunk-IKCAJUCQ.mjs +15 -0
  7. package/dist/chunk-J43ILQC2.mjs +1 -0
  8. package/dist/chunk-JVF7XDM6.js +1 -0
  9. package/dist/chunk-XVGHOE26.mjs +1 -0
  10. package/dist/client/index.d.mts +12 -2
  11. package/dist/client/index.d.ts +12 -2
  12. package/dist/client/index.js +1 -1
  13. package/dist/client/index.mjs +1 -1
  14. package/dist/commands/index.d.mts +3585 -1473
  15. package/dist/commands/index.d.ts +3585 -1473
  16. package/dist/commands/index.js +480 -10
  17. package/dist/commands/index.mjs +480 -10
  18. package/dist/error.d-5tXw_5za.d.mts +73 -0
  19. package/dist/error.d-CSQIXy3t.d.ts +73 -0
  20. package/dist/index.d.mts +43 -3
  21. package/dist/index.d.ts +43 -3
  22. package/dist/index.js +1 -1
  23. package/dist/index.mjs +1 -1
  24. package/dist/types/types.d.mts +2 -2
  25. package/dist/types/types.d.ts +2 -2
  26. package/dist/zod/index.d.mts +2 -2
  27. package/dist/zod/index.d.ts +2 -2
  28. package/dist/zod/index.js +1 -1
  29. package/dist/zod/index.mjs +1 -1
  30. package/dist/{zod-CZRLV2LY.d.ts → zod-CXCZ5lZI.d.ts} +3 -2
  31. package/dist/{zod-MBMJZtTf.d.mts → zod-DxL0TOXN.d.mts} +3 -2
  32. package/package.json +1 -1
  33. package/dist/chunk-2PLZ534I.mjs +0 -1
  34. package/dist/chunk-6M772WIB.js +0 -1
  35. package/dist/chunk-EUF3XDC7.mjs +0 -1
  36. package/dist/chunk-F7YQ446S.mjs +0 -1
  37. package/dist/chunk-PHBC2UFT.js +0 -1
  38. package/dist/chunk-RH4M3MNN.js +0 -1
  39. package/dist/chunk-SYN3RI4N.js +0 -8
  40. package/dist/chunk-VYWLPJFH.mjs +0 -8
  41. package/dist/error.d-BilRDJJN.d.ts +0 -26
  42. package/dist/error.d-ChhpiSrv.d.mts +0 -26
  43. package/dist/{recipient-Ca4as725.d.mts → recipient-BWBFfFe3.d.mts} +8 -8
  44. package/dist/{recipient-Ca4as725.d.ts → recipient-BWBFfFe3.d.ts} +8 -8
package/README.md CHANGED
@@ -22,9 +22,31 @@
22
22
  - [Metrics Middleware](#metrics-middleware)
23
23
  - [Custom Middleware](#custom-middleware)
24
24
  - [API Reference](#api-reference)
25
- - [Transfer Operations](#transfer-operations)
25
+ - [Account Operations](#account-operations)
26
+ - [Account Product Operations](#account-product-operations)
27
+ - [Account Statement Operations](#account-statement-operations)
28
+ - [Charge Operations](#charge-operations)
29
+ - [Card Operations](#card-operations)
30
+ - [Card Product Operations](#card-product-operations)
31
+ - [Credit Card Product Operations](#credit-card-product-operations)
32
+ - [Credit Account Operations](#credit-account-operations)
33
+ - [Acquire Card Operations](#acquire-card-operations)
34
+ - [Client Operations](#client-operations)
35
+ - [Client Address Operations](#client-address-operations)
36
+ - [Client Classification Operations](#client-classification-operations)
26
37
  - [Client Identifier Operations](#client-identifier-operations)
38
+ - [Custom Operations](#custom-operations)
39
+ - [DataTable Operations](#datatable-operations)
40
+ - [Global Configuration Operations](#global-configuration-operations)
41
+ - [Payment Operations](#payment-operations)
42
+ - [Recipient Operations](#recipient-operations)
43
+ - [Transaction Operations](#transaction-operations)
44
+ - [Transfer Operations](#transfer-operations)
27
45
  - [User Operations](#user-operations)
46
+ - [Loan Operations](#loan-operations)
47
+ - [Note Operations](#note-operations)
48
+ - [Notification Operations](#notification-operations)
49
+ - [Report Operations](#report-operations)
28
50
  - [Documentation](#documentation)
29
51
  - [Type Safety & Validation](#type-safety--validation)
30
52
  - [Error Handling](#error-handling)
@@ -142,6 +164,50 @@ await client.connect({
142
164
  });
143
165
  ```
144
166
 
167
+ #### Two-Factor Authentication (2FA)
168
+
169
+ If your account has Two-Factor Authentication (2FA) enabled, you must verify your identity using a One-Time Password (OTP) after the initial connection.
170
+
171
+ ```javascript
172
+ const client = createInstance({
173
+ baseUrl: 'https://api.cloud.mbanq.com',
174
+ tenantId: 'your-tenant-id'
175
+ });
176
+
177
+ // 1. Initial connection
178
+ // Returns 2FA status: { isMFARequired, mfaDeliveryMethods, isSelfServiceUser, isPasswordExpired }
179
+ const { isMFARequired, mfaDeliveryMethods } = await client.connect({
180
+ credential: {
181
+ client_id: 'your-client-id',
182
+ client_secret: 'your-client-secret',
183
+ username: 'your-username',
184
+ password: 'your-password',
185
+ grant_type: 'password'
186
+ }
187
+ });
188
+
189
+ if (isMFARequired) {
190
+ // 2. Perform 2FA verification if required
191
+ // mfaDeliveryMethods contains available methods, e.g. ['TOTP']
192
+ await client.twoFactorAuthentication({
193
+ token: '123456', // The OTP code
194
+ deliveryMethod: 'email'
195
+ });
196
+ }
197
+
198
+ // 3. Perform authorized requests
199
+ try {
200
+ const result = await client.request(CreatePayment({ /* ... */ }));
201
+ } catch (error) {
202
+ // NOTE: If you receive an AUTHORIZATION_ERROR with code 'RESTRICTED'
203
+ // and message "Access to type ... is restricted", it means your 2FA token
204
+ // has expired. You must perform 2FA verification again.
205
+ if (error.code === 'RESTRICTED') {
206
+ await client.twoFactorAuthentication({ /* ... */ });
207
+ }
208
+ }
209
+ ```
210
+
145
211
  ### Security Best Practices
146
212
 
147
213
  #### Credential Management
@@ -788,6 +854,16 @@ await client.request(UpdateCardID({
788
854
  | `GetDataTableProductMappingById` | Retrieve a specific entity data table product mapping by its unique identifier |
789
855
  | `DeleteDataTableProductMapping` | Delete a specific entity data table product mapping by its unique identifier |
790
856
 
857
+ #### FX Pay Operations
858
+
859
+ | Command | Description |
860
+ |---|---|
861
+ | `GetCurrencyTemplates` | Retrieve all available currency templates |
862
+ | `GetFetchFxRates` | Retrieve FX rates for a currency pair |
863
+ | `LockFxRate` | Lock an FX rate for a currency pair |
864
+ | `GetTransferCharges` | Retrieve charges for a transfer |
865
+ | `CreateAndSubmitTransfer` | Create and submit a transfer |
866
+
791
867
  #### Global Configuration Operations
792
868
 
793
869
  | Command | Description |
@@ -963,19 +1039,195 @@ The SDK uses [Zod](https://zod.dev/) for runtime type validation and TypeScript
963
1039
  - **Type Safety**: Full TypeScript support with inferred types
964
1040
 
965
1041
  ## Error Handling
966
- The library uses a consistent error handling pattern. All API calls may throw the following errors:
967
1042
 
968
- ### Error Types
969
- - **`CommandError`**: Base error type with `code`, `message`, `statusCode`, and optional `requestId`
970
- - **Authentication Errors**: Invalid or missing API credentials
971
- - OAuth credential authentication failure
972
- - **Validation Errors**: Invalid parameters provided (uses Zod validation)
973
- - **API Errors**: Server-side errors with specific error codes
974
- - **Network Errors**: Network connectivity or timeout issues
1043
+ The SDK provides a unified error handling pattern across REST and GraphQL APIs. All errors are normalized to a consistent `SdkError` structure.
1044
+
1045
+ ### SdkError Structure
1046
+
1047
+ ```typescript
1048
+ interface SdkError extends Error {
1049
+ name: 'SdkError';
1050
+ message: string; // Human-readable error message
1051
+ statusCode?: number; // HTTP status code (REST only)
1052
+ classification: ErrorClassification; // Error category
1053
+ requestId?: string; // Request tracking ID
1054
+ details?: ErrorDetails; // Structured error details
1055
+ cause?: Error; // Original error (minimal)
1056
+ }
1057
+
1058
+ type ErrorClassification =
1059
+ | 'VALIDATION_ERROR' // 400, 422 - Invalid input
1060
+ | 'AUTHENTICATION_ERROR' // 401 - Invalid credentials
1061
+ | 'AUTHORIZATION_ERROR' // 403 - Insufficient permissions
1062
+ | 'NOT_FOUND' // 404 - Resource not found
1063
+ | 'RATE_LIMIT' // 429 - Too many requests
1064
+ | 'NETWORK_ERROR' // No response from server
1065
+ | 'SERVER_ERROR' // 500+ - Server issues
1066
+ | 'GRAPHQL_ERROR' // GraphQL-specific errors
1067
+ | 'UNKNOWN_ERROR'; // Unclassified errors
1068
+
1069
+ interface ErrorDetails {
1070
+ errorCode?: string; // API error code (e.g., 'error.msg.client.id.invalid')
1071
+ validationErrors?: Array<{ // Field-level errors
1072
+ field: string;
1073
+ message: string;
1074
+ code?: string;
1075
+ value?: unknown;
1076
+ args?: unknown[];
1077
+ }>;
1078
+ path?: string[]; // GraphQL field path
1079
+ graphqlCode?: string; // GraphQL extension code
1080
+ }
1081
+ ```
1082
+
1083
+ ### Basic Error Handling
1084
+
1085
+ ```typescript
1086
+ import { isSdkError, SdkError } from '@mbanq/core-sdk-js';
1087
+
1088
+ try {
1089
+ const result = await client.request(GetClient(123));
1090
+ } catch (error) {
1091
+ if (isSdkError(error)) {
1092
+ console.log('Error:', error.message);
1093
+ console.log('Classification:', error.classification);
1094
+ console.log('Status:', error.statusCode);
1095
+ console.log('Request ID:', error.requestId);
1096
+
1097
+ // Access structured details
1098
+ if (error.details?.validationErrors) {
1099
+ error.details.validationErrors.forEach(ve => {
1100
+ console.log(`Field ${ve.field}: ${ve.message}`);
1101
+ });
1102
+ }
1103
+ }
1104
+ }
1105
+ ```
1106
+
1107
+ ### Classification-Based Handling
1108
+
1109
+ ```typescript
1110
+ try {
1111
+ await client.request(CreatePayment(paymentData));
1112
+ } catch (error) {
1113
+ if (isSdkError(error)) {
1114
+ switch (error.classification) {
1115
+ case 'AUTHENTICATION_ERROR':
1116
+ // Refresh token or re-authenticate
1117
+ await client.connect(credentials);
1118
+ break;
1119
+ case 'AUTHORIZATION_ERROR':
1120
+ // Check 2FA or permissions
1121
+ console.log('Access denied:', error.message);
1122
+ break;
1123
+ case 'VALIDATION_ERROR':
1124
+ // Show field errors to user
1125
+ error.details?.validationErrors?.forEach(e => {
1126
+ showFieldError(e.field, e.message);
1127
+ });
1128
+ break;
1129
+ case 'NOT_FOUND':
1130
+ // Resource doesn't exist
1131
+ console.log('Resource not found');
1132
+ break;
1133
+ case 'NETWORK_ERROR':
1134
+ // Retry or show offline message
1135
+ console.log('Network issue, please retry');
1136
+ break;
1137
+ case 'SERVER_ERROR':
1138
+ // Log and show generic error
1139
+ console.error('Server error:', error.requestId);
1140
+ break;
1141
+ }
1142
+ }
1143
+ }
1144
+ ```
1145
+
1146
+ ### REST Error Example
1147
+
1148
+ When a REST API returns an error like:
1149
+ ```json
1150
+ {
1151
+ "developerMessage": "The requested resource is not available.",
1152
+ "httpStatusCode": "404",
1153
+ "defaultUserMessage": "The requested resource is not available.",
1154
+ "userMessageGlobalisationCode": "error.msg.resource.not.found",
1155
+ "errors": [{
1156
+ "developerMessage": "Client with identifier 21994 does not exist",
1157
+ "defaultUserMessage": "Client with identifier 21994 does not exist",
1158
+ "userMessageGlobalisationCode": "error.msg.client.id.invalid",
1159
+ "parameterName": "id",
1160
+ "value": null,
1161
+ "args": [{"value": 21994}]
1162
+ }]
1163
+ }
1164
+ ```
1165
+
1166
+ The SDK transforms it to:
1167
+ ```typescript
1168
+ {
1169
+ name: 'SdkError',
1170
+ message: 'The requested resource is not available.',
1171
+ statusCode: 404,
1172
+ classification: 'NOT_FOUND',
1173
+ details: {
1174
+ errorCode: 'error.msg.resource.not.found',
1175
+ validationErrors: [{
1176
+ field: 'id',
1177
+ message: 'Client with identifier 21994 does not exist',
1178
+ code: 'error.msg.client.id.invalid',
1179
+ value: null,
1180
+ args: [21994]
1181
+ }]
1182
+ }
1183
+ }
1184
+ ```
1185
+
1186
+ ### GraphQL Error Example
1187
+
1188
+ GraphQL errors like 2FA/permission issues:
1189
+ ```json
1190
+ {
1191
+ "message": "Access to type 'PaymentRecipientTypeFormats' is restricted",
1192
+ "extensions": { "code": "RESTRICTED", "classification": "DataFetchingException" }
1193
+ }
1194
+ ```
975
1195
 
976
- ### Common Authentication Error Scenarios
977
- - **Missing credentials**: No authentication method provided
978
- - **OAuth failure**: Invalid username/password or client credentials
1196
+ Are transformed to:
1197
+ ```typescript
1198
+ {
1199
+ name: 'SdkError',
1200
+ message: "Access to type 'PaymentRecipientTypeFormats' is restricted",
1201
+ classification: 'AUTHORIZATION_ERROR',
1202
+ details: {
1203
+ graphqlCode: 'RESTRICTED',
1204
+ errorCode: 'RESTRICTED'
1205
+ }
1206
+ }
1207
+ ```
1208
+
1209
+ ### Type Guards
1210
+
1211
+ ```typescript
1212
+ import { isSdkError } from '@mbanq/core-sdk-js';
1213
+
1214
+ // Check if error is an SdkError
1215
+ if (isSdkError(error)) {
1216
+ // TypeScript knows error is SdkError
1217
+ console.log(error.classification);
1218
+ }
1219
+ ```
1220
+
1221
+ ### Accessing Original Error
1222
+
1223
+ For debugging, the original error is available via the standard `cause` property:
1224
+
1225
+ ```typescript
1226
+ if (isSdkError(error) && error.cause) {
1227
+ console.log('Original error:', error.cause.message);
1228
+ console.log('Axios code:', (error.cause as any).code);
1229
+ }
1230
+ ```
979
1231
 
980
1232
  ## Examples
981
1233
 
@@ -1043,7 +1295,7 @@ if (transfer.status === 'EXECUTION_PROCESSING') {
1043
1295
  ### Error Handling Example
1044
1296
 
1045
1297
  ```javascript
1046
- import { isCommandError, CreateTransfer } from '@mbanq/core-sdk-js';
1298
+ import { isSdkError, CreateTransfer } from '@mbanq/core-sdk-js';
1047
1299
 
1048
1300
  try {
1049
1301
  const transfer = await client.request(CreateTransfer({
@@ -1052,7 +1304,7 @@ try {
1052
1304
  // Missing required fields
1053
1305
  }));
1054
1306
  } catch (error) {
1055
- if (isCommandError(error)) {
1307
+ if (isSdkError(error)) {
1056
1308
  console.error('Transfer creation failed:');
1057
1309
  console.error('Code:', error.code);
1058
1310
  console.error('Message:', error.message);
@@ -1066,121 +1318,3 @@ try {
1066
1318
  ```
1067
1319
 
1068
1320
  For more detailed information or support, please contact our support team or visit our developer portal.
1069
-
1070
- // Delete a data table entry
1071
- const deleted = await client.request(DeleteEntryFromDataTable({
1072
- datatable: 'd_client_info',
1073
- apptableid: 101,
1074
- datatableId: 1651719413544 // Entry ID to delete
1075
- }));
1076
-
1077
- console.log('Deleted entry ID:', deleted.id);
1078
- console.log('Resource ID:', deleted.resourceId);
1079
-
1080
- // Get product mapping template
1081
- const mappings = await client.request(GetDataTableProductMappingTemplate({}));
1082
- console.log('Total records:', mappings.totalFilteredRecords);
1083
- console.log('Mappings:', mappings.pageItems);
1084
- // pageItems contains: [{ id, entity, datatableName, productId, productName }, ...]
1085
-
1086
- // Filter by application table
1087
- const loanMappings = await client.request(GetDataTableProductMappingTemplate({
1088
- apptable: 'm_loan'
1089
- }));
1090
- // Returns only mappings for m_loan entity
1091
-
1092
- // Create data table product mapping
1093
- const mapping = await client.request(CreateDataTableProductMapping({
1094
- entity: 'm_loan',
1095
- productId: 23,
1096
- datatableName: 'd_loan_additional_details'
1097
- }));
1098
- console.log('Mapping created with ID:', mapping.id);
1099
- console.log('Resource ID:', mapping.resourceId);
1100
-
1101
- // Get list of mappings with pagination
1102
- const mappings = await client.request(GetDataTableProductMappings({
1103
- limit: 10,
1104
- offset: 0
1105
- }));
1106
- console.log('Total records:', mappings.totalFilteredRecords);
1107
- console.log('First page:', mappings.pageItems);
1108
-
1109
- // Filter mappings by entity
1110
- const loanMappings = await client.request(GetDataTableProductMappings({
1111
- entity: 'm_loan'
1112
- }));
1113
-
1114
- // Get specific mapping by ID
1115
- const mapping = await client.request(GetDataTableProductMappingById(67));
1116
- console.log('Mapping ID:', mapping.id);
1117
- console.log('Entity:', mapping.entity);
1118
- console.log('Data Table:', mapping.datatableName);
1119
- console.log('Product:', mapping.productName);
1120
-
1121
- // Delete mapping by ID
1122
- const deleted = await client.request(DeleteDataTableProductMapping(67));
1123
- console.log('Deleted mapping ID:', deleted.id);
1124
- ```
1125
-
1126
- ### Dispute Reason Example
1127
-
1128
- ```javascript
1129
- import { createInstance, AddDisputeReason } from '@mbanq/core-sdk-js';
1130
-
1131
- const client = createInstance({
1132
- baseUrl: 'https://api.cloud.mbanq.com',
1133
- tenantId: 'your-tenant-id'
1134
- });
1135
-
1136
- await client.connect({
1137
- credential: {
1138
- client_id: 'your-client-id',
1139
- client_secret: 'your-client-secret',
1140
- username: 'your-username',
1141
- password: 'your-password',
1142
- grant_type: 'password'
1143
- }
1144
- });
1145
-
1146
- // Add a new dispute reason
1147
- const disputeReason = await client.request(AddDisputeReason([{
1148
- reasonIdentifier: 'UNAUTHORIZED_FRAUD',
1149
- name: 'Unauthorized Fraud',
1150
- description: 'Unrecognized Charge',
1151
- paymentRail: 'CREDIT_CARD',
1152
- supportMultipleTransactions: true,
1153
- supportRecognizedTransaction: false,
1154
- isBlockCardOnDisputeCreation: true
1155
- }]));
1156
-
1157
- console.log('Dispute reason created:', disputeReason.data[0].name);
1158
- console.log('Payment rail:', disputeReason.data[0].paymentRail);
1159
- console.log('Blocks card on creation:', disputeReason.data[0].isBlockCardOnDisputeCreation);
1160
-
1161
- // Add multiple dispute reasons at once
1162
- const multipleReasons = await client.request(AddDisputeReason([
1163
- {
1164
- reasonIdentifier: 'UNAUTHORIZED_FRAUD',
1165
- name: 'Unauthorized Fraud',
1166
- paymentRail: 'CREDIT_CARD'
1167
- },
1168
- {
1169
- reasonIdentifier: 'INCORRECT_AMOUNT',
1170
- name: 'Incorrect Amount',
1171
- paymentRail: 'ACH'
1172
- }
1173
- ]));
1174
- console.log('Created', multipleReasons.data.length, 'dispute reasons');
1175
-
1176
- // Update an existing dispute reason
1177
- const updated = await client.request(UpdateDisputeReason('UNAUTHORIZED_FRAUD', {
1178
- name: 'UnAuthorized Fraud',
1179
- description: 'Non receipt of merchandise',
1180
- reasonIdentifier: 'UNAUTHORIZED_FRAUD',
1181
- supportMultipleTransactions: false,
1182
- paymentRail: 'CREDIT_CARD'
1183
- }));
1184
- console.log('Updated dispute reason ID:', updated.resourceId);
1185
- console.log('Changes:', updated.changes);
1186
- ```
@@ -0,0 +1 @@
1
+ import{c as w,d as C}from"./chunk-IKCAJUCQ.mjs";import{a as m,b as u,c as T,d as k,e as l}from"./chunk-J43ILQC2.mjs";var y=i=>{let a=[];if(!i.baseUrl)a.push("baseUrl is required");else if(typeof i.baseUrl!="string")a.push("baseUrl must be a string");else try{new URL(i.baseUrl)}catch{a.push("baseUrl must be a valid URL")}return i.axiosConfig?.timeout!==void 0&&(typeof i.axiosConfig.timeout!="number"||i.axiosConfig.timeout<0)&&a.push("timeout must be a positive number"),a};import R from"axios";import x from"jsonwebtoken";var A=(i,a)=>{if(!i)throw m({message:"Missing JWT secret",code:"missing_jwt_secret"});return x.sign({signee:a},i,{algorithm:"HS512",expiresIn:"1d"})||""},b=async(i,a,c)=>{let t={method:"POST",url:`${i}/oauth/token`,headers:{"Content-Type":"application/x-www-form-urlencoded",tenantId:a},data:c},{data:{access_token:d}}=await R.request(t);return d};var j=i=>{let a=y(i);if(a.length>0)throw u({message:`Invalid configuration: ${a.join(", ")}`,classification:"VALIDATION_ERROR",details:{validationErrors:a.map(e=>({field:"config",message:e}))}});let c=i,t={accessToken:"",tokenType:"bearer",authConfig:null,isSelfServiceUser:!1,isMFARequired:!1,isPasswordExpired:!1,mfaDeliveryMethods:[],"2FA-Token":void 0},d=async(e,n,s)=>{if(c.middlewares)for(let r of c.middlewares)e==="before"&&r.before?await r.before(n):e==="after"&&r.after?await r.after(n,s):e==="onError"&&r.onError&&await r.onError(n,s)},p=e=>{let n={...e,[t.tokenType==="jwt"?"jwtToken":"bearerToken"]:t.accessToken};return t.authConfig?.tenantId&&(n.tenantId=t.authConfig.tenantId),t["2FA-Token"]&&(n.axiosConfig={...n.axiosConfig,headers:{...n.axiosConfig?.headers,"2FA-Token":t["2FA-Token"]}}),n},g=(e,n)=>n?{...e,axiosConfig:{...e.axiosConfig,...n.timeout&&{timeout:n.timeout},...n.keepAlive!==void 0&&{keepAlive:n.keepAlive},headers:{...e.axiosConfig?.headers,...n.headers}}}:e,h=async e=>{if(e.credential){let n=e.tenantId||c.tenantId;if(!n)throw u({message:"Tenant ID is required when using credential-based authentication",classification:"VALIDATION_ERROR"});try{return{token:await b(c.baseUrl,n,e.credential),type:"bearer"}}catch(s){throw l(s),s}}else{if(e.signee&&e.secret)return{token:A(e.secret,e.signee||""),type:"jwt"};if(e.bearerToken)return{token:e.bearerToken,type:"bearer"};if(e.jwtToken)return{token:e.jwtToken,type:"jwt"};throw u({message:"No valid authentication method provided in config",classification:"VALIDATION_ERROR"})}};return{connect:async e=>{let{token:n,type:s}=await h(e);t.accessToken=n,t.tokenType=s,t.authConfig=e;let r=C();if(r.executeGQL){let o=g({baseUrl:c.baseUrl,tenantId:e.tenantId||c.tenantId});o=p(o);try{let f=await r.executeGQL(o);t.isSelfServiceUser=f?.isSelfServiceUser??!1,t.isMFARequired=f?.isMFARequired??!1,t.isPasswordExpired=f?.isPasswordExpired??!1,t.mfaDeliveryMethods=f?.mfaDeliveryMethods??[]}catch(f){l(f)}}return{isMFARequired:t.isMFARequired,mfaDeliveryMethods:t.mfaDeliveryMethods,isSelfServiceUser:t.isSelfServiceUser,isPasswordExpired:t.isPasswordExpired}},twoFactorAuthentication:async({token:e,deliveryMethod:n})=>{if(t.isMFARequired){let s=w({token:e,deliveryMethod:n});if(s.executeGQL){let r=g({baseUrl:c.baseUrl,tenantId:t.authConfig?.tenantId||c.tenantId});r=p(r);try{let o=await s.executeGQL(r);t["2FA-Token"]=o?.token}catch(o){l(o)}}}else throw u({message:"You are not setup 2FA in your account.",classification:"VALIDATION_ERROR"})},request:async(e,n)=>{try{if(await d("before",e),!t.accessToken)throw u({message:"No authentication token found. Please await instance.connect() first.",classification:"AUTHENTICATION_ERROR"});let s=1;for(;s>=0;)try{let r=g(c,n);r=p(r);let o;if(t.isSelfServiceUser){if(!e.executeGQL)throw u({message:"Command does not have an executeGQL method",classification:"VALIDATION_ERROR"});o=await e.executeGQL(r)}else{if(!e.execute)throw u({message:"Command does not have an execute method",classification:"VALIDATION_ERROR"});o=await e.execute(r)}return await d("after",e,o),o}catch(r){if(s>0&&t.authConfig){if((T(r)||k(r))&&r.statusCode===401){let{token:o,type:f}=await h(t.authConfig);t.accessToken=o,t.tokenType=f,s--;continue}if(r.isAxiosError&&r.response?.status===401){let{token:o,type:f}=await h(t.authConfig);t.accessToken=o,t.tokenType=f,s--;continue}}if(T(r))throw r;l(r)}}catch(s){throw await d("onError",e,s),s}}}};export{j as a};
@@ -0,0 +1,15 @@
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; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkENQXP5AAjs = require('./chunk-ENQXP5AA.js');var _graphql = require('graphql');var _axios = require('axios'); var _axios2 = _interopRequireDefault(_axios);var _uuid = require('uuid');var _https = require('https'); var l = _interopRequireWildcard(_https);var S=e=>e&&(e.startsWith("Bearer ")?e:`Bearer ${e}`),n= exports.a =async e=>{let a=()=>`RequestUUID=${_uuid.v4.call(void 0, )}`,r=_axios2.default.create({timeout:_optionalChain([e, 'access', _ => _.axiosConfig, 'optionalAccess', _2 => _2.timeout])||29e3,baseURL:e.baseUrl,headers:{"Content-Type":"application/json; charset=utf-8","JWT-Token":_optionalChain([e, 'optionalAccess', _3 => _3.jwtToken])||void 0,Authorization:e.bearerToken?S(e.bearerToken):void 0,"trace-id":a(),tenantId:e.tenantId,..._optionalChain([e, 'access', _4 => _4.axiosConfig, 'optionalAccess', _5 => _5.headers])},httpsAgent:new l.Agent({rejectUnauthorized:!0,keepAlive:_optionalChain([e, 'access', _6 => _6.axiosConfig, 'optionalAccess', _7 => _7.keepAlive])})});return e.logger&&e.logger(r),r};var m=e=>({input:e,metadata:{commandName:e.operationName||"GraphQL",path:"/graphql",method:"POST"},execute:async t=>{let a=await n(t),r=t.graphqlPath||"/graphql";try{let s=typeof e.command=="string"?e.command:_graphql.print.call(void 0, e.command),{data:o}=await a.post(r,{query:s,variables:e.variables,operationName:e.operationName});return _optionalChain([o, 'access', _8 => _8.errors, 'optionalAccess', _9 => _9.length])&&_chunkENQXP5AAjs.f.call(void 0, o.errors),o.data||_chunkENQXP5AAjs.f.call(void 0, [{message:"No data returned from GraphQL query"}]),o.data}catch(s){if(_chunkENQXP5AAjs.c.call(void 0, s))throw s;_chunkENQXP5AAjs.g.call(void 0, s)}}});var D=({token:e,deliveryMethod:t})=>{let a=`mutation requestAccessTokenFromOTP($token: String!, $deliveryMethod: requestOTPDeliveryMethod!) {
2
+ requestAccessTokenFromOTP(token: $token, deliveryMethod: $deliveryMethod) {
3
+ token
4
+ }
5
+ }`;return{input:{token:e,deliveryMethod:t},metadata:{commandName:"RequestAccessToken",path:"",method:"POST"},executeGQL:async r=>{let s=m({command:a,variables:{token:e,deliveryMethod:t},operationName:"requestAccessTokenFromOTP"});if(!s.execute)throw new Error("Failed to create GraphQL request");returnawait _asyncOptionalChain([(await s.execute(r)), 'optionalAccess', async _10 => _10.requestAccessTokenFromOTP])}}},k= exports.d =()=>{let e=`query getAuthenticationDetail {
6
+ getAuthenticationDetail {
7
+ ...authenticationDetail
8
+ }
9
+ }
10
+ fragment authenticationDetail on AuthenticationDetail {
11
+ isSelfServiceUser
12
+ isMFARequired
13
+ isPasswordExpired
14
+ mfaDeliveryMethods
15
+ }`;return{input:{},metadata:{commandName:"CheckSelfServiceAccess",path:"",method:"GET"},executeGQL:async t=>{let a=m({command:e,operationName:"getAuthenticationDetail"});if(!a.execute)throw new Error("Failed to create GraphQL request");returnawait _asyncOptionalChain([(await a.execute(t)), 'optionalAccess', async _11 => _11.getAuthenticationDetail])}}},w= exports.e =()=>{let e="/v1/userdetails";return{input:{},metadata:{commandName:"GetUserDetail",path:e,method:"GET"},execute:async t=>{let a=await n(t);try{return(await a.get(e)).data}catch(r){return _chunkENQXP5AAjs.e.call(void 0, r)}}}},G= exports.f =e=>{let t="/v1/users";return{input:{data:e},metadata:{commandName:"EnableSelfServiceAccess",path:t,method:"POST"},execute:async a=>{let r=await n(a);try{return(await r.post(t,{...e,isSelfServiceUser:!0})).data}catch(s){return _chunkENQXP5AAjs.e.call(void 0, s)}}}},L= exports.g =e=>{let{userId:t,...a}=e,r=`/v1/users/${t}`;return{input:{data:e},metadata:{commandName:"UpdateSelfServiceUser",path:r,method:"PUT"},execute:async s=>{let o=await n(s);try{return(await o.put(r,{...a,isSelfServiceUser:!0})).data}catch(p){return _chunkENQXP5AAjs.e.call(void 0, p)}}}},I= exports.h =e=>{let t=`/v1/users/${e}`;return{input:{userId:e},metadata:{commandName:"DeleteSelfServiceUser",path:t,method:"DELETE"},execute:async a=>{let r=await n(a);try{return(await r.delete(t)).data}catch(s){return _chunkENQXP5AAjs.e.call(void 0, s)}}}};exports.a = n; exports.b = m; exports.c = D; exports.d = k; exports.e = w; exports.f = G; exports.g = L; exports.h = I;
@@ -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=e=>{if(typeof e=="string")return e;if(e==null)return"Unknown error";if(typeof e=="object")try{return"message"in e&&typeof e.message=="string"?e.message:JSON.stringify(e)}catch (e2){return String(e)}return String(e)},O= exports.a =({message:e,statusCode:s,code:r,requestId:n,originalError:i})=>{let t=new Error(a(e));return t.name="CommandError",t.statusCode=s,t.code=r,t.requestId=n,t.originalError=i,t},d=e=>e?e===401?"AUTHENTICATION_ERROR":e===403?"AUTHORIZATION_ERROR":e===404?"NOT_FOUND":e===422||e===400?"VALIDATION_ERROR":e===429?"RATE_LIMIT":e>=500?"SERVER_ERROR":"UNKNOWN_ERROR":"UNKNOWN_ERROR",o= exports.b =e=>{let s=new Error(a(e.message));return s.name="SdkError",s.statusCode=e.statusCode,s.classification=e.classification||d(e.statusCode),s.requestId=e.requestId,s.details=e.details,e.cause&&(s.cause=e.cause),s},A= exports.c =e=>typeof e=="object"&&e!==null&&"name"in e&&e.name==="SdkError",N= exports.d =e=>typeof e=="object"&&e!==null&&"name"in e&&e.name==="CommandError",u=e=>{let s={};return!e||typeof e!="object"||(s.errorCode=e.userMessageGlobalisationCode||e.errorCode||e.code||e.error_code,Array.isArray(e.errors)&&e.errors.length>0&&(s.validationErrors=e.errors.map(r=>({field:r.parameterName||r.field||"unknown",message:r.defaultUserMessage||r.message||r.developerMessage||String(r),code:r.userMessageGlobalisationCode,value:r.value,args:_optionalChain([r, 'access', _ => _.args, 'optionalAccess', _2 => _2.map, 'call', _3 => _3(n=>n.value)])})))),s},R=e=>{let s=new Error(e.message);return s.name="AxiosError",s.code=e.code,s.status=_optionalChain([e, 'access', _4 => _4.response, 'optionalAccess', _5 => _5.status]),s};var E=e=>{if(_axios2.default.isAxiosError(e)){let s=_optionalChain([e, 'access', _6 => _6.response, 'optionalAccess', _7 => _7.data]),r=_optionalChain([e, 'access', _8 => _8.response, 'optionalAccess', _9 => _9.status])||e.status,n=_optionalChain([e, 'access', _10 => _10.response, 'optionalAccess', _11 => _11.headers, 'optionalAccess', _12 => _12["x-request-id"]]),i;e.request&&!e.response?i="NETWORK_ERROR":i=d(r);let t;e.request&&!e.response?t="Network error: No response received from server":s?typeof s=="string"?t=s:typeof s=="object"?t=s.message||s.error||s.userMessage||s.defaultUserMessage||`Request failed with status ${r}`:t=`Request failed with status ${r}`:t=e.message||`Request failed with status ${r}`;let c=u(s);throw o({message:t,statusCode:r,classification:i,requestId:n,details:Object.keys(c).length>0?c:void 0,cause:R(e)})}throw e instanceof Error?o({message:e.message,classification:"UNKNOWN_ERROR",cause:e}):o({message:a(e),classification:"UNKNOWN_ERROR"})};var l=e=>{if(!e)return"GRAPHQL_ERROR";let s=_optionalChain([e, 'access', _13 => _13.code, 'optionalAccess', _14 => _14.toUpperCase, 'call', _15 => _15()]),r=_optionalChain([e, 'access', _16 => _16.classification, 'optionalAccess', _17 => _17.toUpperCase, 'call', _18 => _18()]);return s==="UNAUTHENTICATED"||r==="AUTHENTICATIONERROR"?"AUTHENTICATION_ERROR":s==="FORBIDDEN"||s==="RESTRICTED"||r==="AUTHORIZATIONERROR"?"AUTHORIZATION_ERROR":s==="BAD_USER_INPUT"||r==="VALIDATIONERROR"?"VALIDATION_ERROR":s==="NOT_FOUND"?"NOT_FOUND":r==="DATAFETCHINGEXCEPTION"?"AUTHORIZATION_ERROR":"GRAPHQL_ERROR"},g=e=>{let s={};e.path&&e.path.length>0&&(s.path=e.path.map(String)),_optionalChain([e, 'access', _19 => _19.extensions, 'optionalAccess', _20 => _20.code])&&(s.graphqlCode=e.extensions.code,s.errorCode=e.extensions.code);let r=e.message.match(/Field '(\w+)'/);return r&&(s.validationErrors=[{field:r[1],message:e.message}]),!s.errorCode&&e.message.includes("invalid value")&&(s.errorCode="GRAPHQL_VALIDATION_ERROR"),s},h= exports.f =e=>{let s=e[0],r=l(s.extensions),n=g(s);throw e.length>1&&(n.validationErrors=e.slice(1).map(i=>({field:_optionalChain([i, 'access', _21 => _21.path, 'optionalAccess', _22 => _22.join, 'call', _23 => _23(".")])||"unknown",message:i.message}))),o({message:s.message,classification:r,details:Object.keys(n).length>0?n:void 0})},y= exports.g =e=>{throw _axios2.default.isAxiosError(e)&&E(e),e instanceof Error?o({message:e.message,classification:"GRAPHQL_ERROR",cause:e}):o({message:a(e),classification:"GRAPHQL_ERROR"})};exports.a = O; exports.b = o; exports.c = A; exports.d = N; exports.e = E; exports.f = h; exports.g = y;
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);var x=_zod2.default.object({id:_zod2.default.number(),code:_zod2.default.string(),value:_zod2.default.string()}),C=_zod2.default.object({id:_zod2.default.number(),code:_zod2.default.string(),value:_zod2.default.string()}),h=_zod2.default.object({active:_zod2.default.boolean(),mandatory:_zod2.default.boolean(),systemDefined:_zod2.default.boolean()}),A=_zod2.default.object({id:_zod2.default.number()}),D=_zod2.default.object({id:_zod2.default.number(),name:_zod2.default.string().optional()}),N=_zod2.default.object({active:_zod2.default.boolean()}),P=_zod2.default.object({submittedOnDate:_zod2.default.array(_zod2.default.number()),submittedByUsername:_zod2.default.string().optional(),submittedByFirstname:_zod2.default.string().optional(),submittedByLastname:_zod2.default.string().optional(),activatedOnDate:_zod2.default.array(_zod2.default.number()).optional(),activatedByUsername:_zod2.default.string().optional(),activatedByFirstname:_zod2.default.string().optional(),activatedByLastname:_zod2.default.string().optional()}),Z=_zod2.default.object({}).catchall(_zod2.default.any()),ee=_zod2.default.object({}).catchall(_zod2.default.any()),te=_zod2.default.object({}).catchall(_zod2.default.any()),E=_zod2.default.object({constitution:Z,mainBusinessLine:ee,countryOfIncorporation:te}).catchall(_zod2.default.any()),O=_zod2.default.object({isExternalCardDebitDisable:_zod2.default.boolean(),isExternalCardCreditDisable:_zod2.default.boolean(),isAchDebitOutgoingDisable:_zod2.default.boolean(),isAchCreditOutgoingDisable:_zod2.default.boolean(),isAchDebitIncomingDisable:_zod2.default.boolean(),isAchCreditIncomingDisable:_zod2.default.boolean(),isInternalCreditDisable:_zod2.default.boolean(),isInternalDebitDisable:_zod2.default.boolean(),isWireCreditOutgoingDisable:_zod2.default.boolean(),isWireCreditIncomingDisable:_zod2.default.boolean(),isSwiftCreditOutgoingDisable:_zod2.default.boolean(),isSwiftCreditIncomingDisable:_zod2.default.boolean(),isFxpayCreditOutgoingDisable:_zod2.default.boolean(),isAllocateToSubAccountDisable:_zod2.default.boolean(),isInternalCreditOwnDisable:_zod2.default.boolean(),type:_zod2.default.string(),resourceId:_zod2.default.number(),id:_zod2.default.number()}).catchall(_zod2.default.any()),F=_zod2.default.object({}).catchall(_zod2.default.any()),v=_zod2.default.object({id:_zod2.default.number(),accountNo:_zod2.default.string(),status:C,subStatus:h,active:_zod2.default.boolean(),activationDate:_zod2.default.array(_zod2.default.number()).optional(),firstname:_zod2.default.string(),lastname:_zod2.default.string(),displayName:_zod2.default.string(),mobileNo:_zod2.default.string(),emailAddress:_zod2.default.string(),dateOfBirth:_zod2.default.array(_zod2.default.number()),gender:A,clientTypes:_zod2.default.array(_zod2.default.any()),clientClassification:D,occupation:N,isStaff:_zod2.default.boolean(),skipAvs:_zod2.default.boolean(),officeId:_zod2.default.number(),officeName:_zod2.default.string(),imageId:_zod2.default.string().optional(),imagePresent:_zod2.default.boolean().optional(),timeline:P,legalForm:x,clientVerificationStatus:_zod2.default.string(),updatedAt:_zod2.default.string(),isBlockExternalCardsAddition:_zod2.default.boolean(),clientNonPersonDetails:E,clientTransferOptionData:O,authorizations:_zod2.default.array(_zod2.default.number()).optional(),mobileCountryCode:_zod2.default.string(),clientKycStatus:F,ofLoanCycle:_zod2.default.number(),ofLoanActive:_zod2.default.number(),activeDepositAccount:_zod2.default.number(),onBoardingStatus:_zod2.default.string().optional()}).catchall(_zod2.default.any()),ne=_zod2.default.object({riskScore:_zod2.default.number(),rating:_zod2.default.string()}).catchall(_zod2.default.any()),oe=_zod2.default.object({street:_zod2.default.string(),city:_zod2.default.string(),state:_zod2.default.string(),zipCode:_zod2.default.string()}).catchall(_zod2.default.any()),re=_zod2.default.object({type:_zod2.default.string(),value:_zod2.default.string()}).catchall(_zod2.default.any()),ae= exports.a ={firstname:_zod2.default.string(),middlename:_zod2.default.string().optional(),lastname:_zod2.default.string(),occupationId:_zod2.default.number().optional(),isCurrentlyEmployed:_zod2.default.boolean().optional(),nickname:_zod2.default.string().optional(),nationalityId:_zod2.default.number().optional(),genderId:_zod2.default.number().optional(),locale:_zod2.default.string().optional(),officeId:_zod2.default.number(),mobileCountryCode:_zod2.default.string(),mobileNo:_zod2.default.string(),emailAddress:_zod2.default.string().email(),legalFormId:_zod2.default.number().optional(),externalId:_zod2.default.string().optional(),clientTypes:_zod2.default.array(_zod2.default.number()).optional(),isOptedForMLALStatus:_zod2.default.boolean().optional(),currentMLALStatus:_zod2.default.string().optional(),isStaff:_zod2.default.boolean().optional(),staffId:_zod2.default.number().optional(),clientClassificationId:_zod2.default.number().optional(),savingsProductId:_zod2.default.number().optional(),familyMembers:_zod2.default.array(_zod2.default.object({firstName:_zod2.default.string().optional(),middleName:_zod2.default.string().optional(),lastName:_zod2.default.string().optional(),relationshipId:_zod2.default.number().optional(),genderId:_zod2.default.number().optional(),maritalStatusId:_zod2.default.number().optional(),qualification:_zod2.default.string().optional(),isDependent:_zod2.default.boolean().optional(),mobileNumber:_zod2.default.string().optional(),dateFormat:_zod2.default.string().optional(),dateOfBirth:_zod2.default.string().optional(),age:_zod2.default.string().optional(),locale:_zod2.default.string().optional()})).optional(),active:_zod2.default.boolean().optional(),dateFormat:_zod2.default.string().optional(),activationDate:_zod2.default.string().optional(),submittedOnDate:_zod2.default.string().optional(),dateOfBirth:_zod2.default.string().optional()},Ct= exports.b =_zod2.default.object(ae).catchall(_zod2.default.any()),ie= exports.c ={id:_zod2.default.string(),officeId:_zod2.default.number(),clientId:_zod2.default.number(),resourceId:_zod2.default.number()},ht= exports.d =_zod2.default.object(ie).catchall(_zod2.default.any()),se= exports.e ={firstname:_zod2.default.string().optional(),middlename:_zod2.default.string().optional(),fullname:_zod2.default.string().optional(),genderId:_zod2.default.number().optional(),lastname:_zod2.default.string().optional(),occupationId:_zod2.default.number().optional(),mobileCountryCode:_zod2.default.string().optional(),mobileNo:_zod2.default.string().optional(),emailAddress:_zod2.default.string().email().optional(),externalId:_zod2.default.string().optional(),clientClassificationId:_zod2.default.number().optional(),dateOfBirth:_zod2.default.string().optional(),dateFormat:_zod2.default.string().optional()},At= exports.f =_zod2.default.object(se).catchall(_zod2.default.any()),pe= exports.g ={documentTypeId:_zod2.default.string(),documentKey:_zod2.default.string(),status:_zod2.default.string(),description:_zod2.default.string().optional(),issuedBy:_zod2.default.string().optional(),locale:_zod2.default.string().optional(),dateFormat:_zod2.default.string().optional(),expiryDate:_zod2.default.string().optional(),nationality:_zod2.default.number().optional(),issuedDate:_zod2.default.string().optional()},Dt= exports.h =_zod2.default.object(pe).catchall(_zod2.default.any()),ce= exports.i ={id:_zod2.default.number(),officeId:_zod2.default.number(),clientId:_zod2.default.number(),resourceId:_zod2.default.number(),changes:_zod2.default.record(_zod2.default.string(),_zod2.default.any()),isScheduledTransfer:_zod2.default.boolean(),isSkipNotification:_zod2.default.boolean()},Nt= exports.j =_zod2.default.object(ce).catchall(_zod2.default.any()),le= exports.k ={developerMessage:_zod2.default.string(),defaultUserMessage:_zod2.default.string(),userMessageGlobalisationCode:_zod2.default.string(),parameterName:_zod2.default.string().optional(),value:_zod2.default.any().nullable(),args:_zod2.default.array(_zod2.default.object({value:_zod2.default.any()})).optional()},de= exports.l =_zod2.default.object(le),ue= exports.m ={developerMessage:_zod2.default.string(),httpStatusCode:_zod2.default.string(),defaultUserMessage:_zod2.default.string(),userMessageGlobalisationCode:_zod2.default.string(),errors:_zod2.default.array(de).optional()},Pt= exports.n =_zod2.default.object(ue).catchall(_zod2.default.any()),me= exports.o ={tenantId:_zod2.default.string().optional(),offset:_zod2.default.number().optional(),limit:_zod2.default.number().optional(),orderBy:_zod2.default.string().optional(),sortOrder:_zod2.default.string().optional(),officeId:_zod2.default.number().optional(),displayName:_zod2.default.string().optional(),firstname:_zod2.default.string().optional(),lastname:_zod2.default.string().optional(),externalId:_zod2.default.string().optional(),orphansOnly:_zod2.default.boolean().optional(),clientStatus:_zod2.default.string().optional(),mobileNo:_zod2.default.string().optional(),createdStartDate:_zod2.default.string().optional(),creationEndDate:_zod2.default.string().optional(),activatedStartDate:_zod2.default.string().optional(),activatedEndDate:_zod2.default.string().optional(),closedStartDate:_zod2.default.string().optional(),closedEndDate:_zod2.default.string().optional()},Et= exports.p =_zod2.default.object(me),Ot= exports.q ={id:_zod2.default.number(),accountNo:_zod2.default.string(),status:C,subStatus:h,active:_zod2.default.boolean(),activationDate:_zod2.default.array(_zod2.default.number()).optional(),firstname:_zod2.default.string(),lastname:_zod2.default.string(),displayName:_zod2.default.string(),mobileNo:_zod2.default.string(),emailAddress:_zod2.default.string(),dateOfBirth:_zod2.default.array(_zod2.default.number()),gender:A,clientTypes:_zod2.default.array(_zod2.default.any()),clientClassification:D,occupation:N,isStaff:_zod2.default.boolean(),skipAvs:_zod2.default.boolean(),officeId:_zod2.default.number(),officeName:_zod2.default.string(),imageId:_zod2.default.string().optional(),imagePresent:_zod2.default.boolean().optional(),timeline:P,legalForm:x,clientVerificationStatus:_zod2.default.string(),updatedAt:_zod2.default.string(),isBlockExternalCardsAddition:_zod2.default.boolean(),clientNonPersonDetails:E,clientTransferOptionData:O,authorizations:_zod2.default.array(_zod2.default.number()).optional(),mobileCountryCode:_zod2.default.string(),clientKycStatus:F,ofLoanCycle:_zod2.default.number(),ofLoanActive:_zod2.default.number(),activeDepositAccount:_zod2.default.number(),onBoardingStatus:_zod2.default.string().optional()},ye= exports.r ={totalFilteredRecords:_zod2.default.number(),pageItems:_zod2.default.array(v)},Ft= exports.s =_zod2.default.object(ye).catchall(_zod2.default.any()),fe= exports.t ={clientData:v.optional(),riskRatingData:ne.optional(),clientAddressData:oe.optional(),clientIdentifierData:re.optional()},vt= exports.u =_zod2.default.object(fe),be={id:_zod2.default.number(),officeId:_zod2.default.number(),clientId:_zod2.default.number(),resourceId:_zod2.default.number(),changes:_zod2.default.record(_zod2.default.string(),_zod2.default.any()).optional()},jt=_zod2.default.object(be).catchall(_zod2.default.any()),ge={id:_zod2.default.number(),officeId:_zod2.default.number(),clientId:_zod2.default.number(),resourceId:_zod2.default.number()},Lt=_zod2.default.object(ge).catchall(_zod2.default.any());var zt=_zod2.default.enum(["offset","limit","orderBy","sortOrder","officeId","displayName","firstname","lastname","externalId","orphansOnly","clientStatus","mobileNo","createdStartDate","creationEndDate","activatedStartDate","activatedEndDate","closedStartDate","closedEndDate"]),Ut= exports.w =_zod2.default.enum(["displayName","accountNo","officeId","officeName"]),_t= exports.x =_zod2.default.enum(["ASC","DESC"]),kt= exports.y =_zod2.default.enum(["ACTIVE","PENDING","INACTIVE"]);var Gt=_zod2.default.object({clientId:_zod2.default.string(),kycVerificationType:_zod2.default.enum(["FULL","PARTIAL"]).default("FULL").optional(),note:_zod2.default.string().optional(),locale:_zod2.default.string().default("en").optional(),dateFormat:_zod2.default.string().default("dd MMMM yyyy").optional(),activationDate:_zod2.default.string().optional(),isActivatedByManualReview:_zod2.default.boolean().default(!1).optional(),manualReviewActivationComments:_zod2.default.string().optional(),skipVerify:_zod2.default.boolean().default(!1),skipActivate:_zod2.default.boolean().default(!1),autoActivate:_zod2.default.boolean().default(!0)}).refine(r=>!(r.skipVerify&&r.skipActivate),{message:"Cannot skip both verification and activation - at least one action must be performed",path:["skipVerify","skipActivate"]}).refine(r=>!(!r.skipVerify&&!r.kycVerificationType),{message:"kycVerificationType is required when skipVerify is false",path:["kycVerificationType"]}).refine(r=>!(!r.skipActivate&&!r.locale),{message:"locale is required when skipActivate is false",path:["locale"]}).refine(r=>!(!r.skipActivate&&!r.dateFormat),{message:"dateFormat is required when skipActivate is false",path:["dateFormat"]}).refine(r=>!(!r.skipActivate&&!r.activationDate),{message:"activationDate is required when skipActivate is false",path:["activationDate"]}),qt= exports.A =_zod2.default.object({id:_zod2.default.string(),clientId:_zod2.default.number(),officeId:_zod2.default.number(),resourceId:_zod2.default.number(),data:_zod2.default.object({clientVerificationStatus:_zod2.default.enum(["PENDING","IN_PROGRESS","APPROVED","REJECTED"]).optional(),clientKycStatus:_zod2.default.string().optional()}).optional()}),Se= exports.B =_zod2.default.object({id:_zod2.default.number(),name:_zod2.default.string(),isMasked:_zod2.default.boolean()}),Re= exports.C =_zod2.default.object({id:_zod2.default.number(),value:_zod2.default.string()}),Ie= exports.D =_zod2.default.object({id:_zod2.default.number(),clientId:_zod2.default.number(),documentType:Se,documentKey:_zod2.default.string(),issuedDate:_zod2.default.array(_zod2.default.number()).optional(),expiryDate:_zod2.default.array(_zod2.default.number()).optional(),description:_zod2.default.string().optional(),status:_zod2.default.string(),issuedBy:_zod2.default.string().optional(),verificationStatus:Re.optional()}),xe= exports.E =_zod2.default.object({id:_zod2.default.number(),value:_zod2.default.string()}),Tt= exports.F =_zod2.default.object({id:_zod2.default.number(),accountNo:_zod2.default.union([_zod2.default.string(),_zod2.default.number()]),displayName:_zod2.default.string(),legalForm:_zod2.default.object({code:_zod2.default.string(),value:_zod2.default.number()}),verificationStatus:xe,identifiers:_zod2.default.array(Ie).optional(),ofLoanCycle:_zod2.default.number(),mobileCountryCode:_zod2.default.string(),ofLoanActive:_zod2.default.number(),activeDepositAccount:_zod2.default.number()}).catchall(_zod2.default.any()),Mt= exports.G =_zod2.default.object({closureReasonId:_zod2.default.string(),locale:_zod2.default.string().optional(),closerDate:_zod2.default.string(),dateFormat:_zod2.default.string()}).refine(r=>!(r.closerDate==null&&r.dateFormat===void 0)),Vt= exports.H =_zod2.default.object({id:_zod2.default.number(),clientId:_zod2.default.number(),resourceId:_zod2.default.number()});var Bt=_zod2.default.object({riskRating:_zod2.default.boolean().optional(),clientAddress:_zod2.default.boolean().optional(),clientIdentifier:_zod2.default.boolean().optional(),staffInSelectedOfficeOnly:_zod2.default.boolean().optional(),checkIdentitiesExpiration:_zod2.default.boolean().optional(),clientAccountAssociate:_zod2.default.boolean().optional()});var m=_zod.z.enum(["ACH","SAMEDAYACH"]),Ce= exports.K =_zod.z.enum(["CREDIT","DEBIT"]),he= exports.L =_zod.z.enum(["CHECKING","SAVINGS"]),L=_zod.z.record(_zod.z.union([_zod.z.string(),_zod.z.number(),_zod.z.boolean()])),Ae=_zod.z.object({type:_zod.z.string(),value:_zod.z.string()}),De= exports.M =_zod.z.object({name:_zod.z.string(),identifier:_zod.z.string()}),j= exports.N =_zod.z.object({identifier:_zod.z.string(),name:_zod.z.string(),accountType:he}),z=_zod.z.object({incomingReturnFile:_zod.z.string().optional(),outgoingReturnFile:_zod.z.string().optional()}),Ne=_zod.z.object({traceMapping:_zod.z.string(),CoreFileKey:_zod.z.string().optional(),CoreBatch:_zod.z.number().optional(),CoreSeq:_zod.z.number().optional()}),Pe= exports.O =_zod.z.object({id:_zod.z.number(),accountNo:_zod.z.string(),displayName:_zod.z.string(),legalForm:_zod.z.object({code:_zod.z.string(),value:_zod.z.string()}),identifiers:_zod.z.array(Ae),ofLoanCycle:_zod.z.number(),ofLoanActive:_zod.z.number(),activeDepositAccount:_zod.z.number()}),U= exports.P ={type:_zod.z.string(),paymentType:m,paymentSubType:_zod.z.string().optional(),currency:_zod.z.string(),fileUrl:_zod.z.string().optional(),amount:_zod.z.number(),externalId:_zod.z.string(),reference:_zod.z.array(_zod.z.string()),rawPaymentDetails:L.optional(),statementDescription:_zod.z.string().optional(),settlementDate:_zod.z.string().optional(),errorCode:_zod.z.string().optional(),errorMessage:_zod.z.string().optional(),createdAt:_zod.z.string().optional(),client:Pe.optional()},Ee= exports.Q ={type:Ce,fileUrl:_zod.z.string(),paymentType:m,currency:_zod.z.literal("USD"),amount:_zod.z.number(),debtor:j,creditor:j.extend({agent:De}),reference:_zod.z.array(_zod.z.string())},Oe= exports.R ={transferStatus:_zod.z.string().optional(),executedAt:_zod.z.string(),queryLimit:_zod.z.number().optional(),paymentType:m,tenantId:_zod.z.string().optional(),accountType:_zod.z.string().optional()},Fe= exports.S ={paymentType:m,externalId:_zod.z.string(),returnFileUrl:_zod.z.string(),errorCode:_zod.z.string(),errorMessage:_zod.z.string(),returnDate:_zod.z.string().optional(),traceNumbers:z.optional(),rawReturnDetails:L.optional(),tenantId:_zod.z.string().optional()},ve= exports.T ={externalId:_zod.z.string(),traceNumbers:Ne,tenantId:_zod.z.string().optional()},_= exports.U ={id:_zod.z.string(),clientId:_zod.z.number(),resourceId:_zod.z.number(),resourceIdentifier:_zod.z.string().optional()},je= exports.V ={totalFilteredRecords:_zod.z.number(),pageItems:_zod.z.array(_zod.z.object(U))},Le= exports.W ={..._,data:_zod.z.object({amount:_zod.z.number()})},Kt=_zod.z.object({errorMessage:_zod.z.string(),paymentType:m}),Ht=_zod.z.object({fileUrl:_zod.z.string(),paymentType:m,traceNumbers:z.optional()}),Yt= exports.X =_zod.z.object(U),Qt= exports.Y =_zod.z.object(Ee),Xt= exports.Z =_zod.z.object(Oe),$t= exports._ =_zod.z.object(Fe),Jt= exports.$ =_zod.z.object(ve),Zt= exports.aa =_zod.z.object(_),en= exports.ba =_zod.z.object(je),tn= exports.ca =_zod.z.object(Le);var ze=_zod.z.enum(["originatorName","originatorAccount","originatorBankRoutingCode","recipientName","recipientAccount","recipientBankRoutingCode","reference","traceNumber","externalId","clientId","dateFormat","locale","originatedBy","paymentRail","paymentType","fromValueDate","toValueDate","fromExecuteDate","toExecuteDate","status","fromReturnDate","toReturnDate","isSettlement","orderBy","sortOrder"]),y= exports.da =_zod.z.enum(["DRAFT","AML_SCREENING","AML_REJECTED","EXECUTION_SCHEDULED","EXECUTION_PROCESSING","EXECUTION_SUCCESS","EXECUTION_FAILURE","RETURNED","CANCELLED","COMPLIANCE_FAILURE","DELETED","UNKNOWN"]),u= exports.ea =_zod.z.enum(["ACH","SAMEDAYACH","WIRE","SWIFT","INTERNAL","FXPAY","CARD"]),f= exports.fa =_zod.z.enum(["CREDIT","DEBIT"]),V= exports.ga =_zod.z.enum(["ASC","DESC"]),sn=ze.options,pn=y.options,cn= exports.ha =u.options,ln= exports.ia =f.options,dn=V.options;var Ue=_zod.z.string().min(1),_e=_zod.z.string().min(1),ke=_zod.z.string().min(1),Ge=_zod.z.string().min(1),qe=_zod.z.string().min(1),Te=_zod.z.string().min(1),Me=_zod.z.string().min(1),Ve=_zod.z.string().min(1),Be=_zod.z.string().min(1),we=_zod.z.union([_zod.z.string(),_zod.z.number()]),We=_zod.z.string(),Ke=_zod.z.string(),He=_zod.z.string(),k=_zod.z.string(),G=_zod.z.string(),q=_zod.z.string(),Ye=_zod.z.boolean(),Qe=_zod.z.string();var Xe={originatorName:Ue.optional(),originatorAccount:_e.optional(),originatorBankRoutingCode:ke.optional(),recipientName:Ge.optional(),recipientAccount:qe.optional(),recipientBankRoutingCode:Te.optional(),reference:Me.optional(),traceNumber:Ve.optional(),externalId:Be.optional(),clientId:we.optional(),dateFormat:We.optional(),locale:Ke.optional(),originatedBy:He.optional(),paymentRail:u.optional(),paymentType:f.optional(),fromValueDate:k.optional(),toValueDate:k.optional(),fromExecuteDate:G.optional(),toExecuteDate:G.optional(),status:y.optional(),fromReturnDate:q.optional(),toReturnDate:q.optional(),isSettlement:Ye.optional(),orderBy:Qe.optional(),sortOrder:V.optional(),limit:_zod.z.number().min(0).optional().describe("Maximum number of records to return. Defaults to 20 if not specified. Set to 0 to return all records."),offset:_zod.z.number().min(0).optional()},un=_zod.z.object(Xe).partial();var $e={id:_zod.z.number(),clientId:_zod.z.number(),amount:_zod.z.number().positive(),correlationId:_zod.z.string(),paymentType:f,paymentRail:u,recipient:_zod.z.object({cardId:_zod.z.string().optional(),recipientType:_zod.z.string(),address:_zod.z.object({line1:_zod.z.string().optional(),line2:_zod.z.string().optional(),stateCode:_zod.z.string().optional(),countryCode:_zod.z.string(),postalCode:_zod.z.string().optional()}),name:_zod.z.string()}),originator:_zod.z.object({accountId:_zod.z.string().optional(),recipientType:_zod.z.string(),address:_zod.z.object({line1:_zod.z.string().optional(),line2:_zod.z.string().optional(),stateCode:_zod.z.string().optional(),countryCode:_zod.z.string(),postalCode:_zod.z.string().optional()}),name:_zod.z.string()}),executedAt:_zod.z.string(),createdAt:_zod.z.string(),externalId:_zod.z.string(),status:y,paymentRailMetaData:_zod.z.record(_zod.z.string(),_zod.z.any()).optional(),currencyData:_zod.z.object({code:_zod.z.string(),name:_zod.z.string(),decimalPlaces:_zod.z.number(),displaySymbol:_zod.z.string(),nameCode:_zod.z.string(),currencyCodeInDigit:_zod.z.number(),isBaseCurrency:_zod.z.boolean()}),currency:_zod.z.string().min(3).max(3)},Je=_zod.z.object($e).catchall(_zod.z.any()),Ze=_zod.z.object({line1:_zod.z.string().optional(),line2:_zod.z.string().optional(),city:_zod.z.string().optional(),stateCode:_zod.z.string().optional(),countryCode:_zod.z.string().optional(),postalCode:_zod.z.string().optional()}).optional(),et=_zod.z.object({accountId:_zod.z.string()}),T=_zod.z.object({name:_zod.z.string(),accountId:_zod.z.string().optional(),recipientId:_zod.z.string().optional(),accountType:_zod.z.enum(["CHECKING","SAVINGS"]).optional(),recipientType:_zod.z.enum(["INDIVIDUAL","BUSINESS"]).optional(),accountEntity:_zod.z.enum(["PERSONAL","BUSINESS"]).optional(),accountNumber:_zod.z.string().optional(),bankInformation:_zod.z.object({routingNumber:_zod.z.string()}).optional(),cardId:_zod.z.string().optional(),contactNumber:_zod.z.string().optional(),address:Ze}),tt= exports.ka ={amount:_zod.z.number().positive(),currency:_zod.z.string().min(3).max(3),paymentRail:u,paymentType:f,originator:et,recipient:T,clientId:_zod.z.string().optional(),correspondent:T.optional(),exchangeRate:_zod.z.number().positive().optional(),externalId:_zod.z.string().optional(),reference:_zod.z.union([_zod.z.string(),_zod.z.array(_zod.z.string())]).optional(),paymentRailMetaData:_zod.z.record(_zod.z.string(),_zod.z.any()).optional(),chargeBearer:_zod.z.enum(["OUR","BEN","SHA"]).optional(),purposeCode:_zod.z.string().optional(),valueDate:_zod.z.string().optional(),executionDate:_zod.z.string().optional()},nt= exports.la =_zod.z.object(tt).catchall(_zod.z.any()).refine(r=>(r.paymentRail==="WIRE"||r.paymentRail==="SWIFT")&&r.recipient?r.recipient.name&&r.recipient.address&&r.recipient.address.stateCode&&r.recipient.address.countryCode&&r.recipient.accountNumber&&r.recipient.accountType&&r.recipient.bankInformation:!0,{message:"For WIRE transfers, recipient address with state and country is mandatory"}).refine(r=>r.paymentRail==="INTERNAL"?r.originator.accountId&&r.recipient.accountId:!0,{message:"For INTERNAL transfers, both originator and recipient accountId are mandatory"}).refine(r=>r.paymentRail==="ACH"||r.paymentRail==="SAMEDAYACH"?r.recipient.name&&r.originator.accountId&&r.recipient.accountType&&r.recipient.recipientType&&r.recipient.accountNumber&&r.recipient.bankInformation:!0,{message:"For ACH/SAMEDAYACH transfers, originator and recipient accountId, recipient accountType, originator recipientType, recipient accountNumber and recipient bankInformation are mandatory"}).refine(r=>r.paymentRail==="CARD"&&r.recipient?r.recipient.cardId:!0,{message:"For CARD payments, recipient cardId is mandatory"}).refine(r=>r.paymentRail==="FXPAY"?r.recipient.recipientId&&r.recipient.name&&r.recipient.accountNumber&&r.recipient.accountType&&r.recipient.recipientType&&r.recipient.accountEntity&&r.paymentRailMetaData:!0,{message:"For FXPAY payments, correspondent name and identifier are mandatory"}),ot= exports.ma ={amount:_zod.z.number().positive().optional(),correspondent:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional(),accountType:_zod.z.string().optional()}).optional(),creditor:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional(),accountType:_zod.z.string().optional(),agent:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional()}).optional()}).optional(),debtor:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional(),accountType:_zod.z.string().optional(),agent:_zod.z.object({name:_zod.z.string().optional(),identifier:_zod.z.string().optional()}).optional()}).optional(),exchangeRate:_zod.z.number().positive().optional(),externalId:_zod.z.string().optional(),errorCode:_zod.z.string().optional(),errorMessage:_zod.z.string().optional(),reference:_zod.z.union([_zod.z.string(),_zod.z.array(_zod.z.string())]).optional(),paymentRailMetaData:_zod.z.record(_zod.z.string(),_zod.z.any()).optional(),status:y.optional()},rt= exports.na =_zod.z.object(ot).catchall(_zod.z.any()),mn= exports.oa =_zod.z.object({totalFilteredRecords:_zod.z.number(),pageItems:_zod.z.array(Je)});var yn=r=>nt.parse(r),fn= exports.qa =r=>rt.parse(r);var bn=_zod.z.object({id:_zod.z.string(),clientId:_zod.z.number(),resourceId:_zod.z.number(),resourceIdentifier:_zod.z.string()}),at=_zod.z.object({line1:_zod.z.string().optional(),line2:_zod.z.string().optional(),city:_zod.z.string().optional(),stateCode:_zod.z.string().optional(),postalCode:_zod.z.string().optional(),countryCode:_zod.z.string().optional()}),it=_zod.z.object({routingNumber:_zod.z.string().optional(),bankName:_zod.z.string().optional(),bankAddress:_zod.z.string().optional(),iban:_zod.z.string().optional(),swiftCode:_zod.z.string().optional()}),M=_zod.z.object({recipientId:_zod.z.string().optional(),accountId:_zod.z.string().optional(),cardId:_zod.z.string().optional(),accountNumber:_zod.z.string().optional(),accountNumberType:_zod.z.string().optional(),recipientType:_zod.z.string().optional(),address:at.optional(),accountType:_zod.z.string().optional(),name:_zod.z.string().optional(),bankInformation:it.optional(),contactNumber:_zod.z.string().optional()}),gn=_zod.z.object({amount:_zod.z.number(),correlationId:_zod.z.string().optional(),reference:_zod.z.string().optional(),paymentType:_zod.z.string().optional(),paymentRail:_zod.z.string().optional(),forFurtherCredit:_zod.z.string().optional(),recipient:M.optional(),originator:M.optional(),paymentRailMetaData:_zod.z.record(_zod.z.any()).optional(),currency:_zod.z.string().optional()});var st=_zod.z.object({routingNumber:_zod.z.string().optional(),swiftCode:_zod.z.string().optional()}),pt=_zod.z.object({destinationCurrency:_zod.z.string().optional(),branchIdentifier:_zod.z.string().optional(),bankIdentifier:_zod.z.number().optional()}),g= exports.sa =_zod.z.object({accountId:_zod.z.string().optional(),accountNumber:_zod.z.string().optional(),accountType:_zod.z.enum(["CHECKING","SAVINGS"]).optional(),paymentRailMetaData:pt.optional(),bankInformation:st.optional()}),S= exports.ta =_zod.z.object({line1:_zod.z.string(),line2:_zod.z.string(),city:_zod.z.string(),stateCode:_zod.z.string(),countryCode:_zod.z.string(),postalCode:_zod.z.string()}),ct= exports.ua ={id:_zod.z.number(),clientId:_zod.z.number(),nickName:_zod.z.string(),firstName:_zod.z.string(),lastName:_zod.z.string(),businessName:_zod.z.string(),emailAddress:_zod.z.string(),phoneNumber:_zod.z.string(),recipientType:_zod.z.string(),paymentRail:_zod.z.string(),isOwnAccount:_zod.z.boolean(),address:S,accountDetailsData:g},B= exports.va =_zod.z.object(ct),hn= exports.wa =_zod.z.array(B),lt= exports.xa ={limit:_zod.z.number().min(1).optional().describe("Maximum number of records to return. Defaults to 20 if not specified. Set to 0 to return all records."),offset:_zod.z.number().min(0).optional(),name:_zod.z.string().optional()},An= exports.ya =_zod.z.object(lt),dt=_zod.z.enum(["INDIVIDUAL","BUSINESS"]),w= exports.za ={nickName:_zod.z.string(),firstName:_zod.z.string().optional(),lastName:_zod.z.string().optional(),businessName:_zod.z.string().optional(),emailAddress:_zod.z.string().email().optional(),phoneNumber:_zod.z.string().optional(),recipientType:dt,paymentRail:u,isOwnAccount:_zod.z.boolean(),address:S.optional(),accountDetails:g.optional()},Dn= exports.Aa =_zod.z.object(w).refine(r=>r.recipientType==="INDIVIDUAL"?r.firstName!==void 0&&r.lastName!==void 0:!0,{message:"firstName and lastName are required for INDIVIDUAL recipient type",path:["firstName","lastName"]}).refine(r=>r.recipientType==="BUSINESS"?r.businessName!==void 0:!0,{message:"businessName is required for BUSINESS recipient type",path:["businessName"]}).refine(r=>r.paymentRail==="WIRE"||r.paymentRail==="SWIFT"?r.address!==void 0&&r.address.stateCode!==void 0&&r.address.countryCode!==void 0:!0,{message:"Address with state code and country code is required for WIRE and SWIFT payment rails",path:["address"]}),ut={clientId:_zod.z.number(),...w},Nn=_zod.z.object(ut).refine(r=>r.recipientType==="INDIVIDUAL"?r.firstName!==void 0&&r.lastName!==void 0:!0,{message:"firstName and lastName are required for INDIVIDUAL recipient type",path:["firstName","lastName"]}).refine(r=>r.recipientType==="BUSINESS"?r.businessName!==void 0:!0,{message:"businessName is required for BUSINESS recipient type",path:["businessName"]}).refine(r=>r.paymentRail==="WIRE"||r.paymentRail==="SWIFT"?r.address!==void 0&&r.address.stateCode!==void 0&&r.address.countryCode!==void 0:!0,{message:"Address with state code and country code is required for WIRE and SWIFT payment rails",path:["address"]}),Pn=_zod.z.object({id:_zod.z.number()}),En= exports.Ba =_zod.z.enum(["name"]);var mt={nickName:_zod.z.string().optional(),firstName:_zod.z.string().optional(),lastName:_zod.z.string().optional(),businessName:_zod.z.string().optional(),emailAddress:_zod.z.string().email().optional(),phoneNumber:_zod.z.string().optional(),recipientType:_zod.z.string().optional(),paymentRail:u.optional(),isOwnAccount:_zod.z.boolean().optional(),address:S.optional(),accountDetailsData:g.optional()},On=_zod.z.object(mt).refine(r=>r.paymentRail&&r.address&&(r.paymentRail==="WIRE"||r.paymentRail==="SWIFT")?r.address.stateCode!==void 0&&r.address.countryCode!==void 0:!0,{message:"When updating address for WIRE/SWIFT payment rails, state code and country code are required",path:["address"]}),Fn=_zod.z.object({clientId:_zod.z.number(),recipientId:_zod.z.number()}),vn=_zod.z.object({success:_zod.z.boolean()}),jn= exports.Ca =_zod.z.object({clientId:_zod.z.number().optional(),id:_zod.z.number()}),Ln=_zod.z.object({limit:_zod.z.number().optional(),start:_zod.z.number().optional()}),zn=_zod.z.object({pages:_zod.z.number(),total:_zod.z.number(),select:_zod.z.array(B)}),Un=_zod.z.object({officeId:_zod.z.number().optional(),clientId:_zod.z.number(),resourceId:_zod.z.number()});var yt=_zod2.default.object({clientId:_zod2.default.number(),addressType:_zod2.default.string(),addressId:_zod2.default.number(),addressTypeId:_zod2.default.number(),isActive:_zod2.default.boolean(),addressLine1:_zod2.default.string(),addressLine2:_zod2.default.string(),addressLine3:_zod2.default.string(),mobileNo:_zod2.default.number(),townVillage:_zod2.default.string(),countyDistrict:_zod2.default.string(),city:_zod2.default.string(),stateProvinceId:_zod2.default.number(),countryName:_zod2.default.string(),stateName:_zod2.default.string(),countryId:_zod2.default.number(),postalCode:_zod2.default.number(),createdBy:_zod2.default.string(),updatedBy:_zod2.default.string(),minifiedAddress:_zod2.default.array(_zod2.default.string())}),Gn= exports.Ea =_zod2.default.array(yt),qn= exports.Fa =_zod2.default.object({clientId:_zod2.default.number(),resourceId:_zod2.default.number()}),Tn= exports.Ga =_zod2.default.object({id:_zod2.default.number(),clientId:_zod2.default.number(),resourceId:_zod2.default.number()}),W=_zod2.default.object({addressLine1:_zod2.default.string(),addressLine2:_zod2.default.string().optional(),addressLine3:_zod2.default.string().optional(),city:_zod2.default.string(),stateProvinceId:_zod2.default.number(),countryId:_zod2.default.number(),postalCode:_zod2.default.string()}),Mn= exports.Ha =W.extend({isActive:_zod2.default.boolean()}).catchall(_zod2.default.any()),Vn= exports.Ia =W.extend({addressId:_zod2.default.number(),addressTypeId:_zod2.default.number()}).catchall(_zod2.default.any()),Bn= exports.Ja =_zod2.default.object({addressId:_zod2.default.number(),isActive:_zod2.default.boolean()}),wn= exports.Ka =_zod2.default.object({clientId:_zod2.default.number(),type:_zod2.default.number()}),Wn= exports.La =_zod2.default.object({clientId:_zod2.default.number(),type:_zod2.default.number()}),Kn= exports.Ma =_zod2.default.object({clientId:_zod2.default.number(),type:_zod2.default.number()}),R= exports.Na =_zod2.default.object({id:_zod2.default.number(),name:_zod2.default.string(),position:_zod2.default.number(),description:_zod2.default.string().optional(),active:_zod2.default.boolean(),mandatory:_zod2.default.boolean(),systemDefined:_zod2.default.boolean(),parentId:_zod2.default.number(),identifier:_zod2.default.string().optional(),codeName:_zod2.default.string(),isMasked:_zod2.default.boolean()}),Hn= exports.Oa =_zod2.default.object({countryIdOptions:_zod2.default.array(R),stateProvinceIdOptions:_zod2.default.array(R),addressTypeIdOptions:_zod2.default.array(R)});var ft=_zod2.default.object({currencyCode:_zod2.default.string(),digitsAfterDecimal:_zod2.default.number(),interestCompoundingPeriodType:_zod2.default.number(),interestPostingPeriodType:_zod2.default.number(),interestCalculationType:_zod2.default.number(),interestCalculationDaysInYearType:_zod2.default.number(),accountingRule:_zod2.default.number(),isSecuredCreditProduct:_zod2.default.boolean(),name:_zod2.default.string(),shortName:_zod2.default.string(),description:_zod2.default.string(),inMultiplesOf:_zod2.default.number(),isLinkedToFloatingInterestRates:_zod2.default.boolean(),nominalAnnualInterestRate:_zod2.default.number(),nominalAnnualPenaltyInterestRate:_zod2.default.number(),gracePeriod:_zod2.default.number(),nominalCashAdvanceInterestRate:_zod2.default.number(),minimumPayCalculationRate:_zod2.default.number(),minimumPayFixedAmount:_zod2.default.number(),statementDay:_zod2.default.number(),charges:_zod2.default.array(_zod2.default.object({id:_zod2.default.number(),isMandatory:_zod2.default.boolean()})).optional(),disputesInSuspenseAccountId:_zod2.default.number().optional(),graceForArrearsAging:_zod2.default.number().optional(),fundSourceAccountId:_zod2.default.number().optional(),receivableInterestAccountId:_zod2.default.number().optional(),receivablePenaltyAccountId:_zod2.default.number().optional(),transfersInSuspenseAccountId:_zod2.default.number().optional(),creditPortfolioAccountId:_zod2.default.number().optional(),receivableFeeAccountId:_zod2.default.number().optional(),interestOnIncomeAccountId:_zod2.default.number().optional(),incomeFromPenaltyAccountId:_zod2.default.number().optional(),incomeFromFeeAccountId:_zod2.default.number().optional(),incomeFromRecoveryAccountId:_zod2.default.number().optional(),writeOffAccountId:_zod2.default.number().optional(),overpaymentLiabilityAccountId:_zod2.default.number().optional(),paymentChannelToFundSourceMappings:_zod2.default.string().optional(),penaltyToIncomeAccountMappings:_zod2.default.string().optional(),feeToIncomeAccountMappings:_zod2.default.string().optional(),locale:_zod2.default.string().optional()}),Xn= exports.Qa =_zod2.default.object({resourceId:_zod2.default.number()}),$n= exports.Ra =_zod2.default.object({id:_zod2.default.string(),resourceId:_zod2.default.number(),changes:_zod2.default.object({name:_zod2.default.string().optional(),shortName:_zod2.default.string().optional(),inMultiplesOf:_zod2.default.number().optional(),locale:_zod2.default.string().optional(),nominalAnnualInterestRate:_zod2.default.number().optional(),statementDay:_zod2.default.number().optional(),minimumPayCalculationRate:_zod2.default.number().optional(),minimumPayFixedAmount:_zod2.default.number().optional(),charges:_zod2.default.array(_zod2.default.object({id:_zod2.default.number(),isMandatory:_zod2.default.boolean()})).optional(),paymentChannelToFundSourceMappings:_zod2.default.array(_zod2.default.unknown()).optional(),penaltyToIncomeAccountMappings:_zod2.default.array(_zod2.default.unknown()).optional(),feeToIncomeAccountMappings:_zod2.default.array(_zod2.default.unknown()).optional()}).catchall(_zod2.default.any()).optional()}),bt= exports.Sa =_zod2.default.object({id:_zod2.default.number(),name:_zod2.default.string(),shortName:_zod2.default.string(),description:_zod2.default.string(),currency:_zod2.default.object({code:_zod2.default.string(),name:_zod2.default.string(),decimalPlaces:_zod2.default.number(),inMultiplesOf:_zod2.default.number(),displaySymbol:_zod2.default.string(),nameCode:_zod2.default.string(),displayLabel:_zod2.default.string()}),nominalAnnualInterestRate:_zod2.default.number(),interestCompoundingPeriodType:_zod2.default.object({id:_zod2.default.number(),code:_zod2.default.string(),value:_zod2.default.string()}),interestPostingPeriodType:_zod2.default.object({id:_zod2.default.number(),code:_zod2.default.string(),value:_zod2.default.string()}),interestCalculationType:_zod2.default.object({id:_zod2.default.number(),code:_zod2.default.string(),value:_zod2.default.string()}),interestCalculationDaysInYearType:_zod2.default.object({id:_zod2.default.number(),code:_zod2.default.string(),value:_zod2.default.string()}),nominalCashAdvanceInterestRate:_zod2.default.number(),nominalAnnualPenaltyInterestRate:_zod2.default.number(),accountingRule:_zod2.default.object({id:_zod2.default.number(),code:_zod2.default.string(),value:_zod2.default.string()}),charges:_zod2.default.array(_zod2.default.object({id:_zod2.default.number(),isMandatory:_zod2.default.boolean()})),isLinkedToFloatingInterestRates:_zod2.default.boolean(),isFloatingInterestRateCalculationAllowed:_zod2.default.boolean(),isUsedForSuspenseAccounting:_zod2.default.boolean(),isLinkedWithFundSourceAccount:_zod2.default.boolean(),isSecuredCreditProduct:_zod2.default.boolean(),reserveProduct:_zod2.default.object({id:_zod2.default.number(),withdrawalFeeForTransfers:_zod2.default.boolean(),allowOverdraft:_zod2.default.boolean(),enforceMinRequiredBalance:_zod2.default.boolean(),withHoldTax:_zod2.default.boolean(),isLinkedToFloatingInterestRates:_zod2.default.boolean(),isFloatingInterestRateCalculationAllowed:_zod2.default.boolean(),isUsedForSuspenseAccounting:_zod2.default.boolean(),isLinkedWithFundSourceAccount:_zod2.default.boolean(),isSkipCollectTransferCharge:_zod2.default.boolean(),isReservedProduct:_zod2.default.boolean()}).optional(),gracePeriod:_zod2.default.number(),minimumPayCalculationRate:_zod2.default.number()}),Jn= exports.Ta =_zod2.default.array(bt),Zn= exports.Ua =ft.partial();var K=(l=>(l[l.INVALID=0]="INVALID",l[l.LOAN=1]="LOAN",l[l.SAVINGS=2]="SAVINGS",l[l.CLIENT=3]="CLIENT",l[l.SHARES=4]="SHARES",l[l.TRANSFER=5]="TRANSFER",l[l.CREDIT_CARD=6]="CREDIT_CARD",l))(K||{}),H=(i=>(i[i.INVALID=0]="INVALID",i[i.DISBURSEMENT=1]="DISBURSEMENT",i[i.SPECIFIED_DUE_DATE=2]="SPECIFIED_DUE_DATE",i[i.SAVINGS_ACTIVATION=3]="SAVINGS_ACTIVATION",i[i.SAVINGS_CLOSURE=4]="SAVINGS_CLOSURE",i[i.WITHDRAWAL_FEE=5]="WITHDRAWAL_FEE",i[i.ANNUAL_FEE=6]="ANNUAL_FEE",i[i.MONTHLY_FEE=7]="MONTHLY_FEE",i[i.INSTALMENT_FEE=8]="INSTALMENT_FEE",i[i.OVERDUE_INSTALLMENT=9]="OVERDUE_INSTALLMENT",i[i.OVERDRAFT_FEE=10]="OVERDRAFT_FEE",i[i.WEEKLY_FEE=11]="WEEKLY_FEE",i[i.TRANCHE_DISBURSEMENT=12]="TRANCHE_DISBURSEMENT",i[i.SHAREACCOUNT_ACTIVATION=13]="SHAREACCOUNT_ACTIVATION",i[i.SHARE_PURCHASE=14]="SHARE_PURCHASE",i[i.SHARE_REDEEM=15]="SHARE_REDEEM",i[i.SAVINGS_NOACTIVITY_FEE=16]="SAVINGS_NOACTIVITY_FEE",i[i.DOMESTIC_ATM_WITHDRAWAL_FEE=21]="DOMESTIC_ATM_WITHDRAWAL_FEE",i[i.INTERNATIONAL_ATM_WITHDRAWAL_FEE=22]="INTERNATIONAL_ATM_WITHDRAWAL_FEE",i[i.INTERNATIONAL_TRANSACTIONS_FEE=23]="INTERNATIONAL_TRANSACTIONS_FEE",i[i.EXTERNAL_CARD_PUSH_TRANSACTION_FEE=24]="EXTERNAL_CARD_PUSH_TRANSACTION_FEE",i[i.EXTERNAL_CARD_PULL_TRANSACTION_FEE=25]="EXTERNAL_CARD_PULL_TRANSACTION_FEE",i[i.TRANSFER_EXECUTE=26]="TRANSFER_EXECUTE",i[i.SAVINGS_DORMANT_FEE=27]="SAVINGS_DORMANT_FEE",i[i.SAVINGS_ESCHEAT_FEE=28]="SAVINGS_ESCHEAT_FEE",i[i.SPECIFIED_MCC_FEE=29]="SPECIFIED_MCC_FEE",i[i.CARD_ORDERING_FEE=30]="CARD_ORDERING_FEE",i[i.CARD_RE_ORDERING_FEE=31]="CARD_RE_ORDERING_FEE",i[i.TRANSFER_RETURN=32]="TRANSFER_RETURN",i[i.LATE_PAYMENT_FEE=33]="LATE_PAYMENT_FEE",i[i.RETURN_PAYMENT_FEE=34]="RETURN_PAYMENT_FEE",i[i.OVER_CREDIT_LIMIT_FEE=35]="OVER_CREDIT_LIMIT_FEE",i[i.STOP_PAYMENT_FEE=36]="STOP_PAYMENT_FEE",i[i.JOINING_FEE=37]="JOINING_FEE",i[i.DIRECT_DEPOSIT_CASH_ADVANCE_FEE=38]="DIRECT_DEPOSIT_CASH_ADVANCE_FEE",i[i.PHYSICAL_CARD_ORDERING_FEE=39]="PHYSICAL_CARD_ORDERING_FEE",i[i.OVERDRAFT_WITHDRAWAL_FEE=40]="OVERDRAFT_WITHDRAWAL_FEE",i[i.NSF_FEE=41]="NSF_FEE",i[i.FX_TRADE_BUY_CURRENCY_FEE=42]="FX_TRADE_BUY_CURRENCY_FEE",i))(H||{}),Y=(c=>(c[c.INVALID=0]="INVALID",c[c.FLAT=1]="FLAT",c[c.PERCENT_OF_AMOUNT=2]="PERCENT_OF_AMOUNT",c[c.PERCENT_OF_AMOUNT_AND_INTEREST=3]="PERCENT_OF_AMOUNT_AND_INTEREST",c[c.PERCENT_OF_INTEREST=4]="PERCENT_OF_INTEREST",c[c.PERCENT_OF_DISBURSEMENT_AMOUNT=5]="PERCENT_OF_DISBURSEMENT_AMOUNT",c[c.PERCENT_OF_MIN_DUE_AMOUNT=6]="PERCENT_OF_MIN_DUE_AMOUNT",c[c.PERCENT_OF_OUTSTANDING_AMOUNT=7]="PERCENT_OF_OUTSTANDING_AMOUNT",c))(Y||{}),Q=(d=>(d[d.REGULAR=0]="REGULAR",d[d.ACCOUNT_TRANSFER=1]="ACCOUNT_TRANSFER",d))(Q||{}),X=(d=>(d.IN="IN",d.OUT="OUT",d))(X||{}),$=(d=>(d.CREDIT="CREDIT",d.DEBIT="DEBIT",d))($||{}),J=(b=>(b.ALL="ALL",b.ACTIVE="ACTIVE",b.INACTIVE="INACTIVE",b))(J||{}),no= exports.Va =_zod.z.object({chargeStatus:_zod.z.nativeEnum(J).optional()}),gt= exports.Wa =_zod.z.object({name:_zod.z.string(),chargeAppliesTo:_zod.z.nativeEnum(K),currencyCode:_zod.z.string(),locale:_zod.z.string().optional(),amount:_zod.z.number().nonnegative(),chargeTimeType:_zod.z.nativeEnum(H),chargeCalculationType:_zod.z.nativeEnum(Y),chargePaymentMode:_zod.z.nativeEnum(Q).optional(),penalty:_zod.z.boolean().optional(),active:_zod.z.boolean().optional(),minCap:_zod.z.number().optional(),maxCap:_zod.z.number().optional(),feeOnMonthDay:_zod.z.string().optional(),feeInterval:_zod.z.number().optional(),monthDayFormat:_zod.z.string().optional(),feeFrequency:_zod.z.number().optional(),incomeAccountId:_zod.z.number().optional(),taxGroupId:_zod.z.number().optional(),ignoreChargesOnNegativeBalance:_zod.z.boolean().optional(),applyToExistingAccount:_zod.z.boolean().optional(),productIDs:_zod.z.array(_zod.z.number()).optional(),paymentRail:_zod.z.number().optional(),paymentDirection:_zod.z.nativeEnum(X).optional(),transferType:_zod.z.nativeEnum($).optional(),clientClassificationId:_zod.z.number().optional(),applyUpfrontCharge:_zod.z.boolean().optional(),collectOnlyTotalDeferCharge:_zod.z.boolean().optional(),numberOfExemptedFee:_zod.z.union([_zod.z.string(),_zod.z.number()]).optional(),exemptedFeeAmount:_zod.z.union([_zod.z.string(),_zod.z.number()]).optional(),reverseOnTransferFail:_zod.z.boolean().optional(),chargeDueDateOnAccountActivation:_zod.z.boolean().optional()}),St= exports.Xa =gt.partial(),oo= exports.Ya =_zod.z.object({id:_zod.z.string(),resourceId:_zod.z.number(),changes:St.optional()}),Rt= exports.Za ={resourceId:_zod.z.number(),id:_zod.z.string()},ro= exports._a =_zod.z.object(Rt),ao= exports.$a =_zod.z.object({id:_zod.z.number(),name:_zod.z.string(),active:_zod.z.boolean(),penalty:_zod.z.boolean(),currency:_zod.z.object({code:_zod.z.string(),name:_zod.z.string(),decimalPlaces:_zod.z.number(),displaySymbol:_zod.z.string(),nameCode:_zod.z.string(),displayLabel:_zod.z.string()}),amount:_zod.z.number(),chargeTimeType:_zod.z.object({id:_zod.z.number(),code:_zod.z.string(),value:_zod.z.string()}),chargeAppliesTo:_zod.z.object({id:_zod.z.number(),code:_zod.z.string(),value:_zod.z.string()}),chargeCalculationType:_zod.z.object({id:_zod.z.number(),code:_zod.z.string(),value:_zod.z.string()}),chargePaymentMode:_zod.z.object({id:_zod.z.number(),code:_zod.z.string(),value:_zod.z.string()}),minCap:_zod.z.number(),maxCap:_zod.z.number(),savingsProducts:_zod.z.array(_zod.z.object({})),applyToExistingAccount:_zod.z.boolean(),ignoreChargesOnNegativeBalance:_zod.z.boolean(),isMandatory:_zod.z.boolean(),chargeDueDateOnAccountActivation:_zod.z.boolean(),clientClassification:_zod.z.object({id:_zod.z.number(),name:_zod.z.string()}),applyUpfrontCharge:_zod.z.boolean(),numberOfExemptedFee:_zod.z.number(),collectOnlyTotalDeferCharge:_zod.z.boolean(),reverseOnTransferFail:_zod.z.boolean(),createdByUsername:_zod.z.string(),createdDate:_zod.z.array(_zod.z.number()),exemptedFeeAmount:_zod.z.number()});exports.a = ae; exports.b = Ct; exports.c = ie; exports.d = ht; exports.e = se; exports.f = At; exports.g = pe; exports.h = Dt; exports.i = ce; exports.j = Nt; exports.k = le; exports.l = de; exports.m = ue; exports.n = Pt; exports.o = me; exports.p = Et; exports.q = Ot; exports.r = ye; exports.s = Ft; exports.t = fe; exports.u = vt; exports.v = zt; exports.w = Ut; exports.x = _t; exports.y = kt; exports.z = Gt; exports.A = qt; exports.B = Se; exports.C = Re; exports.D = Ie; exports.E = xe; exports.F = Tt; exports.G = Mt; exports.H = Vt; exports.I = Bt; exports.J = m; exports.K = Ce; exports.L = he; exports.M = De; exports.N = j; exports.O = Pe; exports.P = U; exports.Q = Ee; exports.R = Oe; exports.S = Fe; exports.T = ve; exports.U = _; exports.V = je; exports.W = Le; exports.X = Yt; exports.Y = Qt; exports.Z = Xt; exports._ = $t; exports.$ = Jt; exports.aa = Zt; exports.ba = en; exports.ca = tn; exports.da = y; exports.ea = u; exports.fa = f; exports.ga = V; exports.ha = cn; exports.ia = ln; exports.ja = $e; exports.ka = tt; exports.la = nt; exports.ma = ot; exports.na = rt; exports.oa = mn; exports.pa = yn; exports.qa = fn; exports.ra = st; exports.sa = g; exports.ta = S; exports.ua = ct; exports.va = B; exports.wa = hn; exports.xa = lt; exports.ya = An; exports.za = w; exports.Aa = Dn; exports.Ba = En; exports.Ca = jn; exports.Da = yt; exports.Ea = Gn; exports.Fa = qn; exports.Ga = Tn; exports.Ha = Mn; exports.Ia = Vn; exports.Ja = Bn; exports.Ka = wn; exports.La = Wn; exports.Ma = Kn; exports.Na = R; exports.Oa = Hn; exports.Pa = ft; exports.Qa = Xn; exports.Ra = $n; exports.Sa = bt; exports.Ta = Jn; exports.Ua = Zn; exports.Va = no; exports.Wa = gt; exports.Xa = St; exports.Ya = oo; exports.Za = Rt; exports._a = ro; exports.$a = ao;
@@ -0,0 +1,15 @@
1
+ import{c as u,e as i,f as c,g as d}from"./chunk-J43ILQC2.mjs";import{print as v}from"graphql";import h from"axios";import{v4 as f}from"uuid";import*as l from"https";var S=e=>e&&(e.startsWith("Bearer ")?e:`Bearer ${e}`),n=async e=>{let a=()=>`RequestUUID=${f()}`,r=h.create({timeout:e.axiosConfig?.timeout||29e3,baseURL:e.baseUrl,headers:{"Content-Type":"application/json; charset=utf-8","JWT-Token":e?.jwtToken||void 0,Authorization:e.bearerToken?S(e.bearerToken):void 0,"trace-id":a(),tenantId:e.tenantId,...e.axiosConfig?.headers},httpsAgent:new l.Agent({rejectUnauthorized:!0,keepAlive:e.axiosConfig?.keepAlive})});return e.logger&&e.logger(r),r};var m=e=>({input:e,metadata:{commandName:e.operationName||"GraphQL",path:"/graphql",method:"POST"},execute:async t=>{let a=await n(t),r=t.graphqlPath||"/graphql";try{let s=typeof e.command=="string"?e.command:v(e.command),{data:o}=await a.post(r,{query:s,variables:e.variables,operationName:e.operationName});return o.errors?.length&&c(o.errors),o.data||c([{message:"No data returned from GraphQL query"}]),o.data}catch(s){if(u(s))throw s;d(s)}}});var D=({token:e,deliveryMethod:t})=>{let a=`mutation requestAccessTokenFromOTP($token: String!, $deliveryMethod: requestOTPDeliveryMethod!) {
2
+ requestAccessTokenFromOTP(token: $token, deliveryMethod: $deliveryMethod) {
3
+ token
4
+ }
5
+ }`;return{input:{token:e,deliveryMethod:t},metadata:{commandName:"RequestAccessToken",path:"",method:"POST"},executeGQL:async r=>{let s=m({command:a,variables:{token:e,deliveryMethod:t},operationName:"requestAccessTokenFromOTP"});if(!s.execute)throw new Error("Failed to create GraphQL request");return(await s.execute(r))?.requestAccessTokenFromOTP}}},k=()=>{let e=`query getAuthenticationDetail {
6
+ getAuthenticationDetail {
7
+ ...authenticationDetail
8
+ }
9
+ }
10
+ fragment authenticationDetail on AuthenticationDetail {
11
+ isSelfServiceUser
12
+ isMFARequired
13
+ isPasswordExpired
14
+ mfaDeliveryMethods
15
+ }`;return{input:{},metadata:{commandName:"CheckSelfServiceAccess",path:"",method:"GET"},executeGQL:async t=>{let a=m({command:e,operationName:"getAuthenticationDetail"});if(!a.execute)throw new Error("Failed to create GraphQL request");return(await a.execute(t))?.getAuthenticationDetail}}},w=()=>{let e="/v1/userdetails";return{input:{},metadata:{commandName:"GetUserDetail",path:e,method:"GET"},execute:async t=>{let a=await n(t);try{return(await a.get(e)).data}catch(r){return i(r)}}}},G=e=>{let t="/v1/users";return{input:{data:e},metadata:{commandName:"EnableSelfServiceAccess",path:t,method:"POST"},execute:async a=>{let r=await n(a);try{return(await r.post(t,{...e,isSelfServiceUser:!0})).data}catch(s){return i(s)}}}},L=e=>{let{userId:t,...a}=e,r=`/v1/users/${t}`;return{input:{data:e},metadata:{commandName:"UpdateSelfServiceUser",path:r,method:"PUT"},execute:async s=>{let o=await n(s);try{return(await o.put(r,{...a,isSelfServiceUser:!0})).data}catch(p){return i(p)}}}},I=e=>{let t=`/v1/users/${e}`;return{input:{userId:e},metadata:{commandName:"DeleteSelfServiceUser",path:t,method:"DELETE"},execute:async a=>{let r=await n(a);try{return(await r.delete(t)).data}catch(s){return i(s)}}}};export{n as a,m as b,D as c,k as d,w as e,G as f,L as g,I as h};
@@ -0,0 +1 @@
1
+ import f from"axios";var a=e=>{if(typeof e=="string")return e;if(e==null)return"Unknown error";if(typeof e=="object")try{return"message"in e&&typeof e.message=="string"?e.message:JSON.stringify(e)}catch{return String(e)}return String(e)},O=({message:e,statusCode:s,code:r,requestId:n,originalError:i})=>{let t=new Error(a(e));return t.name="CommandError",t.statusCode=s,t.code=r,t.requestId=n,t.originalError=i,t},d=e=>e?e===401?"AUTHENTICATION_ERROR":e===403?"AUTHORIZATION_ERROR":e===404?"NOT_FOUND":e===422||e===400?"VALIDATION_ERROR":e===429?"RATE_LIMIT":e>=500?"SERVER_ERROR":"UNKNOWN_ERROR":"UNKNOWN_ERROR",o=e=>{let s=new Error(a(e.message));return s.name="SdkError",s.statusCode=e.statusCode,s.classification=e.classification||d(e.statusCode),s.requestId=e.requestId,s.details=e.details,e.cause&&(s.cause=e.cause),s},A=e=>typeof e=="object"&&e!==null&&"name"in e&&e.name==="SdkError",N=e=>typeof e=="object"&&e!==null&&"name"in e&&e.name==="CommandError",u=e=>{let s={};return!e||typeof e!="object"||(s.errorCode=e.userMessageGlobalisationCode||e.errorCode||e.code||e.error_code,Array.isArray(e.errors)&&e.errors.length>0&&(s.validationErrors=e.errors.map(r=>({field:r.parameterName||r.field||"unknown",message:r.defaultUserMessage||r.message||r.developerMessage||String(r),code:r.userMessageGlobalisationCode,value:r.value,args:r.args?.map(n=>n.value)})))),s},R=e=>{let s=new Error(e.message);return s.name="AxiosError",s.code=e.code,s.status=e.response?.status,s};var E=e=>{if(f.isAxiosError(e)){let s=e.response?.data,r=e.response?.status||e.status,n=e.response?.headers?.["x-request-id"],i;e.request&&!e.response?i="NETWORK_ERROR":i=d(r);let t;e.request&&!e.response?t="Network error: No response received from server":s?typeof s=="string"?t=s:typeof s=="object"?t=s.message||s.error||s.userMessage||s.defaultUserMessage||`Request failed with status ${r}`:t=`Request failed with status ${r}`:t=e.message||`Request failed with status ${r}`;let c=u(s);throw o({message:t,statusCode:r,classification:i,requestId:n,details:Object.keys(c).length>0?c:void 0,cause:R(e)})}throw e instanceof Error?o({message:e.message,classification:"UNKNOWN_ERROR",cause:e}):o({message:a(e),classification:"UNKNOWN_ERROR"})};var l=e=>{if(!e)return"GRAPHQL_ERROR";let s=e.code?.toUpperCase(),r=e.classification?.toUpperCase();return s==="UNAUTHENTICATED"||r==="AUTHENTICATIONERROR"?"AUTHENTICATION_ERROR":s==="FORBIDDEN"||s==="RESTRICTED"||r==="AUTHORIZATIONERROR"?"AUTHORIZATION_ERROR":s==="BAD_USER_INPUT"||r==="VALIDATIONERROR"?"VALIDATION_ERROR":s==="NOT_FOUND"?"NOT_FOUND":r==="DATAFETCHINGEXCEPTION"?"AUTHORIZATION_ERROR":"GRAPHQL_ERROR"},g=e=>{let s={};e.path&&e.path.length>0&&(s.path=e.path.map(String)),e.extensions?.code&&(s.graphqlCode=e.extensions.code,s.errorCode=e.extensions.code);let r=e.message.match(/Field '(\w+)'/);return r&&(s.validationErrors=[{field:r[1],message:e.message}]),!s.errorCode&&e.message.includes("invalid value")&&(s.errorCode="GRAPHQL_VALIDATION_ERROR"),s},h=e=>{let s=e[0],r=l(s.extensions),n=g(s);throw e.length>1&&(n.validationErrors=e.slice(1).map(i=>({field:i.path?.join(".")||"unknown",message:i.message}))),o({message:s.message,classification:r,details:Object.keys(n).length>0?n:void 0})},y=e=>{throw f.isAxiosError(e)&&E(e),e instanceof Error?o({message:e.message,classification:"GRAPHQL_ERROR",cause:e}):o({message:a(e),classification:"GRAPHQL_ERROR"})};export{O as a,o as b,A as c,N as d,E as e,h as f,y as g};